JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
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 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 FORWARD DECLARATIONS
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 
53 namespace JSBSim {
54 
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DOCUMENTATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 
88 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 CLASS DECLARATION
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
91 
92 class FGTurboProp : public FGEngine
93 {
94 public:
99  FGTurboProp(FGFDMExec* Executive, Element *el, int engine_number, struct Inputs& input);
101  ~FGTurboProp();
102 
103  enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpTrim };
104 
105  void Calculate(void);
106  double CalcFuelNeed(void);
107 
108  double GetPowerAvailable(void) const { return (HP * hptoftlbssec); }
109  double GetRPM(void) const { return RPM; }
110  double GetIeluThrottle(void) const { return (ThrottlePos); }
111  bool GetIeluIntervent(void) const { return Ielu_intervent; }
112 
113  double Seek(double* var, double target, double accel, double decel);
114  double ExpSeek(double* var, double target, double accel, double decel);
115 
116  phaseType GetPhase(void) const { return phase; }
117 
118  bool GetReversed(void) const { return Reversed; }
119  bool GetCutoff(void) const { return Cutoff; }
120 
121  double GetN1(void) const {return N1;}
122  double GetITT(void) const {return Eng_ITT_degC;}
123  double GetEngStarting(void) const { return EngStarting; }
124 
125  double getOilPressure_psi () const {return OilPressure_psi;}
126  double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
127 
128  inline bool GetGeneratorPower(void) const { return GeneratorPower; }
129  inline int GetCondition(void) const { return Condition; }
130 
131  void SetPhase( phaseType p ) { phase = p; }
132  void SetReverse(bool reversed) { Reversed = reversed; }
133  void SetCutoff(bool cutoff) { Cutoff = cutoff; }
134 
135  inline void SetGeneratorPower(bool gp) { GeneratorPower=gp; }
136  inline void SetCondition(bool c) { Condition=c; }
137  int InitRunning(void);
138  std::string GetEngineLabels(const std::string& delimiter);
139  std::string GetEngineValues(const std::string& delimiter);
140 
141 private:
142 
143  phaseType phase;
144  double IdleN1;
145  double N1;
146  double MaxN1;
147  double delay;
148  double N1_factor;
149  double ThrottlePos;
150  bool Reversed;
151  bool Cutoff;
152 
153  double OilPressure_psi;
154  double OilTemp_degK;
155 
156  double Ielu_max_torque; // max propeller torque (before ielu intervent)
157  bool Ielu_intervent;
158  double OldThrottle;
159 
160  double BetaRangeThrottleEnd; // coef (0-1) where is end of beta-range
161  double ReverseMaxPower; // coef (0-1) multiplies max throttle on reverse
162 
163  double Idle_Max_Delay; // time delay for exponential
164  double MaxPower; // max engine power [HP]
165  double StarterN1; // rotates of generator maked by starter [%]
166  double MaxStartingTime; // maximal time for start [s] (-1 means not used)
167  double RPM; // shaft RPM
168  double PSFC; // Power specific fuel comsumption [lb/(HP*hr)] at best efficiency
169  double CombustionEfficiency;
170 
171  double HP; // engine power output
172 
173  double StartTime; // engine starting time [s] (0 when start button pushed)
174 
175  double ITT_Delay; // time delay for exponential growth of ITT
176  double Eng_ITT_degC;
177  double Eng_Temperature; // temperature inside engine
178 
179  bool EngStarting; // logicaly output - TRUE if engine is starting
180  bool GeneratorPower;
181  int Condition;
182  int thrusterType; // the attached thruster
183 
184  double Off(void);
185  double Run(void);
186  double SpinUp(void);
187  double Start(void);
188 
189  void SetDefaults(void);
190  bool Load(FGFDMExec *exec, Element *el);
191  void bindmodel(FGPropertyManager* pm);
192  void Debug(int from);
193 
194  FGTable* ITT_N1; // ITT temperature depending on throttle command
195  FGTable* EnginePowerRPM_N1;
196  FGParameter* EnginePowerVC;
197  FGTable* CombustionEfficiency_N1;
198 };
199 }
200 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201 #endif
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGTurboProp::Calculate
void Calculate(void)
Calculates the thrust of the engine, and other engine functions.
Definition: FGTurboProp.cpp:196
JSBSim::FGTable
Lookup table class.
Definition: FGTable.h:233
JSBSim::FGTurboProp::CalcFuelNeed
double CalcFuelNeed(void)
The fuel need is calculated based on power levels and flow rate for that power level.
Definition: FGTurboProp.cpp:439
JSBSim::FGTurboProp::~FGTurboProp
~FGTurboProp()
Destructor.
Definition: FGTurboProp.cpp:74
JSBSim::FGTurboProp
Turboprop engine model.
Definition: FGTurboProp.h:92
JSBSim::FGJSBBase::KelvinToFahrenheit
static constexpr double KelvinToFahrenheit(double kelvin)
Converts from degrees Kelvin to degrees Fahrenheit.
Definition: FGJSBBase.h:195
JSBSim::FGParameter
Represents various types of parameters.
Definition: FGParameter.h:58
JSBSim::FGEngine::Inputs
Definition: FGEngine.h:106
JSBSim::FGEngine
Base class for all engines.
Definition: FGEngine.h:103
JSBSim::FGTurboProp::FGTurboProp
FGTurboProp(FGFDMExec *Executive, Element *el, int engine_number, struct Inputs &input)
Constructor.
Definition: FGTurboProp.cpp:62
JSBSim::FGPropertyManager
Definition: FGPropertyManager.h:373
JSBSim::Element
Definition: FGXMLElement.h:143