Skip to content

Commit

Permalink
feat(hyd): Simple hydraulic temperature simulation (#7573)
Browse files Browse the repository at this point in the history

Co-authored-by: lukecologne <[email protected]>
Co-authored-by: Benedict Etzel <[email protected]>
Co-authored-by: Pascal Störzbach <[email protected]>
  • Loading branch information
4 people authored Dec 27, 2022
1 parent db6cb81 commit 18f7db2
Show file tree
Hide file tree
Showing 16 changed files with 920 additions and 81 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. [ATSU] Fix LSK6L not returning to ATSU DATALINK page in ATC MENU - @BravoMike99 (Bruno_pt99#5802)
1. [HYD] Trimmable physical assemblies - @Crocket63 (crocket)
1. [HYD] Simulation of the rudder mechanical assembly and yaw dampers - @Crocket63 (crocket)
1. [HYD] Simple temperature simulation - @Crocket63 (crocket)
1. [FLIGHTMODEL] Reduced flap induced drag - @donstim (donbikes#4084)
1. [EFB] Fix and improve pushback system and add API documentation - @frankkopp (Frank Kopp)

Expand Down
15 changes: 15 additions & 0 deletions docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,14 @@
- BLUE
- YELLOW

- A32NX_HYD_{loop_name}_RESERVOIR_OVHT
- Boolean
- Reservoir of {loop_name} hydraulic circuit is overheating
- {loop_name}
- GREEN
- BLUE
- YELLOW

- A32NX_HYD_{loop_name}_EDPUMP_ACTIVE
- Bool
- Engine driven pump of {loop_name} hydraulic circuit is active
Expand Down Expand Up @@ -888,6 +896,13 @@
- BLUE
- YELLOW

- A32NX_HYD_{loop_name}_EPUMP_OVHT
- Bool
- Electric pump of {loop_name} hydraulic circuit is overheating
- {loop_name}
- BLUE
- YELLOW

- A32NX_HYD_{loop_name}_PUMP_1_FIRE_VALVE_OPENED
- Bool
- Engine driven pump of {loop_name} hydraulic circuit can receive hydraulic fluid
Expand Down
6 changes: 6 additions & 0 deletions src/failures/src/a320.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const A320Failure = Object.freeze({
Sec3Failure: 27004,
Fcdc1Failure: 27005,
Fcdc2Failure: 27006,

GreenReservoirLeak: 29000,
BlueReservoirLeak: 29001,
YellowReservoirLeak: 29002,
Expand All @@ -22,6 +23,11 @@ export const A320Failure = Object.freeze({
GreenReservoirReturnLeak: 29006,
BlueReservoirReturnLeak: 29007,
YellowReservoirReturnLeak: 29008,
GreenEdpOverheat: 29009,
BlueEpumpOverheat: 29010,
YellowEdpOverheat: 29011,
YellowEpumpOverheat: 29012,

LeftPfdDisplay: 31000,
RightPfdDisplay: 31001,

Expand Down
9 changes: 9 additions & 0 deletions src/instruments/src/Common/EWDMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ const EWDMessages = {
'270055701': '\x1b<4m\x1b4mF/CTL\x1bm FCDC 2 FAULT',
'290031001': '\x1b<4m*HYD',
'290031201': '\x1b<4m*HYD',
'290012601': '\x1b<4m\x1b4mHYD\x1bm B RSVR OVHT',
'290012602': '\x1b<5m -BLUE ELEC PUMP.....OFF',
'290012701': '\x1b<4m\x1b4mHYD\x1bm Y RSVR OVHT',
'290012702': '\x1b<5m -PTU................OFF',
'290012703': '\x1b<5m -YELLOW ENG 2 PUMP..OFF',
'290012704': '\x1b<5m -YELLOW ELEC PUMP...OFF',
'290012801': '\x1b<4m\x1b4mHYD\x1bm G RSVR OVHT',
'290012802': '\x1b<5m -PTU................OFF',
'290012803': '\x1b<5m -GREEN ENG 1 PUMP...OFF',
'308118601': '\x1b<4m\x1b4mSEVERE ICE\x1bm DETECTED',
'308118602': '\x1b5m -WING ANTI ICE.......ON',
'308118603': '\x1b5m -ENG MOD SEL........IGN',
Expand Down
4 changes: 4 additions & 0 deletions src/instruments/src/EFB/failures-orchestrator-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ const createOrchestrator = () => new FailuresOrchestrator('A32NX', [
[29, A320Failure.GreenReservoirReturnLeak, 'Green reservoir return leak'],
[29, A320Failure.BlueReservoirReturnLeak, 'Blue reservoir return leak'],
[29, A320Failure.YellowReservoirReturnLeak, 'Yellow reservoir return leak'],
[29, A320Failure.GreenEdpOverheat, 'Green engine pump overheat'],
[29, A320Failure.BlueEpumpOverheat, 'Blue electric pump overheat'],
[29, A320Failure.YellowEdpOverheat, 'Yellow engine pump overheat'],
[29, A320Failure.YellowEpumpOverheat, 'Yellow electric pump overheat'],

[31, A320Failure.LeftPfdDisplay, 'Captain PFD display'],
[31, A320Failure.RightPfdDisplay, 'F/O PFD display'],
Expand Down
58 changes: 58 additions & 0 deletions src/instruments/src/EWD/elements/PseudoFWC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,17 @@ const PseudoFWC: React.FC = () => {
const [blueLP] = useSimVar('L:A32NX_HYD_BLUE_EDPUMP_LOW_PRESS', 'bool', 500);
const [blueSysPressurised] = useSimVar('L:A32NX_HYD_BLUE_SYSTEM_1_SECTION_PRESSURE_SWITCH', 'bool', 500);
const [blueRvrLow] = useSimVar('L:A32NX_HYD_BLUE_RESERVOIR_LEVEL_IS_LOW', 'bool', 500);

const [yellowRvrOvht] = useSimVar('L:A32NX_HYD_YELLOW_RESERVOIR_OVHT', 'bool', 500);
const [greenRvrOvht] = useSimVar('L:A32NX_HYD_GREEN_RESERVOIR_OVHT', 'bool', 500);
const [blueRvrOvht] = useSimVar('L:A32NX_HYD_BLUE_RESERVOIR_OVHT', 'bool', 500);
const [blueElecPumpPBAuto] = useSimVar('L:A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO', 'bool', 500);
const [yellowLP] = useSimVar('L:A32NX_HYD_YELLOW_EDPUMP_LOW_PRESS', 'bool', 500);
const [yellowSysPressurised] = useSimVar('L:A32NX_HYD_YELLOW_SYSTEM_1_SECTION_PRESSURE_SWITCH', 'bool', 500);
const [eng1pumpPBisAuto] = useSimVar('L:A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO', 'bool', 500);
const [eng2pumpPBisAuto] = useSimVar('L:A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO', 'bool', 500);
const [yepumpPBisAuto] = useSimVar('L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO', 'bool', 500);
const [ptuIsAuto] = useSimVar('L:A32NX_OVHD_HYD_PTU_PB_IS_AUTO', 'bool', 500);
const [hydPTU] = useSimVar('L:A32NX_HYD_PTU_ON_ECAM_MEMO', 'bool', 500);
const [ratDeployed] = useSimVar('L:A32NX_HYD_RAT_STOW_POSITION', 'percent over 100', 500);

Expand Down Expand Up @@ -1181,6 +1187,51 @@ const PseudoFWC: React.FC = () => {
sysPage: -1,
side: 'LEFT',
},
2900126: // *HYD - Blue reservoir overheat
{
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: blueRvrOvht,
whichCodeToReturn: [
0,
blueElecPumpPBAuto ? 1 : null,
],
codesToReturn: ['290012601', '290012602'],
memoInhibit: false,
failure: 2,
sysPage: 4,
side: 'LEFT',
},
2900127: // *HYD - Yellow reservoir overheat
{
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: yellowRvrOvht,
whichCodeToReturn: [
0,
ptuIsAuto ? 1 : null,
eng2pumpPBisAuto ? 2 : null,
!yepumpPBisAuto ? 3 : null,
],
codesToReturn: ['290012701', '290012702', '290012703', '290012704'],
memoInhibit: false,
failure: 2,
sysPage: 4,
side: 'LEFT',
},
2900128: // *HYD - Green reservoir overheat
{
flightPhaseInhib: [3, 4, 5, 7, 8],
simVarIsActive: greenRvrOvht,
whichCodeToReturn: [
0,
ptuIsAuto ? 1 : null,
eng1pumpPBisAuto ? 2 : null,
],
codesToReturn: ['290012801', '290012802', '290012803'],
memoInhibit: false,
failure: 2,
sysPage: 4,
side: 'LEFT',
},
2900310: // *HYD - Blue
{
flightPhaseInhib: [4, 5],
Expand Down Expand Up @@ -1897,6 +1948,7 @@ const PseudoFWC: React.FC = () => {
autoThrustStatus,
blueElecPumpPBAuto,
blueRvrLow,
blueRvrOvht,
brakeFan,
cabAltSetResetState1,
cabAltSetResetState2,
Expand Down Expand Up @@ -1933,10 +1985,12 @@ const PseudoFWC: React.FC = () => {
eng1AntiIce,
eng1FireTest,
engine1State,
eng1pumpPBisAuto,
eng2Agent1PB,
eng2Agent2PB,
eng2AntiIce,
eng2FireTest,
eng2pumpPBisAuto,
engine2State,
engDualFault,
engSelectorPosition,
Expand All @@ -1958,6 +2012,7 @@ const PseudoFWC: React.FC = () => {
gpwsFlaps3,
gpwsTerrOff,
greenHydEng1PBAuto,
greenRvrOvht,
height1Failed,
height2Failed,
hydPTU,
Expand All @@ -1984,6 +2039,7 @@ const PseudoFWC: React.FC = () => {
packOffNotFailure2,
parkBrake,
predWSOn,
ptuIsAuto,
ratDeployed,
recallReset,
rightOuterInnerValve,
Expand All @@ -2008,6 +2064,8 @@ const PseudoFWC: React.FC = () => {
usrStartRefueling,
wingAntiIce,
voiceVHF3,
yellowRvrOvht,
yepumpPBisAuto,
]);

useEffect(() => {
Expand Down
26 changes: 26 additions & 0 deletions src/instruments/src/SD/Pages/Hyd/Hyd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const HydPage = () => {

const [ACBus1IsPowered] = useSimVar('L:A32NX_ELEC_AC_1_BUS_IS_POWERED', 'bool', 1000);

const [blueElecPumpOvht] = useSimVar('L:A32NX_HYD_BLUE_EPUMP_OVHT', 'bool', 1000);

const [engine1Running, setEngine1Running] = useState(false);
const [engine2Running, setEngine2Running] = useState(false);

Expand Down Expand Up @@ -111,6 +113,13 @@ export const HydPage = () => {
>
ELEC
</text>
<text
className={blueElecPumpOvht ? 'Large Amber' : 'Hide'}
x={420}
y={414}
>
OVHT
</text>

<YellowElecPump pumpPushbuttonOn={yellowElectricPumpStatus} pressure={yellowPressure} enginePumpPressureLowSwitch={!yellowPumpPressurisedSwitch} />

Expand Down Expand Up @@ -255,6 +264,10 @@ const HydReservoir = ({ system, x, y, lowLevel } : HydReservoirProps) => {

const [lowAirPress] = useSimVar(`L:A32NX_HYD_${system}_RESERVOIR_AIR_PRESSURE_IS_LOW`, 'boolean', 1000);

// The overheat indication should be computed by the EIS itself from the numerical temperature value,
// by applying a hysteresis logic. For now, we just use a boolean from the hydraulics directly.
const [overheat] = useSimVar(`L:A32NX_HYD_${system}_RESERVOIR_OVHT`, 'boolean', 1000);

const fluidLevelInLitres = fluidLevel * litersPerGallon;

const values = levels[system];
Expand Down Expand Up @@ -282,6 +295,10 @@ const HydReservoir = ({ system, x, y, lowLevel } : HydReservoirProps) => {

<text className={lowAirPress ? 'Large Amber' : 'Hide'} x={12} y={-72}>LO AIR</text>
<text className={lowAirPress ? 'Large Amber' : 'Hide'} x={12} y={-45}>PRESS</text>

{ /* Not sure about the exact placement, have to wait for an IRL ref */ }
<text className={overheat ? 'Large Amber' : 'Hide'} x={20} y={-5}>OVHT</text>

</SvgGroup>
);
};
Expand All @@ -295,6 +312,8 @@ type YellowElecPumpProps = {
const YellowElecPump = ({ pumpPushbuttonOn, pressure, enginePumpPressureLowSwitch }: YellowElecPumpProps) => {
const [ACBus2IsPowered] = useSimVar('L:A32NX_ELEC_AC_2_BUS_IS_POWERED', 'bool', 1000);

const [yellowElecPumpOvht] = useSimVar('L:A32NX_HYD_YELLOW_EPUMP_OVHT', 'bool', 1000);

let elecHorizontalLineFormat: string;
let verticalLineFormat: string;
let elecTriangleFill: number;
Expand Down Expand Up @@ -326,6 +345,13 @@ const YellowElecPump = ({ pumpPushbuttonOn, pressure, enginePumpPressureLowSwitc
>
ELEC
</text>
<text
className={yellowElecPumpOvht ? 'Large Amber' : 'Hide'}
x={676}
y={322}
>
OVHT
</text>
<Triangle x={642} y={283} scale={4 / 3} colour={elecTriangleColour} fill={elecTriangleFill} orientation={-90} />
<line className={elecHorizontalLineFormat} x1={631} y1={283} x2={642} y2={283} />
<line className={verticalLineFormat} x1={630} y1={217} x2={630} y2={283} />
Expand Down
12 changes: 8 additions & 4 deletions src/systems/a320_hydraulic_simulation_graphs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use systems::hydraulic::*;
use systems::{
electrical::{test::TestElectricitySource, ElectricalBus, Electricity},
shared::{
update_iterator::FixedStepLoop, ElectricalBusType, HydraulicColor, PotentialOrigin,
ReservoirAirPressure,
update_iterator::FixedStepLoop, AirbusElectricPumpId, AirbusEngineDrivenPumpId,
ElectricalBusType, HydraulicColor, PotentialOrigin, ReservoirAirPressure,
},
simulation::{
test::{SimulationTestBed, TestBed},
Expand Down Expand Up @@ -358,15 +358,19 @@ fn hydraulic_loop(context: &mut InitContext, loop_color: HydraulicColor) -> Hydr
fn electric_pump(context: &mut InitContext) -> ElectricPump {
ElectricPump::new(
context,
"DEFAULT",
AirbusElectricPumpId::Green,
ElectricalBusType::AlternatingCurrentGndFltService,
ElectricCurrent::new::<ampere>(45.),
PumpCharacteristics::a320_electric_pump(),
)
}

fn _engine_driven_pump(context: &mut InitContext) -> EngineDrivenPump {
EngineDrivenPump::new(context, "DEFAULT", PumpCharacteristics::a320_edp())
EngineDrivenPump::new(
context,
AirbusEngineDrivenPumpId::Green,
PumpCharacteristics::a320_edp(),
)
}

struct A320TestPneumatics {
Expand Down
Loading

0 comments on commit 18f7db2

Please sign in to comment.