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