FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Propeller.h
1#ifndef CPropeller_h__
2#define CPropeller_h__
3
92#include <memory>
93
94#include <fhsim/simobject/ISimObjectCreator.h>
95#include <fhsim_environment/EnvironmentProvider.h>
96
97#ifdef FH_VISUALIZATION
98#include "sfh/ogre/CDynamicLines.h"
99#endif
100#include "./Ship/Actuators/IPropellerCalculator.h"
101#include "./Ship/Actuators/OpenWaterPropeller.h"
102#include "./Ship/Actuators/TableLookup.h"
103#include <memory>
104
105namespace Ship{
106
107 class Propeller;
108
110 public:
111 PropellerCurrentField() = default;
112 virtual ~PropellerCurrentField() = default;
113 void inline setPropeller(Propeller* propeller){ m_propeller = propeller; }
114 [[deprecated("This may not use up-to-date state info")]]
115 marenv::Status GetCurrent(const double T, const double position[3], double currentVelocity[3]);
116 private:
117 Propeller* m_propeller;
118
119 };
120
121 class Propeller: public SimObject
122 {
123 friend class PropellerCurrentField;
124 public:
125 Propeller(const std::string simObjectName, ISimObjectCreator* const creator);
126 virtual ~Propeller();
127 void FinalSetup( const double T, const double *const X, ISimObjectCreator* const creator );
128 void OdeFcn(const double T, const double* const X, double* const XDot) const;
129
130 #ifdef FH_VISUALIZATION
131 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
132 void RenderUpdate( const double T, const double* const X);
133 #endif
134
136 const double* BladeTopNED(const double T, const double* const X);
138 const double* ForceNED(const double T, const double* const X);
140 const double* TorqueNED(const double T, const double* const X);
142 const double* Us(const double T, const double* const X);
144 const double* Rs(const double T, const double* const X);
145
146 private:
147
148 double Ct( double U, double F);
149
152 double Coefficient(double pitchRatio, double J, bool torque);
153
155 double m_Diameter;
158 bool m_DummyPropeller;
159
161 ISignalPort *m_InForceDirectionNED;
163 ISignalPort *m_InMyRPS;
165 ISignalPort *m_InMyPD;
167 ISignalPort *m_InVelocityNED;
169 ISignalPort *m_InPositionNED;
171 ISignalPort *m_InMyPropellerForce;
173 ISignalPort *m_InMyPropellerTorque;
174
175 std::vector<double> PDlist;
176 double m_BladeTop[3];
177 double m_Force[3];
178 double m_MyThrust[3];
179 double m_MyTorque[3];
180 mutable double m_Position[3];
181 mutable double m_Axis[3];
182
183 double m_MyUs;
184 double m_MyRs;
185
186 double m_MyDiam;
187 double m_MyDiam4;
188 double m_MyDiam5;
189 std::vector<std::unique_ptr<OpenWaterPropeller> > m_PropellerCalculator;
191 WarnOnce m_tableWarning;
192 environment::EnvironmentProvider *m_Environment = nullptr;
193 std::shared_ptr<PropellerCurrentField> m_currentField = std::make_shared<PropellerCurrentField>();
194 int m_RotateAngle;
195
196 #ifdef FH_VISUALIZATION
197 std::string m_Material;
198 Ogre::SceneNode* m_RenderNode;
199 CDynamicLines* m_lines;
200 #endif
201 };
202}
203
204#endif // CRudder_h__
Definition Propeller.h:109
marenv::Status GetCurrent(const double T, const double position[3], double currentVelocity[3])
Definition Propeller.h:122
const double * ForceNED(const double T, const double *const X)
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 TableLookup.h:18
Defines the interface for an relaying information about ocean currents.
Definition CurrentField.h:13
Status
Definition marenv.h:40
Simple waypoint object.
Definition CableAttach.h:16