Marine systems simulation
Loading...
Searching...
No Matches
CycloidalPropeller.h
1#ifndef CycloidalPropeller_h_
2#define CycloidalPropeller_h_
24#include <cmath>
25#include <memory>
26
27#include <Eigen/Eigen>
28#include <sfh/constants.h>
29
30#include <SimObject.h>
31#include <EnvironmentProvider.h>
32
33namespace Ship{
34
35 class CycloidalPropeller;
36
38 public:
40 virtual ~CycloidalPropellerCurrentField() = default;
41 void inline setPropeller(CycloidalPropeller* propeller){ m_propeller = propeller; }
42 [[deprecated("This may not use up-to-date state info")]]
43 marenv::Status GetCurrent(const double T, const double position[3], double currentVelocity[3]);
44 private:
45 CycloidalPropeller* m_propeller;
46 };
47
48 class CycloidalPropeller: public SimObject{
50 public:
51 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
52 CycloidalPropeller(const string simObjectName, ISimObjectCreator* const creator);
53 virtual ~CycloidalPropeller();
54 void Compute(const double T, const double * const X);
55 void OdeFcn(const double T, const double *const X, double *const XDot, const bool IsMajorTimeStep);
56 void PreOdeFcn(const double T, const double *const X, IStateUpdater* updater);
57
58 const double * ForceNED(const double T, const double * const X);
59 const double * TorqueNED(const double T, const double * const X);
60
61 const double * ForceBody(const double T, const double * const X);
62 const double * TorqueBody(const double T, const double * const X);
63
64 const double* ShaftTorqueCorrectedBody(const double T, const double* const X);
65 const double* ShaftTorqueBody(const double T, const double* const X);
66
67 const double* ShaftPowerCorrected(const double T, const double* const X);
68 const double* ShaftPower(const double T, const double* const X);
69
70 void FinalSetup(const double T, const double *const X, ISimObjectCreator* const creator);
71 #ifdef FH_VISUALIZATION
72 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
73 void RenderUpdate(const double T, const double* const X);
74 #endif
75 private:
76
77 double Ct ( double intensity )const{
78 return std::pow(std::sin( intensity*sfh::pi/2 ),2.0);
79 }
80
81 #ifdef FH_VISUALIZATION
82 int m_rotationState;
83 bool m_reverseRotationDirection;
84
85 Ogre::SceneNode *m_RenderNode;
86 Ogre::SceneNode *m_RenderNodeFoil;
87 #endif
88
89 int m_currentState;
90 double m_ct;
91 double m_ct_angle;
92 double m_cq;
93 double m_cq_angle;
94 double m_D;
95 double m_b;
96
97 double m_shaftTorque;
98 double m_shaftPower;
99
100
101 double m_torqueScale;
102 double m_thrustScale;
103
104 double m_current;
105 Eigen::Vector3d m_thrustVectorBody;
106 Eigen::Vector3d m_posNED;
107 Eigen::Quaterniond m_Q;
108 Eigen::Vector3d m_force;
109 Eigen::Vector3d m_torque;
110
111 Eigen::Vector3d m_forceBody;
112 Eigen::Vector3d m_torqueBody;
113
114 ICommonComputation * m_compute;
115
116 ISignalPort * m_inRPM;
117 ISignalPort * m_inThrustIntensity;
118 ISignalPort * m_inThrustVectorBody;
119
120 ISignalPort * m_inPositionNED;
121 ISignalPort * m_inVelocityNED;
122 ISignalPort * m_inOrientationNED;
123
124 environment::EnvironmentProvider *m_environment;
125 std::shared_ptr<CycloidalPropellerCurrentField> m_currentField = std::make_shared<CycloidalPropellerCurrentField>();
126
127 };
128}
129#endif // CycloidalPropeller_h__
Definition CycloidalPropeller.h:37
marenv::Status GetCurrent(const double T, const double position[3], double currentVelocity[3])
Definition CycloidalPropeller.h:48
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