FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Ring.h
1#pragma once
127#include <Eigen/Eigen>
128
129#include <fhsim/PrintDuringExec.h>
130#include <fhsim/simobject/SimObject.h>
131#include <fhsim_environment/EnvironmentProvider.h>
132#include <fhsim_environment/ElementFlowInteraction.h>
133
134#include "cable/GaussPointDrag.h"
135#ifdef FH_VISUALIZATION
136# include "sfh/ogre/C3DLine.h"
137#endif
138
139namespace RbCable
140{
141class Ring : public SimObject
142{
143public:
144 Ring(const std::string& simObjectName, ISimObjectCreator* const creator);
145 ~Ring();
146 void OdeFcn(const double T, const double* const X, double* const XDot) const;
147 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
148 void FinalSetup(const double T, const double* const X, ISimObjectCreator* const creator) override;
149 void PreOdeFcn(const double T, const double* const X) override;
150
151
152 // virtual methods (to be overridden by subclasses)
153 virtual void GetExternalForces(const double T, const double* const X, double* m_extlForce, int index);
154
155
156 // const double* const point(const double T, const double* const X, const int index);
157 void calculations(const double T, const double* const X);
158 void calculationsCommon(const double T, const double* const X) const;
159
161 void BuildJoints(const double* const X);
162
163 virtual const double* outConnectorPos(const double T, const double* const X, const int index);
164 virtual const double* outConnectorVel(const double T, const double* const X, const int index);
165
166#ifdef FH_VISUALIZATION
167 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
168 void RenderUpdate(const double T, const double* const X);
169#endif
170
171protected:
172 typedef Eigen::Matrix<double, 3, 3> mat3;
173 typedef Eigen::Matrix<double, 3, 1> vec3;
174
175 int m_numElements;
176 double m_totalLength;
177 double m_radius;
178 double m_weight;
179 double m_length;
180 double m_mass;
181 double m_Ixy;
182 double m_Iz;
183
184 double m_alphaN;
185 double m_betaN;
186 double m_epsilonN;
187 double m_alphaM;
188 double m_betaM;
189 double m_epsilonM;
190 double m_alphaT;
191 double m_betaT;
192 double m_epsilonT;
193
194 double m_centrePosInit[3];
195
196 // hydrodynamic parameters
197 double m_rho;
198 double m_rhoWater;
199 PrintDuringExec* m_print = nullptr;
200 environment::wake::ElementFlowInteraction m_flow;
201 bool m_gaussPointDrag = true;
203 double m_Ct; // tangential damping coefficient
204 double m_Cn; // normal damping coefficient
205 double m_buoyFactor; // Factor of volume contributing to buoyancy. Default 0.1 for bottom ring.
206
207 // Connectors
211 ISignalPort** m_iIForce;
212 double m_extlForce[3];
215
216 double m_bending_epsilon[3];
217
218 struct element
219 {
220 int p;
221 int q;
222 int v;
223 int w;
224 mat3 Mi;
225 mat3 MiT;
226 vec3 k;
227 mat3 K;
228 vec3 eDot;
229 double nuDot;
230 };
231 element* m_el;
232
233 /* ISignalPort* m_posA;
234 ISignalPort* m_posB;
235 ISignalPort* m_velA;
236 ISignalPort* m_velB;*/
237
238 ICommonComputation* m_calcDynamics;
239 Eigen::Matrix<double, Eigen::Dynamic, 1> m_lambda;
240 Eigen::Matrix<double, Eigen::Dynamic, 1> m_F_MDotV; // external force F, minus Coriolis term dM/dt*V
241 // double* m_lambda;
242
243 double m_forceA[3];
244 double m_forceB[3];
245
246#ifdef FH_VISUALIZATION
247
248 Ogre::SceneNode** m_ManualObjectNodes = nullptr;
249/* Ogre::ManualObject* m_ManualObject;
250 double m_scale;
251 Ogre::SceneNode* m_ManualObjectNode;*/
252#endif
253};
254} // namespace RbCable
Definition Ring.h:142
int m_ElementsPerConnector
number of elements between connectors
Definition Ring.h:210
wet_cylinder_water::ChainJoints m_joints
The joints of the closed loop of elements, and the water at them; buffers kept from call to call.
Definition Ring.h:202
bool m_gaussPointDrag
Gauss-point drag with the water at the joints (MARE-0396).
Definition Ring.h:201
double m_extlForce[3]
Array for holding current value of external force at a given node.
Definition Ring.h:212
Ring(const std::string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, output and intput ports.
void BuildJoints(const double *const X)
Finds the joints of the closed loop of elements from the state; the axis of an element is its quatern...
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:194
double ** m_aadConnectorVel
Local array for storing output velocities.
Definition Ring.h:214
void PreOdeFcn(const double T, const double *const X) override
Takes the other objects' wakes at the element centres, or with the Gauss-point drag at the joints,...
PrintDuringExec * m_print
The shared printer for run errors; null if the creator has none, as in a unit test.
Definition Ring.h:199
double ** m_aadConnectorPos
Local array for storing output positions.
Definition Ring.h:213
environment::wake::ElementFlowInteraction m_flow
The flow at the element centres, the other objects' wakes taken per step (MARE-0223); the Environment...
Definition Ring.h:200
ISignalPort ** m_iIForce
Array of indices to connector forces in input vector.
Definition Ring.h:211
int m_numConnectors
number of additional connectors, if any
Definition Ring.h:209
void FinalSetup(const double T, const double *const X, ISimObjectCreator *const creator) override
Takes the Environment (MARE-0315).
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:208
Definition GaussPointDrag.h:58
Definition Ring.h:219
mat3 MiT
The inverse of the translational inertia with the added mass normal to the axis, global frame (MARE-0...
Definition Ring.h:225