]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PistonEngine.hpp
Updates to the controls properties tree. This is a major update so there may be one...
[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     void setFuelState(bool hasFuel) { _fuel = hasFuel; }
20
21     // For solver use
22     void setRunning(bool r);
23
24     float getMaxPower(); // max sea-level power
25
26     void calc(float pressure, float temp, float speed);
27     bool isRunning();
28     bool isCranking();
29     float getTorque();
30     float getFuelFlow();
31     float getMP();
32     float getEGT();
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     float _maxMP;    // wastegate setting
43     float _displacement; // piston stroke volume
44     float _compression;  // compression ratio (>1)
45
46     // Runtime settables:
47     float _throttle;
48     bool _starter; // true=engaged, false=disengaged
49     int _magnetos; // 0=off, 1=right, 2=left, 3=both
50     float _mixture;
51     float _boost;
52     bool _fuel;
53
54     // Runtime state/output:
55     bool _running;
56     bool _cranking;
57     float _mp;
58     float _torque;
59     float _fuelFlow;
60     float _egt;
61 };
62
63 }; // namespace yasim
64 #endif // _PISTONENGINE_HPP