Thrust reversers. Very simple implementation.
This commit is contained in:
parent
d3865a9bf9
commit
5a9c5d80c8
5 changed files with 20 additions and 4 deletions
|
@ -200,10 +200,11 @@ void ControlMap::applyControls(float dt)
|
|||
case FLAP0: ((Wing*)obj)->setFlap0(lval, rval); break;
|
||||
case FLAP1: ((Wing*)obj)->setFlap1(lval, rval); break;
|
||||
case SPOILER: ((Wing*)obj)->setSpoiler(lval, rval); break;
|
||||
case COLLECTIVE: ((Rotor*)obj)->setCollective(lval); break;
|
||||
case CYCLICAIL: ((Rotor*)obj)->setCyclicail(lval,rval); break;
|
||||
case CYCLICELE: ((Rotor*)obj)->setCyclicele(lval,rval); break;
|
||||
case COLLECTIVE: ((Rotor*)obj)->setCollective(lval); break;
|
||||
case CYCLICAIL: ((Rotor*)obj)->setCyclicail(lval,rval); break;
|
||||
case CYCLICELE: ((Rotor*)obj)->setCyclicele(lval,rval); break;
|
||||
case ROTORENGINEON: ((Rotor*)obj)->setEngineOn((int)lval); break;
|
||||
case REVERSE_THRUST: ((Jet*)obj)->setReverse(lval != 0); break;
|
||||
case BOOST:
|
||||
((Thruster*)obj)->getPistonEngine()->setBoost(lval);
|
||||
break;
|
||||
|
|
|
@ -14,7 +14,8 @@ public:
|
|||
BRAKE, STEER, EXTEND,
|
||||
INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
|
||||
BOOST, CASTERING, PROPPITCH,
|
||||
COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON};
|
||||
COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON,
|
||||
REVERSE_THRUST };
|
||||
|
||||
enum { OPT_SPLIT = 0x01,
|
||||
OPT_INVERT = 0x02,
|
||||
|
|
|
@ -159,6 +159,7 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts)
|
|||
j->setMaxThrust(attrf(a, "thrust") * LBS2N,
|
||||
attrf(a, "afterburner", 0) * LBS2N);
|
||||
j->setVectorAngle(attrf(a, "rotate", 0) * DEG2RAD);
|
||||
j->setReverseThrust(attrf(a, "reverse", 0.2));
|
||||
|
||||
float n1min = attrf(a, "n1-idle", 55);
|
||||
float n1max = attrf(a, "n1-max", 102);
|
||||
|
@ -680,6 +681,7 @@ int FGFDM::parseOutput(const char* name)
|
|||
if(eq(name, "CYCLICAIL")) return ControlMap::CYCLICAIL;
|
||||
if(eq(name, "CYCLICELE")) return ControlMap::CYCLICELE;
|
||||
if(eq(name, "ROTORENGINEON")) return ControlMap::ROTORENGINEON;
|
||||
if(eq(name, "REVERSE_THRUST")) return ControlMap::REVERSE_THRUST;
|
||||
SG_LOG(SG_FLIGHT,SG_ALERT,"Unrecognized control type '"
|
||||
<< name << "' in YASim aircraft description.");
|
||||
exit(1);
|
||||
|
|
|
@ -10,6 +10,7 @@ Jet::Jet()
|
|||
_reheat = 0;
|
||||
_rotControl = 0;
|
||||
_maxRot = 0;
|
||||
_reverseThrust = false;
|
||||
|
||||
// Initialize parameters for an early-ish subsonic turbojet. More
|
||||
// recent turbofans will typically have a lower vMax, epr0, and
|
||||
|
@ -193,6 +194,9 @@ void Jet::integrate(float dt)
|
|||
// 3.5 times as much
|
||||
// fuel per thrust unit
|
||||
_egt = T0 + beta*ibeta0 * (_egt0 - T0);
|
||||
|
||||
// Thrust reverse handling:
|
||||
if(_reverseThrust) _thrust *= -_reverseEff;
|
||||
}
|
||||
|
||||
bool Jet::isRunning()
|
||||
|
|
|
@ -28,6 +28,12 @@ public:
|
|||
// Sets the thrust vector control (0-1)
|
||||
void setRotation(float rot);
|
||||
|
||||
// Thrust reverser control.
|
||||
void setReverse(bool reverse) { _reverseThrust = reverse; }
|
||||
|
||||
// Thrust reverser effectiveness.
|
||||
void setReverseThrust(float eff) { _reverseEff = eff; }
|
||||
|
||||
float getN1();
|
||||
float getN2();
|
||||
float getEPR();
|
||||
|
@ -45,6 +51,7 @@ public:
|
|||
|
||||
private:
|
||||
float _reheat;
|
||||
bool _reverseThrust;
|
||||
|
||||
float _maxThrust; // Max dry thrust at sea level
|
||||
float _abFactor; // Afterburner thrust multiplier
|
||||
|
@ -61,6 +68,7 @@ private:
|
|||
float _n1Max; // N1 at takeoff thrust
|
||||
float _n2Min; // N2 at ground idle
|
||||
float _n2Max; // N2 at takeoff thrust
|
||||
float _reverseEff; // Thrust reverser effectiveness (fraction)
|
||||
|
||||
bool _running; // Is the engine running?
|
||||
bool _cranking; // Is the engine cranking?
|
||||
|
|
Loading…
Add table
Reference in a new issue