FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WavePropulsionHull.h
1#ifndef WavePropulsionHull_H
2#define WavePropulsionHull_H
3
144#include <array>
145#include <string>
146
147#include "WaveHull.h"
148
149#include <fhsim_environment/BodyFlowInteraction.h>
150#include <fhsim_environment/WakeSourceSet.h>
151
153{
154public:
155 WavePropulsionHull(std::string simObjectName, ISimObjectCreator* creator);
156
157 void FinalSetup(double T, const double* X, ISimObjectCreator* creator) override;
158 void PreOdeFcn(double T, const double* X) override;
159
160 const double* ThrustPort(double T, const double* X);
161 const double* RudderForcePort(double T, const double* X);
162
164 const environment::wake::BodyFlowInteraction& Flow() const { return m_flow; }
165
166protected:
167 Loads ExtraLoads(double T, const double* X, const Dof& velocity) const override;
168 std::array<Dof, 6> ExtraLoadsVelocityJacobian(const Dof& velocity) const override;
169 std::array<double, 3> WaterVelocity(double T, const double* X) const override;
170 std::array<double, 3> HeldWaterVelocity() const override { return m_heldWater; }
171
172private:
177 class HullCaster final : public environment::wake::PropelledObject
178 {
179 public:
180 explicit HullCaster(const WavePropulsionHull& hull)
181 : m_hull(hull)
182 {
183 }
184 environment::wake::WakeCastState Reference(double T, const double* X) const override;
185 void CurrentLoad(double T, const double* X, const double freeStream[3], const double flowDir[3], double force[3],
186 double& frontalArea, double rearCentre[3]) const override;
187 environment::wake::PropellerJetInput PropellerJet(double T, const double* X) const override;
188
189 private:
190 const WavePropulsionHull& m_hull;
191 };
192
194 std::array<double, 3> Centre(const double* X) const;
195
197 template<class S>
198 struct Actuation
199 {
200 S thrust;
201 S rudderNormalForce;
202 };
203
204 template<class S>
205 Actuation<S> Actuate(double propellerSpeed, double rudderAngle, const S& u, const S& v, const S& r) const;
206
207 template<class S>
208 std::array<S, 6> LoadsOf(const Actuation<S>& actuation, double rudderAngle) const;
209
211 void HoldInputs(double T, const double* X);
212
213 ISignalPort* m_inPropellerSpeed = nullptr;
214 ISignalPort* m_inRudderAngle = nullptr;
215
216 double m_diameter = 0.0;
217 double m_kt[3] = {0.0, 0.0, 0.0};
218 double m_wakeFraction = 0.0;
219 double m_thrustDeduction = 0.0;
220 double m_propellerX = 0.0;
221 double m_propellerZ = 0.0;
222
223 double m_rudderArea = 0.0;
224 double m_liftSlope = 0.0;
225 double m_rudderX = 0.0;
226 double m_rudderZ = 0.0;
227 double m_hullInteraction = 0.0;
228 double m_hullInteractionX = 0.0;
229 double m_slipstreamFactor = 0.0;
230
231 double m_heldPropellerSpeed = 0.0;
232 double m_heldRudderAngle = 0.0;
233
234 double m_thrustOut = 0.0;
235 std::array<double, 2> m_rudderForceOut {};
236
237 HullCaster m_caster;
238 environment::wake::BodyFlowInteraction m_flow;
239 std::array<double, 3> m_heldWater {};
240};
241
242#endif
Definition WaveHull.h:243
std::array< double, 3 > Dof
Three generalized loads or coordinates: (heave, roll, pitch) or (surge, sway, yaw).
Definition WaveHull.h:246
std::array< double, 6 > Loads
Generalized loads on the six modes, ordered surge, sway, heave, roll, pitch, yaw [N,...
Definition WaveHull.h:248
Definition WavePropulsionHull.h:153
std::array< Dof, 6 > ExtraLoadsVelocityJacobian(const Dof &velocity) const override
std::array< double, 3 > HeldWaterVelocity() const override
The water velocity of the step [m/s], NED, which OdeJacobian holds fixed. The base: still water.
Definition WavePropulsionHull.h:170
const environment::wake::BodyFlowInteraction & Flow() const
The current and wakes it receives, the hull wake and jet it casts (read only, for tests).
Definition WavePropulsionHull.h:164
Loads ExtraLoads(double T, const double *X, const Dof &velocity) const override
std::array< double, 3 > WaterVelocity(double T, const double *X) const override
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).