Marine systems simulation
CCable.h
1
128#ifndef C_CABLERM_H
129#define C_CABLERM_H
130
131#include <Eigen/Eigen>
132
133#include <CPrintDuringExec.h>
134#include <SimObject.h>
135#include "CEnvironment.h"
136#ifdef FH_VISUALIZATION
137 #include "sfh/ogre/C3DLine.h"
138#endif
139#include <memory>
140
141namespace System
142{
208 class CCableRM : public SimObject
209 {
210 public:
222 CCableRM(const string& simObjectName, ISimObjectCreator* const creator);
223 ~CCableRM();
234 void OdeFcn(const double T, const double* const X, double* const XDot, const bool bIsMajorTimeStep);
235
236 void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
237 void FinalSetup(const double T, const double *const X, ISimObjectCreator* const creator);
238
248 const double* forceA(const double T, const double* const X);
258 const double* forceB(const double T, const double* const X);
269 void calculations(const double T, const double* const X);
270
271 // BS: Port to output element position
272 const double* OutPos(const double T, const double* const X, const int i);
273 // BS: Port to output element position
274
275#ifdef FH_VISUALIZATION
276 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
277 void RenderUpdate( const double T, const double* const X);
278#endif
279
280 protected:
281
282 typedef Eigen::Matrix<double,3,3> mat3;
283 typedef Eigen::Matrix<double,3,1> vec3;
284
285 void DistributeCatenary( Eigen::Matrix<double,3,1> P1, Eigen::Matrix<double,3,1> P2, double L, double* states, int i1, int i2, ISimObjectCreator* creator );
286
287 CPrintDuringExec* m_print;
288 CEnvironment* m_environment;
289
290 int m_numElements;
291 double m_totalLength;
292 double m_radius;
293 double m_weight;
294 double m_alphaN;
295 double m_betaN;
296 double m_epsilonN;
297 double m_alphaM;
298 double m_betaM;
299 double m_epsilonM;
300 double m_alphaT;
301 double m_betaT;
302 double m_epsilonT;
303
304 double m_bending_epsilon[3];
305
306 //double m_rho;
307 //double m_surfacePosZ;
308 //double m_rhoWater;
309 //double m_Ct; // tangential damping coefficient
310 //double m_Cn; // normal damping coefficient
311
312 double m_length;
313 double m_mass;
314 double m_Ixy;
315 double m_Iz;
316 //bool TEMP_BOOL_VAR__ISMAJORTIMESTEP;
317
318 // Sugar kelp rope application - start
319 bool m_kelp; // 1 if used as a kelp rope, 0 otherwise
320 double m_wKelp; // Biomass of kelp per meter rope/cable in Newtons
321 // Sugar kelp rope application - end
322
323 struct element {int p; int q; int v; int w; mat3 Mi; vec3 k; mat3 K; vec3 eDot; double nuDot;};
324 element* m_el;
325
326 ISignalPort* m_posA;
327 ISignalPort* m_posB;
328 ISignalPort* m_velA;
329 ISignalPort* m_velB;
330 ISignalPort* m_retractedLengthA;
331 ISignalPort* m_retractedLengthB;
332 ISignalPort* m_retractedSpeedA;
333 ISignalPort* m_retractedSpeedB;
334
335 int m_retractedNodesA;
336 int m_retractedNodesB;
337 int m_numFreeNodes;
338
339 vec3 m_ka;
340 vec3 m_kb;
341
342 ICommonComputation* m_calcDynamics;
343 Eigen::Matrix<double,Eigen::Dynamic,1> m_lambda;
344 Eigen::Matrix<double,Eigen::Dynamic,1> m_F_MDotV; //< external force F, minus Coriolis term dM/dt*V
345
346 double m_forceA[3];
347 double m_forceB[3];
348
349 // BS: Added element gravity force
350 int m_numAddedForce;
351 std::unique_ptr<int[]> m_addElement;
352 std::unique_ptr<double[]> m_addForce;
353 // BS: Added element gravity force
354
355 // BS: Port to output element position
356 int m_numOutElePos;
357 std::unique_ptr<int[]> m_OutEleIndex;
358 // BS: Port to output element position
359
360#ifdef FH_VISUALIZATION
361 double m_scale;
362 Ogre::SceneNode** m_ManualObjectNodes;
363#endif
364 };
365}
366#endif
Definition: CEnvironment.h:10
Definition: CCable.h:209
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:142
Definition: CCable.h:323