FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
HydroBody Class Reference

#include <HydroBody.h>

Public Member Functions

 HydroBody (ISimObjectCreator *creator, const std::string &angularRateName, double convergenceTime, rigid_body::MunkMoment munk)
 
void SetInertia (const double rigid[6], const double added[6])
 
const BodyKinematics6Dof & Kinematics () const
 The kinematic states and their indices.
 
const double * RigidInertia () const
 The diagonal of the rigid-body inertia.
 
const double * AddedMass () const
 The diagonal of the added mass.
 
double InverseMass (int i) const
 The entry i of the diagonal of M^-1.
 
hydro_body::FlowFrame Frame (const double *X, const double waterVel_n[3]) const
 
hydro_body::FlowFrame Frame (const environment::wake::BodyFlowInteraction &flow, double t, const double *X) const
 Frame(X, waterVel_n) with the water velocity of flow at the body origin at time t (BodyFlowInteraction::WaterVelocity).
 
hydro_body::FlowFrame LocalFrame (const double *localX, const double waterVel_n[3]) const
 
hydro_body::FlowFrame LocalFrame (const environment::wake::BodyFlowInteraction &flow, double t, const double *localX) const
 LocalFrame(localX, waterVel_n) with the water velocity of flow at the body origin at time t.
 
void Derivatives (const hydro_body::FlowFrame &frame, const hydro_body::Wrench &wrench, const double *X, double *XDot) const
 
void AddJacobian (const double *localX, const hydro_body::FlowFrame &frame, double dWrench[6][6], double *J, int nStates) const
 

Detailed Description

The states, the inertia and the derivatives of a rigid body moving through water. See HydroBody.h.

The inertia is diagonal: M = diag(M_RB) + diag(M_A), with M_RB the rigid body's and M_A the added mass, entries 0-2 translational and 3-5 rotational about the body axes.

Constructor & Destructor Documentation

◆ HydroBody()

HydroBody::HydroBody ( ISimObjectCreator *  creator,
const std::string &  angularRateName,
double  convergenceTime,
rigid_body::MunkMoment  munk 
)

Registers the kinematic states with creator (BodyKinematics6Dof). The inertia is zero until SetInertia() is called.

Parameters
creatorThe creator of the SimObject that owns the body.
angularRateNameThe name of the angular-rate state, for example AngVel or Omega.
convergenceTimeThe time constant [s] with which the quaternion norm is driven towards one.
munkWhether the moment carries the Munk moment (rigid_body::MunkMoment).

Member Function Documentation

◆ AddJacobian()

void HydroBody::AddJacobian ( const double *  localX,
const hydro_body::FlowFrame &  frame,
double  dWrench[6][6],
double *  J,
int  nStates 
) const

Adds the kinematic blocks to a Jacobian and writes its velocity block: M^-1 (dWrench + the derivative of the Coriolis-centripetal terms), the water velocity held fixed (rigid_body::AddOmegaTermsJacobian).

Parameters
[in]localXThe object's slice of the state vector, as OdeJacobian is handed it.
[in]frameThe frame of localX (LocalFrame()).
[in,out]dWrenchThe derivative of the body's wrench against (u, v, w, p, q, r); the Coriolis-centripetal terms are added to it.
[in,out]JThe object's Jacobian, nStates by nStates, row major; the velocity block is overwritten, the kinematic blocks are added to.
[in]nStatesThe number of states of the object.

◆ Derivatives()

void HydroBody::Derivatives ( const hydro_body::FlowFrame &  frame,
const hydro_body::Wrench &  wrench,
const double *  X,
double *  XDot 
) const

The derivatives of the 13 kinematic states: the kinematics and M^-1 (wrench + the Coriolis-centripetal terms).

Parameters
[in]frameThe frame of X.
[in]wrenchThe sum of the body's loads at X.
[in]XThe global state vector.
[out]XDotThe global derivative vector; only the 13 kinematic entries are written.

◆ Frame()

hydro_body::FlowFrame HydroBody::Frame ( const double *  X,
const double  waterVel_n[3] 
) const

The flow frame of the global state X (as OdeFcn is handed it), with the given water velocity.

Parameters
[in]XThe global state vector.
[in]waterVel_nThe water velocity at the body origin, NED [m/s].

◆ LocalFrame()

hydro_body::FlowFrame HydroBody::LocalFrame ( const double *  localX,
const double  waterVel_n[3] 
) const

The flow frame of the object's state slice localX (as OdeJacobian is handed it), with the given water velocity.

◆ SetInertia()

void HydroBody::SetInertia ( const double  rigid[6],
const double  added[6] 
)

Sets the inertia and inverts it.

Parameters
rigidThe diagonal of the rigid-body inertia M_RB.
addedThe diagonal of the added mass M_A.

The documentation for this class was generated from the following file: