]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PropEngine.hpp
David Megginson writes:
[flightgear.git] / src / FDM / YASim / PropEngine.hpp
1 #ifndef _PROPENGINE_HPP
2 #define _PROPENGINE_HPP
3
4 #include "Thruster.hpp"
5
6 namespace yasim {
7
8 class Propeller;
9 class PistonEngine;
10
11 class PropEngine : public Thruster {
12 public:
13     PropEngine(Propeller* prop, PistonEngine* eng, float moment);
14     virtual ~PropEngine();
15
16     void setAdvance(float advance);
17     void setVariableProp(float min, float max);
18
19     virtual PropEngine* getPropEngine() { return this; }
20     virtual PistonEngine* getPistonEngine() { return _eng; }
21     virtual Propeller* getPropeller() { return _prop; }
22
23     // Dynamic output
24     virtual void getThrust(float* out);
25     virtual void getTorque(float* out);
26     virtual void getGyro(float* out);
27     virtual float getFuelFlow();
28
29     // Runtime instructions
30     virtual void integrate(float dt);
31     virtual void stabilize();
32
33     float getOmega();
34     
35 private:
36     float _moment;
37     Propeller* _prop;
38     PistonEngine* _eng;
39
40     bool _variable;
41     float _advance; // control input, 0-1
42     float _maxOmega;
43     float _minOmega;
44
45     float _omega; // RPM, in radians/sec
46     float _thrust[3];
47     float _torque[3];
48     float _gyro[3];
49     float _fuelFlow;
50 };
51
52 }; // namespace yasim
53 #endif // _PROPENGINE_HPP