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