From 4ccef76fc4ffae48ff58d81eb28692580dc7bd88 Mon Sep 17 00:00:00 2001 From: jmt Date: Tue, 22 Sep 2009 15:56:45 +0000 Subject: [PATCH] Auto-brake enhancements: support for JSBSim aircraft, Airbus-style combined MAX/RTO modes, correct disengage behaviour and more disengage conditions. --- src/Autopilot/autobrake.cxx | 49 ++++++++++++++++++++++++++++++++++--- src/Autopilot/autobrake.hxx | 8 +++++- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/Autopilot/autobrake.cxx b/src/Autopilot/autobrake.cxx index 0eae0fe1b..053c55e89 100644 --- a/src/Autopilot/autobrake.cxx +++ b/src/Autopilot/autobrake.cxx @@ -39,6 +39,7 @@ FGAutoBrake::FGAutoBrake() : // default config, close to Boeing 747-400 / 777 values _configNumSteps = 4; _configRTOStep = -1; + _configDisengageStep = 0; _configMaxDecel = 11; // ft-sec-sec _configRTODecel = 11; // ft-sec-sec _configRTOSpeed = 85; // kts @@ -73,10 +74,12 @@ void FGAutoBrake::init() SGPropertyNode_ptr config = _root->getChild("config", 0, true); config->tie("num-steps", SGRawValuePointer(&_configNumSteps)); config->tie("rto-step", SGRawValuePointer(&_configRTOStep)); + config->tie("disengage-step", SGRawValuePointer(&_configDisengageStep)); config->tie("rto-decel-fts-sec", SGRawValuePointer(&_configRTODecel)); config->tie("max-decel-fts-sec", SGRawValuePointer(&_configMaxDecel)); config->tie("rto-engage-kts", SGRawValuePointer(&_configRTOSpeed)); + // outputs _root->tie("target-decel-fts-sec", SGRawValueMethods(*this, &FGAutoBrake::getTargetDecel)); @@ -170,6 +173,12 @@ void FGAutoBrake::updateEngaged(double dt) return; } + if (!throttlesAtIdle()) { + SG_LOG(SG_AUTOPILOT, SG_INFO, "auto-brake, throttles not at idle, disengaing"); + disengage(); + return; + } + // update the target deceleration; note step can be changed while engaged if (_rto) { _targetDecel = _configRTODecel; @@ -189,6 +198,11 @@ bool FGAutoBrake::shouldEngage() return false; } + + if (!throttlesAtIdle()) { + return false; + } + SG_LOG(SG_AUTOPILOT, SG_INFO, "Autobrake, should enage"); return true; } @@ -205,10 +219,22 @@ bool FGAutoBrake::shouldEngageRTO() } if (!_weightOnWheelsNode->getBoolValue()) { + if (airborne()) { + SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: RTO, airbone, disengaging"); + _rtoArmed = false; + _armed = false; + _step = _configDisengageStep; + } + return false; } - return throttlesAtIdle(); + if (throttlesAtIdle()) { + SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: RTO, throttles at idle, will engage"); + return true; + } else { + return false; + } } else { // RTO arming case if (speed > _configRTOSpeed) { @@ -228,12 +254,19 @@ void FGAutoBrake::disengage() SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: disengage"); _engaged = false; + _fcsBrakeControl = 0.0; _armed = false; _rtoArmed = false; _targetDecel = 0.0; + _step = _configDisengageStep; } -bool FGAutoBrake::throttlesAtIdle() +bool FGAutoBrake::airborne() const +{ + return !_weightOnWheelsNode->getBoolValue(); +} + +bool FGAutoBrake::throttlesAtIdle() const { SGPropertyNode_ptr e; const double IDLE_THROTTLE = 0.05; // 5% margin for idle setting @@ -244,7 +277,6 @@ bool FGAutoBrake::throttlesAtIdle() } } // of engines iteration - SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: throttles at idle"); return true; } @@ -263,7 +295,16 @@ void FGAutoBrake::setRTO(bool aRTO) if (aRTO) { // ensure we meet RTO selection criteria: if (!_weightOnWheelsNode->getBoolValue()) { - SG_LOG(SG_AUTOPILOT, SG_WARN, "auto-brake: cannot select RTO mode, no weight on wheels"); + // some systems combine RTO with a standard step, selecting RTO if on + // the ground. Handle that case by setting _rto = false, and letting + // setStep() do the rest of the work as normal. + if ((_configRTOStep > 0) && (_configRTOStep <= _configNumSteps)) { + // RTO is combined with a normal step, select that + } else { + SG_LOG(SG_AUTOPILOT, SG_WARN, "auto-brake: cannot select RTO mode, no weight on wheels"); + } + + _rto = false; return; } diff --git a/src/Autopilot/autobrake.hxx b/src/Autopilot/autobrake.hxx index 0eb7497e7..4dbf7555d 100644 --- a/src/Autopilot/autobrake.hxx +++ b/src/Autopilot/autobrake.hxx @@ -54,7 +54,12 @@ private: * Helper to determine if all throttles are at idle * (or have reverse thrust engaged) */ - bool throttlesAtIdle(); + bool throttlesAtIdle() const; + + /** + * Helper to determine if we're airbone, i.e weight off all wheels + */ + bool airborne() const; // accessors, mostly for SGRawValueMethods use void setArmed(bool aArmed); @@ -94,6 +99,7 @@ private: int _configNumSteps; int _configRTOStep; + int _configDisengageStep; double _configMaxDecel; ///< deceleration (in ft-sec^2) corresponding to step=numSteps double _configRTODecel; ///< deceleration (in ft-sec^2) to use in RTO mode double _configRTOSpeed; ///< speed (in kts) for RTO mode to arm -- 2.39.5