FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CenterWeight.h
1#pragma once
2
79#include <fhsim/simobject/SimObject.h>
80#include <fhsim_environment/EnvironmentProvider.h>
81#include <fhsim_environment/SeafloorForcesInterface.h>
82
83class CenterWeight : public SimObject
84{
85public:
86 CenterWeight(std::string simObjectName, ISimObjectCreator* creator);
87
89 virtual void OdeFcn(const double dT, const double* const adX,
90 double* const adXDot) const;
91
96 bool HasJacobians() const override;
97 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
98 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
99 bool HasPortJacobians() const override;
100 void InputPortJacobian(const std::string& portName, double T, const double* X,
101 double* dF_dInput, int portSize, int nStates) override;
103#ifdef FH_VISUALIZATION
105 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
107 void RenderUpdate(const double T, const double* const X);
108#endif
109 void FinalSetup(const double dT, const double* const adX, ISimObjectCreator* const creator);
110 virtual const double* Position(const double dT, const double* const adX);
111 virtual const double* Velocity(const double dT, const double* const adX);
112
113protected:
114 ISignalPort* m_inForce1;
115 ISignalPort* m_inForce2;
116 ISignalPort* m_inForce3;
119
120 double m_mass;
121 double m_density;
122 double m_visualizationScale;
123 double m_radius;
124 double m_weight;
125
126 environment::EnvironmentProvider* m_environment;
127 environment::SeafloorForcesInterface* m_seafloor;
128
129#ifdef FH_VISUALIZATION
130 std::string m_material;
131 std::string m_meshName;
132 double m_scale;
133 Ogre::Entity* m_renderEntity;
134 Ogre::SceneNode* m_renderNode;
135 Ogre::SceneManager* m_sceneMgr;
136#endif
137};
Definition CenterWeight.h:84
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot) const
Calculates the state derivatives.
int m_IStateVel
The index of the velocity state.
Definition CenterWeight.h:118
ISignalPort * m_inForce2
A pointer to the input force 2.
Definition CenterWeight.h:115
int m_IStatePos
The index of the position state.
Definition CenterWeight.h:117
ISignalPort * m_inForce3
A pointer to the input force 3.
Definition CenterWeight.h:116
ISignalPort * m_inForce1
A pointer to the input force 1.
Definition CenterWeight.h:114