FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
RigidBarCable.h
1#pragma once
2
91#include <string>
92#include <vector>
93#include <fhsim/simobject/SimObject.h>
94#ifdef FH_VISUALIZATION
95#include "sfh/ogre/CDynamicLines.h"
96#endif
97#include <limits>
98
99#include "subroutines/RBCEngine.h"
100
101
102//Class definition
103class RigidBarCable : public SimObject
104{
105public:
107 RigidBarCable(std::string simObjectName, ISimObjectCreator* creator);
109
110
113
114#ifdef FH_VISUALIZATION
116 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
118
120 void RenderUpdate(const double T, const double* const X);
122#endif
123
124 // Member functions
126 void OdeFcn(const double T, const double* const X,
127 double* const XDot) const;
129
130 // Output port
131 const double* const ForceA(const double T, const double* const X);
132 const double* const ForceB(const double T, const double* const X);
133 const double* const PosR(const double T, const double* const X,
134 const int index);
135 const double* const VelR(const double T, const double* const X,
136 const int index);
137
138protected:
140 void CalcOutput(const double T, const double* const X) const;
141
142 void InitialConditionSetup(const double T,
143 const double *const currentIC,
144 double* const updatedIC,
145 ISimObjectCreator* const creator);
146
147
148
149 protected:
150 // States
151 int m_ISVecR;
152 int m_ISVecRdot;
153 int m_ISVecB;
154 int m_ISVecBdot;
155 int m_ISEndNodeSum;
156
157#ifdef FH_VISUALIZATION
158 Ogre::Entity* m_RenderSpring;
159 Ogre::SceneNode* m_RenderNode;
160 int m_numPoints;
161 CDynamicLines* m_lines = nullptr;
162#endif
163
164 private:
165 // Input port
166 ISignalPort* m_PosA;
167 ISignalPort* m_VelA;
168 ISignalPort* m_PosB;
169 ISignalPort* m_VelB;
170
171 RBCEngine *m_engine;
172
173 double *m_forceOutA;
174 double *m_forceOutB;
175 double *m_posROut;
176 double *m_velROut;
177
178 int m_NofBarElements;
179
183 bool Evaluate(const double T, const double* const X, const bool advanceHistory) const;
184
185 ICommonComputation* m_commonCalc = nullptr;
186
187 mutable std::vector<double> m_addedMass;
188 mutable std::vector<double> m_nodeForces;
189};
Class containing a Rigid Bar Cable (RBC) calculation engine.
Definition RBCEngine.h:20
Definition RigidBarCable.h:104
void CalcOutput(const double T, const double *const X) const
Common calculation of the output ports: the engine at (T, X), without advancing its history.
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.