FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Cable.h
1#pragma once
132#include <Eigen/Eigen>
133
134#include <fhsim/PrintDuringExec.h>
135#include <fhsim/simobject/SimObject.h>
136#include <fhsim_environment/EnvironmentProvider.h>
137#ifdef FH_VISUALIZATION
138# include "sfh/ogre/C3DLine.h"
139#endif
140
141namespace RbCable
142{
208class CableRM : public SimObject
209{
210public:
222 CableRM(const std::string& simObjectName, ISimObjectCreator* const creator);
223 ~CableRM();
234 void OdeFcn(const double T, const double* const X, double* const XDot) const;
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 void calculationsCommon(const double T, const double* const X) const;
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
277protected:
278 typedef Eigen::Matrix<double, 3, 3> mat3;
279 typedef Eigen::Matrix<double, 3, 1> vec3;
280
281 void DistributeCatenary(Eigen::Matrix<double, 3, 1> P1, Eigen::Matrix<double, 3, 1> P2, double L, double* states, int i1, int i2, ISimObjectCreator* creator);
282
283 PrintDuringExec* m_print;
284 environment::EnvironmentProvider* m_environment;
285
286 int m_numElements;
287 double m_totalLength;
288 double m_radius;
289 double m_weight;
290 double m_alphaN;
291 double m_betaN;
292 double m_epsilonN;
293 double m_alphaM;
294 double m_betaM;
295 double m_epsilonM;
296 double m_alphaT;
297 double m_betaT;
298 double m_epsilonT;
299
300 double m_bending_epsilon[3];
301
302 // double m_rho;
303 // double m_surfacePosZ;
304 // double m_rhoWater;
305 // double m_Ct; // tangential damping coefficient
306 // double m_Cn; // normal damping coefficient
307
308 double m_length;
309 double m_mass;
310 double m_Ixy;
311 double m_Iz;
312 // bool TEMP_BOOL_VAR__ISMAJORTIMESTEP;
313
314 // Sugar kelp rope application - start
315 bool m_kelp; // 1 if used as a kelp rope, 0 otherwise
316 double m_wKelp; // Biomass of kelp per meter rope/cable in Newtons
317 // Sugar kelp rope application - end
318
319 struct element
320 {
321 int p;
322 int q;
323 int v;
324 int w;
325 mat3 Mi;
326 vec3 k;
327 mat3 K;
328 vec3 eDot;
329 double nuDot;
330 };
331 element* m_el;
332
333 ISignalPort* m_posA;
334 ISignalPort* m_posB;
335 ISignalPort* m_velA;
336 ISignalPort* m_velB;
337 ISignalPort* m_retractedLengthA;
338 ISignalPort* m_retractedLengthB;
339 ISignalPort* m_retractedSpeedA;
340 ISignalPort* m_retractedSpeedB;
341
342 int m_retractedNodesA;
343 int m_retractedNodesB;
344 int m_numFreeNodes;
345
346 vec3 m_ka;
347 vec3 m_kb;
348
349 ICommonComputation* m_calcDynamics;
350 Eigen::Matrix<double, Eigen::Dynamic, 1> m_lambda;
351 Eigen::Matrix<double, Eigen::Dynamic, 1> m_F_MDotV; //< external force F, minus Coriolis term dM/dt*V
352
353 double m_forceA[3];
354 double m_forceB[3];
355
356#ifdef FH_VISUALIZATION
357 double m_scale;
358 Ogre::SceneNode** m_ManualObjectNodes;
359#endif
360};
361} // namespace RbCable
Definition Cable.h:209
CableRM(const std::string &simObjectName, ISimObjectCreator *const creator)
Reads parameters, registers states, input/output ports and shared resources.
const double * forceB(const double T, const double *const X)
Output port. Returns current force in endpoint B of cable.
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.
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.
Definition Cable.h:320