From 39de1578f0d2d2134f4a95a95dad757e383d9d77 Mon Sep 17 00:00:00 2001 From: David Walschots Date: Mon, 1 Mar 2021 15:04:40 +0100 Subject: [PATCH] feat: electrical systems (#2582) --- .github/CHANGELOG.md | 55 + .../Asobo_A320_NEO/Checklist/Library.xml | 2 +- .../AirPlanes/Asobo_A320_NEO/approach.FLT | 19 +- .../AirPlanes/Asobo_A320_NEO/apron.FLT | 19 +- .../AirPlanes/Asobo_A320_NEO/cruise.FLT | 19 +- .../AirPlanes/Asobo_A320_NEO/final.FLT | 19 +- .../model/A320_NEO_INTERIOR.xml | 49 +- .../AirPlanes/Asobo_A320_NEO/runway.FLT | 19 +- .../AirPlanes/Asobo_A320_NEO/sound/sound.xml | 2 +- .../AirPlanes/Asobo_A320_NEO/taxi.flt | 19 +- A32NX/html_ui/Pages/A32NX_Core/A32NX_APU.js | 13 +- .../Airliners/A320_Neo/BAT/A320_Neo_BAT.js | 2 +- .../A320_Neo/EICAS/A320_Neo_EICAS.js | 4 +- .../EICAS/ECAM/A320_Neo_LowerECAM_APU.js | 38 +- .../EICAS/ECAM/A320_Neo_LowerECAM_BLEED.js | 2 +- .../EICAS/ECAM/A320_Neo_LowerECAM_Elec.html | 144 +- .../EICAS/ECAM/A320_Neo_LowerECAM_Elec.js | 1314 ++++------- .../EICAS/ECAM/A320_Neo_LowerECAM_Fuel.js | 2 +- .../A320_Neo/EICAS/ECAM/A320_Neo_UpperECAM.js | 12 +- Cargo.lock | 125 +- Cargo.toml | 3 +- docs/a320-simvars.md | 258 ++- src/behavior/src/A32NX_Interior_Elec.xml | 12 +- src/behavior/src/A32NX_Interior_Misc.xml | 16 +- src/systems/a320/src/lib.rs | 183 -- src/systems/a320_systems/Cargo.toml | 9 + .../src/electrical/alternating_current.rs | 501 ++++ .../src/electrical/direct_current.rs | 304 +++ .../a320_systems/src/electrical/galley.rs | 52 + .../a320_systems/src/electrical/mod.rs | 2011 +++++++++++++++++ src/systems/a320_systems/src/fuel.rs | 31 + src/systems/a320_systems/src/hydraulic.rs | 16 + .../a320/mod.rs => a320_systems/src/lib.rs} | 58 +- .../a320 => a320_systems/src}/pneumatic.rs | 37 +- .../{a320 => a320_systems_wasm}/Cargo.toml | 7 +- src/systems/a320_systems_wasm/src/lib.rs | 117 + src/systems/systems/Cargo.toml | 2 +- src/systems/systems/src/a320/electrical.rs | 46 - src/systems/systems/src/a320/fuel.rs | 34 - .../systems/src/apu/air_intake_flap.rs | 46 +- src/systems/systems/src/apu/aps3200.rs | 210 +- .../systems/src/apu/electronic_control_box.rs | 43 +- src/systems/systems/src/apu/mod.rs | 452 ++-- src/systems/systems/src/electrical/battery.rs | 180 ++ .../src/electrical/emergency_generator.rs | 131 ++ .../src/electrical/engine_generator.rs | 463 ++++ .../src/electrical/external_power_source.rs | 121 + src/systems/systems/src/electrical/mod.rs | 820 ++++++- .../systems/src/electrical/static_inverter.rs | 138 ++ .../src/electrical/transformer_rectifier.rs | 152 ++ src/systems/systems/src/engine/mod.rs | 27 + src/systems/systems/src/lib.rs | 25 +- src/systems/systems/src/macros/mod.rs | 15 + src/systems/systems/src/overhead/mod.rs | 533 ++++- src/systems/systems/src/pneumatic/mod.rs | 5 + src/systems/systems/src/shared/mod.rs | 223 +- src/systems/systems/src/simulation/mod.rs | 332 +++ src/systems/systems/src/simulation/test.rs | 42 + .../systems/src/simulation/update_context.rs | 118 + src/systems/systems/src/simulator/mod.rs | 180 -- .../systems/src/simulator/update_context.rs | 95 - 61 files changed, 7770 insertions(+), 2156 deletions(-) delete mode 100644 src/systems/a320/src/lib.rs create mode 100644 src/systems/a320_systems/Cargo.toml create mode 100644 src/systems/a320_systems/src/electrical/alternating_current.rs create mode 100644 src/systems/a320_systems/src/electrical/direct_current.rs create mode 100644 src/systems/a320_systems/src/electrical/galley.rs create mode 100644 src/systems/a320_systems/src/electrical/mod.rs create mode 100644 src/systems/a320_systems/src/fuel.rs create mode 100644 src/systems/a320_systems/src/hydraulic.rs rename src/systems/{systems/src/a320/mod.rs => a320_systems/src/lib.rs} (57%) rename src/systems/{systems/src/a320 => a320_systems/src}/pneumatic.rs (71%) rename src/systems/{a320 => a320_systems_wasm}/Cargo.toml (68%) create mode 100644 src/systems/a320_systems_wasm/src/lib.rs delete mode 100644 src/systems/systems/src/a320/electrical.rs delete mode 100644 src/systems/systems/src/a320/fuel.rs create mode 100644 src/systems/systems/src/electrical/battery.rs create mode 100644 src/systems/systems/src/electrical/emergency_generator.rs create mode 100644 src/systems/systems/src/electrical/engine_generator.rs create mode 100644 src/systems/systems/src/electrical/external_power_source.rs create mode 100644 src/systems/systems/src/electrical/static_inverter.rs create mode 100644 src/systems/systems/src/electrical/transformer_rectifier.rs create mode 100644 src/systems/systems/src/engine/mod.rs create mode 100644 src/systems/systems/src/macros/mod.rs create mode 100644 src/systems/systems/src/simulation/mod.rs create mode 100644 src/systems/systems/src/simulation/test.rs create mode 100644 src/systems/systems/src/simulation/update_context.rs delete mode 100644 src/systems/systems/src/simulator/mod.rs delete mode 100644 src/systems/systems/src/simulator/update_context.rs diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index d33dab58ace..64b5abe3044 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -116,6 +116,61 @@ 1. [ECAM] Refactor COND/OXY page to use new useSimVars - @RichardPilbery (tricky_dicky[Z+0]#3571) 1. [LIGHTS] Added ambient light to the cockpit - @ImenesFBW (Imenes) 1. [MCDU] INIT-B page - Fixed Trip Wind value handling - @SergeySoprykin (SergeyS) +1. [ELEC] Basic integrated drive generator implementation - @davidwalschots (David Walschots) +1. [ELEC] A fully functional ELEC page on the lower ECAM - @davidwalschots (David Walschots) +1. [ELEC] Contactor logic is fully modelled - @davidwalschots (David Walschots) +1. [ELEC] GEN 1 and GEN 2 have priority over the APU and EXT PWR - @davidwalschots (David Walschots) +1. [ELEC] EXT PWR has priority over the APU - @davidwalschots (David Walschots) +1. [ELEC] When a single engine generator is active, it powers both AC BUS 1 and 2 - @davidwalschots (David Walschots) +1. [ELEC] When only the APU is active, it powers both AC BUS 1 and 2 - @davidwalschots (David Walschots) +1. [ELEC] When only EXT PWR is active, it powers both AC BUS 1 and 2 - @davidwalschots (David Walschots) +1. [ELEC] When the BUS TIE push button is OFF, GEN n can only power AC BUS n - @davidwalschots (David Walschots) +1. [ELEC] When the BUS TIE push button is OFF, APU and EXT PWR cannot power the aircraft - @davidwalschots (David Walschots) +1. [ELEC] When the APU GEN push button is OFF, the APU cannot power the aircraft - @davidwalschots (David Walschots) +1. [ELEC] When the EXT PWR push button is OFF, EXT PWR cannot power the aircraft - @davidwalschots (David Walschots) +1. [ELEC] When the GEN n push button is OFF, GEN n cannot power the aircraft - @davidwalschots (David Walschots) +1. [ELEC] When the IDG n push button is RELEASED, GEN n cannot power the aircraft - @davidwalschots (David Walschots) +1. [ELEC] When AC BUS 1 is powered, it powers AC ESS BUS - @davidwalschots (David Walschots) +1. [ELEC] When AC BUS 1 is unpowered and AC BUS 2 is powered, AC ESS BUS is automatically powered by AC BUS 2 after three seconds - @davidwalschots (David Walschots) +1. [ELEC] When AC BUS 1 becomes powered after being unpowered, AC ESS BUS is powered by AC BUS 1 without delay - @davidwalschots (David Walschots) +1. [ELEC] When AC ESS FEED push button is set to ALTN, AC ESS BUS is powered by AC BUS 2 without delay - @davidwalschots (David Walschots) +1. [ELEC] In normal conditions, TR 1 supplies power to DC BUS 1, DC BAT BUS, and DC ESS BUS - @davidwalschots (David Walschots) +1. [ELEC] In normal conditions, TR 2 supplies power to DC BUS 2 - @davidwalschots (David Walschots) +1. [ELEC] When TR 1 is unavailable, TR 2 supplies power to DC BUS 2, DC BAT BUS, and DC BUS 1 - @davidwalschots (David Walschots) +1. [ELEC] When TR 2 is unavailable, TR 1 supplies power to DC BUS 1, DC BAT BUS, and DC BUS 2 - @davidwalschots (David Walschots) +1. [ELEC] When TR n is unavailable, TR ESS supplies power to DC ESS BUS - @davidwalschots (David Walschots) +1. [ELEC] Above 100 knots, when TR 1 + 2 are unavailable, DC BAT BUS is unpowered - @davidwalschots (David Walschots) +1. [ELEC] At or below 100 knots, when TR 1 + 2 are unavailable DC BAT BUS is powered by the batteries - @davidwalschots (David Walschots) +1. [ELEC] In certain conditions DC ESS BUS is powered by BAT 2 - @davidwalschots (David Walschots) +1. [ELEC] In certain conditions AC STAT INV BUS is powered by BAT 1 through the static inverter - @davidwalschots (David Walschots) +1. [ELEC] In certain conditions AC ESS BUS is powered by BAT 1 via the static inverter - @davidwalschots (David Walschots) +1. [ELEC] When the BAT 1 to static inverter contactor is closed, an arrow with STAT INV appears next to BAT 1 on the ECAM - @davidwalschots (David Walschots) +1. [ELEC] Both galleys are shed when none of the main power sources (GEN 1, GEN 2, APU GEN, or EXT PWR) is powering the aircraft - @davidwalschots (David Walschots) +1. [ELEC] The main galley is shed when the aircraft is powered by a single engine generator - @davidwalschots (David Walschots) +1. [ELEC] The main galley is shed when the aircraft is in flight and supplied by APU GEN only - @davidwalschots (David Walschots) +1. [ELEC] The main and secondary galley are shed when the COMMERCIAL push button is OFF - @davidwalschots (David Walschots) +1. [ELEC] The main and secondary galley are shed when the GALY & CAB push button is OFF - @davidwalschots (David Walschots) +1. [ELEC] When the main or secondary galley is shed GALLEY SHED is indicated on the ECAM - @davidwalschots (David Walschots) +1. [ELEC] The AC ESS FEED FAULT light illuminates when AC ESS BUS isn't powered - @davidwalschots (David Walschots) +1. [ELEC] The battery voltage is equal to the ECAM indicated voltage - @davidwalschots (David Walschots) +1. [ELEC] The legend of buses is displayed in green when powered, amber otherwise - @davidwalschots (David Walschots) +1. [ELEC] The DC BAT BUS legend becomes amber XX when unpowered - @davidwalschots (David Walschots) +1. [ELEC] When the BAT n push button is OFF, OFF is indicated. Otherwise the electrical parameters are displayed - @davidwalschots (David Walschots) +1. [ELEC] When DC BAT BUS powered by batteries, the BAT to DC BAT BUS wire is displayed - @davidwalschots (David Walschots) +1. [ELEC] Transformer rectifiers legend is white, unless V or A is amber, then it is also amber - @davidwalschots (David Walschots) +1. [ELEC] When AC BUS 1 or AC BUS 2 are unpowered, the wires leading to TR 1 and TR 2 turn amber - @davidwalschots (David Walschots) +1. [ELEC] ESS TR arrow and wire appear in green when ESS TR contactor is closed - @davidwalschots (David Walschots) +1. [ELEC] A basic emergency generator implementation is created, but not yet usable until HYD is implemented - @davidwalschots (David Walschots) +1. [ELEC] GEN 1 + 2 legend indicates amber OFF when the respective GEN push button is OFF - @davidwalschots (David Walschots) +1. [ELEC] GEN 1 + 2 indicates electrical parameters - @davidwalschots (David Walschots) +1. [ELEC] EXT PWR indicates electrical parameters - @davidwalschots (David Walschots) +1. [ELEC] The static inverter legend is displayed when BAT 1 supplies AC ESS through the static inverter - @davidwalschots (David Walschots) +1. [ELEC] The static inverter box is displayed when BAT 1 supplies AC ESS through the static inverter - @davidwalschots (David Walschots) +1. [ELEC] IDG oil outlet temperature is indicated - @davidwalschots (David Walschots) +1. [ELEC] When the IDG is disconnected, the IDG text becomes amber - @davidwalschots (David Walschots) +1. [ELEC] When the IDG is disconnected, DISC appears in amber - @davidwalschots (David Walschots) +1. [ELEC] SHED appears below the AC ESS BUS when AC ESS SHED BUS is unpowered - @davidwalschots (David Walschots) +1. [ELEC] SHED appears below the DC ESS BUS when DC ESS SHED BUS is unpowered - @davidwalschots (David Walschots) ## 0.5.2 1. [CDU] Changing CRZ/DES speed to acknowledge any speed restriction - @Watsi01 (RogePete) diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/Checklist/Library.xml b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/Checklist/Library.xml index 79fe7cfbc5a..abc5d630c33 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/Checklist/Library.xml +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/Checklist/Library.xml @@ -2055,7 +2055,7 @@ - + diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/approach.FLT b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/approach.FLT index 6f6a61059c0..b49339bfe90 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/approach.FLT +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/approach.FLT @@ -138,15 +138,16 @@ A32NX_BARO_BRIGHTNESS=0.75 A32NX_SWITCH_RADAR_PWS_Position=1 A32NX_SWITCH_TCAS_Position=2 A32NX_COCKPIT_DOOR_LOCKED=1 -A32NX_ELEC_COMMERCIAL_FAULT=0 -A32NX_ELEC_COMMERCIAL_TOGGLE=1 -A32NX_ELEC_GALYCAB_FAULT=0 -A32NX_ELEC_GALYCAB_TOGGLE=1 -A32NX_ELEC_IDG1_FAULT=0 -A32NX_ELEC_IDG2_FAULT=0 -A32NX_ELEC_BUSTIE_TOGGLE=1 -A32NX_ELEC_ACESSFEED_FAULT=0 -A32NX_ELEC_ACESSFEED_TOGGLE=1 +A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL=1 A32NX_ELEC_IDG1LOCK_TOGGLE=0 A32NX_ELEC_IDG2LOCK_TOGGLE=0 A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position=1 diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/apron.FLT b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/apron.FLT index f4d30eed68e..5fb2596de8f 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/apron.FLT +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/apron.FLT @@ -144,17 +144,18 @@ PUSH_OVHD_OXYGEN_CREW=1 STROBE_1_Auto=0 A32NX_BARO_BRIGHTNESS=0.15 A32NX_COLD_AND_DARK_SPAWN=1 -A32NX_ELEC_COMMERCIAL_FAULT=0 -A32NX_ELEC_COMMERCIAL_TOGGLE=1 -A32NX_ELEC_GALYCAB_FAULT=0 -A32NX_ELEC_IDG1_FAULT=0 -A32NX_ELEC_IDG2_FAULT=0 -A32NX_ELEC_BUSTIE_TOGGLE=1 -A32NX_ELEC_ACESSFEED_FAULT=0 -A32NX_ELEC_ACESSFEED_TOGGLE=1 +A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO=0 +A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO=0 +A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL=1 A32NX_ELEC_IDG1LOCK_TOGGLE=0 A32NX_ELEC_IDG2LOCK_TOGGLE=0 -A32NX_ELEC_GALYCAB_TOGGLE=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO=1 A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position=1 A32NX_KNOB_OVHD_AIRCOND_PACKFLOW_Position=1 A32NX_AIRCOND_PACK1_FAULT=0 diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/cruise.FLT b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/cruise.FLT index 4387fa5dc68..c8ecc716162 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/cruise.FLT +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/cruise.FLT @@ -138,15 +138,16 @@ A32NX_BARO_BRIGHTNESS=0.75 A32NX_SWITCH_RADAR_PWS_Position=1 A32NX_SWITCH_TCAS_Position=2 A32NX_COCKPIT_DOOR_LOCKED=1 -A32NX_ELEC_COMMERCIAL_FAULT=0 -A32NX_ELEC_COMMERCIAL_TOGGLE=1 -A32NX_ELEC_GALYCAB_FAULT=0 -A32NX_ELEC_GALYCAB_TOGGLE=1 -A32NX_ELEC_IDG1_FAULT=0 -A32NX_ELEC_IDG2_FAULT=0 -A32NX_ELEC_BUSTIE_TOGGLE=1 -A32NX_ELEC_ACESSFEED_FAULT=0 -A32NX_ELEC_ACESSFEED_TOGGLE=1 +A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL=1 A32NX_ELEC_IDG1LOCK_TOGGLE=0 A32NX_ELEC_IDG2LOCK_TOGGLE=0 A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position=1 diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/final.FLT b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/final.FLT index 2f5e89595ac..6e52d2150e2 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/final.FLT +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/final.FLT @@ -138,15 +138,16 @@ A32NX_BARO_BRIGHTNESS=0.75 A32NX_SWITCH_RADAR_PWS_Position=1 A32NX_SWITCH_TCAS_Position=2 A32NX_COCKPIT_DOOR_LOCKED=1 -A32NX_ELEC_COMMERCIAL_FAULT=0 -A32NX_ELEC_COMMERCIAL_TOGGLE=1 -A32NX_ELEC_GALYCAB_FAULT=0 -A32NX_ELEC_GALYCAB_TOGGLE=1 -A32NX_ELEC_IDG1_FAULT=0 -A32NX_ELEC_IDG2_FAULT=0 -A32NX_ELEC_BUSTIE_TOGGLE=1 -A32NX_ELEC_ACESSFEED_FAULT=0 -A32NX_ELEC_ACESSFEED_TOGGLE=1 +A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL=1 A32NX_ELEC_IDG1LOCK_TOGGLE=0 A32NX_ELEC_IDG2LOCK_TOGGLE=0 A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position=1 diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/model/A320_NEO_INTERIOR.xml b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/model/A320_NEO_INTERIOR.xml index 3ad877a522a..89d56cd79a0 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/model/A320_NEO_INTERIOR.xml +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/model/A320_NEO_INTERIOR.xml @@ -1328,24 +1328,23 @@ PUSH_OVHD_ELEC_COMMERCIAL - L:A32NX_ELEC_COMMERCIAL_TOGGLE + L:A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON - (L:A32NX_ELEC_COMMERCIAL_FAULT, Bool) - (L:A32NX_ELEC_COMMERCIAL_TOGGLE, Bool) ! + (L:A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON, Bool) ! - %((L:A32NX_ELEC_COMMERCIAL_TOGGLE, Bool))%{if}Turn OFF commercial%{else}Turn ON commercial%{end} + %((L:A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON, Bool))%{if}Turn OFF commercial%{else}Turn ON commercial%{end} PUSH_OVHD_ELEC_GALYCAB - L:A32NX_ELEC_GALYCAB_TOGGLE + L:A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO - (L:A32NX_ELEC_GALYCAB_FAULT, Bool) - (L:A32NX_ELEC_GALYCAB_TOGGLE, Bool) ! + (L:A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT, Bool) + (L:A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO, Bool) ! - %((L:A32NX_ELEC_GALYCAB_TOGGLE, Bool))%{if}Turn OFF galy & cab%{else}Turn ON galy & cab%{end} + %((L:A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO, Bool))%{if}Turn OFF galy & cab%{else}Turn ON galy & cab%{end} @@ -1353,9 +1352,9 @@ PUSH_OVHD_ELEC_IDG1 LOCK_OVHD_ELEC_IDG1 - 1 (>L:A32NX_ELEC_IDG1_FAULT) + 1 (>L:A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED) - (L:A32NX_ELEC_IDG1_FAULT) + (L:A32NX_OVHD_ELEC_IDG_1_PB_HAS_FAULT) @@ -1365,9 +1364,9 @@ PUSH_OVHD_ELEC_IDG2 LOCK_OVHD_ELEC_IDG2 - 1 (>L:A32NX_ELEC_IDG2_FAULT) + 1 (>L:A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED) - (L:A32NX_ELEC_IDG2_FAULT) + (L:A32NX_OVHD_ELEC_IDG_2_PB_HAS_FAULT) @@ -1376,19 +1375,19 @@ PUSH_OVHD_ELEC_BUSTIE - L:A32NX_ELEC_BUSTIE_TOGGLE + L:A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO - (L:A32NX_ELEC_BUSTIE_TOGGLE, Bool) ! + (L:A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO, Bool) ! PUSH_OVHD_ELEC_ACESSFEED - L:A32NX_ELEC_ACESSFEED_TOGGLE + L:A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL - (L:A32NX_ELEC_ACESSFEED_FAULT, Bool) - (L:A32NX_ELEC_ACESSFEED_TOGGLE, Bool) ! + (L:A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT, Bool) + (L:A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL, Bool) ! @@ -1396,26 +1395,26 @@ PUSH_OVHD_APU_MASTERSW ELECTRICAL_Switch_APU_Master - (L:A32NX_APU_MASTER_SW_ACTIVATED, Bool) if{ - 0 (>L:A32NX_APU_MASTER_SW_ACTIVATED) + (L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON, Bool) if{ + 0 (>L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON) } els{ (A:ELECTRICAL MAIN BUS VOLTAGE, Volts) 20 > if{ - 1 (>L:A32NX_APU_MASTER_SW_ACTIVATED) + 1 (>L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON) } } - (L:A32NX_APU_MASTER_SW_ACTIVATED, Bool) + (L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON, Bool) - (L:A32NX_APU_MASTER_FAULT, Bool) - (L:A32NX_APU_MASTER_SW_ACTIVATED, Bool) + (L:A32NX_OVHD_APU_MASTER_SW_PB_HAS_FAULT, Bool) + (L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON, Bool) - %((L:A32NX_APU_MASTER_SW_ACTIVATED, Bool))%{if}TT:COCKPIT.TOOLTIPS.APU_SWITCH_TURN_OFF%{else}TT:COCKPIT.TOOLTIPS.APU_SWITCH_TURN_ON%{end} + %((L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON, Bool))%{if}TT:COCKPIT.TOOLTIPS.APU_SWITCH_TURN_OFF%{else}TT:COCKPIT.TOOLTIPS.APU_SWITCH_TURN_ON%{end} PUSH_OVHD_APU_START - (A:ELECTRICAL MAIN BUS VOLTAGE, Volts) 20 > (L:A32NX_APU_MASTER_SW_ACTIVATED, Bool) and + (A:ELECTRICAL MAIN BUS VOLTAGE, Volts) 20 > (L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON, Bool) and diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/runway.FLT b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/runway.FLT index a5637581367..671a6262044 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/runway.FLT +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/runway.FLT @@ -145,15 +145,16 @@ A32NX_BARO_BRIGHTNESS=0.75 A32NX_SWITCH_RADAR_PWS_Position=1 A32NX_SWITCH_TCAS_Position=2 A32NX_COCKPIT_DOOR_LOCKED=1 -A32NX_ELEC_COMMERCIAL_FAULT=0 -A32NX_ELEC_COMMERCIAL_TOGGLE=1 -A32NX_ELEC_GALYCAB_FAULT=0 -A32NX_ELEC_GALYCAB_TOGGLE=1 -A32NX_ELEC_IDG1_FAULT=0 -A32NX_ELEC_IDG2_FAULT=0 -A32NX_ELEC_BUSTIE_TOGGLE=1 -A32NX_ELEC_ACESSFEED_FAULT=0 -A32NX_ELEC_ACESSFEED_TOGGLE=1 +A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED=0 +A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL=1 A32NX_ELEC_IDG1LOCK_TOGGLE=0 A32NX_ELEC_IDG2LOCK_TOGGLE=0 A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position=1 diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/sound/sound.xml b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/sound/sound.xml index 25fe7ad459c..b8cde88cae7 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/sound/sound.xml +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/sound/sound.xml @@ -115,7 +115,7 @@ - + diff --git a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/taxi.flt b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/taxi.flt index 373e557e736..f8c9be17e59 100644 --- a/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/taxi.flt +++ b/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/taxi.flt @@ -149,17 +149,18 @@ A320_Neo_AIRCOND_LVL_3=50 STROBE_1_Auto=1 A32NX_BARO_BRIGHTNESS=0.75 A32NX_COCKPIT_DOOR_LOCKED=1 -A32NX_ELEC_COMMERCIAL_FAULT=0 -A32NX_ELEC_COMMERCIAL_TOGGLE=1 -A32NX_ELEC_GALYCAB_FAULT=0 -A32NX_ELEC_GALYCAB_TOGGLE=1 -A32NX_ELEC_IDG1_FAULT=0 +A32NX_OVHD_ELEC_COMMERCIAL_PB_IS_ON=1 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_GALY_AND_CAB_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_IDG_1_PB_IS_RELEASED=0 A32NX_ELEC_IDG1_TOGGLE=1 -A32NX_ELEC_IDG2_FAULT=0 +A32NX_OVHD_ELEC_IDG_2_PB_IS_RELEASED=0 A32NX_ELEC_IDG2_TOGGLE=1 -A32NX_ELEC_BUSTIE_TOGGLE=1 -A32NX_ELEC_ACESSFEED_FAULT=0 -A32NX_ELEC_ACESSFEED_TOGGLE=1 +A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_BUS_TIE_PB_IS_AUTO=1 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_HAS_FAULT=0 +A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL=1 A32NX_ELEC_IDG1LOCK_TOGGLE=0 A32NX_ELEC_IDG2LOCK_TOGGLE=0 A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position=1 diff --git a/A32NX/html_ui/Pages/A32NX_Core/A32NX_APU.js b/A32NX/html_ui/Pages/A32NX_Core/A32NX_APU.js index 114c3141d07..56b08200a80 100644 --- a/A32NX/html_ui/Pages/A32NX_Core/A32NX_APU.js +++ b/A32NX/html_ui/Pages/A32NX_Core/A32NX_APU.js @@ -7,7 +7,7 @@ class A32NX_APU { this.lastAPUBleedState = -1; } update(_deltaTime) { - const available = SimVar.GetSimVarValue("L:A32NX_APU_AVAILABLE", "Bool"); + const available = SimVar.GetSimVarValue("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool"); const apuSwitchIsOn = !!SimVar.GetSimVarValue("A:APU SWITCH", "Bool"); // Until everything that depends on the APU is moved into WASM, @@ -27,21 +27,12 @@ class A32NX_APU { } const apuGenActive = SimVar.GetSimVarValue("APU GENERATOR ACTIVE", "Bool"); - const externalPowerOff = SimVar.GetSimVarValue("EXTERNAL POWER ON", "Bool") === 0; // This logic is consistently faulty in the JavaScript code: of course it should also take into // account if engine generators are supplying electricity. We'll fix this when we create the electrical system. SimVar.SetSimVarValue("L:APU_GEN_ONLINE", "Bool", available && apuGenActive ? 1 : 0); - SimVar.SetSimVarValue( - "L:APU_LOAD_PERCENT", - "percent", - available && apuGenActive && externalPowerOff - ? Math.max(SimVar.GetSimVarValue("L:A32NX_APU_GEN_AMPERAGE", "Amperes") - / SimVar.GetSimVarValue("ELECTRICAL TOTAL LOAD AMPS", "Amperes"), 0) - : 0 - ); - const apuBleedOn = SimVar.GetSimVarValue("L:A32NX_APU_BLEED_ON", "Bool"); + const apuBleedOn = SimVar.GetSimVarValue("L:A32NX_OVHD_PNEU_APU_BLEED_PB_IS_ON", "Bool"); if (apuBleedOn !== this.lastAPUBleedState) { this.lastAPUBleedState = apuBleedOn; if (apuBleedOn === 1) { diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/BAT/A320_Neo_BAT.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/BAT/A320_Neo_BAT.js index 834bd7ec6d6..594a6d1d349 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/BAT/A320_Neo_BAT.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/BAT/A320_Neo_BAT.js @@ -29,7 +29,7 @@ var A320_Neo_BAT; } } else { for (let i = 0; i < 2; ++i) { - const batValue = SimVar.GetSimVarValue("ELECTRICAL BATTERY BUS VOLTAGE", "Volts"); + const batValue = SimVar.GetSimVarValue(`L:A32NX_ELEC_BAT_${i + 10}_POTENTIAL`, "Volts"); this.batValues[i] = batValue; this.batTexts[i].textContent = this.batValues[i].toFixed(1) + "V"; } diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/A320_Neo_EICAS.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/A320_Neo_EICAS.js index f53ad217682..f0decc9e0d3 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/A320_Neo_EICAS.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/A320_Neo_EICAS.js @@ -231,7 +231,7 @@ class A320_Neo_EICAS extends Airliners.BaseEICAS { this.ACPowerLastState = isACPowerAvailable; // modification start here - const currentAPUMasterState = SimVar.GetSimVarValue("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool"); + const currentAPUMasterState = SimVar.GetSimVarValue("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool"); //Determine displayed page when no button is selected const prevPage = this.pageNameWhenUnselected; @@ -243,7 +243,7 @@ class A320_Neo_EICAS extends Airliners.BaseEICAS { const rightThrottleDetent = Simplane.getEngineThrottleMode(1); const highestThrottleDetent = (leftThrottleDetent >= rightThrottleDetent) ? leftThrottleDetent : rightThrottleDetent; const ToPowerSet = (highestThrottleDetent == ThrottleMode.TOGA || highestThrottleDetent == ThrottleMode.FLEX_MCT) && SimVar.GetSimVarValue("ENG N1 RPM:1", "Percent") > 15 && SimVar.GetSimVarValue("ENG N1 RPM:2", "Percent") > 15; - const apuAvailable = SimVar.GetSimVarValue("L:A32NX_APU_AVAILABLE", "Bool"); + const apuAvailable = SimVar.GetSimVarValue("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool"); const EngModeSel = SimVar.GetSimVarValue("L:XMLVAR_ENG_MODE_SEL", "number"); const spoilerOrFlapsDeployed = SimVar.GetSimVarValue("FLAPS HANDLE INDEX", "number") != 0 || SimVar.GetSimVarValue("SPOILERS HANDLE POSITION", "percent") != 0; diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_APU.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_APU.js index 3d5f7354ffe..8fb6a0ef747 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_APU.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_APU.js @@ -58,25 +58,22 @@ var A320_Neo_LowerECAM_APU; const showApuData = shouldShowApuData(); let allParametersWithinAcceptableRange = false; if (showApuData) { - const load = Math.round(SimVar.GetSimVarValue("L:APU_LOAD_PERCENT","percent")); - this.APUGenLoad.textContent = load; - const loadWithinNormalRange = load <= 100; + this.APUGenLoad.textContent = Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_LOAD", "Percent")); + const loadWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_LOAD_NORMAL", "Bool"); this.APUGenLoad.classList.toggle("APUGenParamValue", loadWithinNormalRange); this.APUGenLoad.classList.toggle("APUGenParamValueWarn", !loadWithinNormalRange); - const volts = SimVar.GetSimVarValue("L:A32NX_APU_GEN_VOLTAGE","Volts"); - this.APUVolts.textContent = volts; - const voltsWithinNormalRange = SimVar.GetSimVarValue("L:A32NX_APU_GEN_VOLTAGE_NORMAL", "Bool"); - this.APUVolts.classList.toggle("APUGenParamValue", voltsWithinNormalRange); - this.APUVolts.classList.toggle("APUGenParamValueWarn", !voltsWithinNormalRange); + this.APUVolts.textContent = Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_POTENTIAL", "Volts")); + const potentialWithinNormalRange = SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_POTENTIAL_NORMAL", "Bool"); + this.APUVolts.classList.toggle("APUGenParamValue", potentialWithinNormalRange); + this.APUVolts.classList.toggle("APUGenParamValueWarn", !potentialWithinNormalRange); - const hertz = SimVar.GetSimVarValue("L:A32NX_APU_GEN_FREQ","Hertz"); - this.APUFrequency.textContent = Math.round(hertz); - const hertzWithinNormalRange = SimVar.GetSimVarValue("L:A32NX_APU_GEN_FREQ_NORMAL", "Bool"); - this.APUFrequency.classList.toggle("APUGenParamValue", hertzWithinNormalRange); - this.APUFrequency.classList.toggle("APUGenParamValueWarn", !hertzWithinNormalRange); + this.APUFrequency.textContent = Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_FREQUENCY", "Hertz")); + const frequencyWithinNormalRange = SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_FREQUENCY_NORMAL", "Bool"); + this.APUFrequency.classList.toggle("APUGenParamValue", frequencyWithinNormalRange); + this.APUFrequency.classList.toggle("APUGenParamValueWarn", !frequencyWithinNormalRange); - allParametersWithinAcceptableRange = loadWithinNormalRange && voltsWithinNormalRange && hertzWithinNormalRange; + allParametersWithinAcceptableRange = loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; } this.APUGenTitle.classList.toggle("APUGenTitle", showApuData && allParametersWithinAcceptableRange); @@ -85,14 +82,13 @@ var A320_Neo_LowerECAM_APU; toggleVisibility(this.APUGenInfo, showApuData); - const available = SimVar.GetSimVarValue("L:A32NX_APU_AVAILABLE", "Bool"); + const available = SimVar.GetSimVarValue("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool"); toggleVisibility(this.APUAvail, available); - const apuGenOnline = SimVar.GetSimVarValue("L:APU_GEN_ONLINE", "Bool") === 1; - const externalPowerOff = SimVar.GetSimVarValue("EXTERNAL POWER ON", "Bool") === 0; - // This logic is consistently faulty in the JavaScript code: of course it should also take into - // account if engine generators are supplying electricity. We'll fix this when we create the electrical system. - toggleVisibility(this.APUGenAvailArrow, available && apuGenOnline && externalPowerOff); + const apuGeneratorContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_3XS_IS_CLOSED", "Bool"); + const atLeastOneBusTieContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_11XU1_IS_CLOSED", "Bool") || + !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_11XU2_IS_CLOSED", "Bool"); + toggleVisibility(this.APUGenAvailArrow, apuGeneratorContactorClosed && atLeastOneBusTieContactorClosed); // ADIRS1 on NAV is the normal operation situation. // Komp: If you switch the displays to DMC 3, then ADIRU 3 is the one providing the data. @@ -223,7 +219,7 @@ var A320_Neo_LowerECAM_APU; // Once ELEC is implemented, this depends on the ECB being powered or not. // The ECB will be powered when the MASTER SW is on and unpower when MASTER SW is off, N = 0, and the flap is closed. const apuFlapOpen = SimVar.GetSimVarValue("L:A32NX_APU_FLAP_ECAM_OPEN", "Bool"); - const apuMasterSwitch = SimVar.GetSimVarValue("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool"); + const apuMasterSwitch = SimVar.GetSimVarValue("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool"); return apuMasterSwitch || getN() > 0 || apuFlapOpen; } diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_BLEED.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_BLEED.js index 354abba500d..bbb2c8f28a6 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_BLEED.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_BLEED.js @@ -146,7 +146,7 @@ var A320_Neo_LowerECAM_BLEED; const apuBleedAirValveOpen = SimVar.GetSimVarValue("L:A32NX_APU_BLEED_AIR_VALVE_OPEN", "Bool"); const currentXbleedState = SimVar.GetSimVarValue("L:A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position", "number"); const radioHeight = SimVar.GetSimVarValue("RADIO HEIGHT", "Feet"); - const apuSwitchState = SimVar.GetSimVarValue("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool") || SimVar.GetSimVarValue("L:A32NX_APU_BLEED_ON", "Bool"); + const apuSwitchState = SimVar.GetSimVarValue("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool") || SimVar.GetSimVarValue("L:A32NX_OVHD_PNEU_APU_BLEED_PB_IS_ON", "Bool"); const fadecStatus = [SimVar.GetSimVarValue("L:A32NX_FADEC_POWERED_ENG1", "bool"), SimVar.GetSimVarValue("L:A32NX_FADEC_POWERED_ENG1", "bool")]; const groundSpeed = SimVar.GetSimVarValue("GPS GROUND SPEED", "Meters per second"); const wingAntiInceState = SimVar.GetSimVarValue("STRUCTURAL DEICE SWITCH", "bool"); diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.html b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.html index 0b7c82e787f..5e526dc9758 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.html +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.html @@ -13,7 +13,7 @@ } path { - stroke-width: 1px; + stroke-width: 0.6px; stroke-linecap: square; stroke-linejoin: miter; } @@ -26,7 +26,7 @@ line-height: 1.25; white-space: pre; word-spacing: 0px; - font-size: 5.6px; + font-size: 5.0px; font-weight: 400; } path { @@ -35,8 +35,11 @@ path.green { stroke: var(--displayGreen); } + path.amber { + stroke: var(--displayAmber); + } rect.bus { - fill: #999999; + fill: #636363; } text.bus { font-weight: 700; @@ -70,6 +73,9 @@ text.small { font-size: 4px; } + text.small-medium { + font-size: 4.5px; + } text.medium { font-size: 5px; } @@ -90,20 +96,20 @@ OFF - BAT - 2 - 31 - V - 2 - A + BAT + 2 + 31 + V + 2 + A - DC BAT + DC BAT OFF BAT - 1 + 1 25.5 V 5.2 @@ -111,15 +117,15 @@ DC - 2 + 2 - DC ESS - SHED + DC ESS + SHED DC - 1 + 1 TR @@ -131,7 +137,7 @@ EMER GEN - EMER GEN + EMER GEN 8 V 77 @@ -154,15 +160,15 @@ AC - 2 + 2 - AC ESS - SHED + AC ESS + SHED AC - 1 + 1 GEN @@ -207,15 +213,20 @@ 2 142 °C - DISC - LO PR + DISC IDG 1 142 °C - DISC - LO PR + DISC + + + STAT INV + 128 + V + 50 + HZ GALLEY SHED @@ -223,36 +234,55 @@ ELEC - STAT INV - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + STAT INV + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -260,13 +290,9 @@ - - - - - \ No newline at end of file + diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.js index 11b34c8729d..7adbd34e351 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Elec.js @@ -1,20 +1,5 @@ var A320_Neo_LowerECAM_Elec; (function (A320_Neo_LowerECAM_Elec) { - const ENUM_BUS = { - 0: 'OFF', - 1: 'GEN1', - 2: 'GEN2', - 3: 'EXTPWR', - 4: 'APUGEN', - 5: 'EMERGEN', - 6: '???', - 7: 'TR1', - 8: 'TR2', - 9: 'TRESS', - 10: 'BAT1', - 11: 'BAT2', - }; - class Page extends Airliners.EICASTemplateElement { constructor() { super(); @@ -148,14 +133,12 @@ var A320_Neo_LowerECAM_Elec; this.e_IDG2_TEMP_VALUE = this.querySelector("#IDG2_TEMP_VALUE"); this.e_IDG2_TEMP_UNIT = this.querySelector("#IDG2_TEMP_UNIT"); this.e_IDG2_DISC = this.querySelector("#IDG2_DISC"); - this.e_IDG2_LOPR = this.querySelector("#IDG2_LOPR"); this.e_IDG1_TITLE = this.querySelector("#IDG1_TITLE"); this.e_IDG1_TITLE_NUMBER = this.querySelector("#IDG1_TITLE_NUMBER"); this.e_IDG1_TEMP_VALUE = this.querySelector("#IDG1_TEMP_VALUE"); this.e_IDG1_TEMP_UNIT = this.querySelector("#IDG1_TEMP_UNIT"); this.e_IDG1_DISC = this.querySelector("#IDG1_DISC"); - this.e_IDG1_LOPR = this.querySelector("#IDG1_LOPR"); this.e_GALLEY_SHED_TOP = this.querySelector("#GALLEY_SHED_TOP"); this.e_GALLEY_SHED_BOTTOM = this.querySelector("#GALLEY_SHED_BOTTOM"); @@ -163,31 +146,44 @@ var A320_Neo_LowerECAM_Elec; this.e_TITLE_HEADING = this.querySelector("#TITLE_HEADING"); this.e_TITLE_UNDERLINE = this.querySelector("#TITLE_UNDERLINE"); + this.e_STATINV_BAT_TITLE = this.querySelector("#STATINV_BAT_TITLE"); + + this.e_STATINV_BOX = this.querySelector("#STATINV_BOX"); this.e_STATINV_TITLE = this.querySelector("#STATINV_TITLE"); + this.e_STATINV_VOLTS_VALUE = this.querySelector("#STATINV_VOLTS_VALUE"); + this.e_STATINV_VOLTS_UNIT = this.querySelector("#STATINV_VOLTS_UNIT"); + this.e_STATINV_FREQ_VALUE = this.querySelector("#STATINV_FREQ_VALUE"); + this.e_STATINV_FREQ_UNIT = this.querySelector("#STATINV_FREQ_UNIT"); + + this.e_WIRE_EXT_PWR_AC_BUS_1 = this.querySelector("#WIRE_EXT_PWR_AC_BUS_1"); + this.e_WIRE_EXT_PWR_AC_BUS_2 = this.querySelector("#WIRE_EXT_PWR_AC_BUS_2"); + this.e_WIRE_EXT_PWR_AC_BUS_1_2 = this.querySelector("#WIRE_EXT_PWR_AC_BUS_1_2"); + + this.e_WIRE_APU_GEN_AC_BUS_1 = this.querySelector("#WIRE_APU_GEN_AC_BUS_1"); + this.e_WIRE_APU_GEN_AC_BUS_2 = this.querySelector("#WIRE_APU_GEN_AC_BUS_2"); + this.e_WIRE_APU_GEN_AC_BUS_1_2 = this.querySelector("#WIRE_APU_GEN_AC_BUS_1_2"); + + this.e_WIRE_GEN1_AC_BUS_1 = this.querySelector("#WIRE_GEN1_AC_BUS_1"); + this.e_WIRE_GEN1_AC_BUS_1_2 = this.querySelector("#WIRE_GEN1_AC_BUS_1_2"); + + this.e_WIRE_GEN2_AC_BUS_2 = this.querySelector("#WIRE_GEN2_AC_BUS_2"); + this.e_WIRE_GEN2_AC_BUS_1_2 = this.querySelector("#WIRE_GEN2_AC_BUS_1_2"); - this.e_WIRE_XFEED_C = this.querySelector("#WIRE_XFEED-C"); - this.e_WIRE_XFEED_B = this.querySelector("#WIRE_XFEED-B"); - this.e_WIRE_XFEED_A = this.querySelector("#WIRE_XFEED-A"); - this.e_WIRE_APUGEN_XFEED = this.querySelector("#WIRE_APUGEN_XFEED"); - this.e_WIRE_EXTPWR_XFEED = this.querySelector("#WIRE_EXTPWR_XFEED"); - this.e_WIRE_XFEED_AC1 = this.querySelector("#WIRE_XFEED_AC1"); - this.e_WIRE_GEN1_XFEED = this.querySelector("#WIRE_GEN1_XFEED"); - this.e_WIRE_XFEED_AC2 = this.querySelector("#WIRE_XFEED_AC2"); - this.e_WIRE_GEN2_XFEED = this.querySelector("#WIRE_GEN2_XFEED"); - this.e_WIRE_AC2_ACESS = this.querySelector("#WIRE_AC2_ACESS"); this.e_WIRE_AC1_ACESS = this.querySelector("#WIRE_AC1_ACESS"); + this.e_WIRE_AC2_ACESS = this.querySelector("#WIRE_AC2_ACESS"); + + this.e_WIRE_DC1_DCBAT = this.querySelector("#WIRE_DC1_DCBAT"); + this.e_WIRE_DC1_DCBAT_DCESS = this.querySelector("#WIRE_DC1_DCBAT_DCESS"); + + this.e_WIRE_DCBAT_DCESS = this.querySelector("#WIRE_DCBAT_DCESS"); + + this.e_WIRE_DC2_DCBAT = this.querySelector("#WIRE_DC2_DCBAT"); + this.e_WIRE_AC1_TR1 = this.querySelector("#WIRE_AC1_TR1"); this.e_WIRE_TR1_DC1 = this.querySelector("#WIRE_TR1_DC1"); this.e_WIRE_ACESS_ESSTR = this.querySelector("#WIRE_ACESS_ESSTR"); - this.e_WIRE_DC1_DCBAT_A = this.querySelector("#WIRE_DC1_DCBAT-A"); - this.e_WIRE_DC1_DCBAT_B = this.querySelector("#WIRE_DC1_DCBAT-B"); - this.e_WIRE_DCESS_DCBAT = this.querySelector("#WIRE_DCESS_DCBAT"); - this.e_WIRE_DCBAT_BAT2 = this.querySelector("#WIRE_DCBAT_BAT2"); - this.e_WIRE_BAT2_DCBAT = this.querySelector("#WIRE_BAT2_DCBAT"); - this.e_WIRE_DC2_DCBAT_A = this.querySelector("#WIRE_DC2_DCBAT-A"); - this.e_WIRE_DC2_DCBAT_B = this.querySelector("#WIRE_DC2_DCBAT-B"); - this.e_WIRE_BAT1_DCBAT = this.querySelector("#WIRE_BAT1_DCBAT"); - this.e_WIRE_DCBAT_BAT1 = this.querySelector("#WIRE_DCBAT_BAT1"); + this.e_WIRE_BAT1_DCBAT_FULL = this.querySelector("#WIRE_BAT1_DCBAT_FULL"); + this.e_WIRE_BAT2_DCBAT_FULL = this.querySelector("#WIRE_BAT2_DCBAT_FULL"); this.e_WIRE_AC2_TR2 = this.querySelector("#WIRE_AC2_TR2"); this.e_WIRE_TR2_DC2 = this.querySelector("#WIRE_TR2_DC2"); this.e_WIRE_EMERGEN_ESSTR = this.querySelector("#WIRE_EMERGEN_ESSTR"); @@ -200,861 +196,459 @@ var A320_Neo_LowerECAM_Elec; this.e_ARROW_EXTPWR_XFEED = this.querySelector("#ARROW_EXTPWR_XFEED"); this.e_ARROW_APUGEN_XFEED = this.querySelector("#ARROW_APUGEN_XFEED"); this.e_ARROW_EMERGEN_ESSTR = this.querySelector("#ARROW_EMERGEN_ESSTR"); - this.e_ARROW_BAT1_DCBAT = this.querySelector("#ARROW_BAT1_DCBAT"); - this.e_ARROW_BAT2_DCBAT = this.querySelector("#ARROW_BAT2_DCBAT"); - this.e_ARROW_DCBAT_BAT1 = this.querySelector("#ARROW_DCBAT_BAT1"); - this.e_ARROW_DCBAT_BAT2 = this.querySelector("#ARROW_DCBAT_BAT2"); this.e_ARROW_EMERGEN_ACESS = this.querySelector("#ARROW_EMERGEN_ACESS"); this.e_ARROW_BAT1_STATINV = this.querySelector("#ARROW_BAT1_STATINV"); - this.systems = {}; - this.values = {}; - this.buses = {}; - this.internals = {}; - this.switches = {}; - - this.setBAT1_OFF(); - this.setBAT2_OFF(); - this.setGEN1_OFF(); - this.setGEN2_OFF(); - this.setAPUGEN_OFF(); - this.setEXTPWR_OFF(); - this.setESSTR_OFF(); - this.setEMERGEN_OFF(); - this.setDCESSBUS_SHED_OFF(); - this.setACESSBUS_SHED_OFF(); - this.setIDG1_LOPR_OFF(); - this.setIDG1_DISC_OFF(); - this.setIDG2_LOPR_OFF(); - this.setIDG2_DISC_OFF(); - this.setGALLEY_SHED_OFF(); - this.setSTATINV_OFF(); - - this.setCONNECTION_DCBAT_BAT1_OFF(); - this.setCONNECTION_DCBAT_BAT2_OFF(); - this.setCONNECTION_BAT1_DCBAT_DISCHARGE_OFF(); - this.setCONNECTION_BAT2_DCBAT_DISCHARGE_OFF(); - this.setCONNECTION_DCBAT_BAT1_CHARGE_OFF(); - this.setCONNECTION_DCBAT_BAT2_CHARGE_OFF(); - this.setCONNECTION_DC1_DCBAT_OFF(); - this.setCONNECTION_DC2_DCBAT_OFF(); - this.setCONNECTION_DCESS_DCBAT_OFF(); - this.setCONNECTION_EMERGEN_ESSTR_OFF(); - this.setCONNECTION_EMERGEN_ACESS_OFF(); - this.setCONNECTION_ESSTR_DCESS_OFF(); - this.setCONNECTION_ACESS_ESSTR_OFF(); - this.setCONNECTION_APUGEN_XFEED_OFF(); - this.setCONNECTION_EXTPWR_XFEED_OFF(); - this.setCONNECTION_AC1_ACESS_OFF(); - this.setCONNECTION_AC2_ACESS_OFF(); - this.setCONNECTION_GEN1_AC1_OFF(); - this.setCONNECTION_GEN2_AC2_OFF(); - this.setCONNECTION_XFEED_OFF(); - this.setCONNECTION_AC1_TR1_OFF(); - this.setCONNECTION_AC2_TR2_OFF(); - this.setCONNECTION_TR1_DC1_OFF(); - this.setCONNECTION_TR2_DC2_OFF(); - this.updateThrottler = new UpdateThrottler(500); this.isInitialised = true; - - this.updateVariables(); - this.systemDraw(); } update(_deltaTime) { if (this.updateThrottler.canUpdate(_deltaTime) === -1) { return; } - this.systemDraw(); - } - updateVariables() { - this.systems.BAT1 = this.getSimVar_ONOFF('BATT1_ONLINE'); - this.systems.BAT2 = this.getSimVar_ONOFF('BATT2_ONLINE'); - this.values.BAT1_CAP = this.getSimVar_Number('BATT1_CAPACITY'); - this.values.BAT2_CAP = this.getSimVar_Number('BATT2_CAPACITY'); - this.values.BAT1_VOLTS = this.getSimVar_Number('BATT1_VOLTAGE'); - this.values.BAT2_VOLTS = this.getSimVar_Number('BATT2_VOLTAGE'); - this.values.BAT1_AMPS = this.getSimVar_Number('BATT1_AMPERAGE'); - this.values.BAT2_AMPS = this.getSimVar_Number('BATT2_AMPERAGE'); - this.values.DCBAT_LOAD = this.getSimVar_Number('BATT_BUS_LOAD'); - - this.systems.EXTPWR = this.getSimVar_ONOFF('EXT_GEN_ONLINE'); - this.values.EXTPWR_VOLTS = this.getSimVar_Number('EXT_GEN_VOLTAGE'); - this.values.EXTPWR_AMPS = this.getSimVar_Number('EXT_GEN_AMPERAGE'); - this.values.EXTPWR_FREQ = this.getSimVar_Number('EXT_GEN_FREQ'); - - this.systems.APUGEN = this.getSimVar_ONOFF('APU_GEN_ONLINE'); - this.values.APUGEN_VOLTS = this.getSimVar_Number('A32NX_APU_GEN_VOLTAGE'); - this.values.APUGEN_AMPS = this.getSimVar_Number('A32NX_APU_GEN_AMPERAGE'); - this.values.APUGEN_FREQ = this.getSimVar_Number('A32NX_APU_GEN_FREQ'); - this.values.APUGEN_LOAD = this.getSimVar_Number('APU_LOAD_PERCENT'); - - this.systems.GEN1 = this.getSimVar_ONOFF('GEN1_ONLINE'); - this.systems.GEN2 = this.getSimVar_ONOFF('GEN2_ONLINE'); - this.values.GEN1_VOLTS = this.getSimVar_Number('GEN1_VOLTAGE'); - this.values.GEN2_VOLTS = this.getSimVar_Number('GEN2_VOLTAGE'); - this.values.GEN1_AMPS = this.getSimVar_Number('GEN1_AMPERAGE'); - this.values.GEN2_AMPS = this.getSimVar_Number('GEN2_AMPERAGE'); - this.values.GEN1_FREQ = this.getSimVar_Number('GEN1_FREQ'); - this.values.GEN2_FREQ = this.getSimVar_Number('GEN2_FREQ'); - this.values.IDG1_TEMP = this.getSimVar_Number('GEN1_IDG_TEMP'); - this.values.IDG2_TEMP = this.getSimVar_Number('GEN2_IDG_TEMP'); - - this.systems.EMERGEN = this.getSimVar_ONOFF('EMER_ONLINE'); - this.values.EMERGEN_VOLTS = this.getSimVar_Number('EMER_VOLTAGE'); - this.values.EMERGEN_AMPS = this.getSimVar_Number('EMER_AMPERAGE'); - this.values.EMERGEN_FREQ = this.getSimVar_Number('EMER_FREQ'); - - this.buses.AC1 = this.getSimVar_BusEnum('AC_BUS1'); - this.buses.AC2 = this.getSimVar_BusEnum('AC_BUS2'); - this.buses.ACESS = this.getSimVar_BusEnum('AC_ESS'); - this.buses.ACSHED = this.getSimVar_BusEnum('AC_SHED'); - this.buses.GALLEY_SHED = this.getSimVar_BusEnum('GALLEY_SHED'); - this.buses.DC1 = this.getSimVar_BusEnum('DC_BUS1'); - this.buses.DC2 = this.getSimVar_BusEnum('DC_BUS2'); - this.buses.DCBAT = this.getSimVar_BusEnum('DC_BATBUS'); - this.buses.DCESS = this.getSimVar_BusEnum('DC_ESS'); - this.buses.DCSHED = this.getSimVar_BusEnum('DC_SHED'); - this.buses.HOT1 = this.getSimVar_BusEnum('HOT_BUS1'); - this.buses.HOT2 = this.getSimVar_BusEnum('HOT_BUS2'); - - this.systems.TR1 = this.getSimVar_ONOFF('TR1_ONLINE'); - this.systems.TR2 = this.getSimVar_ONOFF('TR2_ONLINE'); - this.systems.TRESS = this.getSimVar_ONOFF('TRESS_ONLINE'); - this.values.TR1_VOLTS = this.getSimVar_Number('TR1_VOLTAGE'); - this.values.TR2_VOLTS = this.getSimVar_Number('TR2_VOLTAGE'); - this.values.TRESS_VOLTS = this.getSimVar_Number('TRESS_VOLTAGE'); - this.values.TR1_AMPS = this.getSimVar_Number('TR1_AMPERAGE'); - this.values.TR2_AMPS = this.getSimVar_Number('TR2_AMPERAGE'); - this.values.TRESS_AMPS = this.getSimVar_Number('TRESS_AMPERAGE'); - - this.systems.STATINV = this.getSimVar_ONOFF('STATICINV_ONLINE'); - this.values.STATINV_VOLTS = this.getSimVar_Number('STATICINV_VOLTAGE'); - this.values.STATINV_AMPS = this.getSimVar_Number('STATICINV_AMPERAGE'); - this.values.STATINV_FREQ = this.getSimVar_Number('STATICINV_FREQ'); - - this.internals.AC_AVAIL = this.getSimVar_Bool('ACPowerAvailable'); - this.internals.DC_AVAIL = this.getSimVar_Bool('DCPowerAvailable'); - - this.switches.ACESS_FEED_AUTO = this.getSimVar_Bool('A32NX_ELEC_ACESSFEED_TOGGLE'); - this.switches.COMMERCIAL_ON = this.getSimVar_Bool('A32NX_ELEC_COMMERCIAL_TOGGLE'); - this.switches.GALYCAB_ON = this.getSimVar_Bool('A32NX_ELEC_GALYCAB_TOGGLE'); - } + this.draw(); + } + + draw() { + this.drawApuGenerator(); + this.drawEngineGenerators(); + this.drawExternalPower(); + this.drawAcPowerSourcesToAcReceivers(); + this.drawPowerSourcesToDcReceivers(); + this.drawBuses(); + this.drawTransformerRectifiers(); + this.drawBatteries(); + this.drawEmergencyGenerator(); + this.drawStaticInverter(); + this.drawIntegratedDriveGenerators(); + this.drawGalleyShed(); + } + + drawApuGenerator() { + const apuMasterSwPbOn = !!SimVar.GetSimVarValue("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool"); + const apuGenSwitchOn = !!SimVar.GetSimVarValue('APU GENERATOR SWITCH:1', 'Bool'); + this.toggle(this.e_APUGEN_OFF, apuMasterSwPbOn && !apuGenSwitchOn); + this.toggle(this.e_APUGEN_BOX, apuMasterSwPbOn); + + this.setValue(this.e_APUGEN_LOAD_VALUE, 50); + this.toggle(this.e_APUGEN_LOAD_VALUE, apuMasterSwPbOn && apuGenSwitchOn); + this.toggle(this.e_APUGEN_LOAD_UNIT, apuMasterSwPbOn && apuGenSwitchOn); + this.toggle(this.e_APUGEN_VOLTS_VALUE, apuMasterSwPbOn && apuGenSwitchOn); + this.toggle(this.e_APUGEN_VOLTS_UNIT, apuMasterSwPbOn && apuGenSwitchOn); + this.toggle(this.e_APUGEN_FREQ_VALUE, apuMasterSwPbOn && apuGenSwitchOn); + this.toggle(this.e_APUGEN_FREQ_UNIT, apuMasterSwPbOn && apuGenSwitchOn); + + let allParametersWithinAcceptableRange = false; + if (apuMasterSwPbOn && apuGenSwitchOn) { + this.setValue(this.e_APUGEN_LOAD_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_LOAD", "Percent"))); + const loadWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_LOAD_NORMAL", "Bool"); + this.greenWhen(this.e_APUGEN_LOAD_VALUE, loadWithinNormalRange); + + this.setValue(this.e_APUGEN_VOLTS_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_POTENTIAL", "Volts"))); + const potentialWithinNormalRange = SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_POTENTIAL_NORMAL", "Bool"); + this.greenWhen(this.e_APUGEN_VOLTS_VALUE, potentialWithinNormalRange); + + this.setValue(this.e_APUGEN_FREQ_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_FREQUENCY", "Hertz"))); + const frequencyWithinNormalRange = SimVar.GetSimVarValue("L:A32NX_ELEC_APU_GEN_1_FREQUENCY_NORMAL", "Bool"); + this.greenWhen(this.e_APUGEN_FREQ_VALUE, frequencyWithinNormalRange); + + allParametersWithinAcceptableRange = loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; + } - getSimVar_Bool(varName) { - return Math.random() > 0.5; - } + this.toggle(this.e_APUGEN_TITLE, true); + this.whiteWhen(this.e_APUGEN_TITLE, (!apuMasterSwPbOn || (apuGenSwitchOn && allParametersWithinAcceptableRange))); + } + + drawEngineGenerators() { + this.drawEngineGenerator(1, { + off: this.e_GEN1_OFF, + box: this.e_GEN1_BOX, + title: this.e_GEN1_TITLE, + titleNumber: this.e_GEN1_TITLE_NUMBER, + loadValue: this.e_GEN1_LOAD_VALUE, + loadUnit: this.e_GEN1_LOAD_UNIT, + voltsValue: this.e_GEN1_VOLTS_VALUE, + voltsUnit: this.e_GEN1_VOLTS_UNIT, + frequencyValue: this.e_GEN1_FREQ_VALUE, + frequencyUnit: this.e_GEN1_FREQ_UNIT + }); + + this.drawEngineGenerator(2, { + off: this.e_GEN2_OFF, + box: this.e_GEN2_BOX, + title: this.e_GEN2_TITLE, + titleNumber: this.e_GEN2_TITLE_NUMBER, + loadValue: this.e_GEN2_LOAD_VALUE, + loadUnit: this.e_GEN2_LOAD_UNIT, + voltsValue: this.e_GEN2_VOLTS_VALUE, + voltsUnit: this.e_GEN2_VOLTS_UNIT, + frequencyValue: this.e_GEN2_FREQ_VALUE, + frequencyUnit: this.e_GEN2_FREQ_UNIT + }); + } + + drawEngineGenerator(number, elements) { + const engineGeneratorPbOn = !!SimVar.GetSimVarValue("GENERAL ENG MASTER ALTERNATOR:" + number, "Bool"); + + this.toggle(elements.off, !engineGeneratorPbOn); + this.toggle(elements.box, true); + + this.toggle(elements.loadValue, engineGeneratorPbOn); + this.setValue(elements.loadValue, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_ENG_GEN_" + number + "_LOAD", "Percent"))); + const loadWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_ENG_GEN_" + number + "_LOAD_NORMAL", "Bool"); + this.greenWhen(elements.loadValue, loadWithinNormalRange); + this.toggle(elements.loadUnit, engineGeneratorPbOn); + + this.toggle(elements.voltsValue, engineGeneratorPbOn); + this.setValue(elements.voltsValue, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_ENG_GEN_" + number + "_POTENTIAL", "Volts"))); + const potentialWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_ENG_GEN_" + number + "_POTENTIAL_NORMAL", "Bool"); + this.greenWhen(elements.voltsValue, potentialWithinNormalRange); + this.toggle(elements.voltsUnit, engineGeneratorPbOn); + + this.toggle(elements.frequencyValue, engineGeneratorPbOn); + this.setValue(elements.frequencyValue, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_ENG_GEN_" + number + "_FREQUENCY", "Hertz"))); + const frequencyWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_ENG_GEN_" + number + "_FREQUENCY_NORMAL", "Bool"); + this.greenWhen(elements.frequencyValue, frequencyWithinNormalRange); + this.toggle(elements.frequencyUnit, engineGeneratorPbOn); + + const allParametersWithinAcceptableRange = loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; + this.whiteWhen(elements.title, engineGeneratorPbOn && allParametersWithinAcceptableRange); + this.whiteWhen(elements.titleNumber, engineGeneratorPbOn && allParametersWithinAcceptableRange); + } + + drawExternalPower() { + const externalPowerAvailable = !!SimVar.GetSimVarValue("EXTERNAL POWER AVAILABLE:1", "Bool"); + + this.toggle(this.e_EXTPWR_BOX, externalPowerAvailable); + this.toggle(this.e_EXTPWR_TITLE, externalPowerAvailable); + + this.toggle(this.e_EXTPWR_VOLTS_VALUE, externalPowerAvailable); + this.setValue(this.e_EXTPWR_VOLTS_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_EXT_PWR_POTENTIAL", "Volts"))); + const potentialWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_EXT_PWR_POTENTIAL_NORMAL", "Bool"); + this.greenWhen(this.e_EXTPWR_VOLTS_VALUE, potentialWithinNormalRange); + this.toggle(this.e_EXTPWR_VOLTS_UNIT, externalPowerAvailable); + + this.toggle(this.e_EXTPWR_FREQ_VALUE, externalPowerAvailable); + this.setValue(this.e_EXTPWR_FREQ_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_EXT_PWR_FREQUENCY", "Hertz"))); + const frequencyWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_EXT_PWR_FREQUENCY_NORMAL", "Bool"); + this.greenWhen(this.e_EXTPWR_FREQ_VALUE, frequencyWithinNormalRange); + this.toggle(this.e_EXTPWR_FREQ_UNIT, externalPowerAvailable); + + const allParametersWithinAcceptableRange = potentialWithinNormalRange && frequencyWithinNormalRange; + this.whiteWhen(this.e_EXTPWR_TITLE, allParametersWithinAcceptableRange); + } + + drawAcPowerSourcesToAcReceivers() { + const generatorLineContactor1Closed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_9XU1_IS_CLOSED", "Bool"); + const generatorLineContactor2Closed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_9XU2_IS_CLOSED", "Bool"); + const busTieContactor1Closed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_11XU1_IS_CLOSED", "Bool"); + const busTieContactor2Closed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_11XU2_IS_CLOSED", "Bool"); + + this.toggle(this.e_ARROW_XFEED_AC1, generatorLineContactor1Closed || busTieContactor1Closed); + this.toggle(this.e_WIRE_GEN1_AC_BUS_1, generatorLineContactor1Closed && !busTieContactor1Closed); + this.toggle(this.e_WIRE_GEN1_AC_BUS_1_2, generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed); + + this.toggle(this.e_ARROW_XFEED_AC2, generatorLineContactor2Closed || busTieContactor2Closed); + this.toggle(this.e_WIRE_GEN2_AC_BUS_2, generatorLineContactor2Closed && !busTieContactor2Closed); + this.toggle(this.e_WIRE_GEN2_AC_BUS_1_2, generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed); + + const externalPowerContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_3XG_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_EXT_PWR_AC_BUS_1, externalPowerContactorClosed && busTieContactor1Closed && !busTieContactor2Closed); + this.toggle(this.e_WIRE_EXT_PWR_AC_BUS_2, externalPowerContactorClosed && !busTieContactor1Closed && busTieContactor2Closed); + this.toggle(this.e_WIRE_EXT_PWR_AC_BUS_1_2, externalPowerContactorClosed && busTieContactor1Closed && busTieContactor2Closed); + this.toggle(this.e_ARROW_EXTPWR_XFEED, externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed)); + + const apuGeneratorContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_3XS_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_APU_GEN_AC_BUS_1, apuGeneratorContactorClosed && busTieContactor1Closed && !busTieContactor2Closed); + this.toggle(this.e_WIRE_APU_GEN_AC_BUS_2, apuGeneratorContactorClosed && !busTieContactor1Closed && busTieContactor2Closed); + this.toggle(this.e_WIRE_APU_GEN_AC_BUS_1_2, apuGeneratorContactorClosed && busTieContactor1Closed && busTieContactor2Closed); + this.toggle(this.e_ARROW_APUGEN_XFEED, apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed)); + + const acEssFeedContactor1Closed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_3XC1_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_AC1_ACESS, acEssFeedContactor1Closed); + + const acEssFeedContactor2Closed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_3XC2_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_AC2_ACESS, acEssFeedContactor2Closed); + + // This particular wire is always visible. It becomes amber when AC BUS 1 is (partially) unpowered. + const acBus1IsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_AC_1_BUS_IS_POWERED", "Bool"); + this.toggle(this.e_WIRE_AC1_TR1, true); + this.greenWhen(this.e_WIRE_AC1_TR1, acBus1IsPowered); + + // This particular wire is always visible. It becomes amber when AC BUS 2 is (partially) unpowered. + const acBus2IsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_AC_2_BUS_IS_POWERED", "Bool"); + this.toggle(this.e_WIRE_AC2_TR2, true); + this.greenWhen(this.e_WIRE_AC2_TR2, acBus2IsPowered); + } + + drawBuses() { + const acBus1IsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_AC_1_BUS_IS_POWERED", "Bool"); + this.greenWhen(this.e_ACBUS1_TITLE, acBus1IsPowered); + this.greenWhen(this.e_ACBUS1_TITLE_NUMBER, acBus1IsPowered); + + const acBus2IsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_AC_2_BUS_IS_POWERED", "Bool"); + this.greenWhen(this.e_ACBUS2_TITLE, acBus2IsPowered); + this.greenWhen(this.e_ACBUS2_TITLE_NUMBER, acBus2IsPowered); + + const acEssBusIsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED", "Bool"); + this.greenWhen(this.e_ACESSBUS_TITLE, acEssBusIsPowered); + const acEssShedBusIsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED", "Bool"); + this.toggle(this.e_ACESSBUS_SHED, !acEssShedBusIsPowered); + + const dcBatBusIsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_DC_BAT_BUS_IS_POWERED", "Bool"); + const atLeastOneBatteryIsAuto = !!SimVar.GetSimVarValue("L:A32NX_OVHD_ELEC_BAT_10_PB_IS_AUTO", "Bool") + || !!SimVar.GetSimVarValue("L:A32NX_OVHD_ELEC_BAT_11_PB_IS_AUTO", "Bool"); + + // TODO: When battery voltage is implemented. The title should also be amber when BAT BUS voltage < 25 V. + this.greenWhen(this.e_DCBATBUS_TITLE, dcBatBusIsPowered && atLeastOneBatteryIsAuto); + this.setValue(this.e_DCBATBUS_TITLE, dcBatBusIsPowered && atLeastOneBatteryIsAuto ? "DC BAT" : "XX"); + + const dcBus1IsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_DC_1_BUS_IS_POWERED", "Bool"); + this.greenWhen(this.e_DCBUS1_TITLE, dcBus1IsPowered); + this.greenWhen(this.e_DCBUS1_TITLE_NUMBER, dcBus1IsPowered); + + const dcBus2IsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_DC_2_BUS_IS_POWERED", "Bool"); + this.greenWhen(this.e_DCBUS2_TITLE, dcBus2IsPowered); + this.greenWhen(this.e_DCBUS2_TITLE_NUMBER, dcBus2IsPowered); - getSimVar_Number(varName) { - return (Math.random() * 300).toFixed(0); + const dcEssBusIsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_DC_ESS_BUS_IS_POWERED", "Bool"); + this.greenWhen(this.e_DCESSBUS_TITLE, dcEssBusIsPowered); + const dcEssShedBusIsPowered = !!SimVar.GetSimVarValue("L:A32NX_ELEC_DC_ESS_SHED_BUS_IS_POWERED", "Bool"); + this.toggle(this.e_DCESSBUS_SHED, !dcEssShedBusIsPowered); + } + + drawPowerSourcesToDcReceivers() { + const tr1ContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_TR1_DC1, tr1ContactorClosed); + + const tr2ContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_5PU2_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_TR2_DC2, tr2ContactorClosed); + + const dcBus1ToBatBusContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_1PC1_IS_CLOSED", "Bool"); + const dcBatBusToDcEssBusContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_4PC_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_DC1_DCBAT, dcBus1ToBatBusContactorClosed && !dcBatBusToDcEssBusContactorClosed); + this.toggle(this.e_WIRE_DC1_DCBAT_DCESS, dcBus1ToBatBusContactorClosed && dcBatBusToDcEssBusContactorClosed); + + const dcBus2ToBatBusContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_1PC2_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_DC2_DCBAT, dcBus2ToBatBusContactorClosed); + + const battery1ContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_6PB1_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_BAT1_DCBAT_FULL, battery1ContactorClosed); + + const battery2ContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_6PB2_IS_CLOSED", "Bool"); + this.toggle(this.e_WIRE_BAT2_DCBAT_FULL, battery2ContactorClosed); + } + + drawTransformerRectifiers() { + this.drawTransformerRectifier(1, { + title: this.e_TR1_TITLE, + titleNumber: this.e_TR1_TITLE_NUMBER, + voltsValue: this.e_TR1_VOLTS_VALUE, + ampsValue: this.e_TR1_AMPS_VALUE + }); + this.drawTransformerRectifier(2, { + title: this.e_TR2_TITLE, + titleNumber: this.e_TR2_TITLE_NUMBER, + voltsValue: this.e_TR2_VOLTS_VALUE, + ampsValue: this.e_TR2_AMPS_VALUE + }); + + const trEssContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_3PE_IS_CLOSED", "Bool"); + this.toggle(this.e_ESSTR_BOX, trEssContactorClosed); + this.toggle(this.e_ESSTR_VOLTS_VALUE, trEssContactorClosed); + this.toggle(this.e_ESSTR_VOLTS_UNIT, trEssContactorClosed); + this.toggle(this.e_ESSTR_AMPS_VALUE, trEssContactorClosed); + this.toggle(this.e_ESSTR_AMPS_UNIT, trEssContactorClosed); + + this.toggle(this.e_WIRE_ACESS_ESSTR, trEssContactorClosed); + + this.toggle(this.e_WIRE_ESSTR_DCESS, trEssContactorClosed); + this.greenOrWhiteOtherwise(this.e_ARROW_ESSTR_DCESS, trEssContactorClosed); + + this.drawTransformerRectifier(3, { + title: this.e_ESSTR_TITLE, + voltsValue: this.e_ESSTR_VOLTS_VALUE, + ampsValue: this.e_ESSTR_AMPS_VALUE + }, !trEssContactorClosed); + } + + drawTransformerRectifier(number, elements, titleMustRemainWhite) { + const potentialWithinNormalRange = !!SimVar.GetSimVarValue(`L:A32NX_ELEC_TR_${number}_POTENTIAL_NORMAL`, "Bool"); + this.setValue(elements.voltsValue, Math.round(SimVar.GetSimVarValue(`L:A32NX_ELEC_TR_${number}_POTENTIAL`, "Volts"))); + this.greenWhen(elements.voltsValue, potentialWithinNormalRange); + + const currentWithinNormalRange = !!SimVar.GetSimVarValue(`L:A32NX_ELEC_TR_${number}_CURRENT_NORMAL`, "Bool"); + this.setValue(elements.ampsValue, Math.round(SimVar.GetSimVarValue(`L:A32NX_ELEC_TR_${number}_CURRENT`, "Ampere"))); + this.greenWhen(elements.ampsValue, currentWithinNormalRange); + + const allParametersWithinAcceptableRange = potentialWithinNormalRange && currentWithinNormalRange; + this.whiteWhen(elements.title, titleMustRemainWhite || allParametersWithinAcceptableRange); + if (elements.titleNumber) { + this.whiteWhen(elements.titleNumber, allParametersWithinAcceptableRange); + } } - getSimVar_ONOFF(varName) { - return Math.random() > 0.5 ? 'ON' : 'OFF'; - } + drawBatteries() { + this.drawBattery(10, { + off: this.e_BAT1_OFF, + title: this.e_BAT1_TITLE, + titleNumber: this.e_BAT1_TITLE_NUMBER, + voltsValue: this.e_BAT1_VOLTS_VALUE, + voltsUnit: this.e_BAT1_VOLTS_UNIT, + ampsValue: this.e_BAT1_AMPS_VALUE, + ampsUnit: this.e_BAT1_AMPS_UNIT, + }); + this.drawBattery(11, { + off: this.e_BAT2_OFF, + title: this.e_BAT2_TITLE, + titleNumber: this.e_BAT2_TITLE_NUMBER, + voltsValue: this.e_BAT2_VOLTS_VALUE, + voltsUnit: this.e_BAT2_VOLTS_UNIT, + ampsValue: this.e_BAT2_AMPS_VALUE, + ampsUnit: this.e_BAT2_AMPS_UNIT, + }); + } + + drawBattery(number, elements) { + const batPushButtonIsAuto = !!SimVar.GetSimVarValue(`L:A32NX_OVHD_ELEC_BAT_${number}_PB_IS_AUTO`, "Bool"); + + this.toggle(elements.off, !batPushButtonIsAuto); + + this.toggle(elements.voltsValue, batPushButtonIsAuto); + this.setValue(elements.voltsValue, Math.round(SimVar.GetSimVarValue(`L:A32NX_ELEC_BAT_${number}_POTENTIAL`, "Volts"))); + const potentialWithinNormalRange = !!SimVar.GetSimVarValue(`L:A32NX_ELEC_BAT_${number}_POTENTIAL_NORMAL`, "Bool"); + this.greenWhen(elements.voltsValue, potentialWithinNormalRange); + this.toggle(elements.voltsUnit, batPushButtonIsAuto); + + this.toggle(elements.ampsValue, batPushButtonIsAuto); + this.setValue(elements.ampsValue, Math.round(SimVar.GetSimVarValue(`L:A32NX_ELEC_BAT_${number}_CURRENT`, "Ampere"))); + const currentWithinNormalRange = !!SimVar.GetSimVarValue(`L:A32NX_ELEC_BAT_${number}_CURRENT_NORMAL`, "Bool"); + this.greenWhen(elements.ampsValue, currentWithinNormalRange); + this.toggle(elements.ampsUnit, batPushButtonIsAuto); + + const allParametersWithinAcceptableRange = potentialWithinNormalRange && currentWithinNormalRange; + this.whiteWhen(elements.title, !batPushButtonIsAuto || allParametersWithinAcceptableRange); + this.whiteWhen(elements.titleNumber, !batPushButtonIsAuto || allParametersWithinAcceptableRange); + } + + drawEmergencyGenerator() { + const emergencyGenContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_2XE_IS_CLOSED", "Bool"); + this.toggle(this.e_EMERGEN_OFFLINE, !emergencyGenContactorClosed); + this.toggle(this.e_EMERGEN_BOX, emergencyGenContactorClosed); + this.toggle(this.e_EMERGEN_TITLE, emergencyGenContactorClosed); + + this.toggle(this.e_EMERGEN_VOLTS_VALUE, emergencyGenContactorClosed); + this.setValue(this.e_EMERGEN_VOLTS_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_EMER_GEN_POTENTIAL", "Volts"))); + const potentialWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_EMER_GEN_POTENTIAL_NORMAL", "Bool"); + this.greenWhen(this.e_EMERGEN_VOLTS_VALUE, potentialWithinNormalRange); + this.toggle(this.e_EMERGEN_VOLTS_UNIT, emergencyGenContactorClosed); + + this.toggle(this.e_EMERGEN_FREQ_VALUE, emergencyGenContactorClosed); + this.setValue(this.e_EMERGEN_FREQ_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_EMER_GEN_CURRENT", "Ampere"))); + const currentWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_EMER_GEN_CURRENT_NORMAL", "Bool"); + this.greenWhen(this.e_EMERGEN_FREQ_VALUE, currentWithinNormalRange); + this.toggle(this.e_EMERGEN_FREQ_UNIT, emergencyGenContactorClosed); + + const allParametersWithinAcceptableRange = potentialWithinNormalRange && currentWithinNormalRange; + this.whiteWhen(this.e_EMERGEN_TITLE, allParametersWithinAcceptableRange); + + this.greenOrWhiteOtherwise(this.e_ARROW_EMERGEN_ESSTR, emergencyGenContactorClosed); + this.toggle(this.e_WIRE_EMERGEN_ESSTR, emergencyGenContactorClosed); + + const acEssBusContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_15XE1_IS_CLOSED", "Bool"); + this.toggle(this.e_ARROW_EMERGEN_ACESS, acEssBusContactorClosed && emergencyGenContactorClosed); + this.toggle(this.e_WIRE_EMERGEN_ACESS, acEssBusContactorClosed && emergencyGenContactorClosed); + } + + drawStaticInverter() { + const staticInverterToAcEssContactorClosed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED", "Bool"); + this.toggle(this.e_ARROW_BAT1_STATINV, staticInverterToAcEssContactorClosed); + this.toggle(this.e_STATINV_BAT_TITLE, staticInverterToAcEssContactorClosed); + + this.toggle(this.e_STATINV_BOX, staticInverterToAcEssContactorClosed); + this.toggle(this.e_STATINV_TITLE, staticInverterToAcEssContactorClosed); + + this.toggle(this.e_STATINV_VOLTS_VALUE, staticInverterToAcEssContactorClosed); + this.setValue(this.e_STATINV_VOLTS_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_STAT_INV_POTENTIAL", "Volts"))); + const potentialWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_STAT_INV_POTENTIAL_NORMAL", "Bool"); + this.greenWhen(this.e_STATINV_VOLTS_VALUE, potentialWithinNormalRange); + this.toggle(this.e_STATINV_VOLTS_UNIT, staticInverterToAcEssContactorClosed); + + this.toggle(this.e_STATINV_FREQ_VALUE, staticInverterToAcEssContactorClosed); + this.setValue(this.e_STATINV_FREQ_VALUE, Math.round(SimVar.GetSimVarValue("L:A32NX_ELEC_STAT_INV_FREQUENCY", "Ampere"))); + const frequencyWithinNormalRange = !!SimVar.GetSimVarValue("L:A32NX_ELEC_STAT_INV_FREQUENCY_NORMAL", "Bool"); + this.greenWhen(this.e_STATINV_FREQ_VALUE, frequencyWithinNormalRange); + this.toggle(this.e_STATINV_FREQ_UNIT, staticInverterToAcEssContactorClosed); + + const allParametersWithinAcceptableRange = potentialWithinNormalRange && frequencyWithinNormalRange; + this.whiteWhen(this.e_STATINV_TITLE, allParametersWithinAcceptableRange); + } + + drawIntegratedDriveGenerators() { + this.drawIntegratedDriveGenerator(1, { + title: this.e_IDG1_TITLE, + tempValue: this.e_IDG1_TEMP_VALUE, + disc: this.e_IDG1_DISC + }); + this.drawIntegratedDriveGenerator(2, { + title: this.e_IDG2_TITLE, + tempValue: this.e_IDG2_TEMP_VALUE, + disc: this.e_IDG2_DISC + }); + } + + drawIntegratedDriveGenerator(number, elements) { + const temperature = Math.round(SimVar.GetSimVarValue(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_OIL_OUTLET_TEMPERATURE`, "Celsius")); + this.setValue(elements.tempValue, temperature); - getSimVar_BusEnum(varName) { - const index = Math.floor(Math.random() * 11); - return ENUM_BUS[index]; + const connected = !!SimVar.GetSimVarValue(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_IS_CONNECTED`, "Bool"); + this.whiteWhen(elements.title, connected); + this.toggle(elements.disc, !connected); } - systemDraw() { - - this.switches.ACESS_FEED_AUTO = SimVar.GetSimVarValue('L:A32NX_ELEC_ACESSFEED_TOGGLE', 'bool') !== 0; - - // Level 1 - Generators - if (this.systems.GEN1 === 'ON') { - this.setGEN1_ON(); - this.setCONNECTION_GEN1_AC1_ON(); - this.buses.AC1 = 'ON'; // move to after gen layer - if (this.systems.EXTPWR === 'OFF' && this.systems.APUGEN === 'OFF' && this.systems.GEN2 === 'OFF') { - this.setCONNECTION_XFEED_ON(); - this.setCONNECTION_XFEED_AC2_ON(); - this.buses.AC2 = 'ON'; - } - } else { - this.setGEN1_OFF(); - this.setCONNECTION_GEN1_XFEED_OFF(); - if (this.systems.GEN2 === 'OFF' && this.systems.APUGEN === 'OFF' && this.systems.EXTPWR === 'OFF') { - this.setCONNECTION_XFEED_AC1_OFF(); - } - } - - if (this.systems.GEN2 === 'ON') { - this.setGEN2_ON(); - this.setCONNECTION_GEN2_AC2_ON(); - this.buses.AC2 = 'ON'; - if (this.systems.EXTPWR === 'OFF' && this.systems.APUGEN === 'OFF' && this.systems.GEN1 === 'OFF') { - this.setCONNECTION_XFEED_ON(); - this.setCONNECTION_XFEED_AC1_ON(); - this.buses.AC1 = 'ON'; - } - } else { - this.setGEN2_OFF(); - this.setCONNECTION_GEN2_XFEED_OFF(); - if (this.systems.GEN1 === 'OFF' && this.systems.APUGEN === 'OFF' && this.systems.EXTPWR === 'OFF') { - this.setCONNECTION_XFEED_AC2_OFF(); - } - } + drawGalleyShed() { + const galleyIsShed = !!SimVar.GetSimVarValue("L:A32NX_ELEC_GALLEY_IS_SHED", "Bool"); + this.toggle(this.e_GALLEY_SHED_TOP, galleyIsShed); + this.toggle(this.e_GALLEY_SHED_BOTTOM, galleyIsShed); + } - if (this.systems.EXTPWR === 'ON') { - this.setCONNECTION_XFEED_OFF(); - this.setEXTPWR_ON(); - if (this.systems.GEN1 === 'OFF' || this.systems.GEN2 === 'OFF') { - this.setCONNECTION_EXTPWR_XFEED_ON(); - if (this.systems.GEN1 === 'OFF') { - this.setCONNECTION_XFEED_A_ON(); - this.setCONNECTION_XFEED_B_ON(); - this.setCONNECTION_XFEED_AC1_ON(); - this.buses.AC1 = 'ON'; - } - if (this.systems.GEN2 === 'OFF') { - this.setCONNECTION_XFEED_C_ON(); - this.setCONNECTION_XFEED_AC2_ON(); - this.buses.AC2 = 'ON'; - } - } else { - this.setCONNECTION_EXTPWR_XFEED_OFF(); - } + toggle(element, condition) { + if (condition) { + this.show(element); } else { - this.setEXTPWR_OFF(); - this.setCONNECTION_EXTPWR_XFEED_OFF(); + this.hide(element); } + } - if (this.systems.APUGEN === 'ON') { - this.setAPUGEN_ON(); - if (this.systems.EXTPWR === 'OFF') { - this.setCONNECTION_XFEED_OFF(); - if (this.systems.GEN1 === 'OFF' || this.systems.GEN2 === 'OFF') { - this.setCONNECTION_APUGEN_XFEED_ON(); - if (this.systems.GEN1 === 'OFF') { - this.setCONNECTION_XFEED_A_ON(); - this.setCONNECTION_XFEED_AC1_ON(); - this.buses.AC1 = 'ON'; - } - if (this.systems.GEN2 === 'OFF') { - this.setCONNECTION_XFEED_B_ON(); - this.setCONNECTION_XFEED_C_ON(); - this.setCONNECTION_XFEED_AC2_ON(); - this.buses.AC2 = 'ON'; - } - } else { - this.setCONNECTION_APUGEN_XFEED_OFF(); - } - } else { - this.setCONNECTION_APUGEN_XFEED_OFF(); - } + whiteWhen(element, condition) { + if (condition) { + this.white(element); } else { - this.setAPUGEN_OFF(); - this.setCONNECTION_APUGEN_XFEED_OFF(); + this.amber(element); } + } - // Level 2 - AC Buses - if (this.buses.AC1 === 'ON') { - this.setCONNECTION_AC1_TR1_ON(); - this.systems.TR1 = 'ON'; - if (this.switches.ACESS_FEED_AUTO === true || this.buses.AC2 === 'OFF') { - this.setCONNECTION_AC1_ACESS_ON(); - this.setCONNECTION_AC2_ACESS_OFF(); - this.buses.ACESS = 'ON'; - } - } - if (this.buses.AC2 === 'ON') { - this.setCONNECTION_AC2_TR2_ON(); - this.systems.TR2 = 'ON'; - if (this.switches.ACESS_FEED_AUTO === false || this.buses.AC1 === 'OFF') { - this.setCONNECTION_AC2_ACESS_ON(); - this.setCONNECTION_AC1_ACESS_OFF(); - this.buses.ACESS = 'ON'; - } - } - if (this.buses.GALLEY_SHED === true) { - this.setGALLEY_SHED_ON(); + greenWhen(element, condition) { + if (condition) { + this.green(element); } else { - this.setGALLEY_SHED_OFF(); - } - - // Level 3 - TR - if (this.systems.TR1 === 'ON') { - this.setCONNECTION_TR1_DC1_ON(); - this.buses.DC1 = 'ON'; - } - if (this.systems.TR2 === 'ON') { - this.setCONNECTION_TR2_DC2_ON(); - this.buses.DC2 = 'ON'; + this.amber(element); } + } - // Level 4A - Batteries - // if (this.systems.BAT1 === 'ON') { - // this.setBAT1_ON() - // if (this.internal.BAT1_DIR === 'CHARGE') { - // this.setCONNECTION_DCBAT_BAT1_OFF() - // this.setCONNECTION_BAT1_DCBAT_DISCHARGE_OFF() - // this.setCONNECTION_DCBAT_BAT1_CHARGE_ON() - // } else if (this.internal.BAT1_DIR === 'DISCHARGE') { - // this.setCONNECTION_DCBAT_BAT1_OFF() - // this.setCONNECTION_DCBAT_BAT1_CHARGE_OFF() - // this.setCONNECTION_BAT1_DCBAT_DISCHARGE_ON() - // } else if (this.internal.BAT1_DIR === 'IDLE') { - // this.setCONNECTION_DCBAT_BAT1_CHARGE_OFF() - // this.setCONNECTION_BAT1_DCBAT_DISCHARGE_OFF() - // this.setCONNECTION_DCBAT_BAT1_ON() - // } else { - // this.setCONNECTION_DCBAT_BAT1_OFF() - // this.setCONNECTION_DCBAT_BAT1_CHARGE_OFF() - // this.setCONNECTION_BAT1_DCBAT_DISCHARGE_OFF() - // } - // } else { - // this.setBAT1_OFF() - // if (this.internal.BAT2_DIR === 'CHARGE') { - // this.setCONNECTION_DCBAT_BAT2_OFF() - // this.setCONNECTION_BAT2_DCBAT_DISCHARGE_OFF() - // this.setCONNECTION_DCBAT_BAT2_CHARGE_ON() - // } else if (this.internal.BAT2_DIR === 'DISCHARGE') { - // this.setCONNECTION_DCBAT_BAT2_OFF() - // this.setCONNECTION_DCBAT_BAT2_CHARGE_OFF() - // this.setCONNECTION_DCBAT_BAT2_DISCHARGE_ON() - // } else if (this.internal.BAT2_DIR === 'IDLE') { - // this.setCONNECTION_DCBAT_BAT2_CHARGE_OFF() - // this.setCONNECTION_BAT2_DCBAT_DISCHARGE_OFF() - // this.setCONNECTION_DCBAT_BAT2_ON() - // } else { - // this.setCONNECTION_DCBAT_BAT2_OFF() - // this.setCONNECTION_DCBAT_BAT2_CHARGE_OFF() - // this.setCONNECTION_BAT2_DCBAT_DISCHARGE_OFF() - // } - // } - - if (this.systems.BAT2 === 'ON') { - this.setBAT2_ON(); + greenOrWhiteOtherwise(element, condition) { + if (condition) { + this.green(element); } else { - this.setBAT2_OFF(); + this.white(element); } - - // Level 4 - DC Buses - if (this.buses.DC1 === 'ON') { - this.setCONNECTION_DC1_DCBAT_ON(); - this.buses.DCBAT = 'ON'; - this.setCONNECTION_DCESS_DCBAT_ON(); - this.buses.DCESS = 'ON'; - } - if (this.buses.DC2 === 'ON') { - - } - - } - - /** - * Individual Indicator Controls - */ - setFAULT_TR1_ON() { - this.amber(this.e_TR1_TITLE); - this.amber(this.e_TR1_TITLE_NUMBER); - this.amber(this.e_TR1_VOLTS_VALUE); - this.amber(this.e_TR1_AMPS_VALUE); - } - setFAULT_TR1_OFF() { - this.green(this.e_TR1_TITLE); - this.green(this.e_TR1_TITLE_NUMBER); - this.green(this.e_TR1_VOLTS_VALUE); - this.green(this.e_TR1_AMPS_VALUE); - } - - setFAULT_TR2_ON() { - this.amber(this.e_TR2_TITLE); - this.amber(this.e_TR2_TITLE_NUMBER); - this.amber(this.e_TR2_VOLTS_VALUE); - this.amber(this.e_TR2_AMPS_VALUE); - } - setFAULT_TR2_OFF() { - this.green(this.e_TR2_TITLE); - this.green(this.e_TR2_TITLE_NUMBER); - this.green(this.e_TR2_VOLTS_VALUE); - this.green(this.e_TR2_AMPS_VALUE); - } - - setBAT1_ON() { - this.hide(this.e_BAT1_OFF); - this.show(this.e_BAT1_BOX); - this.show(this.e_BAT1_TITLE); - this.show(this.e_BAT1_VOLTS_VALUE); - this.show(this.e_BAT1_VOLTS_UNIT); - this.show(this.e_BAT1_AMPS_VALUE); - this.show(this.e_BAT1_AMPS_UNIT); - } - setBAT1_OFF() { - this.show(this.e_BAT1_OFF); - this.show(this.e_BAT1_BOX); - this.show(this.e_BAT1_TITLE); - this.hide(this.e_BAT1_VOLTS_VALUE); - this.hide(this.e_BAT1_VOLTS_UNIT); - this.hide(this.e_BAT1_AMPS_VALUE); - this.hide(this.e_BAT1_AMPS_UNIT); - } - - setBAT2_ON() { - this.hide(this.e_BAT2_OFF); - this.show(this.e_BAT2_BOX); - this.show(this.e_BAT2_TITLE); - this.show(this.e_BAT2_VOLTS_VALUE); - this.show(this.e_BAT2_VOLTS_UNIT); - this.show(this.e_BAT2_AMPS_VALUE); - this.show(this.e_BAT2_AMPS_UNIT); - } - setBAT2_OFF() { - this.show(this.e_BAT2_OFF); - this.show(this.e_BAT2_BOX); - this.show(this.e_BAT2_TITLE); - this.hide(this.e_BAT2_VOLTS_VALUE); - this.hide(this.e_BAT2_VOLTS_UNIT); - this.hide(this.e_BAT2_AMPS_VALUE); - this.hide(this.e_BAT2_AMPS_UNIT); - } - - setGEN1_ON() { - this.hide(this.e_GEN1_OFF); - this.show(this.e_GEN1_BOX); - this.show(this.e_GEN1_TITLE); - this.show(this.e_GEN1_TITLE_NUMBER); - this.show(this.e_GEN1_LOAD_VALUE); - this.show(this.e_GEN1_LOAD_UNIT); - this.show(this.e_GEN1_VOLTS_VALUE); - this.show(this.e_GEN1_VOLTS_UNIT); - this.show(this.e_GEN1_FREQ_VALUE); - this.show(this.e_GEN1_FREQ_UNIT); - } - setGEN1_OFF() { - this.show(this.e_GEN1_OFF); - this.show(this.e_GEN1_BOX); - this.show(this.e_GEN1_TITLE); - this.show(this.e_GEN1_TITLE_NUMBER); - this.hide(this.e_GEN1_LOAD_VALUE); - this.hide(this.e_GEN1_LOAD_UNIT); - this.hide(this.e_GEN1_VOLTS_VALUE); - this.hide(this.e_GEN1_VOLTS_UNIT); - this.hide(this.e_GEN1_FREQ_VALUE); - this.hide(this.e_GEN1_FREQ_UNIT); - } - - setGEN2_ON() { - this.hide(this.e_GEN2_OFF); - this.show(this.e_GEN2_BOX); - this.show(this.e_GEN2_TITLE); - this.show(this.e_GEN2_TITLE_NUMBER); - this.show(this.e_GEN2_LOAD_VALUE); - this.show(this.e_GEN2_LOAD_UNIT); - this.show(this.e_GEN2_VOLTS_VALUE); - this.show(this.e_GEN2_VOLTS_UNIT); - this.show(this.e_GEN2_FREQ_VALUE); - this.show(this.e_GEN2_FREQ_UNIT); - } - setGEN2_OFF() { - this.show(this.e_GEN2_OFF); - this.show(this.e_GEN2_BOX); - this.show(this.e_GEN2_TITLE); - this.show(this.e_GEN2_TITLE_NUMBER); - this.hide(this.e_GEN2_LOAD_VALUE); - this.hide(this.e_GEN2_LOAD_UNIT); - this.hide(this.e_GEN2_VOLTS_VALUE); - this.hide(this.e_GEN2_VOLTS_UNIT); - this.hide(this.e_GEN2_FREQ_VALUE); - this.hide(this.e_GEN2_FREQ_UNIT); - } - - setAPUGEN_ON() { - this.hide(this.e_APUGEN_OFF); - this.show(this.e_APUGEN_BOX); - this.show(this.e_APUGEN_TITLE); - this.show(this.e_APUGEN_LOAD_VALUE); - this.show(this.e_APUGEN_LOAD_UNIT); - this.show(this.e_APUGEN_VOLTS_VALUE); - this.show(this.e_APUGEN_VOLTS_UNIT); - this.show(this.e_APUGEN_FREQ_VALUE); - this.show(this.e_APUGEN_FREQ_UNIT); - } - setAPUGEN_OFF() { - this.hide(this.e_APUGEN_OFF); - this.hide(this.e_APUGEN_BOX); - this.show(this.e_APUGEN_TITLE); - this.hide(this.e_APUGEN_LOAD_VALUE); - this.hide(this.e_APUGEN_LOAD_UNIT); - this.hide(this.e_APUGEN_VOLTS_VALUE); - this.hide(this.e_APUGEN_VOLTS_UNIT); - this.hide(this.e_APUGEN_FREQ_VALUE); - this.hide(this.e_APUGEN_FREQ_UNIT); - } - - setEXTPWR_ON() { - this.show(this.e_EXTPWR_BOX); - this.show(this.e_EXTPWR_TITLE); - this.show(this.e_EXTPWR_VOLTS_VALUE); - this.show(this.e_EXTPWR_VOLTS_UNIT); - this.show(this.e_EXTPWR_FREQ_VALUE); - this.show(this.e_EXTPWR_FREQ_UNIT); - } - setEXTPWR_OFF() { - this.hide(this.e_EXTPWR_BOX); - this.hide(this.e_EXTPWR_TITLE); - this.hide(this.e_EXTPWR_VOLTS_VALUE); - this.hide(this.e_EXTPWR_VOLTS_UNIT); - this.hide(this.e_EXTPWR_FREQ_VALUE); - this.hide(this.e_EXTPWR_FREQ_UNIT); - } - - setESSTR_ON() { - this.show(this.e_ESSTR_BOX); - this.show(this.e_ESSTR_TITLE); - this.show(this.e_ESSTR_VOLTS_VALUE); - this.show(this.e_ESSTR_VOLTS_UNIT); - this.show(this.e_ESSTR_AMPS_VALUE); - this.show(this.e_ESSTR_AMPS_UNIT); - } - setESSTR_OFF() { - this.hide(this.e_ESSTR_BOX); - this.show(this.e_ESSTR_TITLE); - this.hide(this.e_ESSTR_VOLTS_VALUE); - this.hide(this.e_ESSTR_VOLTS_UNIT); - this.hide(this.e_ESSTR_AMPS_VALUE); - this.hide(this.e_ESSTR_AMPS_UNIT); - } - - setEMERGEN_ON() { - this.hide(this.e_EMERGEN_OFFLINE); - this.show(this.e_EMERGEN_BOX); - this.show(this.e_EMERGEN_TITLE); - this.show(this.e_EMERGEN_VOLTS_VALUE); - this.show(this.e_EMERGEN_VOLTS_UNIT); - this.show(this.e_EMERGEN_FREQ_VALUE); - this.show(this.e_EMERGEN_FREQ_UNIT); - } - setEMERGEN_OFF() { - this.show(this.e_EMERGEN_OFFLINE); - this.hide(this.e_EMERGEN_BOX); - this.hide(this.e_EMERGEN_TITLE); - this.hide(this.e_EMERGEN_VOLTS_VALUE); - this.hide(this.e_EMERGEN_VOLTS_UNIT); - this.hide(this.e_EMERGEN_FREQ_VALUE); - this.hide(this.e_EMERGEN_FREQ_UNIT); - } - - setACESSBUS_SHED_ON() { - this.show(this.e_ACESSBUS_SHED); - } - setACESSBUS_SHED_OFF() { - this.hide(this.e_ACESSBUS_SHED); - } - - setIDG1_LOPR_ON() { - this.show(this.e_IDG1_LOPR); - } - setIDG1_LOPR_OFF() { - this.hide(this.e_IDG1_LOPR); - } - - setIDG2_LOPR_ON() { - this.show(this.e_IDG2_LOPR); - } - setIDG2_LOPR_OFF() { - this.hide(this.e_IDG2_LOPR); - } - - setIDG1_DISC_ON() { - this.show(this.e_IDG1_DISC); - } - setIDG1_DISC_OFF() { - this.hide(this.e_IDG1_DISC); - } - - setIDG2_DISC_ON() { - this.show(this.e_IDG2_DISC); - } - setIDG2_DISC_OFF() { - this.hide(this.e_IDG2_DISC); - } - - setDCESSBUS_SHED_ON() { - this.show(this.e_DCESSBUS_SHED); - } - setDCESSBUS_SHED_OFF() { - this.hide(this.e_DCESSBUS_SHED); - } - - setGALLEY_SHED_ON() { - this.show(this.e_GALLEY_SHED_TOP); - this.show(this.e_GALLEY_SHED_BOTTOM); - } - setGALLEY_SHED_OFF() { - this.hide(this.e_GALLEY_SHED_TOP); - this.hide(this.e_GALLEY_SHED_BOTTOM); - } - - setSTATINV_ON() { - this.show(this.e_STATINV_TITLE); - this.show(this.e_ARROW_BAT1_STATINV); - } - setSTATINV_OFF() { - this.hide(this.e_STATINV_TITLE); - this.hide(this.e_ARROW_BAT1_STATINV); - } - - setCONNECTION_DCBAT_BAT1_ON() { - this.show(this.e_WIRE_DCBAT_BAT1); - this.show(this.e_WIRE_BAT1_DCBAT); - } - setCONNECTION_DCBAT_BAT1_OFF() { - this.hide(this.e_WIRE_DCBAT_BAT1); - this.hide(this.e_WIRE_BAT1_DCBAT); - } - - setCONNECTION_DCBAT_BAT2_ON() { - this.show(this.e_WIRE_DCBAT_BAT2); - this.show(this.e_WIRE_BAT2_DCBAT); - } - setCONNECTION_DCBAT_BAT2_OFF() { - this.hide(this.e_WIRE_DCBAT_BAT2); - this.hide(this.e_WIRE_BAT2_DCBAT); - } - - setCONNECTION_DCBAT_BAT1_CHARGE_ON() { - this.show(this.e_WIRE_DCBAT_BAT1); - this.show(this.e_ARROW_DCBAT_BAT1); - } - setCONNECTION_DCBAT_BAT1_CHARGE_OFF() { - this.hide(this.e_WIRE_DCBAT_BAT1); - this.hide(this.e_ARROW_DCBAT_BAT1); - } - - setCONNECTION_DCBAT_BAT2_CHARGE_ON() { - this.show(this.e_WIRE_DCBAT_BAT2); - this.show(this.e_ARROW_DCBAT_BAT2); - } - setCONNECTION_DCBAT_BAT2_CHARGE_OFF() { - this.hide(this.e_WIRE_DCBAT_BAT2); - this.hide(this.e_ARROW_DCBAT_BAT2); - } - - setCONNECTION_BAT1_DCBAT_DISCHARGE_ON() { - this.show(this.e_WIRE_BAT1_DCBAT); - this.show(this.e_ARROW_BAT1_DCBAT); - } - setCONNECTION_BAT1_DCBAT_DISCHARGE_OFF() { - this.hide(this.e_WIRE_BAT1_DCBAT); - this.hide(this.e_ARROW_BAT1_DCBAT); - } - - setCONNECTION_BAT2_DCBAT_DISCHARGE_ON() { - this.show(this.e_WIRE_BAT2_DCBAT); - this.show(this.e_ARROW_BAT2_DCBAT); - } - setCONNECTION_BAT2_DCBAT_DISCHARGE_OFF() { - this.hide(this.e_WIRE_BAT2_DCBAT); - this.hide(this.e_ARROW_BAT2_DCBAT); - } - - setCONNECTION_DC1_DCBAT_ON() { - this.show(this.e_WIRE_DC1_DCBAT_A); - this.show(this.e_WIRE_DC1_DCBAT_B); - } - setCONNECTION_DC1_DCBAT_OFF() { - this.hide(this.e_WIRE_DC1_DCBAT_A); - this.hide(this.e_WIRE_DC1_DCBAT_B); - } - - setCONNECTION_DC2_DCBAT_ON() { - this.show(this.e_WIRE_DC2_DCBAT_A); - this.show(this.e_WIRE_DC2_DCBAT_B); - } - setCONNECTION_DC2_DCBAT_OFF() { - this.hide(this.e_WIRE_DC2_DCBAT_A); - this.hide(this.e_WIRE_DC2_DCBAT_B); - } - - setCONNECTION_DCESS_DCBAT_ON() { - this.show(this.e_WIRE_DCESS_DCBAT); - this.show(this.e_WIRE_DC1_DCBAT_B); - } - setCONNECTION_DCESS_DCBAT_OFF() { - this.hide(this.e_WIRE_DCESS_DCBAT); - this.hide(this.e_WIRE_DC1_DCBAT_B); - } - - setCONNECTION_ESSTR_DCESS_ON() { - this.show(this.e_WIRE_ESSTR_DCESS); - } - setCONNECTION_ESSTR_DCESS_OFF() { - this.hide(this.e_WIRE_ESSTR_DCESS); - } - - setCONNECTION_EMERGEN_ESSTR_ON() { - this.show(this.e_WIRE_EMERGEN_ESSTR); - } - setCONNECTION_EMERGEN_ESSTR_OFF() { - this.hide(this.e_WIRE_EMERGEN_ESSTR); - } - - setCONNECTION_EMERGEN_ACESS_ON() { - this.show(this.e_WIRE_EMERGEN_ACESS); - this.show(this.e_ARROW_EMERGEN_ACESS); - } - setCONNECTION_EMERGEN_ACESS_OFF() { - this.hide(this.e_WIRE_EMERGEN_ACESS); - this.hide(this.e_ARROW_EMERGEN_ACESS); - } - - setCONNECTION_ACESS_ESSTR_ON() { - this.show(this.e_WIRE_ACESS_ESSTR); - } - setCONNECTION_ACESS_ESSTR_OFF() { - this.hide(this.e_WIRE_ACESS_ESSTR); - } - - setCONNECTION_APUGEN_XFEED_ON() { - this.show(this.e_WIRE_APUGEN_XFEED); - this.show(this.e_ARROW_APUGEN_XFEED); - } - setCONNECTION_APUGEN_XFEED_OFF() { - this.hide(this.e_WIRE_APUGEN_XFEED); - this.hide(this.e_ARROW_APUGEN_XFEED); - } - - setCONNECTION_EXTPWR_XFEED_ON() { - this.show(this.e_WIRE_EXTPWR_XFEED); - this.show(this.e_ARROW_EXTPWR_XFEED); - } - setCONNECTION_EXTPWR_XFEED_OFF() { - this.hide(this.e_WIRE_EXTPWR_XFEED); - this.hide(this.e_ARROW_EXTPWR_XFEED); - } - - setCONNECTION_AC1_ACESS_ON() { - this.show(this.e_WIRE_AC1_ACESS); - } - setCONNECTION_AC1_ACESS_OFF() { - this.hide(this.e_WIRE_AC1_ACESS); - } - - setCONNECTION_AC2_ACESS_ON() { - this.show(this.e_WIRE_AC2_ACESS); - } - setCONNECTION_AC2_ACESS_OFF() { - this.hide(this.e_WIRE_AC2_ACESS); - } - - setCONNECTION_GEN1_AC1_ON() { - this.show(this.e_WIRE_GEN1_XFEED); - this.show(this.e_WIRE_XFEED_AC1); - this.show(this.e_ARROW_XFEED_AC1); - } - setCONNECTION_GEN1_AC1_OFF() { - this.hide(this.e_WIRE_GEN1_XFEED); - this.hide(this.e_WIRE_XFEED_AC1); - this.hide(this.e_ARROW_XFEED_AC1); - } - - setCONNECTION_GEN2_AC2_ON() { - this.show(this.e_WIRE_GEN2_XFEED); - this.show(this.e_WIRE_XFEED_AC2); - this.show(this.e_ARROW_XFEED_AC2); - } - setCONNECTION_GEN2_AC2_OFF() { - this.hide(this.e_WIRE_GEN2_XFEED); - this.hide(this.e_WIRE_XFEED_AC2); - this.hide(this.e_ARROW_XFEED_AC2); - } - - setCONNECTION_GEN1_XFEED_ON() { - this.show(this.e_WIRE_GEN1_XFEED); - } - setCONNECTION_GEN1_XFEED_OFF() { - this.hide(this.e_WIRE_GEN1_XFEED); - } - - setCONNECTION_GEN2_XFEED_ON() { - this.show(this.e_WIRE_GEN2_XFEED); - } - setCONNECTION_GEN2_XFEED_OFF() { - this.hide(this.e_WIRE_GEN2_XFEED); - } - - setCONNECTION_XFEED_ON() { - this.show(this.e_WIRE_XFEED_A); - this.show(this.e_WIRE_XFEED_B); - this.show(this.e_WIRE_XFEED_C); - } - setCONNECTION_XFEED_OFF() { - this.hide(this.e_WIRE_XFEED_A); - this.hide(this.e_WIRE_XFEED_B); - this.hide(this.e_WIRE_XFEED_C); - } - - setCONNECTION_XFEED_A_ON() { - this.show(this.e_WIRE_XFEED_A); - } - setCONNECTION_XFEED_A_OFF() { - this.hide(this.e_WIRE_XFEED_A); - } - - setCONNECTION_XFEED_B_ON() { - this.show(this.e_WIRE_XFEED_B); - } - setCONNECTION_XFEED_B_OFF() { - this.hide(this.e_WIRE_XFEED_B); - } - - setCONNECTION_XFEED_C_ON() { - this.show(this.e_WIRE_XFEED_C); - } - setCONNECTION_XFEED_C_OFF() { - this.hide(this.e_WIRE_XFEED_C); - } - - setCONNECTION_XFEED_AC1_ON() { - this.show(this.e_WIRE_XFEED_AC1); - this.show(this.e_ARROW_XFEED_AC1); - } - setCONNECTION_XFEED_AC1_OFF() { - this.hide(this.e_WIRE_XFEED_AC1); - this.hide(this.e_ARROW_XFEED_AC1); - } - - setCONNECTION_XFEED_AC2_ON() { - this.show(this.e_WIRE_XFEED_AC2); - this.show(this.e_ARROW_XFEED_AC2); - } - setCONNECTION_XFEED_AC2_OFF() { - this.hide(this.e_WIRE_XFEED_AC2); - this.hide(this.e_ARROW_XFEED_AC2); - } - - setCONNECTION_AC1_TR1_ON() { - this.show(this.e_WIRE_AC1_TR1); - } - setCONNECTION_AC1_TR1_OFF() { - this.hide(this.e_WIRE_AC1_TR1); - } - - setCONNECTION_AC2_TR2_ON() { - this.show(this.e_WIRE_AC2_TR2); - } - setCONNECTION_AC2_TR2_OFF() { - this.hide(this.e_WIRE_AC2_TR2); - } - - setCONNECTION_TR1_DC1_ON() { - this.show(this.e_WIRE_TR1_DC1); - } - setCONNECTION_TR1_DC1_OFF() { - this.hide(this.e_WIRE_TR1_DC1); } - setCONNECTION_TR2_DC2_ON() { - this.show(this.e_WIRE_TR2_DC2); - } - setCONNECTION_TR2_DC2_OFF() { - this.hide(this.e_WIRE_TR2_DC2); + setValue(element, value) { + element.textContent = value; } /** @@ -1078,6 +672,11 @@ var A320_Neo_LowerECAM_Elec; element.classList.add("amber"); } + white(element) { + element.classList.remove("green"); + element.classList.remove("amber"); + } + onEvent(_event) { } @@ -1085,4 +684,3 @@ var A320_Neo_LowerECAM_Elec; A320_Neo_LowerECAM_Elec.Page = Page; })(A320_Neo_LowerECAM_Elec || (A320_Neo_LowerECAM_Elec = {})); customElements.define("a320-neo-lower-ecam-elec", A320_Neo_LowerECAM_Elec.Page); -//# sourceMappingURL=A320_Neo_LowerECAM_Elec.js.map diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Fuel.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Fuel.js index 15ee088a490..ecd7459fe8d 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Fuel.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_LowerECAM_Fuel.js @@ -154,7 +154,7 @@ var A320_Neo_LowerECAM_Fuel; this.middlePump2_On.setAttribute("visibility", "hidden"); } - this.setAPUState(SimVar.GetSimVarValue("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool"), SimVar.GetSimVarValue("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool")); + this.setAPUState(SimVar.GetSimVarValue("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool"), SimVar.GetSimVarValue("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool")); } onEvent(_event) { switch (_event) { diff --git a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_UpperECAM.js b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_UpperECAM.js index 68d55f65afe..10905862418 100644 --- a/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_UpperECAM.js +++ b/A32NX/html_ui/Pages/VCockpit/Instruments/Airliners/A320_Neo/EICAS/ECAM/A320_Neo_UpperECAM.js @@ -423,7 +423,7 @@ var A320_Neo_UpperECAM; message: "APU", action: "START", isCompleted: () => { - return this.getCachedSimVar("L:A32NX_APU_AVAILABLE", "Bool") === 1; + return this.getCachedSimVar("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool") === 1; } }, { @@ -1083,7 +1083,7 @@ var A320_Neo_UpperECAM; style: "action", message: "MASTER SW", action: "OFF", - isCompleted: () => !this.getCachedSimVar("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool"), + isCompleted: () => !this.getCachedSimVar("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool"), }, ] }, @@ -1097,7 +1097,7 @@ var A320_Neo_UpperECAM; style: "action", message: "MASTER SW", action: "OFF", - isCompleted: () => !this.getCachedSimVar("L:A32NX_APU_MASTER_SW_ACTIVATED", "Bool"), + isCompleted: () => !this.getCachedSimVar("L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON", "Bool"), }, ] } @@ -1329,14 +1329,14 @@ var A320_Neo_UpperECAM; message: "APU AVAIL", isActive: () => ( !SimVar.GetSimVarValue("L:A32NX_APU_BLEED_AIR_VALVE_OPEN", "Bool") && - this.getCachedSimVar("L:A32NX_APU_AVAILABLE", "Bool") + this.getCachedSimVar("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool") ) }, { message: "APU BLEED", isActive: () => ( SimVar.GetSimVarValue("L:A32NX_APU_BLEED_AIR_VALVE_OPEN", "Bool") && - this.getCachedSimVar("L:A32NX_APU_AVAILABLE", "Bool") + this.getCachedSimVar("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool") ) }, { @@ -1566,7 +1566,7 @@ var A320_Neo_UpperECAM; const eng1active = this.getCachedSimVar("ENG COMBUSTION:1", "Bool"); const eng2active = this.getCachedSimVar("ENG COMBUSTION:2", "Bool"); const xBleedPos = this.getCachedSimVar("L:A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position", "number"); - const engBleedAndPackActive = xBleedPos === 2 || (xBleedPos === 1 && this.getCachedSimVar("L:A32NX_APU_AVAILABLE", "Bool") === 1 && SimVar.GetSimVarValue("L:A32NX_APU_BLEED_AIR_VALVE_OPEN", "Bool")) ? + const engBleedAndPackActive = xBleedPos === 2 || (xBleedPos === 1 && this.getCachedSimVar("L:A32NX_OVHD_APU_START_PB_IS_AVAILABLE", "Bool") === 1 && SimVar.GetSimVarValue("L:A32NX_APU_BLEED_AIR_VALVE_OPEN", "Bool")) ? (this.getCachedSimVar("BLEED AIR ENGINE:1", "Bool") || this.getCachedSimVar("BLEED AIR ENGINE:2", "Bool")) && ((this.getCachedSimVar("L:A32NX_AIRCOND_PACK1_TOGGLE", "bool") && eng1active) || (this.getCachedSimVar("L:A32NX_AIRCOND_PACK2_TOGGLE", "bool") && eng2active)) : diff --git a/Cargo.lock b/Cargo.lock index 6a8e9cfa311..a81a8d4762d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,23 +1,32 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "aho-corasick" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +name = "a320_systems" +version = "0.1.0" dependencies = [ - "memchr", + "systems", + "uom", ] [[package]] -name = "airbus-systems" +name = "a320_systems_wasm" version = "0.1.0" dependencies = [ - "ntest", - "rand", + "a320_systems", + "msfs", + "systems", "uom", ] +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -103,9 +112,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c" +checksum = "5cb92721cb37482245ed88428f72253ce422b3b4ee169c70a0642521bb5db4cc" dependencies = [ "glob", "libc", @@ -142,9 +151,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c70be434c505aee38639abccb918163b63158a4b4bb791b45b7023044bdc3c9c" +checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" dependencies = [ "futures-channel", "futures-core", @@ -157,9 +166,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f01c61843314e95f96cc9245702248733a3a3d744e43e2e755e3c7af8348a0a9" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", "futures-sink", @@ -167,15 +176,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8d3b0917ff63a2a96173133c02818fac4a746b0a57569d3baca9ec0e945e08" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-executor" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee9ca2f7eb4475772cf39dd1cd06208dce2670ad38f4d9c7262b3e15f127068" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ "futures-core", "futures-task", @@ -184,15 +193,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37c1a51b037b80922864b8eed90692c5cd8abd4c71ce49b77146caa47f3253b" +checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" [[package]] name = "futures-macro" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8719ca0e1f3c5e34f3efe4570ef2c0610ca6da85ae7990d472e9cbfba13664" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -202,24 +211,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6adabac1290109cfa089f79192fb6244ad2c3f1cc2281f3e1dd987592b71feb" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92a0843a2ff66823a8f7c77bffe9a09be2b64e533562c412d63075643ec0038" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "036a2107cdeb57f6d7322f1b6c363dad67cd63ca3b7d1b925bdf75bd5d96cda9" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures-channel", "futures-core", @@ -237,9 +246,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if 1.0.0", "libc", @@ -254,9 +263,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -284,15 +293,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.82" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" +checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" [[package]] name = "libloading" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9367bdfa836b7e3cf895867f7a570283444da90562980ec2263d6e1569b16bc" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" dependencies = [ "cfg-if 1.0.0", "winapi", @@ -300,11 +309,11 @@ dependencies = [ [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -448,9 +457,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro-nested" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" @@ -469,18 +478,18 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", "rand_chacha", @@ -500,9 +509,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ "getrandom", ] @@ -542,9 +551,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "serde" -version = "1.0.118" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" [[package]] name = "shlex" @@ -566,9 +575,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2", "quote", @@ -579,8 +588,8 @@ dependencies = [ name = "systems" version = "0.1.0" dependencies = [ - "airbus-systems", - "msfs", + "ntest", + "rand", "uom", ] @@ -604,11 +613,11 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] @@ -662,9 +671,9 @@ checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "wasi" -version = "0.10.1+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "which" diff --git a/Cargo.toml b/Cargo.toml index 194defa475d..ae97ebaaaae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ - "src/systems/a320", + "src/systems/a320_systems", + "src/systems/a320_systems_wasm", "src/systems/systems" ] diff --git a/docs/a320-simvars.md b/docs/a320-simvars.md index 6ae86b19e85..c1380bc32db 100644 --- a/docs/a320-simvars.md +++ b/docs/a320-simvars.md @@ -51,22 +51,6 @@ - Used in the `.flt` files to set a default value for the ALT RPTG 2 way switch on the TCAS panel - Maps to the `I:XMLVAR_ALT_MODE_REQUESTED` variable which is the actual backing var for the switch -- A32NX_ELEC_COMMERCIAL_TOGGLE - - Bool - - True if electrical commercial push button on - -- A32NX_ELEC_COMMERCIAL_FAULT - - Bool - - True if fault in electrical commercial system - -- A32NX_ELEC_GALYCAB_TOGGLE - - Bool - - True if electrical galy & cab push button on - -- A32NX_ELEC_GALYCAB_FAULT - - Bool - - True if fault in electrical galy & cab system - - A32NX_KNOB_OVHD_AIRCOND_XBLEED_Position - Position (0-2) - 0 is SHUT, 1 is AUTO, 2 is OPEN @@ -382,34 +366,6 @@ - Percent - The APU's rotations per minute in percentage of the maximum RPM -- A32NX_APU_MASTER_SW_ACTIVATED - - Bool - - True when the APU MASTER SW is activated - -- A32NX_APU_START_ACTIVATED - - Bool - - True when the APU START push button is activated - -- A32NX_APU_GEN_VOLTAGE: - - Volts - - The electric potential made available by the APU generator - -- A32NX_APU_GEN_VOLTAGE_NORMAL: - - Bool - - Indicates if the APU generator potential is within the normal range - -- A32NX_APU_GEN_AMPERAGE: - - Amperes - - The electric current made available by the APU generator - -- A32NX_APU_GEN_FREQ - - Hertz - - The alternating current frequency of the electric current made available by the APU generator - -- A32NX_APU_GEN_FREQ_NORMAL - - Bool - - Indicates if the APU generator output frequency is within the normal range - - A32NX_APU_START_CONTACTOR_ENERGIZED - Bool - Indicates if the APU START contactor is energized @@ -418,18 +374,6 @@ - Bool - Indicates if the APU bleed air valve is open -- A32NX_APU_BLEED_FAULT - - Bool - - Indicates if the APU BLEED FAULT light should be illuminated - -- A32NX_APU_BLEED_ON - - Bool - - Indicates if the APU BLEED is ON - -- A32NX_APU_MASTER_FAULT - - Bool - - Indicates if the MASTER SW FAULT light should be illuminated - - A32NX_APU_LOW_FUEL_PRESSURE_FAULT - Bool - Indicates if the APU has an active LOW FUEL PRESSURE fault @@ -456,7 +400,7 @@ - A32NX_FIRE_BUTTON_APU - Bool - - Indicates if the APU fire button is released + - Indicates if the APU fire button is RELEASED - A32NX_RMP_L_TOGGLE_SWITCH - Boolean @@ -509,3 +453,203 @@ - A32NX_ENG_OUT_ACC_ALT - feet - The engine out acceleration altitude, set in the PERF TAKE OFF page. + +- A32NX_OVHD_{name}_PB_IS_AVAILABLE + - Bool + - True when the push button's AVAIL light should illuminate + - {name} + - APU_START + +- A32NX_OVHD_{name}_PB_HAS_FAULT + - Bool + - Indicates if the push button's FAULT light should illuminate + - {name} + - APU_MASTER_SW + - ELEC_BAT_10 + - ELEC_BAT_11 + - ELEC_IDG_1 + - ELEC_IDG_2 + - ELEC_ENG_GEN_1 + - ELEC_ENG_GEN_2 + - ELEC_AC_ESS_FEED + - ELEC_GALY_AND_CAB + - PNEU_APU_BLEED + +- A32NX_OVHD_{name}_PB_IS_AUTO + - Bool + - True when the push button is AUTO + - {name} + - ELEC_BAT_10 + - ELEC_BAT_11 + - ELEC_BUS_TIE_PB + - ELEC_GALY_AND_CAB + +- A32NX_OVHD_{name}_PB_IS_RELEASED + - Bool + - True when the push button is RELEASED + - {name} + - ELEC_IDG_1 + - ELEC_IDG_2 + +- A32NX_OVHD_ELEC_AC_ESS_FEED_PB_IS_NORMAL + - Bool + - True when the AC ESS FEED push button is NORMAL + +- A32NX_OVHD_{name}_PB_IS_ON + - Bool + - True when the push button is ON + - {name} + - APU_START + - APU_MASTER_SW + - ELEC_COMMERCIAL + - PNEU_APU_BLEED + +- A32NX_ELEC_CONTACTOR_{name}_IS_CLOSED + - Bool + - True when the contactor is CLOSED + - {name} + - 1PC1: DC BAT BUS feed contactor between DC BUS 1 and DC BAT BUS + - 1PC2: DC BAT BUS feed contactor between DC BUS 2 and DC BAT BUS + - 2XB1: Contactor between battery 1 and the static inverter + - 2XB2: Contactor between battery 2 and the DC ESS BUS + - 3XC1: AC ESS feed contactor between AC BUS 1 and AC ESS BUS + - 3XC2: AC ESS feed contactor between AC BUS 2 and AC ESS BUS + - 3PE: Transformer rectifier ESS contactor between TR ESS and DC ESS BUS + - 2XE: Emergency generator contactor + - 3XG: External power contactor + - 3XS: APU generator contactor + - 4PC: Contactor between DC BAT BUS and DC ESS BUS + - 5PU1: Transformer rectifier 1 contactor between TR1 and DC BUS 1 + - 5PU2: Transformer rectifier 2 contactor between TR2 and DC BUS 2 + - 6PB1: Battery 1 contactor + - 6PB2: Battery 2 contactor + - 8PH: DC ESS SHED contactor + - 8XH: AC ESS SHED contactor + - 9XU1: Engine generator line contactor 1 + - 9XU2: Engine generator line contactor 2 + - 11XU1: AC BUS tie 1 contactor + - 11XU2: AC BUS tie 2 contactor + - 15XE1: Contactor between AC ESS BUS and TR ESS + EMER GEN + - 15XE2: Contactor between the static inverter and AC ESS BUS + +- A32NX_ELEC_{name}_BUS_IS_POWERED + - Bool + - True when the given bus is powered + - {name} + - AC_1 + - AC_2 + - AC_ESS + - AC_ESS_SHED + - AC_STAT_INV + - DC_1 + - DC_2 + - DC_ESS + - DC_ESS_SHED + - DC_BAT + - DC_HOT_1 + - DC_HOT_2 + + +- A32NX_ELEC_{name}_POTENTIAL + - Volts + - The electric potential of the given element + - {name} + - APU_GEN_1 + - ENG_GEN_1 + - ENG_GEN_2 + - EXT_PWR + - STAT_INV + - EMER_GEN + - TR_1 + - TR_2 + - TR_3: TR ESS + - BAT_10: Battery 1 + - BAT_11: Battery 2 + +- A32NX_ELEC_{name}_POTENTIAL_NORMAL + - Bool + - Indicates if the potential is within the normal range + - {name} + - APU_GEN_1 + - ENG_GEN_1 + - ENG_GEN_2 + - EXT_PWR + - STAT_INV + - EMER_GEN + - TR_1 + - TR_2 + - TR_3: TR ESS + - BAT_10: Battery 1 + - BAT_11: Battery 2 + +- A32NX_ELEC_{name}_FREQUENCY: + - Hertz + - The frequency of the alternating current of the given element + - {name} + - APU_GEN_1 + - ENG_GEN_1 + - ENG_GEN_2 + - EXT_PWR + - STAT_INV + - EMER_GEN + +- A32NX_ELEC_{name}_FREQUENCY_NORMAL + - Hertz + - Indicates if the frequency is within the normal range + - {name} + - APU_GEN_1 + - ENG_GEN_1 + - ENG_GEN_2 + - EXT_PWR + - STAT_INV + - EMER_GEN + +- A32NX_ELEC_{name}_LOAD + - Percent + - The load the generator is providing compared to its maximum + - {name} + - APU_GEN_1 + - ENG_GEN_1 + - ENG_GEN_2 + +- A32NX_ELEC_{name}_LOAD_NORMAL + - Percent + - Indicates if the load is within the normal range + - {name} + - APU_GEN_1 + - ENG_GEN_1 + - ENG_GEN_2 + +- A32NX_ELEC_{name}_CURRENT + - Ampere + - The electric current flowing through the given element + - {name} + - TR_1 + - TR_2 + - TR_3: TR ESS + - BAT_10: Battery 1 + - BAT_11: Battery 2 + +- A32NX_ELEC_{name}_CURRENT_NORMAL + - Ampere + - Indicates if the current is within the normal range + - {name} + - TR_1 + - TR_2 + - TR_3: TR ESS + - BAT_10: Battery 1 + - BAT_11: Battery 2 + +- A32NX_ELEC_ENG_GEN_{number}_IDG_OIL_OUTLET_TEMPERATURE + - Celsius + - The integrated drive generator's oil outlet temperature + - {number} + - 1 + - 2 + +- A32NX_ELEC_ENG_GEN_{number}_IDG_IS_CONNECTED + - Bool + - Indicates if the given integrated drive generator is connected + - {number} + - 1 + - 2 diff --git a/src/behavior/src/A32NX_Interior_Elec.xml b/src/behavior/src/A32NX_Interior_Elec.xml index 0383768b82e..523f10d1078 100644 --- a/src/behavior/src/A32NX_Interior_Elec.xml +++ b/src/behavior/src/A32NX_Interior_Elec.xml @@ -41,7 +41,7 @@ (>K:TOGGLE_ALTERNATOR#ID#) - (A:GENERAL ENG MASTER ALTERNATOR:#ID#, bool) (A:GENERAL ENG PCT MAX RPM:#ID#, Percent) 1 < and + (L:A32NX_OVHD_ELEC_ENG_GEN_#ID#_PB_HAS_FAULT, Bool) (A:GENERAL ENG MASTER ALTERNATOR:#ID#, Bool) ! (A:GENERAL ENG MASTER ALTERNATOR:#ID#, Bool) @@ -101,8 +101,16 @@ - #BATTERY_BUS_ID# #HOT_BATTERY_BUS_ID# (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) + + #BATTERY_BUS_ID# #HOT_BATTERY_BUS_ID# (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) + #BATTERY_STATE_CODE# ! if{ + 0 (>L:A32NX_OVHD_ELEC_BAT_#BATTERY_BUS_ID#_PB_IS_AUTO) + } els{ + 1 (>L:A32NX_OVHD_ELEC_BAT_#BATTERY_BUS_ID#_PB_IS_AUTO) + } + + (L:A32NX_OVHD_ELEC_BAT_#BATTERY_BUS_ID#_PB_HAS_FAULT, Bool) #BATTERY_STATE_CODE# ! #BATTERY_STATE_CODE# diff --git a/src/behavior/src/A32NX_Interior_Misc.xml b/src/behavior/src/A32NX_Interior_Misc.xml index 9fd3bf71141..34d6558455e 100644 --- a/src/behavior/src/A32NX_Interior_Misc.xml +++ b/src/behavior/src/A32NX_Interior_Misc.xml @@ -410,19 +410,19 @@