FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CableBranched.h
1#pragma once
2
212#include "cable/subroutines/InternalCableWithBottomContact.h"
213
214#include "sfh/timers/StopWatch.h"
215
216#include <fhsim/simobject/SimObject.h>
217#include <fhsim_environment/EnvironmentProvider.h>
218#include <fhsim_environment/SeafloorForcesInterface.h>
219#include <string>
220
221#ifdef FH_VISUALIZATION
222# ifdef USE_BILLBOARD_LABELS
223# include "CMovableText.h"
224# endif
225#endif
226
227// Class definition
228class CableBranched : public SimObject
229{
230public:
232 CableBranched(std::string simObjectName, ISimObjectCreator* creator);
233 CableBranched(std::string simObjectName)
234 : SimObject(simObjectName)
235 { }
236 virtual void aFunction(std::string simObjectName, ISimObjectCreator* creator);
239
240 // Member functions
241 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot) const;
242 bool HasJacobians() const override;
243 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
244 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
245 void FinalSetup(const double dT, const double* const adX, ISimObjectCreator* const creator);
246 void InitialConditionSetup(const double dT, const double* const adCurrentIC, double* const adUpdatedIC, ISimObjectCreator* const creator);
247#ifdef FH_VISUALIZATION
249 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
250
252 void RenderUpdate(const double dT, const double* const adX);
253#endif
254
255protected:
256 virtual void CreateStates(ISimObjectCreator* creator);
257 void CalcOutput(const double dT, const double* const adX) const;
258 void OutputExternalConnForces(double dT, const double* adX);
259 void GetPosAndVelPointer(
260 int node,
261 double dT,
262 const double* const adX,
263 const double** const padPos,
264 const double** const padVel) const;
265
266 const double* GetPosPointer(
267 int node,
268 double dT,
269 const double* const adX) const;
270
271
273 virtual void AddBottomForces(double dT, const double* const adX) const;
274 virtual void CreateDataStructures();
275 virtual void CreateInputports(ISimObjectCreator* creator);
276 virtual void CreateOutputports(ISimObjectCreator* creator);
277
278
280 void CheckNodeNumber(int nodeNumber, std::string nodeDescription, ISimObjectCreator* creator);
281
282 ISignalPort** m_inVel;
283 ISignalPort** m_inPos;
284 ISignalPort** m_inLength;
285 ICommonComputation* m_commonCalc;
286 const double* ExternalForce(const double dT, const double* const adX, int i);
287 const double* ExternalTension(const double dT, const double* const adX, int i);
288 const double* SectionLength(const double dT, const double* const adX, int i);
299
300 // int* m_numAEndsToExt; ///< The number of elements with the A node connected to each external node.
301 // int* m_numBEndsToExt; ///< The number of elements with the B node connected to each external node.
302 // int** m_aaiAEndsToExt; ///< The elements with the A node connected to each external node.
303 // int** m_aaiBEndsToExt; ///< The elements with the B node connected to each external node.
304
305 // int* m_numElementsPerSection;
309 double m_fluidRho;
311 double m_maxStep;
313 double* m_stiffness;
318 double* m_density;
319 double* m_dE;
320 double* m_diameter;
321 double* m_maxTension;
323 // double* m_inertiaA; ///< The inertia of the connected end A of each eleemnt.
324 // double* m_inertiaB; ///< The inertia of the connected end B of each eleemnt.
325 double* m_nodeForce;
326 // double* m_forceA; ///< The force on the A nodes.
327 // double* m_forceB; ///< The force on the B nodes.
328 double* m_lengths;
329 std::string m_materialName;
330 double m_drawScale;
331 double* m_externalTensions;
333
334 const double* m_padVelWater;
335 environment::EnvironmentProvider* m_environment;
336 environment::SeafloorForcesInterface* m_seafloor;
337 // bool m_outputFcnCalled;
338#ifdef FH_VISUALIZATION
339# ifdef USE_BILLBOARD_LABELS
340 Ogre::SceneNode** m_renderNode;
341 Ogre::CMovableText** m_bBTxt;
342 double m_txtSize;
343# endif
344#endif
345};
Definition CableBranched.h:229
double m_drawScale
The scale for which to draw the cable diameter.
Definition CableBranched.h:330
InternalCable ** m_cableSections
An array holding the cable sections.
Definition CableBranched.h:332
int * m_iStateVel
An array of indices to the node velocity states.
Definition CableBranched.h:290
double * m_relaxedLength
The relaxed length of the cable.
Definition CableBranched.h:314
CableBranched(std::string simObjectName, ISimObjectCreator *creator)
The constructor sets the pointer to the output object and the parser object.
int * m_iStatePos
An array of indices to the node position states.
Definition CableBranched.h:289
int m_cableFaces
The number of faces of the cable visuaization.
Definition CableBranched.h:298
int m_numExternalConn
The number of external connections.
Definition CableBranched.h:296
ISignalPort ** m_inPos
The position input ports.
Definition CableBranched.h:283
virtual void AddBottomForces(double dT, const double *const adX) const
Adds the bottom forces to the main nodes.
double * m_dE
The stiffness of the cable material.
Definition CableBranched.h:319
double * m_density
The density of the cable material.
Definition CableBranched.h:318
int m_numNodesCalc
The number of nodes of the cable between the cable elements.
Definition CableBranched.h:293
double * m_stiffness
The linear stiffness of the cable.
Definition CableBranched.h:313
int * m_nodeConnections
The nodes connected to each cable section.
Definition CableBranched.h:297
double m_eAdaptationPeriod
The time constant of the adaptation of the mean tension.
Definition CableBranched.h:307
double * m_diameter
The diameter of the cable.
Definition CableBranched.h:320
double m_maxLengthChangeSpeed
The maximum speed of the cable length change.
Definition CableBranched.h:316
double m_maxAcceleration
The value to truncate the acceleration of each node to.
Definition CableBranched.h:310
double * m_lengths
The lengths of the cable elements.
Definition CableBranched.h:328
~CableBranched()
The destructor deletes dynamically allocated memory.
double m_stepSafetyFactor
The safety factor when calculating the Young modulus of the element.
Definition CableBranched.h:306
double m_maxStep
The maximum steplength of the simulation.
Definition CableBranched.h:311
double * m_maxTension
The maximum tension in the cable.
Definition CableBranched.h:321
int m_numCableSections
The number of cable sections in the branched cable, where each section may be comprised of one or mor...
Definition CableBranched.h:294
double * m_dampingRatio
The damping ratio to specify the internal damping.
Definition CableBranched.h:317
double * m_nodeForce
The force on the calculation nodes belonging to this simObject.
Definition CableBranched.h:325
double m_numericalDamping
The numerical damping of the cable.
Definition CableBranched.h:308
int m_numElements
The number of elements to divide the cable into.
Definition CableBranched.h:292
int * m_iStateCable
An array of indices to the cable sections states.
Definition CableBranched.h:291
double * m_meanTension
The mean tension of the cable.
Definition CableBranched.h:312
ISignalPort ** m_inLength
The cable sections length port.
Definition CableBranched.h:284
int m_numNodesGlobal
The number of nodes of the branched cable used for conecting the internal cable sections.
Definition CableBranched.h:295
double * m_nodeInertia
The inertia of the calculation nodes belonging to this simObject.
Definition CableBranched.h:322
ICommonComputation * m_commonCalc
Calculations necessary for more than one output port.
Definition CableBranched.h:285
std::string m_materialName
The material name of the cable;.
Definition CableBranched.h:329
double * m_relaxedLength_d
The desired relaxed length of the cable.
Definition CableBranched.h:315
ISignalPort ** m_inVel
The velocity input port s.
Definition CableBranched.h:282
void CheckNodeNumber(int nodeNumber, std::string nodeDescription, ISimObjectCreator *creator)
Checks to see if a specified nodenumber is ok.
double m_fluidRho
The density of the surrounding fluid.
Definition CableBranched.h:309
Definition InternalCable.h:190