]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/propulsion/FGTurbine.cpp
Merge branch 'next' into durk-atc
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTurbine.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGTurbine.cpp
4  Author:       David Culp
5  Date started: 03/11/2003
6  Purpose:      This module models a turbine engine.
7
8  ------------- Copyright (C) 2003  David Culp (davidculp2@comcast.net) ---------
9
10  This program is free software; you can redistribute it and/or modify it under
11  the terms of the GNU Lesser General Public License as published by the Free Software
12  Foundation; either version 2 of the License, or (at your option) any later
13  version.
14
15  This program is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
18  details.
19
20  You should have received a copy of the GNU Lesser General Public License along with
21  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  Place - Suite 330, Boston, MA  02111-1307, USA.
23
24  Further information about the GNU Lesser General Public License can also be found on
25  the world wide web at http://www.gnu.org.
26
27 FUNCTIONAL DESCRIPTION
28 --------------------------------------------------------------------------------
29
30 This class descends from the FGEngine class and models a turbine engine based
31 on parameters given in the engine config file for this class
32
33 HISTORY
34 --------------------------------------------------------------------------------
35 03/11/2003  DPC  Created
36 09/08/2003  DPC  Changed Calculate() and added engine phases
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 INCLUDES
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41
42 #include <iostream>
43 #include <sstream>
44 #include "FGTurbine.h"
45 #include "FGThruster.h"
46 #include "models/FGPropulsion.h"
47 #include "models/FGAuxiliary.h"
48 #include "models/FGAtmosphere.h"
49
50 using namespace std;
51
52 namespace JSBSim {
53
54 static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.31 2011/03/03 12:16:26 jberndt Exp $";
55 static const char *IdHdr = ID_TURBINE;
56
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 CLASS IMPLEMENTATION
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60
61
62 FGTurbine::FGTurbine(FGFDMExec* exec, Element *el, int engine_number)
63   : FGEngine(exec, el, engine_number)
64 {
65   Type = etTurbine;
66
67   MilThrust = MaxThrust = 10000.0;
68   TSFC = 0.8;
69   ATSFC = 1.7;
70   IdleN1 = 30.0;
71   IdleN2 = 60.0;
72   MaxN1 = MaxN2 = 100.0;
73   Augmented = AugMethod = Injected = 0;
74   BypassRatio = BleedDemand = 0.0;
75   IdleThrustLookup = MilThrustLookup = MaxThrustLookup = InjectionLookup = 0;
76   N1_spinup = 1.0; N2_spinup = 3.0; 
77   EPR = 1.0;
78
79   ResetToIC();
80
81   Load(exec, el);
82   Debug(0);
83 }
84
85 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86
87 FGTurbine::~FGTurbine()
88 {
89   delete IdleThrustLookup;
90   delete MilThrustLookup;
91   delete MaxThrustLookup;
92   delete InjectionLookup;
93   Debug(1);
94 }
95
96 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97
98 void FGTurbine::ResetToIC(void)
99 {
100     
101   FGEngine::ResetToIC();
102     
103   N1 = N2 = 0.0;
104   N2norm = 0.0;
105   correctedTSFC = TSFC;
106   ThrottlePos = AugmentCmd = 0.0;
107   InletPosition = NozzlePosition = 1.0;
108   Stalled = Seized = Overtemp = Fire = Augmentation = Injection = Reversed = false;
109   Cutoff = true;
110   phase = tpOff;
111   TAT = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556;
112   EGT_degC = TAT;
113   OilTemp_degK = TAT + 273.0;
114 }
115
116 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 // The main purpose of Calculate() is to determine what phase the engine should
118 // be in, then call the corresponding function.
119
120 void FGTurbine::Calculate(void)
121 {
122   double thrust;
123
124   RunPreFunctions();
125
126   TAT = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556;
127   double qbar = Auxiliary->Getqbar();
128   dt = FDMExec->GetDeltaT() * Propulsion->GetRate();
129   ThrottlePos = FCS->GetThrottlePos(EngineNumber);
130   if (ThrottlePos > 1.0) {
131     AugmentCmd = ThrottlePos - 1.0;
132     ThrottlePos -= AugmentCmd;
133   } else {
134     AugmentCmd = 0.0;
135   }
136
137   // When trimming is finished check if user wants engine OFF or RUNNING
138   if ((phase == tpTrim) && (dt > 0)) {
139     if (Running && !Starved) {
140       phase = tpRun;
141       N2 = IdleN2 + ThrottlePos * N2_factor;
142       N1 = IdleN1 + ThrottlePos * N1_factor;
143       OilTemp_degK = 366.0;
144       Cutoff = false;
145       }
146     else {
147       phase = tpOff;
148       Cutoff = true;
149       EGT_degC = TAT;
150       }
151     }
152
153   if (!Running && Cutoff && Starter) {
154      if (phase == tpOff) phase = tpSpinUp;
155   }
156
157   // start
158   if ((Starter == true) || (qbar > 30.0)) {
159     if (!Running && !Cutoff && (N2 > 15.0)) phase = tpStart;
160   }
161
162   if (Cutoff && (phase != tpSpinUp)) phase = tpOff;
163   if (dt == 0) phase = tpTrim;
164   if (Starved) phase = tpOff;
165   if (Stalled) phase = tpStall;
166   if (Seized) phase = tpSeize;
167
168   switch (phase) {
169     case tpOff:    thrust = Off(); break;
170     case tpRun:    thrust = Run(); break;
171     case tpSpinUp: thrust = SpinUp(); break;
172     case tpStart:  thrust = Start(); break;
173     case tpStall:  thrust = Stall(); break;
174     case tpSeize:  thrust = Seize(); break;
175     case tpTrim:   thrust = Trim(); break;
176     default: thrust = Off();
177   }
178
179   Thruster->Calculate(thrust); // allow thruster to modify thrust (i.e. reversing)
180
181   RunPostFunctions();
182 }
183
184 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185
186 double FGTurbine::Off(void)
187 {
188   double qbar = Auxiliary->Getqbar();
189   Running = false;
190   FuelFlow_pph = Seek(&FuelFlow_pph, 0, 1000.0, 10000.0);
191   N1 = Seek(&N1, qbar/10.0, N1/2.0, N1/2.0);
192   N2 = Seek(&N2, qbar/15.0, N2/2.0, N2/2.0);
193   EGT_degC = Seek(&EGT_degC, TAT, 11.7, 7.3);
194   OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
195   OilPressure_psi = N2 * 0.62;
196   NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
197   EPR = Seek(&EPR, 1.0, 0.2, 0.2);
198   Augmentation = false;
199   ConsumeFuel();  
200   return 0.0;
201 }
202
203 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204
205 double FGTurbine::Run()
206 {
207   double idlethrust, milthrust, thrust;
208   double spoolup;                        // acceleration in pct/sec
209   double sigma = Atmosphere->GetDensityRatio();
210   double T = Atmosphere->GetTemperature();
211
212   idlethrust = MilThrust * IdleThrustLookup->GetValue();
213   milthrust = (MilThrust - idlethrust) * MilThrustLookup->GetValue();
214
215   Running = true;
216   Starter = false;
217
218   // adjust acceleration for N2 and atmospheric density
219   double n = N2norm + 0.1;
220   if (n > 1) n = 1; 
221   spoolup = delay / (1 + 3 * (1-n)*(1-n)*(1-n) + (1 - sigma));
222   
223   N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, spoolup, spoolup * 3.0);
224   N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, spoolup, spoolup * 2.4);
225   N2norm = (N2 - IdleN2) / N2_factor;
226   thrust = idlethrust + (milthrust * N2norm * N2norm);
227   EGT_degC = TAT + 363.1 + ThrottlePos * 357.1;
228   OilPressure_psi = N2 * 0.62;
229   OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
230
231   if (!Augmentation) {
232     correctedTSFC = TSFC * sqrt(T/389.7) * (0.84 + (1-N2norm)*(1-N2norm));
233     FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 10000.0);
234     if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
235     NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
236     thrust = thrust * (1.0 - BleedDemand);
237     EPR = 1.0 + thrust/MilThrust;
238   }
239
240   if (AugMethod == 1) {
241     if ((ThrottlePos > 0.99) && (N2 > 97.0)) {Augmentation = true;}
242     else {Augmentation = false;}
243   }
244
245   if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
246     thrust = MaxThrustLookup->GetValue() * MaxThrust;
247     FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
248     NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
249   }
250
251   if (AugMethod == 2) {
252     if (AugmentCmd > 0.0) {
253       Augmentation = true;
254       double tdiff = (MaxThrust * MaxThrustLookup->GetValue()) - thrust;
255       thrust += (tdiff * AugmentCmd);
256       FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
257       NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
258     } else {
259       Augmentation = false;
260     }
261   }
262
263   if ((Injected == 1) && Injection) {
264     InjectionTimer += dt;
265     if (InjectionTimer < InjectionTime) {
266        thrust = thrust * InjectionLookup->GetValue();
267     } else {
268        Injection = false;
269     }
270   }
271
272   ConsumeFuel();
273   if (Cutoff) phase = tpOff;
274   if (Starved) phase = tpOff;
275
276   return thrust;
277 }
278
279 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
280
281 double FGTurbine::SpinUp(void)
282 {
283   Running = false;
284   FuelFlow_pph = 0.0;
285   N2 = Seek(&N2, 25.18, N2_spinup, N2/2.0);
286   N1 = Seek(&N1, 5.21, N1_spinup, N1/2.0);
287   EGT_degC = Seek(&EGT_degC, TAT, 11.7, 7.3);
288   OilPressure_psi = N2 * 0.62;
289   OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
290   EPR = 1.0;
291   NozzlePosition = 1.0;
292   if (Starter == false) phase = tpOff;
293   return 0.0;
294 }
295
296 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297
298 double FGTurbine::Start(void)
299 {
300   double qbar = Auxiliary->Getqbar();
301   if ((N2 > 15.0) && !Starved) {       // minimum 15% N2 needed for start
302     Cranking = true;                   // provided for sound effects signal
303     if (N2 < IdleN2) {
304       N2 = Seek(&N2, IdleN2, 2.0, N2/2.0);
305       N1 = Seek(&N1, IdleN1, 1.4, N1/2.0);
306       EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
307       FuelFlow_pph = IdleFF * N2 / IdleN2;
308       OilPressure_psi = N2 * 0.62;
309       ConsumeFuel();
310       if ((Starter == false) && (qbar < 30.0)) phase = tpOff; // aborted start
311       }
312     else {
313       phase = tpRun;
314       Running = true;
315       Starter = false;
316       Cranking = false;
317       }
318     }
319   else {                 // no start if N2 < 15%
320     phase = tpOff;
321     Starter = false;
322     }
323
324   return 0.0;
325 }
326
327 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328
329 double FGTurbine::Stall(void)
330 {
331   double qbar = Auxiliary->Getqbar();
332   EGT_degC = TAT + 903.14;
333   FuelFlow_pph = IdleFF;
334   N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
335   N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
336   ConsumeFuel();
337   if (ThrottlePos < 0.01) {
338     phase = tpRun;               // clear the stall with throttle to idle
339     Stalled = false;
340     }
341   return 0.0;
342 }
343
344 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345
346 double FGTurbine::Seize(void)
347 {
348     double qbar = Auxiliary->Getqbar();
349     N2 = 0.0;
350     N1 = Seek(&N1, qbar/20.0, 0, N1/15.0);
351     FuelFlow_pph = Cutoff ? 0.0 : IdleFF;
352     ConsumeFuel();
353     OilPressure_psi = 0.0;
354     OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0, 0.2);
355     Running = false;
356     return 0.0;
357 }
358
359 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
360
361 double FGTurbine::Trim()
362 {
363     double idlethrust, milthrust, thrust, tdiff;
364     idlethrust = MilThrust * IdleThrustLookup->GetValue();
365     milthrust = (MilThrust - idlethrust) * MilThrustLookup->GetValue();
366     N2 = IdleN2 + ThrottlePos * N2_factor;
367     N2norm = (N2 - IdleN2) / N2_factor;
368     thrust = (idlethrust + (milthrust * N2norm * N2norm))
369           * (1.0 - BleedDemand);
370
371     if (AugMethod == 1) {
372       if ((ThrottlePos > 0.99) && (N2 > 97.0)) {Augmentation = true;}
373       else {Augmentation = false;}
374     }
375
376     if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
377       thrust = MaxThrust * MaxThrustLookup->GetValue();
378     }
379
380     if (AugMethod == 2) {
381       if (AugmentCmd > 0.0) {
382         tdiff = (MaxThrust * MaxThrustLookup->GetValue()) - thrust;
383         thrust += (tdiff * AugmentCmd);
384       }
385     }
386
387     if ((Injected == 1) && Injection) {
388       thrust = thrust * InjectionLookup->GetValue();
389     }
390
391     return thrust;
392 }
393
394 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395
396 double FGTurbine::CalcFuelNeed(void)
397 {
398   double dT = FDMExec->GetDeltaT() * Propulsion->GetRate();
399   FuelFlowRate = FuelFlow_pph / 3600.0; // Calculates flow in lbs/sec from lbs/hr
400   FuelExpended = FuelFlowRate * dT;     // Calculates fuel expended in this time step
401   return FuelExpended;
402 }
403
404 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
405
406 double FGTurbine::GetPowerAvailable(void) {
407   if( ThrottlePos <= 0.77 )
408     return 64.94*ThrottlePos;
409   else
410     return 217.38*ThrottlePos - 117.38;
411 }
412
413 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414
415 double FGTurbine::Seek(double *var, double target, double accel, double decel) {
416   double v = *var;
417   if (v > target) {
418     v -= dt * decel;
419     if (v < target) v = target;
420   } else if (v < target) {
421     v += dt * accel;
422     if (v > target) v = target;
423   }
424   return v;
425 }
426
427 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428
429 bool FGTurbine::Load(FGFDMExec* exec, Element *el)
430 {
431   string property_name, property_prefix;
432   property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
433
434   if (el->FindElement("milthrust"))
435     MilThrust = el->FindElementValueAsNumberConvertTo("milthrust","LBS");
436   if (el->FindElement("maxthrust"))
437     MaxThrust = el->FindElementValueAsNumberConvertTo("maxthrust","LBS");
438   if (el->FindElement("bypassratio"))
439     BypassRatio = el->FindElementValueAsNumber("bypassratio");
440   if (el->FindElement("bleed"))
441     BleedDemand = el->FindElementValueAsNumber("bleed");
442   if (el->FindElement("tsfc"))
443     TSFC = el->FindElementValueAsNumber("tsfc");
444   if (el->FindElement("atsfc"))
445     ATSFC = el->FindElementValueAsNumber("atsfc");
446   if (el->FindElement("idlen1"))
447     IdleN1 = el->FindElementValueAsNumber("idlen1");
448   if (el->FindElement("idlen2"))
449     IdleN2 = el->FindElementValueAsNumber("idlen2");
450   if (el->FindElement("maxn1"))
451     MaxN1 = el->FindElementValueAsNumber("maxn1");
452   if (el->FindElement("maxn2"))
453     MaxN2 = el->FindElementValueAsNumber("maxn2");
454   if (el->FindElement("n1spinup"))
455     N1_spinup = el->FindElementValueAsNumber("n1spinup");
456   if (el->FindElement("n2spinup"))
457     N2_spinup = el->FindElementValueAsNumber("n2spinup");
458   if (el->FindElement("augmented"))
459     Augmented = (int)el->FindElementValueAsNumber("augmented");
460   if (el->FindElement("augmethod"))
461     AugMethod = (int)el->FindElementValueAsNumber("augmethod");
462   if (el->FindElement("injected"))
463     Injected = (int)el->FindElementValueAsNumber("injected");
464   if (el->FindElement("injection-time"))
465     InjectionTime = el->FindElementValueAsNumber("injection-time");
466
467   Element *function_element;
468   string name;
469   FGPropertyManager* PropertyManager = exec->GetPropertyManager();
470
471   while (true) {
472     function_element = el->FindNextElement("function");
473     if (!function_element) break;
474     name = function_element->GetAttributeValue("name");
475     if (name == "IdleThrust") {
476       IdleThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix);
477     } else if (name == "MilThrust") {
478       MilThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix);
479     } else if (name == "AugThrust") {
480       MaxThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix);
481     } else if (name == "Injection") {
482       InjectionLookup = new FGFunction(PropertyManager, function_element, property_prefix);
483     }
484   }
485
486   // Pre-calculations and initializations
487
488   delay = 90.0 / (BypassRatio + 3.0);
489   N1_factor = MaxN1 - IdleN1;
490   N2_factor = MaxN2 - IdleN2;
491   OilTemp_degK = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556 + 273.0;
492   IdleFF = pow(MilThrust, 0.2) * 107.0;  // just an estimate
493
494   bindmodel();
495   return true;
496 }
497
498 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
499
500 string FGTurbine::GetEngineLabels(const string& delimiter)
501 {
502   std::ostringstream buf;
503
504   buf << Name << "_N1[" << EngineNumber << "]" << delimiter
505       << Name << "_N2[" << EngineNumber << "]" << delimiter
506       << Thruster->GetThrusterLabels(EngineNumber, delimiter);
507
508   return buf.str();
509 }
510
511 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
512
513 string FGTurbine::GetEngineValues(const string& delimiter)
514 {
515   std::ostringstream buf;
516
517   buf << N1 << delimiter
518       << N2 << delimiter
519       << Thruster->GetThrusterValues(EngineNumber, delimiter);
520
521   return buf.str();
522 }
523
524 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
525
526 void FGTurbine::bindmodel()
527 {
528   string property_name, base_property_name;
529   base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
530   property_name = base_property_name + "/n1";
531   PropertyManager->Tie( property_name.c_str(), &N1);
532   property_name = base_property_name + "/n2";
533   PropertyManager->Tie( property_name.c_str(), &N2);
534   property_name = base_property_name + "/injection_cmd";
535   PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this, 
536                         &FGTurbine::GetInjection, &FGTurbine::SetInjection);
537   property_name = base_property_name + "/seized";
538   PropertyManager->Tie( property_name.c_str(), &Seized);
539   property_name = base_property_name + "/stalled";
540   PropertyManager->Tie( property_name.c_str(), &Stalled);
541   property_name = base_property_name + "/bleed-factor";
542   PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this, &FGTurbine::GetBleedDemand, &FGTurbine::SetBleedDemand);
543 }
544
545 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
546
547 int FGTurbine::InitRunning(void) {
548   FDMExec->SuspendIntegration();
549   Cutoff=false;
550   Running=true;  
551   N2=IdleN2;
552   Calculate();
553   FDMExec->ResumeIntegration();
554   return phase==tpRun;
555 }
556
557 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
558 //    The bitmasked value choices are as follows:
559 //    unset: In this case (the default) JSBSim would only print
560 //       out the normally expected messages, essentially echoing
561 //       the config files as they are read. If the environment
562 //       variable is not set, debug_lvl is set to 1 internally
563 //    0: This requests JSBSim not to output any messages
564 //       whatsoever.
565 //    1: This value explicity requests the normal JSBSim
566 //       startup messages
567 //    2: This value asks for a message to be printed out when
568 //       a class is instantiated
569 //    4: When this value is set, a message is displayed when a
570 //       FGModel object executes its Run() method
571 //    8: When this value is set, various runtime state variables
572 //       are printed out periodically
573 //    16: When set various parameters are sanity checked and
574 //       a message is printed out when they go out of bounds
575
576 void FGTurbine::Debug(int from)
577 {
578   if (debug_lvl <= 0) return;
579
580   if (debug_lvl & 1) { // Standard console startup message output
581     if (from == 0) { // Constructor
582
583     }
584     if (from == 2) { // called from Load()
585       cout << "\n    Engine Name: "         << Name << endl;
586       cout << "      MilThrust:   "         << MilThrust << endl;
587       cout << "      MaxThrust:   "         << MaxThrust << endl;
588       cout << "      BypassRatio: "         << BypassRatio << endl;
589       cout << "      TSFC:        "         << TSFC << endl;
590       cout << "      ATSFC:       "         << ATSFC << endl;
591       cout << "      IdleN1:      "         << IdleN1 << endl;
592       cout << "      IdleN2:      "         << IdleN2 << endl;
593       cout << "      MaxN1:       "         << MaxN1 << endl;
594       cout << "      MaxN2:       "         << MaxN2 << endl;
595       cout << "      Augmented:   "         << Augmented << endl;
596       cout << "      AugMethod:   "         << AugMethod << endl;
597       cout << "      Injected:    "         << Injected << endl;
598       cout << "      MinThrottle: "         << MinThrottle << endl;
599
600       cout << endl;
601     }
602   }
603   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
604     if (from == 0) cout << "Instantiated: FGTurbine" << endl;
605     if (from == 1) cout << "Destroyed:    FGTurbine" << endl;
606   }
607   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
608   }
609   if (debug_lvl & 8 ) { // Runtime state variables
610   }
611   if (debug_lvl & 16) { // Sanity checking
612   }
613   if (debug_lvl & 64) {
614     if (from == 0) { // Constructor
615       cout << IdSrc << endl;
616       cout << IdHdr << endl;
617     }
618   }
619 }
620 }