237#include "HeaveRollPitch.h"
238#include <fhsim/simobject/SimObject.h>
239#include <fhsim_environment/EnvironmentProvider.h>
248 using Dof = std::array<double, 3>;
250 using Loads = std::array<double, 6>;
252 WaveHull(std::string simObjectName, ISimObjectCreator* creator);
254 void FinalSetup(
double T,
const double* X, ISimObjectCreator* creator)
override;
256 void OdeFcn(
double T,
const double* X,
double* XDot)
const override;
258 bool HasJacobians()
const override {
return true; }
259 void OdeJacobian(
double T,
const double* X,
double* J,
int nStates)
override;
260 int GetJacobianSparsity(
int ,
int* ,
int* )
override {
return -1; }
262#ifdef FH_VISUALIZATION
264 void RenderInit(Ogre::Root* ogreRoot, ISimObjectCreator* creator)
override;
265 void RenderUpdate(
double T,
const double* X)
override;
271 const double* MotionPort(
double T,
const double* X);
272 const double* MotionRatePort(
double T,
const double* X);
273 const double* ExcitationPort(
double T,
const double* X);
274 const double* VelocityPort(
double T,
const double* X);
275 const double* PositionPort(
double T,
const double* X);
276 const double* RotationPort(
double T,
const double* X);
293 virtual std::array<double, 3>
WaterVelocity(
double ,
const double* )
const {
return {0.0, 0.0, 0.0}; }
307 double Length()
const {
return m_length; }
308 double Breadth()
const {
return m_breadth; }
309 double Lcf()
const {
return m_lcf; }
310 double Draught()
const {
return m_draught; }
311 double Rho()
const {
return m_rho; }
312 int MotionIndex()
const {
return m_vertical->MotionIndex(); }
313 int RateIndex()
const {
return m_vertical->RateIndex(); }
314 int PoseIndex()
const {
return m_indexPose; }
315 int VelocityIndex()
const {
return m_indexVelocity; }
319 Dof HorizontalAccelerations(
const double* velocity,
const Dof& load)
const;
322 std::optional<HeaveRollPitch> m_vertical;
325 int m_indexVelocity = 0;
331 Dof m_horizontalInertia {};
332 Dof m_horizontalLinearDamping {};
333 Dof m_horizontalQuadraticDamping {};
335 std::array<double, 3> m_positionOut {};
336 std::array<double, 3> m_rotationOut {};
338 double m_length = 0.0;
339 double m_breadth = 0.0;
341 double m_draught = 0.0;
343#ifdef FH_VISUALIZATION
344 Ogre::SceneNode* m_renderNode =
nullptr;
Definition WaveHull.h:245
virtual Loads ExtraLoads(double, const double *, const Dof &) const
Definition WaveHull.h:282
virtual std::array< double, 3 > HeldWaterVelocity() const
The water velocity of the step [m/s], NED, which OdeJacobian holds fixed. The base: still water.
Definition WaveHull.h:296
Dof VelocityThroughWater(double T, const double *X) const
(u, v, r) through the water at time T for the model-global state X.
std::array< double, 3 > Dof
Three generalized loads or coordinates: (heave, roll, pitch) or (surge, sway, yaw).
Definition WaveHull.h:248
static Dof InBodyFrame(const std::array< double, 3 > &water, double psi)
The water velocity water (NED) in the body frame of heading psi: (u_c, v_c, 0).
std::array< double, 6 > Loads
Generalized loads on the six modes, ordered surge, sway, heave, roll, pitch, yaw [N,...
Definition WaveHull.h:250
virtual std::array< double, 3 > WaterVelocity(double, const double *) const
Definition WaveHull.h:293
Dof RawWaveLoads(double T, const double *pose) const
Unfiltered wave loads (Fz, Mphi, Mtheta) at time T for the hull at pose (N, E, psi).
virtual std::array< Dof, 6 > ExtraLoadsVelocityJacobian(const Dof &) const
Definition WaveHull.h:287
Dof HullDamping(const Dof &velocity) const
The hull's damping X(u), Y(v), N(r) at the velocity through the water velocity (u,...