]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PropEngine.hpp
Use SG_LOG for debugging messages from the YASim helicopter model.
[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
21     virtual PropEngine* getPropEngine() { return this; }
22     virtual PistonEngine* getPistonEngine() { return _eng; }
23     virtual Propeller* getPropeller() { return _prop; }
24
25     // Dynamic output
26     virtual bool isRunning();
27     virtual bool isCranking();
28     virtual void getThrust(float* out);
29     virtual void getTorque(float* out);
30     virtual void getGyro(float* out);
31     virtual float getFuelFlow();
32
33     // Runtime instructions
34     virtual void init();
35     virtual void integrate(float dt);
36     virtual void stabilize();
37
38     float getOmega();
39     void setOmega (float omega);
40     
41 private:
42     float _moment;
43     Propeller* _prop;
44     PistonEngine* _eng;
45
46     bool _variable;
47     int _magnetos;  // 0=off, 1=right, 2=left, 3=both
48     float _advance; // control input, 0-1
49     float _maxOmega;
50     float _minOmega;
51
52     float _omega; // RPM, in radians/sec
53     float _thrust[3];
54     float _torque[3];
55     float _gyro[3];
56     float _fuelFlow;
57 };
58
59 }; // namespace yasim
60 #endif // _PROPENGINE_HPP