Skip to content

Commit

Permalink
feat(athr/fadec): improved reverse thrust limit based on TOGA limit (#…
Browse files Browse the repository at this point in the history
…8565)

* feat(athr/fadec) improved reverse thrust limit based on TOGA limit
* feat(athr/fadec) tuned reverse thrust ratio and default thrust percentage from TOGA limit
* Slightly increased reverse thrust force based on feedback of stopping distances
* Update reverser_thrust.rs
* added reverse thrust factor based on indicated airspeed
* make linter happy

---------

Co-authored-by: donstim <[email protected]>
Co-authored-by: Saschl <[email protected]>
  • Loading branch information
3 people authored Apr 13, 2024
1 parent 229258a commit 46d43fc
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
1. [FWC] Implement non-cancellable master warning for overspeed and gear not down - @tracernz (Mike)
1. [EFB] Checklist restructure to add more capabilities and use json configs - @frankkopp (Frank Kopp)
1. [FLIGHTMODEL] Landing lights or RAT extended now have drag - @Crocket63 (crocket)
1. [ATHR/FADEC] Improved reverse thrust limit - @aguther (Andreas Guther)

## 0.11.0

Expand Down
4 changes: 2 additions & 2 deletions fbw-a32nx/docs/Configuration/ModelConfiguration.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

[autothrust]
; !! WARNING CHANGE AT YOUR OWN RISK !!
; sets the target N1 for full reverse
;thrust_limit_reverse = -45.0
; sets the target N1 in percentage of TOGA limit for full reverse
;thrust_limit_reverse_percentage_toga = 0.8

; !! WARNING CHANGE AT YOUR OWN RISK !!
; if enabled, thrust limits IDLE, CLB and TOGA are taken from local variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ minor = 0

[GENERALENGINEDATA]
engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop
min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser
min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser
master_ignition_switch = 0
starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air
max_contrail_temperature = -39.724
Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/systems/instruments/src/EWD/N1Limit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class N1Limit extends DisplayComponent<N1LimitProps> {
});

sub.on('autoThrustLimit').whenChanged().handle((l) => {
this.autoThrustLimit = l;
this.autoThrustLimit = Math.abs(l);
});

sub.on('thrustLimitType').whenChanged().handle((l) => {
Expand Down
11 changes: 6 additions & 5 deletions fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,11 @@ void FlyByWireInterface::loadConfiguration() {

// --------------------------------------------------------------------------
// load values - autothrust
autothrustThrustLimitReverse = INITypeConversion::getDouble(iniStructure, "AUTOTHRUST", "THRUST_LIMIT_REVERSE", -45.0);

// initialize local variable for reverse
idAutothrustThrustLimitREV->set(autothrustThrustLimitReverse);
autothrustThrustLimitReversePercentageToga =
INITypeConversion::getDouble(iniStructure, "AUTOTHRUST", "THRUST_LIMIT_REVERSE_PERCENTAGE_TOGA", 0.813);

// print configuration into console
std::cout << "WASM: AUTOTHRUST : THRUST_LIMIT_REVERSE = " << autothrustThrustLimitReverse << std::endl;
std::cout << "WASM: AUTOTHRUST : THRUST_LIMIT_REVERSE_PERCENTAGE_TOGA = " << autothrustThrustLimitReversePercentageToga << std::endl;

// --------------------------------------------------------------------------
// load values - flight controls
Expand Down Expand Up @@ -2407,6 +2405,9 @@ bool FlyByWireInterface::updateAutothrust(double sampleTime) {
idThrottlePosition3d_1->set(idThrottlePositionLookupTable3d.get(thrustLeverAngle_1->get()));
idThrottlePosition3d_2->set(idThrottlePositionLookupTable3d.get(thrustLeverAngle_2->get()));

// update reverser thrust limit
idAutothrustThrustLimitREV->set(idAutothrustThrustLimitTOGA->get() * autothrustThrustLimitReversePercentageToga);

// set client data if needed
if (!autoThrustEnabled || !autopilotStateMachineEnabled || !flyByWireEnabled) {
ClientDataLocalVariablesAutothrust ClientDataLocalVariablesAutothrust = {
Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/wasm/fbw_a320/src/FlyByWireInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class FlyByWireInterface {
bool wasPaused = false;
bool wasInSlew = false;

double autothrustThrustLimitReverse = -45;
double autothrustThrustLimitReversePercentageToga = 0.0;

bool flightDirectorConnectLatch_1 = false;
bool flightDirectorConnectLatch_2 = false;
Expand Down
4 changes: 2 additions & 2 deletions fbw-a32nx/src/wasm/fbw_a320/src/model/Autothrust_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ Autothrust::Parameters_Autothrust_T Autothrust::Autothrust_P{

0.0,

-20.0,
-100.0,

-2.0,

0.0,

-20.0,
-100.0,


{ 1.8, 1.8, 1.0, 1.2, 1.2 },
Expand Down
56 changes: 38 additions & 18 deletions fbw-common/src/wasm/systems/systems/src/engine/reverser_thrust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use uom::si::{
mass::kilogram,
ratio::{percent, ratio},
torque::newton_meter,
velocity::{foot_per_second, meter_per_second},
velocity::{foot_per_second, knot, meter_per_second},
};

use crate::{
Expand All @@ -29,37 +29,53 @@ impl ReverserThrust {
current_thrust: Force::default(),
}
}
fn update(&mut self, engine: &impl Engine, reverser_position: &impl ReverserPosition) {
self.current_thrust = if reverser_position.reverser_position().get::<ratio>()
> Self::MIN_REVERSER_POS
{
let current_thrust_force =
Force::new::<newton>(engine.net_thrust().get::<kilogram>() * 9.80665);

// Total net thrust with reverser will need to cancel out forward thrust generated by engine + added desired reverse thrust
(current_thrust_force
+ current_thrust_force * Self::reverse_thrust_ratio_from_n1(engine.corrected_n1()))
* reverser_position.reverser_position()
} else {
Force::default()
};
fn update(
&mut self,
engine: &impl Engine,
reverser_position: &impl ReverserPosition,
longitudinal_velocity: Velocity,
) {
self.current_thrust =
if reverser_position.reverser_position().get::<ratio>() > Self::MIN_REVERSER_POS {
let current_thrust_force =
Force::new::<newton>(engine.net_thrust().get::<kilogram>() * 9.80665);

// Total net thrust with reverser will need to cancel out forward thrust generated by engine + added desired reverse thrust
(current_thrust_force
+ current_thrust_force
* Self::reverse_thrust_ratio_from_n1(engine.corrected_n1())
* Self::reverse_thrust_ratio_longitudinal_velocity(longitudinal_velocity))
* reverser_position.reverser_position()
} else {
Force::default()
};
}

fn current_thrust(&self) -> Force {
self.current_thrust
}

fn reverse_thrust_ratio_from_n1(engine_n1: Ratio) -> Ratio {
let n1_breakpoints = [0., 15., 20., 50., 55.];
let n1_breakpoints = [0., 15., 20., 50., 55., 100.];

let reverse_thrust_ratio = [0., 0., 0.15, 0.4, 0.42];
let reverse_thrust_ratio = [0., 0., 0.04, 0.31, 0.31, 0.31];

Ratio::new::<ratio>(interpolation(
&n1_breakpoints,
&reverse_thrust_ratio,
engine_n1.get::<percent>(),
))
}

fn reverse_thrust_ratio_longitudinal_velocity(longitudinal_velocity: Velocity) -> Ratio {
let longitudinal_velocity_knots = longitudinal_velocity.get::<knot>();

if longitudinal_velocity_knots >= 0. {
Ratio::new::<ratio>(1.0)
} else {
Ratio::new::<ratio>((0.1151 * longitudinal_velocity_knots).exp())
}
}
}

pub struct ReverserForce {
Expand Down Expand Up @@ -98,7 +114,11 @@ impl ReverserForce {
reverser_position: &[impl ReverserPosition],
) {
for (engine_index, reverser) in self.reversers.iter_mut().enumerate() {
reverser.update(engine[engine_index], &reverser_position[engine_index]);
reverser.update(
engine[engine_index],
&reverser_position[engine_index],
Velocity::new::<meter_per_second>(context.local_velocity().to_ms_vector()[2]),
);
}

let total_force = self.reversers[0].current_thrust() + self.reversers[1].current_thrust();
Expand Down

0 comments on commit 46d43fc

Please sign in to comment.