]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PistonEngine.hpp
2431c494785e082730093086747ede56952db482
[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 setMinThrottle(float m);
18     void setWastegate(float norm) { _wastegate = norm; }
19     void setSupercharger(bool hasSuper) { _hasSuper = hasSuper; }
20     void setTurboLag(float lag) { _turboLag = lag; }
21
22     bool isCranking();
23     float getMP();
24     float getEGT();
25     float getMaxPower(); // max sea-level power
26     float getBoost() { return _boostPressure; }
27     float getOilTemp() { return _oilTemp; }
28
29     virtual void calc(float pressure, float temp, float speed);
30     virtual void stabilize();
31     virtual void integrate(float dt);
32     virtual float getTorque();
33     virtual float getFuelFlow();
34
35 private:
36     // Static configuration:
37     float _power0;   // reference power setting
38     float _omega0;   //   "       engine speed
39     float _rho0;     //   "       manifold air density
40     float _f0;       // "ideal" fuel flow at P0/omega0
41     float _mixCoeff; // fuel flow per omega at full mixture
42     float _turbo;    // (or super-)charger pressure multiplier
43     bool _hasSuper;  // true indicates gear-driven (not turbo)
44     float _turboLag; // turbo lag time in seconds
45     float _charge;   // current {turbo|super}charge multiplier
46     float _chargeTarget;  // eventual charge value
47     float _maxMP;    // static maximum pressure
48     float _wastegate;    // wastegate setting, [0:1]
49     float _displacement; // piston stroke volume
50     float _compression;  // compression ratio (>1)
51     float _minthrottle; // minimum throttle [0:1]
52
53     // Runtime state/output:
54     float _mp;
55     float _torque;
56     float _fuelFlow;
57     float _egt;
58     float _boostPressure;
59     float _oilTemp;
60     float _oilTempTarget;
61     float _dOilTempdt;
62 };
63
64 }; // namespace yasim
65 #endif // _PISTONENGINE_HPP