2001-12-01 06:22:24 +00:00
|
|
|
#ifndef _PISTONENGINE_HPP
|
|
|
|
#define _PISTONENGINE_HPP
|
|
|
|
|
|
|
|
namespace yasim {
|
|
|
|
|
|
|
|
class PistonEngine {
|
|
|
|
public:
|
|
|
|
// 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-01 06:22:24 +00:00
|
|
|
|
|
|
|
void setThrottle(float throttle);
|
|
|
|
void setMixture(float mixture);
|
|
|
|
|
2001-12-06 18:13:24 +00:00
|
|
|
float getPower();
|
|
|
|
|
2001-12-01 06:22:24 +00:00
|
|
|
// Calculates power output and fuel flow, based on a given
|
|
|
|
// throttle setting (0-1 corresponding to the fraction of
|
|
|
|
// "available" manifold pressure), mixture (fuel flux per rpm,
|
|
|
|
// 0-1, where 1 is "max rich", or a little bit more than needed
|
|
|
|
// for rated power at sea level)
|
2001-12-06 18:13:24 +00:00
|
|
|
void calc(float pressure, float temp, float speed,
|
2001-12-01 06:22:24 +00:00
|
|
|
float* powerOut, float* fuelFlowOut);
|
|
|
|
|
|
|
|
private:
|
|
|
|
float _P0; // reference power setting
|
|
|
|
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
|
|
|
|
|
|
|
|
// Runtime settables:
|
|
|
|
float _throttle;
|
|
|
|
float _mixture;
|
2001-12-06 18:13:24 +00:00
|
|
|
|
|
|
|
float _turbo;
|
|
|
|
float _maxMP;
|
2001-12-01 06:22:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace yasim
|
|
|
|
#endif // _PISTONENGINE_HPP
|