2003-03-23 15:12:35 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
Header: FGSimTurbine.h
|
|
|
|
Author: David Culp
|
|
|
|
Date started: 03/11/2003
|
|
|
|
|
David Culp:
Here's a new FGSimTurbine module. Changes are:
1. Adds starting and stopping functionality
2. Calculate() now calls other functions, based on the engine's state, which gives more readable code.
Until now turbine engines were always running as long as fuel was available. With this new module the engine defaults to OFF. To start with the engine running, the variable FGEngine::Running must be set to true at sim startup. In FlightGear this is done with --prop:/engines/engine[n]/running=true.
To start the engine (on the ground), first set the starter to ON, i.e. FGEngine::Starter is set to true. In FlightGear this is done by toggling /controls/engines/engine[n]/starter to TRUE. Note that the current FlightGear key binding will not work, as it causes the starter to quit when the key is released. A new key binding is needed, without the mod-up.
When N2 reaches 15% or greater, place the fuel cutoff control to FALSE. This is FGEngine::Cutoff. In FlightGear this is done with /controls/engines/engine[n]/cutoff set to FALSE. The engine will then accelerate to idle. Upon reaching idle, the starter is automatically turned off, and the engine is running. There is presently no FlightGear key binding for the fuel cutoff switch.
To shut off the engine, place the fuel cutoff control to TRUE.
If you shut down the engine in flight it will windmill. To airstart you will need at least 15% N2, just as with a ground start. When you have enough N2, place the cutoff control to FALSE and the engine will restart. Note that if you can't get enough N2 by speeding up, you can get it by using the starter.
The reverser still works, and is controlled in FlightGear with /controls/engines/engine[n]/reverser. With the reverser control on (TRUE), the engine will produce negative thrust in proportion to throttle position, i.e. to get more reverse thrust, increase throttle.
2003-09-23 09:24:36 +00:00
|
|
|
------------- Copyright (C) 2003 David Culp (davidculp2@comcast.net)----------
|
2003-03-23 15:12:35 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
2003-10-19 09:48:44 +00:00
|
|
|
03/11/2003 DPC Created, based on FGTurbine
|
|
|
|
09/22/2003 DPC Added starting, stopping, new framework
|
2003-03-23 15:12:35 +00:00
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
COMMENTS, REFERENCES, and NOTES
|
2003-10-19 09:48:44 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2003-10-19 09:48:44 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2003-03-23 15:12:35 +00:00
|
|
|
SENTRY
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
#ifndef FGSIMTURBINE_H
|
|
|
|
#define FGSIMTURBINE_H
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
INCLUDES
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "FGEngine.h"
|
|
|
|
#include "FGConfigFile.h"
|
|
|
|
#include "FGCoefficient.h"
|
|
|
|
|
|
|
|
#define ID_SIMTURBINE "$Id$"
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2003-10-19 09:48:44 +00:00
|
|
|
FORWARD DECLARATIONS
|
2003-03-23 15:12:35 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
namespace JSBSim {
|
|
|
|
|
2003-10-19 09:48:44 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DOCUMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
/** This class models a turbine engine. 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.
|
|
|
|
<P>
|
|
|
|
-STARTING (on ground):
|
|
|
|
-# Set the control FGEngine::Starter to true. The engine will spin up to
|
|
|
|
a maximum of about %25 N2 (%5.2 N1). This simulates the action of a
|
|
|
|
pneumatic starter.
|
|
|
|
-# After reaching %15 N2 set the control FGEngine::Cutoff to false. If fuel
|
|
|
|
is available the engine will now accelerate to idle. The starter will
|
|
|
|
automatically be set to false after the start cycle.
|
|
|
|
<P>
|
|
|
|
-STARTING (in air):
|
|
|
|
-# Increase speed to obtain a minimum of %15 N2. If this is not possible,
|
|
|
|
the starter may be used to assist.
|
|
|
|
-# Place the control FGEngine::Cutoff to false.
|
|
|
|
<P>
|
|
|
|
Ignition is assumed to be on anytime the Cutoff control is set to false,
|
|
|
|
therefore a seperate ignition system is not modeled.
|
|
|
|
|
|
|
|
@author David P. Culp
|
|
|
|
@version $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DECLARATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
2003-03-23 15:12:35 +00:00
|
|
|
class FGSimTurbine : public FGEngine
|
|
|
|
{
|
|
|
|
public:
|
2003-10-19 09:48:44 +00:00
|
|
|
/** Constructor
|
|
|
|
@param exec pointer to executive structure
|
|
|
|
@param Eng_Cfg pointer to engine config file instance */
|
2003-03-23 15:12:35 +00:00
|
|
|
FGSimTurbine(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
2003-10-19 09:48:44 +00:00
|
|
|
/// Destructor
|
2003-03-23 15:12:35 +00:00
|
|
|
~FGSimTurbine();
|
|
|
|
|
David Culp:
Here's a new FGSimTurbine module. Changes are:
1. Adds starting and stopping functionality
2. Calculate() now calls other functions, based on the engine's state, which gives more readable code.
Until now turbine engines were always running as long as fuel was available. With this new module the engine defaults to OFF. To start with the engine running, the variable FGEngine::Running must be set to true at sim startup. In FlightGear this is done with --prop:/engines/engine[n]/running=true.
To start the engine (on the ground), first set the starter to ON, i.e. FGEngine::Starter is set to true. In FlightGear this is done by toggling /controls/engines/engine[n]/starter to TRUE. Note that the current FlightGear key binding will not work, as it causes the starter to quit when the key is released. A new key binding is needed, without the mod-up.
When N2 reaches 15% or greater, place the fuel cutoff control to FALSE. This is FGEngine::Cutoff. In FlightGear this is done with /controls/engines/engine[n]/cutoff set to FALSE. The engine will then accelerate to idle. Upon reaching idle, the starter is automatically turned off, and the engine is running. There is presently no FlightGear key binding for the fuel cutoff switch.
To shut off the engine, place the fuel cutoff control to TRUE.
If you shut down the engine in flight it will windmill. To airstart you will need at least 15% N2, just as with a ground start. When you have enough N2, place the cutoff control to FALSE and the engine will restart. Note that if you can't get enough N2 by speeding up, you can get it by using the starter.
The reverser still works, and is controlled in FlightGear with /controls/engines/engine[n]/reverser. With the reverser control on (TRUE), the engine will produce negative thrust in proportion to throttle position, i.e. to get more reverse thrust, increase throttle.
2003-09-23 09:24:36 +00:00
|
|
|
enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
|
|
|
|
|
2003-03-23 15:12:35 +00:00
|
|
|
double Calculate(double);
|
|
|
|
double CalcFuelNeed(void);
|
2003-07-26 09:12:54 +00:00
|
|
|
double GetPowerAvailable(void);
|
David Culp:
Here's a new FGSimTurbine module. Changes are:
1. Adds starting and stopping functionality
2. Calculate() now calls other functions, based on the engine's state, which gives more readable code.
Until now turbine engines were always running as long as fuel was available. With this new module the engine defaults to OFF. To start with the engine running, the variable FGEngine::Running must be set to true at sim startup. In FlightGear this is done with --prop:/engines/engine[n]/running=true.
To start the engine (on the ground), first set the starter to ON, i.e. FGEngine::Starter is set to true. In FlightGear this is done by toggling /controls/engines/engine[n]/starter to TRUE. Note that the current FlightGear key binding will not work, as it causes the starter to quit when the key is released. A new key binding is needed, without the mod-up.
When N2 reaches 15% or greater, place the fuel cutoff control to FALSE. This is FGEngine::Cutoff. In FlightGear this is done with /controls/engines/engine[n]/cutoff set to FALSE. The engine will then accelerate to idle. Upon reaching idle, the starter is automatically turned off, and the engine is running. There is presently no FlightGear key binding for the fuel cutoff switch.
To shut off the engine, place the fuel cutoff control to TRUE.
If you shut down the engine in flight it will windmill. To airstart you will need at least 15% N2, just as with a ground start. When you have enough N2, place the cutoff control to FALSE and the engine will restart. Note that if you can't get enough N2 by speeding up, you can get it by using the starter.
The reverser still works, and is controlled in FlightGear with /controls/engines/engine[n]/reverser. With the reverser control on (TRUE), the engine will produce negative thrust in proportion to throttle position, i.e. to get more reverse thrust, increase throttle.
2003-09-23 09:24:36 +00:00
|
|
|
double Seek(double* var, double target, double accel, double decel);
|
|
|
|
|
|
|
|
virtual phaseType GetPhase(void) { return phase; }
|
|
|
|
virtual void SetPhase( phaseType p ) { phase = p; }
|
|
|
|
|
|
|
|
virtual bool GetOvertemp(void) { return Overtemp; }
|
|
|
|
virtual bool GetFire(void) { return Fire; }
|
2003-03-23 15:12:35 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
typedef vector<FGCoefficient*> CoeffArray;
|
|
|
|
CoeffArray ThrustTables;
|
|
|
|
|
2003-10-19 09:48:44 +00:00
|
|
|
phaseType phase; ///< Operating mode, or "phase"
|
|
|
|
double MilThrust; ///< Maximum Unaugmented Thrust, static @ S.L. (lbf)
|
|
|
|
double MaxThrust; ///< Maximum Augmented Thrust, static @ S.L. (lbf)
|
|
|
|
double BypassRatio; ///< Bypass Ratio
|
|
|
|
double TSFC; ///< Thrust Specific Fuel Consumption (lbm/hr/lbf)
|
|
|
|
double ATSFC; ///< Augmented TSFC (lbm/hr/lbf)
|
|
|
|
double IdleN1; ///< Idle N1
|
|
|
|
double IdleN2; ///< Idle N2
|
|
|
|
double MaxN1; ///< N1 at 100% throttle
|
|
|
|
double MaxN2; ///< N2 at 100% throttle
|
|
|
|
double IdleFF; ///< Idle Fuel Flow (lbm/hr)
|
|
|
|
double delay; ///< Inverse spool-up time from idle to 100% (seconds)
|
|
|
|
double dt; ///< Simulator time slice
|
|
|
|
double N1_factor; ///< factor to tie N1 and throttle
|
|
|
|
double N2_factor; ///< factor to tie N2 and throttle
|
|
|
|
double ThrottleCmd; ///< FCS-supplied throttle position
|
|
|
|
double TAT; ///< total air temperature (deg C)
|
|
|
|
bool Stalled; ///< true if engine is compressor-stalled
|
|
|
|
bool Seized; ///< true if inner spool is seized
|
|
|
|
bool Overtemp; ///< true if EGT exceeds limits
|
|
|
|
bool Fire; ///< true if engine fire detected
|
|
|
|
int Augmented; ///< = 1 if augmentation installed
|
|
|
|
int Injected; ///< = 1 if water injection installed
|
|
|
|
int AugMethod; ///< = 0 if using property /engine[n]/augmentation
|
|
|
|
///< = 1 if using last 1% of throttle movement
|
2003-03-23 15:12:35 +00:00
|
|
|
|
David Culp:
Here's a new FGSimTurbine module. Changes are:
1. Adds starting and stopping functionality
2. Calculate() now calls other functions, based on the engine's state, which gives more readable code.
Until now turbine engines were always running as long as fuel was available. With this new module the engine defaults to OFF. To start with the engine running, the variable FGEngine::Running must be set to true at sim startup. In FlightGear this is done with --prop:/engines/engine[n]/running=true.
To start the engine (on the ground), first set the starter to ON, i.e. FGEngine::Starter is set to true. In FlightGear this is done by toggling /controls/engines/engine[n]/starter to TRUE. Note that the current FlightGear key binding will not work, as it causes the starter to quit when the key is released. A new key binding is needed, without the mod-up.
When N2 reaches 15% or greater, place the fuel cutoff control to FALSE. This is FGEngine::Cutoff. In FlightGear this is done with /controls/engines/engine[n]/cutoff set to FALSE. The engine will then accelerate to idle. Upon reaching idle, the starter is automatically turned off, and the engine is running. There is presently no FlightGear key binding for the fuel cutoff switch.
To shut off the engine, place the fuel cutoff control to TRUE.
If you shut down the engine in flight it will windmill. To airstart you will need at least 15% N2, just as with a ground start. When you have enough N2, place the cutoff control to FALSE and the engine will restart. Note that if you can't get enough N2 by speeding up, you can get it by using the starter.
The reverser still works, and is controlled in FlightGear with /controls/engines/engine[n]/reverser. With the reverser control on (TRUE), the engine will produce negative thrust in proportion to throttle position, i.e. to get more reverse thrust, increase throttle.
2003-09-23 09:24:36 +00:00
|
|
|
double Off(void);
|
|
|
|
double Run(void);
|
|
|
|
double SpinUp(void);
|
|
|
|
double Start(void);
|
|
|
|
double Stall(void);
|
|
|
|
double Seize(void);
|
|
|
|
double Trim(void);
|
|
|
|
|
2003-03-23 15:12:35 +00:00
|
|
|
void SetDefaults(void);
|
|
|
|
bool Load(FGConfigFile *ENG_cfg);
|
|
|
|
void Debug(int from);
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
#endif
|
|
|
|
|