FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CLinearSpring.h
1
78#ifndef CLINEARSPRING_H
79#define CLINEARSPRING_H
80
81// Includes
82#include <fhsim/simobject/SimObject.h>
83
84#include <limits>
85#include <string>
86
87#ifdef FH_VISUALIZATION
88//#include "sfh/ogre/CDynamicLines.h"
89# include "sfh/ogre/C3DLine.h"
90#endif
91
92//Class definition
93class CLinearSpring : public SimObject
94{
95 public:
97 CLinearSpring(std::string sSimObjectName, ISimObjectCreator* pCreator);
98
101
102#ifdef FH_VISUALIZATION
104 virtual void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator);
105
107 virtual void RenderUpdate(const double dT, const double* const adX);
108#endif
109
110 // Member functions
112 void OdeFcn(const double dT, const double* const adX, double* const adXDot) const { }
113
115 const double* ForceA(const double dT, const double* const adX);
116
118 const double* ForceB(const double dT, const double* const adX);
119
120
121 protected:
122 // Member functions
124 void CalcOutput(const double dT, const double* const adX);
125
126 // Member variables
127 double m_dStiffness;
128 double m_dRelaxedLength;
129 ISignalPort* m_pInPosA;
130 ISignalPort* m_pInPosB;
131 double m_adOutForceA[3];
132 double m_adOutForceB[3];
133
134#ifdef FH_VISUALIZATION
135 Ogre::Entity* m_pRenderEntity;
136 Ogre::SceneNode* m_pRenderNode;
137 int m_iNumPoints;
138 C3DLine* m_pLines;
139#endif
140};
141
142
143#endif
A linear spring in 3 degrees of freedom.
Definition CLinearSpring.h:25
CLinearSpring(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
const double * ForceA(const double dT, const double *const adX)
Calculates the end force A.
double m_adOutForceB[3]
Force vector on point B.
Definition CLinearSpring.h:61
ISignalPort * m_pInPosB
Input for position B.
Definition CLinearSpring.h:59
const double * ForceB(const double dT, const double *const adX)
Calculates the end force A.
void CalcOutput(const double dT, const double *const adX)
< Sets the parameters of the spring.
~CLinearSpring()
The destructor cleans up dynamically allocated memory.
double m_adOutForceA[3]
Force vector on point A.
Definition CLinearSpring.h:60
ISignalPort * m_pInPosA
Input for position A.
Definition CLinearSpring.h:58
double m_dStiffness
The linear stiffness of the spring.
Definition CLinearSpring.h:56
double m_dRelaxedLength
the relaxed length of the spring.
Definition CLinearSpring.h:57
void OdeFcn(const double dT, const double *const adX, double *const adXDot) const
Does nothing, as the object contains no states.
Definition CLinearSpring.h:112