1 #ifndef _PISTONENGINE_HPP
2 #define _PISTONENGINE_HPP
8 class PistonEngine : public Engine {
10 virtual PistonEngine* isPistonEngine() { return this; }
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 setWastegate(float norm) { _wastegate = norm; }
18 void setSupercharger(bool hasSuper) { _hasSuper = hasSuper; }
19 void setTurboLag(float lag) { _turboLag = lag; }
24 float getMaxPower(); // max sea-level power
25 float getBoost() { return _boostPressure; }
26 float getOilTemp() { return _oilTemp; }
28 virtual void calc(float pressure, float temp, float speed);
29 virtual void stabilize();
30 virtual void integrate(float dt);
31 virtual float getTorque();
32 virtual float getFuelFlow();
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 bool _hasSuper; // true indicates gear-driven (not turbo)
43 float _turboLag; // turbo lag time in seconds
44 float _charge; // current {turbo|super}charge multiplier
45 float _chargeTarget; // eventual charge value
46 float _maxMP; // static maximum pressure
47 float _wastegate; // wastegate setting, [0:1]
48 float _displacement; // piston stroke volume
49 float _compression; // compression ratio (>1)
51 // Runtime state/output:
63 #endif // _PISTONENGINE_HPP