Skip to content

Commit

Permalink
feat(a380x): proper trim tank calculation/logic for automatic refueli…
Browse files Browse the repository at this point in the history
…ng (flybywiresim#8885)

* init trim tank lut

* feat: trim tank calculation v1

* fix: don't round 2 digits

* revert: back to normal defaults

* fix: tests

* feat: target zfw bsaed on efb values

* fix: initialise desired fuel on first load

* chore: remove old comment

* chore: readme

* chore: remove unnecessary features

* feat: limit refuel slider % to be more sensible for current WV (can be overriden)

* fix: review comments

* fix: review comments

* refactor: updated flts for current tank fueling logic

* fix: adjust for 0 pax

* refactor: remove clone and immutable mut, cleanup

* fix: arm gnd spoilers in appropriate flt states

* fix: update flaps and ths setting for runway flt

* fix: seatbelt sign

* fix: seatbelt sign

* fix: use clamp

* fix: remove def

* fix: flt + xml

* revert: a320 apron.flt
  • Loading branch information
2hwk authored Sep 25, 2024
1 parent 7445b15 commit 51f0662
Show file tree
Hide file tree
Showing 20 changed files with 1,162 additions and 238 deletions.
817 changes: 668 additions & 149 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dev-env
Submodule dev-env added at 232438
8 changes: 6 additions & 2 deletions fbw-a380x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ These systems are currently not operational / these features are missing and sha
- Complete SLAT/FLAP CTL implementation (adapted A32NX computers atm)

### ATA 28 Fuel

- Automatic fuel transfer system
- Refuel Driver/Refuel Application placeholder pseudo-FQMS implementation (pre-cursor for realistic FQMS implementation while supporting instant load)
- CPIOM etc. not implemented yet.
- Automatic fuel transfer system - Not fully implemented yet i.e. AGT off when 2 engines on
- Manual refueling - Not supported yet
- Integrated Refuel Panel - Simulated in the systems but not modeled in the plane model, or fully connected to ELEC
- MFD entry - Not supported yet (ZFW/ZFWCG entry - Possible via EFB currently for testing)

### ATA 29 Hydraulic System

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,24 @@ Pump.18=False
Pump.19=False
Pump.20=False
Pump.21=False
Tank.1=0
Tank.2=1
Tank.3=0.25
Tank.4=0.25
Tank.5=1
Tank.6=1
Tank.7=0.25
Tank.8=0.25
Tank.9=1
Tank.10=0
Tank.11=0
Tank.1=0.4818560183048248291
Tank.2=0.74762970209121704102
Tank.3=0
Tank.4=0.14810475707054138184
Tank.5=0.72874546051025390625
Tank.6=0.72874546051025390625
Tank.7=0.14810457825660705566
Tank.8=0
Tank.9=0.74762970209121704102
Tank.10=0.4818560183048248291
Tank.11=0.55189013481140136719
Junction.7=1
Junction.8=1
Junction.9=1

[Systems.0]
BatterySwitch=True
SeatBeltsSwitch=True
StructuralDeiceSwitch=False
PropDeiceSwitch=False
StandbyVacuum=False
Expand All @@ -234,7 +235,16 @@ TailhookState=0
FoldingWingsHandle=False
FoldingWingsState=0, 0

[Payload.0]
PayloadList=1296.3,4629.7,7037.2,8703.8,7037.2,7777.9,7037.2,6296.4,7037.2,7037.2,2222.3,5370.5,4629.7,3148.2,10491.8,7456.0, 923.7, 1.0, 1.0

[LocalVars.0]
A32NX_CARGO_FWD=4759
A32NX_CARGO_FWD_DESIRED=4759
A32NX_CARGO_AFT=3382
A32NX_CARGO_AFT_DESIRED=3382
A32NX_CARGO_BULK=419
A32NX_CARGO_BULK_DESIRED=419
A32NX_EFIS_L_NAVAID_1_MODE=2
A32NX_EFIS_L_NAVAID_2_MODE=2
A32NX_EFIS_L_ND_MODE=3
Expand Down Expand Up @@ -294,6 +304,34 @@ A32NX_OVHD_HYD_ENG_4B_PUMP_PB_IS_AUTO = 1
A32NX_OVHD_PRESS_MAN_ALTITUDE_PB_IS_AUTO=1
A32NX_OVHD_PRESS_MAN_VS_CTL_PB_IS_AUTO=1
A32NX_OVHD_VENT_CAB_FANS_PB_IS_ON=1
A32NX_PAX_MAIN_FWD_A=35160464
A32NX_PAX_MAIN_FWD_A_DESIRED=35160464
A32NX_PAX_MAIN_FWD_B=268430719
A32NX_PAX_MAIN_FWD_B_DESIRED=268430719
A32NX_PAX_MAIN_MID_1A=1097363095551
A32NX_PAX_MAIN_MID_1A_DESIRED=1097363095551
A32NX_PAX_MAIN_MID_1B=2251796592328701
A32NX_PAX_MAIN_MID_1B_DESIRED=2251796592328701
A32NX_PAX_MAIN_MID_1C=17589501640446
A32NX_PAX_MAIN_MID_1C_DESIRED=17589501640446
A32NX_PAX_MAIN_MID_2A=558386550667247
A32NX_PAX_MAIN_MID_2A_DESIRED=558386550667247
A32NX_PAX_MAIN_MID_2B=1647119957759
A32NX_PAX_MAIN_MID_2B_DESIRED=1647119957759
A32NX_PAX_MAIN_MID_2C=135157121023
A32NX_PAX_MAIN_MID_2C_DESIRED=135157121023
A32NX_PAX_MAIN_AFT_A=4361203744767
A32NX_PAX_MAIN_AFT_A_DESIRED=4361203744767
A32NX_PAX_MAIN_AFT_B=2196875509695
A32NX_PAX_MAIN_AFT_B_DESIRED=2196875509695
A32NX_PAX_UPPER_FWD=15615
A32NX_PAX_UPPER_FWD_DESIRED=15615
A32NX_PAX_UPPER_MID_A=1073741819
A32NX_PAX_UPPER_MID_A_DESIRED=1073741819
A32NX_PAX_UPPER_MID_B=268432127
A32NX_PAX_UPPER_MID_B_DESIRED=268432127
A32NX_PAX_UPPER_AFT=261631
A32NX_PAX_UPPER_AFT_DESIRED=261631
A32NX_PRIM_1_PUSHBUTTON_PRESSED=1
A32NX_PRIM_2_PUSHBUTTON_PRESSED=1
A32NX_PRIM_3_PUSHBUTTON_PRESSED=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ TailhookHandle=False
TailhookState=0
FoldingWingsHandle=False
FoldingWingsState=0, 0
SeatBeltsSwitch=True

[Payload.0]
PayloadList=1296.3,4629.7,7037.2,8703.8,7037.2,7777.9,7037.2,6296.4,7037.2,7037.2,2222.3,5370.5,4629.7,3148.2,10491.8,7456.0, 923.7, 1.0, 1.0

[LocalVars.0]
A320_Neo_AIRCOND_LVL_1=50
Expand All @@ -241,6 +245,12 @@ A32NX_AVIONICS_STARTUP_SOUNDS_INHIBIT=1
A32NX_BARO_BRIGHTNESS=0.75
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_CARGO_FWD=4759
A32NX_CARGO_FWD_DESIRED=4759
A32NX_CARGO_AFT=3382
A32NX_CARGO_AFT_DESIRED=3382
A32NX_CARGO_BULK=419
A32NX_CARGO_BULK_DESIRED=419
A32NX_CARGOSMOKE_AFT_DISCHARGED = 0
A32NX_CARGOSMOKE_DISCH1LOCK_TOGGLE=0
A32NX_CARGOSMOKE_DISCH2LOCK_TOGGLE=0
Expand Down Expand Up @@ -357,6 +367,34 @@ A32NX_OXYGEN_TMR_RESET_FAULT = 0
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
A32NX_PARK_BRAKE_LEVER_POS=0
A32NX_PAX_MAIN_FWD_A=35160464
A32NX_PAX_MAIN_FWD_A_DESIRED=35160464
A32NX_PAX_MAIN_FWD_B=268430719
A32NX_PAX_MAIN_FWD_B_DESIRED=268430719
A32NX_PAX_MAIN_MID_1A=1097363095551
A32NX_PAX_MAIN_MID_1A_DESIRED=1097363095551
A32NX_PAX_MAIN_MID_1B=2251796592328701
A32NX_PAX_MAIN_MID_1B_DESIRED=2251796592328701
A32NX_PAX_MAIN_MID_1C=17589501640446
A32NX_PAX_MAIN_MID_1C_DESIRED=17589501640446
A32NX_PAX_MAIN_MID_2A=558386550667247
A32NX_PAX_MAIN_MID_2A_DESIRED=558386550667247
A32NX_PAX_MAIN_MID_2B=1647119957759
A32NX_PAX_MAIN_MID_2B_DESIRED=1647119957759
A32NX_PAX_MAIN_MID_2C=135157121023
A32NX_PAX_MAIN_MID_2C_DESIRED=135157121023
A32NX_PAX_MAIN_AFT_A=4361203744767
A32NX_PAX_MAIN_AFT_A_DESIRED=4361203744767
A32NX_PAX_MAIN_AFT_B=2196875509695
A32NX_PAX_MAIN_AFT_B_DESIRED=2196875509695
A32NX_PAX_UPPER_FWD=15615
A32NX_PAX_UPPER_FWD_DESIRED=15615
A32NX_PAX_UPPER_MID_A=1073741819
A32NX_PAX_UPPER_MID_A_DESIRED=1073741819
A32NX_PAX_UPPER_MID_B=268432127
A32NX_PAX_UPPER_MID_B_DESIRED=268432127
A32NX_PAX_UPPER_AFT=261631
A32NX_PAX_UPPER_AFT_DESIRED=261631
A32NX_PRIM_1_PUSHBUTTON_PRESSED=1
A32NX_PRIM_2_PUSHBUTTON_PRESSED=1
A32NX_PRIM_3_PUSHBUTTON_PRESSED=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ TailhookState=0
FoldingWingsHandle=False
FoldingWingsState=0, 0
ExternalPowerSwitch=False
SeatBeltsSwitch=False

[LocalVars.0]
A320_Neo_AIRCOND_LVL_1=50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,17 @@ Pump.18=False
Pump.19=False
Pump.20=False
Pump.21=False
Tank.1=0
Tank.2=1
Tank.3=0.25
Tank.4=0.25
Tank.5=1
Tank.6=1
Tank.7=0.25
Tank.8=0.25
Tank.9=1
Tank.10=0
Tank.11=0
Tank.1=0.4818560183048248291
Tank.2=0.74762970209121704102
Tank.3=0
Tank.4=0.14810475707054138184
Tank.5=0.72874546051025390625
Tank.6=0.72874546051025390625
Tank.7=0.14810457825660705566
Tank.8=0
Tank.9=0.74762970209121704102
Tank.10=0.4818560183048248291
Tank.11=0.55189013481140136719
Junction.7=1
Junction.8=1
Junction.9=1
Expand All @@ -234,6 +234,9 @@ TailhookState=0
FoldingWingsHandle=False
FoldingWingsState=0, 0

[Payload.0]
PayloadList=1296.3,4629.7,7037.2,8703.8,7037.2,7777.9,7037.2,6296.4,7037.2,7037.2,2222.3,5370.5,4629.7,3148.2,10491.8,7456.0, 923.7, 1.0, 1.0

[LocalVars.0]
A320_Neo_AIRCOND_LVL_1=50
A320_Neo_AIRCOND_LVL_2=50
Expand All @@ -252,6 +255,12 @@ A32NX_AVIONICS_STARTUP_SOUNDS_INHIBIT=1
A32NX_BARO_BRIGHTNESS=0.75
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_CARGO_FWD=4759
A32NX_CARGO_FWD_DESIRED=4759
A32NX_CARGO_AFT=3382
A32NX_CARGO_AFT_DESIRED=3382
A32NX_CARGO_BULK=419
A32NX_CARGO_BULK_DESIRED=419
A32NX_CARGOSMOKE_AFT_DISCHARGED = 0
A32NX_CARGOSMOKE_DISCH1LOCK_TOGGLE=0
A32NX_CARGOSMOKE_DISCH2LOCK_TOGGLE=0
Expand Down Expand Up @@ -391,6 +400,34 @@ A32NX_OXYGEN_TMR_RESET_FAULT = 0
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
A32NX_PARK_BRAKE_LEVER_POS=0
A32NX_PAX_MAIN_FWD_A=35160464
A32NX_PAX_MAIN_FWD_A_DESIRED=35160464
A32NX_PAX_MAIN_FWD_B=268430719
A32NX_PAX_MAIN_FWD_B_DESIRED=268430719
A32NX_PAX_MAIN_MID_1A=1097363095551
A32NX_PAX_MAIN_MID_1A_DESIRED=1097363095551
A32NX_PAX_MAIN_MID_1B=2251796592328701
A32NX_PAX_MAIN_MID_1B_DESIRED=2251796592328701
A32NX_PAX_MAIN_MID_1C=17589501640446
A32NX_PAX_MAIN_MID_1C_DESIRED=17589501640446
A32NX_PAX_MAIN_MID_2A=558386550667247
A32NX_PAX_MAIN_MID_2A_DESIRED=558386550667247
A32NX_PAX_MAIN_MID_2B=1647119957759
A32NX_PAX_MAIN_MID_2B_DESIRED=1647119957759
A32NX_PAX_MAIN_MID_2C=135157121023
A32NX_PAX_MAIN_MID_2C_DESIRED=135157121023
A32NX_PAX_MAIN_AFT_A=4361203744767
A32NX_PAX_MAIN_AFT_A_DESIRED=4361203744767
A32NX_PAX_MAIN_AFT_B=2196875509695
A32NX_PAX_MAIN_AFT_B_DESIRED=2196875509695
A32NX_PAX_UPPER_FWD=15615
A32NX_PAX_UPPER_FWD_DESIRED=15615
A32NX_PAX_UPPER_MID_A=1073741819
A32NX_PAX_UPPER_MID_A_DESIRED=1073741819
A32NX_PAX_UPPER_MID_B=268432127
A32NX_PAX_UPPER_MID_B_DESIRED=268432127
A32NX_PAX_UPPER_AFT=261631
A32NX_PAX_UPPER_AFT_DESIRED=261631
A32NX_PRIM_1_PUSHBUTTON_PRESSED=1
A32NX_PRIM_2_PUSHBUTTON_PRESSED=1
A32NX_PRIM_3_PUSHBUTTON_PRESSED=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Junction.9=1

[Systems.0]
BatterySwitch=True
SeatBeltsSwitch=True
StructuralDeiceSwitch=False
PropDeiceSwitch=False
StandbyVacuum=False
Expand All @@ -233,6 +234,9 @@ TailhookState=0
FoldingWingsHandle=False
FoldingWingsState=0, 0

[Payload.0]
PayloadList=1296.3,4629.7,7037.2,8703.8,7037.2,7777.9,7037.2,6296.4,7037.2,7037.2,2222.3,5370.5,4629.7,3148.2,10491.8,7456.0, 923.7, 1.0, 1.0

[LocalVars.0]
A320_NEO_CDU_START_PAGE=35
A320_Neo_AIRCOND_LVL_1=50
Expand All @@ -252,6 +256,12 @@ A32NX_AVIONICS_STARTUP_SOUNDS_INHIBIT=1
A32NX_BARO_BRIGHTNESS=0.75
A32NX_CALLS_EMERLOCK_TOGGLE=1
A32NX_CALLS_EMER_ON=0
A32NX_CARGO_FWD=4759
A32NX_CARGO_FWD_DESIRED=4759
A32NX_CARGO_AFT=3382
A32NX_CARGO_AFT_DESIRED=3382
A32NX_CARGO_BULK=419
A32NX_CARGO_BULK_DESIRED=419
A32NX_CARGOSMOKE_AFT_DISCHARGED = 0
A32NX_CARGOSMOKE_DISCH1LOCK_TOGGLE=0
A32NX_CARGOSMOKE_DISCH2LOCK_TOGGLE=0
Expand Down Expand Up @@ -390,6 +400,34 @@ A32NX_OXYGEN_TMR_RESET_FAULT = 0
A32NX_PANEL_DCDU_L_BRIGHTNESS=0.5
A32NX_PANEL_DCDU_R_BRIGHTNESS=0.5
A32NX_PARK_BRAKE_LEVER_POS=0
A32NX_PAX_MAIN_FWD_A=35160464
A32NX_PAX_MAIN_FWD_A_DESIRED=35160464
A32NX_PAX_MAIN_FWD_B=268430719
A32NX_PAX_MAIN_FWD_B_DESIRED=268430719
A32NX_PAX_MAIN_MID_1A=1097363095551
A32NX_PAX_MAIN_MID_1A_DESIRED=1097363095551
A32NX_PAX_MAIN_MID_1B=2251796592328701
A32NX_PAX_MAIN_MID_1B_DESIRED=2251796592328701
A32NX_PAX_MAIN_MID_1C=17589501640446
A32NX_PAX_MAIN_MID_1C_DESIRED=17589501640446
A32NX_PAX_MAIN_MID_2A=558386550667247
A32NX_PAX_MAIN_MID_2A_DESIRED=558386550667247
A32NX_PAX_MAIN_MID_2B=1647119957759
A32NX_PAX_MAIN_MID_2B_DESIRED=1647119957759
A32NX_PAX_MAIN_MID_2C=135157121023
A32NX_PAX_MAIN_MID_2C_DESIRED=135157121023
A32NX_PAX_MAIN_AFT_A=4361203744767
A32NX_PAX_MAIN_AFT_A_DESIRED=4361203744767
A32NX_PAX_MAIN_AFT_B=2196875509695
A32NX_PAX_MAIN_AFT_B_DESIRED=2196875509695
A32NX_PAX_UPPER_FWD=15615
A32NX_PAX_UPPER_FWD_DESIRED=15615
A32NX_PAX_UPPER_MID_A=1073741819
A32NX_PAX_UPPER_MID_A_DESIRED=1073741819
A32NX_PAX_UPPER_MID_B=268432127
A32NX_PAX_UPPER_MID_B_DESIRED=268432127
A32NX_PAX_UPPER_AFT=261631
A32NX_PAX_UPPER_AFT_DESIRED=261631
A32NX_PRIM_1_PUSHBUTTON_PRESSED=1
A32NX_PRIM_2_PUSHBUTTON_PRESSED=1
A32NX_PRIM_3_PUSHBUTTON_PRESSED=1
Expand All @@ -402,6 +440,7 @@ A32NX_RCDR_TEST = 0
A32NX_SEC_1_PUSHBUTTON_PRESSED=1
A32NX_SEC_2_PUSHBUTTON_PRESSED=1
A32NX_SEC_3_PUSHBUTTON_PRESSED=1
A32NX_SPOILERS_ARMED=1
A32NX_START_STATE=8
A32NX_SVGEINT_OVRD_ON = 0
A32NX_SWITCH_RADAR_PWS_Position=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2071,9 +2071,8 @@
</UseTemplate>

<Update Once="True">
(L:XMLVAR_SWITCH_OVHD_INTLT_SEATBELT_Position) 1 == (A:CABIN SEATBELTS ALERT
SWITCH, bool) 0 == and if{
(&gt;K:CABIN_SEATBELTS_ALERT_SWITCH_TOGGLE)
(L:XMLVAR_SWITCH_OVHD_INTLT_SEATBELT_Position) (A:CABIN SEATBELTS ALERT SWITCH, bool) != if{
(&gt;K:CABIN_SEATBELTS_ALERT_SWITCH_TOGGLE)
}
</Update>
<UseTemplate Name="FBW_GT_Switch">
Expand Down
Loading

0 comments on commit 51f0662

Please sign in to comment.