- // estimate throttle plate area. This maps 0.2 -> 0.1 for historical performance reasons
- double throttle_area = ThrottleAngle * 1.125 - 0.125;
- map_coefficient = pow ((throttle_area * MaxManifoldPressure_Percent),RPM/MaxRPM);
- MAP = p_amb * map_coefficient;
-
- 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.
- double boost_factor = BoostMul[BoostSpeed] * map_coefficient * RPM/RatedRPM[BoostSpeed];
- if (boost_factor < 1.0) boost_factor = 1.0; // boost will never reduce the MAP
- MAP *= boost_factor;
- // 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;