The attached patch isn't ready to go in, but I was hoping to get some
comments on it.  It changes the power calculation to use the Gagg-
Farrar Power Drop Off Rule from "Performance of Light Aircraft" by John
Lowry.

The Gagg-Farrar equation uses a constant to express the power drop off
of a piston engine as air density decreases.

sigma= air_density / standard_density

phi = ( sigma - C ) / ( 1 - C )

power *= phi

In early testing it seems to work well.  I used rho_air_manifold for
air_density and replaced suction_loss, which was based in part on
throttle position, with phi.  This may resolve one of Torsten's issues
with the FGPiston model.

I've made the constant "C" a configurable item, but I don't have a good
name for it.  The patch calls it <gagg-c> but there must be a better
name...  I just can't think of one.

Thanks 

Ron
Index: FGPiston.cpp
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/JSBSim/models/propulsion/FGPiston.cpp,v
retrieving revision 1.12
diff -u -r1.12 FGPiston.cpp
--- FGPiston.cpp	30 Nov 2008 10:44:30 -0000	1.12
+++ FGPiston.cpp	17 Dec 2008 06:33:58 -0000
@@ -81,6 +81,7 @@
   MinManifoldPressure_inHg = 6.5;
   MaxManifoldPressure_inHg = 28.5;
   BSFC = -1;
+  Gagg_C = 0.12;
 
   // Initialisation
   volumetric_efficiency = 0.8;  // Actually f(speed, load) but this will get us running
@@ -206,6 +207,8 @@
     BSFC = el->FindElementValueAsNumberConvertTo("bsfc", "LBS/HP*HR");
   if (el->FindElement("volumetric-efficiency"))
     volumetric_efficiency = el->FindElementValueAsNumber("volumetric-efficiency");
+  if (el->FindElement("gagg-c"))
+    Gagg_C = el->FindElementValueAsNumber("gagg-c");
   if (el->FindElement("numboostspeeds")) { // Turbo- and super-charging parameters
     BoostSpeeds = (int)el->FindElementValueAsNumber("numboostspeeds");
     if (el->FindElement("boostoverride"))
@@ -521,9 +524,10 @@
 
 void FGPiston::doMAP(void)
 {
+    double p_inlet=p_amb, boost_factor=1;
+
     suction_loss = RPM > 0.0 ? ThrottlePos * MaxRPM / RPM : 1.0;
     if (suction_loss > 1.0) suction_loss = 1.0;
-    MAP = p_amb * suction_loss;
 
     if(Boosted) {
       // If takeoff boost is fitted, we currently assume the following throttle map:
@@ -549,21 +553,22 @@
         }
       }
       // Boost the manifold pressure.
-      double boost_factor = BoostMul[BoostSpeed] * suction_loss * RPM/RatedRPM[BoostSpeed];
+      boost_factor = BoostMul[BoostSpeed] * suction_loss * RPM/RatedRPM[BoostSpeed];
       if (boost_factor < 1.0) boost_factor = 1.0;  // boost will never reduce the MAP
-      MAP *= boost_factor;
+      p_inlet *= boost_factor;
       // Now clip the manifold pressure to BCV or Wastegate setting.
       if(bTakeoffPos) {
-        if(MAP > TakeoffMAP[BoostSpeed]) {
-          MAP = TakeoffMAP[BoostSpeed];
+        if(p_inlet > TakeoffMAP[BoostSpeed]) {
+          p_inlet = TakeoffMAP[BoostSpeed];
         }
       } else {
-        if(MAP > RatedMAP[BoostSpeed]) {
-          MAP = RatedMAP[BoostSpeed];
+        if(p_inlet > RatedMAP[BoostSpeed]) {
+          p_inlet = RatedMAP[BoostSpeed];
         }
       }
     }
 
+    MAP = p_inlet * suction_loss;
   // And set the value in American units as well
   ManifoldPressure_inHg = MAP / inhgtopa;
 }
@@ -579,7 +584,7 @@
  *
  * TODO: Model inlet manifold air temperature.
  *
- * Outputs: rho_air, m_dot_air
+ * Outputs: rho_air, m_dot_air, Gagg_sigma
  */
 
 void FGPiston::doAirFlow(void)
@@ -588,8 +593,8 @@
   double displacement_SI = Displacement * in3tom3;
   double swept_volume = (displacement_SI * (RPM/60)) / 2;
   double v_dot_air = swept_volume * volumetric_efficiency * suction_loss;
-
   double rho_air_manifold = MAP / (R_air * T_amb);
+  Gagg_sigma = rho_air_manifold / 1.225;
   m_dot_air = v_dot_air * rho_air_manifold;
 }
 
@@ -636,6 +641,7 @@
   if (Running) {
     double T_amb_degF = KelvinToFahrenheit(T_amb);
     double T_amb_sea_lev_degF = KelvinToFahrenheit(288);
+    double phi=(Gagg_sigma-Gagg_C)/(1-Gagg_C); // Gagg-Farrar Power Drop Off Factor
 
     // FIXME: this needs to be generalized
     double ME, friction, percent_RPM, power;  // Convienience term for use in the calculations
@@ -649,7 +655,7 @@
     if ( Magnetos != 3 ) power *= SparkFailDrop;
 
 
-    HP = (FuelFlow_gph * 6.0 / BSFC )* ME * suction_loss * power;
+    HP = (FuelFlow_gph * 6.0 / BSFC )* ME  * phi * power;
 
   } else {
 
Index: FGPiston.cpp
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/JSBSim/models/propulsion/FGPiston.cpp,v
retrieving revision 1.12
diff -u -r1.12 FGPiston.cpp
--- FGPiston.cpp	30 Nov 2008 10:44:30 -0000	1.12
+++ FGPiston.cpp	17 Dec 2008 06:34:04 -0000
@@ -81,6 +81,7 @@
   MinManifoldPressure_inHg = 6.5;
   MaxManifoldPressure_inHg = 28.5;
   BSFC = -1;
+  Gagg_C = 0.12;
 
   // Initialisation
   volumetric_efficiency = 0.8;  // Actually f(speed, load) but this will get us running
@@ -206,6 +207,8 @@
     BSFC = el->FindElementValueAsNumberConvertTo("bsfc", "LBS/HP*HR");
   if (el->FindElement("volumetric-efficiency"))
     volumetric_efficiency = el->FindElementValueAsNumber("volumetric-efficiency");
+  if (el->FindElement("gagg-c"))
+    Gagg_C = el->FindElementValueAsNumber("gagg-c");
   if (el->FindElement("numboostspeeds")) { // Turbo- and super-charging parameters
     BoostSpeeds = (int)el->FindElementValueAsNumber("numboostspeeds");
     if (el->FindElement("boostoverride"))
@@ -521,9 +524,10 @@
 
 void FGPiston::doMAP(void)
 {
+    double p_inlet=p_amb, boost_factor=1;
+
     suction_loss = RPM > 0.0 ? ThrottlePos * MaxRPM / RPM : 1.0;
     if (suction_loss > 1.0) suction_loss = 1.0;
-    MAP = p_amb * suction_loss;
 
     if(Boosted) {
       // If takeoff boost is fitted, we currently assume the following throttle map:
@@ -549,21 +553,22 @@
         }
       }
       // Boost the manifold pressure.
-      double boost_factor = BoostMul[BoostSpeed] * suction_loss * RPM/RatedRPM[BoostSpeed];
+      boost_factor = BoostMul[BoostSpeed] * suction_loss * RPM/RatedRPM[BoostSpeed];
       if (boost_factor < 1.0) boost_factor = 1.0;  // boost will never reduce the MAP
-      MAP *= boost_factor;
+      p_inlet *= boost_factor;
       // Now clip the manifold pressure to BCV or Wastegate setting.
       if(bTakeoffPos) {
-        if(MAP > TakeoffMAP[BoostSpeed]) {
-          MAP = TakeoffMAP[BoostSpeed];
+        if(p_inlet > TakeoffMAP[BoostSpeed]) {
+          p_inlet = TakeoffMAP[BoostSpeed];
         }
       } else {
-        if(MAP > RatedMAP[BoostSpeed]) {
-          MAP = RatedMAP[BoostSpeed];
+        if(p_inlet > RatedMAP[BoostSpeed]) {
+          p_inlet = RatedMAP[BoostSpeed];
         }
       }
     }
 
+    MAP = p_inlet * suction_loss;
   // And set the value in American units as well
   ManifoldPressure_inHg = MAP / inhgtopa;
 }
@@ -579,7 +584,7 @@
  *
  * TODO: Model inlet manifold air temperature.
  *
- * Outputs: rho_air, m_dot_air
+ * Outputs: rho_air, m_dot_air, Gagg_sigma
  */
 
 void FGPiston::doAirFlow(void)
@@ -588,8 +593,8 @@
   double displacement_SI = Displacement * in3tom3;
   double swept_volume = (displacement_SI * (RPM/60)) / 2;
   double v_dot_air = swept_volume * volumetric_efficiency * suction_loss;
-
   double rho_air_manifold = MAP / (R_air * T_amb);
+  Gagg_sigma = rho_air_manifold / 1.225;
   m_dot_air = v_dot_air * rho_air_manifold;
 }
 
@@ -636,6 +641,7 @@
   if (Running) {
     double T_amb_degF = KelvinToFahrenheit(T_amb);
     double T_amb_sea_lev_degF = KelvinToFahrenheit(288);
+    double phi=(Gagg_sigma-Gagg_C)/(1-Gagg_C); // Gagg-Farrar Power Drop Off Factor
 
     // FIXME: this needs to be generalized
     double ME, friction, percent_RPM, power;  // Convienience term for use in the calculations
@@ -649,7 +655,7 @@
     if ( Magnetos != 3 ) power *= SparkFailDrop;
 
 
-    HP = (FuelFlow_gph * 6.0 / BSFC )* ME * suction_loss * power;
+    HP = (FuelFlow_gph * 6.0 / BSFC )* ME  * phi * power;
 
   } else {
 
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to