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