1 #ifndef _JET_HPP
2 #define _JET_HPP
3 
4 #include "Thruster.hpp"
5 
6 namespace yasim {
7 
8 class Jet : public Thruster {
9 public:
10     Jet();
11 
getJet()12     virtual Jet* getJet() { return this; }
13 
14     void setMaxThrust(float thrust, float afterburner=0);
setVMax(float spd)15     void setVMax(float spd) { _vMax = spd; };
setTSFC(float tsfc)16     void setTSFC(float tsfc) { _tsfc = tsfc; };
setATSFC(float atsfc)17     void setATSFC(float atsfc) { _atsfc = atsfc; };
18     void setRPMs(float idleN1, float maxN1, float idleN2, float maxN2);
setEGT(float takeoffEGT)19     void setEGT(float takeoffEGT) { _egt0 = takeoffEGT; };
setEPR(float takeoffEPR)20     void setEPR(float takeoffEPR) { _epr0 = takeoffEPR; };
setVectorAngle(float angle)21     void setVectorAngle(float angle) { _maxRot = angle; };
22 
23     // The time it takes the engine to reach 90% thrust from idle
24     void setSpooling(float time);
25 
26     // Sets the reheat control
27     void setReheat(float reheat);
28 
29     // Sets the thrust vector control (0-1)
30     void setRotation(float rot);
31 
32     // Thrust reverser control.
setReverse(bool reverse)33     void setReverse(bool reverse) { _reverseThrust = reverse; }
34 
35     // Thrust reverser effectiveness.
setReverseThrust(float eff)36     void setReverseThrust(float eff) { _reverseEff = eff; }
37 
38     float getN1();
39     float getN2();
getEPR() const40     float getEPR() const { return _epr; };
41     float getEGT();
42 
43     // Normalized "performance" number.  Used for fuzzy numbers in FGFDM
getPerfNorm()44     float getPerfNorm() { return (_n1 - _n1Min) / (_n1Max - _n1Min); }
45 
46     // From Thruster:
isRunning()47     virtual bool isRunning() { return _running; };
isCranking()48     virtual bool isCranking() { return _cranking; };
49     virtual void getThrust(float* out);
50     virtual void getTorque(float* out);
51     virtual void getGyro(float* out);
52     virtual float getFuelFlow();
53     virtual void integrate(float dt);
54     virtual void stabilize();
55 
56 private:
57     float _reheat;
58     bool _reverseThrust;
59 
60     float _maxThrust; // Max dry thrust at sea level
61     float _abThrust; // Max ab component of thrust at sea level
62     float _abFactor;  // Afterburner thrust multiplier
63 
64     float _maxRot;
65     float _rotControl;
66 
67     float _decay;  // time constant for the exponential integration
68     float _vMax;   // speed at which thrust is zero
69     float _epr0;   // EPR at takeoff thrust
70     float _tsfc;   // TSFC ((lb/hr)/lb) at takeoff thrust and zero airspeed
71     float _atsfc;   // Afterburning TSFC ((lb/hr)/lb) at takeoff thrust and zero airspeed (total TSFC)
72     float _abFuelFactor;   // Afterburner Only Fuel Factor at takeoff thrust and zero airspeed
73     float _egt0;   // EGT at takeoff thrust
74     float _n1Min;  // N1 at ground idle
75     float _n1Max;  // N1 at takeoff thrust
76     float _n2Min;  // N2 at ground idle
77     float _n2Max;  // N2 at takeoff thrust
78     float _reverseEff; // Thrust reverser effectiveness (fraction)
79 
80     bool _running;   // Is the engine running?
81     bool _cranking;  // Is the engine cranking?
82     float _thrust;   // Current thrust
83     float _epr;      // Current EPR
84     float _n1;       // Current UNCORRECTED N1 (percent)
85     float _n2;       // Current UNCORRECTED N2 (percent)
86     float _fuelFlow; // Current UNCORRECTED fuel flow (kg/s)
87     float _egt;      // Current UNCORRECTED EGT (kelvin)
88 
89     float _tempCorrect; // Intake temp / std temp (273 K)
90     float _pressureCorrect; // Intake pressure / std pressure
91 };
92 
93 }; // namespace yasim
94 #endif // _JET_HPP
95