FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
AuvHullLaw.h
1
11#pragma once
12
13#include "AuvFoil.h"
14#include <marenv/marenv.h>
15#include <string>
16
170namespace auv_hull
171{
177struct Hull
178{
179 double radius = 0.0;
180 double volume = 0.0;
181 double frontalArea = 0.0;
182 double mass = 0.0;
183 double ixx = 0.0;
184 double iyy = 0.0;
185 double izz = 0.0;
186};
187
193enum class RudderPlane
194{
195 Dive,
196 Yaw
197};
198
200struct Rudder
201{
204 double area = 0.016;
205 double pos[3] = {-0.85, 0.0, 0.0};
206 double maxDeflection = 0.35;
207};
208
219Hull HullPropertiesOf(double length, double diameter, double averageDensity);
220
238void AxialDragWrench(const double relVel_d[3], double rho, double frontalArea,
239 double axialDragCoeff, double wrench_d[6]);
240
252double AxialDragDerivative(double surge, double rho, double frontalArea, double axialDragCoeff);
253
255constexpr int kSectionCount = 3;
256
264
274constexpr double kCrossFlowSpeedEpsilon = 1.0e-12;
275
278{
279 double x[kSectionCount] = {};
280 double diameter[kSectionCount] = {};
281 double length[kSectionCount] = {};
282};
283
286{
288 double axialDrag = 0.0;
289 double crossFlowDrag = 0.0;
290 double rollDampingLinear = 0.0;
291 double rollDampingQuadratic = 0.0;
292};
293
322void CrossFlowStripWrench(const double relVel_d[3], const double omega_d[3],
323 double rho, double crossFlowDragCoeff, int sectionCount, const double* sectionX,
324 const double* sectionDiameter, const double* sectionLength, double wrench_d[6]);
325
355void AddCrossFlowStripDerivative(const double relVel_d[3], const double omega_d[3], double rho,
356 double crossFlowDragCoeff, int sectionCount, const double* sectionX,
357 const double* sectionDiameter, const double* sectionLength, double dWrench_dVelocity[6][6]);
358
389void SlenderBodyLiftWrench(const double relVel_d[3], const double omega_d[3], double rho,
390 int sectionCount, const double* sectionX, const double* sectionDiameter,
391 const double* sectionLength, double wrench_d[6], double (*dWrench_dVelocity)[6] = nullptr);
392
403double RollDampingMoment(double rollRate, double linear, double quadratic);
404
412double RollDampingDerivative(double rollRate, double linear, double quadratic);
413
421constexpr double kInflowSpeedEpsilon = 1.0e-12;
422
440void RudderWrench(RudderPlane plane, const double relVel_d[3], const double omega_d[3],
441 double deflection, const Rudder& rudder, double wrench_d[6]);
442
472void RudderWrenchJacobian(RudderPlane plane, const double relVel_d[3],
473 const double omega_d[3], double deflection, const Rudder& rudder,
474 double dWrench_dVelocity[6][6], double dWrench_dDeflection[6]);
475
495void HullLoadDerivative(const Hull& hull, const Sections& sections, const Rudder& rudder,
496 const Coefficients& c, const double relVel_d[3], const double omega_d[3],
497 double rudderDive, double rudderYaw, double dWrench_dVelocity[6][6]);
498
525void AddHullLoad(const Hull& hull, const Sections& sections, const Rudder& rudder, const Coefficients& c,
526 const double relVel_d[3], const double omega_d[3], double rudderDive, double rudderYaw,
527 double wrench[6]);
528
548std::string FinAuthorityWarning(const std::string& simObjectName, const Hull& hull, const Rudder& rudder,
549 const Coefficients& c, double cogZ, double cruiseThrust, double diveAngle);
550} // namespace auv_hull
void AddCrossFlowStripDerivative(const double relVel_d[3], const double omega_d[3], double rho, double crossFlowDragCoeff, int sectionCount, const double *sectionX, const double *sectionDiameter, const double *sectionLength, double dWrench_dVelocity[6][6])
void AxialDragWrench(const double relVel_d[3], double rho, double frontalArea, double axialDragCoeff, double wrench_d[6])
constexpr int kSectionCount
The number of hull sections the cross-flow strip theory divides the hull into.
Definition AuvHullLaw.h:255
double RollDampingMoment(double rollRate, double linear, double quadratic)
void CrossFlowStripWrench(const double relVel_d[3], const double omega_d[3], double rho, double crossFlowDragCoeff, int sectionCount, const double *sectionX, const double *sectionDiameter, const double *sectionLength, double wrench_d[6])
void HullLoadDerivative(const Hull &hull, const Sections &sections, const Rudder &rudder, const Coefficients &c, const double relVel_d[3], const double omega_d[3], double rudderDive, double rudderYaw, double dWrench_dVelocity[6][6])
void RudderWrench(RudderPlane plane, const double relVel_d[3], const double omega_d[3], double deflection, const Rudder &rudder, double wrench_d[6])
Hull HullPropertiesOf(double length, double diameter, double averageDensity)
constexpr double kCrossFlowSpeedEpsilon
Definition AuvHullLaw.h:274
void SlenderBodyLiftWrench(const double relVel_d[3], const double omega_d[3], double rho, int sectionCount, const double *sectionX, const double *sectionDiameter, const double *sectionLength, double wrench_d[6], double(*dWrench_dVelocity)[6]=nullptr)
double RollDampingDerivative(double rollRate, double linear, double quadratic)
constexpr double kInflowSpeedEpsilon
Definition AuvHullLaw.h:421
RudderPlane
Definition AuvHullLaw.h:194
@ Dive
The stern planes, working in the body x-z plane and commanded by RudderDive.
@ Yaw
The turning fins, working in the body x-y plane and commanded by RudderYaw.
std::string FinAuthorityWarning(const std::string &simObjectName, const Hull &hull, const Rudder &rudder, const Coefficients &c, double cogZ, double cruiseThrust, double diveAngle)
void AddHullLoad(const Hull &hull, const Sections &sections, const Rudder &rudder, const Coefficients &c, const double relVel_d[3], const double omega_d[3], double rudderDive, double rudderYaw, double wrench[6])
void RudderWrenchJacobian(RudderPlane plane, const double relVel_d[3], const double omega_d[3], double deflection, const Rudder &rudder, double dWrench_dVelocity[6][6], double dWrench_dDeflection[6])
double AxialDragDerivative(double surge, double rho, double frontalArea, double axialDragCoeff)
double DefaultCrossFlowDragCoeff()
constexpr double seawaterDensity
Ocean water density [kg/m^3].
Definition marenv.h:20
Definition AuvFoil.h:82
The coefficients of the hull laws. rho is a copy of the water density of the host (as Rudder::rho is)...
Definition AuvHullLaw.h:286
double rho
The density of the sea water, kg/m³.
Definition AuvHullLaw.h:287
double rollDampingQuadratic
The quadratic roll damping, N·m·s².
Definition AuvHullLaw.h:291
double crossFlowDrag
The two-dimensional cross-flow drag coefficient of a section.
Definition AuvHullLaw.h:289
double rollDampingLinear
The linear roll damping, N·m·s.
Definition AuvHullLaw.h:290
double axialDrag
The drag coefficient on the frontal area.
Definition AuvHullLaw.h:288
Definition AuvHullLaw.h:178
double mass
Vehicle mass, kg.
Definition AuvHullLaw.h:182
double izz
Yaw inertia about the body z axis, kg·m².
Definition AuvHullLaw.h:185
double frontalArea
Frontal area of the cylinder, pi r², m².
Definition AuvHullLaw.h:181
double ixx
Roll inertia about the body x axis, kg·m².
Definition AuvHullLaw.h:183
double radius
Hull radius, m.
Definition AuvHullLaw.h:179
double volume
Displaced volume, m³.
Definition AuvHullLaw.h:180
double iyy
Pitch inertia about the body y axis, kg·m².
Definition AuvHullLaw.h:184
Everything one fin plane needs beyond its inflow and its commanded deflection.
Definition AuvHullLaw.h:201
AuvFoilProperties foil
The lift and drag coefficient parameters.
Definition AuvHullLaw.h:202
double pos[3]
Where the fin wrench acts, body frame, m.
Definition AuvHullLaw.h:205
double rho
The density of the sea water, kg/m³.
Definition AuvHullLaw.h:203
double maxDeflection
The mechanical stop on the command, rad.
Definition AuvHullLaw.h:206
double area
The planform area of the fin plane, m².
Definition AuvHullLaw.h:204
The strip-theory sections of the hull, kSectionCount of each array.
Definition AuvHullLaw.h:278
double diameter[kSectionCount]
The cross-flow diameter of each section, m.
Definition AuvHullLaw.h:280
double x[kSectionCount]
The body-frame x of each section centroid, m.
Definition AuvHullLaw.h:279
double length[kSectionCount]
The length of each section, m.
Definition AuvHullLaw.h:281