]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Engine.hpp
Refactoring in preparation to add a turbine engine to YASim. The
[flightgear.git] / src / FDM / YASim / Engine.hpp
1 #ifndef _ENGINE_HPP
2 #define _ENGINE_HPP
3
4 namespace yasim {
5
6 class PistonEngine;
7
8 //
9 // Interface for the "Engine" part of a PropEngine object.  This is a
10 // virtual class, intended to be implemented by stuff like
11 // PistonEngine and TurbineEngine, and maybe exotics like
12 // SolarElectricEngine, etc...
13 //
14
15 class Engine {
16 public:
17     virtual PistonEngine* isPistonEngine() { return 0; }
18
19     void setThrottle(float throttle) { _throttle = throttle; }
20     void setStarter(bool starter) { _starter = starter; }
21     void setMagnetos(int magnetos) { _magnetos = magnetos; }
22     void setMixture(float mixture) { _mixture = mixture; }
23     void setBoost(float boost) { _boost = boost; }
24     void setFuelState(bool hasFuel) { _fuel = hasFuel; }
25     void setRunning(bool r) { _running = r; }
26
27     bool isRunning() { return _running; }
28     virtual bool isCranking() { return false; }
29
30     virtual void calc(float pressure, float temp, float speed) = 0;
31     virtual float getTorque() = 0;
32     virtual float getFuelFlow() = 0;
33
34 protected:
35     float _throttle;
36     bool _starter; // true=engaged, false=disengaged
37     int _magnetos; // 0=off, 1=right, 2=left, 3=both
38     float _mixture;
39     float _boost;
40     bool _fuel;
41     bool _running;
42 };
43
44 }; // namespace yasim
45 #endif // _ENGINE_HPP