From fed2bff02beb9a7e3a4ab193e5c36b43b99ea8ff Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Mon, 16 Jun 2025 10:39:19 +0930 Subject: [PATCH 1/9] Basic modifications and page setup --- .../src/SD/Pages/ElecAc/ElecAc.scss | 77 ++ .../src/SD/Pages/ElecAc/ElecAc.tsx | 679 ++++++++++++++++ .../src/SD/Pages/ElecDc/ElecDc.scss | 77 ++ .../src/SD/Pages/ElecDc/ElecDc.tsx | 736 ++++++++++++++++++ .../instruments/src/SD/PagesContainer.tsx | 7 +- 5 files changed, 1573 insertions(+), 3 deletions(-) create mode 100644 hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.scss create mode 100644 hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx create mode 100644 hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.scss create mode 100644 hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.scss b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.scss new file mode 100644 index 000000000..8054114e3 --- /dev/null +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.scss @@ -0,0 +1,77 @@ +@import "../../style"; +@import "../../../Common/definitions"; + +#main-elec-ac { + .Box { + stroke: $display-grey; + fill: none; + stroke-width: 2.5px; + } + + path { + stroke: $display-white; + stroke-width: 2.25px; + stroke-linecap: square; + stroke-linejoin: miter; + + &.Green { + stroke: $display-green; + } + + &.Amber { + stroke: $display-amber; + } + } + + rect.Bus { + fill: $display-grey; + } + + text { + fill: $display-white; + font-size: 19px; + + &.ExtraLarge { + font-size: 26px; + } + + // Seriously, we need to fix this at some point ^^ + &.QuiteLarge { + font-size: 24px; + } + + &.Large { + font-size: 22px; + } + + &.Small { + font-size: 16.875px; + } + + &.ExtraSmall { + font-size: 15px; + } + + &.Middle { + text-anchor: middle; + text-align: middle; + } + + &.Right { + text-anchor: end; + text-align: end; + } + + &.Green { + fill: $display-green; + } + + &.Amber { + fill: $display-amber; + } + + &.Cyan { + fill: $display-cyan; + } + } +} diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx new file mode 100644 index 000000000..63cd9e414 --- /dev/null +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -0,0 +1,679 @@ +// Copyright (c) 2021-2023 FlyByWire Simulations +// +// SPDX-License-Identifier: GPL-3.0 + +import React from 'react'; +import classNames from 'classnames'; +import { useSimVar } from '@flybywiresim/fbw-sdk'; +import { PageTitle } from '../../Common/PageTitle'; +import { EcamPage } from '../../Common/EcamPage'; +import { SvgGroup } from '../../Common/SvgGroup'; + +import './ElecAc.scss'; + +const maxStaleness = 300; + +export const ElecAcPage = () => { + const [ac1IsPowered] = useSimVar('L:A32NX_ELEC_AC_1_BUS_IS_POWERED', 'Bool', maxStaleness); + const [ac2IsPowered] = useSimVar('L:A32NX_ELEC_AC_2_BUS_IS_POWERED', 'Bool', maxStaleness); + const [acEssIsPowered] = useSimVar('L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED', 'Bool', maxStaleness); + const [acEssShedBusIsPowered] = useSimVar('L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED', 'Bool', maxStaleness); + const [externalPowerAvailable] = useSimVar('L:A32NX_EXT_PWR_AVAIL:1', 'Bool', maxStaleness); + const [staticInverterInUse] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED', 'Bool', maxStaleness); + const [galleyIsShed] = useSimVar('L:A32NX_ELEC_GALLEY_IS_SHED', 'Bool', maxStaleness); + const [ac1SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC1_IS_CLOSED', 'Bool', maxStaleness); + const [ac2SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC2_IS_CLOSED', 'Bool', maxStaleness); + + const [emergencyGeneratorSupplies] = useSimVar('L:A32NX_ELEC_CONTACTOR_2XE_IS_CLOSED', 'Bool', maxStaleness); + const [acEssBusContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE1_IS_CLOSED', 'Bool', maxStaleness); + const [trEssSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3PE_IS_CLOSED', 'Bool', maxStaleness); + + const [externalPowerContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XG_IS_CLOSED', 'Bool', maxStaleness); + const [apuGeneratorContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XS_IS_CLOSED', 'Bool', maxStaleness); + const [generatorLineContactor1Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_9XU1_IS_CLOSED', 'Bool', maxStaleness); + const [generatorLineContactor2Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_9XU2_IS_CLOSED', 'Bool', maxStaleness); + const [busTieContactor1Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_11XU1_IS_CLOSED', 'Bool', maxStaleness); + const [busTieContactor2Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_11XU2_IS_CLOSED', 'Bool', maxStaleness); + + const [idg1Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_1_IDG_IS_CONNECTED', 'Bool', maxStaleness); + const [idg2Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_2_IDG_IS_CONNECTED', 'Bool', maxStaleness); + + return ( + + + + {ac1SuppliesAcEss ? : null} + {ac2SuppliesAcEss ? : null} + + {acEssBusContactorClosed && !emergencyGeneratorSupplies ? ( + + ) : null} + {trEssSuppliesDcEss ? : null} + + + {emergencyGeneratorSupplies ? ( + + ) : null} + + {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( + <> + + + + ) : null} + + {externalPowerContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( + + ) : null} + {externalPowerContactorClosed && !busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + {externalPowerContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {apuGeneratorContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( + + ) : null} + {apuGeneratorContactorClosed && !busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + {apuGeneratorContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor1Closed && !busTieContactor1Closed ? ( + + ) : null} + {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor2Closed && !busTieContactor2Closed ? ( + + ) : null} + {generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor1Closed || busTieContactor1Closed ? ( + + ) : null} + {generatorLineContactor2Closed || busTieContactor2Closed ? ( + + ) : null} + {externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( + + ) : null} + {apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( + + ) : null} + + + + + + + + {staticInverterInUse ? : null} + {!staticInverterInUse && externalPowerAvailable ? : null} + + + + {galleyIsShed ? : null} + + + + {!idg1Connected ? : null} + + + {!idg2Connected ? : null} + + ); +}; + +const Battery = ({ x, y, number }) => { + const [isAuto] = useSimVar(`L:A32NX_OVHD_ELEC_BAT_${number}_PB_IS_AUTO`, 'Bool', maxStaleness); + + const [potential] = useSimVar(`L:A32NX_ELEC_BAT_${number}_POTENTIAL`, 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar(`L:A32NX_ELEC_BAT_${number}_POTENTIAL_NORMAL`, 'Bool', maxStaleness); + + const [current] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT`, 'Ampere', maxStaleness); + const [currentWithinNormalRange] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT_NORMAL`, 'Bool', maxStaleness); + + const allParametersWithinNormalRange = potentialWithinNormalRange && currentWithinNormalRange; + + const [staticInverterInUse] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED', 'Bool', maxStaleness); + + return ( + + + + BAT + + + {number} + + {isAuto ? ( + <> + + + + ) : ( + + OFF + + )} + {number === 1 && staticInverterInUse ? ( + <> + + + STAT INV + + + ) : null} + + ); +}; + +const BatteryToBatBusWire = ({ x, y, number }) => { + const [contactorClosed] = useSimVar(`L:A32NX_ELEC_CONTACTOR_6PB${number}_IS_CLOSED`, 'Bool', maxStaleness); + const [current] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT`, 'Ampere', maxStaleness); + const [showArrowWhenContactorClosed] = useSimVar( + `L:A32NX_ELEC_CONTACTOR_6PB${number}_SHOW_ARROW_WHEN_CLOSED`, + 'Bool', + maxStaleness, + ); + + const showArrow = contactorClosed && showArrowWhenContactorClosed; + const isCharging = current > 0; + const isDischarging = current < 0; + + const pointingRight = (number === 2 && isCharging) || (number === 1 && isDischarging); + + if (!contactorClosed) { + return <>; + } + + return ( + + {showArrow ? ( + <> + {pointingRight ? ( + <> + + + + ) : ( + <> + + + + )} + + ) : ( + + )} + + ); +}; + +const ElectricalProperty = ({ x, y, value, unit, isWithinNormalRange }) => ( + + {Math.round(value)} + + {unit} + + +); + +const Box = ({ width, height }) => ; + +interface BusProps { + x: number; + y: number; + width: number; + name: string; + number?: number; + isNormal: boolean; + isShed?: boolean; +} + +const Bus = ({ x, y, width, name, number, isNormal, isShed }: BusProps) => { + const busHeight = 26.25; + return ( + + + + {name} + + {number ? ( + + {number} + + ) : null} + {isShed ? ( + + SHED + + ) : null} + + ); +}; + +const EngineGenerator = ({ x, y, number }) => { + const [isOn] = useSimVar(`GENERAL ENG MASTER ALTERNATOR:${number}`, 'Bool', maxStaleness); + + const [load] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_LOAD`, 'Percent', maxStaleness); + const [loadWithinNormalRange] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_LOAD_NORMAL`, 'Bool', maxStaleness); + + const [potential] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_POTENTIAL`, 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar( + `L:A32NX_ELEC_ENG_GEN_${number}_POTENTIAL_NORMAL`, + 'Bool', + maxStaleness, + ); + + const [frequency] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_FREQUENCY`, 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar( + `L:A32NX_ELEC_ENG_GEN_${number}_FREQUENCY_NORMAL`, + 'Bool', + maxStaleness, + ); + + const allParametersWithinNormalRange = + loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; + return ( + + + + + GEN + + + {number} + + {isOn ? ( + <> + + + + + ) : ( + + OFF + + )} + + ); +}; + +const ApuGenerator = ({ x, y }) => { + const [masterSwPbOn] = useSimVar('L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON', 'Bool', maxStaleness); + const [genSwitchOn] = useSimVar('APU GENERATOR SWITCH:1', 'Bool', maxStaleness); + + const [load] = useSimVar('L:A32NX_ELEC_APU_GEN_1_LOAD', 'Percent', maxStaleness); + const [loadWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_LOAD_NORMAL', 'Bool', maxStaleness); + + const [potential] = useSimVar('L:A32NX_ELEC_APU_GEN_1_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_APU_GEN_1_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + const allParametersWithinNormalRange = + loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; + + const apuGenTitle = ( + + APU GEN + + ); + + return ( + + {masterSwPbOn ? ( + <> + + {apuGenTitle} + {genSwitchOn ? ( + <> + + + + + ) : ( + + OFF + + )} + + ) : ( + apuGenTitle + )} + + ); +}; + +const ExternalPower = ({ x, y }) => { + const [potential] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + return ( + + ); +}; + +const StaticInverter = ({ x, y }) => { + const [potential] = useSimVar('L:A32NX_ELEC_STAT_INV_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_STAT_INV_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_STAT_INV_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_STAT_INV_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + return ( + + ); +}; + +const PotentialFrequencyBox = ({ + x, + y, + text, + potential, + potentialWithinNormalRange, + frequency, + frequencyWithinNormalRange, +}) => { + const allParametersWithinNormalRange = potentialWithinNormalRange && frequencyWithinNormalRange; + + return ( + + + 7 ? 'Small' : ''} ${!allParametersWithinNormalRange ? 'Amber' : ''}`} + > + {text} + + + + + ); +}; + +interface TransformerRectifierProps { + x: number; + y: number; + number: number; + titleOnly?: boolean; +} + +const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierProps) => { + const [potential] = useSimVar(`L:A32NX_ELEC_TR_${number}_POTENTIAL`, 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar(`L:A32NX_ELEC_TR_${number}_POTENTIAL_NORMAL`, 'Bool', maxStaleness); + + const [current] = useSimVar(`L:A32NX_ELEC_TR_${number}_CURRENT`, 'Ampere', maxStaleness); + const [currentWithinNormalRange] = useSimVar(`L:A32NX_ELEC_TR_${number}_CURRENT_NORMAL`, 'Bool', maxStaleness); + + const allParametersWithinNormalRange = potentialWithinNormalRange && currentWithinNormalRange; + + const title = ( + + {number === 3 ? 'ESS TR' : 'TR'} + + ); + + return ( + + {titleOnly ? ( + title + ) : ( + <> + + {title} + {number !== 3 ? ( + + {number} + + ) : null} + + + + )} + + ); +}; + +const EmergencyGenerator = ({ x, y, titleOnly }) => { + const [potential] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_EMER_GEN_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + const allParametersWithinNormalRange = potentialWithinNormalRange && frequencyWithinNormalRange; + + return ( + + {titleOnly ? ( + + EMER GEN + + ) : ( + <> + + + + EMER GEN + + + + + )} + + ); +}; + +const GalleyShed = ({ x, y }) => ( + + GALLEY + + SHED + + +); + +const IntegratedDriveGeneratorTitle = ({ x, y, number }) => { + const [connected] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_IS_CONNECTED`, 'Bool', maxStaleness); + return ( + + IDG + + {number} + + + ); +}; + +const IntegratedDriveGeneratorTemperature = ({ x, y, number }) => { + const [temperature] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_OIL_OUTLET_TEMPERATURE`, 'Celsius', maxStaleness); + return ( + + {Math.round(temperature)} + + °C + + + ); +}; + +const IntegratedDriveGeneratorDisconnected = ({ x, y }) => ( + + DISC + +); + +interface ArrowProps { + x: number; + y: number; + direction: 'up' | 'down' | 'right' | 'left'; + green?: boolean; + amber?: boolean; + description?: string; +} + +const Arrow = ({ x, y, direction, green, amber }: ArrowProps) => { + const classes = classNames({ Green: green }, { Amber: amber }); + switch (direction) { + default: + case 'up': + return ; + case 'down': + return ; + case 'right': + return ; + case 'left': + return ; + } +}; + +const arrowSize = 13.737375; + +interface WireProps { + d: string; + amber?: boolean; + description?: string; +} + +const Wire = ({ d, amber }: WireProps) => { + const classes = classNames({ Green: !amber }, { Amber: amber }); + return ; +}; diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.scss b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.scss new file mode 100644 index 000000000..116e801eb --- /dev/null +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.scss @@ -0,0 +1,77 @@ +@import "../../style"; +@import "../../../Common/definitions"; + +#main-elec-dc { + .Box { + stroke: $display-grey; + fill: none; + stroke-width: 2.5px; + } + + path { + stroke: $display-white; + stroke-width: 2.25px; + stroke-linecap: square; + stroke-linejoin: miter; + + &.Green { + stroke: $display-green; + } + + &.Amber { + stroke: $display-amber; + } + } + + rect.Bus { + fill: $display-grey; + } + + text { + fill: $display-white; + font-size: 19px; + + &.ExtraLarge { + font-size: 26px; + } + + // Seriously, we need to fix this at some point ^^ + &.QuiteLarge { + font-size: 24px; + } + + &.Large { + font-size: 22px; + } + + &.Small { + font-size: 16.875px; + } + + &.ExtraSmall { + font-size: 15px; + } + + &.Middle { + text-anchor: middle; + text-align: middle; + } + + &.Right { + text-anchor: end; + text-align: end; + } + + &.Green { + fill: $display-green; + } + + &.Amber { + fill: $display-amber; + } + + &.Cyan { + fill: $display-cyan; + } + } +} diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx new file mode 100644 index 000000000..113b67d35 --- /dev/null +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx @@ -0,0 +1,736 @@ +// Copyright (c) 2021-2023 FlyByWire Simulations +// +// SPDX-License-Identifier: GPL-3.0 + +import React from 'react'; +import classNames from 'classnames'; +import { useSimVar } from '@flybywiresim/fbw-sdk'; +import { PageTitle } from '../../Common/PageTitle'; +import { EcamPage } from '../../Common/EcamPage'; +import { SvgGroup } from '../../Common/SvgGroup'; + +import './ElecDc.scss'; + +const maxStaleness = 300; + +export const ElecDcPage = () => { + const [dc1IsPowered] = useSimVar('L:A32NX_ELEC_DC_1_BUS_IS_POWERED', 'Bool', maxStaleness); + const [dc2IsPowered] = useSimVar('L:A32NX_ELEC_DC_2_BUS_IS_POWERED', 'Bool', maxStaleness); + const [dcEssIsPowered] = useSimVar('L:A32NX_ELEC_DC_ESS_BUS_IS_POWERED', 'Bool', maxStaleness); + const [dcEssShedBusIsPowered] = useSimVar('L:A32NX_ELEC_DC_ESS_SHED_BUS_IS_POWERED', 'Bool', maxStaleness); + const [ac1IsPowered] = useSimVar('L:A32NX_ELEC_AC_1_BUS_IS_POWERED', 'Bool', maxStaleness); + const [ac2IsPowered] = useSimVar('L:A32NX_ELEC_AC_2_BUS_IS_POWERED', 'Bool', maxStaleness); + const [acEssIsPowered] = useSimVar('L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED', 'Bool', maxStaleness); + const [acEssShedBusIsPowered] = useSimVar('L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED', 'Bool', maxStaleness); + const [externalPowerAvailable] = useSimVar('L:A32NX_EXT_PWR_AVAIL:1', 'Bool', maxStaleness); + const [staticInverterInUse] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED', 'Bool', maxStaleness); + const [galleyIsShed] = useSimVar('L:A32NX_ELEC_GALLEY_IS_SHED', 'Bool', maxStaleness); + const [tr1SuppliesDc1] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED', 'Bool', maxStaleness); + const [tr2SuppliesDc2] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU2_IS_CLOSED', 'Bool', maxStaleness); + const [ac1SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC1_IS_CLOSED', 'Bool', maxStaleness); + const [ac2SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC2_IS_CLOSED', 'Bool', maxStaleness); + const [dc1AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC1_IS_CLOSED', 'Bool', maxStaleness); + const [dcBatAndDcEssConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_4PC_IS_CLOSED', 'Bool', maxStaleness); + const [dc2AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC2_IS_CLOSED', 'Bool', maxStaleness); + + const [emergencyGeneratorSupplies] = useSimVar('L:A32NX_ELEC_CONTACTOR_2XE_IS_CLOSED', 'Bool', maxStaleness); + const [acEssBusContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE1_IS_CLOSED', 'Bool', maxStaleness); + const [trEssSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3PE_IS_CLOSED', 'Bool', maxStaleness); + + const [externalPowerContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XG_IS_CLOSED', 'Bool', maxStaleness); + const [apuGeneratorContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XS_IS_CLOSED', 'Bool', maxStaleness); + const [generatorLineContactor1Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_9XU1_IS_CLOSED', 'Bool', maxStaleness); + const [generatorLineContactor2Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_9XU2_IS_CLOSED', 'Bool', maxStaleness); + const [busTieContactor1Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_11XU1_IS_CLOSED', 'Bool', maxStaleness); + const [busTieContactor2Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_11XU2_IS_CLOSED', 'Bool', maxStaleness); + + const [idg1Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_1_IDG_IS_CONNECTED', 'Bool', maxStaleness); + const [idg2Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_2_IDG_IS_CONNECTED', 'Bool', maxStaleness); + + return ( + + + + + + + {tr1SuppliesDc1 ? : null} + + + {tr2SuppliesDc2 ? : null} + + + {ac1SuppliesAcEss ? : null} + {ac2SuppliesAcEss ? : null} + + {dc1AndDcBatConnected && !dcBatAndDcEssConnected ? ( + + ) : null} + {dc1AndDcBatConnected && dcBatAndDcEssConnected ? ( + + ) : null} + {dc2AndDcBatConnected ? ( + + ) : null} + + {acEssBusContactorClosed && !emergencyGeneratorSupplies ? ( + + ) : null} + {trEssSuppliesDcEss ? : null} + + + {emergencyGeneratorSupplies ? ( + + ) : null} + + {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( + <> + + + + ) : null} + + {externalPowerContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( + + ) : null} + {externalPowerContactorClosed && !busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + {externalPowerContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {apuGeneratorContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( + + ) : null} + {apuGeneratorContactorClosed && !busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + {apuGeneratorContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor1Closed && !busTieContactor1Closed ? ( + + ) : null} + {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor2Closed && !busTieContactor2Closed ? ( + + ) : null} + {generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor1Closed || busTieContactor1Closed ? ( + + ) : null} + {generatorLineContactor2Closed || busTieContactor2Closed ? ( + + ) : null} + {externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( + + ) : null} + {apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( + + ) : null} + + + + + + + + + + + + + + {staticInverterInUse ? : null} + {!staticInverterInUse && externalPowerAvailable ? : null} + + + + + + {galleyIsShed ? : null} + + + + {!idg1Connected ? : null} + + + {!idg2Connected ? : null} + + ); +}; + +const Battery = ({ x, y, number }) => { + const [isAuto] = useSimVar(`L:A32NX_OVHD_ELEC_BAT_${number}_PB_IS_AUTO`, 'Bool', maxStaleness); + + const [potential] = useSimVar(`L:A32NX_ELEC_BAT_${number}_POTENTIAL`, 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar(`L:A32NX_ELEC_BAT_${number}_POTENTIAL_NORMAL`, 'Bool', maxStaleness); + + const [current] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT`, 'Ampere', maxStaleness); + const [currentWithinNormalRange] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT_NORMAL`, 'Bool', maxStaleness); + + const allParametersWithinNormalRange = potentialWithinNormalRange && currentWithinNormalRange; + + const [staticInverterInUse] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED', 'Bool', maxStaleness); + + return ( + + + + BAT + + + {number} + + {isAuto ? ( + <> + + + + ) : ( + + OFF + + )} + {number === 1 && staticInverterInUse ? ( + <> + + + STAT INV + + + ) : null} + + ); +}; + +const BatteryToBatBusWire = ({ x, y, number }) => { + const [contactorClosed] = useSimVar(`L:A32NX_ELEC_CONTACTOR_6PB${number}_IS_CLOSED`, 'Bool', maxStaleness); + const [current] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT`, 'Ampere', maxStaleness); + const [showArrowWhenContactorClosed] = useSimVar( + `L:A32NX_ELEC_CONTACTOR_6PB${number}_SHOW_ARROW_WHEN_CLOSED`, + 'Bool', + maxStaleness, + ); + + const showArrow = contactorClosed && showArrowWhenContactorClosed; + const isCharging = current > 0; + const isDischarging = current < 0; + + const pointingRight = (number === 2 && isCharging) || (number === 1 && isDischarging); + + if (!contactorClosed) { + return <>; + } + + return ( + + {showArrow ? ( + <> + {pointingRight ? ( + <> + + + + ) : ( + <> + + + + )} + + ) : ( + + )} + + ); +}; + +const ElectricalProperty = ({ x, y, value, unit, isWithinNormalRange }) => ( + + {Math.round(value)} + + {unit} + + +); + +const Box = ({ width, height }) => ; + +interface BusProps { + x: number; + y: number; + width: number; + name: string; + number?: number; + isNormal: boolean; + isShed?: boolean; +} + +const Bus = ({ x, y, width, name, number, isNormal, isShed }: BusProps) => { + const busHeight = 26.25; + return ( + + + + {name} + + {number ? ( + + {number} + + ) : null} + {isShed ? ( + + SHED + + ) : null} + + ); +}; + +const BatteryBus = ({ x, y, width }) => { + const [isPowered] = useSimVar('L:A32NX_ELEC_DC_BAT_BUS_IS_POWERED', 'Bool', maxStaleness); + + const [bat1IsAuto] = useSimVar('L:A32NX_OVHD_ELEC_BAT_1_PB_IS_AUTO', 'Bool', maxStaleness); + const [bat2IsAuto] = useSimVar('L:A32NX_OVHD_ELEC_BAT_2_PB_IS_AUTO', 'Bool', maxStaleness); + const atLeastOneBatteryIsAuto = bat1IsAuto || bat2IsAuto; + + const potentialIsWithinNormalRange = useSimVar('L:A32NX_ELEC_DC_BAT_BUS_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const name = atLeastOneBatteryIsAuto ? 'DC BAT' : 'XX'; + return ( + + ); +}; + +const EngineGenerator = ({ x, y, number }) => { + const [isOn] = useSimVar(`GENERAL ENG MASTER ALTERNATOR:${number}`, 'Bool', maxStaleness); + + const [load] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_LOAD`, 'Percent', maxStaleness); + const [loadWithinNormalRange] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_LOAD_NORMAL`, 'Bool', maxStaleness); + + const [potential] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_POTENTIAL`, 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar( + `L:A32NX_ELEC_ENG_GEN_${number}_POTENTIAL_NORMAL`, + 'Bool', + maxStaleness, + ); + + const [frequency] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_FREQUENCY`, 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar( + `L:A32NX_ELEC_ENG_GEN_${number}_FREQUENCY_NORMAL`, + 'Bool', + maxStaleness, + ); + + const allParametersWithinNormalRange = + loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; + return ( + + + + + GEN + + + {number} + + {isOn ? ( + <> + + + + + ) : ( + + OFF + + )} + + ); +}; + +const ApuGenerator = ({ x, y }) => { + const [masterSwPbOn] = useSimVar('L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON', 'Bool', maxStaleness); + const [genSwitchOn] = useSimVar('APU GENERATOR SWITCH:1', 'Bool', maxStaleness); + + const [load] = useSimVar('L:A32NX_ELEC_APU_GEN_1_LOAD', 'Percent', maxStaleness); + const [loadWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_LOAD_NORMAL', 'Bool', maxStaleness); + + const [potential] = useSimVar('L:A32NX_ELEC_APU_GEN_1_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_APU_GEN_1_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + const allParametersWithinNormalRange = + loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; + + const apuGenTitle = ( + + APU GEN + + ); + + return ( + + {masterSwPbOn ? ( + <> + + {apuGenTitle} + {genSwitchOn ? ( + <> + + + + + ) : ( + + OFF + + )} + + ) : ( + apuGenTitle + )} + + ); +}; + +const ExternalPower = ({ x, y }) => { + const [potential] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + return ( + + ); +}; + +const StaticInverter = ({ x, y }) => { + const [potential] = useSimVar('L:A32NX_ELEC_STAT_INV_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_STAT_INV_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_STAT_INV_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_STAT_INV_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + return ( + + ); +}; + +const PotentialFrequencyBox = ({ + x, + y, + text, + potential, + potentialWithinNormalRange, + frequency, + frequencyWithinNormalRange, +}) => { + const allParametersWithinNormalRange = potentialWithinNormalRange && frequencyWithinNormalRange; + + return ( + + + 7 ? 'Small' : ''} ${!allParametersWithinNormalRange ? 'Amber' : ''}`} + > + {text} + + + + + ); +}; + +interface TransformerRectifierProps { + x: number; + y: number; + number: number; + titleOnly?: boolean; +} + +const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierProps) => { + const [potential] = useSimVar(`L:A32NX_ELEC_TR_${number}_POTENTIAL`, 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar(`L:A32NX_ELEC_TR_${number}_POTENTIAL_NORMAL`, 'Bool', maxStaleness); + + const [current] = useSimVar(`L:A32NX_ELEC_TR_${number}_CURRENT`, 'Ampere', maxStaleness); + const [currentWithinNormalRange] = useSimVar(`L:A32NX_ELEC_TR_${number}_CURRENT_NORMAL`, 'Bool', maxStaleness); + + const allParametersWithinNormalRange = potentialWithinNormalRange && currentWithinNormalRange; + + const title = ( + + {number === 3 ? 'ESS TR' : 'TR'} + + ); + + return ( + + {titleOnly ? ( + title + ) : ( + <> + + {title} + {number !== 3 ? ( + + {number} + + ) : null} + + + + )} + + ); +}; + +const EmergencyGenerator = ({ x, y, titleOnly }) => { + const [potential] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL', 'Volts', maxStaleness); + const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL_NORMAL', 'Bool', maxStaleness); + + const [frequency] = useSimVar('L:A32NX_ELEC_EMER_GEN_FREQUENCY', 'Hertz', maxStaleness); + const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_FREQUENCY_NORMAL', 'Bool', maxStaleness); + + const allParametersWithinNormalRange = potentialWithinNormalRange && frequencyWithinNormalRange; + + return ( + + {titleOnly ? ( + + EMER GEN + + ) : ( + <> + + + + EMER GEN + + + + + )} + + ); +}; + +const GalleyShed = ({ x, y }) => ( + + GALLEY + + SHED + + +); + +const IntegratedDriveGeneratorTitle = ({ x, y, number }) => { + const [connected] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_IS_CONNECTED`, 'Bool', maxStaleness); + return ( + + IDG + + {number} + + + ); +}; + +const IntegratedDriveGeneratorTemperature = ({ x, y, number }) => { + const [temperature] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_OIL_OUTLET_TEMPERATURE`, 'Celsius', maxStaleness); + return ( + + {Math.round(temperature)} + + °C + + + ); +}; + +const IntegratedDriveGeneratorDisconnected = ({ x, y }) => ( + + DISC + +); + +interface ArrowProps { + x: number; + y: number; + direction: 'up' | 'down' | 'right' | 'left'; + green?: boolean; + amber?: boolean; + description?: string; +} + +const Arrow = ({ x, y, direction, green, amber }: ArrowProps) => { + const classes = classNames({ Green: green }, { Amber: amber }); + switch (direction) { + default: + case 'up': + return ; + case 'down': + return ; + case 'right': + return ; + case 'left': + return ; + } +}; + +const arrowSize = 13.737375; + +interface WireProps { + d: string; + amber?: boolean; + description?: string; +} + +const Wire = ({ d, amber }: WireProps) => { + const classes = classNames({ Green: !amber }, { Amber: amber }); + return ; +}; diff --git a/hdw-a339x/src/systems/instruments/src/SD/PagesContainer.tsx b/hdw-a339x/src/systems/instruments/src/SD/PagesContainer.tsx index 884bee656..d85da89a3 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/PagesContainer.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/PagesContainer.tsx @@ -7,7 +7,8 @@ import { useUpdate, useSimVar, useArinc429Var } from '@flybywiresim/fbw-sdk'; import { EngPage } from './Pages/Eng/Eng'; import { BleedPage } from './Pages/Bleed/Bleed'; import { PressPage } from './Pages/Press/Press'; -import { ElecPage } from './Pages/Elec/Elec'; +import { ElecAcPage } from './Pages/ElecAc/ElecAc'; +import { ElecDcPage } from './Pages/ElecDc/ElecDc'; import { HydPage } from './Pages/Hyd/Hyd'; import { FuelPage } from './Pages/Fuel/Fuel'; import { ApuPage } from './Pages/Apu/Apu'; @@ -271,8 +272,8 @@ export const PagesContainer = () => { 0: , 1: , 2: , - 3: , - 4: , + 3: , + 4: , 5: , 6: , 7: , From e760051043b8a709745a888ac815bb384b210628 Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Sat, 5 Jul 2025 11:32:56 +0930 Subject: [PATCH 2/9] element changes --- .../src/SD/Pages/ElecAc/ElecAc.tsx | 56 +-- .../src/SD/Pages/ElecDc/ElecDc.tsx | 395 +++--------------- 2 files changed, 85 insertions(+), 366 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx index 63cd9e414..2a61cfd7b 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -49,24 +49,12 @@ export const ElecAcPage = () => { ) : null} {trEssSuppliesDcEss ? : null} - + {emergencyGeneratorSupplies ? ( ) : null} - + {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( <> @@ -95,14 +83,14 @@ export const ElecAcPage = () => { ) : null} {generatorLineContactor1Closed && !busTieContactor1Closed ? ( - + ) : null} {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} {generatorLineContactor2Closed && !busTieContactor2Closed ? ( - + ) : null} {generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed ? ( @@ -121,29 +109,29 @@ export const ElecAcPage = () => { ) : null} - - - - - - + + + + + + {staticInverterInUse ? : null} {!staticInverterInUse && externalPowerAvailable ? : null} - + {galleyIsShed ? : null} - - + + {!idg1Connected ? : null} - - + + {!idg2Connected ? : null} ); @@ -273,11 +261,7 @@ const Bus = ({ x, y, width, name, number, isNormal, isShed }: BusProps) => { return ( - + {name} {number ? ( @@ -519,8 +503,8 @@ const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierP const title = ( {number === 3 ? 'ESS TR' : 'TR'} diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx index 113b67d35..fc454bbbb 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx @@ -18,24 +18,23 @@ export const ElecDcPage = () => { const [dc2IsPowered] = useSimVar('L:A32NX_ELEC_DC_2_BUS_IS_POWERED', 'Bool', maxStaleness); const [dcEssIsPowered] = useSimVar('L:A32NX_ELEC_DC_ESS_BUS_IS_POWERED', 'Bool', maxStaleness); const [dcEssShedBusIsPowered] = useSimVar('L:A32NX_ELEC_DC_ESS_SHED_BUS_IS_POWERED', 'Bool', maxStaleness); - const [ac1IsPowered] = useSimVar('L:A32NX_ELEC_AC_1_BUS_IS_POWERED', 'Bool', maxStaleness); - const [ac2IsPowered] = useSimVar('L:A32NX_ELEC_AC_2_BUS_IS_POWERED', 'Bool', maxStaleness); - const [acEssIsPowered] = useSimVar('L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED', 'Bool', maxStaleness); - const [acEssShedBusIsPowered] = useSimVar('L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED', 'Bool', maxStaleness); - const [externalPowerAvailable] = useSimVar('L:A32NX_EXT_PWR_AVAIL:1', 'Bool', maxStaleness); + // const [ac1IsPowered] = useSimVar('L:A32NX_ELEC_AC_1_BUS_IS_POWERED', 'Bool', maxStaleness); + //const [ac2IsPowered] = useSimVar('L:A32NX_ELEC_AC_2_BUS_IS_POWERED', 'Bool', maxStaleness); const [staticInverterInUse] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED', 'Bool', maxStaleness); - const [galleyIsShed] = useSimVar('L:A32NX_ELEC_GALLEY_IS_SHED', 'Bool', maxStaleness); - const [tr1SuppliesDc1] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED', 'Bool', maxStaleness); - const [tr2SuppliesDc2] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU2_IS_CLOSED', 'Bool', maxStaleness); - const [ac1SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC1_IS_CLOSED', 'Bool', maxStaleness); + //const [galleyIsShed] = useSimVar('L:A32NX_ELEC_GALLEY_IS_SHED', 'Bool', maxStaleness); + //const [tr1SuppliesDc1] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED', 'Bool', maxStaleness); + //const [tr2SuppliesDc2] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU2_IS_CLOSED', 'Bool', maxStaleness); + //const [trEssSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED', 'Bool', maxStaleness); //change to correct contactor for ESS + //const [trApuSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED', 'Bool', maxStaleness); //change to correct contactor for APU + //const [ac1SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC1_IS_CLOSED', 'Bool', maxStaleness); const [ac2SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC2_IS_CLOSED', 'Bool', maxStaleness); - const [dc1AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC1_IS_CLOSED', 'Bool', maxStaleness); - const [dcBatAndDcEssConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_4PC_IS_CLOSED', 'Bool', maxStaleness); + //const [dc1AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC1_IS_CLOSED', 'Bool', maxStaleness); + //const [dcBatAndDcEssConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_4PC_IS_CLOSED', 'Bool', maxStaleness); const [dc2AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC2_IS_CLOSED', 'Bool', maxStaleness); const [emergencyGeneratorSupplies] = useSimVar('L:A32NX_ELEC_CONTACTOR_2XE_IS_CLOSED', 'Bool', maxStaleness); const [acEssBusContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE1_IS_CLOSED', 'Bool', maxStaleness); - const [trEssSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3PE_IS_CLOSED', 'Bool', maxStaleness); + //const [trEssSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3PE_IS_CLOSED', 'Bool', maxStaleness); const [externalPowerContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XG_IS_CLOSED', 'Bool', maxStaleness); const [apuGeneratorContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XS_IS_CLOSED', 'Bool', maxStaleness); @@ -44,9 +43,6 @@ export const ElecDcPage = () => { const [busTieContactor1Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_11XU1_IS_CLOSED', 'Bool', maxStaleness); const [busTieContactor2Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_11XU2_IS_CLOSED', 'Bool', maxStaleness); - const [idg1Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_1_IDG_IS_CONNECTED', 'Bool', maxStaleness); - const [idg2Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_2_IDG_IS_CONNECTED', 'Bool', maxStaleness); - return ( @@ -54,47 +50,12 @@ export const ElecDcPage = () => { - {tr1SuppliesDc1 ? : null} - - - {tr2SuppliesDc2 ? : null} - - - {ac1SuppliesAcEss ? : null} {ac2SuppliesAcEss ? : null} - {dc1AndDcBatConnected && !dcBatAndDcEssConnected ? ( - - ) : null} - {dc1AndDcBatConnected && dcBatAndDcEssConnected ? ( - - ) : null} {dc2AndDcBatConnected ? ( ) : null} - {acEssBusContactorClosed && !emergencyGeneratorSupplies ? ( - - ) : null} - {trEssSuppliesDcEss ? : null} - - - {emergencyGeneratorSupplies ? ( - - ) : null} - {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( <> @@ -123,25 +84,33 @@ export const ElecDcPage = () => { ) : null} {generatorLineContactor1Closed && !busTieContactor1Closed ? ( - + + ) : null} + {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor1Closed && !busTieContactor1Closed ? ( // ESS TR to DC ESS + + ) : null} + {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( + + ) : null} + + {generatorLineContactor1Closed && !busTieContactor1Closed ? ( // TR 2 to DC 2 + ) : null} {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} {generatorLineContactor2Closed && !busTieContactor2Closed ? ( - + ) : null} {generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} - {generatorLineContactor1Closed || busTieContactor1Closed ? ( - - ) : null} - {generatorLineContactor2Closed || busTieContactor2Closed ? ( - - ) : null} {externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( ) : null} @@ -149,38 +118,19 @@ export const ElecDcPage = () => { ) : null} - - - - - - - - - - - - + + + + + + + + {staticInverterInUse ? : null} - {!staticInverterInUse && externalPowerAvailable ? : null} - - - - - - {galleyIsShed ? : null} - - - - {!idg1Connected ? : null} - - - {!idg2Connected ? : null} + + + + ); }; @@ -201,12 +151,25 @@ const Battery = ({ x, y, number }) => { return ( - - BAT - - - {number} - + {number === 3 ? ( + <> + + APU + + + BAT + + + ) : ( + <> + + BAT + + + {number} + + + )} {isAuto ? ( <> { ); }; -const BatteryBus = ({ x, y, width }) => { +const BatteryBus = ({ x, y, width, number }) => { const [isPowered] = useSimVar('L:A32NX_ELEC_DC_BAT_BUS_IS_POWERED', 'Bool', maxStaleness); const [bat1IsAuto] = useSimVar('L:A32NX_OVHD_ELEC_BAT_1_PB_IS_AUTO', 'Bool', maxStaleness); @@ -339,166 +302,19 @@ const BatteryBus = ({ x, y, width }) => { const potentialIsWithinNormalRange = useSimVar('L:A32NX_ELEC_DC_BAT_BUS_POTENTIAL_NORMAL', 'Bool', maxStaleness); - const name = atLeastOneBatteryIsAuto ? 'DC BAT' : 'XX'; + const nameDc = atLeastOneBatteryIsAuto ? 'DC BAT' : 'XX'; + const nameApu = atLeastOneBatteryIsAuto ? 'DC APU' : 'XX'; return ( ); }; -const EngineGenerator = ({ x, y, number }) => { - const [isOn] = useSimVar(`GENERAL ENG MASTER ALTERNATOR:${number}`, 'Bool', maxStaleness); - - const [load] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_LOAD`, 'Percent', maxStaleness); - const [loadWithinNormalRange] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_LOAD_NORMAL`, 'Bool', maxStaleness); - - const [potential] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_POTENTIAL`, 'Volts', maxStaleness); - const [potentialWithinNormalRange] = useSimVar( - `L:A32NX_ELEC_ENG_GEN_${number}_POTENTIAL_NORMAL`, - 'Bool', - maxStaleness, - ); - - const [frequency] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_FREQUENCY`, 'Hertz', maxStaleness); - const [frequencyWithinNormalRange] = useSimVar( - `L:A32NX_ELEC_ENG_GEN_${number}_FREQUENCY_NORMAL`, - 'Bool', - maxStaleness, - ); - - const allParametersWithinNormalRange = - loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; - return ( - - - - - GEN - - - {number} - - {isOn ? ( - <> - - - - - ) : ( - - OFF - - )} - - ); -}; - -const ApuGenerator = ({ x, y }) => { - const [masterSwPbOn] = useSimVar('L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON', 'Bool', maxStaleness); - const [genSwitchOn] = useSimVar('APU GENERATOR SWITCH:1', 'Bool', maxStaleness); - - const [load] = useSimVar('L:A32NX_ELEC_APU_GEN_1_LOAD', 'Percent', maxStaleness); - const [loadWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_LOAD_NORMAL', 'Bool', maxStaleness); - - const [potential] = useSimVar('L:A32NX_ELEC_APU_GEN_1_POTENTIAL', 'Volts', maxStaleness); - const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_POTENTIAL_NORMAL', 'Bool', maxStaleness); - - const [frequency] = useSimVar('L:A32NX_ELEC_APU_GEN_1_FREQUENCY', 'Hertz', maxStaleness); - const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_APU_GEN_1_FREQUENCY_NORMAL', 'Bool', maxStaleness); - - const allParametersWithinNormalRange = - loadWithinNormalRange && potentialWithinNormalRange && frequencyWithinNormalRange; - - const apuGenTitle = ( - - APU GEN - - ); - - return ( - - {masterSwPbOn ? ( - <> - - {apuGenTitle} - {genSwitchOn ? ( - <> - - - - - ) : ( - - OFF - - )} - - ) : ( - apuGenTitle - )} - - ); -}; - -const ExternalPower = ({ x, y }) => { - const [potential] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL', 'Volts', maxStaleness); - const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL_NORMAL', 'Bool', maxStaleness); - - const [frequency] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY', 'Hertz', maxStaleness); - const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY_NORMAL', 'Bool', maxStaleness); - - return ( - - ); -}; - const StaticInverter = ({ x, y }) => { const [potential] = useSimVar('L:A32NX_ELEC_STAT_INV_POTENTIAL', 'Volts', maxStaleness); const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_STAT_INV_POTENTIAL_NORMAL', 'Bool', maxStaleness); @@ -576,11 +392,11 @@ const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierP const title = ( - {number === 3 ? 'ESS TR' : 'TR'} + {number === 3 ? 'ESS TR' : number === 4 ? 'APU TR' : 'TR'} ); @@ -592,7 +408,7 @@ const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierP <> {title} - {number !== 3 ? ( + {number !== 3 && number !== 4 ? ( {number} @@ -617,87 +433,6 @@ const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierP ); }; -const EmergencyGenerator = ({ x, y, titleOnly }) => { - const [potential] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL', 'Volts', maxStaleness); - const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL_NORMAL', 'Bool', maxStaleness); - - const [frequency] = useSimVar('L:A32NX_ELEC_EMER_GEN_FREQUENCY', 'Hertz', maxStaleness); - const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_FREQUENCY_NORMAL', 'Bool', maxStaleness); - - const allParametersWithinNormalRange = potentialWithinNormalRange && frequencyWithinNormalRange; - - return ( - - {titleOnly ? ( - - EMER GEN - - ) : ( - <> - - - - EMER GEN - - - - - )} - - ); -}; - -const GalleyShed = ({ x, y }) => ( - - GALLEY - - SHED - - -); - -const IntegratedDriveGeneratorTitle = ({ x, y, number }) => { - const [connected] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_IS_CONNECTED`, 'Bool', maxStaleness); - return ( - - IDG - - {number} - - - ); -}; - -const IntegratedDriveGeneratorTemperature = ({ x, y, number }) => { - const [temperature] = useSimVar(`L:A32NX_ELEC_ENG_GEN_${number}_IDG_OIL_OUTLET_TEMPERATURE`, 'Celsius', maxStaleness); - return ( - - {Math.round(temperature)} - - °C - - - ); -}; - -const IntegratedDriveGeneratorDisconnected = ({ x, y }) => ( - - DISC - -); - interface ArrowProps { x: number; y: number; From 4853d87049f5a90c0144f5ac3c25639c29bb02ea Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Mon, 28 Jul 2025 21:20:02 +0930 Subject: [PATCH 3/9] add AC text and arrows DC page, minor AC changes --- .../src/SD/Pages/ElecAc/ElecAc.tsx | 26 +++++----- .../src/SD/Pages/ElecDc/ElecDc.tsx | 49 +++++++++---------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx index 2a61cfd7b..d1adf9c21 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -41,16 +41,13 @@ export const ElecAcPage = () => { return ( - {ac1SuppliesAcEss ? : null} {ac2SuppliesAcEss ? : null} - {acEssBusContactorClosed && !emergencyGeneratorSupplies ? ( ) : null} {trEssSuppliesDcEss ? : null} - {emergencyGeneratorSupplies ? ( ) : null} @@ -61,7 +58,6 @@ export const ElecAcPage = () => { ) : null} - {externalPowerContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( ) : null} @@ -71,7 +67,6 @@ export const ElecAcPage = () => { {externalPowerContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} - {apuGeneratorContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( ) : null} @@ -81,21 +76,18 @@ export const ElecAcPage = () => { {apuGeneratorContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} - {generatorLineContactor1Closed && !busTieContactor1Closed ? ( ) : null} {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} - {generatorLineContactor2Closed && !busTieContactor2Closed ? ( ) : null} {generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} - {generatorLineContactor1Closed || busTieContactor1Closed ? ( ) : null} @@ -108,15 +100,20 @@ export const ElecAcPage = () => { {apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( ) : null} - + - + {staticInverterInUse ? : null} - {!staticInverterInUse && externalPowerAvailable ? : null} + {!staticInverterInUse && externalPowerAvailable ? ( + <> + + + + ) : null}{' '} { titleOnly={!trEssSuppliesDcEss && !acEssBusContactorClosed && !emergencyGeneratorSupplies} /> - {galleyIsShed ? : null} - {!idg1Connected ? : null} @@ -406,18 +401,19 @@ const ApuGenerator = ({ x, y }) => { ); }; -const ExternalPower = ({ x, y }) => { +const ExternalPower = ({ x, y, number }) => { const [potential] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL', 'Volts', maxStaleness); const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_POTENTIAL_NORMAL', 'Bool', maxStaleness); const [frequency] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY', 'Hertz', maxStaleness); const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY_NORMAL', 'Bool', maxStaleness); + const extPowerTitle = `EXT ${number === 1 ? 'B' : 'A'}`; return ( { //const [trApuSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_5PU1_IS_CLOSED', 'Bool', maxStaleness); //change to correct contactor for APU //const [ac1SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC1_IS_CLOSED', 'Bool', maxStaleness); const [ac2SuppliesAcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XC2_IS_CLOSED', 'Bool', maxStaleness); - //const [dc1AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC1_IS_CLOSED', 'Bool', maxStaleness); + const [dc1AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC1_IS_CLOSED', 'Bool', maxStaleness); //const [dcBatAndDcEssConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_4PC_IS_CLOSED', 'Bool', maxStaleness); const [dc2AndDcBatConnected] = useSimVar('L:A32NX_ELEC_CONTACTOR_1PC2_IS_CLOSED', 'Bool', maxStaleness); @@ -36,7 +36,7 @@ export const ElecDcPage = () => { const [acEssBusContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE1_IS_CLOSED', 'Bool', maxStaleness); //const [trEssSuppliesDcEss] = useSimVar('L:A32NX_ELEC_CONTACTOR_3PE_IS_CLOSED', 'Bool', maxStaleness); - const [externalPowerContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XG_IS_CLOSED', 'Bool', maxStaleness); + //const [externalPowerContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XG_IS_CLOSED', 'Bool', maxStaleness); const [apuGeneratorContactorClosed] = useSimVar('L:A32NX_ELEC_CONTACTOR_3XS_IS_CLOSED', 'Bool', maxStaleness); const [generatorLineContactor1Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_9XU1_IS_CLOSED', 'Bool', maxStaleness); const [generatorLineContactor2Closed] = useSimVar('L:A32NX_ELEC_CONTACTOR_9XU2_IS_CLOSED', 'Bool', maxStaleness); @@ -47,11 +47,9 @@ export const ElecDcPage = () => { - - - {ac2SuppliesAcEss ? : null} + {dc1AndDcBatConnected ? : null} {dc2AndDcBatConnected ? ( ) : null} @@ -63,16 +61,6 @@ export const ElecDcPage = () => { ) : null} - {externalPowerContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( - - ) : null} - {externalPowerContactorClosed && !busTieContactor1Closed && busTieContactor2Closed ? ( - - ) : null} - {externalPowerContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( - - ) : null} - {apuGeneratorContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( ) : null} @@ -91,7 +79,7 @@ export const ElecDcPage = () => { ) : null} {generatorLineContactor1Closed && !busTieContactor1Closed ? ( // ESS TR to DC ESS - + ) : null} {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( @@ -111,26 +99,29 @@ export const ElecDcPage = () => { ) : null} - {externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( - - ) : null} - {apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( - - ) : null} + + + + + - - + + {staticInverterInUse ? : null} - + + + + + ); }; @@ -433,6 +424,14 @@ const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierP ); }; +const AcBusTitle = ({ x, y, number }) => { + return ( + + AC{number} + + ); +}; + interface ArrowProps { x: number; y: number; From fc5bfeb4c60b64bb993022297ea1f24cfdd44a5f Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Mon, 4 Aug 2025 21:01:53 +0930 Subject: [PATCH 4/9] Add STAT INV text --- .../src/SD/Pages/ElecDc/ElecDc.tsx | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx index 99c41e51f..d871bd6ea 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx @@ -99,7 +99,7 @@ export const ElecDcPage = () => { ) : null} - + @@ -118,10 +118,11 @@ export const ElecDcPage = () => { - - - - + + + + + ); }; @@ -432,6 +433,21 @@ const AcBusTitle = ({ x, y, number }) => { ); }; +const StaticInverterTitle = ({ x, y }) => { + return ( + + + + STAT + + + INV + + + + ); +}; + interface ArrowProps { x: number; y: number; From 260265ac1c13dd4334a5a65d179a984e67bfd3b7 Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Tue, 5 Aug 2025 17:46:05 +0930 Subject: [PATCH 5/9] change position of BAT bus and wires --- .../systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx index d871bd6ea..8750fb1d9 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecDc/ElecDc.tsx @@ -49,7 +49,7 @@ export const ElecDcPage = () => { {ac2SuppliesAcEss ? : null} - {dc1AndDcBatConnected ? : null} + {dc1AndDcBatConnected ? : null} {dc2AndDcBatConnected ? ( ) : null} @@ -264,15 +264,11 @@ const Bus = ({ x, y, width, name, number, isNormal, isShed }: BusProps) => { return ( - + {name} {number ? ( - + {number} ) : null} From b4963dd8152158c27ae6c34ef5d2b2f0797dc646 Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Wed, 6 Aug 2025 16:39:37 +0930 Subject: [PATCH 6/9] adjust positioning of ELEC AC elements --- .../src/SD/Pages/ElecAc/ElecAc.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx index d1adf9c21..4cab05f72 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -47,7 +47,7 @@ export const ElecAcPage = () => { ) : null} {trEssSuppliesDcEss ? : null} - + {emergencyGeneratorSupplies ? ( ) : null} @@ -100,23 +100,24 @@ export const ElecAcPage = () => { {apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( ) : null} - - - - + {ac1SuppliesAcEss ? : null} + + + + - + {staticInverterInUse ? : null} {!staticInverterInUse && externalPowerAvailable ? ( <> - - + + ) : null}{' '} @@ -407,7 +408,7 @@ const ExternalPower = ({ x, y, number }) => { const [frequency] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY', 'Hertz', maxStaleness); const [frequencyWithinNormalRange] = useSimVar('L:A32NX_ELEC_EXT_PWR_FREQUENCY_NORMAL', 'Bool', maxStaleness); - const extPowerTitle = `EXT ${number === 1 ? 'B' : 'A'}`; + const extPowerTitle = `EXT ${number === 1 ? 'A' : 'B'}`; return ( Date: Mon, 1 Sep 2025 10:45:33 +0930 Subject: [PATCH 7/9] AC positioning and wire changes --- .../src/SD/Pages/ElecAc/ElecAc.tsx | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx index 4cab05f72..9cd167431 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -58,6 +58,13 @@ export const ElecAcPage = () => { ) : null} + + {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( + <> + + + + ) : null} {externalPowerContactorClosed && busTieContactor1Closed && !busTieContactor2Closed ? ( ) : null} @@ -74,7 +81,10 @@ export const ElecAcPage = () => { ) : null} {apuGeneratorContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( - + + ) : null} + {busTieContactor1Closed && busTieContactor2Closed ? ( + ) : null} {generatorLineContactor1Closed && !busTieContactor1Closed ? ( @@ -97,37 +107,37 @@ export const ElecAcPage = () => { {externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( ) : null} - {apuGeneratorContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( - - ) : null} - {ac1SuppliesAcEss ? : null} - - - + {ac1SuppliesAcEss ? : null} + + + + + + - - + + {staticInverterInUse ? : null} {!staticInverterInUse && externalPowerAvailable ? ( <> - - + + ) : null}{' '} {galleyIsShed ? : null} - - + + {!idg1Connected ? : null} - - + + {!idg2Connected ? : null} ); @@ -627,6 +637,7 @@ interface ArrowProps { y: number; direction: 'up' | 'down' | 'right' | 'left'; green?: boolean; + white?: boolean; amber?: boolean; description?: string; } From 9157c8fd0a8eb6e1b349d8c95a711fdfb277f43f Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Sat, 6 Sep 2025 20:31:46 +0930 Subject: [PATCH 8/9] removed battery logic, improve element visibility --- .../src/SD/Pages/ElecAc/ElecAc.tsx | 139 +++--------------- 1 file changed, 23 insertions(+), 116 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx index 9cd167431..1dce94316 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -38,10 +38,12 @@ export const ElecAcPage = () => { const [idg1Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_1_IDG_IS_CONNECTED', 'Bool', maxStaleness); const [idg2Connected] = useSimVar('L:A32NX_ELEC_ENG_GEN_2_IDG_IS_CONNECTED', 'Bool', maxStaleness); + const [masterSwPbOn] = useSimVar('L:A32NX_OVHD_APU_MASTER_SW_PB_IS_ON', 'Bool', maxStaleness); + return ( - {ac1SuppliesAcEss ? : null} + {ac1SuppliesAcEss ? : null} {ac2SuppliesAcEss ? : null} {acEssBusContactorClosed && !emergencyGeneratorSupplies ? ( @@ -83,40 +85,45 @@ export const ElecAcPage = () => { {apuGeneratorContactorClosed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} - {busTieContactor1Closed && busTieContactor2Closed ? ( - - ) : null} {generatorLineContactor1Closed && !busTieContactor1Closed ? ( - + ) : null} {generatorLineContactor1Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} {generatorLineContactor2Closed && !busTieContactor2Closed ? ( - + ) : null} {generatorLineContactor2Closed && busTieContactor1Closed && busTieContactor2Closed ? ( ) : null} {generatorLineContactor1Closed || busTieContactor1Closed ? ( - + ) : null} {generatorLineContactor2Closed || busTieContactor2Closed ? ( - + ) : null} {externalPowerContactorClosed && (busTieContactor1Closed || busTieContactor2Closed) ? ( ) : null} {ac1SuppliesAcEss ? : null} - + {masterSwPbOn ? ( + + ) : null} - - + + {staticInverterInUse ? : null} {!staticInverterInUse && externalPowerAvailable ? ( @@ -133,114 +140,16 @@ export const ElecAcPage = () => { /> {galleyIsShed ? : null} - - + + {!idg1Connected ? : null} - - + + {!idg2Connected ? : null} ); }; -const Battery = ({ x, y, number }) => { - const [isAuto] = useSimVar(`L:A32NX_OVHD_ELEC_BAT_${number}_PB_IS_AUTO`, 'Bool', maxStaleness); - - const [potential] = useSimVar(`L:A32NX_ELEC_BAT_${number}_POTENTIAL`, 'Volts', maxStaleness); - const [potentialWithinNormalRange] = useSimVar(`L:A32NX_ELEC_BAT_${number}_POTENTIAL_NORMAL`, 'Bool', maxStaleness); - - const [current] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT`, 'Ampere', maxStaleness); - const [currentWithinNormalRange] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT_NORMAL`, 'Bool', maxStaleness); - - const allParametersWithinNormalRange = potentialWithinNormalRange && currentWithinNormalRange; - - const [staticInverterInUse] = useSimVar('L:A32NX_ELEC_CONTACTOR_15XE2_IS_CLOSED', 'Bool', maxStaleness); - - return ( - - - - BAT - - - {number} - - {isAuto ? ( - <> - - - - ) : ( - - OFF - - )} - {number === 1 && staticInverterInUse ? ( - <> - - - STAT INV - - - ) : null} - - ); -}; - -const BatteryToBatBusWire = ({ x, y, number }) => { - const [contactorClosed] = useSimVar(`L:A32NX_ELEC_CONTACTOR_6PB${number}_IS_CLOSED`, 'Bool', maxStaleness); - const [current] = useSimVar(`L:A32NX_ELEC_BAT_${number}_CURRENT`, 'Ampere', maxStaleness); - const [showArrowWhenContactorClosed] = useSimVar( - `L:A32NX_ELEC_CONTACTOR_6PB${number}_SHOW_ARROW_WHEN_CLOSED`, - 'Bool', - maxStaleness, - ); - - const showArrow = contactorClosed && showArrowWhenContactorClosed; - const isCharging = current > 0; - const isDischarging = current < 0; - - const pointingRight = (number === 2 && isCharging) || (number === 1 && isDischarging); - - if (!contactorClosed) { - return <>; - } - - return ( - - {showArrow ? ( - <> - {pointingRight ? ( - <> - - - - ) : ( - <> - - - - )} - - ) : ( - - )} - - ); -}; - const ElectricalProperty = ({ x, y, value, unit, isWithinNormalRange }) => ( {Math.round(value)} @@ -405,9 +314,7 @@ const ApuGenerator = ({ x, y }) => { )} - ) : ( - apuGenTitle - )} + ) : null} ); }; From 95ab2a71812e31307875b689cc95790c88023b04 Mon Sep 17 00:00:00 2001 From: Jonny23787 Date: Mon, 10 Nov 2025 17:27:15 +1030 Subject: [PATCH 9/9] More AC changes --- .../src/SD/Pages/ElecAc/ElecAc.tsx | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx index 1dce94316..daf6997a6 100644 --- a/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx +++ b/hdw-a339x/src/systems/instruments/src/SD/Pages/ElecAc/ElecAc.tsx @@ -53,14 +53,14 @@ export const ElecAcPage = () => { {emergencyGeneratorSupplies ? ( ) : null} - + {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( <> ) : null} - + {acEssBusContactorClosed && emergencyGeneratorSupplies ? ( <> @@ -116,15 +116,15 @@ export const ElecAcPage = () => { direction="up" /> ) : null} - - - + + + - + - + {staticInverterInUse ? : null} {!staticInverterInUse && externalPowerAvailable ? ( <> @@ -132,13 +132,16 @@ export const ElecAcPage = () => { ) : null}{' '} + + + - + {galleyIsShed ? : null} @@ -176,11 +179,15 @@ const Bus = ({ x, y, width, name, number, isNormal, isShed }: BusProps) => { return ( - + {name} {number ? ( - + {number} ) : null} @@ -373,7 +380,7 @@ const PotentialFrequencyBox = ({ return ( - + {number === 3 ? 'ESS TR' : 'TR'} @@ -458,6 +465,12 @@ const TransformerRectifier = ({ x, y, number, titleOnly }: TransformerRectifierP ); }; +const TransformerRectifierTitle = ({ x, y, number }) => ( + + {number === 3 ? APU TR : TR{number}} + +); + const EmergencyGenerator = ({ x, y, titleOnly }) => { const [potential] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL', 'Volts', maxStaleness); const [potentialWithinNormalRange] = useSimVar('L:A32NX_ELEC_EMER_GEN_POTENTIAL_NORMAL', 'Bool', maxStaleness);