FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
AuvHullLaw.h
1
11#pragma once
12
13#include "AuvFoil.h"
14
168namespace auv_hull
169{
175struct Hull
176{
177 double radius = 0.0;
178 double volume = 0.0;
179 double frontalArea = 0.0;
180 double mass = 0.0;
181 double ixx = 0.0;
182 double iyy = 0.0;
183 double izz = 0.0;
184};
185
191enum class RudderPlane
192{
193 Dive,
194 Yaw
195};
196
198struct Rudder
199{
201 double rho = 1025.0;
202 double area = 0.016;
203 double pos[3] = {-0.85, 0.0, 0.0};
204 double maxDeflection = 0.35;
205};
206
217Hull HullPropertiesOf(double length, double diameter, double averageDensity);
218
236void AxialDragWrench(const double relVel_d[3], double rho, double frontalArea,
237 double axialDragCoeff, double wrench_d[6]);
238
250double AxialDragDerivative(double surge, double rho, double frontalArea, double axialDragCoeff);
251
253constexpr int kSectionCount = 3;
254
262
272constexpr double kCrossFlowSpeedEpsilon = 1.0e-12;
273
276{
277 double x[kSectionCount] = {};
278 double diameter[kSectionCount] = {};
279 double length[kSectionCount] = {};
280};
281
284{
285 double rho = 1025.0;
286 double axialDrag = 0.0;
287 double crossFlowDrag = 0.0;
288 double rollDampingLinear = 0.0;
289 double rollDampingQuadratic = 0.0;
290};
291
320void CrossFlowStripWrench(const double relVel_d[3], const double omega_d[3],
321 double rho, double crossFlowDragCoeff, int sectionCount, const double* sectionX,
322 const double* sectionDiameter, const double* sectionLength, double wrench_d[6]);
323
353void AddCrossFlowStripDerivative(const double relVel_d[3], const double omega_d[3], double rho,
354 double crossFlowDragCoeff, int sectionCount, const double* sectionX,
355 const double* sectionDiameter, const double* sectionLength, double dWrench_dVelocity[6][6]);
356
387void SlenderBodyLiftWrench(const double relVel_d[3], const double omega_d[3], double rho,
388 int sectionCount, const double* sectionX, const double* sectionDiameter,
389 const double* sectionLength, double wrench_d[6], double (*dWrench_dVelocity)[6] = nullptr);
390
401double RollDampingMoment(double rollRate, double linear, double quadratic);
402
410double RollDampingDerivative(double rollRate, double linear, double quadratic);
411
419constexpr double kInflowSpeedEpsilon = 1.0e-12;
420
438void RudderWrench(RudderPlane plane, const double relVel_d[3], const double omega_d[3],
439 double deflection, const Rudder& rudder, double wrench_d[6]);
440
470void RudderWrenchJacobian(RudderPlane plane, const double relVel_d[3],
471 const double omega_d[3], double deflection, const Rudder& rudder,
472 double dWrench_dVelocity[6][6], double dWrench_dDeflection[6]);
473
493void HullLoadDerivative(const Hull& hull, const Sections& sections, const Rudder& rudder,
494 const Coefficients& c, const double relVel_d[3], const double omega_d[3],
495 double rudderDive, double rudderYaw, double dWrench_dVelocity[6][6]);
496
523void AddHullLoad(const Hull& hull, const Sections& sections, const Rudder& rudder, const Coefficients& c,
524 const double relVel_d[3], const double omega_d[3], double rudderDive, double rudderYaw,
525 double wrench[6]);
526} // 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:253
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:272
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:419
RudderPlane
Definition AuvHullLaw.h:192
@ 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.
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()
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:284
double rho
The density of the sea water, kg/m³.
Definition AuvHullLaw.h:285
double rollDampingQuadratic
The quadratic roll damping, N·m·s².
Definition AuvHullLaw.h:289
double crossFlowDrag
The two-dimensional cross-flow drag coefficient of a section.
Definition AuvHullLaw.h:287
double rollDampingLinear
The linear roll damping, N·m·s.
Definition AuvHullLaw.h:288
double axialDrag
The drag coefficient on the frontal area.
Definition AuvHullLaw.h:286
Definition AuvHullLaw.h:176
double mass
Vehicle mass, kg.
Definition AuvHullLaw.h:180
double izz
Yaw inertia about the body z axis, kg·m².
Definition AuvHullLaw.h:183
double frontalArea
Frontal area of the cylinder, pi r², m².
Definition AuvHullLaw.h:179
double ixx
Roll inertia about the body x axis, kg·m².
Definition AuvHullLaw.h:181
double radius
Hull radius, m.
Definition AuvHullLaw.h:177
double volume
Displaced volume, m³.
Definition AuvHullLaw.h:178
double iyy
Pitch inertia about the body y axis, kg·m².
Definition AuvHullLaw.h:182
Everything one fin plane needs beyond its inflow and its commanded deflection.
Definition AuvHullLaw.h:199
AuvFoilProperties foil
The lift and drag coefficient parameters.
Definition AuvHullLaw.h:200
double pos[3]
Where the fin wrench acts, body frame, m.
Definition AuvHullLaw.h:203
double rho
The density of the sea water, kg/m³.
Definition AuvHullLaw.h:201
double maxDeflection
The mechanical stop on the command, rad.
Definition AuvHullLaw.h:204
double area
The planform area of the fin plane, m².
Definition AuvHullLaw.h:202
The strip-theory sections of the hull, kSectionCount of each array.
Definition AuvHullLaw.h:276
double diameter[kSectionCount]
The cross-flow diameter of each section, m.
Definition AuvHullLaw.h:278
double x[kSectionCount]
The body-frame x of each section centroid, m.
Definition AuvHullLaw.h:277
double length[kSectionCount]
The length of each section, m.
Definition AuvHullLaw.h:279