]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PistonEngine.hpp
Use bool where the source and destination variable is bool.
[flightgear.git] / src / FDM / YASim / PistonEngine.hpp
1 #ifndef _PISTONENGINE_HPP
2 #define _PISTONENGINE_HPP
3
4 #include "Engine.hpp"
5
6 namespace yasim {
7
8 class PistonEngine : public Engine {
9 public:
10     virtual PistonEngine* isPistonEngine() { return this; }
11
12     // Initializes an engine from known "takeoff" parameters.
13     PistonEngine(float power, float spd);
14     void setTurboParams(float mul, float maxMP);
15     void setDisplacement(float d);
16     void setCompression(float c);
17     void setWastegate(float norm) { _wastegate = norm; }
18     void setSupercharger(bool hasSuper) { _hasSuper = hasSuper; }
19     void setTurboLag(float lag) { _turboLag = lag; }
20
21     bool isCranking();
22     float getMP();
23     float getEGT();
24     float getMaxPower(); // max sea-level power
25     float getBoost() { return _boostPressure; }
26     float getOilTemp() { return _oilTemp; }
27
28     virtual void calc(float pressure, float temp, float speed);
29     virtual void stabilize();
30     virtual void integrate(float dt);
31     virtual float getTorque();
32     virtual float getFuelFlow();
33
34 private:
35     // Static configuration:
36     float _power0;   // reference power setting
37     float _omega0;   //   "       engine speed
38     float _rho0;     //   "       manifold air density
39     float _f0;       // "ideal" fuel flow at P0/omega0
40     float _mixCoeff; // fuel flow per omega at full mixture
41     float _turbo;    // (or super-)charger pressure multiplier
42     bool _hasSuper;  // true indicates gear-driven (not turbo)
43     float _turboLag; // turbo lag time in seconds
44     float _charge;   // current {turbo|super}charge multiplier
45     float _chargeTarget;  // eventual charge value
46     float _maxMP;    // static maximum pressure
47     float _wastegate;    // wastegate setting, [0:1]
48     float _displacement; // piston stroke volume
49     float _compression;  // compression ratio (>1)
50
51     // Runtime state/output:
52     float _mp;
53     float _torque;
54     float _fuelFlow;
55     float _egt;
56     float _boostPressure;
57     float _oilTemp;
58     float _oilTempTarget;
59     float _dOilTempdt;
60 };
61
62 }; // namespace yasim
63 #endif // _PISTONENGINE_HPP