Marine systems simulation
CLinearSpring.h

See also the class documentation.

//
#ifndef CLINEARSPRING_H
#define CLINEARSPRING_H
#include "SimObject.h"
#include "sfh/timers/Timer.h"
#include <limits>
#include <string>
#ifdef FH_VISUALIZATION
# include "sfh/ogre/C3DLine.h"
#endif
//Class definition
class CLinearSpring : public SimObject
{
public:
CLinearSpring(std::string sSimObjectName, ISimObjectCreator* pCreator);
#ifdef FH_VISUALIZATION
virtual void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator);
virtual void RenderUpdate(const double dT, const double* const adX);
#endif
// Member functions
void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep) { }
const double* ForceA(const double dT, const double* const adX);
const double* ForceB(const double dT, const double* const adX);
protected:
void CalcOutput(const double dT, const double* const adX);
// Member variables
double m_dStiffness;
ISignalPort* m_pInPosA;
ISignalPort* m_pInPosB;
double m_adOutForceA[3];
double m_adOutForceB[3];
sfh::timers::Timer m_OutputTimer;
ICommonComputation* m_CalcOutputs;
#ifdef FH_VISUALIZATION
Ogre::Entity* m_pRenderEntity;
Ogre::SceneNode* m_pRenderNode;
int m_iNumPoints;
C3DLine* m_pLines;
#endif
};
#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
ICommonComputation * m_CalcOutputs
Common computation for outputs.
Definition: CLinearSpring.h:64
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:44
const double * ForceB(const double dT, const double *const adX)
Calculates the end force B.
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