2001-12-01 06:22:24 +00:00
|
|
|
#ifndef _PISTONENGINE_HPP
|
|
|
|
#define _PISTONENGINE_HPP
|
|
|
|
|
2004-04-30 19:06:29 +00:00
|
|
|
#include "Engine.hpp"
|
|
|
|
|
2001-12-01 06:22:24 +00:00
|
|
|
namespace yasim {
|
|
|
|
|
2004-04-30 19:06:29 +00:00
|
|
|
class PistonEngine : public Engine {
|
2001-12-01 06:22:24 +00:00
|
|
|
public:
|
2004-04-30 19:06:29 +00:00
|
|
|
virtual PistonEngine* isPistonEngine() { return this; }
|
|
|
|
|
2001-12-01 06:22:24 +00:00
|
|
|
// Initializes an engine from known "takeoff" parameters.
|
|
|
|
PistonEngine(float power, float spd);
|
2001-12-06 18:13:24 +00:00
|
|
|
void setTurboParams(float mul, float maxMP);
|
2001-12-24 13:54:03 +00:00
|
|
|
void setDisplacement(float d);
|
|
|
|
void setCompression(float c);
|
2006-02-27 23:35:02 +00:00
|
|
|
void setWastegate(float norm) { _wastegate = norm; }
|
|
|
|
void setSupercharger(float hasSuper) { _hasSuper = hasSuper; }
|
|
|
|
void setTurboLag(float lag) { _turboLag = lag; }
|
2001-12-01 06:22:24 +00:00
|
|
|
|
2002-02-20 04:27:22 +00:00
|
|
|
bool isCranking();
|
2001-12-24 13:54:03 +00:00
|
|
|
float getMP();
|
|
|
|
float getEGT();
|
2004-04-30 19:06:29 +00:00
|
|
|
float getMaxPower(); // max sea-level power
|
2005-07-02 17:09:42 +00:00
|
|
|
float getBoost() { return _boostPressure; }
|
2005-10-19 18:52:57 +00:00
|
|
|
float getOilTemp() { return _oilTemp; }
|
2004-04-30 19:06:29 +00:00
|
|
|
|
|
|
|
virtual void calc(float pressure, float temp, float speed);
|
2005-10-19 18:52:57 +00:00
|
|
|
virtual void stabilize();
|
|
|
|
virtual void integrate(float dt);
|
2004-04-30 19:06:29 +00:00
|
|
|
virtual float getTorque();
|
|
|
|
virtual float getFuelFlow();
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
private:
|
2001-12-24 13:54:03 +00:00
|
|
|
// Static configuration:
|
2001-12-07 20:00:59 +00:00
|
|
|
float _power0; // reference power setting
|
2001-12-01 06:22:24 +00:00
|
|
|
float _omega0; // " engine speed
|
|
|
|
float _rho0; // " manifold air density
|
|
|
|
float _f0; // "ideal" fuel flow at P0/omega0
|
|
|
|
float _mixCoeff; // fuel flow per omega at full mixture
|
2001-12-24 13:54:03 +00:00
|
|
|
float _turbo; // (or super-)charger pressure multiplier
|
2006-02-27 23:35:02 +00:00
|
|
|
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]
|
2001-12-24 13:54:03 +00:00
|
|
|
float _displacement; // piston stroke volume
|
|
|
|
float _compression; // compression ratio (>1)
|
2001-12-01 06:22:24 +00:00
|
|
|
|
2001-12-24 13:54:03 +00:00
|
|
|
// Runtime state/output:
|
|
|
|
float _mp;
|
|
|
|
float _torque;
|
|
|
|
float _fuelFlow;
|
|
|
|
float _egt;
|
2005-07-02 17:09:42 +00:00
|
|
|
float _boostPressure;
|
2005-10-19 18:52:57 +00:00
|
|
|
float _oilTemp;
|
|
|
|
float _oilTempTarget;
|
|
|
|
float _dOilTempdt;
|
2001-12-01 06:22:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace yasim
|
|
|
|
#endif // _PISTONENGINE_HPP
|