Marine systems simulation
CTrawlDoor_base.h
1#ifndef CTrawlDoor_base_H
2#define CTrawlDoor_base_H
3
4#include <string>
5#include <math.h>
6
7#include <SimObject.h>
8#include "sfh/sim/kinematics.h"
9
10// fhsim_base
11#include <ICurrentVel.h>
12#include <CEnvironment.h>
13
14
15
16#ifdef FH_VISUALIZATION
17#include "OgreParticleSystem.h"
18#ifdef USE_BILLBOARD_LABELS
19#include "sfh/ogre/CMovableText.h"
20#endif
21#endif
22
116//#define TD_AR 1.45
117//#define TD_C_X 0.11
118//#define TD_C_Z 0.22
119//#define TD_OUT_OF_BOUND_COEFF {0.2, 1.2, 0.4, 1.0, 1.0, 1.0}
120
121class CTrawlDoor_base : public SimObject
122{
123public:
125 CTrawlDoor_base(std::string sSimObjectName, ISimObjectCreator* pCreator);
126
128 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep);
129
130
131#ifdef FH_VISUALIZATION
133 virtual void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator);
134
136 virtual void RenderUpdate(const double dT, const double* const adX);
137#endif
138
139protected:
140 virtual void TD_HydroForces(const double pRelVel[], double *pAlpha, double *pBeta, double *pU, double pForceSS[]);
141 //virtual void TD_AngularDamping(double rho, double TD_ARea, const double pRelVel[], double pAngDamp[]);
142 virtual void TD_HydroForces_SS(double TD_Area, double rho, const double pRelVel[], double alpha, double beta, double U, double* pCoeffSS, double* pForceSS);
143 virtual void TD_HydroCoeff_SS(double alpha, double beta, double pCoeffSS[]);
144 virtual void TD_vel2HydroAng(const double pRelVel[], double* pAlpha, double* pBeta, double* pU);
145 virtual void AddExternalForces(double dT, const double* const adX);
146 virtual void AddInternalForces();
147 virtual void AddHydroForces();
148 virtual void AddDampingForces();
149 virtual void AddBottomForces(){};
150 virtual void CalcDerivatives(double dT, double* const adXDot, const double* const adX);
151 virtual void CalcFoundation(const double dT, const double* const adX, double* const adXDot, bool bIsMajorTimeStep);
152 virtual void AddExternalForce(const double adPos_d[3], const double adForceExternal_n[3]);
153 virtual void CalcOutput(const double dT, const double* const adX);
154 void FinalSetup(const double dT, const double *const adX, ISimObjectCreator* const pCreator);
155 // Geometry and properties
157 double m_adCOG[3];
158 double m_dArea;
159 double m_dHeight;
160 double m_dLength;
161 double m_dAR;
162 double m_dCurvature;
163 double m_dMass;
164 double m_dMassInverse[6][6];
165 double m_mdCornerPos_body[4][3];
166 double m_dRhoDoor;
167
168 // Hydrodynamic forces
169 double m_adOutOfBoundCoeff[6];
170 double m_adHydrodynamicCorrections[6];
171
172 // Fastening points
173 double m_adWarpPos_d[3];
174 double m_adLBPos_d[3];
175 double m_adUBPos_d[3];
176
177 // External
178 double m_dRhoWater;
179 double m_adForce_warp[3];
180 double m_adForce_LB[3];
181 double m_adForce_UB[3];
182 double m_adWaterVel_n[3];
183 ICommonComputation* m_pCommonCalc;
184
185 ICurrentVel** m_ppCurrentVel;
186 CEnvironment* m_pEnvironment;
187
188 // Input ports
189 ISignalPort* m_pInWarp_F;
190 ISignalPort* m_pInLB_F;
191 ISignalPort* m_pInUB_F;
192
193 // Output ports
194 const double* OutPos1(const double dT, const double* const adX);
195 const double* OutPos3(const double dT, const double* const adX);
196 const double* OutPos2(const double dT, const double* const adX);
197 const double* OutVel1(const double dT, const double* const adX);
198 const double* OutVel3(const double dT, const double* const adX);
199 const double* OutVel2(const double dT, const double* const adX);
200
201 double m_adOutPos1[3];
202 double m_adOutPos3[3];
203 double m_adOutPos2[3];
204 double m_adOutVel1[3];
205 double m_adOutVel3[3];
206 double m_adOutVel2[3];
207
208 unsigned long m_IStatePos;
209 unsigned long m_IStateQuater;
210 unsigned long m_IStateLocalVel;
211 unsigned long m_IStateOmega;
212 unsigned long m_IStateHydroForce;
213
214 // For computational efficiency
215 double ma_adSumForces[6];
216 double ma_dAlpha;
217 double ma_dBeta;
218 double ma_dU;
219
220 const double* ma_adXPos_n;
221 const double* ma_adXQuater;
222 const double* ma_adXVel_d;
223 const double* ma_adXOmega;
224
225 double ma_mdR[3][3];
226 double ma_adXVel_n[3];
227 double ma_adHydroForceSS[6];
228 double ma_adRelVel_d[6];
229 double ma_adWaterVel_d[3];
230
231#ifdef FH_VISUALIZATION
232 void BottomContactRenderInit();
233 void RenderBottomContact(double depth, double m_aCornerPos_ned[4][3], double m_adSubmergence[4]);
234 Ogre::ParticleSystem* m_particleSystem;
235 Ogre::SceneNode* m_particleNode;
236 Ogre::ParticleEmitter* m_particleEmitter;
237 Ogre::Vector3 m_visualizationScale;
238
239 std::string m_sMeshName;
240 double m_dVisScale;
241 double m_dLengthScale;
242 double m_dHeightScale;
243 double m_dCurvatureScale;
244 Ogre::Entity* m_pRenderEntity;
245 Ogre::SceneNode* m_pRenderNode;
246 Ogre::Quaternion m_InitOrientation;
247 Ogre::SceneManager* m_pSceneMgr;
248
249#ifdef USE_BILLBOARD_LABELS
250 Ogre::SceneNode* m_BBRenderNode;
251 Ogre::CMovableText* m_BBTxt;
252 double m_dBBTxtSize;
253#endif
254#endif
255
256};
257
258
259#endif
Definition: CEnvironment.h:10
Definition: CTrawlDoor_base.h:122
double m_adForce_LB[3]
A pointer to the force.
Definition: CTrawlDoor_base.h:180
double m_adWaterVel_n[3]
The water velocity in the door position.
Definition: CTrawlDoor_base.h:182
double m_dRhoWater
The density of the surrounding fluid.
Definition: CTrawlDoor_base.h:178
double m_adForce_warp[3]
A pointer to the Warp force.
Definition: CTrawlDoor_base.h:179
double m_dRhoDoor
The density of the trawl door material.
Definition: CTrawlDoor_base.h:166
bool m_bIsPort
Is this a port trawl door?
Definition: CTrawlDoor_base.h:156
CTrawlDoor_base(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
ICommonComputation * m_pCommonCalc
Calculations necessary for more than one output port.
Definition: CTrawlDoor_base.h:183
ISignalPort * m_pInLB_F
The cable length input port.
Definition: CTrawlDoor_base.h:190
double m_dMass
The mass of the object.
Definition: CTrawlDoor_base.h:163
ISignalPort * m_pInUB_F
The cable length input port.
Definition: CTrawlDoor_base.h:191
double m_dArea
The trawldoor area.
Definition: CTrawlDoor_base.h:158
ISignalPort * m_pInWarp_F
The cable length input port.
Definition: CTrawlDoor_base.h:189
double m_adForce_UB[3]
A pointer to the input force.
Definition: CTrawlDoor_base.h:181
double m_adCOG[3]
The trawl door center of gravity.
Definition: CTrawlDoor_base.h:157
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Calculates the state derivatives.
Definition: ICurrentVel.h:12