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-24 13:54:03 +00:00
|
|
|
void setDisplacement(float d);
|
|
|
|
void setCompression(float c);
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
void setThrottle(float throttle);
|
2002-02-20 04:27:22 +00:00
|
|
|
void setStarter(bool starter);
|
|
|
|
void setMagnetos(int magnetos);
|
2001-12-01 06:22:24 +00:00
|
|
|
void setMixture(float mixture);
|
2001-12-24 13:54:03 +00:00
|
|
|
void setBoost(float boost); // fraction of turbo-mul used
|
2001-12-01 06:22:24 +00:00
|
|
|
|
2002-02-27 00:18:57 +00:00
|
|
|
// For solver use
|
|
|
|
void setRunning(bool r);
|
|
|
|
|
2001-12-24 13:54:03 +00:00
|
|
|
float getMaxPower(); // max sea-level power
|
2001-12-06 18:13:24 +00:00
|
|
|
|
2001-12-24 13:54:03 +00:00
|
|
|
void calc(float pressure, float temp, float speed);
|
2002-02-20 04:27:22 +00:00
|
|
|
bool isRunning();
|
|
|
|
bool isCranking();
|
2001-12-24 13:54:03 +00:00
|
|
|
float getTorque();
|
|
|
|
float getFuelFlow();
|
|
|
|
float getMP();
|
|
|
|
float getEGT();
|
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
|
|
|
|
float _maxMP; // wastegate setting
|
|
|
|
float _displacement; // piston stroke volume
|
|
|
|
float _compression; // compression ratio (>1)
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
// Runtime settables:
|
|
|
|
float _throttle;
|
2002-02-20 04:27:22 +00:00
|
|
|
bool _starter; // true=engaged, false=disengaged
|
|
|
|
int _magnetos; // 0=off, 1=right, 2=left, 3=both
|
2001-12-01 06:22:24 +00:00
|
|
|
float _mixture;
|
2001-12-24 13:54:03 +00:00
|
|
|
float _boost;
|
2001-12-06 18:13:24 +00:00
|
|
|
|
2001-12-24 13:54:03 +00:00
|
|
|
// Runtime state/output:
|
2002-02-20 04:27:22 +00:00
|
|
|
bool _running;
|
|
|
|
bool _cranking;
|
2001-12-24 13:54:03 +00:00
|
|
|
float _mp;
|
|
|
|
float _torque;
|
|
|
|
float _fuelFlow;
|
|
|
|
float _egt;
|
2001-12-01 06:22:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace yasim
|
|
|
|
#endif // _PISTONENGINE_HPP
|