]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGPiston.cpp
Latest JSBSim changes, including some gear tweaking from Jon and some
[flightgear.git] / src / FDM / JSBSim / FGPiston.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGPiston.cpp
4  Author:       Jon S. Berndt, JSBSim framework
5                Dave Luff, Piston engine model
6  Date started: 09/12/2000
7  Purpose:      This module models a Piston engine
8
9  ------------- Copyright (C) 2000  Jon S. Berndt (jsb@hal-pc.org) --------------
10
11  This program is free software; you can redistribute it and/or modify it under
12  the terms of the GNU General Public License as published by the Free Software
13  Foundation; either version 2 of the License, or (at your option) any later
14  version.
15
16  This program is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19  details.
20
21  You should have received a copy of the GNU General Public License along with
22  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23  Place - Suite 330, Boston, MA  02111-1307, USA.
24
25  Further information about the GNU General Public License can also be found on
26  the world wide web at http://www.gnu.org.
27
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30
31 This class descends from the FGEngine class and models a Piston engine based on
32 parameters given in the engine config file for this class
33
34 HISTORY
35 --------------------------------------------------------------------------------
36 09/12/2000  JSB  Created
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 INCLUDES
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41
42 #include "FGPiston.h"
43 #include "FGPropulsion.h"
44
45 static const char *IdSrc = "$Id$";
46 static const char *IdHdr = ID_PISTON;
47
48 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 CLASS IMPLEMENTATION
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
51
52 FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec),
53   CONVERT_CUBIC_INCHES_TO_METERS_CUBED(1.638706e-5),
54   R_air(287.3),
55   rho_fuel(800),                 // estimate
56   calorific_value_fuel(47.3e6),
57   Cp_air(1005),
58   Cp_fuel(1700)
59 {
60   string token;
61
62   MinManifoldPressure_inHg = 6.5;
63   MaxManifoldPressure_inHg = 28.5;
64   Displacement = 360;
65   MaxHP = 200;
66   Cycles = 2;
67   IdleRPM = 600;
68
69   Name = Eng_cfg->GetValue("NAME");
70   Eng_cfg->GetNextConfigLine();
71   while (Eng_cfg->GetValue() != string("/FG_PISTON")) {
72     *Eng_cfg >> token;
73     if      (token == "MINMP") *Eng_cfg >> MinManifoldPressure_inHg;
74     else if (token == "MAXMP") *Eng_cfg >> MaxManifoldPressure_inHg;
75     else if (token == "DISPLACEMENT") *Eng_cfg >> Displacement;
76     else if (token == "MAXHP") *Eng_cfg >> MaxHP;
77     else if (token == "CYCLES") *Eng_cfg >> Cycles;
78     else if (token == "IDLERPM") *Eng_cfg >> IdleRPM;
79     else if (token == "MAXTHROTTLE") *Eng_cfg >> MaxThrottle;
80     else if (token == "MINTHROTTLE") *Eng_cfg >> MinThrottle;
81     else cerr << "Unhandled token in Engine config file: " << token << endl;
82   }
83
84   Type = etPiston;
85   crank_counter = 0;
86   EngineNumber = 0;
87   OilTemp_degK = 298;
88   ManifoldPressure_inHg = Atmosphere->GetPressure() * 0.014138; // psf to in Hg
89
90   dt = State->Getdt();
91
92   // Initialisation
93   volumetric_efficiency = 0.8;  // Actually f(speed, load) but this will get us running
94
95   // First column is thi, second is neta (combustion efficiency)
96   Lookup_Combustion_Efficiency = new FGTable(12);
97   *Lookup_Combustion_Efficiency << 0.00 << 0.980;
98   *Lookup_Combustion_Efficiency << 0.90 << 0.980;
99   *Lookup_Combustion_Efficiency << 1.00 << 0.970;
100   *Lookup_Combustion_Efficiency << 1.05 << 0.950;
101   *Lookup_Combustion_Efficiency << 1.10 << 0.900;
102   *Lookup_Combustion_Efficiency << 1.15 << 0.850;
103   *Lookup_Combustion_Efficiency << 1.20 << 0.790;
104   *Lookup_Combustion_Efficiency << 1.30 << 0.700;
105   *Lookup_Combustion_Efficiency << 1.40 << 0.630;
106   *Lookup_Combustion_Efficiency << 1.50 << 0.570;
107   *Lookup_Combustion_Efficiency << 1.60 << 0.525;
108   *Lookup_Combustion_Efficiency << 2.00 << 0.345;
109
110   Power_Mixture_Correlation = new FGTable(13);
111   *Power_Mixture_Correlation << (14.7/1.6) << 78.0;
112   *Power_Mixture_Correlation << 10 <<  86.0;
113   *Power_Mixture_Correlation << 11 <<  93.5;
114   *Power_Mixture_Correlation << 12 <<  98.0;
115   *Power_Mixture_Correlation << 13 << 100.0;
116   *Power_Mixture_Correlation << 14 <<  99.0;
117   *Power_Mixture_Correlation << 15 <<  96.4;
118   *Power_Mixture_Correlation << 16 <<  92.5;
119   *Power_Mixture_Correlation << 17 <<  88.0;
120   *Power_Mixture_Correlation << 18 <<  83.0;
121   *Power_Mixture_Correlation << 19 <<  78.5;
122   *Power_Mixture_Correlation << 20 <<  74.0;
123   *Power_Mixture_Correlation << (14.7/0.6) << 58;
124
125   Debug(0); // Call Debug() routine from constructor if needed
126 }
127
128 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129
130 FGPiston::~FGPiston()
131 {
132   Debug(1); // Call Debug() routine from constructor if needed
133 }
134
135 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136
137 double FGPiston::Calculate(double PowerRequired)
138 {
139   // FIXME: calculate from actual fuel flow
140   ConsumeFuel();
141
142   Throttle = FCS->GetThrottlePos(EngineNumber);
143   Mixture = FCS->GetMixturePos(EngineNumber);
144
145   //
146   // Input values.
147   //
148
149   p_amb = Atmosphere->GetPressure() * 48;              // convert from lbs/ft2 to Pa
150   p_amb_sea_level = Atmosphere->GetPressureSL() * 48;
151   T_amb = Atmosphere->GetTemperature() * (5.0 / 9.0);  // convert from Rankine to Kelvin
152
153   RPM = Propulsion->GetThruster(EngineNumber)->GetRPM();
154   //if (RPM < IdleRPM) RPM = IdleRPM;  // kludge
155     
156   IAS = Auxiliary->GetVcalibratedKTS();
157
158   if (Mixture >= 0.3) {
159     doEngineStartup();
160     doManifoldPressure();
161     doAirFlow();
162     doFuelFlow();
163     doEnginePower();
164     doEGT();
165     doCHT();
166     doOilTemperature();
167     doOilPressure();
168   } else {
169     HP = 0;
170   }
171
172   PowerAvailable = (HP * hptoftlbssec) - PowerRequired;
173   return PowerAvailable;
174 }
175
176 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
177 /**
178  * Start or stop the engine.
179  */
180
181 void FGPiston::doEngineStartup(void)
182 {
183   // TODO: check magnetos, spark, starter, etc. and decide whether
184   // engine is running
185
186   // Check parameters that may alter the operating state of the engine. 
187   // (spark, fuel, starter motor etc)
188   bool spark;
189   bool fuel;
190
191   // Check for spark
192   Magneto_Left = false;
193   Magneto_Right = false;
194   // Magneto positions:
195   // 0 -> off
196   // 1 -> left only
197   // 2 -> right only
198   // 3 -> both
199   if (Magnetos != 0) {
200     spark = true;
201   } else {
202     spark = false;
203   }  // neglects battery voltage, master on switch, etc for now.
204   
205   if ((Magnetos == 1) || (Magnetos > 2)) Magneto_Left = true;
206   if (Magnetos > 1)  Magneto_Right = true;
207
208   // Assume we have fuel for now
209   fuel = true;
210
211   // Check if we are turning the starter motor
212   if (Cranking != Starter) {
213     // This check saves .../cranking from getting updated every loop - they
214     // only update when changed.
215     Cranking = Starter;
216     crank_counter = 0;
217   }
218
219   //Check mode of engine operation
220   // ACK - unfortunately this hack doesn't work in JSBSim since the RPM is reset
221   // each iteration by the propeller :-(
222   if (Cranking) {
223     crank_counter++;
224     if (RPM <= 480) {
225       RPM += 100;
226       if (RPM > 480)
227         RPM = 480;
228     } else {
229       // consider making a horrible noise if the starter is engaged with
230       // the engine running
231     }
232     // TODO - find a better guess at cranking speed
233   }
234   
235   // if ((!Running) && (spark) && (fuel) && (crank_counter > 120)) {
236
237   if ((!Running) && (spark) && (fuel)) {
238   // start the engine if revs high enough
239     if (RPM > 450) {
240       // For now just instantaneously start but later we should maybe crank for
241       // a bit
242       Running = true;
243       // RPM = 600;
244     }
245   }
246
247   if ( (Running) && ((!spark)||(!fuel)) ) {
248     // Cut the engine
249     // note that we only cut the power - the engine may continue to
250     // spin if the prop is in a moving airstream
251     Running = false;
252   }
253
254   // And finally a last check for stalling
255   if (Running) { 
256     //Check if we have stalled the engine
257     if (RPM == 0) {
258       Running = false;
259     } else if ((RPM <= 480) && (Cranking)) {
260       // Make sure the engine noise dosn't play if the engine won't
261             // start due to eg mixture lever pulled out.
262       Running = false;
263     }
264   }
265 }
266
267 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268
269 /**
270  * Calculate the nominal manifold pressure in inches hg
271  *
272  * This function calculates nominal manifold pressure directly
273  * from the throttle position, and does not adjust it for the
274  * difference between the pressure at sea level and the pressure
275  * at the current altitude (that adjustment takes place in
276  * {@link #doEnginePower}).
277  *
278  * TODO: changes in MP should not be instantaneous -- introduce
279  * a lag between throttle changes and MP changes, to allow pressure
280  * to build up or disperse.
281  *
282  * Inputs: MinManifoldPressure_inHg, MaxManifoldPressure_inHg, Throttle
283  *
284  * Outputs: ManifoldPressure_inHg
285  */
286
287 void FGPiston::doManifoldPressure(void)
288 {
289   if (Running || Cranking) {
290     ManifoldPressure_inHg = MinManifoldPressure_inHg +
291             (Throttle * (MaxManifoldPressure_inHg - MinManifoldPressure_inHg));
292   } else {
293     ManifoldPressure_inHg = Atmosphere->GetPressure() * 0.014138; // psf to in Hg
294   }  
295 }
296
297 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298 /**
299  * Calculate the air flow through the engine.
300  *
301  * At this point, ManifoldPressure_inHg still represents the sea-level
302  * MP, not adjusted for altitude.
303  *
304  * Inputs: p_amb, R_air, T_amb, ManifoldPressure_inHg, Displacement,
305  *   RPM, volumetric_efficiency
306  *
307  * Outputs: rho_air, m_dot_air
308  */
309
310 void FGPiston::doAirFlow(void)
311 {
312   rho_air = p_amb / (R_air * T_amb);
313   double rho_air_manifold = rho_air * ManifoldPressure_inHg / 29.6;
314   double displacement_SI = Displacement * CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
315   double swept_volume = (displacement_SI * (RPM/60)) / 2;
316   double v_dot_air = swept_volume * volumetric_efficiency;
317   m_dot_air = v_dot_air * rho_air_manifold;
318 }
319
320 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
321 /**
322  * Calculate the fuel flow into the engine.
323  *
324  * Inputs: Mixture, thi_sea_level, p_amb_sea_level, p_amb, m_dot_air
325  *
326  * Outputs: equivalence_ratio, m_dot_fuel
327  */
328
329 void FGPiston::doFuelFlow(void)
330 {
331   double thi_sea_level = 1.3 * Mixture;
332   equivalence_ratio = thi_sea_level * p_amb_sea_level / p_amb;
333   m_dot_fuel = m_dot_air / 14.7 * equivalence_ratio;
334   FuelFlow_gph = m_dot_fuel
335     * 3600                      // seconds to hours
336     * 2.2046                    // kg to lb
337     / 6.6;                      // lb to gal_us of kerosene
338 }
339
340 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341 /**
342  * Calculate the power produced by the engine.
343  *
344  * Currently, the JSBSim propellor model does not allow the
345  * engine to produce enough RPMs to get up to a high horsepower.
346  * When tested with sufficient RPM, it has no trouble reaching
347  * 200HP.
348  *
349  * Inputs: ManifoldPressure_inHg, p_amb, p_amb_sea_level, RPM, T_amb, 
350  *   equivalence_ratio, Cycles, MaxHP
351  *
352  * Outputs: Percentage_Power, HP
353  */
354
355 void FGPiston::doEnginePower(void)
356 {
357   ManifoldPressure_inHg *= p_amb / p_amb_sea_level;
358   double ManXRPM = ManifoldPressure_inHg * RPM;
359         // FIXME: this needs to be generalized
360   Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0;
361   double T_amb_degF = (T_amb * 1.8) - 459.67;
362   double T_amb_sea_lev_degF = (288 * 1.8) - 459.67; 
363   Percentage_Power =
364     Percentage_Power + ((T_amb_sea_lev_degF - T_amb_degF) * 7 /120);
365   double Percentage_of_best_power_mixture_power =
366     Power_Mixture_Correlation->GetValue(14.7 / equivalence_ratio);
367   Percentage_Power =
368     Percentage_Power * Percentage_of_best_power_mixture_power / 100.0;
369   if (Percentage_Power < 0.0)
370     Percentage_Power = 0.0;
371   else if (Percentage_Power > 100.0)
372     Percentage_Power = 100.0;
373   HP = Percentage_Power * MaxHP / 100.0;
374
375   //Hack
376   if (!Running) {
377     if (Cranking) {
378       if (RPM < 480) {
379         HP = 3.0 + ((480 - RPM) / 10.0);
380       } else {
381         HP = 3.0;
382       }
383     } else {
384       // Quick hack until we port the FMEP stuff
385       if (RPM > 0.0)
386         HP = -1.5;
387       else
388         HP = 0.0;
389     }
390   }
391 }
392
393 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 /**
395  * Calculate the exhaust gas temperature.
396  *
397  * Inputs: equivalence_ratio, m_dot_fuel, calorific_value_fuel, 
398  *   Cp_air, m_dot_air, Cp_fuel, m_dot_fuel, T_amb, Percentage_Power
399  *
400  * Outputs: combustion_efficiency, ExhaustGasTemp_degK
401  */
402
403 void FGPiston::doEGT(void)
404 {
405   double delta_T_exhaust;
406   double enthalpy_exhaust;
407   double heat_capacity_exhaust;
408   double dEGTdt;
409
410   if ((Running) && (m_dot_air > 0.0)) {  // do the energy balance
411     combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio);
412     enthalpy_exhaust = m_dot_fuel * calorific_value_fuel * 
413                               combustion_efficiency * 0.33;
414     heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
415     delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
416     ExhaustGasTemp_degK = T_amb + delta_T_exhaust;
417     ExhaustGasTemp_degK *= 0.444 + ((0.544 - 0.444) * Percentage_Power / 100.0);
418   } else {  // Drop towards ambient - guess an appropriate time constant for now
419     dEGTdt = (298.0 - ExhaustGasTemp_degK) / 100.0;
420     delta_T_exhaust = dEGTdt * dt;
421     ExhaustGasTemp_degK += delta_T_exhaust;
422   }
423 }
424
425 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426 /**
427  * Calculate the cylinder head temperature.
428  *
429  * Inputs: T_amb, IAS, rho_air, m_dot_fuel, calorific_value_fuel,
430  *   combustion_efficiency, RPM
431  *
432  * Outputs: CylinderHeadTemp_degK
433  */
434
435 void FGPiston::doCHT(void)
436 {
437   double h1 = -95.0;
438   double h2 = -3.95;
439   double h3 = -0.05;
440
441   double arbitary_area = 1.0;
442   double CpCylinderHead = 800.0;
443   double MassCylinderHead = 8.0;
444
445   double temperature_difference = CylinderHeadTemp_degK - T_amb;
446   double v_apparent = IAS * 0.5144444;
447   double v_dot_cooling_air = arbitary_area * v_apparent;
448   double m_dot_cooling_air = v_dot_cooling_air * rho_air;
449   double dqdt_from_combustion = 
450     m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.33;
451   double dqdt_forced = (h2 * m_dot_cooling_air * temperature_difference) + 
452     (h3 * RPM * temperature_difference);
453   double dqdt_free = h1 * temperature_difference;
454   double dqdt_cylinder_head = dqdt_from_combustion + dqdt_forced + dqdt_free;
455     
456   double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
457     
458   CylinderHeadTemp_degK = dqdt_cylinder_head / HeatCapacityCylinderHead;
459 }
460
461 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462 /**
463  * Calculate the oil temperature.
464  *
465  * Inputs: Percentage_Power, running flag.
466  *
467  * Outputs: OilTemp_degK
468  */
469
470 void FGPiston::doOilTemperature(void)
471 {
472   double idle_percentage_power = 2.3;        // approximately
473   double target_oil_temp;        // Steady state oil temp at the current engine conditions
474   double time_constant;          // The time constant for the differential equation
475
476   if (Running) {
477     target_oil_temp = 363;
478     time_constant = 500;        // Time constant for engine-on idling.
479     if (Percentage_Power > idle_percentage_power) {
480       time_constant /= ((Percentage_Power / idle_percentage_power) / 10.0); // adjust for power 
481     }
482   } else {
483     target_oil_temp = 298;
484     time_constant = 1000;  // Time constant for engine-off; reflects the fact
485                            // that oil is no longer getting circulated
486   }
487
488   double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
489
490   OilTemp_degK += (dOilTempdt * dt);
491 }
492
493 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
494 /**
495  * Calculate the oil pressure.
496  *
497  * Inputs: RPM
498  *
499  * Outputs: OilPressure_psi
500  */
501
502 void FGPiston::doOilPressure(void)
503 {
504   double Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine
505   double Oil_Press_RPM_Max = 1800;    // FIXME: may vary by engine
506   double Design_Oil_Temp = 85;        // FIXME: may vary by engine
507              // FIXME: WRONG!!! (85 degK???)
508   double Oil_Viscosity_Index = 0.25;
509
510   OilPressure_psi = (Oil_Press_Relief_Valve / Oil_Press_RPM_Max) * RPM;
511
512   if (OilPressure_psi >= Oil_Press_Relief_Valve) {
513     OilPressure_psi = Oil_Press_Relief_Valve;
514   }
515
516   OilPressure_psi += (Design_Oil_Temp - OilTemp_degK) * Oil_Viscosity_Index;
517 }
518
519 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520 //
521 //    The bitmasked value choices are as follows:
522 //    unset: In this case (the default) JSBSim would only print
523 //       out the normally expected messages, essentially echoing
524 //       the config files as they are read. If the environment
525 //       variable is not set, debug_lvl is set to 1 internally
526 //    0: This requests JSBSim not to output any messages
527 //       whatsoever.
528 //    1: This value explicity requests the normal JSBSim
529 //       startup messages
530 //    2: This value asks for a message to be printed out when
531 //       a class is instantiated
532 //    4: When this value is set, a message is displayed when a
533 //       FGModel object executes its Run() method
534 //    8: When this value is set, various runtime state variables
535 //       are printed out periodically
536 //    16: When set various parameters are sanity checked and
537 //       a message is printed out when they go out of bounds
538
539 void FGPiston::Debug(int from)
540 {
541   if (debug_lvl <= 0) return;
542
543   if (debug_lvl & 1) { // Standard console startup message output
544     if (from == 0) { // Constructor
545
546       cout << "\n    Engine Name: "         << Name << endl;
547       cout << "      MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
548       cout << "      MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
549       cout << "      Displacement: "        << Displacement             << endl;
550       cout << "      MaxHP: "               << MaxHP                    << endl;
551       cout << "      Cycles: "              << Cycles                   << endl;
552       cout << "      IdleRPM: "             << IdleRPM                  << endl;
553       cout << "      MaxThrottle: "         << MaxThrottle              << endl;
554       cout << "      MinThrottle: "         << MinThrottle              << endl;
555
556       cout << endl;
557       cout << "      Combustion Efficiency table:" << endl;
558       Lookup_Combustion_Efficiency->Print();
559       cout << endl;
560
561       cout << endl;
562       cout << "      Power Mixture Correlation table:" << endl;
563       Power_Mixture_Correlation->Print();
564       cout << endl;
565
566     }
567   }
568   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
569     if (from == 0) cout << "Instantiated: FGPiston" << endl;
570     if (from == 1) cout << "Destroyed:    FGPiston" << endl;
571   }
572   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
573   }
574   if (debug_lvl & 8 ) { // Runtime state variables
575   }
576   if (debug_lvl & 16) { // Sanity checking
577   }
578   if (debug_lvl & 64) {
579     if (from == 0) { // Constructor
580       cout << IdSrc << endl;
581       cout << IdHdr << endl;
582     }
583   }
584 }
585
586 double
587 FGPiston::CalcFuelNeed(void)
588 {
589                                 // FIXME: is this right?
590   return FuelFlow_gph * State->Getdt() * Propulsion->GetRate();
591 }