From 0cb783fe69121e40bd44b64ebbe1c28015c9c553 Mon Sep 17 00:00:00 2001 From: Benedict Etzel Date: Thu, 19 May 2022 23:30:26 +0200 Subject: [PATCH] feat(fws): rebuild flight warning system in Rust #4872 (@f23bf86) --- Cargo.lock | 1 + fbw-a32nx/docs/a320-simvars.md | 92 +- .../ModelBehaviorDefs/A32NX/Airbus.xml | 52 +- .../AirPlanes/FlyByWire_A320_NEO/approach.FLT | 1 - .../AirPlanes/FlyByWire_A320_NEO/cruise.FLT | 1 - .../AirPlanes/FlyByWire_A320_NEO/final.FLT | 1 - .../model/A320_NEO_INTERIOR.xml | 32 +- .../AirPlanes/FlyByWire_A320_NEO/runway.FLT | 1 - .../FlyByWire_A320_NEO/sound/sound.xml | 539 ++- .../AirPlanes/FlyByWire_A320_NEO/taxi.flt | 1 - .../html_ui/Pages/A32NX_Core/A32NX_Core.js | 5 - .../html_ui/Pages/A32NX_Core/A32NX_FWC.js | 397 -- .../html_ui/Pages/A32NX_Core/A32NX_GPWS.js | 336 -- .../Pages/A32NX_Core/A32NX_SoundManager.js | 64 - .../FlyByWire_A320_Neo/CDU/A320_Neo_CDU.html | 1 - .../FMC/A32NX_FMCMainDisplay.js | 18 +- fbw-a32nx/src/systems/failures/src/a320.ts | 3 + .../src/systems/fmgc/src/flightphase/Phase.ts | 6 +- .../instruments/src/Common/EWDMessages.tsx | 11 + .../systems/instruments/src/Common/NXLogic.ts | 30 +- .../EFB/failures-orchestrator-provider.tsx | 2 + .../systems/instruments/src/EWD/PseudoFWC.ts | 77 +- .../src/EWD/shared/EwdSimvarPublisher.tsx | 2 +- .../src/PFD/DigitalAltitudeReadout.tsx | 47 +- .../instruments/src/PFD/animations.scss | 16 +- .../src/PFD/shared/PFDSimvarPublisher.tsx | 14 +- .../tcas/src/components/TcasComputer.ts | 5 + .../tcas/src/components/TcasSoundManager.ts | 4 + fbw-a32nx/src/wasm/fadec_a320/src/SimVars.h | 2 +- .../wasm/fbw_a320/src/FlyByWireInterface.cpp | 2 +- .../src/wasm/systems/a320_systems/Cargo.toml | 1 + .../a320_systems/src/flight_warning/README.md | 165 + .../src/flight_warning/ecam_control.rs | 516 +++ .../a320_systems/src/flight_warning/input.rs | 1033 +++++ .../a320_systems/src/flight_warning/mod.rs | 417 ++ .../src/flight_warning/runtime/acquisition.rs | 497 +++ .../src/flight_warning/runtime/audio.rs | 1077 +++++ .../src/flight_warning/runtime/mod.rs | 219 + .../src/flight_warning/runtime/monitor.rs | 777 ++++ .../src/flight_warning/runtime/parameters.rs | 1350 +++++++ .../src/flight_warning/runtime/test.rs | 248 ++ .../runtime/warnings/air_data.rs | 277 ++ .../runtime/warnings/auto_call_outs.rs | 3560 +++++++++++++++++ .../runtime/warnings/auto_flight.rs | 1026 +++++ .../flight_warning/runtime/warnings/engine.rs | 142 + .../runtime/warnings/flight_phases.rs | 2387 +++++++++++ .../runtime/warnings/landing_gear.rs | 99 + .../flight_warning/runtime/warnings/memo.rs | 370 ++ .../flight_warning/runtime/warnings/mod.rs | 1069 +++++ .../runtime/warnings/monitor.rs | 151 + .../systems/a320_systems/src/hydraulic/mod.rs | 21 + .../src/wasm/systems/a320_systems/src/lib.rs | 16 + .../systems/a320_systems/src/navigation.rs | 10 +- .../a320_systems_wasm/src/flight_warning.rs | 30 + .../wasm/systems/a320_systems_wasm/src/lib.rs | 5 + .../systems/systems/src/enhanced_gpwc/mod.rs | 12 + .../wasm/systems/systems/src/failures/mod.rs | 2 + .../systems/src/flight_warning/acquisition.rs | 245 ++ .../systems/src/flight_warning/logic.rs | 613 +++ .../systems/systems/src/flight_warning/mod.rs | 30 + .../systems/src/flight_warning/parameters.rs | 175 + .../systems/src/flight_warning/utils.rs | 19 + .../systems/src/flight_warning/warnings.rs | 65 + .../systems/systems/src/landing_gear/mod.rs | 18 + .../src/wasm/systems/systems/src/lib.rs | 1 + .../systems/systems/src/navigation/adirs.rs | 22 + .../systems/systems/src/navigation/ala52b.rs | 2 +- .../systems/systems/src/shared/arinc429.rs | 8 + .../wasm/systems/systems/src/shared/mod.rs | 10 + 69 files changed, 17493 insertions(+), 955 deletions(-) delete mode 100644 fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/A32NX_Core/A32NX_FWC.js create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/README.md create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/ecam_control.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/input.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/mod.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/acquisition.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/audio.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/mod.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/monitor.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/parameters.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/test.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/air_data.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/auto_call_outs.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/auto_flight.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/engine.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/flight_phases.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/landing_gear.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/memo.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/mod.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems/src/flight_warning/runtime/warnings/monitor.rs create mode 100644 fbw-a32nx/src/wasm/systems/a320_systems_wasm/src/flight_warning.rs create mode 100644 fbw-common/src/wasm/systems/systems/src/flight_warning/acquisition.rs create mode 100644 fbw-common/src/wasm/systems/systems/src/flight_warning/logic.rs create mode 100644 fbw-common/src/wasm/systems/systems/src/flight_warning/mod.rs create mode 100644 fbw-common/src/wasm/systems/systems/src/flight_warning/parameters.rs create mode 100644 fbw-common/src/wasm/systems/systems/src/flight_warning/utils.rs create mode 100644 fbw-common/src/wasm/systems/systems/src/flight_warning/warnings.rs diff --git a/Cargo.lock b/Cargo.lock index 04204848efd..c42c9f5cad9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,6 +22,7 @@ name = "a320_systems" version = "0.1.0" dependencies = [ "enum-map", + "fxhash", "lazy_static", "nalgebra", "ntest", diff --git a/fbw-a32nx/docs/a320-simvars.md b/fbw-a32nx/docs/a320-simvars.md index d5d028580db..f85a978bd1f 100644 --- a/fbw-a32nx/docs/a320-simvars.md +++ b/fbw-a32nx/docs/a320-simvars.md @@ -18,6 +18,7 @@ - [Autoflight (ATA 22)](#autoflight-ata-22) - [Flaps / Slats (ATA 27)](#flaps--slats-ata-27) - [Flight Controls (ATA 27)](#flight-controls-ata-27) + - [Flight Warning System (ATA 31)](#flight-warning-system-ata-31) - [Landing Gear (ATA 32)](#landing-gear-ata-32) - [ATC (ATA 34)](#atc-ata-34) - [Radio Altimeter (ATA 34)](#radio-altimeter-ata-34) @@ -243,27 +244,6 @@ - Feet - Departure runway elevation as calculated by the FMC -- A32NX_FWC_FLIGHT_PHASE - - Enum - - Contains the numeric flight phase as determined by the FWC - - Input for: systems.wasm - -- A32NX_FWC_SKIP_STARTUP - - Bool - - Set to true in a non-cold and dark flight phase to skip the initial memorization step - -- A32NX_FWC_TOMEMO - - Bool - - True when the FWC decides that the takeoff memo should be shown - -- A32NX_FWC_LDGMEMO - - Bool - - True when the FWC decides that the landing memo should be shown - -- A32NX_FWC_INHIBOVRD - - Bool - - True when the FWC decides that flight phase inhibits should be overridden (and ignored) - - A32NX_SPEEDS_VS - Number - Current config stall speed @@ -3408,6 +3388,70 @@ In the variables below, {number} should be replaced with one item in the set: { - Percent - Trim wheel position in percent +## Flight Warning System (ATA 31) + +- A32NX_FWC_FLIGHT_PHASE + - Enum + - Contains the numeric flight phase as determined by the FWC + - **WARNING:** This value may be nonsensical or unset if the FWCs have lost power or have failed. Only use this if you're modeling a screen or system that truly retrieves this from an FWC. + - **DEPRECATED:** You should be using A32NX_FWS_FWC_{1|2}_FLIGHT_PHASE instead. + +- A32NX_FWS_ANY_FWC_NORMAL + - Bool + - True when either FWC is working. + +- A32NX_FWS_MW_CANCEL_ON_{CAPT,FO} + - Bool + - True while the captain/first officer Master Warning cancel button is depressed. + +- A32NX_FWS_MC_CANCEL_ON_{CAPT,FO} + - Bool + - True while the captain/first officer Master Caution cancel button is depressed. + +- A32NX_FWS_TOMEMO + - Bool + - True when the FWC responsible for the ECAM determines that the takeoff memo should be shown + +- A32NX_FWS_LDGMEMO + - Bool + - True when the FWC responsible for the ECAM determines that the landing memo should be shown + +- A32NX_FWS_TOINHIBIT + - Bool + - True when the FWC responsible for the ECAM determines that the special line T.O INHIBIT should be shown + +- A32NX_FWS_LDGMEMO + - Bool + - True when the FWC responsible for the ECAM determines that the special line LDG INHIBIT should be shown + +- A32NX_FWS_INHIBOVRD + - Bool + - True when the FWC responsible for the ECAM determines that flight phase inhibits should be overridden (and ignored) + +- A32NX_FWS_FWC_{1|2}_NORMAL + - Bool + - True when the corresponding FWC is working. + +- A32NX_FWS_FWC_{1|2}_FLIGHT_PHASE + - Enum + - The flight phase as determined by the corresponding FWC, or 0 if the FWC is not ready. + +- A32NX_FWS_FWC_{1|2}_AUDIO_ATTENUATION + - Bool + - True when the corresponding FWC has determined that aural warnings should be 6dB quieter. + +- A32NX_FWS_FWC_{1|2}_SYNTHETIC_VOICE + - Enum + - The specific synthetic voice line that should be played, or 0 when none should be played. + +- A32NX_FWS_FWC_{1|2}_ALT_ALERT_PULSING + - Bool + - True when the altitude window should be pulsing due to an altitude alert, as determined the corresponding FWC. + +- A32NX_FWS_FWC_{1|2}_ALT_ALERT_FLASHING + - Enum + - True when the altitude window should be flashing due to an altitude alert, as determined the corresponding FWC. + ## Landing Gear (ATA 32) - A32NX_LGCIU_{number}_DISCRETE_WORD_1 @@ -3625,6 +3669,12 @@ In the variables below, {number} should be replaced with one item in the set: { - {number} - 0 - 1 + +- A32NX_TCAS_AURAL_ADVISORY_OUTPUT + - boolean + - Populated by TCAS, Read-Only for other systems + - Whether TCAS is currently playing an aural advisory. True for the duration of the synthetic voice. + ## Radio Altimeter (ATA 34) - A32NX_RA_{number}_RADIO_ALTITUDE diff --git a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml index eba23547c7c..e28865c8ea4 100644 --- a/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml +++ b/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/ModelBehaviorDefs/A32NX/Airbus.xml @@ -253,6 +253,51 @@ + + + +