]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/PistonEngine.hpp
Initial revision of Andy Ross's YASim code. This is (Y)et (A)nother Flight
[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
11     void setThrottle(float throttle);
12     void setMixture(float mixture);
13
14     // Calculates power output and fuel flow, based on a given
15     // throttle setting (0-1 corresponding to the fraction of
16     // "available" manifold pressure), mixture (fuel flux per rpm,
17     // 0-1, where 1 is "max rich", or a little bit more than needed
18     // for rated power at sea level)
19     void calc(float density, float speed,
20               float* powerOut, float* fuelFlowOut);
21
22 private:
23     float _P0;       // reference power setting
24     float _omega0;   //   "       engine speed
25     float _rho0;     //   "       manifold air density
26     float _f0;       // "ideal" fuel flow at P0/omega0
27     float _mixCoeff; // fuel flow per omega at full mixture
28
29     // Runtime settables:
30     float _throttle;
31     float _mixture;
32 };
33
34 }; // namespace yasim
35 #endif // _PISTONENGINE_HPP