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