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