![]() |
JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++
|
This class models a turbine engine. More...
#include <FGTurbine.h>
Inheritance diagram for FGTurbine:
Collaboration diagram for FGTurbine:Public Types | |
| enum | phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim } |
Public Member Functions | |
| FGTurbine (FGFDMExec *Executive, Element *el, int engine_number, struct Inputs &input) | |
| Constructor. | |
| ~FGTurbine () | |
| Destructor. | |
| double | CalcFuelNeed (void) |
| The fuel need is calculated based on power levels and flow rate for that power level. | |
| void | Calculate (void) |
| Calculates the thrust of the engine, and other engine functions. | |
| bool | GetAugmentation (void) const |
| double | GetBleedDemand (void) const |
| bool | GetCutoff (void) const |
| double | GetEGT (void) const |
| std::string | GetEngineLabels (const std::string &delimiter) |
| std::string | GetEngineValues (const std::string &delimiter) |
| double | GetEPR (void) const |
| bool | GetFire (void) const |
| int | GetIgnition (void) const |
| bool | GetInjection (void) const |
| double | GetInlet (void) const |
| double | GetN1 (void) const |
| double | GetN2 (void) const |
| double | GetNozzle (void) const |
| double | getOilPressure_psi () const |
| double | getOilTemp_degF (void) |
| bool | GetOvertemp (void) const |
| phaseType | GetPhase (void) |
| double | GetPowerAvailable (void) |
| bool | GetReversed (void) const |
| int | InitRunning (void) |
| void | ResetToIC (void) |
| Resets the Engine parameters to the initial conditions. | |
| double | Seek (double *var, double target, double accel, double decel) |
| A lag filter. | |
| void | SetAugmentation (bool augmentation) |
| void | SetBleedDemand (double bleedDemand) |
| void | SetCutoff (bool cutoff) |
| void | SetEPR (double epr) |
| void | SetIgnition (int ignition) |
| void | SetInjection (bool injection) |
| void | SetPhase (phaseType p) |
| void | SetReverse (bool reversed) |
Based on Jon Berndt's FGTurbine module. Here the term "phase" signifies the engine's mode of operation. At any given time the engine is in only one phase. At simulator startup the engine will be placed in the Trim phase in order to provide a simplified thrust value without throttle lag. When trimming is complete the engine will go to the Off phase, unless the value FGEngine::Running has been previously set to true, in which case the engine will go to the Run phase. Once an engine is in the Off phase the full starting procedure (or airstart) must be used to get it running.
Ignition is assumed to be on anytime the Cutoff control is set to false, therefore a seperate ignition system is not modeled.
<turbine_engine name="{string}"> <milthrust unit="{LBS | N}"> {number} </milthrust> <maxthrust unit="{LBS | N}"> {number} </maxthrust> <bypassratio> {number} </bypassratio> <bleed> {number} </bleed> <tsfc> {number} </tsfc> <atsfc> {number} </atsfc> <idlen1> {number} </idlen1> <idlen2> {number} </idlen2> <n1spinup> {number} </n1spinup> <n2spinup> {number} </n2spinup> <maxn1> {number} </maxn1> <maxn2> {number} </maxn2> <augmented> {0 | 1} </augmented> <augmethod> {0 | 1 | 2} </augmethod> <injected> {0 | 1} </injected> <injection-time> {number} </injection-time> </turbine_engine>
milthrust - Maximum thrust, static, at sea level.
maxthrust - Afterburning thrust, static, at sea level.
bypassratio - Ratio of bypass air flow to core air flow.
bleed - Thrust reduction factor due to losses (0.0 to 1.0).
tsfc - Thrust-specific fuel consumption at cruise, lbm/hr/lbf
atsfc - Afterburning TSFC, lbm/hr/lbf
idlen1 - Fan rotor rpm (% of max) at idle
idlen2 - Core rotor rpm (% of max) at idle
n1spinup - Fan rotor rpm starter acceleration (default 1.0)
n2spinup - Core rotor rpm starter acceleration (default 3.0)
maxn1 - Fan rotor rpm (% of max) at full throttle
maxn2 - Core rotor rpm (% of max) at full throttle
augmented
0 = afterburner not installed
1 = afterburner installed
augmethod
0 = afterburner activated by property /engines/engine[n]/augmentation
1 = afterburner activated by pushing throttle above 99% position
2 = throttle range is expanded in the FCS, and values above 1.0 are afterburner range
injected
0 = Water injection not installed
1 = Water injection installed
injection-time - Time, in seconds, of water injection duration
Bypass ratio is used only to estimate engine acceleration time. The
effect of bypass ratio on engine efficiency is already included in
the TSFC value. Feel free to set this parameter (even for turbojets) to
whatever value gives a desired spool-up rate. Default value is 0. The bleed factor is multiplied by thrust to give a resulting thrust
after losses. This can represent losses due to bleed, or any other cause.
Default value is 0. A common value would be 0.04. Nozzle position, for variable area exhaust nozzles, is provided for users
needing to drive a nozzle gauge or animate a virtual nozzle.This model can only be used with the "direct" thruster. See the file: /engine/direct.xml
Definition at line 160 of file FGTurbine.h.
| Executive | pointer to executive structure |
| el | pointer to the XML element representing the turbine engine |
| engine_number | engine number |
Definition at line 60 of file FGTurbine.cpp.
References FGTurbine::ResetToIC().
: FGEngine(exec, el, engine_number, input)
{
Type = etTurbine;
MilThrust = MaxThrust = 10000.0;
TSFC = 0.8;
ATSFC = 1.7;
IdleN1 = 30.0;
IdleN2 = 60.0;
MaxN1 = MaxN2 = 100.0;
Augmented = AugMethod = Injected = 0;
BypassRatio = BleedDemand = 0.0;
IdleThrustLookup = MilThrustLookup = MaxThrustLookup = InjectionLookup = 0;
N1_spinup = 1.0; N2_spinup = 3.0;
EPR = 1.0;
ResetToIC();
Load(exec, el);
Debug(0);
}
Here is the call graph for this function:| double CalcFuelNeed | ( | void | ) | [virtual] |
It is also turned from a rate into an actual amount (pounds) by multiplying it by the delta T and the rate.
Reimplemented from FGEngine.
Definition at line 383 of file FGTurbine.cpp.
{
FuelFlowRate = FuelFlow_pph / 3600.0; // Calculates flow in lbs/sec from lbs/hr
FuelExpended = FuelFlowRate * in.TotalDeltaT; // Calculates fuel expended in this time step
if (!Starved) FuelUsedLbs += FuelExpended;
return FuelExpended;
}
| void Calculate | ( | void | ) | [virtual] |
Implements FGEngine.
Definition at line 118 of file FGTurbine.cpp.
{
double thrust;
RunPreFunctions();
ThrottlePos = in.ThrottlePos[EngineNumber];
TAT = (in.TotalTempearture - 491.69) * 0.5555556;
if (ThrottlePos > 1.0) {
AugmentCmd = ThrottlePos - 1.0;
ThrottlePos -= AugmentCmd;
} else {
AugmentCmd = 0.0;
}
// When trimming is finished check if user wants engine OFF or RUNNING
if ((phase == tpTrim) && (in.TotalDeltaT > 0)) {
if (Running && !Starved) {
phase = tpRun;
N2 = IdleN2 + ThrottlePos * N2_factor;
N1 = IdleN1 + ThrottlePos * N1_factor;
OilTemp_degK = 366.0;
Cutoff = false;
} else {
phase = tpOff;
Cutoff = true;
EGT_degC = TAT;
}
}
if (!Running && Cutoff && Starter) {
if (phase == tpOff) phase = tpSpinUp;
}
// start
if ((Starter == true) || (in.qbar > 30.0)) {
if (!Running && !Cutoff && (N2 > 15.0)) phase = tpStart;
}
if (Cutoff && (phase != tpSpinUp)) phase = tpOff;
if (in.TotalDeltaT == 0) phase = tpTrim;
if (Starved) phase = tpOff;
if (Stalled) phase = tpStall;
if (Seized) phase = tpSeize;
switch (phase) {
case tpOff: thrust = Off(); break;
case tpRun: thrust = Run(); break;
case tpSpinUp: thrust = SpinUp(); break;
case tpStart: thrust = Start(); break;
case tpStall: thrust = Stall(); break;
case tpSeize: thrust = Seize(); break;
case tpTrim: thrust = Trim(); break;
default: thrust = Off();
}
Thruster->Calculate(thrust); // allow thruster to modify thrust (i.e. reversing)
RunPostFunctions();
}
| double Seek | ( | double * | var, |
| double | target, | ||
| double | accel, | ||
| double | decel | ||
| ) |
Used to control the rate at which values are allowed to change.
| var | a pointer to a variable of type double |
| target | the desired (target) value |
| accel | the rate, per second, the value may increase |
| decel | the rate, per second, the value may decrease |
Definition at line 402 of file FGTurbine.cpp.
{
double v = *var;
if (v > target) {
v -= in.TotalDeltaT * decel;
if (v < target) v = target;
} else if (v < target) {
v += in.TotalDeltaT * accel;
if (v > target) v = target;
}
return v;
}