Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(press): excess residual pressure warning with adirs off #8690

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: residual pressure warning direct signal
  • Loading branch information
mjuhe committed Jun 21, 2024
commit 1f290e8c908ba1b607d293466a5d705d825df03b
3 changes: 1 addition & 2 deletions fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -2841,7 +2841,7 @@ In the variables below, {number} should be replaced with one item in the set: {
|:---:|:----------------------------------------------------:|
| 11 | System in control |
| 12 | System status - fail |
| 13 | Excessive residual pressure - warn |
| 13 | Not used |
| 14 | Excessive cabin altitude - warn |
| 15 | Low differential pressure - warn |
| 16 | Preplanned desc inf - too quick * |
Expand Down Expand Up @@ -2916,7 +2916,6 @@ In the variables below, {number} should be replaced with one item in the set: {

- A32NX_PRESS_EXCESS_RESIDUAL_PR
- Bool
- **Deprecated in A32NX**
- True when FWC condition for "EXCES RESIDUAL PR" is met

- A32NX_PRESS_LOW_DIFF_PR
Expand Down
13 changes: 11 additions & 2 deletions fbw-a32nx/src/systems/instruments/src/EWD/PseudoFWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ export class PseudoFWC {

private readonly excessPressure = Subject.create(false);

private readonly excessResidualPrConfirm = new NXLogicConfirmNode(12);
private readonly enginesOffAndOnGroundSignal = new NXLogicConfirmNode(7);

private readonly excessResidualPrConfirm = new NXLogicConfirmNode(5);

private readonly excessResidualPr = Subject.create(false);

Expand Down Expand Up @@ -1360,7 +1362,14 @@ export class PseudoFWC {

const manExcessAltitude = SimVar.GetSimVarValue('L:A32NX_PRESS_MAN_EXCESSIVE_CABIN_ALTITUDE', 'bool');
this.excessPressure.set(activeCpc.bitValueOr(14, false) || manExcessAltitude);
this.excessResidualPr.set(this.excessResidualPrConfirm.write(activeCpc.bitValueOr(13, false), deltaTime));

const eng1And2NotRunning = !this.engine1CoreAtOrAboveMinIdle.get() && !this.engine2CoreAtOrAboveMinIdle.get();
this.enginesOffAndOnGroundSignal.write(this.aircraftOnGround.get() && eng1And2NotRunning, deltaTime);
const residualPressureSignal = SimVar.GetSimVarValue('L:A32NX_PRESS_EXCESS_RESIDUAL_PR', 'bool');
this.excessResidualPr.set(
this.excessResidualPrConfirm.write(this.enginesOffAndOnGroundSignal.read() && residualPressureSignal, deltaTime),
);

this.lowDiffPress.set(activeCpc.bitValueOr(15, false));

this.pressurizationAuto.set(SimVar.GetSimVarValue('L:A32NX_OVHD_PRESS_MODE_SEL_PB_IS_AUTO', 'bool'));
Expand Down
38 changes: 34 additions & 4 deletions fbw-a32nx/src/wasm/systems/a320_systems/src/air_conditioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ use systems::{

use std::time::Duration;
use uom::si::{
f64::*, pressure::hectopascal, ratio::percent, thermodynamic_temperature::degree_celsius,
velocity::knot, volume::cubic_meter, volume_rate::liter_per_second,
f64::*,
pressure::{hectopascal, psi},
ratio::percent,
thermodynamic_temperature::degree_celsius,
velocity::knot,
volume::cubic_meter,
volume_rate::liter_per_second,
};

use crate::payload::A320Pax;
Expand Down Expand Up @@ -692,8 +697,11 @@ impl<const ZONES: usize> SimulationElement for A320AirConditioningSystemOverhead
}

struct A320PressurizationSystem {
is_excessive_residual_pressure_id: VariableIdentifier,

cpc: [CabinPressureController<A320PressurizationConstants>; 2],
cpc_interface: [PressurizationSystemInterfaceUnit; 2],
is_excessive_residual_pressure: bool,
outflow_valve: [OutflowValve; 1], // Array to prepare for more than 1 outflow valve in A380
safety_valve: SafetyValve,
safety_valve_signal: SafetyValveSignal<A320PressurizationConstants>,
Expand All @@ -709,6 +717,9 @@ impl A320PressurizationSystem {
let active = 2 - (random % 2);

Self {
is_excessive_residual_pressure_id: context
.get_identifier("PRESS_EXCESS_RESIDUAL_PR".to_owned()),

cpc: [
CabinPressureController::new(context, CpcId::Cpc1),
CabinPressureController::new(context, CpcId::Cpc2),
Expand All @@ -717,6 +728,7 @@ impl A320PressurizationSystem {
PressurizationSystemInterfaceUnit::new(context, 1),
PressurizationSystemInterfaceUnit::new(context, 2),
],
is_excessive_residual_pressure: false,
// Sub-buses 206PP, 401PP (auto) and 301PP (manual)
outflow_valve: [OutflowValve::new(
vec![
Expand Down Expand Up @@ -813,6 +825,9 @@ impl A320PressurizationSystem {
self.cpc.iter().all(|controller| controller.has_fault())
&& !self.pressurization_overhead.is_in_man_mode(),
);

self.is_excessive_residual_pressure =
self.is_excessive_residual_pressure(context, cabin_simulation);
}

fn switch_active_system(&mut self) {
Expand Down Expand Up @@ -841,6 +856,16 @@ impl A320PressurizationSystem {
.for_each(|c| c.update_ambient_conditions(context, adirs));
}

fn is_excessive_residual_pressure(
&self,
context: &UpdateContext,
cabin_simulation: &impl CabinSimulation,
) -> bool {
// This signal comes from a dedicated pressure switch and is transmitted directly to the FWC
(cabin_simulation.cabin_pressure() - context.ambient_pressure())
> Pressure::new::<psi>(A320PressurizationConstants::EXCESSIVE_RESIDUAL_PRESSURE_WARNING)
}

fn outflow_valve_open_amount(&self, ofv_id: usize) -> Ratio {
self.outflow_valve[ofv_id].open_amount()
}
Expand All @@ -861,6 +886,13 @@ impl CabinAltitude for A320PressurizationSystem {
}

impl SimulationElement for A320PressurizationSystem {
fn write(&self, writer: &mut SimulatorWriter) {
writer.write(
&self.is_excessive_residual_pressure_id,
self.is_excessive_residual_pressure,
);
}

fn accept<T: SimulationElementVisitor>(&mut self, visitor: &mut T) {
accept_iterable!(self.cpc, visitor);
accept_iterable!(self.cpc_interface, visitor);
Expand Down Expand Up @@ -896,8 +928,6 @@ impl PressurizationSystemInterfaceUnit {

self.discrete_word.set_bit(11, cpc.is_active());
self.discrete_word.set_bit(12, cpc.has_fault());
self.discrete_word
.set_bit(13, cpc.is_excessive_residual_pressure());
self.discrete_word.set_bit(14, cpc.is_excessive_alt());
self.discrete_word.set_bit(15, cpc.is_low_diff_pressure());
self.discrete_word
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,6 @@ impl<C: PressurizationConstants> CabinPressureController<C> {
&& self.cabin_alt > (self.landing_elevation + Length::new::<foot>(1000.))
}

pub fn is_excessive_residual_pressure(&self) -> bool {
// Only emit the signal if delta pressure information is valid
self.cabin_delta_p() > Pressure::new::<psi>(C::EXCESSIVE_RESIDUAL_PRESSURE_WARNING)
&& self.adirs_data_is_valid
}

pub fn is_low_diff_pressure(&self) -> bool {
// Only emit the signal if delta pressure information is valid
self.cabin_delta_p() < Pressure::new::<psi>(C::LOW_DIFFERENTIAL_PRESSURE_WARNING)
Expand Down