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

feat(APU): Add APU start motor failure #8260

Closed
wants to merge 14 commits into from
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## 0.12.0

1. [APU] Added APU start motor failure - @uX-Pizza (pizza187)
1. [EFB/ATSU] Added NOAA (aviationweather.gov) as a METAR source - @tracernz (Mike)
1. [EFB] Fixed the main page and landing calculator to use the selected METAR source - @tracernz (Mike)
1. [FMS] Improve layout of PERF CLB, PERF CRZ and PERF DES pages according to H3 - @BlueberryKing (BlueberryKing)
Expand Down
2 changes: 2 additions & 0 deletions fbw-a32nx/src/systems/failures/src/a320.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@ export const A320Failure = Object.freeze({

RadioAltimeter1: 34000,
RadioAltimeter2: 34001,

ApuStartMotor: 49000,
});
2 changes: 2 additions & 0 deletions fbw-a32nx/src/systems/instruments/src/Common/EWDMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ const EWDMessages = {
'340023502': '\x1b<2m -VFE...............215',
'340024001': '\x1b<2m\x1b4mOVERSPEED\x1bm',
'340024002': '\x1b<2m -VFE...............230',
'490001001': '\x1b<4m\x1b4mAPU\x1bm AUTO SHUT DOWN',
'490001002': '\x1b<5m -MASTER SW..........OFF',
'770002701': '\x1b<2m\x1b4mENG\x1bm ALL ENGINES FAILURE',
'770002702': '\x1b<5m -EMER ELEC PWR...MAN ON',
'770002703': '\x1b<5m OPT RELIGHT SPD.280/.77',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const createOrchestrator = () => new FailuresOrchestrator('A32NX', [

[34, A320Failure.RadioAltimeter1, 'RA 1'],
[34, A320Failure.RadioAltimeter2, 'RA 2'],

[49, A320Failure.ApuStartMotor, 'APU start motor'],
]);

const Context = React.createContext<FailuresOrchestratorContext>({
Expand Down
20 changes: 20 additions & 0 deletions fbw-a32nx/src/systems/instruments/src/EWD/PseudoFWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ export class PseudoFWC {

private readonly toInhibitTimer = new NXLogicConfirmNode(3);

/** 49 - Airborne Auxiliary Power */

private readonly apuAutoshutdown = Subject.create(false);

/** TO CONFIG TEST raw button input */
private toConfigTestRaw = false;

Expand Down Expand Up @@ -1230,6 +1234,9 @@ export class PseudoFWC {
this.leftFuelLow.set(this.leftFuelLowConfirm.write(leftFuelLow && !this.lrTankLow.get(), deltaTime));
this.rightFuelLow.set(this.rightFuelLowConfirm.write(rightFuelLow && !this.lrTankLow.get(), deltaTime));

/** 49 - Airborne Auxiliary Power */
this.apuAutoshutdown.set(SimVar.GetSimVarValue('L:A32NX_APU_IS_AUTO_SHUTDOWN', 'bool'));

/* F/CTL */
const fcdc1DiscreteWord1 = Arinc429Word.fromSimVarValue('L:A32NX_FCDC_1_DISCRETE_WORD_1');
const fcdc2DiscreteWord1 = Arinc429Word.fromSimVarValue('L:A32NX_FCDC_2_DISCRETE_WORD_1');
Expand Down Expand Up @@ -2857,6 +2864,19 @@ export class PseudoFWC {
sysPage: 5,
side: 'LEFT',
},
4900010: { // APU AUTO SHUTDOWN
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: this.apuAutoshutdown,
whichCodeToReturn: () => [
0,
this.apuMasterSwitch.get() ? 1 : null,
],
codesToReturn: ['490001001', '490001002'],
memoInhibit: () => false,
failure: 2,
sysPage: 6,
side: 'LEFT',
},
}

ewdMessageMemos: EWDMessageDict = {
Expand Down
1 change: 1 addition & 0 deletions fbw-a32nx/src/wasm/systems/a320_systems_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ async fn systems(mut gauge: msfs::Gauge) -> Result<(), Box<dyn Error>> {
(32_150, FailureType::BrakeAccumulatorGasLeak),
(34_000, FailureType::RadioAltimeter(1)),
(34_001, FailureType::RadioAltimeter(2)),
(49_000, FailureType::ApuStartMotor),
])
.provides_aircraft_variable("ACCELERATION BODY X", "feet per second squared", 0)?
.provides_aircraft_variable("ACCELERATION BODY Y", "feet per second squared", 0)?
Expand Down
1 change: 1 addition & 0 deletions fbw-common/src/systems/shared/src/ata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const AtaChaptersDescription = Object.freeze({
31: 'The cockpit displays give critical flight information to the pilots. In a failure where displays are lost, the pilots must deal with a lack of flight data given to them.',
32: 'The landing gear components are responsible for supporting and steering the aircraft on the ground, and make it possible to retract and store the landing gear in flight. Includes the functioning and maintenance aspects of the landing gear doors.',
34: 'The navigation systems provide data about the position, speed, heading, and altitude of the aircraft. Failures in a system such as the ADIRS can cause a loss of data sent to instrumentation.',
49: 'The Auxiliary Power Unit (APU) provides power and bleed air without the need to start the engines. It is primarily used for starting the engines and providing air conditioning while on the ground.',
});

export type AtaChapterNumber = keyof typeof AtaChaptersTitle;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use super::{
};
use crate::simulation::{InitContext, VariableIdentifier};
use crate::{
failures::{Failure, FailureType},
pneumatic::PneumaticValveSignal,
shared::{
arinc429::SignStatus, ApuBleedAirValveSignal, ApuMaster, ApuStart, ConsumePower,
Expand Down Expand Up @@ -47,6 +48,7 @@ pub(super) struct ElectronicControlBox {
egt_warning_temperature: ThermodynamicTemperature,
n_above_95_duration: Duration,
fire_button_is_released: bool,
start_motor_failure: Failure,
/** Absolute air pressure sensor in the air intake assembly. */
inlet_pressure: Pressure,
}
Expand Down Expand Up @@ -77,6 +79,7 @@ impl ElectronicControlBox {
master_is_on: false,
start_is_on: false,
start_motor_is_powered: false,
start_motor_failure: Failure::new(FailureType::ApuStartMotor),
n: Ratio::new::<percent>(0.),
bleed_is_on: false,
bleed_air_valve_last_open_time_ago: Duration::from_secs(1000),
Expand Down Expand Up @@ -138,6 +141,14 @@ impl ElectronicControlBox {
{
self.fault = Some(ApuFault::DcPowerLoss);
}

if self.start_motor_failure.is_active()
&& self.master_is_on
&& self.start_is_on
&& self.n.get::<percent>() < Self::START_MOTOR_POWERED_UNTIL_N
{
self.fault = Some(ApuFault::ApuStartMotor);
}
}

pub fn update(&mut self, context: &UpdateContext, turbine: &dyn Turbine) {
Expand Down Expand Up @@ -282,7 +293,10 @@ impl ControllerSignal<ContactorSignal> for ElectronicControlBox {
match self.turbine_state {
TurbineState::Shutdown
if {
self.master_is_on && self.start_is_on && self.air_intake_flap_is_fully_open()
self.master_is_on
&& self.start_is_on
&& self.air_intake_flap_is_fully_open()
&& !self.start_motor_failure.is_active()
} =>
{
Some(ContactorSignal::Close)
Expand All @@ -291,6 +305,7 @@ impl ControllerSignal<ContactorSignal> for ElectronicControlBox {
if {
self.turbine_state == TurbineState::Starting
&& self.n.get::<percent>() < Self::START_MOTOR_POWERED_UNTIL_N
&& !self.start_motor_failure.is_active()
} =>
{
Some(ContactorSignal::Close)
Expand Down Expand Up @@ -358,6 +373,10 @@ impl ControllerSignal<ApuBleedAirValveSignal> for ElectronicControlBox {
}
}
impl SimulationElement for ElectronicControlBox {
fn accept<T: crate::simulation::SimulationElementVisitor>(&mut self, visitor: &mut T) {
self.start_motor_failure.accept(visitor);
visitor.visit(self);
}
fn write(&self, writer: &mut SimulatorWriter) {
let ssm = if self.is_on() {
SignStatus::NormalOperation
Expand Down Expand Up @@ -417,4 +436,5 @@ enum ApuFault {
ApuFire,
FuelLowPressure,
DcPowerLoss,
ApuStartMotor,
}
1 change: 1 addition & 0 deletions fbw-common/src/wasm/systems/systems/src/failures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub enum FailureType {
BrakeHydraulicLeak(HydraulicColor),
BrakeAccumulatorGasLeak,
RadioAltimeter(usize),
ApuStartMotor,
}

pub struct Failure {
Expand Down