FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Cable.h
1#pragma once
129#include <Eigen/Eigen>
130
131#include <fhsim/PrintDuringExec.h>
132#include <fhsim/simobject/SimObject.h>
133#include <fhsim_environment/EnvironmentProvider.h>
134#ifdef FH_VISUALIZATION
135# include "sfh/ogre/C3DLine.h"
136#endif
137
138namespace RbCable
139{
205class CCableRM : public SimObject
206{
207public:
219 CCableRM(const std::string& simObjectName, ISimObjectCreator* const creator);
220 ~CCableRM();
231 void OdeFcn(const double T, const double* const X, double* const XDot) const;
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 void calculationsCommon(const double T, const double* const X) const;
268
269#ifdef FH_VISUALIZATION
270 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
271 void RenderUpdate(const double T, const double* const X);
272#endif
273
274protected:
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 PrintDuringExec* m_print;
281 environment::EnvironmentProvider* 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
317 {
318 int p;
319 int q;
320 int v;
321 int w;
322 mat3 Mi;
323 vec3 k;
324 mat3 K;
325 vec3 eDot;
326 double nuDot;
327 };
328 element* m_el;
329
330 ISignalPort* m_posA;
331 ISignalPort* m_posB;
332 ISignalPort* m_velA;
333 ISignalPort* m_velB;
334 ISignalPort* m_retractedLengthA;
335 ISignalPort* m_retractedLengthB;
336 ISignalPort* m_retractedSpeedA;
337 ISignalPort* m_retractedSpeedB;
338
339 int m_retractedNodesA;
340 int m_retractedNodesB;
341 int m_numFreeNodes;
342
343 vec3 m_ka;
344 vec3 m_kb;
345
346 ICommonComputation* m_calcDynamics;
347 Eigen::Matrix<double, Eigen::Dynamic, 1> m_lambda;
348 Eigen::Matrix<double, Eigen::Dynamic, 1> m_F_MDotV; //< external force F, minus Coriolis term dM/dt*V
349
350 double m_forceA[3];
351 double m_forceB[3];
352
353#ifdef FH_VISUALIZATION
354 double m_scale;
355 Ogre::SceneNode** m_ManualObjectNodes;
356#endif
357};
358} // namespace RbCable
Definition Cable.h:206
void OdeFcn(const double T, const double *const X, double *const XDot) const
Computes object derivatives as a function of time, states and input ports.
CCableRM(const std::string &simObjectName, ISimObjectCreator *const creator)
Reads parameters, registers states, input/output ports and shared resources.
const double * forceA(const double T, const double *const X)
Output port. Returns current force in endpoint A of cable.
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 Cable.h:317