Marine systems simulation
CLinearSpring.h
1
80#ifndef CLINEARSPRING_H
81#define CLINEARSPRING_H
82
83// Includes
84#include "SimObject.h"
85
86#include "sfh/timers/Timer.h"
87
88#include <limits>
89#include <string>
90
91#ifdef FH_VISUALIZATION
92//#include "sfh/ogre/CDynamicLines.h"
93# include "sfh/ogre/C3DLine.h"
94#endif
95
96//Class definition
97class CLinearSpring : public SimObject
98{
99 public:
101 CLinearSpring(std::string sSimObjectName, ISimObjectCreator* pCreator);
102
105
106#ifdef FH_VISUALIZATION
108 virtual void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator);
109
111 virtual void RenderUpdate(const double dT, const double* const adX);
112#endif
113
114 // Member functions
116 void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep) { }
117
119 const double* ForceA(const double dT, const double* const adX);
120
122 const double* ForceB(const double dT, const double* const adX);
123
124
125 protected:
126 // Member functions
128 void CalcOutput(const double dT, const double* const adX);
129
130 // Member variables
131 double m_dStiffness;
132 double m_dRelaxedLength;
133 ISignalPort* m_pInPosA;
134 ISignalPort* m_pInPosB;
135 double m_adOutForceA[3];
136 double m_adOutForceB[3];
137 sfh::timers::Timer m_OutputTimer;
138
139#ifdef FH_VISUALIZATION
140 Ogre::Entity* m_pRenderEntity;
141 Ogre::SceneNode* m_pRenderNode;
142 int m_iNumPoints;
143 C3DLine* m_pLines;
144#endif
145};
146
147
148#endif
A linear spring in 3 degrees of freedom.
Definition: CLinearSpring.h:26
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:62
ISignalPort * m_pInPosB
Input for position B.
Definition: CLinearSpring.h:60
void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Does nothing, as the object contains no states.
Definition: CLinearSpring.h:116
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:61
ISignalPort * m_pInPosA
Input for position A.
Definition: CLinearSpring.h:59
double m_dStiffness
The linear stiffness of the spring.
Definition: CLinearSpring.h:57
sfh::timers::Timer m_OutputTimer
Output timer.
Definition: CLinearSpring.h:63
double m_dRelaxedLength
the relaxed length of the spring.
Definition: CLinearSpring.h:58