]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PropEngine.hpp
Initial checkin of a TurbineEngine implementation. This hasn't been
[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 setGearRatio(float ratio) { _gearRatio = ratio; }
23
24     virtual PropEngine* getPropEngine() { return this; }
25     virtual Engine* getEngine() { return _eng; }
26     virtual Propeller* getPropeller() { return _prop; }
27
28     // Dynamic output
29     virtual bool isRunning();
30     virtual bool isCranking();
31     virtual void getThrust(float* out);
32     virtual void getTorque(float* out);
33     virtual void getGyro(float* out);
34     virtual float getFuelFlow();
35
36     // Runtime instructions
37     virtual void init();
38     virtual void integrate(float dt);
39     virtual void stabilize();
40
41     float getOmega();
42     void setOmega (float omega);
43     
44 private:
45     float _moment;
46     Propeller* _prop;
47     Engine* _eng;
48
49     bool _variable;
50     int _magnetos;  // 0=off, 1=right, 2=left, 3=both
51     float _gearRatio;
52     float _advance; // control input, 0-1
53     float _maxOmega;
54     float _minOmega;
55
56     float _omega; // RPM, in radians/sec
57     float _thrust[3];
58     float _torque[3];
59     float _gyro[3];
60     float _fuelFlow;
61 };
62
63 }; // namespace yasim
64 #endif // _PROPENGINE_HPP