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