Marine systems simulation
C6DBody.h
1#ifndef C_6D_BODY_H
2#define C_6D_BODY_H
3
125#include "SimObject.h"
126
127class C6DBody : public SimObject
128{
129 public:
130 C6DBody(std::string sSimObjectName, ISimObjectCreator* pCreator);
131
132#ifdef FH_VISUALIZATION
134 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
135
137 virtual void RenderUpdate(const double T, const double* const X);
138
139#endif
140
142 virtual void OdeFcn(const double dT, const double* const adX,
143 double* const adXDot, const bool bIsMajorTimeStep);
144
146 virtual void CalcDerivatives(const double adLocalForces[3],
147 const double adLocalMoments[3],
148 const double adGlobalForces[3],
149 const double adGlobalMoments[3],
150 const double adVelLocal[3],
151 const double adOmegaLocal[3],
152 const double adQuater[4],
153 double adVelLocalDot[3],
154 double adOmegaLocalDot[3],
155 double adQuaterDot[4],
156 double adPosGlobalDot[3]);
157
158#ifdef USE_FULL_MASS_MATRIX
159 void CalcDerivatives(const double adSumForces[6],
160 const double adXVel_d[3],
161 const double adXOmega[3],
162 const double adXQuater[4],
163 const double R[3][3],
164 double adXPos_n_DotOut[3],
165 double adXVel_d_DotOut[3],
166 double adXOmega_DotOut[3],
167 double adXQuater_DotOut[4]);
168#endif
169
170 protected:
171 ISignalPort* m_pInMoment;
172 ISignalPort* m_pInForce;
173 virtual const double* Position(const double dT, const double* const adX);
174 virtual const double* Velocity(const double dT, const double* const adX);
175 virtual const double* Quater(const double dT, const double* const adX);
176 virtual const double* LocalVel(const double dT, const double* const adX);
177 virtual const double* AngVel(const double dT, const double* const adX);
178
179 double m_dMass;
180 double m_dGravity;
181 double m_adVelGlobal[3];
187
188 double m_adBodySize[3];
189#ifdef USE_FULL_MASS_MATRIX
190 bool m_bHasFullMassMatrix;
191 double m_mdMassInverse[6][6];
192#endif
193
194#ifdef FH_VISUALIZATION
195 std::string m_sMaterial;
196 std::string m_sMeshName;
197
198 double m_adMeshScale[3];
199 double m_adMeshOrigin[3];
200 double m_dVisScale;
201 double m_dLengthScale;
202 double m_dHeightScale;
203 double m_dCurvatureScale;
204 Ogre::Quaternion m_InitOrientation;
205 Ogre::Entity* m_pRenderEntity;
206 Ogre::SceneNode* m_pRenderNode;
207 Ogre::SceneManager* m_pSceneMgr;
208#endif
209};
210
211
212#endif
Definition: C6DBody.h:128
int m_IStatePos
Index of the global position in the state vector.
Definition: C6DBody.h:183
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])
Calculates the state derivatives when the forces and moments are known.
double m_adDiagonalMass[6]
The diagonal of the mass matrix, assuming all cross coupling terms to be zero.
Definition: C6DBody.h:182
double m_dMass
The mass of the object.
Definition: C6DBody.h:179
ISignalPort * m_pInForce
A pointer to the input force.
Definition: C6DBody.h:172
double m_dGravity
The gravitational acceleration.
Definition: C6DBody.h:180
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Calculates the state derivatives.
double m_adVelGlobal[3]
The global velocity.
Definition: C6DBody.h:181
double m_adBodySize[3]
The size of the body along x-, y- and z-axis.
Definition: C6DBody.h:188
ISignalPort * m_pInMoment
A pointer to the input moment.
Definition: C6DBody.h:171
int m_IStateQuater
Index of the quaternions in the state vector.
Definition: C6DBody.h:184
int m_IStateLocalVel
Index of the local velocity in the state vector.
Definition: C6DBody.h:185
int m_IStateOmega
Index of the local angular velocity in the state vector.
Definition: C6DBody.h:186