]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PistonEngine.hpp
Automatically generate "contact" points for collision detection. Implemented
[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     float getMaxPower(); // max sea-level power
21
22     void calc(float pressure, float temp, float speed);
23     bool isRunning();
24     bool isCranking();
25     float getTorque();
26     float getFuelFlow();
27     float getMP();
28     float getEGT();
29
30 private:
31     // Static configuration:
32     float _power0;   // reference power setting
33     float _omega0;   //   "       engine speed
34     float _rho0;     //   "       manifold air density
35     float _f0;       // "ideal" fuel flow at P0/omega0
36     float _mixCoeff; // fuel flow per omega at full mixture
37     float _turbo;    // (or super-)charger pressure multiplier
38     float _maxMP;    // wastegate setting
39     float _displacement; // piston stroke volume
40     float _compression;  // compression ratio (>1)
41
42     // Runtime settables:
43     float _throttle;
44     bool _starter; // true=engaged, false=disengaged
45     int _magnetos; // 0=off, 1=right, 2=left, 3=both
46     float _mixture;
47     float _boost;
48
49     // Runtime state/output:
50     bool _running;
51     bool _cranking;
52     float _mp;
53     float _torque;
54     float _fuelFlow;
55     float _egt;
56 };
57
58 }; // namespace yasim
59 #endif // _PISTONENGINE_HPP