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 setMinThrottle(float m);
18 void setWastegate(float norm) { _wastegate = norm; }
19 void setSupercharger(bool hasSuper) { _hasSuper = hasSuper; }
20 void setTurboLag(float lag) { _turboLag = lag; }
25 float getMaxPower(); // max sea-level power
26 float getBoost() { return _boostPressure; }
27 float getOilTemp() { return _oilTemp; }
29 virtual void calc(float pressure, float temp, float speed);
30 virtual void stabilize();
31 virtual void integrate(float dt);
32 virtual float getTorque();
33 virtual float getFuelFlow();
36 // Static configuration:
37 float _power0; // reference power setting
38 float _omega0; // " engine speed
39 float _rho0; // " manifold air density
40 float _f0; // "ideal" fuel flow at P0/omega0
41 float _mixCoeff; // fuel flow per omega at full mixture
42 float _turbo; // (or super-)charger pressure multiplier
43 bool _hasSuper; // true indicates gear-driven (not turbo)
44 float _turboLag; // turbo lag time in seconds
45 float _charge; // current {turbo|super}charge multiplier
46 float _chargeTarget; // eventual charge value
47 float _maxMP; // static maximum pressure
48 float _wastegate; // wastegate setting, [0:1]
49 float _displacement; // piston stroke volume
50 float _compression; // compression ratio (>1)
51 float _minthrottle; // minimum throttle [0:1]
53 // Runtime state/output:
65 #endif // _PISTONENGINE_HPP