]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGPiston.cpp
JSBSim change from Dave Luff:
[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   ConsumeFuel();
140
141   Throttle = FCS->GetThrottlePos(EngineNumber);
142   Mixture = FCS->GetMixturePos(EngineNumber);
143
144   //
145   // Input values.
146   //
147
148   p_amb = Atmosphere->GetPressure() * 48;              // convert from lbs/ft2 to Pa
149   p_amb_sea_level = Atmosphere->GetPressureSL() * 48;
150   T_amb = Atmosphere->GetTemperature() * (5.0 / 9.0);  // convert from Rankine to Kelvin
151
152   RPM = Propulsion->GetThruster(EngineNumber)->GetRPM();
153   //if (RPM < IdleRPM) RPM = IdleRPM;  // kludge
154     
155   IAS = Auxiliary->GetVcalibratedKTS();
156
157   if (Mixture >= 0.3) {
158     doEngineStartup();
159     doManifoldPressure();
160     doAirFlow();
161     doFuelFlow();
162     doEnginePower();
163     doEGT();
164     doCHT();
165     doOilTemperature();
166     doOilPressure();
167   } else {
168     HP = 0;
169   }
170
171   PowerAvailable = (HP * hptoftlbssec) - PowerRequired;
172   return PowerAvailable;
173 }
174
175 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
176 /**
177  * Start or stop the engine.
178  */
179
180 void FGPiston::doEngineStartup(void)
181 {
182   // Check parameters that may alter the operating state of the engine. 
183   // (spark, fuel, starter motor etc)
184   bool spark;
185   bool fuel;
186
187   // Check for spark
188   Magneto_Left = false;
189   Magneto_Right = false;
190   // Magneto positions:
191   // 0 -> off
192   // 1 -> left only
193   // 2 -> right only
194   // 3 -> both
195   if (Magnetos != 0) {
196     spark = true;
197   } else {
198     spark = false;
199   }  // neglects battery voltage, master on switch, etc for now.
200   
201   if ((Magnetos == 1) || (Magnetos > 2)) Magneto_Left = true;
202   if (Magnetos > 1)  Magneto_Right = true;
203
204   // Assume we have fuel for now
205   fuel = !Starved;
206
207   // Check if we are turning the starter motor
208   if (Cranking != Starter) {
209     // This check saves .../cranking from getting updated every loop - they
210     // only update when changed.
211     Cranking = Starter;
212     crank_counter = 0;
213   }
214
215   //Check mode of engine operation
216   if (Cranking) {
217     crank_counter++;
218     if (RPM <= 480) {
219       // Do nothing !! - cranking power output is now handled in the doPower section
220     } else {
221       // consider making a horrible noise if the starter is engaged with
222       // the engine running
223     }
224   }
225   
226   // if ((!Running) && (spark) && (fuel) && (crank_counter > 120)) {
227
228   if ((!Running) && (spark) && (fuel)) {
229   // start the engine if revs high enough
230     if ((RPM > 450) && (crank_counter > 175)) {
231       // For now just instantaneously start but later we should maybe crank for
232       // a bit
233       Running = true;
234       // RPM = 600;
235     }
236   }
237
238   if ( (Running) && ((!spark)||(!fuel)) ) {
239     // Cut the engine
240     // note that we only cut the power - the engine may continue to
241     // spin if the prop is in a moving airstream
242     Running = false;
243   }
244
245   // And finally a last check for stalling
246   if (Running) { 
247     //Check if we have stalled the engine
248     if (RPM == 0) {
249       Running = false;
250     } else if ((RPM <= 480) && (Cranking)) {
251       // Make sure the engine noise dosn't play if the engine won't
252             // start due to eg mixture lever pulled out.
253       Running = false;
254     }
255   }
256 }
257
258 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259
260 /**
261  * Calculate the nominal manifold pressure in inches hg
262  *
263  * This function calculates nominal manifold pressure directly
264  * from the throttle position, and does not adjust it for the
265  * difference between the pressure at sea level and the pressure
266  * at the current altitude (that adjustment takes place in
267  * {@link #doEnginePower}).
268  *
269  * TODO: changes in MP should not be instantaneous -- introduce
270  * a lag between throttle changes and MP changes, to allow pressure
271  * to build up or disperse.
272  *
273  * Inputs: MinManifoldPressure_inHg, MaxManifoldPressure_inHg, Throttle
274  *
275  * Outputs: ManifoldPressure_inHg
276  */
277
278 void FGPiston::doManifoldPressure(void)
279 {
280   if (Running || Cranking) {
281     ManifoldPressure_inHg = MinManifoldPressure_inHg +
282             (Throttle * (MaxManifoldPressure_inHg - MinManifoldPressure_inHg));
283   } else {
284     ManifoldPressure_inHg = Atmosphere->GetPressure() * 0.014138; // psf to in Hg
285   }  
286 }
287
288 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289 /**
290  * Calculate the air flow through the engine.
291  *
292  * At this point, ManifoldPressure_inHg still represents the sea-level
293  * MP, not adjusted for altitude.
294  *
295  * Inputs: p_amb, R_air, T_amb, ManifoldPressure_inHg, Displacement,
296  *   RPM, volumetric_efficiency
297  *
298  * Outputs: rho_air, m_dot_air
299  */
300
301 void FGPiston::doAirFlow(void)
302 {
303   rho_air = p_amb / (R_air * T_amb);
304   double rho_air_manifold = rho_air * ManifoldPressure_inHg / 29.6;
305   double displacement_SI = Displacement * CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
306   double swept_volume = (displacement_SI * (RPM/60)) / 2;
307   double v_dot_air = swept_volume * volumetric_efficiency;
308   m_dot_air = v_dot_air * rho_air_manifold;
309 }
310
311 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312 /**
313  * Calculate the fuel flow into the engine.
314  *
315  * Inputs: Mixture, thi_sea_level, p_amb_sea_level, p_amb, m_dot_air
316  *
317  * Outputs: equivalence_ratio, m_dot_fuel
318  */
319
320 void FGPiston::doFuelFlow(void)
321 {
322   double thi_sea_level = 1.3 * Mixture;
323   equivalence_ratio = thi_sea_level * p_amb_sea_level / p_amb;
324   m_dot_fuel = m_dot_air / 14.7 * equivalence_ratio;
325   FuelFlow_gph = m_dot_fuel
326     * 3600                      // seconds to hours
327     * 2.2046                    // kg to lb
328     / 6.6;                      // lb to gal_us of kerosene
329 }
330
331 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332 /**
333  * Calculate the power produced by the engine.
334  *
335  * Currently, the JSBSim propellor model does not allow the
336  * engine to produce enough RPMs to get up to a high horsepower.
337  * When tested with sufficient RPM, it has no trouble reaching
338  * 200HP.
339  *
340  * Inputs: ManifoldPressure_inHg, p_amb, p_amb_sea_level, RPM, T_amb, 
341  *   equivalence_ratio, Cycles, MaxHP
342  *
343  * Outputs: Percentage_Power, HP
344  */
345
346 void FGPiston::doEnginePower(void)
347 {
348   ManifoldPressure_inHg *= p_amb / p_amb_sea_level;
349   if(Running) { 
350     double ManXRPM = ManifoldPressure_inHg * RPM;
351         // FIXME: this needs to be generalized
352     Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0;
353     double T_amb_degF = (T_amb * 1.8) - 459.67;
354     double T_amb_sea_lev_degF = (288 * 1.8) - 459.67; 
355     Percentage_Power =
356       Percentage_Power + ((T_amb_sea_lev_degF - T_amb_degF) * 7 /120);
357     double Percentage_of_best_power_mixture_power =
358       Power_Mixture_Correlation->GetValue(14.7 / equivalence_ratio);
359     Percentage_Power =
360       Percentage_Power * Percentage_of_best_power_mixture_power / 100.0;
361     if (Percentage_Power < 0.0)
362       Percentage_Power = 0.0;
363     else if (Percentage_Power > 100.0)
364       Percentage_Power = 100.0;
365     HP = Percentage_Power * MaxHP / 100.0;
366   } else {  
367     // Power output when the engine is not running
368     if (Cranking) {
369       if (RPM < 10) {
370         HP = 3.0;       // This is a hack to prevent overshooting the idle rpm in the first time step
371                     // It may possibly need to be changed if the prop model is changed.
372       } else if (RPM < 480) {
373         HP = 3.0 + ((480 - RPM) / 10.0);  
374         // This is a guess - would be nice to find a proper starter moter torque curve
375       } else {
376         HP = 3.0;
377       }
378     } else {
379       // Quick hack until we port the FMEP stuff
380       if (RPM > 0.0)
381         HP = -1.5;
382       else
383         HP = 0.0;
384     }
385   }
386 }
387
388 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
389 /**
390  * Calculate the exhaust gas temperature.
391  *
392  * Inputs: equivalence_ratio, m_dot_fuel, calorific_value_fuel, 
393  *   Cp_air, m_dot_air, Cp_fuel, m_dot_fuel, T_amb, Percentage_Power
394  *
395  * Outputs: combustion_efficiency, ExhaustGasTemp_degK
396  */
397
398 void FGPiston::doEGT(void)
399 {
400   double delta_T_exhaust;
401   double enthalpy_exhaust;
402   double heat_capacity_exhaust;
403   double dEGTdt;
404
405   if ((Running) && (m_dot_air > 0.0)) {  // do the energy balance
406     combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio);
407     enthalpy_exhaust = m_dot_fuel * calorific_value_fuel * 
408                               combustion_efficiency * 0.33;
409     heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
410     delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
411     ExhaustGasTemp_degK = T_amb + delta_T_exhaust;
412     ExhaustGasTemp_degK *= 0.444 + ((0.544 - 0.444) * Percentage_Power / 100.0);
413   } else {  // Drop towards ambient - guess an appropriate time constant for now
414     dEGTdt = (298.0 - ExhaustGasTemp_degK) / 100.0;
415     delta_T_exhaust = dEGTdt * dt;
416     ExhaustGasTemp_degK += delta_T_exhaust;
417   }
418 }
419
420 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421 /**
422  * Calculate the cylinder head temperature.
423  *
424  * Inputs: T_amb, IAS, rho_air, m_dot_fuel, calorific_value_fuel,
425  *   combustion_efficiency, RPM
426  *
427  * Outputs: CylinderHeadTemp_degK
428  */
429
430 void FGPiston::doCHT(void)
431 {
432   double h1 = -95.0;
433   double h2 = -3.95;
434   double h3 = -0.05;
435
436   double arbitary_area = 1.0;
437   double CpCylinderHead = 800.0;
438   double MassCylinderHead = 8.0;
439
440   double temperature_difference = CylinderHeadTemp_degK - T_amb;
441   double v_apparent = IAS * 0.5144444;
442   double v_dot_cooling_air = arbitary_area * v_apparent;
443   double m_dot_cooling_air = v_dot_cooling_air * rho_air;
444   double dqdt_from_combustion = 
445     m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.33;
446   double dqdt_forced = (h2 * m_dot_cooling_air * temperature_difference) + 
447     (h3 * RPM * temperature_difference);
448   double dqdt_free = h1 * temperature_difference;
449   double dqdt_cylinder_head = dqdt_from_combustion + dqdt_forced + dqdt_free;
450     
451   double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
452     
453   CylinderHeadTemp_degK = dqdt_cylinder_head / HeatCapacityCylinderHead;
454 }
455
456 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457 /**
458  * Calculate the oil temperature.
459  *
460  * Inputs: Percentage_Power, running flag.
461  *
462  * Outputs: OilTemp_degK
463  */
464
465 void FGPiston::doOilTemperature(void)
466 {
467   double idle_percentage_power = 2.3;        // approximately
468   double target_oil_temp;        // Steady state oil temp at the current engine conditions
469   double time_constant;          // The time constant for the differential equation
470
471   if (Running) {
472     target_oil_temp = 363;
473     time_constant = 500;        // Time constant for engine-on idling.
474     if (Percentage_Power > idle_percentage_power) {
475       time_constant /= ((Percentage_Power / idle_percentage_power) / 10.0); // adjust for power 
476     }
477   } else {
478     target_oil_temp = 298;
479     time_constant = 1000;  // Time constant for engine-off; reflects the fact
480                            // that oil is no longer getting circulated
481   }
482
483   double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
484
485   OilTemp_degK += (dOilTempdt * dt);
486 }
487
488 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489 /**
490  * Calculate the oil pressure.
491  *
492  * Inputs: RPM
493  *
494  * Outputs: OilPressure_psi
495  */
496
497 void FGPiston::doOilPressure(void)
498 {
499   double Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine
500   double Oil_Press_RPM_Max = 1800;    // FIXME: may vary by engine
501   double Design_Oil_Temp = 85;        // FIXME: may vary by engine
502              // FIXME: WRONG!!! (85 degK???)
503   double Oil_Viscosity_Index = 0.25;
504
505   OilPressure_psi = (Oil_Press_Relief_Valve / Oil_Press_RPM_Max) * RPM;
506
507   if (OilPressure_psi >= Oil_Press_Relief_Valve) {
508     OilPressure_psi = Oil_Press_Relief_Valve;
509   }
510
511   OilPressure_psi += (Design_Oil_Temp - OilTemp_degK) * Oil_Viscosity_Index;
512 }
513
514 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
515 //
516 //    The bitmasked value choices are as follows:
517 //    unset: In this case (the default) JSBSim would only print
518 //       out the normally expected messages, essentially echoing
519 //       the config files as they are read. If the environment
520 //       variable is not set, debug_lvl is set to 1 internally
521 //    0: This requests JSBSim not to output any messages
522 //       whatsoever.
523 //    1: This value explicity requests the normal JSBSim
524 //       startup messages
525 //    2: This value asks for a message to be printed out when
526 //       a class is instantiated
527 //    4: When this value is set, a message is displayed when a
528 //       FGModel object executes its Run() method
529 //    8: When this value is set, various runtime state variables
530 //       are printed out periodically
531 //    16: When set various parameters are sanity checked and
532 //       a message is printed out when they go out of bounds
533
534 void FGPiston::Debug(int from)
535 {
536   if (debug_lvl <= 0) return;
537
538   if (debug_lvl & 1) { // Standard console startup message output
539     if (from == 0) { // Constructor
540
541       cout << "\n    Engine Name: "         << Name << endl;
542       cout << "      MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
543       cout << "      MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
544       cout << "      Displacement: "        << Displacement             << endl;
545       cout << "      MaxHP: "               << MaxHP                    << endl;
546       cout << "      Cycles: "              << Cycles                   << endl;
547       cout << "      IdleRPM: "             << IdleRPM                  << endl;
548       cout << "      MaxThrottle: "         << MaxThrottle              << endl;
549       cout << "      MinThrottle: "         << MinThrottle              << endl;
550
551       cout << endl;
552       cout << "      Combustion Efficiency table:" << endl;
553       Lookup_Combustion_Efficiency->Print();
554       cout << endl;
555
556       cout << endl;
557       cout << "      Power Mixture Correlation table:" << endl;
558       Power_Mixture_Correlation->Print();
559       cout << endl;
560
561     }
562   }
563   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
564     if (from == 0) cout << "Instantiated: FGPiston" << endl;
565     if (from == 1) cout << "Destroyed:    FGPiston" << endl;
566   }
567   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
568   }
569   if (debug_lvl & 8 ) { // Runtime state variables
570   }
571   if (debug_lvl & 16) { // Sanity checking
572   }
573   if (debug_lvl & 64) {
574     if (from == 0) { // Constructor
575       cout << IdSrc << endl;
576       cout << IdHdr << endl;
577     }
578   }
579 }
580
581 double
582 FGPiston::CalcFuelNeed(void)
583 {
584   return FuelFlow_gph / 3600 * State->Getdt() * Propulsion->GetRate();
585 }