Marine systems simulation
VirtualSpring.h
1
10
11#ifndef VirtualSpring_H
12#define VirtualSpring_H
13
14#include "SimObject.h"
15#include <Eigen/Eigen>
16
17class VirtualSpring : public SimObject
18{
19public:
21 VirtualSpring(std::string sSimObjectName, ISimObjectCreator* pCreator);
23
25 void OdeFcn(const double T, const double* const X, double* const XDot, const bool bIsMajorTimeStep);
26
27 void InitialConditionSetup(const double T, const double* const X, double* const XDot, ISimObjectCreator* pCreator);
28
29 const double* OutPos(const double T, const double * const X);
30 const double* OutDeltaPos(const double T, const double * const X);
31 const double* OutDelta(const double T, const double * const X);
32 const double* OutDeltaLen(const double T, const double * const X);
33
34#ifdef FH_VISUALIZATION
36 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator){}
37
39 virtual void RenderUpdate(const double T, const double* const X){}
40#endif
41protected:
42 typedef Eigen::Matrix<double, 3, 1> vec3;
43
44 ISignalPort* m_InPosA;
45 ISignalPort* m_InPosB;
46 ISignalPort* m_InTar;
47 ISignalPort* m_InAct;
48 double m_TarTen;
49 double m_ActTen;
50 int m_adLength, m_adIntegral, m_adDerivate;
51 double m_Pp, m_Pd, m_Pi, m_IntegralSaturation, m_DerivativeTInv;
52 double m_StiffN;
53 vec3 m_adForceA;
54 double m_OutPos[3];
55 double m_OutDeltaPos[3];
56 double m_adLengthMax;
57 double m_InitialT;
58 double m_ErrorMax;
59 double m_OutDelta;
60 double m_OutDeltaLen;
61 double m_MinTen;
62
63 bool m_NoCompress;
64 double m_InitialLength;
65 ISignalPort* m_InAdPosA;
66 ISignalPort* m_InAdPosB;
67};
68
69
70#endif
Definition: VirtualSpring.h:18
void OdeFcn(const double T, const double *const X, double *const XDot, const bool bIsMajorTimeStep)
Calculates the state derivatives.
VirtualSpring(std::string sSimObjectName, ISimObjectCreator *pCreator)
Constructor.