- suction_loss = pow( ThrottlePos*0.98, RPM/MaxRPM );
- MAP = p_amb * suction_loss;
-
- if(Boosted) {
- // If takeoff boost is fitted, we currently assume the following throttle map:
- // (In throttle % - actual input is 0 -> 1)
- // 99 / 100 - Takeoff boost
- // 96 / 97 / 98 - Rated boost
- // 0 - 95 - Idle to Rated boost (MinManifoldPressure to MaxManifoldPressure)
- // In real life, most planes would be fitted with a mechanical 'gate' between
- // the rated boost and takeoff boost positions.
- double T = Throttle; // processed throttle value.
- bool bTakeoffPos = false;
- if(bTakeoffBoost) {
- if(Throttle > 0.98) {
- //cout << "Takeoff Boost!!!!\n";
- bTakeoffPos = true;
- } else if(Throttle <= 0.95) {
- bTakeoffPos = false;
- T *= 1.0 / 0.95;
- } else {
- bTakeoffPos = false;
- //cout << "Rated Boost!!\n";
- T = 1.0;
- }
- }
- // Boost the manifold pressure.
- MAP += MAP * BoostMul[BoostSpeed] * RPM/MaxRPM;
- // Now clip the manifold pressure to BCV or Wastegate setting.
- if(bTakeoffPos) {
- if(MAP > TakeoffMAP[BoostSpeed]) {
- MAP = TakeoffMAP[BoostSpeed];
- }
- } else {
- if(MAP > RatedMAP[BoostSpeed]) {
- MAP = RatedMAP[BoostSpeed];
- }
+ // estimate throttle plate area.
+ double throttle_area = ThrottleAngle*ThrottleAngle;
+ // Internal Combustion Engine in Theory and Practice, Volume 2. Charles Fayette Taylor. Revised Edition, 1985 fig 6-13
+ double map_coefficient = 1-((MeanPistonSpeed_fps*MeanPistonSpeed_fps)/(24978*throttle_area));
+
+ if ( map_coefficient < 0.1 ) map_coefficient = 0.1;
+
+ // Add a one second lag to manifold pressure changes
+ double dMAP = (TMAP - p_amb * map_coefficient) * dt;
+ TMAP -=dMAP;
+
+ // Find the mean effective pressure required to achieve this manifold pressure
+ // Fixme: determine the HP consumed by the supercharger
+
+ PMEP = TMAP - p_amb; // Fixme: p_amb should be exhaust manifold pressure
+
+ if (Boosted) {
+ // If takeoff boost is fitted, we currently assume the following throttle map:
+ // (In throttle % - actual input is 0 -> 1)
+ // 99 / 100 - Takeoff boost
+ // In real life, most planes would be fitted with a mechanical 'gate' between
+ // the rated boost and takeoff boost positions.
+
+ bool bTakeoffPos = false;
+ if (bTakeoffBoost) {
+ if (Throttle > 0.98) {
+ bTakeoffPos = true;