Marine systems simulation
CSimpleFloatingCollar.h
1
2#pragma once
3
4#include "CEnvironment.h"
5#include <RingStructure.h>
6#include <RigidElement.h>
7#include <Eigen/Eigen>
8
9#include "CContact.h"
10
11using namespace std;
12using namespace Eigen;
13
14#ifdef FH_VISUALIZATION
15#include "sfh/ogre/C3DLine.h"
16#endif
17
18namespace System {
19
32class SimpleFloatingCollar : public SimObject {
33public:
34
36 SimpleFloatingCollar(string simobjectname, ISimObjectCreator* creator);
37
40
41 void OdeFcn(const double T, const double *const X, double *const XDot, const bool IsMajorTimeStep);
42
44 void InitialConditionSetup(const double T, const double *const CurrentIC, double *const UpdatedIC, ISimObjectCreator *const Creator);
45
47 virtual void FinalSetup(const double T, const double* const X, ISimObjectCreator* const pCreator);
48
50 const double* GetElementPosition(const double T, const double* const X, int iElem);
51 const double* GetElementVelocity(const double T, const double* const X, int iElem);
52
54 const double* NetPosition(const double T, const double* const X, int i);
55 const double* NetVelocity(const double T, const double* const X, int i);
56 const double* BridlePosition(const double T, const double* const X, int i);
57 const double* BridleVelocity(const double T, const double* const X, int i);
58 const double* ChainPosition(const double T, const double* const X, int i);
59 const double* ChainVelocity(const double T, const double* const X, int i);
60
61 Eigen::Matrix<double, 3, 1> extElementPosition(const double T, const double* const X, int iElem, double extL);
62
66 double numTubes;
67 double elemMass;
68 double* Ca;
69 double* Cb;
70 double elemVolume;
71 double elemRadius;
72 double elemLength;
73 double elemArea;
74 double elemProjArea;
76 double Cd_n;
77 double Cd_t;
78 double rhoWater;
79 double g;
80 double heaveRAO;
81
85 double* BridleForces;
86 double* BridlePos;
87
88 int numNetConnectors;
90 double* NetForces;
91 double* NetPos;
92
93 int numChains;
95 double* ChainForces;
96 double* ChainPos;
97
100 int* ContactElemIndex;
101 double* ContactElemForce;
102 double* ContactPos;
104 } m_forceCoeffs;
105
106#ifdef FH_VISUALIZATION
107 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
108 virtual void RenderUpdate(const double T, const double* const X);
109
110 //C3DLine * m_Line;
111
112 Ogre::SceneNode* m_RenderNode;
113 Ogre::SceneNode** m_ManualObjectNodes;
114 Ogre::SceneNode** m_ManualObjectSpheres;
115 string m_Material;
116 double m_Color[3];
117#endif
118
119protected:
120 int m_Num;
121 double m_Beta;
122
123 double m_elemRad;
124
127 ISignalPort** m_AccDispIn;
128 double* m_AccDisp;
131 void GetAccelerometerPositions(const double T, const double* X, ISignalPort** posIn, double* pos, int numPos);
132 double getSplineZPos(double beta);
134 double m_TLast;
135 double m_dTInt;
136 double m_dTUpdt;
137 double m_velZ_max;
138 double m_W_lastRef;
139
141 void calcSplineCoefficients(double* vertDispl);
142 double* m_spline_a;
143 double* m_spline_b;
144 double* m_spline_c;
145 double* m_spline_d;
146
147 double** m_spline_A;
148 double* m_spline_B;
149 double* m_spline_h;
150 double* m_spline_m;
151
152 Eigen::MatrixXd m_spl_A;
153 Eigen::MatrixXd m_spl_B;
154 Eigen::MatrixXd m_spl_m;
156
159
161
162 double m_UpdateDT;
163 double m_UpdateNT;
164 double m_ContactPos[3];
167 double m_ContactForce[6];
168 void CalContactForce(const double T, const double* const X);
169 const virtual double* OutContactPosition(const double T, const double* const X);
170 const virtual double* OutContactForce(const double T, const double* const X);
174 double m_ClosestPos[3];
176 void CalClosestDistnace(const double T, const double* const X);
177 const virtual double* OutClosestPosition(const double T, const double* const X);
178 const virtual double* OutClosestDistnace(const double T, const double* const X);
180
185 double* m_BridlePos;
186 double* m_BridleVel;
187
188 int m_numNetConnectors;
190 double* m_NetForces;
191 double* m_NetEleRad;
192 double* m_NetPos;
193 double* m_NetVel;
194
195 int m_numChains;
199 double* m_ChainPos;
200 double* m_ChainVel;
201
202 double* m_elemPos;
203 double* m_elemVel;
204
206 double m_heaveMaxDelta;
207 double* m_heavePos;
208 double* m_heaveVel;
209
211 void GetExternalForces(const double T, const double* X, ISignalPort** forcesIn, double* forces, int numForces);
212
216
217 ISignalPort** m_BridleForcesIn;
218 ISignalPort** m_NetForcesIn;
219 ISignalPort** m_ChainForcesIn;
220
221 // Structural
228 double m_InitPos[3];
230 double m_multiply;
231 double m_eModulus;
232 double m_gModulus;
233 double m_damping;
234
235 // Hydrodynamics
236 double m_Cd_t;
237 double m_Cd_n;
238 double m_Ca[3];
239 double m_Cb[3];
240 double m_rhoWater;
241 double m_g;
242
244};
245
247public:
248 RingCoRiBoForces(CoRiBoDynamics::ConstraintSolver* solver, CEnvironment* environment, double timeConstant, const vector<CoRiBoDynamics::RigidElement*> &elements, System::SimpleFloatingCollar::forceCoefficients *coefficients);
249
250 void ComputeConstraints(const double T, const double * const X);
251protected:
252 vector<CoRiBoDynamics::RigidElement*> m_elements;
253 double m_timeConstant;
254 CEnvironment* m_environment;
255
256 double m_numTubes;
257 double m_elemMass;
258 double* m_Ca;
259 double* m_Cb;
261 double m_elemArea;
266 double m_Cd_n;
267 double m_Cd_t;
268 double m_rhoWater;
269 double m_g;
270
274
277 double* m_NetForces;
278
282
284
287 int* m_ContactElemIndex;
288 double* m_ContactElemForce;
290
291 double* m_BridlePos;
292 double* m_NetPos;
293 double* m_ChainPos;
294 double* m_ContactPos;
295};
296}
Definition: CEnvironment.h:10
Definition: ConstraintSet.h:24
Definition: ConstraintSolver.h:31
Definition: JointConstraint.h:17
Definition: RingStructure.h:8
Definition: CContact.h:108
Definition: CSimpleFloatingCollar.h:246
double m_elemProjArea
Area of each element (ommitting circular end patches)
Definition: CSimpleFloatingCollar.h:262
double m_rhoWater
Tangential drag coeffocient.
Definition: CSimpleFloatingCollar.h:268
double * m_ChainForces
Pointer to array holding element index of Chain connection points.
Definition: CSimpleFloatingCollar.h:281
int * m_BridleElemIndex
Number of bridles connected to floating collar.
Definition: CSimpleFloatingCollar.h:272
double m_elemMass
Number of tubes
Definition: CSimpleFloatingCollar.h:257
double * m_BridlePos
Contact.
Definition: CSimpleFloatingCollar.h:291
void ComputeConstraints(const double T, const double *const X)
double m_elemArea
Volume for an element in the ring structure.
Definition: CSimpleFloatingCollar.h:261
double m_Cd_n
Length of each element in the floating collar.
Definition: CSimpleFloatingCollar.h:266
int m_numBridles
Acceleration of gravity. Not usually something you want to meddle with.
Definition: CSimpleFloatingCollar.h:271
int m_numChains
Pointer to array holding forces from the net on the elements.
Definition: CSimpleFloatingCollar.h:279
double m_elemRadius
Cross sectional area of each element in the ring structure (pi*radius^2)
Definition: CSimpleFloatingCollar.h:264
double m_heaveRAO
Pointer to array holding forces from Chains on the elements.
Definition: CSimpleFloatingCollar.h:283
double m_g
Water density.
Definition: CSimpleFloatingCollar.h:269
double m_elemVolume
Potential wave damping coefficient array for Mass matrix and diffraction force. 1....
Definition: CSimpleFloatingCollar.h:260
double * m_NetForces
Pointer to array holding element index of net connection points.
Definition: CSimpleFloatingCollar.h:277
double m_elemCrossSectArea
Projected area of element (2*elementRadius*elementLength)
Definition: CSimpleFloatingCollar.h:263
double * m_Cb
Added mass coefficient array for Mass matrix and diffraction force. 1.0 is equal to mass of displaced...
Definition: CSimpleFloatingCollar.h:259
int m_NumConPoint
Contact.
Definition: CSimpleFloatingCollar.h:286
int m_numNetConnectors
Pointer to array holding forces from bridles on the elements.
Definition: CSimpleFloatingCollar.h:275
int * m_ChainElemIndex
Number of Chains connected to floating collar.
Definition: CSimpleFloatingCollar.h:280
double m_elemLength
Diameter for an element in the ring structure.
Definition: CSimpleFloatingCollar.h:265
double * m_BridleForces
Pointer to array holding element index of bridle connection points.
Definition: CSimpleFloatingCollar.h:273
int * m_NetElemIndex
Number of net connections to floating collar.
Definition: CSimpleFloatingCollar.h:276
double * m_Ca
Mass for an element in the ring structure.
Definition: CSimpleFloatingCollar.h:258
double m_Cd_t
Normal drag coefficient for an element in the ring structure.
Definition: CSimpleFloatingCollar.h:267
Definition: CSimpleFloatingCollar.h:32
bool m_isDoubleTubeCollar
Tube mass per metre [kg/m].
Definition: CSimpleFloatingCollar.h:226
double m_ClosestPos[3]
Number of discretized points for distance detection.
Definition: CSimpleFloatingCollar.h:174
double * m_NetEleRad
Net forces of an element connected to the net.
Definition: CSimpleFloatingCollar.h:191
ISignalPort ** m_NetForcesIn
Signal port containing forces from bridle connectors.
Definition: CSimpleFloatingCollar.h:218
const double * NetPosition(const double T, const double *const X, int i)
NEW.
double * m_spline_B
Arrays containing parameters for cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:148
double m_ContactForce[6]
Contact element force.
Definition: CSimpleFloatingCollar.h:167
double * m_BridleForces
Index of elements connected to a bridle.
Definition: CSimpleFloatingCollar.h:183
int m_numBridles
Distance.
Definition: CSimpleFloatingCollar.h:181
virtual void FinalSetup(const double T, const double *const X, ISimObjectCreator *const pCreator)
Final setup.
CoRiBoDynamics::JointConstraint * m_ConstraintSet
Constraint solver.
Definition: CSimpleFloatingCollar.h:214
double ** m_spline_A
Array containing coefficients for calculation of cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:147
const double * GetElementVelocity(const double T, const double *const X, int iElem)
NEW.
double m_CollarTubeThickness
Diamter of the pipe comprising the floating collar.
Definition: CSimpleFloatingCollar.h:224
virtual const double * OutClosestDistnace(const double T, const double *const X)
Output closest position.
double m_TLast
Array with positions of measurements in radians. Last element equals last + 2*pi. size m_nMeasPos + 1...
Definition: CSimpleFloatingCollar.h:134
int m_NumConPoint
Spline function variables end.
Definition: CSimpleFloatingCollar.h:158
double * m_spline_d
Array containing coefficients for calculation of cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:145
void GetExternalForces(const double T, const double *X, ISignalPort **forcesIn, double *forces, int numForces)
Get function.
double * m_spline_m
Arrays containing parameters for cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:150
double * m_elemVel
Element positions.
Definition: CSimpleFloatingCollar.h:203
~SimpleFloatingCollar()
The destructor cleans up.
ISignalPort ** m_BridleForcesIn
Ring structure.
Definition: CSimpleFloatingCollar.h:217
virtual const double * OutClosestPosition(const double T, const double *const X)
Calculate closest distance.
double * m_spline_a
Function calculates Matrix A and B with periodic buondary condition.
Definition: CSimpleFloatingCollar.h:142
double m_Cd_t
Structural damping.
Definition: CSimpleFloatingCollar.h:236
void CalContactForce(const double T, const double *const X)
Contact forces.
double m_damping
Elastic modulus.
Definition: CSimpleFloatingCollar.h:233
int * m_AccElemIndex
Array containing positions of displacements.
Definition: CSimpleFloatingCollar.h:130
double * m_ChainEleRad
Chain forces of an element connected to a chain.
Definition: CSimpleFloatingCollar.h:198
double m_rhoWater
Potential damping (wave damping) coefficient array for diffraction force. 1.0 is equal to mass of dis...
Definition: CSimpleFloatingCollar.h:240
SimpleFloatingCollar(string simobjectname, ISimObjectCreator *creator)
The constructor sets the pointer to the output object and the parser object.
double m_doubleSwitch
Initial position of the center of the floating collar in (x,y,z) coordinates.
Definition: CSimpleFloatingCollar.h:229
double m_ClosestDis
Position of closest point.
Definition: CSimpleFloatingCollar.h:175
ISignalPort ** m_AccDispIn
Number of acceloremters feeding data.
Definition: CSimpleFloatingCollar.h:127
double m_gModulus
Elastic modulus.
Definition: CSimpleFloatingCollar.h:232
double m_UpdateDT
External object involved in contact.
Definition: CSimpleFloatingCollar.h:162
double m_Beta
number of discrete elements in the collar
Definition: CSimpleFloatingCollar.h:121
double * m_AccElemRad
Array containing displacements received through the signal port.
Definition: CSimpleFloatingCollar.h:129
double * m_AccDisp
Signal port given displacements derived from accelorometer data.
Definition: CSimpleFloatingCollar.h:128
double m_eModulus
Multiplier for floating collar comprised of two concentric pipes (tubes). Equals 1....
Definition: CSimpleFloatingCollar.h:231
int * m_BridleElemIndex
Number of bridle connectors.
Definition: CSimpleFloatingCollar.h:182
int * m_ChainElemIndex
Number of chain connectors.
Definition: CSimpleFloatingCollar.h:196
int m_NumDisPoint
Definition: CSimpleFloatingCollar.h:173
void CalClosestDistnace(const double T, const double *const X)
Distance to closest point.
double m_CollarTubeDiameter
Diameter of floating collar centre to centre (c-c) of the pipe.
Definition: CSimpleFloatingCollar.h:223
double m_CollarTubeDistance
True if floating collar consists of two tubes.
Definition: CSimpleFloatingCollar.h:227
double * m_BridleEleRad
Bridle forces of an element connected to a bridle.
Definition: CSimpleFloatingCollar.h:184
virtual const double * OutContactPosition(const double T, const double *const X)
Calculate contact forces.
Contact::ContactObject m_Vessel
Number of discretized points for contact detection.
Definition: CSimpleFloatingCollar.h:160
double m_g
Density of water. It kind of depends.
Definition: CSimpleFloatingCollar.h:241
double * m_AccElemRadPer
Function for obtaining position on ring as a function of local angle beta and current calculated spli...
Definition: CSimpleFloatingCollar.h:133
int * m_NetElemIndex
Number of net connectors.
Definition: CSimpleFloatingCollar.h:189
CoRiBoDynamics::ConstraintSolver * m_ConstraintSolver
NEW.
Definition: CSimpleFloatingCollar.h:213
double * m_spline_b
Array containing coefficients for calculation of cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:143
virtual const double * OutContactForce(const double T, const double *const X)
Output contact position.
double m_Cb[3]
Added mass coefficient array for Mass matrix and diffraction force. 1.0 is equal to mass of displaced...
Definition: CSimpleFloatingCollar.h:239
double * m_spline_h
Arrays containing parameters for cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:149
double m_InitPos[3]
Distance (centre-centre) between the to concetric pipes comprinsing a standard floating collar.
Definition: CSimpleFloatingCollar.h:228
void GetAccelerometerPositions(const double T, const double *X, ISignalPort **posIn, double *pos, int numPos)
Array containg element indices for position of accelorometers.
ISignalPort ** m_ChainForcesIn
Signal port containing forces from net connections.
Definition: CSimpleFloatingCollar.h:219
Eigen::MatrixXd m_spl_A
Arrays containing parameters for cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:152
double m_UpdateNT
Update interval.
Definition: CSimpleFloatingCollar.h:163
double m_elemRad
main frequency coefficient
Definition: CSimpleFloatingCollar.h:123
void InitialConditionSetup(const double T, const double *const CurrentIC, double *const UpdatedIC, ISimObjectCreator *const Creator)
Initializes the collar elements in a ring.
double * m_ChainForces
Index of elements connected to a chain.
Definition: CSimpleFloatingCollar.h:197
double m_ContactPos[3]
Time for next update.
Definition: CSimpleFloatingCollar.h:164
double m_Ca[3]
Drag coefficient. Normal drag.
Definition: CSimpleFloatingCollar.h:238
double m_multiply
Switch for when single (equals 0.0) and double (equals 1.0) pipe floater is used.
Definition: CSimpleFloatingCollar.h:230
double m_heaveRAO
Element velocities.
Definition: CSimpleFloatingCollar.h:205
double m_CollarRingDiameter
Signal port containing forces from chain connectors.
Definition: CSimpleFloatingCollar.h:222
double m_ContactElemForce[3]
Contact element index.
Definition: CSimpleFloatingCollar.h:166
double getSplineZPos(double beta)
Function who gets accelorometer displacaments.
CEnvironment * m_Environment
Acceleration of gravity. Not usually something you want to meddle with.
Definition: CSimpleFloatingCollar.h:243
int m_ContactElemIndex
Position at contact.
Definition: CSimpleFloatingCollar.h:165
void calcSplineCoefficients(double *vertDispl)
Spline function to estimate vertical position of ring elements.
double m_CollarTubeUnitMass
Wall thickness of the material comprising the floating collar tube.
Definition: CSimpleFloatingCollar.h:225
double * m_NetForces
Index of elements connected to the net.
Definition: CSimpleFloatingCollar.h:190
double * m_spline_c
Array containing coefficients for calculation of cubic spline for vertical displacement.
Definition: CSimpleFloatingCollar.h:144
const double * GetElementPosition(const double T, const double *const X, int iElem)
Get Functions.
int m_numAccMeas
Accelerometer data.
Definition: CSimpleFloatingCollar.h:126
double m_Cd_n
Drag coefficient. Tangential drag.
Definition: CSimpleFloatingCollar.h:237
Class modelling a flexible bottom ring, inheriting from CRing in RMCable lib.
Definition: CCable.h:142
NEW.
Definition: CSimpleFloatingCollar.h:64
int * NetElemIndex
Number of net connections to floating collar.
Definition: CSimpleFloatingCollar.h:89
double elemRadius
Volume of each element in the floating collar.
Definition: CSimpleFloatingCollar.h:71
int * BridleElemIndex
Number of bridles connected to floating collar.
Definition: CSimpleFloatingCollar.h:84
int NumConPoint
Contact.
Definition: CSimpleFloatingCollar.h:99
double * NetForces
Pointer to array holding element index of net connection points.
Definition: CSimpleFloatingCollar.h:90
double * BridlePos
Array holdign bridle forces for elements with a bridle connection.
Definition: CSimpleFloatingCollar.h:86
double * ChainPos
Array holding chain forces for elements with a chain connection.
Definition: CSimpleFloatingCollar.h:96
double * BridleForces
Pointer to array holding element index of bridle connection points.
Definition: CSimpleFloatingCollar.h:85
double * NetPos
Array holding net forces for elements with a net connection.
Definition: CSimpleFloatingCollar.h:91
double rhoWater
Tangential drag coeffocient.
Definition: CSimpleFloatingCollar.h:78
double elemArea
Length of each element in the floating collar.
Definition: CSimpleFloatingCollar.h:73
double * ChainForces
Pointer to array holding element index of chain connection points.
Definition: CSimpleFloatingCollar.h:95
double elemLength
Diameter of each element in the floating collar.
Definition: CSimpleFloatingCollar.h:72
double elemMass
Number of tubes.
Definition: CSimpleFloatingCollar.h:67
double numTubes
Parameters and variables.
Definition: CSimpleFloatingCollar.h:66
double elemCrossSectArea
Projected area of element (2*elementRadius*elementLength)
Definition: CSimpleFloatingCollar.h:75
double * Ca
Mass of each element in the floating collar.
Definition: CSimpleFloatingCollar.h:68
double heaveRAO
Acceleration of gravity. Not usually something you want to meddle with.
Definition: CSimpleFloatingCollar.h:80
int * ChainElemIndex
Number of chain connections to floating collar.
Definition: CSimpleFloatingCollar.h:94
double Cd_t
Normal drag coefficient for each element in the floating collar.
Definition: CSimpleFloatingCollar.h:77
int numBridles
Connections to other simulation objects.
Definition: CSimpleFloatingCollar.h:83
double Cd_n
Cross sectional area of each element in the floating collar (pi*radius^2)
Definition: CSimpleFloatingCollar.h:76
double elemProjArea
Area of each element (ommitting circular end patches)
Definition: CSimpleFloatingCollar.h:74
double elemVolume
Potential wave damping coefficient array for Mass matrix and diffraction force. 1....
Definition: CSimpleFloatingCollar.h:70
double g
Water density.
Definition: CSimpleFloatingCollar.h:79
double * Cb
Added mass coefficient array for Mass matrix and diffraction force. 1.0 is equal to mass of displaced...
Definition: CSimpleFloatingCollar.h:69