Marine systems simulation
Loading...
Searching...
No Matches
CCable.h
1
125#ifndef C_CABLERM_H
126#define C_CABLERM_H
127
128#include <Eigen/Eigen>
129
130#include <CPrintDuringExec.h>
131#include <SimObject.h>
132#include "EnvironmentProvider.h"
133#ifdef FH_VISUALIZATION
134 #include "sfh/ogre/C3DLine.h"
135#endif
136#include <memory>
137
138namespace System
139{
205 class CCableRM : public SimObject
206 {
207 public:
219 CCableRM(const string& simObjectName, ISimObjectCreator* const creator);
220 ~CCableRM();
231 void OdeFcn(const double T, const double* const X, double* const XDot, const bool bIsMajorTimeStep);
232
233 void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
234 void FinalSetup(const double T, const double *const X, ISimObjectCreator* const creator);
235
245 const double* forceA(const double T, const double* const X);
255 const double* forceB(const double T, const double* const X);
266 void calculations(const double T, const double* const X);
267
268 // BS: Port to output element position
269 const double* OutPos(const double T, const double* const X, const int i);
270 // BS: Port to output element position
271
272#ifdef FH_VISUALIZATION
273 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
274 void RenderUpdate( const double T, const double* const X);
275#endif
276
277 protected:
278
279 typedef Eigen::Matrix<double,3,3> mat3;
280 typedef Eigen::Matrix<double,3,1> vec3;
281
282 void DistributeCatenary( Eigen::Matrix<double,3,1> P1, Eigen::Matrix<double,3,1> P2, double L, double* states, int i1, int i2, ISimObjectCreator* creator );
283
284 CPrintDuringExec* m_print;
285 environment::EnvironmentProvider* m_environment;
286
287 int m_numElements;
288 double m_totalLength;
289 double m_radius;
290 double m_weight;
291 double m_alphaN;
292 double m_betaN;
293 double m_epsilonN;
294 double m_alphaM;
295 double m_betaM;
296 double m_epsilonM;
297 double m_alphaT;
298 double m_betaT;
299 double m_epsilonT;
300
301 double m_bending_epsilon[3];
302
303 //double m_rho;
304 //double m_surfacePosZ;
305 //double m_rhoWater;
306 //double m_Ct; // tangential damping coefficient
307 //double m_Cn; // normal damping coefficient
308
309 double m_length;
310 double m_mass;
311 double m_Ixy;
312 double m_Iz;
313 //bool TEMP_BOOL_VAR__ISMAJORTIMESTEP;
314
315 // Sugar kelp rope application - start
316 bool m_kelp; // 1 if used as a kelp rope, 0 otherwise
317 double m_wKelp; // Biomass of kelp per meter rope/cable in Newtons
318 // Sugar kelp rope application - end
319
320 struct element {int p; int q; int v; int w; mat3 Mi; vec3 k; mat3 K; vec3 eDot; double nuDot;};
321 element* m_el;
322
323 ISignalPort* m_posA;
324 ISignalPort* m_posB;
325 ISignalPort* m_velA;
326 ISignalPort* m_velB;
327 ISignalPort* m_retractedLengthA;
328 ISignalPort* m_retractedLengthB;
329 ISignalPort* m_retractedSpeedA;
330 ISignalPort* m_retractedSpeedB;
331
332 int m_retractedNodesA;
333 int m_retractedNodesB;
334 int m_numFreeNodes;
335
336 vec3 m_ka;
337 vec3 m_kb;
338
339 ICommonComputation* m_calcDynamics;
340 Eigen::Matrix<double,Eigen::Dynamic,1> m_lambda;
341 Eigen::Matrix<double,Eigen::Dynamic,1> m_F_MDotV; //< external force F, minus Coriolis term dM/dt*V
342
343 double m_forceA[3];
344 double m_forceB[3];
345
346 // BS: Added element gravity force
347 int m_numAddedForce;
348 std::unique_ptr<int[]> m_addElement;
349 std::unique_ptr<double[]> m_addForce;
350 // BS: Added element gravity force
351
352 // BS: Port to output element position
353 int m_numOutElePos;
354 std::unique_ptr<int[]> m_OutEleIndex;
355 // BS: Port to output element position
356
357#ifdef FH_VISUALIZATION
358 double m_scale;
359 Ogre::SceneNode** m_ManualObjectNodes;
360#endif
361 };
362}
363#endif
Definition CCable.h:206
const double * forceB(const double T, const double *const X)
Output port. Returns current force in endpoint B of cable.
void OdeFcn(const double T, const double *const X, double *const XDot, const bool bIsMajorTimeStep)
Computes object derivatives as a function of time, states and input ports.
const double * forceA(const double T, const double *const X)
Output port. Returns current force in endpoint A of cable.
CCableRM(const string &simObjectName, ISimObjectCreator *const creator)
Reads parameters, registers states, input/output ports and shared resources.
void calculations(const double T, const double *const X)
Performs a series of computations within the cable object.
Class modelling a flexible bottom ring, inheriting from CRing in RMCable lib.
Definition CCable.h:139
Definition CCable.h:320