Marine systems simulation
CRing.h
1#pragma once
95#include <Eigen/Eigen>
96
97#include <SimObject.h>
98#ifdef FH_VISUALIZATION
99 #include "sfh/ogre/C3DLine.h"
100#endif
101
102namespace RbCable
103{
104 class CRing : public SimObject
105 {
106 public:
107 CRing(const string& simObjectName, ISimObjectCreator* const creator);
108 ~CRing();
109 void OdeFcn(const double T, const double* const X, double* const XDot, const bool bIsMajorTimeStep);
110 void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
111
112
113 // virtual methods (to be overridden by subclasses)
114 virtual void GetExternalForces(const double T, const double* const X, double* m_extlForce, int index);
115
116
117
118 // const double* const point(const double T, const double* const X, const int index);
119 void calculations(const double T, const double* const X);
120
121 virtual const double* outConnectorPos(const double T, const double* const X, const int index);
122 virtual const double* outConnectorVel(const double T, const double* const X, const int index);
123
124 #ifdef FH_VISUALIZATION
125 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
126 void RenderUpdate( const double T, const double* const X);
127 #endif
128
129 protected:
130
131 typedef Eigen::Matrix<double,3,3> mat3;
132 typedef Eigen::Matrix<double,3,1> vec3;
133
134 int m_numElements;
135 double m_totalLength;
136 double m_radius;
137 double m_weight;
138 double m_length;
139 double m_mass;
140 double m_Ixy;
141 double m_Iz;
142 double m_C_isAddMassHack; // HACK! Added mass coefficient if hack is used. Set to 0 if it is not to be used. Increases mass in order to give pseudo effect of added mass.
143 double m_AddMassHack; // Added mass dictated by hack.
144
145 double m_alphaN;
146 double m_betaN;
147 double m_epsilonN;
148 double m_alphaM;
149 double m_betaM;
150 double m_epsilonM;
151 double m_alphaT;
152 double m_betaT;
153 double m_epsilonT;
154
155 double m_centrePosInit[3];
156
157 // hydrodynamic parameters
158 double m_rho;
159 double m_surfacePosZ;
160 double m_rhoWater;
161 double m_Ct; // tangential damping coefficient
162 double m_Cn; // normal damping coefficient
163 double m_bouyFactor; // Factor of volume contributing to bouyancy. Default 0.1 for bottom ring.
164
165 // Connectors
170 ISignalPort** m_aIIForce;
171 double m_extlForce[3];
174
175 double m_bending_epsilon[3];
176
177 struct element {int p; int q; int v; int w; mat3 Mi; vec3 k; mat3 K; vec3 eDot; double nuDot;};
178 element* m_el;
179
180 /* ISignalPort* m_posA;
181 ISignalPort* m_posB;
182 ISignalPort* m_velA;
183 ISignalPort* m_velB;*/
184
185 ICommonComputation* m_calcDynamics;
186 Eigen::Matrix<double,Eigen::Dynamic,1> m_lambda;
187 Eigen::Matrix<double,Eigen::Dynamic,1> m_F_MDotV; // external force F, minus Coriolis term dM/dt*V
188 //double* m_lambda;
189
190 double m_forceA[3];
191 double m_forceB[3];
192
193 #ifdef FH_VISUALIZATION
194
195 Ogre::SceneNode** m_ManualObjectNodes;
196 /* Ogre::ManualObject* m_ManualObject;
197 double m_scale;
198 Ogre::SceneNode* m_ManualObjectNode;*/
199 #endif
200 };
201}
Definition: CRing.h:105
int m_numInputsPerConnector
number of force inputs per connector position (used for multiple attachments at same point)
Definition: CRing.h:168
int m_numConnectors
number of additional connectors, if any
Definition: CRing.h:167
virtual void GetExternalForces(const double T, const double *const X, double *m_extlForce, int index)
get the external forces at element 'index'. Should be overridden by inheriting classes to get forces ...
double ** m_aadConnectorPos
Local array for storing output positions.
Definition: CRing.h:172
double m_centrePosInit[3]
Parameter for describing the initial position of the centre of the ring (not an IC since there is no ...
Definition: CRing.h:155
bool m_additionalConnectors
flag for additional connectors along cable
Definition: CRing.h:166
int m_ElementsPerConnector
number of elements between connectors
Definition: CRing.h:169
ISignalPort ** m_aIIForce
Array of indices to connector forces in input vector.
Definition: CRing.h:170
double ** m_aadConnectorVel
Local array for storing output velocities.
Definition: CRing.h:173
CRing(const string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, output and intput ports.
double m_extlForce[3]
Array for holding current value of external force at a given node.
Definition: CRing.h:171
Definition: CRing.h:177