JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGTurboProp.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGTurboProp.h
4  Author: Jiri "Javky" Javurek
5  based on SimTurbine and Turbine engine from David Culp
6  Date started: 05/14/2004
7 
8  ------------- Copyright (C) 2004 (javky@email.cz)----------
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 HISTORY
28 --------------------------------------------------------------------------------
29 05/14/2004 Created
30 02/08/2011 T. Kreitler, added rotor support
31 
32 //JVK (mark)
33 
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 SENTRY
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 
38 #ifndef FGTURBOPROP_H
39 #define FGTURBOPROP_H
40 
41 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 INCLUDES
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
44 
45 #include <vector>
46 #include "FGEngine.h"
47 #include "math/FGTable.h"
48 
49 #define ID_TURBOPROP "$Id: FGTurboProp.h,v 1.25 2017/02/26 11:41:28 bcoconni Exp $"
50 
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 FORWARD DECLARATIONS
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54 
55 namespace JSBSim {
56 
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 CLASS DOCUMENTATION
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 
90 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 CLASS DECLARATION
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
93 
94 class FGTurboProp : public FGEngine
95 {
96 public:
101  FGTurboProp(FGFDMExec* Executive, Element *el, int engine_number, struct Inputs& input);
103  ~FGTurboProp();
104 
105  enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpTrim };
106 
107  void Calculate(void);
108  double CalcFuelNeed(void);
109 
110  double GetPowerAvailable(void) const { return (HP * hptoftlbssec); }
111  double GetRPM(void) const { return RPM; }
112  double GetIeluThrottle(void) const { return (ThrottlePos); }
113  bool GetIeluIntervent(void) const { return Ielu_intervent; }
114 
115  double Seek(double* var, double target, double accel, double decel);
116  double ExpSeek(double* var, double target, double accel, double decel);
117 
118  phaseType GetPhase(void) const { return phase; }
119 
120  bool GetReversed(void) const { return Reversed; }
121  bool GetCutoff(void) const { return Cutoff; }
122 
123  double GetN1(void) const {return N1;}
124  double GetITT(void) const {return Eng_ITT_degC;}
125  double GetEngStarting(void) const { return EngStarting; }
126 
127  double getOilPressure_psi () const {return OilPressure_psi;}
128  double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
129 
130  inline bool GetGeneratorPower(void) const { return GeneratorPower; }
131  inline int GetCondition(void) const { return Condition; }
132 
133  void SetPhase( phaseType p ) { phase = p; }
134  void SetReverse(bool reversed) { Reversed = reversed; }
135  void SetCutoff(bool cutoff) { Cutoff = cutoff; }
136 
137  inline void SetGeneratorPower(bool gp) { GeneratorPower=gp; }
138  inline void SetCondition(bool c) { Condition=c; }
139  int InitRunning(void);
140  std::string GetEngineLabels(const std::string& delimiter);
141  std::string GetEngineValues(const std::string& delimiter);
142 
143 private:
144 
145  phaseType phase;
146  double IdleN1;
147  double N1;
148  double MaxN1;
149  double delay;
150  double N1_factor;
151  double ThrottlePos;
152  bool Reversed;
153  bool Cutoff;
154 
155  double OilPressure_psi;
156  double OilTemp_degK;
157 
158  double Ielu_max_torque; // max propeller torque (before ielu intervent)
159  bool Ielu_intervent;
160  double OldThrottle;
161 
162  double BetaRangeThrottleEnd; // coef (0-1) where is end of beta-range
163  double ReverseMaxPower; // coef (0-1) multiplies max throttle on reverse
164 
165  double Idle_Max_Delay; // time delay for exponential
166  double MaxPower; // max engine power [HP]
167  double StarterN1; // rotates of generator maked by starter [%]
168  double MaxStartingTime; // maximal time for start [s] (-1 means not used)
169  double RPM; // shaft RPM
170  double PSFC; // Power specific fuel comsumption [lb/(HP*hr)] at best efficiency
171  double CombustionEfficiency;
172 
173  double HP; // engine power output
174 
175  double StartTime; // engine starting time [s] (0 when start button pushed)
176 
177  double ITT_Delay; // time delay for exponential growth of ITT
178  double Eng_ITT_degC;
179  double Eng_Temperature; // temperature inside engine
180 
181  bool EngStarting; // logicaly output - TRUE if engine is starting
182  bool GeneratorPower;
183  int Condition;
184  int thrusterType; // the attached thruster
185 
186  double Off(void);
187  double Run(void);
188  double SpinUp(void);
189  double Start(void);
190 
191  void SetDefaults(void);
192  bool Load(FGFDMExec *exec, Element *el);
193  void bindmodel(FGPropertyManager* pm);
194  void Debug(int from);
195 
196  FGTable* ITT_N1; // ITT temperature depending on throttle command
197  FGTable* EnginePowerRPM_N1;
198  FGParameter* EnginePowerVC;
199  FGTable* CombustionEfficiency_N1;
200 };
201 }
202 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203 #endif
~FGTurboProp()
Destructor.
Definition: FGTurboProp.cpp:77
static double KelvinToFahrenheit(double kelvin)
Converts from degrees Kelvin to degrees Fahrenheit.
Definition: FGJSBBase.h:197
double CalcFuelNeed(void)
The fuel need is calculated based on power levels and flow rate for that power level.
FGTurboProp(FGFDMExec *Executive, Element *el, int engine_number, struct Inputs &input)
Constructor.
Definition: FGTurboProp.cpp:65
Represents various types of parameters.
Definition: FGParameter.h:63
Turboprop engine model.
Definition: FGTurboProp.h:94
Base class for all engines.
Definition: FGEngine.h:121
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
void Calculate(void)
Calculates the thrust of the engine, and other engine functions.
Lookup table class.
Definition: FGTable.h:243