X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FYASim%2FPistonEngine.hpp;h=40d6bac52e5dcbbca5cf98e7d012b74548eb5b8a;hb=6afe252440140c1e1fadcfe9aea2c1e31e1607f2;hp=8552d86cbf6471558549473e4e901a07f1085011;hpb=f0e6716953604730579a5e45f785fd063737dce4;p=flightgear.git diff --git a/src/FDM/YASim/PistonEngine.hpp b/src/FDM/YASim/PistonEngine.hpp index 8552d86cb..40d6bac52 100644 --- a/src/FDM/YASim/PistonEngine.hpp +++ b/src/FDM/YASim/PistonEngine.hpp @@ -1,27 +1,35 @@ #ifndef _PISTONENGINE_HPP #define _PISTONENGINE_HPP +#include "Engine.hpp" + namespace yasim { -class PistonEngine { +class PistonEngine : public Engine { public: + virtual PistonEngine* isPistonEngine() { return this; } + // Initializes an engine from known "takeoff" parameters. PistonEngine(float power, float spd); void setTurboParams(float mul, float maxMP); void setDisplacement(float d); void setCompression(float c); + void setWastegate(float norm) { _wastegate = norm; } + void setSupercharger(bool hasSuper) { _hasSuper = hasSuper; } + void setTurboLag(float lag) { _turboLag = lag; } - void setThrottle(float throttle); - void setMixture(float mixture); - void setBoost(float boost); // fraction of turbo-mul used - - float getMaxPower(); // max sea-level power - - void calc(float pressure, float temp, float speed); - float getTorque(); - float getFuelFlow(); + bool isCranking(); float getMP(); float getEGT(); + float getMaxPower(); // max sea-level power + float getBoost() { return _boostPressure; } + float getOilTemp() { return _oilTemp; } + + virtual void calc(float pressure, float temp, float speed); + virtual void stabilize(); + virtual void integrate(float dt); + virtual float getTorque(); + virtual float getFuelFlow(); private: // Static configuration: @@ -31,20 +39,24 @@ private: float _f0; // "ideal" fuel flow at P0/omega0 float _mixCoeff; // fuel flow per omega at full mixture float _turbo; // (or super-)charger pressure multiplier - float _maxMP; // wastegate setting + bool _hasSuper; // true indicates gear-driven (not turbo) + float _turboLag; // turbo lag time in seconds + float _charge; // current {turbo|super}charge multiplier + float _chargeTarget; // eventual charge value + float _maxMP; // static maximum pressure + float _wastegate; // wastegate setting, [0:1] float _displacement; // piston stroke volume float _compression; // compression ratio (>1) - // Runtime settables: - float _throttle; - float _mixture; - float _boost; - // Runtime state/output: float _mp; float _torque; float _fuelFlow; float _egt; + float _boostPressure; + float _oilTemp; + float _oilTempTarget; + float _dOilTempdt; }; }; // namespace yasim