FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WavePropulsionHull.h
1#ifndef WavePropulsionHull_H
2#define WavePropulsionHull_H
3
144#include "WaveHull.h"
145
146#include <fhsim_environment/BodyFlowInteraction.h>
147#include <fhsim_environment/WakeSourceSet.h>
148
150{
151public:
152 WavePropulsionHull(std::string simObjectName, ISimObjectCreator* creator);
153
154 void FinalSetup(double T, const double* X, ISimObjectCreator* creator) override;
155 void PreOdeFcn(double T, const double* X, IStateUpdater* updater) override;
156
157 const double* ThrustPort(double T, const double* X);
158 const double* RudderForcePort(double T, const double* X);
159
161 const environment::wake::BodyFlowInteraction& Flow() const { return m_flow; }
162
163protected:
164 Loads ExtraLoads(double T, const double* X, const Dof& velocity) const override;
165 std::array<Dof, 6> ExtraLoadsVelocityJacobian(const Dof& velocity) const override;
166 std::array<double, 3> WaterVelocity(double T, const double* X) const override;
167 std::array<double, 3> HeldWaterVelocity() const override { return m_heldWater; }
168
169private:
174 class HullCaster final : public environment::wake::PropelledObject
175 {
176 public:
177 explicit HullCaster(const WavePropulsionHull& hull)
178 : m_hull(hull)
179 {
180 }
181 environment::wake::WakeCastState Reference(double T, const double* X) const override;
182 void CurrentLoad(double T, const double* X, const double freeStream[3], const double flowDir[3], double force[3],
183 double& frontalArea, double rearCentre[3]) const override;
184 environment::wake::PropellerJetInput PropellerJet(double T, const double* X) const override;
185
186 private:
187 const WavePropulsionHull& m_hull;
188 };
189
191 std::array<double, 3> Centre(const double* X) const;
192
194 template<class S>
195 struct Actuation
196 {
197 S thrust;
198 S rudderNormalForce;
199 };
200
201 template<class S>
202 Actuation<S> Actuate(double propellerSpeed, double rudderAngle, const S& u, const S& v, const S& r) const;
203
204 template<class S>
205 std::array<S, 6> LoadsOf(const Actuation<S>& actuation, double rudderAngle) const;
206
208 void HoldInputs(double T, const double* X);
209
210 ISignalPort* m_inPropellerSpeed = nullptr;
211 ISignalPort* m_inRudderAngle = nullptr;
212
213 double m_diameter = 0.0;
214 double m_kt[3] = {0.0, 0.0, 0.0};
215 double m_wakeFraction = 0.0;
216 double m_thrustDeduction = 0.0;
217 double m_propellerX = 0.0;
218 double m_propellerZ = 0.0;
219
220 double m_rudderArea = 0.0;
221 double m_liftSlope = 0.0;
222 double m_rudderX = 0.0;
223 double m_rudderZ = 0.0;
224 double m_hullInteraction = 0.0;
225 double m_hullInteractionX = 0.0;
226 double m_slipstreamFactor = 0.0;
227
228 double m_heldPropellerSpeed = 0.0;
229 double m_heldRudderAngle = 0.0;
230
231 double m_thrustOut = 0.0;
232 std::array<double, 2> m_rudderForceOut {};
233
234 HullCaster m_caster;
235 environment::wake::BodyFlowInteraction m_flow;
236 std::array<double, 3> m_heldWater {};
237};
238
239#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:150
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:167
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:161
Loads ExtraLoads(double T, const double *X, const Dof &velocity) const override
std::array< double, 3 > WaterVelocity(double T, const double *X) const override