]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp
Merge branch 'luff/kln89'
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTurboProp.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGTurboProp.cpp
4  Author:       Jiri "Javky" Javurek
5                based on SimTurbine and Turbine engine from David Culp
6  Date started: 05/14/2004
7  Purpose:      This module models a turbo propeller engine.
8
9  ------------- Copyright (C) 2004  (javky@email.cz) ---------
10
11  This program is free software; you can redistribute it and/or modify it under
12  the terms of the GNU Lesser 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 Lesser General Public License for more
19  details.
20
21  You should have received a copy of the GNU Lesser 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 Lesser 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 Turbo propeller engine
32 based on parameters given in the engine config file for this class
33
34 HISTORY
35 --------------------------------------------------------------------------------
36 05/14/2004  Created
37
38 //JVK (mark)
39
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 INCLUDES
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44 #include <iostream>
45 #include <sstream>
46 #include "FGTurboProp.h"
47
48 #include "FGPropeller.h"
49 #include "FGState.h"
50 #include "models/FGAuxiliary.h"
51
52 using namespace std;
53
54 namespace JSBSim {
55
56 static const char *IdSrc = "$Id$";
57 static const char *IdHdr = ID_TURBOPROP;
58
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 CLASS IMPLEMENTATION
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62
63 FGTurboProp::FGTurboProp(FGFDMExec* exec, Element *el, int engine_number)
64   : FGEngine(exec, el, engine_number),
65     ITT_N1(NULL), EnginePowerRPM_N1(NULL), EnginePowerVC(NULL)
66 {
67   SetDefaults();
68
69   Load(exec, el);
70   Debug(0);
71 }
72
73 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74
75 FGTurboProp::~FGTurboProp()
76 {
77   delete ITT_N1;
78   delete EnginePowerRPM_N1;
79   delete EnginePowerVC;
80   Debug(1);
81 }
82
83 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84
85 bool FGTurboProp::Load(FGFDMExec* exec, Element *el)
86 {
87   IdleFF=-1;
88   MaxStartingTime = 999999; //very big timeout -> infinite
89   Ielu_max_torque=-1;
90
91 // ToDo: Need to make sure units are properly accounted for below.
92
93   if (el->FindElement("milthrust"))
94     MilThrust = el->FindElementValueAsNumberConvertTo("milthrust","LBS");
95   if (el->FindElement("idlen1"))
96     IdleN1 = el->FindElementValueAsNumber("idlen1");
97   if (el->FindElement("idlen2"))
98     IdleN2 = el->FindElementValueAsNumber("idlen2");
99   if (el->FindElement("maxn1"))
100     MaxN1 = el->FindElementValueAsNumber("maxn1");
101   if (el->FindElement("maxn2"))
102     MaxN2 = el->FindElementValueAsNumber("maxn2");
103   if (el->FindElement("betarangeend"))
104     BetaRangeThrottleEnd = el->FindElementValueAsNumber("betarangeend")/100.0;
105   if (el->FindElement("reversemaxpower"))
106     ReverseMaxPower = el->FindElementValueAsNumber("reversemaxpower")/100.0;
107
108   if (el->FindElement("maxpower"))
109     MaxPower = el->FindElementValueAsNumber("maxpower");
110   if (el->FindElement("idlefuelflow"))
111     IdleFF = el->FindElementValueAsNumber("idlefuelflow");
112   if (el->FindElement("psfc"))
113     PSFC = el->FindElementValueAsNumber("psfc");
114   if (el->FindElement("n1idle_max_delay"))
115     Idle_Max_Delay = el->FindElementValueAsNumber("n1idle_max_delay");
116   if (el->FindElement("maxstartingtime"))
117     MaxStartingTime = el->FindElementValueAsNumber("maxstartingtime");
118   if (el->FindElement("startern1"))
119     StarterN1 = el->FindElementValueAsNumber("startern1");
120   if (el->FindElement("ielumaxtorque"))
121     Ielu_max_torque = el->FindElementValueAsNumber("ielumaxtorque");
122   if (el->FindElement("itt_delay"))
123     ITT_Delay = el->FindElementValueAsNumber("itt_delay");
124
125   Element *table_element;
126   string name;
127   FGPropertyManager* PropertyManager = exec->GetPropertyManager();
128
129   while (true) {
130     table_element = el->FindNextElement("table");
131     if (!table_element) break;
132     name = table_element->GetAttributeValue("name");
133     if (name == "EnginePowerVC") {
134       EnginePowerVC = new FGTable(PropertyManager, table_element);
135     } else if (name == "EnginePowerRPM_N1") {
136       EnginePowerRPM_N1 = new FGTable(PropertyManager, table_element);
137     } else if (name == "ITT_N1") {
138       ITT_N1 = new FGTable(PropertyManager, table_element);
139     } else {
140       cerr << "Unknown table type: " << name << " in turbine definition." <<
141       endl;
142     }
143   }
144
145   // Pre-calculations and initializations
146
147   delay=1;
148   N1_factor = MaxN1 - IdleN1;
149   N2_factor = MaxN2 - IdleN2;
150   OilTemp_degK = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556 + 273.0;
151   if (IdleFF==-1) IdleFF = pow(MilThrust, 0.2) * 107.0;  // just an estimate
152
153   cout << "ENG POWER:" << EnginePowerRPM_N1->GetValue(1200,90) << "\n";
154
155   return true;
156 }
157
158 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
159 // The main purpose of Calculate() is to determine what phase the engine should
160 // be in, then call the corresponding function.
161
162 double FGTurboProp::Calculate(void)
163 {
164   TAT = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556;
165   dt = State->Getdt() * Propulsion->GetRate();
166
167   ThrottleCmd = FCS->GetThrottleCmd(EngineNumber);
168
169   Prop_RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
170   if (Thruster->GetType() == FGThruster::ttPropeller) {
171     ((FGPropeller*)Thruster)->SetAdvance(FCS->GetPropAdvance(EngineNumber));
172     ((FGPropeller*)Thruster)->SetFeather(FCS->GetPropFeather(EngineNumber));
173     ((FGPropeller*)Thruster)->SetReverse(Reversed);
174     if (Reversed) {
175       ((FGPropeller*)Thruster)->SetReverseCoef(ThrottleCmd);
176     } else {
177       ((FGPropeller*)Thruster)->SetReverseCoef(0.0);
178     }
179   }
180
181   if (Reversed) {
182     if (ThrottleCmd < BetaRangeThrottleEnd) {
183         ThrottleCmd = 0.0;  // idle when in Beta-range
184     } else {
185       // when reversed:
186       ThrottleCmd = (ThrottleCmd-BetaRangeThrottleEnd)/(1-BetaRangeThrottleEnd) * ReverseMaxPower;
187     }
188   }
189
190   // When trimming is finished check if user wants engine OFF or RUNNING
191   if ((phase == tpTrim) && (dt > 0)) {
192     if (Running && !Starved) {
193       phase = tpRun;
194       N2 = IdleN2;
195       N1 = IdleN1;
196       OilTemp_degK = 366.0;
197       Cutoff = false;
198     } else {
199       phase = tpOff;
200       Cutoff = true;
201       Eng_ITT_degC = TAT;
202       Eng_Temperature = TAT;
203       OilTemp_degK = TAT+273.15;
204     }
205   }
206
207   if (!Running && Starter) {
208     if (phase == tpOff) {
209       phase = tpSpinUp;
210       if (StartTime < 0) StartTime=0;
211     }
212   }
213   if (!Running && !Cutoff && (N1 > 15.0)) {
214     phase = tpStart;
215     StartTime = -1;
216   }
217   if (Cutoff && (phase != tpSpinUp)) phase = tpOff;
218   if (dt == 0) phase = tpTrim;
219   if (Starved) phase = tpOff;
220   if (Condition >= 10) {
221     phase = tpOff;
222     StartTime=-1;
223   }
224
225   if (Condition < 1) {
226     if (Ielu_max_torque > 0
227       && -Ielu_max_torque > ((FGPropeller*)(Thruster))->GetTorque()
228       && ThrottleCmd >= OldThrottle ) {
229       ThrottleCmd = OldThrottle - 0.1 * dt; //IELU down
230       Ielu_intervent = true;
231     } else if (Ielu_max_torque > 0 && Ielu_intervent && ThrottleCmd >= OldThrottle) {
232       ThrottleCmd = OldThrottle;
233       ThrottleCmd = OldThrottle + 0.05 * dt; //IELU up
234       Ielu_intervent = true;
235     } else {
236       Ielu_intervent = false;
237     }
238   } else {
239     Ielu_intervent = false;
240   }
241   OldThrottle = ThrottleCmd;
242
243   switch (phase) {
244     case tpOff:    Eng_HP = Off(); break;
245     case tpRun:    Eng_HP = Run(); break;
246     case tpSpinUp: Eng_HP = SpinUp(); break;
247     case tpStart:  Eng_HP = Start(); break;
248     default: Eng_HP = 0;
249   }
250
251   //printf ("EngHP: %lf / Requi: %lf\n",Eng_HP,Prop_Required_Power);
252   PowerAvailable = (Eng_HP * hptoftlbssec) - Thruster->GetPowerRequired();
253
254   return Thruster->Calculate(PowerAvailable);
255
256 }
257
258 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259
260 double FGTurboProp::Off(void)
261 {
262   double qbar = Auxiliary->Getqbar();
263   Running = false; EngStarting = false;
264
265   FuelFlow_pph = Seek(&FuelFlow_pph, 0, 800.0, 800.0);
266
267   //allow the air turn with generator
268   N1 = ExpSeek(&N1, qbar/15.0, Idle_Max_Delay*2.5, Idle_Max_Delay * 5);
269
270   OilTemp_degK = ExpSeek(&OilTemp_degK,273.15 + TAT, 400 , 400);
271
272   Eng_Temperature = ExpSeek(&Eng_Temperature,TAT,300,400);
273   double ITT_goal = ITT_N1->GetValue(N1,0.1) + ((N1>20) ? 0.0 : (20-N1)/20.0 * Eng_Temperature);
274   Eng_ITT_degC  = ExpSeek(&Eng_ITT_degC,ITT_goal,ITT_Delay,ITT_Delay*1.2);
275
276   OilPressure_psi = (N1/100.0*0.25+(0.1-(OilTemp_degK-273.15)*0.1/80.0)*N1/100.0) / 7692.0e-6; //from MPa to psi
277
278   ConsumeFuel(); // for possible setting Starved = false when fuel tank
279                  // is refilled (fuel crossfeed etc.)
280
281   if (Prop_RPM>5) return -0.012; // friction in engine when propeller spining (estimate)
282   return 0.0;
283 }
284
285 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
286
287 double FGTurboProp::Run(void)
288 {
289   double thrust = 0.0, EngPower_HP, eff_coef;
290   Running = true; Starter = false; EngStarting = false;
291
292 //---
293   double old_N1 = N1;
294   N1 = ExpSeek(&N1, IdleN1 + ThrottleCmd * N1_factor, Idle_Max_Delay, Idle_Max_Delay * 2.4);
295
296   EngPower_HP = EnginePowerRPM_N1->GetValue(Prop_RPM,N1);
297   EngPower_HP *= EnginePowerVC->GetValue();
298   if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
299
300   eff_coef = 9.333 - (N1)/12; // 430%Fuel at 60%N1
301   FuelFlow_pph = PSFC * EngPower_HP * eff_coef;
302
303   Eng_Temperature = ExpSeek(&Eng_Temperature,Eng_ITT_degC,300,400);
304   double ITT_goal = ITT_N1->GetValue((N1-old_N1)*300+N1,1);
305   Eng_ITT_degC  = ExpSeek(&Eng_ITT_degC,ITT_goal,ITT_Delay,ITT_Delay*1.2);
306
307   OilPressure_psi = (N1/100.0*0.25+(0.1-(OilTemp_degK-273.15)*0.1/80.0)*N1/100.0) / 7692.0e-6; //from MPa to psi
308 //---
309   EPR = 1.0 + thrust/MilThrust;
310
311   OilTemp_degK = Seek(&OilTemp_degK, 353.15, 0.4-N1*0.001, 0.04);
312
313   ConsumeFuel();
314
315   if (Cutoff) phase = tpOff;
316   if (Starved) phase = tpOff;
317
318   return EngPower_HP;
319 }
320
321 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322
323 double FGTurboProp::SpinUp(void)
324 {
325   double EngPower_HP;
326   Running = false; EngStarting = true;
327   FuelFlow_pph = 0.0;
328
329   if (!GeneratorPower) {
330     EngStarting=false;
331     phase=tpOff;
332     StartTime = -1;
333     return 0.0;
334   }
335
336   N1 = ExpSeek(&N1, StarterN1, Idle_Max_Delay * 6, Idle_Max_Delay * 2.4);
337
338   Eng_Temperature = ExpSeek(&Eng_Temperature,TAT,300,400);
339   double ITT_goal = ITT_N1->GetValue(N1,0.1) + ((N1>20) ? 0.0 : (20-N1)/20.0 * Eng_Temperature);
340   Eng_ITT_degC  = ExpSeek(&Eng_ITT_degC,ITT_goal,ITT_Delay,ITT_Delay*1.2);
341
342   OilTemp_degK = ExpSeek(&OilTemp_degK,273.15 + TAT, 400 , 400);
343
344   OilPressure_psi = (N1/100.0*0.25+(0.1-(OilTemp_degK-273.15)*0.1/80.0)*N1/100.0) / 7692.0e-6; //from MPa to psi
345   NozzlePosition = 1.0;
346
347   EngPower_HP = EnginePowerRPM_N1->GetValue(Prop_RPM,N1);
348   EngPower_HP *= EnginePowerVC->GetValue();
349   if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
350
351   if (StartTime>=0) StartTime+=dt;
352   if (StartTime > MaxStartingTime && MaxStartingTime > 0) { //start failed due timeout
353     phase = tpOff;
354     StartTime = -1;
355   }
356
357   ConsumeFuel(); // for possible setting Starved = false when fuel tank
358                  // is refilled (fuel crossfeed etc.)
359
360   return EngPower_HP;
361 }
362
363 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364
365 double FGTurboProp::Start(void)
366 {
367   double EngPower_HP,eff_coef;
368   EngStarting = false;
369   if ((N1 > 15.0) && !Starved) {       // minimum 15% N2 needed for start
370     double old_N1 = N1;
371     Cranking = true;                   // provided for sound effects signal
372     if (N1 < IdleN1) {
373       EngPower_HP = EnginePowerRPM_N1->GetValue(Prop_RPM,N1);
374       EngPower_HP *= EnginePowerVC->GetValue();
375       if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
376       N1 = ExpSeek(&N1, IdleN1*1.1, Idle_Max_Delay*4, Idle_Max_Delay * 2.4);
377       eff_coef = 9.333 - (N1)/12; // 430%Fuel at 60%N1
378       FuelFlow_pph = PSFC * EngPower_HP * eff_coef;
379       Eng_Temperature = ExpSeek(&Eng_Temperature,Eng_ITT_degC,300,400);
380       double ITT_goal = ITT_N1->GetValue((N1-old_N1)*300+N1,1);
381       Eng_ITT_degC  = ExpSeek(&Eng_ITT_degC,ITT_goal,ITT_Delay,ITT_Delay*1.2);
382
383       OilPressure_psi = (N1/100.0*0.25+(0.1-(OilTemp_degK-273.15)*0.1/80.0)*N1/100.0) / 7692.0e-6; //from MPa to psi
384       OilTemp_degK = Seek(&OilTemp_degK, 353.15, 0.4-N1*0.001, 0.04);
385
386     } else {
387       phase = tpRun;
388       Running = true;
389       Starter = false;
390       Cranking = false;
391       FuelFlow_pph = 0;
392       EngPower_HP=0.0;
393     }
394   } else {                 // no start if N2 < 15% or Starved
395     phase = tpOff;
396     Starter = false;
397   }
398
399   ConsumeFuel();
400
401   return EngPower_HP;
402 }
403
404
405 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
406
407 double FGTurboProp::CalcFuelNeed(void)
408 {
409   double dT = State->Getdt() * Propulsion->GetRate();
410   FuelFlowRate = FuelFlow_pph / 3600.0;
411   FuelExpended = FuelFlowRate * dT;
412   return FuelExpended;
413 }
414
415 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
416
417 double FGTurboProp::Seek(double *var, double target, double accel, double decel)
418 {
419   double v = *var;
420   if (v > target) {
421     v -= dt * decel;
422     if (v < target) v = target;
423   } else if (v < target) {
424     v += dt * accel;
425     if (v > target) v = target;
426   }
427   return v;
428 }
429
430 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
431
432 double FGTurboProp::ExpSeek(double *var, double target, double accel_tau, double decel_tau)
433 {
434 // exponential delay instead of the linear delay used in Seek
435   double v = *var;
436   if (v > target) {
437     v = (v - target) * exp ( -dt / decel_tau) + target;
438   } else if (v < target) {
439     v = (target - v) * (1 - exp ( -dt / accel_tau)) + v;
440   }
441   return v;
442 }
443
444 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
445
446 void FGTurboProp::SetDefaults(void)
447 {
448 //  Name = "Not defined";
449   N1 = N2 = 0.0;
450   Type = etTurboprop;
451   MilThrust = 10000.0;
452   IdleN1 = 30.0;
453   IdleN2 = 60.0;
454   MaxN1 = 100.0;
455   MaxN2 = 100.0;
456   ThrottleCmd = 0.0;
457   InletPosition = 1.0;
458   NozzlePosition = 1.0;
459   Reversed = false;
460   Cutoff = true;
461   phase = tpOff;
462   Stalled = false;
463   Seized = false;
464   Overtemp = false;
465   Fire = false;
466   Eng_ITT_degC = 0.0;
467
468   GeneratorPower=true;
469   Condition = 0;
470   Ielu_intervent=false;
471
472   Idle_Max_Delay = 1.0;
473 }
474
475 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
476
477
478 string FGTurboProp::GetEngineLabels(const string& delimiter)
479 {
480   std::ostringstream buf;
481
482   buf << Name << "_N1[" << EngineNumber << "]" << delimiter
483       << Name << "_N2[" << EngineNumber << "]" << delimiter
484       << Name << "_PwrAvail[" << EngineNumber << "]" << delimiter
485       << Thruster->GetThrusterLabels(EngineNumber, delimiter);
486
487   return buf.str();
488 }
489
490 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491
492 string FGTurboProp::GetEngineValues(const string& delimiter)
493 {
494   std::ostringstream buf;
495
496   buf << PowerAvailable << delimiter
497       << N1 << delimiter
498       << N2 << delimiter
499       << Thruster->GetThrusterValues(EngineNumber,delimiter);
500
501   return buf.str();
502 }
503
504 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
505
506 int FGTurboProp::InitRunning(void)
507 {
508   State->SuspendIntegration();
509   Cutoff=false;
510   Running=true;  
511   N2=16.0;
512   Calculate();
513   State->ResumeIntegration();
514   return phase==tpRun;
515 }
516
517 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
518
519 void FGTurboProp::bindmodel()
520 {
521   string property_name, base_property_name;
522   base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
523   property_name = base_property_name + "/n1";
524   PropertyManager->Tie( property_name.c_str(), &N1);
525   property_name = base_property_name + "/n2";
526   PropertyManager->Tie( property_name.c_str(), &N2);
527   property_name = base_property_name + "/reverser";
528   PropertyManager->Tie( property_name.c_str(), &Reversed);
529 }
530
531 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
532 //    The bitmasked value choices are as follows:
533 //    unset: In this case (the default) JSBSim would only print
534 //       out the normally expected messages, essentially echoing
535 //       the config files as they are read. If the environment
536 //       variable is not set, debug_lvl is set to 1 internally
537 //    0: This requests JSBSim not to output any messages
538 //       whatsoever.
539 //    1: This value explicity requests the normal JSBSim
540 //       startup messages
541 //    2: This value asks for a message to be printed out when
542 //       a class is instantiated
543 //    4: When this value is set, a message is displayed when a
544 //       FGModel object executes its Run() method
545 //    8: When this value is set, various runtime state variables
546 //       are printed out periodically
547 //    16: When set various parameters are sanity checked and
548 //       a message is printed out when they go out of bounds
549
550 void FGTurboProp::Debug(int from)
551 {
552   if (debug_lvl <= 0) return;
553
554   if (debug_lvl & 1) { // Standard console startup message output
555     if (from == 0) { // Constructor
556
557     }
558     if (from == 2) { // called from Load()
559       cout << "\n ****MUJ MOTOR TURBOPROP****\n";
560       cout << "\n    Engine Name: "         << Name << endl;
561       cout << "      MilThrust:   "         << MilThrust << endl;
562       cout << "      IdleN1:      "         << IdleN1 << endl;
563       cout << "      MaxN1:       "         << MaxN1 << endl;
564
565       cout << endl;
566     }
567   }
568   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
569     if (from == 0) cout << "Instantiated: FGTurboProp" << endl;
570     if (from == 1) cout << "Destroyed:    FGTurboProp" << 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 }