FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Thruster.h
1#ifndef CThruster_h__
2#define CThruster_h__
37#include <fhsim/simobject/SimObject.h>
38#include <fhsim_environment/EnvironmentProvider.h>
39#include "PropulsorWakeField.h"
40#include <memory>
41#include <string>
42
43#include "./Ship/Actuators/SimpleThruster.h"
44
45namespace Ship{
46
49 double position[3] = {0,0,0};
50 double axis[3] = {0,0,0};
51 };
52
54 marenv::Status ThrusterJet(const ThrusterWakeState& state, double time, const double position[3], double currentVelocity[3]);
55
56 using ThrusterCurrentField = PropulsorWakeField<ThrusterWakeState>;
57
58
59 class Thruster: public SimObject
60 {
61
62 public:
63 Thruster(const std::string simObjectName, ISimObjectCreator* const creator);
64
65 void FinalSetup( const double T, const double *const X, ISimObjectCreator* const creator );
66 void OdeFcn(const double T, const double* const X, double* const XDot) const;
68 void AcceptedStep(double T, const double* X) override;
69
70 #ifdef FH_VISUALIZATION
71 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
72 void RenderUpdate( const double T, const double* const X);
73 #endif
74
76 const double* ForceNED (const double T, const double* const X);
78 const double* PositionNED(const double T, const double* const X);
79
80 private:
82 double m_ForceMax;
84 double m_Diameter;
85
87 ISignalPort *m_InAxisNED;
89 ISignalPort *m_InPositionNED;
91 ISignalPort *m_InPitch;
93 ISignalPort *m_InN;
94
95
96 double m_Position[3];
97 double m_Force[3];
98 std::unique_ptr<SimpleThruster> ThrusterCalculator;
100 WarnOnce m_tableWarning;
101 environment::EnvironmentProvider *Environment = nullptr;
102 std::shared_ptr<ThrusterCurrentField> m_CurrentField = std::make_shared<ThrusterCurrentField>(ThrusterJet);
103
104 #ifdef FH_VISUALIZATION
105 Ogre::SceneNode* m_RenderNode;
106 #endif
107 };
108}
109
110#endif // CThruster_h__
Definition PropulsorWakeField.h:25
Definition Thruster.h:60
const double * PositionNED(const double T, const double *const X)
void AcceptedStep(double T, const double *X) override
Copies the wake state of the accepted state into the jet field (G4).
const double * ForceNED(const double T, const double *const X)
Definition TableLookup.h:18
Status
Definition marenv.h:44
Simple waypoint object.
Definition CableAttach.h:58
marenv::Status ThrusterJet(const ThrusterWakeState &state, double time, const double position[3], double currentVelocity[3])
The jet behind the thruster (G4: reads only the copy of the state). It is zero everywhere.
The state the thruster jet needs, copied after each accepted step.
Definition Thruster.h:48