FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
C6DBody Class Reference
+ Inheritance diagram for C6DBody:
+ Collaboration diagram for C6DBody:

Public Member Functions

 C6DBody (std::string sSimObjectName, ISimObjectCreator *pCreator)
 
virtual void OdeFcn (const double dT, const double *const adX, double *const adXDot) const
 Calculates the state derivatives.
 
bool HasJacobians () const override
 
void OdeJacobian (double T, const double *X, double *J, int nStates) override
 
int GetJacobianSparsity (int nStates, int *rowPtr, int *colIdx) override
 
virtual void CalcDerivatives (const double adLocalForces[3], const double adLocalMoments[3], const double adGlobalForces[3], const double adGlobalMoments[3], const double adVelLocal[3], const double adOmegaLocal[3], const double adQuater[4], double adVelLocalDot[3], double adOmegaLocalDot[3], double adQuaterDot[4], double adPosGlobalDot[3]) const
 Calculates the state derivatives when the forces and moments are known.
 

Protected Member Functions

virtual const double * Position (const double dT, const double *const adX)
 
virtual const double * Velocity (const double dT, const double *const adX)
 
virtual const double * Quater (const double dT, const double *const adX)
 
virtual const double * LocalVel (const double dT, const double *const adX)
 
virtual const double * AngVel (const double dT, const double *const adX)
 
int LocalIndex (int globalStateIndex) const
 

Protected Attributes

ISignalPort * m_pInMoment
 A pointer to the input moment.
 
ISignalPort * m_pInForce
 A pointer to the input force.
 
double m_dMass
 The mass of the object.
 
double m_dGravity
 The gravitational acceleration.
 
double m_adVelGlobal [3]
 The global velocity.
 
double m_adDiagonalMass [6]
 The diagonal of the mass matrix, assuming all cross coupling terms to be zero.
 
int m_IStatePos
 Index of the global position in the state std::vector.
 
int m_IStateQuater
 Index of the quaternions in the state std::vector.
 
int m_IStateLocalVel
 Index of the local velocity in the state std::vector.
 
int m_IStateOmega
 Index of the local angular velocity in the state std::vector.
 
double m_adBodySize [3]
 The size of the body along x-, y- and z-axis.
 

Member Function Documentation

◆ LocalIndex()

int C6DBody::LocalIndex ( int  globalStateIndex) const
inlineprotected

Turns a model-global state index into one local to this SimObject.

OdeFcn and the port functions are handed the whole model's state vector, so they use the global indices AddState returned directly. OdeJacobian is handed this object's own slice, whose first element is Pos, so every index it uses goes through this function (BASE-0033).


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