FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
RigidBarCable.h
1#pragma once
2
89#include <string>
90#include <fhsim/simobject/SimObject.h>
91#ifdef FH_VISUALIZATION
92#include "sfh/ogre/CDynamicLines.h"
93#endif
94#include <limits>
95
96#include "subroutines/RBCEngine.h"
97
98
99//Class definition
100class RigidBarCable : public SimObject
101{
102public:
104 RigidBarCable(std::string simObjectName, ISimObjectCreator* creator);
106
107
110
111#ifdef FH_VISUALIZATION
113 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
115
117 void RenderUpdate(const double T, const double* const X);
119#endif
120
121 // Member functions
123 void OdeFcn(const double T, const double* const X,
124 double* const XDot) const;
126
127 // Output port
128 const double* const ForceA(const double T, const double* const X);
129 const double* const ForceB(const double T, const double* const X);
130 const double* const PosR(const double T, const double* const X,
131 const int index);
132 const double* const VelR(const double T, const double* const X,
133 const int index);
134
135protected:
136 void InitialConditionSetup(const double T,
137 const double *const currentIC,
138 double* const updatedIC,
139 ISimObjectCreator* const creator);
140
141
142
143 protected:
144 // States
145 int m_ISVecR;
146 int m_ISVecRdot;
147 int m_ISVecB;
148 int m_ISVecBdot;
149 int m_ISEndNodeSum;
150
151#ifdef FH_VISUALIZATION
152 Ogre::Entity* m_RenderSpring;
153 Ogre::SceneNode* m_RenderNode;
154 int m_numPoints;
155 CDynamicLines* m_lines = nullptr;
156#endif
157
158 private:
159 // Input port
160 ISignalPort* m_PosA;
161 ISignalPort* m_VelA;
162 ISignalPort* m_PosB;
163 ISignalPort* m_VelB;
164
165 RBCEngine *m_engine;
166
167 double *m_forceOutA;
168 double *m_forceOutB;
169 double *m_posROut;
170 double *m_velROut;
171
172 int m_NofBarElements;
173};
Class containing a Rigid Bar Cable (RBC) calculation engine.
Definition RBCEngine.h:20
Definition RigidBarCable.h:101
void OdeFcn(const double T, const double *const X, double *const XDot) const
Calculates the time derivative of the state vector.
RigidBarCable(std::string simObjectName, ISimObjectCreator *creator)
The constructor sets the pointer to the output object and the parser object.
~RigidBarCable()
The destructor cleans up dynamically allocated memory.