Marine systems simulation
CCable.h
1#pragma once
129#include <Eigen/Eigen>
130
131#include <CPrintDuringExec.h>
132#include <SimObject.h>
133#include <CEnvironment.h>
134#ifdef FH_VISUALIZATION
135 #include "sfh/ogre/C3DLine.h"
136#endif
137
138namespace RbCable
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 IsMajorTimeStep);
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#ifdef FH_VISUALIZATION
269 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
270 void RenderUpdate( const double T, const double* const X);
271#endif
272
273 protected:
274
275 typedef Eigen::Matrix<double,3,3> mat3;
276 typedef Eigen::Matrix<double,3,1> vec3;
277
278 void DistributeCatenary( Eigen::Matrix<double,3,1> P1, Eigen::Matrix<double,3,1> P2, double L, double* states, int i1, int i2, ISimObjectCreator* creator );
279
280 CPrintDuringExec* m_print;
281 CEnvironment* m_environment;
282
283 int m_numElements;
284 double m_totalLength;
285 double m_radius;
286 double m_weight;
287 double m_alphaN;
288 double m_betaN;
289 double m_epsilonN;
290 double m_alphaM;
291 double m_betaM;
292 double m_epsilonM;
293 double m_alphaT;
294 double m_betaT;
295 double m_epsilonT;
296
297 double m_bending_epsilon[3];
298
299 //double m_rho;
300 //double m_surfacePosZ;
301 //double m_rhoWater;
302 //double m_Ct; // tangential damping coefficient
303 //double m_Cn; // normal damping coefficient
304
305 double m_length;
306 double m_mass;
307 double m_Ixy;
308 double m_Iz;
309 //bool TEMP_BOOL_VAR__ISMAJORTIMESTEP;
310
311 // Sugar kelp rope application - start
312 bool m_kelp; // 1 if used as a kelp rope, 0 otherwise
313 double m_wKelp; // Biomass of kelp per meter rope/cable in Newtons
314 // Sugar kelp rope application - end
315
316 struct element {int p; int q; int v; int w; mat3 Mi; vec3 k; mat3 K; vec3 eDot; double nuDot;};
317 element* m_el;
318
319 ISignalPort* m_posA;
320 ISignalPort* m_posB;
321 ISignalPort* m_velA;
322 ISignalPort* m_velB;
323 ISignalPort* m_retractedLengthA;
324 ISignalPort* m_retractedLengthB;
325 ISignalPort* m_retractedSpeedA;
326 ISignalPort* m_retractedSpeedB;
327
328 int m_retractedNodesA;
329 int m_retractedNodesB;
330 int m_numFreeNodes;
331
332 vec3 m_ka;
333 vec3 m_kb;
334
335 ICommonComputation* m_calcDynamics;
336 Eigen::Matrix<double,Eigen::Dynamic,1> m_lambda;
337 Eigen::Matrix<double,Eigen::Dynamic,1> m_F_MDotV; //< external force F, minus Coriolis term dM/dt*V
338
339 double m_forceA[3];
340 double m_forceB[3];
341
342#ifdef FH_VISUALIZATION
343 double m_scale;
344 Ogre::SceneNode** m_ManualObjectNodes;
345#endif
346 };
347}
Definition: CEnvironment.h:10
Definition: CCable.h:206
void OdeFcn(const double T, const double *const X, double *const XDot, const bool IsMajorTimeStep)
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.
const double * forceB(const double T, const double *const X)
Output port. Returns current force in endpoint B of cable.
Definition: CCable.h:316