Marine systems simulation
CRing.h
1
9#ifndef C_RING_H
10#define C_RING_H
11#include <Eigen/Eigen>
12
13#include <SimObject.h>
14#ifdef FH_VISUALIZATION
15 #include "sfh/ogre/C3DLine.h"
16#endif
17
18namespace System
19{
20 class CRing : public SimObject
21 {
22 public:
23 CRing(const string& simObjectName, ISimObjectCreator* const creator);
24 ~CRing();
25 void OdeFcn(const double T, const double* const X, double* const XDot, const bool bIsMajorTimeStep);
26 void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
27
28
29 // virtual methods (to be overridden by subclasses)
30 virtual void GetExternalForces(const double T, const double* const X, double* m_extlForce, int index);
31
32
33
34 // const double* const point(const double T, const double* const X, const int index);
35 void calculations(const double T, const double* const X);
36
37 virtual const double* outConnectorPos(const double T, const double* const X, const int index);
38 virtual const double* outConnectorVel(const double T, const double* const X, const int index);
39
40 #ifdef FH_VISUALIZATION
41 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
42 void RenderUpdate( const double T, const double* const X);
43 #endif
44
45 protected:
46
47 typedef Eigen::Matrix<double,3,3> mat3;
48 typedef Eigen::Matrix<double,3,1> vec3;
49
50 int m_numElements;
51 double m_totalLength;
52 double m_radius;
53 double m_weight;
54 double m_length;
55 double m_mass;
56 double m_Ixy;
57 double m_Iz;
58 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.
59 double m_AddMassHack; // Added mass dictated by hack.
60
61 double m_alphaN;
62 double m_betaN;
63 double m_epsilonN;
64 double m_alphaM;
65 double m_betaM;
66 double m_epsilonM;
67 double m_alphaT;
68 double m_betaT;
69 double m_epsilonT;
70
71 double m_centrePosInit[3];
72
73 // hydrodynamic parameters
74 double m_rho;
75 double m_surfacePosZ;
76 double m_rhoWater;
77 double m_Ct; // tangential damping coefficient
78 double m_Cn; // normal damping coefficient
79 double m_bouyFactor; // Factor of volume contributing to bouyancy. Default 0.1 for bottom ring.
80
81 // Connectors
86 ISignalPort** m_aIIForce;
87 double m_extlForce[3];
90
91 double m_bending_epsilon[3];
92
93 struct element {int p; int q; int v; int w; mat3 Mi; vec3 k; mat3 K; vec3 eDot; double nuDot;};
94 element* m_el;
95
96 /* ISignalPort* m_posA;
97 ISignalPort* m_posB;
98 ISignalPort* m_velA;
99 ISignalPort* m_velB;*/
100
101 ICommonComputation* m_calcDynamics;
102 Eigen::Matrix<double,Eigen::Dynamic,1> m_lambda;
103 Eigen::Matrix<double,Eigen::Dynamic,1> m_F_MDotV; // external force F, minus Coriolis term dM/dt*V
104 //double* m_lambda;
105
106 double m_forceA[3];
107 double m_forceB[3];
108
109 // Shape ========================= BiaoSu
110 int m_shape;
111 Eigen::Matrix<double, Eigen::Dynamic, 1> m_shapeMat;
112 // Shape ========================= BiaoSu
113
114 #ifdef FH_VISUALIZATION
115
116 Ogre::SceneNode** m_ManualObjectNodes;
117 /* Ogre::ManualObject* m_ManualObject;
118 double m_scale;
119 Ogre::SceneNode* m_ManualObjectNode;*/
120 #endif
121 };
122}
123#endif
Definition: CRing.h:21
bool m_additionalConnectors
flag for additional connectors along cable
Definition: CRing.h:82
double m_centrePosInit[3]
Parameter for describing the initial position of the centre of the ring (not an IC since there is no ...
Definition: CRing.h:71
double m_extlForce[3]
Array for holding current value of external force at a given node.
Definition: CRing.h:87
int m_numConnectors
number of additional connectors, if any
Definition: CRing.h:83
Eigen::Matrix< double, Eigen::Dynamic, 1 > m_shapeMat
0: circular; 1: square
Definition: CRing.h:111
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 ...
CRing(const string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, output and intput ports.
int m_numInputsPerConnector
number of force inputs per connector position (used for multiple attachments at same point)
Definition: CRing.h:84
int m_ElementsPerConnector
number of elements between connectors
Definition: CRing.h:85
double ** m_aadConnectorVel
Local array for storing output velocities.
Definition: CRing.h:89
double ** m_aadConnectorPos
Local array for storing output positions.
Definition: CRing.h:88
ISignalPort ** m_aIIForce
Array of indices to connector forces in input vector.
Definition: CRing.h:86
Class modelling a flexible bottom ring, inheriting from CRing in RMCable lib.
Definition: CCable.h:142
Definition: CRing.h:93