diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md
index b66b4b42609..904b3195d95 100644
--- a/.github/CHANGELOG.md
+++ b/.github/CHANGELOG.md
@@ -5,6 +5,7 @@
## 0.7.0
+1. [HYD] First building block, more to come. Hydraulics do not impact the sim YET. - @crocket6 (crocket)
1. [ENGINE] Fixed fuel consumption model - @Taz5150 (TazX [Z+2]#0405)
1. [ENGINE] Fixed fuel flow being 0 at Start-up - @Taz5150 (TazX [Z+2]#0405)
1. [MCDU] Fixed input and display issues on PERF/W&B and INIT pages - @felixharnstrom (Felix Härnström)
diff --git a/.gitignore b/.gitignore
index 8a95f75fb16..ee205955d91 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,7 @@ node_modules
/target
/src/instruments/src/EFB/web/
/src/systems/target/
+/src/systems/a320_hydraulic_simulation_graphs/*.png
!igniter.config.mjs
.igniter
/src/fdr2csv/*.exe
diff --git a/Cargo.lock b/Cargo.lock
index df1482c341c..ff41ef2aff4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,9 +1,26 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+[[package]]
+name = "a320_hydraulic_simulation_graphs"
+version = "0.1.0"
+dependencies = [
+ "a320_systems",
+ "itertools",
+ "ntest",
+ "num-derive",
+ "num-traits",
+ "plotlib",
+ "rand",
+ "rustplotlib",
+ "systems",
+ "uom",
+]
+
[[package]]
name = "a320_systems"
version = "0.1.0"
dependencies = [
+ "rand",
"systems",
"uom",
]
@@ -18,6 +35,21 @@ dependencies = [
"uom",
]
+[[package]]
+name = "addr2line"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
[[package]]
name = "aho-corasick"
version = "0.7.15"
@@ -53,6 +85,20 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+[[package]]
+name = "backtrace"
+version = "0.3.56"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc"
+dependencies = [
+ "addr2line",
+ "cfg-if 1.0.0",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
[[package]]
name = "bindgen"
version = "0.55.1"
@@ -155,6 +201,28 @@ dependencies = [
"termcolor",
]
+[[package]]
+name = "failure"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
+dependencies = [
+ "backtrace",
+ "failure_derive",
+]
+
+[[package]]
+name = "failure_derive"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "synstructure",
+]
+
[[package]]
name = "futures"
version = "0.3.12"
@@ -261,6 +329,12 @@ dependencies = [
"wasi",
]
+[[package]]
+name = "gimli"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
+
[[package]]
name = "glob"
version = "0.3.0"
@@ -337,6 +411,16 @@ version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
+[[package]]
+name = "miniz_oxide"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
+dependencies = [
+ "adler",
+ "autocfg",
+]
+
[[package]]
name = "msfs"
version = "0.0.1-alpha.2"
@@ -436,6 +520,12 @@ dependencies = [
"autocfg",
]
+[[package]]
+name = "object"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4"
+
[[package]]
name = "once_cell"
version = "1.5.2"
@@ -460,6 +550,16 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "plotlib"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9462104f987d8d0f6625f0c7764f1c8b890bd1dc8584d8293e031f25c5a0d242"
+dependencies = [
+ "failure",
+ "svg",
+]
+
[[package]]
name = "ppv-lite86"
version = "0.2.10"
@@ -569,12 +669,24 @@ version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
+[[package]]
+name = "rustc-demangle"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
+
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+[[package]]
+name = "rustplotlib"
+version = "0.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4326f7ac67e4ff419282ad12dabf1fcad09481a849b72108c890e01414ebb88a"
+
[[package]]
name = "serde"
version = "1.0.123"
@@ -599,6 +711,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+[[package]]
+name = "svg"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3685c82a045a6af0c488f0550b0f52b4c77d2a52b0ca8aba719f9d268fa96965"
+
[[package]]
name = "syn"
version = "1.0.60"
@@ -610,6 +728,18 @@ dependencies = [
"unicode-xid",
]
+[[package]]
+name = "synstructure"
+version = "0.12.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "unicode-xid",
+]
+
[[package]]
name = "systems"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index ae97ebaaaae..fd83c593e23 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,5 +3,6 @@
members = [
"src/systems/a320_systems",
"src/systems/a320_systems_wasm",
- "src/systems/systems"
+ "src/systems/systems",
+ "src/systems/a320_hydraulic_simulation_graphs",
]
diff --git a/docs/a320-simvars.md b/docs/a320-simvars.md
index 09d68830bbd..1ae650694fc 100644
--- a/docs/a320-simvars.md
+++ b/docs/a320-simvars.md
@@ -114,46 +114,42 @@
- Bool
- True if pedestal door video button is being held
-- A32NX_HYD_ENG1PUMP_FAULT
+- A32NX_OVHD_HYD_{name}_PUMP_PB_HAS_FAULT
- Bool
- - True if engine 1 hyd pump fault
-
-- A32NX_HYD_ENG1PUMP_TOGGLE
- - Bool
- - True if engine 1 hyd pump is on
-
-- A32NX_HYD_ENG2PUMP_FAULT
- - Bool
- - True if engine 2 hyd pump fault
+ - True if engine {name} hyd pump fault
+ - {name}
+ - ENG_1
+ - ENG_2
-- A32NX_HYD_ENG2PUMP_TOGGLE
+- A32NX_OVHD_HYD_{name}_PUMP_PB_IS_AUTO
- Bool
- - True if engine 2 hyd pump is on
+ - True if {name} hyd pump is on
+ - {name}
+ - ENG_1
+ - ENG_2
-- A32NX_HYD_ELECPUMP_FAULT
+- A32NX_OVHD_HYD_{name}_PB_HAS_FAULT
- Bool
- - True if elec hyd pump fault
+ - True if elec {name} hyd pump fault
+ - {name}
+ - EPUMPB
+ - EPUMPY
-- A32NX_HYD_ELECPUMP_TOGGLE
+- A32NX_OVHD_HYD_{name}_PB_IS_AUTO
- Bool
- - True if elec hyd pump is on/auto
+ - True if elec {name} hyd pump is on/auto
+ - {name}
+ - EPUMPB
+ - EPUMPY
-- A32NX_HYD_PTU_FAULT
+- A32NX_OVHD_HYD_PTU_PB_HAS_FAULT
- Bool
- True if PTU fault
-- A32NX_HYD_PTU_TOGGLE
+- A32NX_OVHD_HYD_PTU_PB_IS_AUTO
- Bool
- True if PTU system on/auto
-- A32NX_HYD_ELECPUMPY_FAULT
- - Bool
- - True if yellow elec hyd pump fault
-
-- A32NX_HYD_ELECPUMPY_TOGGLE
- - Bool
- - True if yellow elec hyd pump is on/auto
-
- A32NX_ENGMANSTART1_TOGGLE
- Bool
- True if manual engine 1 start on
@@ -226,7 +222,7 @@
- Bool
- True if PFD metric altitude enabled
-- A32NX_OVHD_HYD_BLUEPUMP_OVRD
+- A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON
- Bool
- True if "BLUE PUMP OVRD" switch is off
@@ -782,6 +778,98 @@
- 1
- 2
+- A32NX_HYD_{loop_name}_PRESSURE
+ - Psi
+ - Current pressure in the {loop_name} hydraulic circuit
+ - {loop_name}
+ - GREEN
+ - BLUE
+ - YELLOW
+
+- A32NX_HYD_{loop_name}_RESERVOIR
+ - Gallon
+ - Current fluid level in the {loop_name} hydraulic circuit reservoir
+ - {loop_name}
+ - GREEN
+ - BLUE
+ - YELLOW
+
+- A32NX_HYD_{loop_name}_EDPUMP_ACTIVE
+ - Bool
+ - Engine driven pump of {loop_name} hydraulic circuit is active
+ - {loop_name}
+ - GREEN
+ - YELLOW
+
+- A32NX_HYD_{loop_name}_EDPUMP_LOW_PRESS
+ - Bool
+ - Engine driven pump of {loop_name} hydraulic circuit is active but pressure is too low
+ - {loop_name}
+ - GREEN
+ - YELLOW
+
+- A32NX_HYD_{loop_name}_EPUMP_ACTIVE
+ - Bool
+ - Electric pump of {loop_name} hydraulic circuit is active
+ - {loop_name}
+ - BLUE
+ - YELLOW
+
+- A32NX_HYD_{loop_name}_EPUMP_LOW_PRESS
+ - Bool
+ - Electric pump of {loop_name} hydraulic circuit is active but pressure is too low
+ - {loop_name}
+ - BLUE
+ - YELLOW
+
+- A32NX_HYD_{loop_name}_FIRE_VALVE_OPENED
+ - Bool
+ - Engine driven pump of {loop_name} hydraulic circuit can receive hydraulic fluid
+ - {loop_name}
+ - GREEN
+ - YELLOW
+
+- A32NX_HYD_PTU_VALVE_OPENED
+ - Bool
+ - Power Transfer Unit can receive fluid from yellow and green circuits
+
+- A32NX_HYD_PTU_ACTIVE_{motor_side}
+ - Bool
+ - Power Transfer Unit is trying to transfer hydraulic power from either yellow to green (R2L) or green to yellow (L2R) circuits
+ - {motor_side}
+ - L2R
+ - R2L
+
+- A32NX_HYD_PTU_MOTOR_FLOW
+ - Gallon per second
+ - Power Transfer Unit instantaneous flow in motor side
+
+- A32NX_HYD_RAT_STOW_POSITION
+ - Percent over 100
+ - RAT position, from fully stowed (0) to fully deployed (1)
+
+- A32NX_HYD_RAT_RPM
+ - Rpm
+ - RAT propeller current RPM
+
+- A32NX_HYD_BRAKE_NORM_{brake_side}_PRESS
+ - Psi
+ - Current pressure in brake slave circuit on green brake circuit
+ - {brake_side}
+ - LEFT
+ - RIGHT
+
+- A32NX_HYD_BRAKE_ALTN_{brake_side}_PRESS
+ - Psi
+ - Current pressure in brake slave circuit on yellow alternate brake circuit
+ - {brake_side}
+ - LEFT
+ - RIGHT
+
+- A32NX_HYD_BRAKE_ALTN_ACC_PRESS
+ - Psi
+ - Current pressure in brake accumulator on yellow alternate brake circuit
+
- A32NX_FMGC_FLIGHT_PHASE
- Enum
- Holds the FMGCs current flight phase
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT
index 892289cb76b..82ca0650ac5 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/approach.FLT
@@ -165,18 +165,13 @@ A32NX_AIRCOND_RAMAIR_TOGGLE=0
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_OVHD_COCKPITDOORVIDEO_TOGGLE=1
-A32NX_HYD_ENG1PUMP_FAULT=0
-A32NX_HYD_ENG1PUMP_TOGGLE=1
-A32NX_HYD_ENG2PUMP_FAULT=0
-A32NX_HYD_ENG2PUMP_TOGGLE=1
+A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO=1
+A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO=1
A32NX_HYD_RATMANONLOCK_TOGGLE=0
-A32NX_HYD_ELECPUMP_FAULT=0
-A32NX_HYD_ELECPUMP_TOGGLE=1
+A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO=1
A32NX_HYD_ELECPUMPLOCK_TOGGLE=0
-A32NX_HYD_PTU_FAULT=0
-A32NX_HYD_PTU_TOGGLE=1
-A32NX_HYD_ELECPUMPY_FAULT=0
-A32NX_HYD_ELECPUMPY_TOGGLE=1
+A32NX_OVHD_HYD_PTU_PB_IS_AUTO=1
+A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO=1
A32NX_ENGMANSTART1LOCK_TOGGLE=0
A32NX_ENGMANSTART2LOCK_TOGGLE=0
A32NX_ENGMANSTART1_TOGGLE=0
@@ -201,7 +196,7 @@ A32NX_KNOB_SWITCHING_3_Position=1
A32NX_KNOB_SWITCHING_4_Position=1
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
-A32NX_OVHD_HYD_BLUEPUMP_OVRD=0
+A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON=0
A32NX_OVHD_HYD_LEAK_MEASUREMENT_G=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_B=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_Y=1
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT
index 16bc428a158..7ebb724b040 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/apron.FLT
@@ -170,18 +170,13 @@ A32NX_AIRCOND_RAMAIR_TOGGLE=0
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_OVHD_COCKPITDOORVIDEO_TOGGLE=1
-A32NX_HYD_ENG1PUMP_FAULT=0
-A32NX_HYD_ENG1PUMP_TOGGLE=1
-A32NX_HYD_ENG2PUMP_FAULT=0
-A32NX_HYD_ENG2PUMP_TOGGLE=1
+A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO=1
+A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO=1
A32NX_HYD_RATMANONLOCK_TOGGLE=0
-A32NX_HYD_ELECPUMP_FAULT=0
-A32NX_HYD_ELECPUMP_TOGGLE=1
+A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO=1
A32NX_HYD_ELECPUMPLOCK_TOGGLE=0
-A32NX_HYD_PTU_FAULT=0
-A32NX_HYD_PTU_TOGGLE=1
-A32NX_HYD_ELECPUMPY_FAULT=0
-A32NX_HYD_ELECPUMPY_TOGGLE=1
+A32NX_OVHD_HYD_PTU_PB_IS_AUTO=1
+A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO=1
A32NX_ENGMANSTART1LOCK_TOGGLE=0
A32NX_ENGMANSTART2LOCK_TOGGLE=0
A32NX_ENGMANSTART1_TOGGLE=0
@@ -206,7 +201,7 @@ A32NX_KNOB_SWITCHING_3_Position=1
A32NX_KNOB_SWITCHING_4_Position=1
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
-A32NX_OVHD_HYD_BLUEPUMP_OVRD=0
+A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON=0
A32NX_OVHD_HYD_LEAK_MEASUREMENT_G=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_B=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_Y=1
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT
index 7cd188eabd6..fa84a387992 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/cruise.FLT
@@ -165,18 +165,13 @@ A32NX_AIRCOND_RAMAIR_TOGGLE=0
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_OVHD_COCKPITDOORVIDEO_TOGGLE=1
-A32NX_HYD_ENG1PUMP_FAULT=0
-A32NX_HYD_ENG1PUMP_TOGGLE=1
-A32NX_HYD_ENG2PUMP_FAULT=0
-A32NX_HYD_ENG2PUMP_TOGGLE=1
+A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO=1
+A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO=1
A32NX_HYD_RATMANONLOCK_TOGGLE=0
-A32NX_HYD_ELECPUMP_FAULT=0
-A32NX_HYD_ELECPUMP_TOGGLE=1
+A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO=1
A32NX_HYD_ELECPUMPLOCK_TOGGLE=0
-A32NX_HYD_PTU_FAULT=0
-A32NX_HYD_PTU_TOGGLE=1
-A32NX_HYD_ELECPUMPY_FAULT=0
-A32NX_HYD_ELECPUMPY_TOGGLE=1
+A32NX_OVHD_HYD_PTU_PB_IS_AUTO=1
+A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO=1
A32NX_ENGMANSTART1LOCK_TOGGLE=0
A32NX_ENGMANSTART2LOCK_TOGGLE=0
A32NX_ENGMANSTART1_TOGGLE=0
@@ -201,7 +196,7 @@ A32NX_KNOB_SWITCHING_3_Position=1
A32NX_KNOB_SWITCHING_4_Position=1
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
-A32NX_OVHD_HYD_BLUEPUMP_OVRD=0
+A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON=0
A32NX_OVHD_HYD_LEAK_MEASUREMENT_G=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_B=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_Y=1
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT
index 31e568ced2d..74fd6e4051a 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/final.FLT
@@ -165,18 +165,13 @@ A32NX_AIRCOND_RAMAIR_TOGGLE=0
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_OVHD_COCKPITDOORVIDEO_TOGGLE=1
-A32NX_HYD_ENG1PUMP_FAULT=0
-A32NX_HYD_ENG1PUMP_TOGGLE=1
-A32NX_HYD_ENG2PUMP_FAULT=0
-A32NX_HYD_ENG2PUMP_TOGGLE=1
+A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO=1
+A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO=1
A32NX_HYD_RATMANONLOCK_TOGGLE=0
-A32NX_HYD_ELECPUMP_FAULT=0
-A32NX_HYD_ELECPUMP_TOGGLE=1
+A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO=1
A32NX_HYD_ELECPUMPLOCK_TOGGLE=0
-A32NX_HYD_PTU_FAULT=0
-A32NX_HYD_PTU_TOGGLE=1
-A32NX_HYD_ELECPUMPY_FAULT=0
-A32NX_HYD_ELECPUMPY_TOGGLE=1
+A32NX_OVHD_HYD_PTU_PB_IS_AUTO=1
+A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO=1
A32NX_ENGMANSTART1LOCK_TOGGLE=0
A32NX_ENGMANSTART2LOCK_TOGGLE=0
A32NX_ENGMANSTART1_TOGGLE=0
@@ -201,7 +196,7 @@ A32NX_KNOB_SWITCHING_3_Position=1
A32NX_KNOB_SWITCHING_4_Position=1
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
-A32NX_OVHD_HYD_BLUEPUMP_OVRD=0
+A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON=0
A32NX_OVHD_HYD_LEAK_MEASUREMENT_G=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_B=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_Y=1
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
index 46d3271be29..3c6c70ed4a5 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/model/A320_NEO_INTERIOR.xml
@@ -1859,27 +1859,27 @@
PUSH_OVHD_HYD_ENG1PUMP
- L:A32NX_HYD_ENG1PUMP_TOGGLE
+ L:A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO
(L:A32NX_ELEC_AC_1_BUS_IS_POWERED, Bool)
- (L:A32NX_HYD_ENG1PUMP_FAULT, Bool)
- (L:A32NX_HYD_ENG1PUMP_TOGGLE, Bool) !
+ (L:A32NX_OVHD_HYD_ENG_1_PUMP_PB_HAS_FAULT, Bool)
+ (L:A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO, Bool) !
False
False
False
- %((L:A32NX_HYD_ENG1PUMP_TOGGLE, Bool))%{if}Turn OFF eng 1 hyd pump%{else}Turn ON eng 1 hyd pump%{end}
+ %((L:A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO, Bool))%{if}Turn OFF eng 1 hyd pump%{else}Turn ON eng 1 hyd pump%{end}
PUSH_OVHD_HYD_ENG2PUMP
- L:A32NX_HYD_ENG2PUMP_TOGGLE
+ L:A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO
(L:A32NX_ELEC_AC_2_BUS_IS_POWERED, Bool)
- (L:A32NX_HYD_ENG2PUMP_FAULT, Bool)
- (L:A32NX_HYD_ENG2PUMP_TOGGLE, Bool) !
+ (L:A32NX_OVHD_HYD_ENG_2_PUMP_PB_HAS_FAULT, Bool)
+ (L:A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO, Bool) !
False
False
False
- %((L:A32NX_HYD_ENG2PUMP_TOGGLE, Bool))%{if}Turn OFF eng 2 hyd pump%{else}Turn ON eng 2 hyd pump%{end}
+ %((L:A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO, Bool))%{if}Turn OFF eng 2 hyd pump%{else}Turn ON eng 2 hyd pump%{end}
@@ -1895,41 +1895,41 @@
PUSH_OVHD_HYD_ELECPUMP
LOCK_OVHD_HYD_ELECPUMP
- L:A32NX_HYD_ELECPUMP_TOGGLE
+ L:A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO
(L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool)
- (L:A32NX_HYD_ELECPUMP_FAULT, Bool)
- (L:A32NX_HYD_ELECPUMP_TOGGLE, Bool) !
+ (L:A32NX_OVHD_HYD_EPUMPB_PB_HAS_FAULT, Bool)
+ (L:A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO, Bool) !
False
False
False
- %((L:A32NX_HYD_ELECPUMP_TOGGLE, Bool))%{if}Turn OFF elec hyd pump%{else}Turn ON elec hyd pump%{end}
+ %((L:A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO, Bool))%{if}Turn OFF elec hyd pump%{else}Turn ON elec hyd pump%{end}
PUSH_OVHD_HYD_PTU
- L:A32NX_HYD_PTU_TOGGLE
+ L:A32NX_OVHD_HYD_PTU_PB_IS_AUTO
(L:A32NX_ELEC_AC_2_BUS_IS_POWERED, Bool)
- (L:A32NX_HYD_PTU_FAULT, Bool)
- (L:A32NX_HYD_PTU_TOGGLE, Bool) !
+ (L:A32NX_OVHD_HYD_PTU_PB_HAS_FAULT, Bool)
+ (L:A32NX_OVHD_HYD_PTU_PB_IS_AUTO, Bool) !
False
False
False
- %((L:A32NX_HYD_PTU_TOGGLE, Bool))%{if}Turn OFF PTU%{else}Turn ON PTU%{end}
+ %((L:A32NX_OVHD_HYD_PTU_PB_IS_AUTO, Bool))%{if}Turn OFF PTU%{else}Turn ON PTU%{end}
PUSH_OVHD_HYD_ELECPUMPY
- L:A32NX_HYD_ELECPUMPY_TOGGLE
+ L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO
(L:A32NX_ELEC_AC_2_BUS_IS_POWERED, Bool)
- (L:A32NX_HYD_ELECPUMPY_FAULT, Bool)
- (L:A32NX_HYD_ELECPUMPY_TOGGLE, Bool) !
+ (L:A32NX_OVHD_HYD_EPUMPY_PB_HAS_FAULT, Bool)
+ (L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO, Bool) !
False
False
False
- %((L:A32NX_HYD_ELECPUMPY_TOGGLE, Bool))%{if}Turn ON yellow elec hyd pump%{else}Turn OFF yellow elec hyd pump%{end}
+ %((L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO, Bool))%{if}Turn ON yellow elec hyd pump%{else}Turn OFF yellow elec hyd pump%{end}
@@ -2833,7 +2833,7 @@
PUSH_OVHD_HYD_BLUEPUMP
LOCK_OVHD_HYD_BLUEPUMPOVRD
- L:A32NX_OVHD_HYD_BLUEPUMP_OVRD
+ L:A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON
(L:A32NX_ELEC_AC_1_BUS_IS_POWERED, Bool)
False
False
@@ -3701,9 +3701,9 @@
Press_Arc_L
3
1
-
+
(L:A32NX_ELEC_DC_ESS_BUS_IS_POWERED, Bool) if{
- (A:BRAKE PARKING POSITION, Bool) 2 *
+ (L:A32NX_HYD_BRAKE_ALTN_LEFT_PRESS, number) 1000 /
} els{
0
}
@@ -3718,7 +3718,7 @@
1
(L:A32NX_ELEC_DC_ESS_BUS_IS_POWERED, Bool) if{
- (A:BRAKE PARKING POSITION, Bool) 2 *
+ (L:A32NX_HYD_BRAKE_ALTN_RIGHT_PRESS, number) 1000 /
} els{
0
}
@@ -3733,7 +3733,7 @@
1
(L:A32NX_ELEC_DC_ESS_BUS_IS_POWERED, Bool) if{
- 0.8
+ (L:A32NX_HYD_BRAKE_ALTN_ACC_PRESS, number) 4000 /
} els{
0
}
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT
index 1a8b1aeba97..b357545ff37 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/runway.FLT
@@ -172,18 +172,13 @@ A32NX_AIRCOND_RAMAIR_TOGGLE=0
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_OVHD_COCKPITDOORVIDEO_TOGGLE=1
-A32NX_HYD_ENG1PUMP_FAULT=0
-A32NX_HYD_ENG1PUMP_TOGGLE=1
-A32NX_HYD_ENG2PUMP_FAULT=0
-A32NX_HYD_ENG2PUMP_TOGGLE=1
+A32NX_OVHD_HYD_ENG_1_PUMP_PB_IS_AUTO=1
+A32NX_OVHD_HYD_ENG_2_PUMP_PB_IS_AUTO=1
A32NX_HYD_RATMANONLOCK_TOGGLE=0
-A32NX_HYD_ELECPUMP_FAULT=0
-A32NX_HYD_ELECPUMP_TOGGLE=1
+A32NX_OVHD_HYD_EPUMPB_PB_IS_AUTO=1
A32NX_HYD_ELECPUMPLOCK_TOGGLE=0
-A32NX_HYD_PTU_FAULT=0
-A32NX_HYD_PTU_TOGGLE=1
-A32NX_HYD_ELECPUMPY_FAULT=0
-A32NX_HYD_ELECPUMPY_TOGGLE=1
+A32NX_OVHD_HYD_PTU_PB_IS_AUTO=1
+A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO=1
A32NX_ENGMANSTART1LOCK_TOGGLE=0
A32NX_ENGMANSTART2LOCK_TOGGLE=0
A32NX_ENGMANSTART1_TOGGLE=0
@@ -208,7 +203,7 @@ A32NX_KNOB_SWITCHING_3_Position=1
A32NX_KNOB_SWITCHING_4_Position=1
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
-A32NX_OVHD_HYD_BLUEPUMP_OVRD=0
+A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON=0
A32NX_OVHD_HYD_LEAK_MEASUREMENT_G=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_B=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_Y=1
diff --git a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt
index 957dfb09243..c90f9a7c35b 100644
--- a/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt
+++ b/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/taxi.flt
@@ -184,7 +184,7 @@ A32NX_KNOB_SWITCHING_3_Position=1
A32NX_KNOB_SWITCHING_4_Position=1
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
-A32NX_OVHD_HYD_BLUEPUMP_OVRD=0
+A32NX_OVHD_HYD_EPUMPY_OVRD_PB_IS_ON=0
A32NX_OVHD_HYD_LEAK_MEASUREMENT_G=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_B=1
A32NX_OVHD_HYD_LEAK_MEASUREMENT_Y=1
diff --git a/src/systems/a320_hydraulic_simulation_graphs/Cargo.toml b/src/systems/a320_hydraulic_simulation_graphs/Cargo.toml
new file mode 100644
index 00000000000..9cd7db19df2
--- /dev/null
+++ b/src/systems/a320_hydraulic_simulation_graphs/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "a320_hydraulic_simulation_graphs"
+version = "0.1.0"
+authors = ["davydecorps <38904654+crocket63@users.noreply.github.com>"]
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+systems = { path = "../systems" }
+a320_systems = { path = "../a320_systems" }
+uom = "0.30.0"
+rand = "0.8.0"
+ntest = "0.7.2"
+num-derive = "0.3.3"
+num-traits = "0.2.14"
+itertools = "0.10.0"
+plotlib = "0.5.1"
+rustplotlib = "0.0.4"
diff --git a/src/systems/a320_hydraulic_simulation_graphs/src/main.rs b/src/systems/a320_hydraulic_simulation_graphs/src/main.rs
new file mode 100644
index 00000000000..4bc6c0afa3e
--- /dev/null
+++ b/src/systems/a320_hydraulic_simulation_graphs/src/main.rs
@@ -0,0 +1,837 @@
+use systems::simulation::UpdateContext;
+
+pub use systems::hydraulic::*;
+
+use std::time::Duration;
+use uom::si::{
+ acceleration::foot_per_second_squared,
+ f64::*,
+ length::foot,
+ pressure::{pascal, psi},
+ thermodynamic_temperature::degree_celsius,
+ velocity::knot,
+ volume::{gallon, liter},
+ volume_rate::gallon_per_second,
+};
+
+use plotlib::page::Page;
+use plotlib::repr::Plot;
+use plotlib::style::LineStyle;
+use plotlib::view::ContinuousView;
+
+extern crate rustplotlib;
+use rustplotlib::Figure;
+
+struct TestHydraulicLoopController {
+ should_open_fire_shutoff_valve: bool,
+}
+impl TestHydraulicLoopController {
+ fn commanding_open_fire_shutoff_valve() -> Self {
+ Self {
+ should_open_fire_shutoff_valve: true,
+ }
+ }
+}
+impl HydraulicLoopController for TestHydraulicLoopController {
+ fn should_open_fire_shutoff_valve(&self) -> bool {
+ self.should_open_fire_shutoff_valve
+ }
+}
+
+struct TestPumpController {
+ should_pressurise: bool,
+}
+impl TestPumpController {
+ fn commanding_pressurise() -> Self {
+ Self {
+ should_pressurise: true,
+ }
+ }
+
+ fn commanding_depressurise() -> Self {
+ Self {
+ should_pressurise: false,
+ }
+ }
+
+ fn command_pressurise(&mut self) {
+ self.should_pressurise = true;
+ }
+
+ fn command_depressurise(&mut self) {
+ self.should_pressurise = false;
+ }
+}
+impl PumpController for TestPumpController {
+ fn should_pressurise(&self) -> bool {
+ self.should_pressurise
+ }
+}
+
+struct TestPowerTransferUnitController {
+ should_enable: bool,
+}
+impl TestPowerTransferUnitController {
+ fn commanding_disabled() -> Self {
+ Self {
+ should_enable: false,
+ }
+ }
+
+ fn commanding_enabled() -> Self {
+ Self {
+ should_enable: true,
+ }
+ }
+
+ fn command_enable(&mut self) {
+ self.should_enable = true;
+ }
+}
+impl PowerTransferUnitController for TestPowerTransferUnitController {
+ fn should_enable(&self) -> bool {
+ self.should_enable
+ }
+}
+
+fn main() {
+ println!("Launching hyd simulation...");
+ let path = "./src/systems/a320_hydraulic_simulation_graphs/";
+
+ green_loop_edp_simulation(path);
+ yellow_green_ptu_loop_simulation(path);
+ yellow_epump_plus_edp2_with_ptu(path);
+}
+
+fn make_figure(h: &History) -> Figure {
+ use rustplotlib::{Axes2D, Line2D};
+
+ let mut all_axis: Vec