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