228#include "cable/subroutines/InternalCableWithBottomContact.h"
230#include "sfh/timers/StopWatch.h"
232#include <fhsim/simobject/SimObject.h>
233#include <fhsim_environment/EnvironmentProvider.h>
234#include <fhsim_environment/SeafloorForcesInterface.h>
240#ifdef FH_VISUALIZATION
241# ifdef USE_BILLBOARD_LABELS
242# include "CMovableText.h"
261 virtual void OdeFcn(
const double dT,
const double*
const adX,
double*
const adXDot)
const;
264 bool HasJacobians()
const override;
266 void OdeJacobian(
double T,
const double* X,
double* J,
int nStates)
override;
267 int GetJacobianSparsity(
int nStates,
int* rowPtr,
int* colIdx)
override;
268 void FinalSetup(
const double dT,
const double*
const adX, ISimObjectCreator*
const creator);
269 void InitialConditionSetup(
const double dT,
const double*
const adCurrentIC,
double*
const adUpdatedIC, ISimObjectCreator*
const creator);
270#ifdef FH_VISUALIZATION
272 void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
275 void RenderUpdate(
const double dT,
const double*
const adX);
294 void CreateStates(ISimObjectCreator* creator);
295 void CalcOutput(
const double dT,
const double*
const adX)
const;
303 void OutputExternalConnForces(
double dT,
const double* adX);
304 void GetPosAndVelPointer(
307 const double*
const adX,
308 const double**
const padPos,
309 const double**
const padVel)
const;
311 const double* GetPosPointer(
314 const double*
const adX)
const;
319 virtual void CreateDataStructures();
320 virtual void CreateInputports(ISimObjectCreator* creator);
321 virtual void CreateOutputports(ISimObjectCreator* creator);
325 void CheckNodeNumber(
int nodeNumber, std::string nodeDescription, ISimObjectCreator* creator);
331 const double* ExternalForce(
const double dT,
const double*
const adX,
int i);
332 const double* ExternalTension(
const double dT,
const double*
const adX,
int i);
333 const double* SectionLength(
const double dT,
const double*
const adX,
int i);
393 double* m_externalTensions;
396 const double* m_padVelWater;
397 environment::EnvironmentProvider* m_environment;
398 environment::SeafloorForcesInterface* m_seafloor;
400#ifdef FH_VISUALIZATION
401# ifdef USE_BILLBOARD_LABELS
402 Ogre::SceneNode** m_renderNode;
403 Ogre::CMovableText** m_bBTxt;
410 void ReadFile(ISimObjectCreator* creator,
const SectionFactory& makeSection);
Definition CableBranched.h:248
virtual void PrepareSections(double, const double *) const
Definition CableBranched.h:302
double m_drawScale
The scale for which to draw the cable diameter.
Definition CableBranched.h:392
InternalCable ** m_cableSections
An array holding the cable sections.
Definition CableBranched.h:394
int * m_iStateVel
An array of indices to the node velocity states.
Definition CableBranched.h:335
CableBranched(std::string simObjectName, ISimObjectCreator *creator, const SectionFactory &makeSection)
A subclass's sections: reads the file as Cable/Branched does and makes each section with makeSection.
double * m_relaxedLength
The relaxed length of the cable.
Definition CableBranched.h:367
CableBranched(std::string simObjectName, ISimObjectCreator *creator)
Cable/Branched: reads the file and makes every section an InternalCableWithBottomContact.
int * m_iStatePos
An array of indices to the node position states.
Definition CableBranched.h:334
int m_cableFaces
The number of faces of the cable visuaization.
Definition CableBranched.h:353
double m_bottomContactDiameter
BottomContactDiameter of the General section: the sphere of each main node in the seabed contact [m].
Definition CableBranched.h:370
void PreOdeFcn(double T, const double *X) override
Applies the Length inputs and advances the sections' mean tension from the step's start state (MARE-0...
int m_numExternalConn
The number of external connections.
Definition CableBranched.h:351
void OdeJacobian(double T, const double *X, double *J, int nStates) override
Writes nothing while HasJacobians() is false (FhSim's Jacobian checker, E12-Q3).
ISignalPort ** m_inPos
The position input ports.
Definition CableBranched.h:328
int m_iStateBase
Global index of this SimObject's first state, set in CreateStates().
Definition CableBranched.h:337
virtual void AddBottomForces(double dT, const double *const adX) const
Adds the bottom forces to the main nodes, and marks the state (MarkForceOutsideJacobian) if any of th...
double * m_dE
The stiffness of the cable material.
Definition CableBranched.h:373
double * m_density
The density of the cable material.
Definition CableBranched.h:372
int m_numNodesCalc
The number of nodes of the cable between the cable elements.
Definition CableBranched.h:348
double * m_stiffness
The linear stiffness of the cable.
Definition CableBranched.h:366
int * m_nodeConnections
The nodes connected to each cable section.
Definition CableBranched.h:352
double m_eAdaptationPeriod
The time constant of the adaptation of the mean tension.
Definition CableBranched.h:362
double * m_diameter
The diameter of the cable.
Definition CableBranched.h:374
double m_maxLengthChangeSpeed
The maximum speed of the cable length change.
Definition CableBranched.h:369
std::function< std::unique_ptr< InternalCable >(ISimObjectCreator *creator, const SCableSpec &spec)> SectionFactory
Definition CableBranched.h:253
double * m_lengths
The lengths of the cable elements.
Definition CableBranched.h:389
double * m_outLengths
As m_lengths, as CalcOutput found it for the Length ports.
Definition CableBranched.h:390
~CableBranched()
The destructor deletes dynamically allocated memory.
int LocalIndex(int globalStateIndex) const
Definition CableBranched.h:346
double m_stepSafetyFactor
The safety factor when calculating the Young modulus of the element.
Definition CableBranched.h:361
void UpdateSectionLength(int element, double dT, const double *adX) const
Reads the Length input of a cable section and applies it to the section (MARE-0037).
std::mutex m_sectionMutex
Definition CableBranched.h:386
double m_maxStep
The maximum steplength of the simulation.
Definition CableBranched.h:364
double * m_maxTension
The maximum tension in the cable.
Definition CableBranched.h:375
bool m_forceOutsideJacobian
Whether the last OdeFcn state had a force OdeJacobian does not model: bottom contact (FISH-0086) or a...
Definition CableBranched.h:338
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:349
double * m_dampingRatio
The damping ratio to specify the internal damping.
Definition CableBranched.h:371
virtual void AddJunctionNodeForce(const double[3], const double[3], double[3]) const
Definition CableBranched.h:288
double * m_nodeForce
The force on the calculation nodes belonging to this simObject, as OdeFcn found it.
Definition CableBranched.h:379
double m_numericalDamping
The numerical damping of the cable.
Definition CableBranched.h:363
double * m_outNodeForce
As m_nodeForce, as CalcOutput found it for the Force and Tension ports.
Definition CableBranched.h:380
int m_numElements
The number of elements to divide the cable into.
Definition CableBranched.h:347
int * m_iStateCable
An array of indices to the cable sections states.
Definition CableBranched.h:336
double * m_meanTension
The mean tension of the cable.
Definition CableBranched.h:365
ISignalPort ** m_inLength
The cable sections length port.
Definition CableBranched.h:329
double * m_outNodeInertia
As m_nodeInertia, as CalcOutput found it.
Definition CableBranched.h:381
int m_numNodesGlobal
The number of nodes of the branched cable used for conecting the internal cable sections.
Definition CableBranched.h:350
double * m_nodeInertia
The inertia of the calculation nodes belonging to this simObject.
Definition CableBranched.h:376
ICommonComputation * m_commonCalc
Calculations necessary for more than one output port.
Definition CableBranched.h:330
std::string m_materialName
The material name of the cable;.
Definition CableBranched.h:391
double * m_relaxedLength_d
The desired relaxed length of the cable.
Definition CableBranched.h:368
ISignalPort ** m_inVel
The velocity input port s.
Definition CableBranched.h:327
void MarkForceOutsideJacobian() const
Definition CableBranched.h:292
void CheckNodeNumber(int nodeNumber, std::string nodeDescription, ISimObjectCreator *creator)
Checks to see if a specified nodenumber is ok.
Definition InternalCable.h:214
Contains some specifications used for simulating cables.
Definition InternalCable.h:59