FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Propeller.h
1#ifndef CPropeller_h__
2#define CPropeller_h__
3
95#include <memory>
96
97#include <fhsim/simobject/ISimObjectCreator.h>
98#include <fhsim_environment/EnvironmentProvider.h>
99
100#ifdef FH_VISUALIZATION
101#include "sfh/ogre/CDynamicLines.h"
102#endif
103#include "./Ship/Actuators/IPropellerCalculator.h"
104#include "./Ship/Actuators/OpenWaterPropeller.h"
105#include "./Ship/Actuators/TableLookup.h"
106#include "PropulsorWakeField.h"
107#include <memory>
108#include <string>
109
110namespace Ship{
111
114 double position[3] = {0,0,0};
115 double axis[3] = {1,0,0};
116 double Us = 0;
117 double Rs = 0;
118 };
119
121 marenv::Status PropellerJet(const PropellerWakeState& state, double T, const double position[3], double currentVelocity[3]);
122
123 using PropellerCurrentField = PropulsorWakeField<PropellerWakeState>;
124
125 class Propeller: public SimObject
126 {
127 public:
128 Propeller(const std::string simObjectName, ISimObjectCreator* const creator);
129 void FinalSetup( const double T, const double *const X, ISimObjectCreator* const creator );
130 void OdeFcn(const double T, const double* const X, double* const XDot) const;
132 void AcceptedStep(double T, const double* X) override;
133
134 #ifdef FH_VISUALIZATION
135 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
136 void RenderUpdate( const double T, const double* const X);
137 #endif
138
140 const double* BladeTopNED(const double T, const double* const X);
142 const double* ForceNED(const double T, const double* const X);
144 const double* TorqueNED(const double T, const double* const X);
146 const double* Us(const double T, const double* const X);
148 const double* Rs(const double T, const double* const X);
149
150 private:
151
153 void ComputeThrust(const double T, const double* const X) const;
154
155 double Ct( double U, double F);
156
159 double Coefficient(double pitchRatio, double J, bool torque) const;
160
162 double m_Diameter;
165 bool m_DummyPropeller;
166
168 ISignalPort *m_InForceDirectionNED = nullptr;
170 ISignalPort *m_InMyRPS = nullptr;
172 ISignalPort *m_InMyPD = nullptr;
174 ISignalPort *m_InVelocityNED = nullptr;
176 ISignalPort *m_InPositionNED = nullptr;
178 ISignalPort *m_InMyPropellerForce = nullptr;
180 ISignalPort *m_InMyPropellerTorque = nullptr;
181
182 std::vector<double> PDlist;
183 double m_BladeTop[3] = {0,0,0};
184 double m_Force[3] = {0,0,0};
185 mutable double m_MyThrust[3] = {0,0,0};
186 ICommonComputation *m_computeThrust = nullptr;
187 double m_MyTorque[3] = {0,0,0};
188 double m_MyUs = 0;
189 double m_MyRs = 0;
190
191 double m_MyDiam;
192 double m_MyDiam4;
193 double m_MyDiam5;
194 std::vector<std::unique_ptr<OpenWaterPropeller> > m_PropellerCalculator;
196 mutable WarnOnce m_tableWarning;
197 environment::EnvironmentProvider *m_Environment = nullptr;
198 std::shared_ptr<PropellerCurrentField> m_currentField = std::make_shared<PropellerCurrentField>(PropellerJet);
200 int m_RotateAngle = -1;
201
202 #ifdef FH_VISUALIZATION
203 std::string m_Material;
204 Ogre::SceneNode* m_RenderNode;
205 CDynamicLines* m_lines;
206 #endif
207 };
208}
209
210#endif // CRudder_h__
Definition Propeller.h:126
const double * ForceNED(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 * Us(const double T, const double *const X)
const double * BladeTopNED(const double T, const double *const X)
const double * Rs(const double T, const double *const X)
const double * TorqueNED(const double T, const double *const X)
Definition PropulsorWakeField.h:25
Status
Definition marenv.h:44
Superclass of control algorithms for the control system.
Definition CableAttach.h:58
marenv::Status PropellerJet(const PropellerWakeState &state, double T, const double position[3], double currentVelocity[3])
The jet behind the propeller (G4: reads only the copy of the state).
The state the propeller jet needs, copied after each accepted step (zero jet by default: Us = Rs = 0)...
Definition Propeller.h:113