Marine systems simulation
WagProp.h
1
10
11
12#pragma once
13
14#include <string>
15#include "SimObject.h"
16#include "propeller_table_2d.h"
17#include "CPrintDuringExec.h"
18#include "CEnvironment.h"
19
20#ifdef FH_VISUALIZATION
21#include "sfh/ogre/CDynamicLines.h"
22#endif
23
24#include <ICurrentField.h>
25
26
27#define N_PROP_DATA 361 // Number of elements in array for CQ and CT
28
29const double PI = 3.1415926;
30
31class CWagProp : public SimObject, ICurrentField
32{
33public:
35 CWagProp(string simobjectname, ISimObjectCreator* creator);
36
38 virtual void OdeFcn(const double T, const double *const X, double *const XDot, const bool bIsMajorTimeStep);
39 void FinalSetup(const double T, const double *const X, ISimObjectCreator* const creator);
40 void GetCurrent(const double T, const double* const X, const double position[3], double* currentVelocity);
41
42 const double* const outRPS(const double T, const double* const X);
43 const double* const outHydTorque(const double T, const double* const X);
44 const double* const outThrust(const double T, const double* const X);
45 const double* const outBeta(const double T, const double* const X);
46
47 const double* const outCt(const double T, const double* const X);
48 const double* const outUs(const double T, const double* const X);
49 const double* const outRs(const double T, const double* const X);
50
51#ifdef FH_VISUALIZATION
52
54 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
55
57 virtual void RenderUpdate(const double T, const double* const X);
58#endif
59
60protected:
62 //virtual void InitParameters();
63 bool ReadPropParFile(ISimObjectCreator* creator);
64 void CalcOutPut(const double T,const double* const X);
65 void CalcBeta(const double T, const double* const X);
66
67 // Model parameters
68 double m_dInertia;
69 double m_dDia;
70 double m_dRho;
71
72 double m_dRudderArea;
73 double m_dRudderHeigth;
74
75 // Model input
76 //double* m_adM; ///< Pointer to input torque
77 ISignalPort* m_IM;
78 ISignalPort* m_IN;
79 ISignalPort* m_IVa;
80 ISignalPort* m_IDir;
81 ISignalPort* m_IPD;
82 ISignalPort* m_IPos;
83
84 // States
86
87 std::string driving_port;
88
89
90 // Model output
91 double m_outRPS;
92 double m_outQ;
93 double m_outBeta;
94 double m_outT[3];
95
96 double m_Ct;
97 double m_Us;
98 double m_Rs;
99
100 double m_Pos[3];
101
102 // Model data for CQ and CT
103 //double m_aDataCQ[N_PROP_DATA];
104 //double m_aDataCT[N_PROP_DATA];
105
106 propeller_table_2d m_PropData;
107
108 CPrintDuringExec* m_Print; // Pointer to CPrintDuringExec
109
110 CEnvironment* m_environment;
111 ICurrentField* m_propellerJetstream;
112
113#ifdef FH_VISUALIZATION
114 Ogre::SceneNode* m_RenderNode;
115 CDynamicLines* m_lines;
116#endif
117
118};
Definition: CEnvironment.h:10
Definition: WagProp.h:32
CWagProp(string simobjectname, ISimObjectCreator *creator)
The constructor sets the pointer to the output object and the parser object.
double m_dRho
Water density.
Definition: WagProp.h:70
virtual void OdeFcn(const double T, const double *const X, double *const XDot, const bool bIsMajorTimeStep)
Calculates the state derivatives.
double m_dInertia
Inertia of the propeller/shaft.
Definition: WagProp.h:68
void GetCurrent(const double T, const double *const X, const double position[3], double *currentVelocity)
ICurrentField interface method.
int m_ISAngVel
The index of the angular angular velocity state.
Definition: WagProp.h:85
bool ReadPropParFile(ISimObjectCreator *creator)
Sets the parameters of the mass object.
double m_dDia
Propeller diameter.
Definition: WagProp.h:69
Definition: ICurrentField.h:4
Definition: propeller_table_2d.h:15