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