]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/propulsion/FGPiston.cpp
Latest round of JSBim updates.
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGPiston.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGPiston.cpp
4  Author:       Jon S. Berndt, JSBSim framework
5                Dave Luff, Piston engine model
6                Ronald Jensen, Piston engine model
7  Date started: 09/12/2000
8  Purpose:      This module models a Piston engine
9
10  ------------- Copyright (C) 2000  Jon S. Berndt (jon@jsbsim.org) --------------
11
12  This program is free software; you can redistribute it and/or modify it under
13  the terms of the GNU Lesser General Public License as published by the Free Software
14  Foundation; either version 2 of the License, or (at your option) any later
15  version.
16
17  This program is distributed in the hope that it will be useful, but WITHOUT
18  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
20  details.
21
22  You should have received a copy of the GNU Lesser General Public License along with
23  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
24  Place - Suite 330, Boston, MA  02111-1307, USA.
25
26  Further information about the GNU Lesser General Public License can also be found on
27  the world wide web at http://www.gnu.org.
28
29 FUNCTIONAL DESCRIPTION
30 --------------------------------------------------------------------------------
31
32 This class descends from the FGEngine class and models a Piston engine based on
33 parameters given in the engine config file for this class
34
35 HISTORY
36 --------------------------------------------------------------------------------
37 09/12/2000  JSB  Created
38
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 INCLUDES
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42
43 #include <iostream>
44 #include <sstream>
45
46 #include "FGPiston.h"
47 #include "FGPropeller.h"
48
49 using namespace std;
50
51 namespace JSBSim {
52
53 static const char *IdSrc = "$Id: FGPiston.cpp,v 1.68 2011/10/11 15:13:34 jentron Exp $";
54 static const char *IdHdr = ID_PISTON;
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS IMPLEMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60 FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number, struct Inputs& input)
61   : FGEngine(exec, el, engine_number, input),
62   R_air(287.3),                  // Gas constant for air J/Kg/K
63   rho_fuel(800),                 // estimate
64   calorific_value_fuel(47.3e6),  // J/Kg
65   Cp_air(1005),                  // Specific heat (constant pressure) J/Kg/K
66   Cp_fuel(1700),
67   standard_pressure(101320.73)
68 {
69   Element *table_element;
70   string token;
71   string name="";
72
73   // Defaults and initializations
74
75   Type = etPiston;
76
77   // These items are read from the configuration file
78   // Defaults are from a Lycoming O-360, more or less
79
80   Cycles = 4;
81   IdleRPM = 600;
82   MaxRPM = 2800;
83   Displacement = 360;
84   SparkFailDrop = 1.0;
85   MaxHP = 200;
86   MinManifoldPressure_inHg = 6.5;
87   MaxManifoldPressure_inHg = 28.5;
88   ISFC = -1;
89   volumetric_efficiency = 0.85;
90   Bore = 5.125;
91   Stroke = 4.375;
92   Cylinders = 4;
93   CylinderHeadMass = 2; //kg
94   CompressionRatio = 8.5;
95   Z_airbox = -999;
96   Ram_Air_Factor = 1;
97   PeakMeanPistonSpeed_fps = 100;
98   FMEPDynamic= 18400;
99   FMEPStatic = 46500;
100   Cooling_Factor = 0.5144444;
101   StaticFriction_HP = 1.5;
102
103   // These are internal program variables
104
105   Lookup_Combustion_Efficiency = 0;
106   Mixture_Efficiency_Correlation = 0;
107   crank_counter = 0;
108   Magnetos = 0;
109   minMAP = 21950;
110   maxMAP = 96250;
111
112   ResetToIC();
113
114   // Supercharging
115   BoostSpeeds = 0;  // Default to no supercharging
116   BoostSpeed = 0;
117   Boosted = false;
118   BoostOverride = 0;
119   BoostManual = 0;
120   bBoostOverride = false;
121   bTakeoffBoost = false;
122   TakeoffBoost = 0.0;   // Default to no extra takeoff-boost
123   int i;
124   for (i=0; i<FG_MAX_BOOST_SPEEDS; i++) {
125     RatedBoost[i] = 0.0;
126     RatedPower[i] = 0.0;
127     RatedAltitude[i] = 0.0;
128     BoostMul[i] = 1.0;
129     RatedMAP[i] = 100000;
130     RatedRPM[i] = 2500;
131     TakeoffMAP[i] = 100000;
132   }
133   for (i=0; i<FG_MAX_BOOST_SPEEDS-1; i++) {
134     BoostSwitchAltitude[i] = 0.0;
135     BoostSwitchPressure[i] = 0.0;
136   }
137
138   // Read inputs from engine data file where present.
139
140   if (el->FindElement("minmp")) // Should have ELSE statement telling default value used?
141     MinManifoldPressure_inHg = el->FindElementValueAsNumberConvertTo("minmp","INHG");
142   if (el->FindElement("maxmp"))
143     MaxManifoldPressure_inHg = el->FindElementValueAsNumberConvertTo("maxmp","INHG");
144   if (el->FindElement("displacement"))
145     Displacement = el->FindElementValueAsNumberConvertTo("displacement","IN3");
146   if (el->FindElement("maxhp"))
147     MaxHP = el->FindElementValueAsNumberConvertTo("maxhp","HP");
148   if (el->FindElement("static-friction"))
149     StaticFriction_HP = el->FindElementValueAsNumberConvertTo("static-friction","HP");
150   if (el->FindElement("sparkfaildrop"))
151     SparkFailDrop = Constrain(0, 1 - el->FindElementValueAsNumber("sparkfaildrop"), 1);
152   if (el->FindElement("cycles"))
153     Cycles = el->FindElementValueAsNumber("cycles");
154   if (el->FindElement("idlerpm"))
155     IdleRPM = el->FindElementValueAsNumber("idlerpm");
156   if (el->FindElement("maxrpm"))
157     MaxRPM = el->FindElementValueAsNumber("maxrpm");
158   if (el->FindElement("maxthrottle"))
159     MaxThrottle = el->FindElementValueAsNumber("maxthrottle");
160   if (el->FindElement("minthrottle"))
161     MinThrottle = el->FindElementValueAsNumber("minthrottle");
162   if (el->FindElement("bsfc"))
163     ISFC = el->FindElementValueAsNumberConvertTo("bsfc", "LBS/HP*HR");
164   if (el->FindElement("volumetric-efficiency"))
165     volumetric_efficiency = el->FindElementValueAsNumber("volumetric-efficiency");
166   if (el->FindElement("compression-ratio"))
167     CompressionRatio = el->FindElementValueAsNumber("compression-ratio");
168   if (el->FindElement("bore"))
169     Bore = el->FindElementValueAsNumberConvertTo("bore","IN");
170   if (el->FindElement("stroke"))
171     Stroke = el->FindElementValueAsNumberConvertTo("stroke","IN");
172   if (el->FindElement("cylinders"))
173     Cylinders = el->FindElementValueAsNumber("cylinders");
174   if (el->FindElement("cylinder-head-mass"))
175     CylinderHeadMass = el->FindElementValueAsNumberConvertTo("cylinder-head-mass","KG");
176   if (el->FindElement("air-intake-impedance-factor"))
177     Z_airbox = el->FindElementValueAsNumber("air-intake-impedance-factor");
178   if (el->FindElement("ram-air-factor"))
179     Ram_Air_Factor  = el->FindElementValueAsNumber("ram-air-factor");
180   if (el->FindElement("cooling-factor"))
181     Cooling_Factor  = el->FindElementValueAsNumber("cooling-factor");
182   if (el->FindElement("dynamic-fmep"))
183     FMEPDynamic= el->FindElementValueAsNumberConvertTo("dynamic-fmep","PA");
184   if (el->FindElement("static-fmep"))
185     FMEPStatic = el->FindElementValueAsNumberConvertTo("static-fmep","PA");
186   if (el->FindElement("peak-piston-speed"))
187     PeakMeanPistonSpeed_fps  = el->FindElementValueAsNumber("peak-piston-speed");
188   if (el->FindElement("numboostspeeds")) { // Turbo- and super-charging parameters
189     BoostSpeeds = (int)el->FindElementValueAsNumber("numboostspeeds");
190     if (el->FindElement("boostoverride"))
191       BoostOverride = (int)el->FindElementValueAsNumber("boostoverride");
192     if (el->FindElement("boostmanual"))
193       BoostManual = (int)el->FindElementValueAsNumber("boostmanual");
194     if (el->FindElement("takeoffboost"))
195       TakeoffBoost = el->FindElementValueAsNumberConvertTo("takeoffboost", "PSI");
196     if (el->FindElement("ratedboost1"))
197       RatedBoost[0] = el->FindElementValueAsNumberConvertTo("ratedboost1", "PSI");
198     if (el->FindElement("ratedboost2"))
199       RatedBoost[1] = el->FindElementValueAsNumberConvertTo("ratedboost2", "PSI");
200     if (el->FindElement("ratedboost3"))
201       RatedBoost[2] = el->FindElementValueAsNumberConvertTo("ratedboost3", "PSI");
202     if (el->FindElement("ratedpower1"))
203       RatedPower[0] = el->FindElementValueAsNumberConvertTo("ratedpower1", "HP");
204     if (el->FindElement("ratedpower2"))
205       RatedPower[1] = el->FindElementValueAsNumberConvertTo("ratedpower2", "HP");
206     if (el->FindElement("ratedpower3"))
207       RatedPower[2] = el->FindElementValueAsNumberConvertTo("ratedpower3", "HP");
208     if (el->FindElement("ratedrpm1"))
209       RatedRPM[0] = el->FindElementValueAsNumber("ratedrpm1");
210     if (el->FindElement("ratedrpm2"))
211       RatedRPM[1] = el->FindElementValueAsNumber("ratedrpm2");
212     if (el->FindElement("ratedrpm3"))
213       RatedRPM[2] = el->FindElementValueAsNumber("ratedrpm3");
214     if (el->FindElement("ratedaltitude1"))
215       RatedAltitude[0] = el->FindElementValueAsNumberConvertTo("ratedaltitude1", "FT");
216     if (el->FindElement("ratedaltitude2"))
217       RatedAltitude[1] = el->FindElementValueAsNumberConvertTo("ratedaltitude2", "FT");
218     if (el->FindElement("ratedaltitude3"))
219       RatedAltitude[2] = el->FindElementValueAsNumberConvertTo("ratedaltitude3", "FT");
220   }
221
222   while((table_element = el->FindNextElement("table")) != 0) {
223     name = table_element->GetAttributeValue("name");
224     try {
225       if (name == "COMBUSTION") {
226         Lookup_Combustion_Efficiency = new FGTable(PropertyManager, table_element);
227       } else if (name == "MIXTURE") {
228         Mixture_Efficiency_Correlation = new FGTable(PropertyManager, table_element);
229       } else {
230         cerr << "Unknown table type: " << name << " in piston engine definition." << endl;
231       }
232     } catch (std::string str) {
233       throw("Error loading piston engine table:" + name + ". " + str);
234     }
235   }
236
237   StarterHP = sqrt(MaxHP) * 0.4;
238   displacement_SI = Displacement * in3tom3;
239   RatedMeanPistonSpeed_fps =  ( MaxRPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
240
241   // Create IFSC to match the engine if not provided
242   if (ISFC < 0) {
243       double pmep = 29.92 - MaxManifoldPressure_inHg;
244       pmep *= inhgtopa  * volumetric_efficiency;
245       double fmep = (FMEPDynamic * RatedMeanPistonSpeed_fps * fttom + FMEPStatic);
246       double hp_loss = ((pmep + fmep) * displacement_SI * MaxRPM)/(Cycles*22371);
247       ISFC = ( 1.1*Displacement * MaxRPM * volumetric_efficiency *(MaxManifoldPressure_inHg / 29.92) ) / (9411 * (MaxHP+hp_loss-StaticFriction_HP));
248 // cout <<"FMEP: "<< fmep <<" PMEP: "<< pmep << " hp_loss: " <<hp_loss <<endl;
249   }
250   if ( MaxManifoldPressure_inHg > 29.9 ) {   // Don't allow boosting with a bogus number
251       MaxManifoldPressure_inHg = 29.9;
252   }
253   minMAP = MinManifoldPressure_inHg * inhgtopa;  // inHg to Pa
254   maxMAP = MaxManifoldPressure_inHg * inhgtopa;
255
256 // For throttle
257 /*
258  * Pm = ( Ze / ( Ze + Zi + Zt ) ) * Pa
259  * Where:
260  * Pm = Manifold Pressure
261  * Pa = Ambient Pressre
262  * Ze = engine impedance, Ze is effectively 1 / Mean Piston Speed
263  * Zi = airbox impedance
264  * Zt = throttle impedance
265  *
266  * For the calculation below throttle is fully open or Zt = 0
267  *
268  *
269  *
270  */
271   if(Z_airbox < 0.0){
272     double Ze=PeakMeanPistonSpeed_fps/RatedMeanPistonSpeed_fps; // engine impedence
273     Z_airbox = (standard_pressure *Ze / maxMAP) - Ze; // impedence of airbox
274   }
275   // Constant for Throttle impedence
276   Z_throttle=(PeakMeanPistonSpeed_fps/((IdleRPM * Stroke) / 360))*(standard_pressure/minMAP - 1) - Z_airbox; 
277   //  Z_throttle=(MaxRPM/IdleRPM )*(standard_pressure/minMAP+2); // Constant for Throttle impedence
278
279 // Default tables if not provided in the configuration file
280   if(Lookup_Combustion_Efficiency == 0) {
281     // First column is thi, second is neta (combustion efficiency)
282     Lookup_Combustion_Efficiency = new FGTable(12);
283     *Lookup_Combustion_Efficiency << 0.00 << 0.980;
284     *Lookup_Combustion_Efficiency << 0.90 << 0.980;
285     *Lookup_Combustion_Efficiency << 1.00 << 0.970;
286     *Lookup_Combustion_Efficiency << 1.05 << 0.950;
287     *Lookup_Combustion_Efficiency << 1.10 << 0.900;
288     *Lookup_Combustion_Efficiency << 1.15 << 0.850;
289     *Lookup_Combustion_Efficiency << 1.20 << 0.790;
290     *Lookup_Combustion_Efficiency << 1.30 << 0.700;
291     *Lookup_Combustion_Efficiency << 1.40 << 0.630;
292     *Lookup_Combustion_Efficiency << 1.50 << 0.570;
293     *Lookup_Combustion_Efficiency << 1.60 << 0.525;
294     *Lookup_Combustion_Efficiency << 2.00 << 0.345;
295   }
296
297     // First column is Fuel/Air Ratio, second is neta (mixture efficiency)
298   if( Mixture_Efficiency_Correlation == 0) {
299     Mixture_Efficiency_Correlation = new FGTable(15);
300     *Mixture_Efficiency_Correlation << 0.05000 << 0.00000;
301     *Mixture_Efficiency_Correlation << 0.05137 << 0.00862;
302     *Mixture_Efficiency_Correlation << 0.05179 << 0.21552;
303     *Mixture_Efficiency_Correlation << 0.05430 << 0.48276;
304     *Mixture_Efficiency_Correlation << 0.05842 << 0.70690;
305     *Mixture_Efficiency_Correlation << 0.06312 << 0.83621;
306     *Mixture_Efficiency_Correlation << 0.06942 << 0.93103;
307     *Mixture_Efficiency_Correlation << 0.07786 << 1.00000;
308     *Mixture_Efficiency_Correlation << 0.08845 << 1.00000;
309     *Mixture_Efficiency_Correlation << 0.09270 << 0.98276;
310     *Mixture_Efficiency_Correlation << 0.10120 << 0.93103;
311     *Mixture_Efficiency_Correlation << 0.11455 << 0.72414;
312     *Mixture_Efficiency_Correlation << 0.12158 << 0.45690;
313     *Mixture_Efficiency_Correlation << 0.12435 << 0.23276;
314     *Mixture_Efficiency_Correlation << 0.12500 << 0.00000;
315   }
316
317   string property_name, base_property_name;
318   base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
319   property_name = base_property_name + "/power-hp";
320   PropertyManager->Tie(property_name, &HP);
321   property_name = base_property_name + "/bsfc-lbs_hphr";
322   PropertyManager->Tie(property_name, &ISFC);
323   property_name = base_property_name + "/volumetric-efficiency";
324   PropertyManager->Tie(property_name, &volumetric_efficiency);
325   property_name = base_property_name + "/map-pa";
326   PropertyManager->Tie(property_name, &MAP);
327   property_name = base_property_name + "/map-inhg";
328   PropertyManager->Tie(property_name, &ManifoldPressure_inHg);
329   property_name = base_property_name + "/air-intake-impedance-factor";
330   PropertyManager->Tie(property_name, &Z_airbox);
331   property_name = base_property_name + "/ram-air-factor";
332   PropertyManager->Tie(property_name, &Ram_Air_Factor);
333   property_name = base_property_name + "/cooling-factor";
334   PropertyManager->Tie(property_name, &Cooling_Factor);
335   property_name = base_property_name + "/boost-speed";
336   PropertyManager->Tie(property_name, &BoostSpeed);
337   property_name = base_property_name + "/cht-degF";
338   PropertyManager->Tie(property_name, this, &FGPiston::getCylinderHeadTemp_degF);
339   property_name = base_property_name + "/oil-temperature-degF";
340   PropertyManager->Tie(property_name, this, &FGPiston::getOilTemp_degF);
341   property_name = base_property_name + "/oil-pressure-psi";
342   PropertyManager->Tie(property_name, this, &FGPiston::getOilPressure_psi);
343   property_name = base_property_name + "/egt-degF";
344   PropertyManager->Tie(property_name, this, &FGPiston::getExhaustGasTemp_degF);
345
346   // Set up and sanity-check the turbo/supercharging configuration based on the input values.
347   if (TakeoffBoost > RatedBoost[0]) bTakeoffBoost = true;
348   for (i=0; i<BoostSpeeds; ++i) {
349     bool bad = false;
350     if (RatedBoost[i] <= 0.0) bad = true;
351     if (RatedPower[i] <= 0.0) bad = true;
352     if (RatedAltitude[i] < 0.0) bad = true;  // 0.0 is deliberately allowed - this corresponds to unregulated supercharging.
353     if (i > 0 && RatedAltitude[i] < RatedAltitude[i - 1]) bad = true;
354     if (bad) {
355       // We can't recover from the above - don't use this supercharger speed.
356       BoostSpeeds--;
357       // TODO - put out a massive error message!
358       break;
359     }
360     // Now sanity-check stuff that is recoverable.
361     if (i < BoostSpeeds - 1) {
362       if (BoostSwitchAltitude[i] < RatedAltitude[i]) {
363         // TODO - put out an error message
364         // But we can also make a reasonable estimate, as below.
365         BoostSwitchAltitude[i] = RatedAltitude[i] + 1000;
366       }
367       BoostSwitchPressure[i] = GetStdPressure100K(BoostSwitchAltitude[i]) * psftopa;
368       //cout << "BoostSwitchAlt = " << BoostSwitchAltitude[i] << ", pressure = " << BoostSwitchPressure[i] << '\n';
369       // Assume there is some hysteresis on the supercharger gear switch, and guess the value for now
370       BoostSwitchHysteresis = 1000;
371     }
372     // Now work out the supercharger pressure multiplier of this speed from the rated boost and altitude.
373     RatedMAP[i] = standard_pressure + RatedBoost[i] * 6895;  // psi*6895 = Pa.
374     // Sometimes a separate BCV setting for takeoff or extra power is fitted.
375     if (TakeoffBoost > RatedBoost[0]) {
376       // Assume that the effect on the BCV is the same whichever speed is in use.
377       TakeoffMAP[i] = RatedMAP[i] + ((TakeoffBoost - RatedBoost[0]) * 6895);
378       bTakeoffBoost = true;
379     } else {
380       TakeoffMAP[i] = RatedMAP[i];
381       bTakeoffBoost = false;
382     }
383     BoostMul[i] = RatedMAP[i] / (GetStdPressure100K(RatedAltitude[i]) * psftopa);
384
385   }
386
387   if (BoostSpeeds > 0) {
388     Boosted = true;
389     BoostSpeed = 0;
390   }
391   bBoostOverride = (BoostOverride == 1 ? true : false);
392   bBoostManual   = (BoostManual   == 1 ? true : false);
393   Debug(0); // Call Debug() routine from constructor if needed
394 }
395
396 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397
398 FGPiston::~FGPiston()
399 {
400   delete Lookup_Combustion_Efficiency;
401   delete Mixture_Efficiency_Correlation;
402   Debug(1); // Call Debug() routine from constructor if needed
403 }
404
405 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
406
407 void FGPiston::ResetToIC(void)
408 {
409   FGEngine::ResetToIC();
410
411   ManifoldPressure_inHg = in.Pressure * psftoinhg; // psf to in Hg
412   MAP = in.Pressure * psftopa;
413   TMAP = MAP;
414   double airTemperature_degK = RankineToKelvin(in.Temperature);
415   OilTemp_degK = airTemperature_degK;
416   CylinderHeadTemp_degK = airTemperature_degK;
417   ExhaustGasTemp_degK = airTemperature_degK;
418   EGT_degC = ExhaustGasTemp_degK - 273;
419   Thruster->SetRPM(0.0);
420   RPM = 0.0;
421   OilPressure_psi = 0.0;
422 }
423
424 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425
426 void FGPiston::Calculate(void)
427 {
428   // Input values.
429
430   p_amb = in.Pressure * psftopa;
431   double p = in.TotalPressure * psftopa;
432   p_ram = (p - p_amb) * Ram_Air_Factor + p_amb;
433   T_amb = RankineToKelvin(in.Temperature);
434
435   RunPreFunctions();
436
437   TotalDeltaT = ( in.TotalDeltaT < 1e-9 ) ? 1.0 : in.TotalDeltaT;
438
439 /* The thruster controls the engine RPM because it encapsulates the gear ratio and other transmission variables */
440   RPM = Thruster->GetEngineRPM();
441
442   MeanPistonSpeed_fps =  ( RPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
443
444   IAS = in.Vc;
445
446   doEngineStartup();
447   if (Boosted) doBoostControl();
448   doMAP();
449   doAirFlow();
450   doFuelFlow();
451
452   //Now that the fuel flow is done check if the mixture is too lean to run the engine
453   //Assume lean limit at 22 AFR for now - thats a thi of 0.668
454   //This might be a bit generous, but since there's currently no audiable warning of impending
455   //cutout in the form of misfiring and/or rough running its probably reasonable for now.
456
457   //  if (equivalence_ratio < 0.668)
458   //    Running = false;
459
460   doEnginePower();
461   if (IndicatedHorsePower < 0.1250) Running = false;
462
463   doEGT();
464   doCHT();
465   doOilTemperature();
466   doOilPressure();
467
468   if (Thruster->GetType() == FGThruster::ttPropeller) {
469     ((FGPropeller*)Thruster)->SetAdvance(in.PropAdvance[EngineNumber]);
470     ((FGPropeller*)Thruster)->SetFeather(in.PropFeather[EngineNumber]);
471   }
472
473   LoadThrusterInputs();
474   Thruster->Calculate(HP * hptoftlbssec);
475
476   RunPostFunctions();
477 }
478
479 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
480
481 double FGPiston::CalcFuelNeed(void)
482 {
483   FuelExpended = FuelFlowRate * in.TotalDeltaT;
484   if (!Starved) FuelUsedLbs += FuelExpended; 
485   return FuelExpended;
486 }
487
488 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489
490 int FGPiston::InitRunning(void)
491 {
492   Magnetos=3;
493   in.MixtureCmd[EngineNumber] = in.PressureRatio/1.3;
494   in.MixturePos[EngineNumber] = in.PressureRatio/1.3;
495   Thruster->SetRPM( 2.0*IdleRPM/Thruster->GetGearRatio() );
496   Running = true;
497   return 1;
498 }
499
500 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501 /**
502  * Start or stop the engine.
503  */
504
505 void FGPiston::doEngineStartup(void)
506 {
507   // Check parameters that may alter the operating state of the engine.
508   // (spark, fuel, starter motor etc)
509   bool spark;
510   bool fuel;
511   // Check for spark
512   Magneto_Left = false;
513   Magneto_Right = false;
514   // Magneto positions:
515   // 0 -> off
516   // 1 -> left only
517   // 2 -> right only
518   // 3 -> both
519   if (Magnetos != 0) {
520     spark = true;
521   } else {
522     spark = false;
523   }  // neglects battery voltage, master on switch, etc for now.
524
525   if ((Magnetos == 1) || (Magnetos > 2)) Magneto_Left = true;
526   if (Magnetos > 1)  Magneto_Right = true;
527
528   // Assume we have fuel for now
529   fuel = !Starved;
530
531   // Check if we are turning the starter motor
532   if (Cranking != Starter) {
533     // This check saves .../cranking from getting updated every loop - they
534     // only update when changed.
535     Cranking = Starter;
536     crank_counter = 0;
537   }
538
539   if (Cranking) crank_counter++;  //Check mode of engine operation
540
541   if (!Running && spark && fuel) {  // start the engine if revs high enough
542     if (Cranking) {
543       if ((RPM > IdleRPM*0.8) && (crank_counter > 175)) // Add a little delay to startup
544         Running = true;                         // on the starter
545     } else {
546       if (RPM > IdleRPM*0.8)                            // This allows us to in-air start
547         Running = true;                         // when windmilling
548     }
549   }
550
551   // Cut the engine *power* - Note: the engine may continue to
552   // spin if the prop is in a moving airstream
553
554   if ( Running && (!spark || !fuel) ) Running = false;
555
556   // Check for stalling (RPM = 0).
557   if (Running) {
558     if (RPM == 0) {
559       Running = false;
560     } else if ((RPM <= IdleRPM *0.8 ) && (Cranking)) {
561       Running = false;
562     }
563   }
564 }
565
566 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
567
568 /**
569  * Calculate the Current Boost Speed
570  *
571  * This function calculates the current turbo/supercharger boost speed
572  * based on altitude and the (automatic) boost-speed control valve configuration.
573  *
574  * Inputs: p_amb, BoostSwitchPressure, BoostSwitchHysteresis
575  *
576  * Outputs: BoostSpeed
577  */
578
579 void FGPiston::doBoostControl(void)
580 {
581   if(BoostManual) {
582     if(BoostSpeed > BoostSpeeds-1) BoostSpeed = BoostSpeeds-1;
583     if(BoostSpeed < 0) BoostSpeed = 0;
584   } else {
585     if(BoostSpeed < BoostSpeeds - 1) {
586       // Check if we need to change to a higher boost speed
587       if(p_amb < BoostSwitchPressure[BoostSpeed] - BoostSwitchHysteresis) {
588         BoostSpeed++;
589       }
590     } if(BoostSpeed > 0) {
591       // Check if we need to change to a lower boost speed
592       if(p_amb > BoostSwitchPressure[BoostSpeed - 1] + BoostSwitchHysteresis) {
593         BoostSpeed--;
594       }
595     }
596   }
597 }
598
599 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
600
601 /**
602  * Calculate the manifold absolute pressure (MAP) in inches hg
603  *
604  * This function calculates manifold absolute pressure (MAP)
605  * from the throttle position, turbo/supercharger boost control
606  * system, engine speed and local ambient air density.
607  *
608  * Inputs: p_amb, Throttle,
609  *         MeanPistonSpeed_fps, dt
610  *
611  * Outputs: MAP, ManifoldPressure_inHg, TMAP
612  */
613
614 void FGPiston::doMAP(void)
615 {
616   double Zt = (1 - in.ThrottlePos[EngineNumber])*(1 - in.ThrottlePos[EngineNumber])*Z_throttle; // throttle impedence
617   double Ze= MeanPistonSpeed_fps > 0 ? PeakMeanPistonSpeed_fps/MeanPistonSpeed_fps : 999999; // engine impedence
618
619   double map_coefficient = Ze/(Ze+Z_airbox+Zt);
620
621   // Add a one second lag to manifold pressure changes
622   double dMAP=0;
623   dMAP = (TMAP - p_ram * map_coefficient) * TotalDeltaT;
624
625   TMAP -=dMAP;
626
627   // Find the mean effective pressure required to achieve this manifold pressure
628   // Fixme: determine the HP consumed by the supercharger
629
630   PMEP = (TMAP - p_amb) * volumetric_efficiency; // Fixme: p_amb should be exhaust manifold pressure
631
632   if (Boosted) {
633     // If takeoff boost is fitted, we currently assume the following throttle map:
634     // (In throttle % - actual input is 0 -> 1)
635     // 99 / 100 - Takeoff boost
636     // In real life, most planes would be fitted with a mechanical 'gate' between
637     // the rated boost and takeoff boost positions.
638
639     bool bTakeoffPos = false;
640     if (bTakeoffBoost) {
641       if (in.ThrottlePos[EngineNumber] > 0.98) {
642         bTakeoffPos = true;
643       }
644     }
645     // Boost the manifold pressure.
646     double boost_factor = (( BoostMul[BoostSpeed] - 1 ) / RatedRPM[BoostSpeed] ) * RPM + 1;
647     MAP = TMAP * boost_factor;
648     // Now clip the manifold pressure to BCV or Wastegate setting.
649     if (bTakeoffPos) {
650       if (MAP > TakeoffMAP[BoostSpeed]) MAP = TakeoffMAP[BoostSpeed];
651     } else {
652       if (MAP > RatedMAP[BoostSpeed]) MAP = RatedMAP[BoostSpeed];
653     }
654   } else {
655       MAP = TMAP;
656   }
657
658   // And set the value in American units as well
659   ManifoldPressure_inHg = MAP / inhgtopa;
660 }
661
662 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663 /**
664  * Calculate the air flow through the engine.
665  * Also calculates ambient air density
666  * (used in CHT calculation for air-cooled engines).
667  *
668  * Inputs: p_amb, R_air, T_amb, MAP, Displacement,
669  *   RPM, volumetric_efficiency,
670  *
671  * TODO: Model inlet manifold air temperature.
672  *
673  * Outputs: rho_air, m_dot_air
674  */
675
676 void FGPiston::doAirFlow(void)
677 {
678   double gamma = 1.3; // specific heat constants
679 // loss of volumentric efficiency due to difference between MAP and exhaust pressure
680 // Eq 6-10 from The Internal Combustion Engine - Charles Taylor Vol 1
681   double ve =((gamma-1)/gamma) +( CompressionRatio -(p_amb/MAP))/(gamma*( CompressionRatio - 1));
682
683   rho_air = p_amb / (R_air * T_amb);
684   double swept_volume = (displacement_SI * (RPM/60)) / 2;
685   double v_dot_air = swept_volume * volumetric_efficiency *ve;
686
687   double rho_air_manifold = MAP / (R_air * T_amb);
688   m_dot_air = v_dot_air * rho_air_manifold;
689
690 }
691
692 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 /**
694  * Calculate the fuel flow into the engine.
695  *
696  * Inputs: Mixture, thi_sea_level, p_amb, m_dot_air
697  *
698  * Outputs: equivalence_ratio, m_dot_fuel
699  */
700
701 void FGPiston::doFuelFlow(void)
702 {
703   double thi_sea_level = 1.3 * in.MixturePos[EngineNumber]; // Allows an AFR of infinity:1 to 11.3075:1
704   equivalence_ratio = thi_sea_level * 101325.0 / p_amb;
705 //  double AFR = 10+(12*(1-in.Mixture[EngineNumber]));// mixture 10:1 to 22:1
706 //  m_dot_fuel = m_dot_air / AFR;
707   m_dot_fuel = (m_dot_air * equivalence_ratio) / 14.7;
708   FuelFlowRate =  m_dot_fuel * 2.2046;  // kg to lb
709   if(Starved) // There is no fuel, so zero out the flows we've calculated so far
710   {
711     equivalence_ratio = 0.0;
712     FuelFlowRate = 0.0;
713     m_dot_fuel = 0.0;
714   }
715   FuelFlow_pph = FuelFlowRate  * 3600;  // seconds to hours
716   FuelFlow_gph = FuelFlow_pph / 6.0;    // Assumes 6 lbs / gallon
717 }
718
719 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
720 /**
721  * Calculate the power produced by the engine.
722  *
723  * Inputs: ManifoldPressure_inHg, p_amb, RPM, T_amb, ISFC,
724  *   Mixture_Efficiency_Correlation, Cycles, MaxHP, PMEP,
725  *   MeanPistonSpeed_fps
726  *
727  * Outputs: PctPower, HP, FMEP, IndicatedHorsePower
728  */
729
730 void FGPiston::doEnginePower(void)
731 {
732   IndicatedHorsePower = 0;
733   FMEP = 0;
734   if (Running) {
735     // FIXME: this needs to be generalized
736     double ME, percent_RPM, power;  // Convienience term for use in the calculations
737     ME = Mixture_Efficiency_Correlation->GetValue(m_dot_fuel/m_dot_air);
738
739     percent_RPM = RPM/MaxRPM;
740 // Guestimate engine friction losses from Figure 4.4 of "Engines: An Introduction", John Lumley
741     FMEP = (-FMEPDynamic * MeanPistonSpeed_fps * fttom - FMEPStatic);
742
743     power = 1;
744
745     if ( Magnetos != 3 ) power *= SparkFailDrop;
746
747
748     IndicatedHorsePower = (FuelFlow_pph / ISFC )* ME * power;
749
750   } else {
751     // Power output when the engine is not running
752     if (Cranking) {
753       if (RPM < 10) {
754         IndicatedHorsePower = StarterHP;
755       } else if (RPM < IdleRPM*0.8) {
756         IndicatedHorsePower = StarterHP + ((IdleRPM*0.8 - RPM) / 8.0);
757         // This is a guess - would be nice to find a proper starter moter torque curve
758       } else {
759         IndicatedHorsePower = StarterHP;
760       }
761     }
762   }
763
764   // Constant is (1/2) * 60 * 745.7
765   // (1/2) convert cycles, 60 minutes to seconds, 745.7 watts to hp.
766   double pumping_hp = ((PMEP + FMEP) * displacement_SI * RPM)/(Cycles*22371);
767
768   HP = IndicatedHorsePower + pumping_hp - StaticFriction_HP; //FIXME static friction should depend on oil temp and configuration
769 //  cout << "pumping_hp " <<pumping_hp << FMEP << PMEP <<endl;
770   PctPower = HP / MaxHP ;
771 //  cout << "Power = " << HP << "  RPM = " << RPM << "  Running = " << Running << "  Cranking = " << Cranking << endl;
772 }
773
774 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
775 /**
776  * Calculate the exhaust gas temperature.
777  *
778  * Inputs: equivalence_ratio, m_dot_fuel, calorific_value_fuel,
779  *   Cp_air, m_dot_air, Cp_fuel, m_dot_fuel, T_amb, PctPower
780  *
781  * Outputs: combustion_efficiency, ExhaustGasTemp_degK
782  */
783
784 void FGPiston::doEGT(void)
785 {
786   double delta_T_exhaust;
787   double enthalpy_exhaust;
788   double heat_capacity_exhaust;
789   double dEGTdt;
790
791   if ((Running) && (m_dot_air > 0.0)) {  // do the energy balance
792     combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio);
793     enthalpy_exhaust = m_dot_fuel * calorific_value_fuel *
794                               combustion_efficiency * 0.30;
795     heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
796     delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
797     ExhaustGasTemp_degK = T_amb + delta_T_exhaust;
798   } else {  // Drop towards ambient - guess an appropriate time constant for now
799     combustion_efficiency = 0;
800     dEGTdt = (RankineToKelvin(in.Temperature) - ExhaustGasTemp_degK) / 100.0;
801     delta_T_exhaust = dEGTdt * TotalDeltaT;
802
803     ExhaustGasTemp_degK += delta_T_exhaust;
804   }
805 }
806
807 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
808 /**
809  * Calculate the cylinder head temperature.
810  *
811  * Inputs: T_amb, IAS, rho_air, m_dot_fuel, calorific_value_fuel,
812  *   combustion_efficiency, RPM, MaxRPM, Displacement, Cylinders
813  *
814  * Outputs: CylinderHeadTemp_degK
815  */
816
817 void FGPiston::doCHT(void)
818 {
819   double h1 = -95.0;
820   double h2 = -3.95;
821   double h3 = -140.0; // -0.05 * 2800 (default maxrpm)
822
823   double arbitary_area = Displacement/360.0;
824   double CpCylinderHead = 800.0;
825   double MassCylinderHead = CylinderHeadMass * Cylinders;
826
827   double temperature_difference = CylinderHeadTemp_degK - T_amb;
828   double v_apparent = IAS * Cooling_Factor;
829   double v_dot_cooling_air = arbitary_area * v_apparent;
830   double m_dot_cooling_air = v_dot_cooling_air * rho_air;
831   double dqdt_from_combustion =
832     m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.33;
833   double dqdt_forced = (h2 * m_dot_cooling_air * temperature_difference) +
834     (h3 * RPM * temperature_difference / MaxRPM);
835   double dqdt_free = h1 * temperature_difference * arbitary_area;
836   double dqdt_cylinder_head = dqdt_from_combustion + dqdt_forced + dqdt_free;
837
838   double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
839
840   CylinderHeadTemp_degK +=
841     (dqdt_cylinder_head / HeatCapacityCylinderHead) * TotalDeltaT;
842
843 }
844
845 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846 /**
847  * Calculate the oil temperature.
848  *
849  * Inputs: CylinderHeadTemp_degK, T_amb, OilPressure_psi.
850  *
851  * Outputs: OilTemp_degK
852  */
853
854 void FGPiston::doOilTemperature(void)
855 {
856   double target_oil_temp;        // Steady state oil temp at the current engine conditions
857   double time_constant;          // The time constant for the differential equation
858   double efficiency = 0.667;     // The aproximate oil cooling system efficiency // FIXME: may vary by engine
859
860 //  Target oil temp is interpolated between ambient temperature and Cylinder Head Tempurature
861 //  target_oil_temp = ( T_amb * efficiency ) + (CylinderHeadTemp_degK *(1-efficiency)) ;
862   target_oil_temp = CylinderHeadTemp_degK + efficiency * (T_amb - CylinderHeadTemp_degK) ;
863
864   if (OilPressure_psi > 5.0 ) {
865     time_constant = 5000 / OilPressure_psi; // Guess at a time constant for circulated oil.
866                                             // The higher the pressure the faster it reaches
867                                             // target temperature.  Oil pressure should be about
868                                             // 60 PSI yielding a TC of about 80.
869   } else {
870     time_constant = 1000;  // Time constant for engine-off; reflects the fact
871                            // that oil is no longer getting circulated
872   }
873
874   double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
875
876   OilTemp_degK += (dOilTempdt * TotalDeltaT);
877 }
878
879 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
880 /**
881  * Calculate the oil pressure.
882  *
883  * Inputs: RPM, MaxRPM, OilTemp_degK
884  *
885  * Outputs: OilPressure_psi
886  */
887
888 void FGPiston::doOilPressure(void)
889 {
890   double Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine
891   double Oil_Press_RPM_Max = MaxRPM * 0.75;    // 75% of max rpm FIXME: may vary by engine
892   double Design_Oil_Temp = 358;          // degK; FIXME: may vary by engine
893   double Oil_Viscosity_Index = 0.25;
894
895   OilPressure_psi = (Oil_Press_Relief_Valve / Oil_Press_RPM_Max) * RPM;
896
897   if (OilPressure_psi >= Oil_Press_Relief_Valve) {
898     OilPressure_psi = Oil_Press_Relief_Valve;
899   }
900
901   OilPressure_psi += (Design_Oil_Temp - OilTemp_degK) * Oil_Viscosity_Index * OilPressure_psi / Oil_Press_Relief_Valve;
902 }
903
904 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
905 //
906 // This is a local copy of the same function in FGStandardAtmosphere.
907
908 double FGPiston::GetStdPressure100K(double altitude) const
909 {
910   // Limit this equation to input altitudes of 100000 ft.
911   if (altitude > 100000.0) altitude = 100000.0;
912
913   double alt[5];
914   const double coef[5] = {  2116.217,
915                           -7.648932746E-2,
916                            1.0925498604E-6,
917                           -7.1135726027E-12,
918                            1.7470331356E-17 };
919
920   alt[0] = 1;
921   for (int pwr=1; pwr<=4; pwr++) alt[pwr] = alt[pwr-1]*altitude;
922
923   double press = 0.0;
924   for (int ctr=0; ctr<=4; ctr++) press += coef[ctr]*alt[ctr];
925   return press;
926 }
927
928 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
929
930 string FGPiston::GetEngineLabels(const string& delimiter)
931 {
932   std::ostringstream buf;
933
934   buf << Name << " Power Available (engine " << EngineNumber << " in ft-lbs/sec)" << delimiter
935       << Name << " HP (engine " << EngineNumber << ")" << delimiter
936       << Name << " equivalent ratio (engine " << EngineNumber << ")" << delimiter
937       << Name << " MAP (engine " << EngineNumber << " in inHg)" << delimiter
938       << Thruster->GetThrusterLabels(EngineNumber, delimiter);
939
940   return buf.str();
941 }
942
943 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
944
945 string FGPiston::GetEngineValues(const string& delimiter)
946 {
947   std::ostringstream buf;
948
949   buf << (HP * hptoftlbssec) << delimiter << HP << delimiter
950       << equivalence_ratio << delimiter << ManifoldPressure_inHg << delimiter
951       << Thruster->GetThrusterValues(EngineNumber, delimiter);
952
953   return buf.str();
954 }
955
956 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
957 //
958 //    The bitmasked value choices are as follows:
959 //    unset: In this case (the default) JSBSim would only print
960 //       out the normally expected messages, essentially echoing
961 //       the config files as they are read. If the environment
962 //       variable is not set, debug_lvl is set to 1 internally
963 //    0: This requests JSBSim not to output any messages
964 //       whatsoever.
965 //    1: This value explicity requests the normal JSBSim
966 //       startup messages
967 //    2: This value asks for a message to be printed out when
968 //       a class is instantiated
969 //    4: When this value is set, a message is displayed when a
970 //       FGModel object executes its Run() method
971 //    8: When this value is set, various runtime state variables
972 //       are printed out periodically
973 //    16: When set various parameters are sanity checked and
974 //       a message is printed out when they go out of bounds
975
976 void FGPiston::Debug(int from)
977 {
978   if (debug_lvl <= 0) return;
979
980   if (debug_lvl & 1) { // Standard console startup message output
981     if (from == 0) { // Constructor
982
983       cout << "\n    Engine Name: "         << Name << endl;
984       cout << "      MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
985       cout << "      MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
986       cout << "      MinMaP (Pa):         " << minMAP << endl;
987       cout << "      MaxMaP (Pa):         " << maxMAP << endl;
988       cout << "      Displacement: "        << Displacement             << endl;
989       cout << "      Bore: "                << Bore                     << endl;
990       cout << "      Stroke: "              << Stroke                   << endl;
991       cout << "      Cylinders: "           << Cylinders                << endl;
992       cout << "      Cylinders Head Mass: " <<CylinderHeadMass          << endl;
993       cout << "      Compression Ratio: "   << CompressionRatio         << endl;
994       cout << "      MaxHP: "               << MaxHP                    << endl;
995       cout << "      Cycles: "              << Cycles                   << endl;
996       cout << "      IdleRPM: "             << IdleRPM                  << endl;
997       cout << "      MaxRPM: "              << MaxRPM                   << endl;
998       cout << "      Throttle Constant: "   << Z_throttle               << endl;
999       cout << "      ISFC: "                << ISFC                     << endl;
1000       cout << "      Volumetric Efficiency: " << volumetric_efficiency    << endl;
1001       cout << "      PeakMeanPistonSpeed_fps: " << PeakMeanPistonSpeed_fps << endl;
1002       cout << "      Intake Impedance Factor: " << Z_airbox << endl;
1003       cout << "      Dynamic FMEP Factor: " << FMEPDynamic << endl;
1004       cout << "      Static FMEP Factor: " << FMEPStatic << endl;
1005
1006       cout << endl;
1007       cout << "      Combustion Efficiency table:" << endl;
1008       Lookup_Combustion_Efficiency->Print();
1009       cout << endl;
1010
1011       cout << endl;
1012       cout << "      Mixture Efficiency Correlation table:" << endl;
1013       Mixture_Efficiency_Correlation->Print();
1014       cout << endl;
1015
1016     }
1017   }
1018   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
1019     if (from == 0) cout << "Instantiated: FGPiston" << endl;
1020     if (from == 1) cout << "Destroyed:    FGPiston" << endl;
1021   }
1022   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
1023   }
1024   if (debug_lvl & 8 ) { // Runtime state variables
1025   }
1026   if (debug_lvl & 16) { // Sanity checking
1027   }
1028   if (debug_lvl & 64) {
1029     if (from == 0) { // Constructor
1030       cout << IdSrc << endl;
1031       cout << IdHdr << endl;
1032     }
1033   }
1034 }
1035 } // namespace JSBSim