]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PropEngine.hpp
Wire up a "gear-ratio" attribute for geared propeller aircraft
[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 setMagnetos(int magnetos);
17     void setAdvance(float advance);
18     void setPropPitch(float proppitch);
19     void setVariableProp(float min, float max);
20     void setGearRatio(float ratio) { _gearRatio = ratio; }
21
22     virtual PropEngine* getPropEngine() { return this; }
23     virtual PistonEngine* getPistonEngine() { return _eng; }
24     virtual Propeller* getPropeller() { return _prop; }
25
26     // Dynamic output
27     virtual bool isRunning();
28     virtual bool isCranking();
29     virtual void getThrust(float* out);
30     virtual void getTorque(float* out);
31     virtual void getGyro(float* out);
32     virtual float getFuelFlow();
33
34     // Runtime instructions
35     virtual void init();
36     virtual void integrate(float dt);
37     virtual void stabilize();
38
39     float getOmega();
40     void setOmega (float omega);
41     
42 private:
43     float _moment;
44     Propeller* _prop;
45     PistonEngine* _eng;
46
47     bool _variable;
48     int _magnetos;  // 0=off, 1=right, 2=left, 3=both
49     float _gearRatio;
50     float _advance; // control input, 0-1
51     float _maxOmega;
52     float _minOmega;
53
54     float _omega; // RPM, in radians/sec
55     float _thrust[3];
56     float _torque[3];
57     float _gyro[3];
58     float _fuelFlow;
59 };
60
61 }; // namespace yasim
62 #endif // _PROPENGINE_HPP