FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CableBranched Class Reference
+ Inheritance diagram for CableBranched:
+ Collaboration diagram for CableBranched:

Public Types

using SectionFactory = std::function< std::unique_ptr< InternalCable >(ISimObjectCreator *creator, const SCableSpec &spec)>
 

Public Member Functions

 CableBranched (std::string simObjectName, ISimObjectCreator *creator)
 Cable/Branched: reads the file and makes every section an InternalCableWithBottomContact.
 
 ~CableBranched ()
 The destructor deletes dynamically allocated memory.
 
virtual void OdeFcn (const double dT, const double *const adX, double *const adXDot) const
 
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-0357).
 
bool HasJacobians () const override
 
void OdeJacobian (double T, const double *X, double *J, int nStates) override
 Writes nothing while HasJacobians() is false (FhSim's Jacobian checker, E12-Q3).
 
int GetJacobianSparsity (int nStates, int *rowPtr, int *colIdx) override
 
void FinalSetup (const double dT, const double *const adX, ISimObjectCreator *const creator)
 
void InitialConditionSetup (const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const creator)
 

Protected Member Functions

 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.
 
virtual void AddJunctionNodeForce (const double[3], const double[3], double[3]) const
 
void MarkForceOutsideJacobian () const
 
void CreateStates (ISimObjectCreator *creator)
 
void CalcOutput (const double dT, const double *const adX) const
 
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).
 
virtual void PrepareSections (double, const double *) const
 
void OutputExternalConnForces (double dT, const double *adX)
 
void GetPosAndVelPointer (int node, double dT, const double *const adX, const double **const padPos, const double **const padVel) const
 
const double * GetPosPointer (int node, double dT, const double *const adX) const
 
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 them got one.
 
virtual void CreateDataStructures ()
 
virtual void CreateInputports (ISimObjectCreator *creator)
 
virtual void CreateOutputports (ISimObjectCreator *creator)
 
void CheckNodeNumber (int nodeNumber, std::string nodeDescription, ISimObjectCreator *creator)
 Checks to see if a specified nodenumber is ok.
 
const double * ExternalForce (const double dT, const double *const adX, int i)
 
const double * ExternalTension (const double dT, const double *const adX, int i)
 
const double * SectionLength (const double dT, const double *const adX, int i)
 
int LocalIndex (int globalStateIndex) const
 

Protected Attributes

ISignalPort ** m_inVel
 The velocity input port s.
 
ISignalPort ** m_inPos
 The position input ports.
 
ISignalPort ** m_inLength
 The cable sections length port.
 
ICommonComputation * m_commonCalc
 Calculations necessary for more than one output port.
 
int * m_iStatePos
 An array of indices to the node position states.
 
int * m_iStateVel
 An array of indices to the node velocity states.
 
int * m_iStateCable
 An array of indices to the cable sections states.
 
int m_iStateBase = 0
 Global index of this SimObject's first state, set in CreateStates().
 
bool m_forceOutsideJacobian = false
 Whether the last OdeFcn state had a force OdeJacobian does not model: bottom contact (FISH-0086) or a subclass's own force.
 
int m_numElements
 The number of elements to divide the cable into.
 
int m_numNodesCalc
 The number of nodes of the cable between the cable elements.
 
int m_numCableSections
 The number of cable sections in the branched cable, where each section may be comprised of one or more elements.
 
int m_numNodesGlobal
 The number of nodes of the branched cable used for conecting the internal cable sections.
 
int m_numExternalConn
 The number of external connections.
 
int * m_nodeConnections
 The nodes connected to each cable section.
 
int m_cableFaces
 The number of faces of the cable visuaization.
 
double m_stepSafetyFactor
 The safety factor when calculating the Young modulus of the element.
 
double m_eAdaptationPeriod
 The time constant of the adaptation of the mean tension.
 
double m_numericalDamping
 The numerical damping of the cable.
 
double m_maxStep
 The maximum steplength of the simulation.
 
double * m_meanTension
 The mean tension of the cable.
 
double * m_stiffness
 The linear stiffness of the cable.
 
double * m_relaxedLength
 The relaxed length of the cable.
 
double * m_relaxedLength_d
 The desired relaxed length of the cable.
 
double m_maxLengthChangeSpeed
 The maximum speed of the cable length change.
 
double m_bottomContactDiameter = 0.5
 BottomContactDiameter of the General section: the sphere of each main node in the seabed contact [m].
 
double * m_dampingRatio
 The damping ratio to specify the internal damping.
 
double * m_density
 The density of the cable material.
 
double * m_dE
 The stiffness of the cable material.
 
double * m_diameter
 The diameter of the cable.
 
double * m_maxTension
 The maximum tension in the cable.
 
double * m_nodeInertia
 The inertia of the calculation nodes belonging to this simObject.
 
double * m_nodeForce
 The force on the calculation nodes belonging to this simObject, as OdeFcn found it.
 
double * m_outNodeForce = nullptr
 As m_nodeForce, as CalcOutput found it for the Force and Tension ports.
 
double * m_outNodeInertia = nullptr
 As m_nodeInertia, as CalcOutput found it.
 
std::mutex m_sectionMutex
 
double * m_lengths
 The lengths of the cable elements.
 
double * m_outLengths = nullptr
 As m_lengths, as CalcOutput found it for the Length ports.
 
std::string m_materialName
 The material name of the cable;.
 
double m_drawScale
 The scale for which to draw the cable diameter.
 
double * m_externalTensions
 
InternalCable ** m_cableSections
 An array holding the cable sections.
 
const double * m_padVelWater
 
environment::EnvironmentProvider * m_environment
 
environment::SeafloorForcesInterface * m_seafloor
 

Member Typedef Documentation

◆ SectionFactory

using CableBranched::SectionFactory = std::function<std::unique_ptr<InternalCable>(ISimObjectCreator* creator, const SCableSpec& spec)>

Makes one section of a branched cable from its spec as read from the file; the cable owns it. It runs inside the constructor, before a subclass exists: it may use only what it captured.

Member Function Documentation

◆ AddJunctionNodeForce()

virtual void CableBranched::AddJunctionNodeForce ( const double  [3],
const double  [3],
double  [3] 
) const
inlineprotectedvirtual

A subclass's own force on one junction node (a node of the branched cable with states, not an external connection) at position pos and velocity vel, added to force, the node's force so far. OdeFcn calls it for every junction node, in node order, after the sections' end forces and the bottom forces and before the derivatives; under m_sectionMutex, after PrepareSections(dT, adX). A force OdeJacobian does not model must call MarkForceOutsideJacobian(). Does nothing here.

Reimplemented in CableBranchedAttractor.

◆ LocalIndex()

int CableBranched::LocalIndex ( int  globalStateIndex) const
inlineprotected

Convert a model-global state index, as AddState returned it, to an index into the local state slice and Jacobian block that the Jacobian callbacks are handed.

Parameters
[in]globalStateIndexA value from m_iStateCable, m_iStatePos or m_iStateVel.
Returns
The same state's index counted from this SimObject's first state.

◆ MarkForceOutsideJacobian()

void CableBranched::MarkForceOutsideJacobian ( ) const
inlineprotected

Marks the current OdeFcn state as having a force OdeJacobian does not model: HasJacobians() is false until the next OdeFcn finds none. AddBottomForces and the sections' reports use it too (FISH-0086).

◆ PrepareSections()

virtual void CableBranched::PrepareSections ( double  ,
const double *   
) const
inlineprotectedvirtual

Prepares the cable sections for an evaluation at (dT, adX), adX the model-global states. OdeFcn and CalcOutput call it under m_sectionMutex before they evaluate the sections; a subclass whose sections take other inputs at (T, X) sets them here. Does nothing here.

Reimplemented in CableBranchedAttractor.

Member Data Documentation

◆ m_sectionMutex

std::mutex CableBranched::m_sectionMutex
mutableprotected

OdeFcn and CalcOutput share the cable sections' scratch (lengths, directions): with NumCores > 1 another object's OdeFcn reads a Force port, so CalcOutput, while this one's OdeFcn runs. Each takes this lock; each writes its own node arrays, so a port keeps its value while OdeFcn runs.


The documentation for this class was generated from the following file: