FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CLinearSpring.h
1
80#ifndef CLINEARSPRING_H
81#define CLINEARSPRING_H
82
83// Includes
84#include <fhsim/simobject/SimObject.h>
85
86#include <limits>
87#include <string>
88
89#ifdef FH_VISUALIZATION
90//#include "sfh/ogre/CDynamicLines.h"
91# include "sfh/ogre/C3DLine.h"
92#endif
93
94//Class definition
95class CLinearSpring : public SimObject
96{
97 public:
99 CLinearSpring(std::string sSimObjectName, ISimObjectCreator* pCreator);
100
103
104#ifdef FH_VISUALIZATION
106 virtual void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator);
107
109 virtual void RenderUpdate(const double dT, const double* const adX);
110#endif
111
112 // Member functions
114 void OdeFcn(const double dT, const double* const adX, double* const adXDot) const { }
115
117 const double* ForceA(const double dT, const double* const adX);
118
120 const double* ForceB(const double dT, const double* const adX);
121
122
123 protected:
124 // Member functions
126 void CalcOutput(const double dT, const double* const adX);
127
128 // Member variables
129 double m_dStiffness;
130 double m_dRelaxedLength;
131 ISignalPort* m_pInPosA;
132 ISignalPort* m_pInPosB;
133 double m_adOutForceA[3];
134 double m_adOutForceB[3];
135
136#ifdef FH_VISUALIZATION
137 Ogre::Entity* m_pRenderEntity;
138 Ogre::SceneNode* m_pRenderNode;
139 int m_iNumPoints;
140 C3DLine* m_pLines;
141#endif
142};
143
144
145#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:114