Skip to content

Commit

Permalink
feat(fwc): fcu faults (#9655)
Browse files Browse the repository at this point in the history
* feat(fwc): fcu faults

* refactor(fcu): use proper bits in existing DW for FCU healthy

* refactor(fcu): also revert other FlyByWireInterface changes

---------

Co-authored-by: Lukas Michels <[email protected]>
  • Loading branch information
tracernz and lukecologne authored Dec 14, 2024
1 parent 3761596 commit 3ca1ef1
Show file tree
Hide file tree
Showing 7 changed files with 347 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
1. [A380X/FMS] Fix VLS computation error for CONF 1, might have lead to FMS crashes during climb out - @flogross89 (floridude)
1. [A380X/FCU] Add correct QFE label using the baro preselect display - @heclak (Heclak)
1. [FMS] Move the speed limit data to performance data, so that it is flight-plan-specific - @BlueberryKing (BlueberryKing)
1. [A32NX/FWC] Add FCU faults - @tracernz (Mike)

## 0.12.0

Expand Down
4 changes: 3 additions & 1 deletion fbw-a32nx/docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -3332,7 +3332,9 @@ In the variables below, {number} should be replaced with one item in the set: {
|15-19| Spare |
| 20 | FMGC 1 selected (has priority) |
| 21 | FMGC 2 selected (has priority) |
|22-25| Spare |
|22-23| Spare |
| 24 | FCU 1 Healthy |
| 25 | FCU 2 Healthy |
| 26 | FD 1 Button off |
| 27 | FD 2 Button off |
|28-29| Spare |
Expand Down
6 changes: 6 additions & 0 deletions fbw-a32nx/src/systems/instruments/src/Common/EWDMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ const EWDMessages = {
'216330503': '\x1b<4m -FWD CAB TRIM VALVE',
'216330504': '\x1b<4m -AFT CAB TRIM VALVE',
'216330505': '\x1b<4m -TRIM AIR HI PR',
'220020201': '\x1b<4m\x1b4mAUTO FLT\x1bm FCU 1+2 FAULT',
'220020202': '\x1b<5m -PFD BARO REF: STD ONLY',
'220021001': '\x1b<4m\x1b4mAUTO FLT\x1bm FCU 1 FAULT',
'220021002': '\x1b<5m -BARO REF.........CHECK',
'220021501': '\x1b<4m\x1b4mAUTO FLT\x1bm FCU 2 FAULT',
'220021502': '\x1b<5m -BARO REF.........CHECK',
'221070001': '\x1b<4m\x1b4mT.O\x1bm SPEEDS TOO LOW',
'221070002': '\x1b<5m -TOW AND T.O DATA.CHECK',
'221071001': '\x1b<4m\x1b4mT.O\x1bm V1/VR/V2 DISAGREE',
Expand Down
54 changes: 52 additions & 2 deletions fbw-a32nx/src/systems/instruments/src/EWD/PseudoFWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '@microsoft/msfs-sdk';

import {
Arinc429LocalVarConsumerSubject,
Arinc429Register,
Arinc429RegisterSubject,
Arinc429SignStatusMatrix,
Expand All @@ -30,6 +31,7 @@ import {
import { VerticalMode } from '@shared/autopilot';
import { EwdSimvars } from 'instruments/src/EWD/shared/EwdSimvarPublisher';
import { FuelSystemEvents } from '../MsfsAvionicsCommon/providers/FuelSystemPublisher';
import { A32NXFcuBusEvents } from '../../../shared/src/publishers/A32NXFcuBusPublisher';

export function xor(a: boolean, b: boolean): boolean {
return !!((a ? 1 : 0) ^ (b ? 1 : 0));
Expand Down Expand Up @@ -71,7 +73,8 @@ enum FwcAuralWarning {
}

export class PseudoFWC {
private readonly sub = this.bus.getSubscriber<EwdSimvars & StallWarningEvents>();
private readonly sub = this.bus.getSubscriber<A32NXFcuBusEvents & EwdSimvars & StallWarningEvents>();

/** Time to inhibit master warnings and cautions during startup in ms */
private static readonly FWC_STARTUP_TIME = 5000;

Expand Down Expand Up @@ -289,6 +292,13 @@ export class PseudoFWC {

private toV2VRV2DisagreeWarning = Subject.create(false);

private readonly fcu1DiscreteWord2 = Arinc429LocalVarConsumerSubject.create(this.sub.on('a32nx_fcu_discrete_word_2'));
private readonly fcu2DiscreteWord2 = Arinc429LocalVarConsumerSubject.create(this.sub.on('a32nx_fcu_discrete_word_2'));

private readonly fcu12Fault = Subject.create(false);
private readonly fcu1Fault = Subject.create(false);
private readonly fcu2Fault = Subject.create(false);

/* 24 - ELECTRICAL */

private readonly ac1BusPowered = Subject.create(false);
Expand Down Expand Up @@ -1088,7 +1098,6 @@ export class PseudoFWC {
const deltaTime = this.instrument.deltaTime;

// Inputs update

this.flightPhaseEndedPulseNode.write(false, deltaTime);

this.fwcFlightPhase.set(SimVar.GetSimVarValue('L:A32NX_FWC_FLIGHT_PHASE', 'Enum'));
Expand Down Expand Up @@ -1379,6 +1388,14 @@ export class PseudoFWC {
overspeedWarning ||= adr1Discrete1.bitValueOr(9, false) || adr2Discrete1.bitValueOr(9, false);
this.overspeedWarning.set(overspeedWarning);

// In reality FWC1 takes 1B, and FWC2 2B.
const fcu1Healthy = this.fcu1DiscreteWord2.get().bitValueOr(24, false);
const fcu2Healthy = this.fcu1DiscreteWord2.get().bitValueOr(25, false);

this.fcu12Fault.set(!fcu1Healthy && !fcu2Healthy && this.dcESSBusPowered.get() && this.dc2BusPowered.get());
this.fcu1Fault.set(!fcu1Healthy && fcu2Healthy && this.dcESSBusPowered.get());
this.fcu2Fault.set(fcu1Healthy && !fcu2Healthy && this.dc2BusPowered.get());

// TO SPEEDS NOT INSERTED
const fmToSpeedsNotInserted = fm1DiscreteWord3.bitValueOr(18, false) && fm2DiscreteWord3.bitValueOr(18, false);

Expand Down Expand Up @@ -2525,6 +2542,39 @@ export class PseudoFWC {

ewdMessageFailures: EWDMessageDict = {
// 22 - AUTOFLIGHT
2200202: {
// FCU 1+2 FAULT
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: this.fcu12Fault,
whichCodeToReturn: () => [0, 1],
codesToReturn: ['220020201', '220020202'],
memoInhibit: () => false,
failure: 2,
sysPage: -1,
side: 'LEFT',
},
2200210: {
// FCU 1 FAULT
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: this.fcu1Fault,
whichCodeToReturn: () => [0, 1],
codesToReturn: ['220021001', '220021002'],
memoInhibit: () => false,
failure: 1,
sysPage: -1,
side: 'LEFT',
},
2200215: {
// FCU 2 FAULT
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: this.fcu2Fault,
whichCodeToReturn: () => [0, 1],
codesToReturn: ['220021501', '220021502'],
memoInhibit: () => false,
failure: 1,
sysPage: -1,
side: 'LEFT',
},
2210700: {
// TO SPEEDS TOO LOW
flightPhaseInhib: [1, 4, 5, 6, 7, 8, 9, 10],
Expand Down
5 changes: 5 additions & 0 deletions fbw-a32nx/src/systems/instruments/src/EWD/instrument.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { FuelSystemPublisher } from 'instruments/src/MsfsAvionicsCommon/provider
import { ArincValueProvider } from './shared/ArincValueProvider';
import { EwdComponent } from './EWD';
import { EwdSimvarPublisher } from './shared/EwdSimvarPublisher';
import { A32NXFcuBusPublisher } from '@shared/publishers/A32NXFcuBusPublisher';
import { PseudoFWC } from './PseudoFWC';

import './style.scss';
Expand All @@ -35,6 +36,8 @@ class A32NX_EWD extends BaseInstrument {

private readonly stallWarningPublisher = new StallWarningPublisher(this.bus, 0.9);

private readonly a32nxFcuBusPublisher = new A32NXFcuBusPublisher(this.bus);

private readonly pseudoFwc = new PseudoFWC(this.bus, this);

constructor() {
Expand All @@ -45,6 +48,8 @@ class A32NX_EWD extends BaseInstrument {
this.backplane.addPublisher('FuelSystem', this.fuelSystemPublisher);
this.backplane.addPublisher('adc', this.adcPublisher);
this.backplane.addPublisher('stallWarning', this.stallWarningPublisher);
this.backplane.addPublisher('A32NXFcuBus', this.a32nxFcuBusPublisher);

this.backplane.addInstrument('Fwc', this.pseudoFwc);
}

Expand Down
Loading

0 comments on commit 3ca1ef1

Please sign in to comment.