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