]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PistonEngine.hpp
Norman Vine's speed optimizations
[flightgear.git] / src / FDM / YASim / PistonEngine.hpp
1 #ifndef _PISTONENGINE_HPP
2 #define _PISTONENGINE_HPP
3
4 namespace yasim {
5
6 class PistonEngine {
7 public:
8     // Initializes an engine from known "takeoff" parameters.
9     PistonEngine(float power, float spd);
10     void setTurboParams(float mul, float maxMP);
11     void setDisplacement(float d);
12     void setCompression(float c);
13
14     void setThrottle(float throttle);
15     void setStarter(bool starter);
16     void setMagnetos(int magnetos);
17     void setMixture(float mixture);
18     void setBoost(float boost); // fraction of turbo-mul used
19
20     // For solver use
21     void setRunning(bool r);
22
23     float getMaxPower(); // max sea-level power
24
25     void calc(float pressure, float temp, float speed);
26     bool isRunning();
27     bool isCranking();
28     float getTorque();
29     float getFuelFlow();
30     float getMP();
31     float getEGT();
32
33 private:
34     // Static configuration:
35     float _power0;   // reference power setting
36     float _omega0;   //   "       engine speed
37     float _rho0;     //   "       manifold air density
38     float _f0;       // "ideal" fuel flow at P0/omega0
39     float _mixCoeff; // fuel flow per omega at full mixture
40     float _turbo;    // (or super-)charger pressure multiplier
41     float _maxMP;    // wastegate setting
42     float _displacement; // piston stroke volume
43     float _compression;  // compression ratio (>1)
44
45     // Runtime settables:
46     float _throttle;
47     bool _starter; // true=engaged, false=disengaged
48     int _magnetos; // 0=off, 1=right, 2=left, 3=both
49     float _mixture;
50     float _boost;
51
52     // Runtime state/output:
53     bool _running;
54     bool _cranking;
55     float _mp;
56     float _torque;
57     float _fuelFlow;
58     float _egt;
59 };
60
61 }; // namespace yasim
62 #endif // _PISTONENGINE_HPP