1#ifndef HeaveRollPitch_H
2#define HeaveRollPitch_H
24#include <fhsim/simobject/SimObject.h>
25#include <fhsim_environment/EnvironmentProvider.h>
34 using Dof = std::array<double, 3>;
42 std::optional<double> mass;
43 std::optional<double> waterplaneArea;
44 std::optional<double> rollInertia;
45 std::optional<double> pitchInertia;
47 std::optional<double>
gml;
50 double rollDampingRatio = 0.45;
68 void OdeFcn(
double T,
const double* X,
double* XDot,
const double* pose,
const Dof& extraLoad)
const;
74 void OdeJacobian(
double T,
const double* X,
double* J,
int nStates,
int first,
int poseIndex)
const;
87 int MotionIndex()
const {
return m_indexMotion; }
88 int RateIndex()
const {
return m_indexRate; }
89 int ExcitationIndex()
const {
return m_indexExcitation; }
91 double Rho()
const {
return m_rho; }
92 double Lcf()
const {
return m_lcf; }
93 double Mass()
const {
return m_mass; }
94 double WaterplaneArea()
const {
return m_waterplaneArea; }
96 double Draught()
const {
return m_draught; }
110 void BuildFootprint(
double length,
double breadth,
double lcf,
int sampleLevel);
111 double RotationalStiffness(ISimObjectCreator* creator,
const std::string& gmName,
const std::string& periodName,
112 double mass,
double inertia, std::optional<double> defaultGm, std::optional<double> defaultPeriod)
const;
114 environment::EnvironmentProvider* m_environment =
nullptr;
116 int m_indexMotion = 0;
118 int m_indexExcitation = 0;
121 double m_waterplaneArea = 0.0;
122 double m_filterTime = 0.0;
123 double m_rollQuadraticDamping = 0.0;
133 double m_length = 0.0;
135 double m_draught = 0.0;
137 std::vector<SamplePoint> m_samples;
138 double m_sampleWeight = 0.0;
Definition HeaveRollPitch.h:31
void OdeJacobian(double T, const double *X, double *J, int nStates, int first, int poseIndex) const
const Dof & Damping() const
Diagonal of B.
Definition HeaveRollPitch.h:100
const Dof & Inertia() const
Diagonal of M + A.
Definition HeaveRollPitch.h:98
std::array< double, 3 > Dof
Three generalized loads or coordinates: (heave, roll, pitch).
Definition HeaveRollPitch.h:34
void SetEnvironment(environment::EnvironmentProvider *environment)
The provider of the waves, or nullptr for calm water. Not owned.
Definition HeaveRollPitch.h:62
double Draught() const
Mass / (Rho WaterplaneArea) [m].
Definition HeaveRollPitch.h:96
HeaveRollPitch(ISimObjectCreator *creator, double length, double breadth, const Defaults &defaults)
Dof RawWaveLoads(double T, const double *pose) const
Unfiltered wave loads (Fz, Mphi, Mtheta) at time T for the body at pose (N, E, psi).
int AddStates(ISimObjectCreator *creator)
Adds the states Motion, MotionRate and Excitation (3 each, in that order, contiguous) and returns the...
void OdeFcn(double T, const double *X, double *XDot, const double *pose, const Dof &extraLoad) const
Dof VerticalAccelerations(const double *motion, const double *rate, const Dof &load) const
Accelerations of heave, roll and pitch for the given motion, rates and loads.
Dof AccelerationPerLoad(const Dof &dLoad) const
const Dof & Stiffness() const
Diagonal of C.
Definition HeaveRollPitch.h:99
Definition FlukeAnchor.h:124
Definition HeaveRollPitch.h:41
std::optional< double > rollQuadraticDamping
Default of RollQuadraticDamping [N m s^2].
Definition HeaveRollPitch.h:48
std::optional< double > rollPeriod
Used when neither GMT nor RollPeriod is given [s].
Definition HeaveRollPitch.h:46
std::optional< double > gml
Used when neither GML nor PitchPeriod is given [m].
Definition HeaveRollPitch.h:47