]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PropEngine.hpp
Add support for a turbo prop condition lever.
[flightgear.git] / src / FDM / YASim / PropEngine.hpp
1 #ifndef _PROPENGINE_HPP
2 #define _PROPENGINE_HPP
3
4 #include "Thruster.hpp"
5 #include "Engine.hpp"
6
7 namespace yasim {
8
9 class Propeller;
10
11 class PropEngine : public Thruster {
12 public:
13     PropEngine(Propeller* prop, Engine* eng, float moment);
14     virtual ~PropEngine();
15
16     void setEngine(Engine* eng) { delete _eng; _eng = eng; }
17
18     void setMagnetos(int magnetos);
19     void setAdvance(float advance);
20     void setPropPitch(float proppitch);
21     void setVariableProp(float min, float max);
22     void setPropFeather(int state);
23     void setGearRatio(float ratio) { _gearRatio = ratio; }
24
25     virtual PropEngine* getPropEngine() { return this; }
26     virtual Engine* getEngine() { return _eng; }
27     virtual Propeller* getPropeller() { return _prop; }
28
29     // Dynamic output
30     virtual bool isRunning();
31     virtual bool isCranking();
32     virtual void getThrust(float* out);
33     virtual void getTorque(float* out);
34     virtual void getGyro(float* out);
35     virtual float getFuelFlow();
36
37     // Runtime instructions
38     virtual void init();
39     virtual void integrate(float dt);
40     virtual void stabilize();
41
42     float getOmega();
43     void setOmega (float omega);
44     
45 private:
46     float _moment;
47     Propeller* _prop;
48     Engine* _eng;
49
50     bool _variable;
51     int _magnetos;  // 0=off, 1=right, 2=left, 3=both
52     float _gearRatio;
53     float _advance; // control input, 0-1
54     float _maxOmega;
55     float _minOmega;
56
57     float _omega; // RPM, in radians/sec
58     float _thrust[3];
59     float _torque[3];
60     float _gyro[3];
61     float _fuelFlow;
62 };
63
64 }; // namespace yasim
65 #endif // _PROPENGINE_HPP