From 85779a5676e6fa054210a6a23ee1fc365e92bc59 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 11 Jul 2020 20:13:21 +0100 Subject: [PATCH] Major bugfixes to failures; correct property references; optimize it-fbw --- A320-main.xml | 36 +-- AircraftConfig/acconfig.nas | 41 +-- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 51 ++- Models/Instruments/OHpanel/OHpanel.xml | 34 +- Models/Instruments/PFD/PFD.nas | 18 +- Nasal/ECAM/ECAM-logic.nas | 2 +- Nasal/FBW/it-fbw.nas | 315 +++++++------------ Nasal/FMGC/FMGC.nas | 159 +++++----- Nasal/Libraries/property-tree-setup.nas | 1 + Nasal/Systems/electrical.nas | 1 + Nasal/Systems/fuel.nas | 162 ---------- Sounds/A320-common-sound.xml | 2 +- Systems/a320-fbw.xml | 146 ++++++++- Systems/a320-fuel.xml | 25 ++ Systems/a320-spoiler.xml | 40 +-- 15 files changed, 472 insertions(+), 561 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 508a3092..51ce2f72 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -620,9 +620,6 @@ 0 - - 1 - @@ -715,15 +712,6 @@ - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 0 @@ -1059,6 +1047,7 @@ + 0 0 @@ -1151,16 +1140,18 @@ 0 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 0 @@ -1219,6 +1210,7 @@ 0 0 + 0 diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 1c8fb230..b2adcb55 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -26,28 +26,28 @@ var failReset = func { } var failResetOld = func { - setprop("/systems/failures/elac1", 0); - setprop("/systems/failures/elac2", 0); - setprop("/systems/failures/sec1", 0); - setprop("/systems/failures/sec2", 0); - setprop("/systems/failures/sec3", 0); - setprop("/systems/failures/fac1", 0); - setprop("/systems/failures/fac2", 0); + setprop("/systems/failures/fctl/elac1", 0); + setprop("/systems/failures/fctl/elac2", 0); + setprop("/systems/failures/fctl/sec1", 0); + setprop("/systems/failures/fctl/sec2", 0); + setprop("/systems/failures/fctl/sec3", 0); + setprop("/systems/failures/fctl/fac1", 0); + setprop("/systems/failures/fctl/fac2", 0); setprop("/systems/failures/aileron-left", 0); setprop("/systems/failures/aileron-right", 0); setprop("/systems/failures/elevator-left", 0); setprop("/systems/failures/elevator-right", 0); setprop("/systems/failures/rudder", 0); - setprop("/systems/failures/spoiler-l1", 0); - setprop("/systems/failures/spoiler-l2", 0); - setprop("/systems/failures/spoiler-l3", 0); - setprop("/systems/failures/spoiler-l4", 0); - setprop("/systems/failures/spoiler-l5", 0); - setprop("/systems/failures/spoiler-r1", 0); - setprop("/systems/failures/spoiler-r2", 0); - setprop("/systems/failures/spoiler-r3", 0); - setprop("/systems/failures/spoiler-r4", 0); - setprop("/systems/failures/spoiler-r5", 0); + setprop("/systems/failures/spoilers/spoiler-l1", 0); + setprop("/systems/failures/spoilers/spoiler-l2", 0); + setprop("/systems/failures/spoilers/spoiler-l3", 0); + setprop("/systems/failures/spoilers/spoiler-l4", 0); + setprop("/systems/failures/spoilers/spoiler-l5", 0); + setprop("/systems/failures/spoilers/spoiler-r1", 0); + setprop("/systems/failures/spoilers/spoiler-r2", 0); + setprop("/systems/failures/spoilers/spoiler-r3", 0); + setprop("/systems/failures/spoilers/spoiler-r4", 0); + setprop("/systems/failures/spoilers/spoiler-r5", 0); setprop("/systems/failures/hyd-blue", 0); setprop("/systems/failures/hyd-green", 0); setprop("/systems/failures/hyd-yellow", 0); @@ -56,13 +56,6 @@ var failResetOld = func { setprop("/systems/failures/pump-green", 0); setprop("/systems/failures/pump-yellow-eng", 0); setprop("/systems/failures/pump-yellow-elec", 0); - setprop("/systems/failures/tank0pump1", 0); - setprop("/systems/failures/tank0pump2", 0); - setprop("/systems/failures/tank1pump1", 0); - setprop("/systems/failures/tank1pump2", 0); - setprop("/systems/failures/tank2pump1", 0); - setprop("/systems/failures/tank2pump2", 0); - setprop("/systems/failures/fuelmode", 0); setprop("/systems/failures/cargo-aft-fire", 0); setprop("/systems/failures/cargo-fwd-fire", 0); setprop("/systems/failures/engine-left-fire", 0); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 79da26a5..bc0cf483 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -198,26 +198,26 @@ var spoiler_R2 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r2/final- var spoiler_R3 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r3/final-deg", 1); var spoiler_R4 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r4/final-deg", 1); var spoiler_R5 = props.globals.getNode("/fdm/jsbsim/hydraulics/spoiler-r5/final-deg", 1); -var spoiler_L1_fail = props.globals.getNode("/systems/failures/spoiler-l1", 1); -var spoiler_L2_fail = props.globals.getNode("/systems/failures/spoiler-l2", 1); -var spoiler_L3_fail = props.globals.getNode("/systems/failures/spoiler-l3", 1); -var spoiler_L4_fail = props.globals.getNode("/systems/failures/spoiler-l4", 1); -var spoiler_L5_fail = props.globals.getNode("/systems/failures/spoiler-l5", 1); -var spoiler_R1_fail = props.globals.getNode("/systems/failures/spoiler-r1", 1); -var spoiler_R2_fail = props.globals.getNode("/systems/failures/spoiler-r2", 1); -var spoiler_R3_fail = props.globals.getNode("/systems/failures/spoiler-r3", 1); -var spoiler_R4_fail = props.globals.getNode("/systems/failures/spoiler-r4", 1); -var spoiler_R5_fail = props.globals.getNode("/systems/failures/spoiler-r5", 1); +var spoiler_L1_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l1", 1); +var spoiler_L2_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l2", 1); +var spoiler_L3_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l3", 1); +var spoiler_L4_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l4", 1); +var spoiler_L5_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-l5", 1); +var spoiler_R1_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r1", 1); +var spoiler_R2_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r2", 1); +var spoiler_R3_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r3", 1); +var spoiler_R4_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r4", 1); +var spoiler_R5_fail = props.globals.getNode("/systems/failures/spoilers/spoiler-r5", 1); var elac1 = props.globals.getNode("/systems/fctl/elac1", 1); var elac2 = props.globals.getNode("/systems/fctl/elac2", 1); var sec1 = props.globals.getNode("/systems/fctl/sec1", 1); var sec2 = props.globals.getNode("/systems/fctl/sec2", 1); var sec3 = props.globals.getNode("/systems/fctl/sec3", 1); -var elac1_fail = props.globals.getNode("/systems/failures/elac1", 1); -var elac2_fail = props.globals.getNode("/systems/failures/elac2", 1); -var sec1_fail = props.globals.getNode("/systems/failures/sec1", 1); -var sec2_fail = props.globals.getNode("/systems/failures/sec2", 1); -var sec3_fail = props.globals.getNode("/systems/failures/sec3", 1); +var elac1_fail = props.globals.getNode("/systems/failures/fctl/elac1", 1); +var elac2_fail = props.globals.getNode("/systems/failures/fctl/elac2", 1); +var sec1_fail = props.globals.getNode("/systems/failures/fctl/sec1", 1); +var sec2_fail = props.globals.getNode("/systems/failures/fctl/sec2", 1); +var sec3_fail = props.globals.getNode("/systems/failures/fctl/sec3", 1); var eng1_n1 = props.globals.getNode("/engines/engine[0]/n1-actual", 1); var eng2_n1 = props.globals.getNode("/engines/engine[1]/n1-actual", 1); var total_fuel_lbs = props.globals.getNode("/consumables/fuel/total-fuel-lbs", 1); @@ -231,13 +231,6 @@ var fuel_right_outer_temp = props.globals.getNode("/consumables/fuel/tank[4]/tem var fuel_right_inner_temp = props.globals.getNode("/consumables/fuel/tank[3]/temperature_degC", 1); var cutoff_switch1 = props.globals.getNode("/controls/engines/engine[0]/cutoff-switch", 1); var cutoff_switch2 = props.globals.getNode("/controls/engines/engine[1]/cutoff-switch", 1); -var fuel_xfeed = props.globals.getNode("/controls/fuel/x-feed", 1); -var tank0pump1 = props.globals.getNode("/controls/fuel/tank0pump1", 1); -var tank0pump2 = props.globals.getNode("/controls/fuel/tank0pump2", 1); -var tank1pump1 = props.globals.getNode("/controls/fuel/tank1pump1", 1); -var tank1pump2 = props.globals.getNode("/controls/fuel/tank1pump2", 1); -var tank2pump1 = props.globals.getNode("/controls/fuel/tank2pump1", 1); -var tank2pump2 = props.globals.getNode("/controls/fuel/tank2pump2", 1); var autobreak_mode = props.globals.getNode("/controls/autobrake/mode", 1); var gear1_pos = props.globals.getNode("/gear/gear[0]/position-norm", 1); var gear2_pos = props.globals.getNode("/gear/gear[1]/position-norm", 1); @@ -2505,7 +2498,7 @@ var canvas_lowerECAM_fuel = { # TODO use the valve prop # TODO add amber when disagree between switch and btn # TODO add transition state - if (systems.FUEL.Valves.crossfeed.getValue() == 1) { + if (systems.FUEL.Valves.crossfeed.getBoolValue()) { me["FUEL-XFEED"].setRotation(0); me["FUEL-XFEED-pipes"].show(); } else { @@ -2514,7 +2507,7 @@ var canvas_lowerECAM_fuel = { } # TODO add LO indication - if (systems.FUEL.Switches.pumpLeft1.getValue() == 1) { + if (systems.FUEL.Switches.pumpLeft1.getBoolValue()) { me["FUEL-Pump-Left-1-Open"].show(); me["FUEL-Pump-Left-1-Closed"].hide(); me["FUEL-Pump-Left-1"].setColor(0.0509,0.7529,0.2941); @@ -2527,7 +2520,7 @@ var canvas_lowerECAM_fuel = { } # TODO add LO indication - if (systems.FUEL.Switches.pumpLeft2.getValue() == 1) { + if (systems.FUEL.Switches.pumpLeft2.getBoolValue()) { me["FUEL-Pump-Left-2-Open"].show(); me["FUEL-Pump-Left-2-Closed"].hide(); me["FUEL-Pump-Left-2"].setColor(0.0509,0.7529,0.2941); @@ -2540,7 +2533,7 @@ var canvas_lowerECAM_fuel = { } # TODO add functionality to match FCOM 1.28.20 "Amber: Transfer valve is open, whereas commanded closed in automatic or manual mode" - if (systems.FUEL.Switches.pumpCenter1.getValue() == 1) { + if (systems.FUEL.Switches.pumpCenter1.getBoolValue()) { me["FUEL-Pump-Center-1-Open"].show(); me["FUEL-Pump-Center-1-Closed"].hide(); me["FUEL-Pump-Center-1"].setColor(0.0509,0.7529,0.2941); @@ -2553,7 +2546,7 @@ var canvas_lowerECAM_fuel = { } # TODO add LO indication - if (systems.FUEL.Switches.pumpCenter2.getValue() == 1) { + if (systems.FUEL.Switches.pumpCenter2.getBoolValue()) { me["FUEL-Pump-Center-2-Open"].show(); me["FUEL-Pump-Center-2-Closed"].hide(); me["FUEL-Pump-Center-2"].setColor(0.0509,0.7529,0.2941); @@ -2566,7 +2559,7 @@ var canvas_lowerECAM_fuel = { } # TODO add LO indication - if (systems.FUEL.Switches.pumpRight1.getValue() == 1) { + if (systems.FUEL.Switches.pumpRight1.getBoolValue()) { me["FUEL-Pump-Right-1-Open"].show(); me["FUEL-Pump-Right-1-Closed"].hide(); me["FUEL-Pump-Right-1"].setColor(0.0509,0.7529,0.2941); @@ -2579,7 +2572,7 @@ var canvas_lowerECAM_fuel = { } # TODO add LO indication - if (systems.FUEL.Switches.pumpRight2.getValue() == 1) { + if (systems.FUEL.Switches.pumpRight2.getBoolValue()) { me["FUEL-Pump-Right-2-Open"].show(); me["FUEL-Pump-Right-2-Closed"].hide(); me["FUEL-Pump-Right-2"].setColor(0.0509,0.7529,0.2941); diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index dcc26fa5..1aa51d61 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -1242,7 +1242,11 @@ - systems/failures/elac1-fault + systems/fctl/lights/elac1-fault + 1 + + + controls/fctl/switches/elac1 1 @@ -1305,7 +1309,7 @@ - systems/failures/sec1 + systems/fctl/lights/sec1-fault 1 @@ -1372,7 +1376,7 @@ - systems/failures/fac1-fault + systems/fctl/lights/fac1-fault 1 @@ -1439,7 +1443,7 @@ - systems/failures/elac2-fault + systems/fctl/lights/elac2-fault 1 @@ -1472,7 +1476,7 @@ - + pick SEC2Btn1 @@ -1506,7 +1510,7 @@ - systems/failures/sec2 + systems/fctl/lights/sec2-fault 1 @@ -1573,7 +1577,7 @@ - systems/failures/sec3 + systems/fctl/lights/sec3-fault 1 @@ -1640,7 +1644,7 @@ - systems/failures/fac2-fault + systems/fctl/lights/fac2-fault 1 @@ -2462,7 +2466,7 @@ - systems/fuel/tank0pump1-fault + systems/failures/fuel/left-tank-pump-1 1 @@ -2527,7 +2531,7 @@ - systems/fuel/tank0pump2-fault + systems/failures/fuel/left-tank-pump-2 1 @@ -2592,7 +2596,7 @@ - systems/fuel/tank1pump1-fault + systems/failures/fuel/center-tank-pump-1 1 @@ -2721,7 +2725,7 @@ - systems/fuel/tank1pump2-fault + systems/failures/fuel/center-tank-pump-2 1 @@ -2786,7 +2790,7 @@ - systems/fuel/tank2pump1-fault + systems/failures/fuel/right-tank-pump-1 1 @@ -2851,7 +2855,7 @@ - systems/fuel/tank2pump2-fault + systems/failures/fuel/right-tank-pump-2 1 @@ -4751,7 +4755,7 @@ - systems/failures/pack2 + systems/failures/pneumatics/pack-2-valve 1 diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 3604d36c..7e1bc2fb 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -78,7 +78,6 @@ var vs_needle = props.globals.getNode("/instrumentation/pfd/vs-needle", 1); var vs_digit = props.globals.getNode("/instrumentation/pfd/vs-digit-trans", 1); var ap_vs_pfd = props.globals.getNode("/it-autoflight/internal/vert-speed-fpm-pfd", 1); var athr_arm = props.globals.getNode("/modes/pfd/fma/athr-armed", 1); -var FMGC_max_spd = props.globals.getNode("/FMGC/internal/maxspeed", 1); var ind_spd_kt = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt", 1); var ind_spd_mach = props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach", 1); var at_mach_mode = props.globals.getNode("/it-autoflight/input/kts-mach", 1); @@ -1025,7 +1024,6 @@ var canvas_PFD_1 = { SPDftrgtdiff: 0, SPDflaptrgtdiff: 0, SPDcleantrgtdiff: 0, - FMGC_max: 0, new: func(canvas_group, file) { var m = {parents: [canvas_PFD_1, canvas_PFD_base]}; m.init(canvas_group, file); @@ -1186,7 +1184,7 @@ var canvas_PFD_1 = { me.ASI = ind_spd - 30; } - me.FMGC_max = FMGC_max_spd.getValue(); + me.FMGC_max = fmgc.FMGCInternal.maxspeed; if (me.FMGC_max <= 30) { me.ASImax = 0 - me.ASI; } else if (me.FMGC_max >= 420) { @@ -1198,7 +1196,7 @@ var canvas_PFD_1 = { me["ASI_scale"].setTranslation(0, me.ASI * 6.6); me["ASI_max"].setTranslation(0, me.ASImax * -6.6); - if (!getprop("/FMGC/status/to-state") and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { + if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min"); if (me.FMGC_vls <= 30) { me.VLSmin = 0 - me.ASI; @@ -1207,7 +1205,7 @@ var canvas_PFD_1 = { } else { me.VLSmin = me.FMGC_vls - 30 - me.ASI; } - me.FMGC_prot = getprop("/FMGC/internal/computed-speeds/alpha_prot"); + me.FMGC_prot = fmgc.FMGCInternal.alpha_prot; if (me.FMGC_prot <= 30) { me.ALPHAprot = 0 - me.ASI; } else if (me.FMGC_prot >= 420) { @@ -1215,7 +1213,7 @@ var canvas_PFD_1 = { } else { me.ALPHAprot = me.FMGC_prot - 30 - me.ASI; } - me.FMGC_max = getprop("/FMGC/internal/computed-speeds/alpha_max"); + me.FMGC_max = fmgc.FMGCInternal.alpha_max; if (me.FMGC_max <= 30) { me.ALPHAmax = 0 - me.ASI; } else if (me.FMGC_max >= 420) { @@ -1924,7 +1922,7 @@ var canvas_PFD_2 = { me.ASI = ind_spd - 30; } - me.FMGC_max = FMGC_max_spd.getValue(); + me.FMGC_max = fmgc.FMGCInternal.maxspeed; if (me.FMGC_max <= 30) { me.ASImax = 0 - me.ASI; } else if (me.FMGC_max >= 420) { @@ -1936,7 +1934,7 @@ var canvas_PFD_2 = { me["ASI_scale"].setTranslation(0, me.ASI * 6.6); me["ASI_max"].setTranslation(0, me.ASImax * -6.6); - if (!getprop("/FMGC/status/to-state") and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { + if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min"); if (me.FMGC_vls <= 30) { me.VLSmin = 0 - me.ASI; @@ -1945,7 +1943,7 @@ var canvas_PFD_2 = { } else { me.VLSmin = me.FMGC_vls - 30 - me.ASI; } - me.FMGC_prot = getprop("/FMGC/internal/computed-speeds/alpha_prot"); + me.FMGC_prot = fmgc.FMGCInternal.alpha_prot; if (me.FMGC_prot <= 30) { me.ALPHAprot = 0 - me.ASI; } else if (me.FMGC_prot >= 420) { @@ -1953,7 +1951,7 @@ var canvas_PFD_2 = { } else { me.ALPHAprot = me.FMGC_prot - 30 - me.ASI; } - me.FMGC_max = getprop("/FMGC/internal/computed-speeds/alpha_max"); + me.FMGC_max = fmgc.FMGCInternal.alpha_max; if (me.FMGC_max <= 30) { me.ALPHAmax = 0 - me.ASI; } else if (me.FMGC_max >= 420) { diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 75150a82..f183a636 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -2213,7 +2213,7 @@ var messages_right_memo = func { land_asap_r.active = 0; } - if (land_asap_r.active == 0 and getprop("gear/gear[1]/wow") == 0 and ((getprop("fdm/jsbsim/propulsion/tank[0]/contents-lbs") < 1650 and getprop("fdm/jsbsim/propulsion/tank[1]/contents-lbs") < 1650) or ((getprop("systems/electrical/bus/dc-2") < 25 and (getprop("systems/failures/elac1") == 1 or getprop("systems/failures/sec1") == 1)) or (getprop("systems/hydraulic/green-psi") < 1500 and (getprop("systems/failures/elac1") == 1 and getprop("systems/failures/sec1") == 1)) or (getprop("systems/hydraulic/yellow-psi") < 1500 and (getprop("systems/failures/elac1") == 1 and getprop("systems/failures/sec1") == 1)) or (getprop("systems/hydraulic/blue-psi") < 1500 and (getprop("systems/failures/elac2") == 1 and getprop("systems/failures/sec2") == 1))) or (phaseVarMemo3 >= 3 and phaseVarMemo3 <= 8 and (getprop("engines/engine[0]/state") != 3 or getprop("engines/engine[1]/state") != 3)))) { + if (land_asap_r.active == 0 and getprop("gear/gear[1]/wow") == 0 and ((getprop("fdm/jsbsim/propulsion/tank[0]/contents-lbs") < 1650 and getprop("fdm/jsbsim/propulsion/tank[1]/contents-lbs") < 1650) or ((getprop("systems/electrical/bus/dc-2") < 25 and (getprop("systems/failures/fctl/elac1") == 1 or getprop("systems/failures/fctl/sec1") == 1)) or (getprop("systems/hydraulic/green-psi") < 1500 and (getprop("systems/failures/fctl/elac1") == 1 and getprop("systems/failures/fctl/sec1") == 1)) or (getprop("systems/hydraulic/yellow-psi") < 1500 and (getprop("systems/failures/fctl/elac1") == 1 and getprop("systems/failures/fctl/sec1") == 1)) or (getprop("systems/hydraulic/blue-psi") < 1500 and (getprop("systems/failures/fctl/elac2") == 1 and getprop("systems/failures/fctl/sec2") == 1))) or (phaseVarMemo3 >= 3 and phaseVarMemo3 <= 8 and (getprop("engines/engine[0]/state") != 3 or getprop("engines/engine[1]/state") != 3)))) { land_asap_a.active = 1; } else { land_asap_a.active = 0; diff --git a/Nasal/FBW/it-fbw.nas b/Nasal/FBW/it-fbw.nas index 87eb1e6d..d27d13bd 100644 --- a/Nasal/FBW/it-fbw.nas +++ b/Nasal/FBW/it-fbw.nas @@ -3,90 +3,80 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -# If All ELACs Fail, Alternate Law - var mmoIAS = 0; +var cas = 0; -var elac1_sw = 0; -var elac2_sw = 0; -var sec1_sw = 0; -var sec2_sw = 0; -var sec3_sw = 0; -var fac1_sw = 0; -var fac2_sw = 0; - -var elac1_fail = 0; -var elac2_fail = 0; -var sec1_fail = 0; -var sec2_fail = 0; -var sec3_fail = 0; -var fac1_fail = 0; -var fac2_fail = 0; +var elac1 = 0; +var elac2 = 0; +var sec1 = 0; +var sec2 = 0; +var sec3 = 0; +var fac1 = 0; +var fac2 = 0; -var ac_ess = 0; -var dc_ess = 0; -var dc_ess_shed = 0; -var ac1 = 0; -var ac2 = 0; -var dc1 = 0; -var dc2 = 0; -var dcHot1 = 0; -var dcHot2 = 0; var blue = 0; var green = 0; var yellow = 0; var ail = 0; var roll = 0; var rollback = 0; -var battery1_sw = 0; -var battery2_sw = 0; - var law = 0; var FBW = { - degradeLaw: props.globals.getNode("it-fbw/degrade-law"), - activeLaw: props.globals.getNode("it-fbw/law"), - override: props.globals.getNode("it-fbw/override"), - rollBack: props.globals.getNode("it-fbw/roll-back"), - rollLim: props.globals.getNode("it-fbw/roll-lim"), + degradeLaw: props.globals.getNode("/it-fbw/degrade-law"), + activeLaw: props.globals.getNode("/it-fbw/law"), + override: props.globals.getNode("/it-fbw/override"), + rollBack: props.globals.getNode("/it-fbw/roll-back"), + rollLim: props.globals.getNode("/it-fbw/roll-lim"), Computers: { - elac1: props.globals.getNode("systems/fctl/elac1"), - elac2: props.globals.getNode("systems/fctl/elac2"), - sec1: props.globals.getNode("systems/fctl/sec1"), - sec2: props.globals.getNode("systems/fctl/sec2"), - sec3: props.globals.getNode("systems/fctl/sec3"), - fac1: props.globals.getNode("systems/fctl/fac1"), - fac2: props.globals.getNode("systems/fctl/fac2"), + elac1: props.globals.getNode("/systems/fctl/elac1"), + elac2: props.globals.getNode("/systems/fctl/elac2"), + sec1: props.globals.getNode("/systems/fctl/sec1"), + sec2: props.globals.getNode("/systems/fctl/sec2"), + sec3: props.globals.getNode("/systems/fctl/sec3"), + fac1: props.globals.getNode("/systems/fctl/fac1"), + fac2: props.globals.getNode("/systems/fctl/fac2"), }, Failures: { - elac1: props.globals.getNode("systems/failures/fctl/elac1"), - elac2: props.globals.getNode("systems/failures/fctl/elac2"), - sec1: props.globals.getNode("systems/failures/fctl/sec1"), - sec2: props.globals.getNode("systems/failures/fctl/sec2"), - sec3: props.globals.getNode("systems/failures/fctl/sec3"), - fac1: props.globals.getNode("systems/failures/fctl/fac1"), - fac2: props.globals.getNode("systems/failures/fctl/fac2"), + elac1: props.globals.getNode("/systems/failures/fctl/elac1"), + elac2: props.globals.getNode("/systems/failures/fctl/elac2"), + sec1: props.globals.getNode("/systems/failures/fctl/sec1"), + sec2: props.globals.getNode("/systems/failures/fctl/sec2"), + sec3: props.globals.getNode("/systems/failures/fctl/sec3"), + fac1: props.globals.getNode("/systems/failures/fctl/fac1"), + fac2: props.globals.getNode("/systems/failures/fctl/fac2"), + spoilerl1: props.globals.getNode("/systems/failures/spoilers/spoiler-l1"), + spoilerl2: props.globals.getNode("/systems/failures/spoilers/spoiler-l2"), + spoilerl3: props.globals.getNode("/systems/failures/spoilers/spoiler-l3"), + spoilerl4: props.globals.getNode("/systems/failures/spoilers/spoiler-l4"), + spoilerl5: props.globals.getNode("/systems/failures/spoilers/spoiler-l5"), + spoilerr1: props.globals.getNode("/systems/failures/spoilers/spoiler-r1"), + spoilerr2: props.globals.getNode("/systems/failures/spoilers/spoiler-r2"), + spoilerr3: props.globals.getNode("/systems/failures/spoilers/spoiler-r3"), + spoilerr4: props.globals.getNode("/systems/failures/spoilers/spoiler-r4"), + spoilerr5: props.globals.getNode("/systems/failures/spoilers/spoiler-r5"), }, Lights: { - elac1: props.globals.getNode("controls/fctl/lights/elac1-fault"), - elac2: props.globals.getNode("controls/fctl/lights/elac2-fault"), - sec1: props.globals.getNode("controls/fctl/lights/sec1-fault"), - sec2: props.globals.getNode("controls/fctl/lights/sec2-fault"), - sec2: props.globals.getNode("controls/fctl/lights/sec3-fault"), - fac1: props.globals.getNode("controls/fctl/lights/fac1-fault"), - fac2: props.globals.getNode("controls/fctl/lights/fac2-fault"), + elac1: props.globals.getNode("/systems/fctl/lights/elac1-fault"), + elac2: props.globals.getNode("/systems/fctl/lights/elac2-fault"), + sec1: props.globals.getNode("/systems/fctl/lights/sec1-fault"), + sec2: props.globals.getNode("/systems/fctl/lights/sec2-fault"), + sec2: props.globals.getNode("/systems/fctl/lights/sec3-fault"), + fac1: props.globals.getNode("/systems/fctl/lights/fac1-fault"), + fac2: props.globals.getNode("/systems/fctl/lights/fac2-fault"), }, Protections: { - overspeedRoll: props.globals.getNode("it-fbw/protections/overspeed-roll-back"), + overspeedRoll: props.globals.getNode("/it-fbw/protections/overspeed-roll-back"), + overspeed: props.globals.getNode("/it-fbw/protections/overspeed"), }, Switches: { - elac1Sw: props.globals.getNode("controls/fctl/switches/elac1"), - elac2Sw: props.globals.getNode("controls/fctl/switches/elac2"), - sec1Sw: props.globals.getNode("controls/fctl/switches/sec1"), - sec2Sw: props.globals.getNode("controls/fctl/switches/sec2"), - sec3Sw: props.globals.getNode("controls/fctl/switches/sec3"), - fac1Sw: props.globals.getNode("controls/fctl/switches/fac1"), - fac2Sw: props.globals.getNode("controls/fctl/switches/fac2"), + elac1Sw: props.globals.getNode("/controls/fctl/switches/elac1"), + elac2Sw: props.globals.getNode("/controls/fctl/switches/elac2"), + sec1Sw: props.globals.getNode("/controls/fctl/switches/sec1"), + sec2Sw: props.globals.getNode("/controls/fctl/switches/sec2"), + sec3Sw: props.globals.getNode("/controls/fctl/switches/sec3"), + fac1Sw: props.globals.getNode("/controls/fctl/switches/fac1"), + fac2Sw: props.globals.getNode("/controls/fctl/switches/fac2"), }, init: func() { if (updatet.isRunning) { @@ -135,137 +125,21 @@ var FBW = { }; var update_loop = func { - elac1_sw = FBW.Switches.elac1Sw.getValue(); - elac2_sw = FBW.Switches.elac2Sw.getValue(); - sec1_sw = FBW.Switches.sec1Sw.getValue(); - sec2_sw = FBW.Switches.sec2Sw.getValue(); - sec3_sw = FBW.Switches.sec3Sw.getValue(); - fac1_sw = FBW.Switches.fac1Sw.getValue(); - fac2_sw = FBW.Switches.fac2Sw.getValue(); - elac1_fail = FBW.Failures.elac1.getValue(); - elac2_fail = FBW.Failures.elac2.getValue(); - sec1_fail = FBW.Failures.sec1.getValue(); - sec2_fail = FBW.Failures.sec2.getValue(); - sec3_fail = FBW.Failures.sec3.getValue(); - fac1_fail = FBW.Failures.fac1.getValue(); - fac2_fail = FBW.Failures.fac2.getValue(); - - ac_ess = systems.ELEC.Bus.acEss.getValue(); - dc_ess = systems.ELEC.Bus.dcEss.getValue(); - dc_ess_shed = systems.ELEC.Bus.dcEssShed.getValue(); - ac1 = systems.ELEC.Bus.ac1.getValue(); - ac2 = systems.ELEC.Bus.ac2.getValue(); - dc1 = systems.ELEC.Bus.dc1.getValue(); - dc2 = systems.ELEC.Bus.dc2.getValue(); - dcHot1 = systems.ELEC.Bus.dcHot1.getValue(); - dcHot2 = systems.ELEC.Bus.dcHot2.getValue(); - battery1_sw = systems.ELEC.Switch.bat1.getValue(); - battery2_sw = systems.ELEC.Switch.bat2.getValue(); - - if (elac1_sw and !elac1_fail and (dc_ess >= 25 or dcHot1 >= 25)) { - FBW.Computers.elac1.setValue(1); - FBW.Lights.elac1.setValue(0); - } else if (elac1_sw and (elac1_fail or (dc_ess < 25 and dcHot1 < 25))) { - FBW.Computers.elac1.setValue(0); - FBW.Lights.elac1.setValue(1); - } - - if (elac2_sw and !elac2_fail and (dc2 >= 25 or dcHot2 >= 25)) { - FBW.Computers.elac2.setValue(1); - FBW.Lights.elac2.setValue(0); - } else if (elac1_sw and (elac2_fail or (dc2 < 25 and dcHot2 < 25))) { - FBW.Computers.elac2.setValue(0); - FBW.Lights.elac2.setValue(1); - } - - if (sec1_sw and !sec1_fail and dc_ess >= 25) { - setprop("systems/fctl/sec1", 1); - setprop("systems/failures/spoiler-l3", 0); - setprop("systems/failures/spoiler-r3", 0); - setprop("systems/failures/spoiler-l4", 0); - setprop("systems/failures/spoiler-r4", 0); - } else { - setprop("systems/fctl/sec1", 0); - setprop("systems/failures/spoiler-l3", 1); - setprop("systems/failures/spoiler-r3", 1); - setprop("systems/failures/spoiler-l4", 1); - setprop("systems/failures/spoiler-r4", 1); - } - - if (sec2_sw and !sec2_fail and dc2 >= 25) { - setprop("systems/fctl/sec2", 1); - setprop("systems/failures/spoiler-l5", 0); - setprop("systems/failures/spoiler-r5", 0); - } else { - setprop("systems/fctl/sec2", 0); - setprop("systems/failures/spoiler-l5", 1); - setprop("systems/failures/spoiler-r5", 1); - } - - if (sec3_sw and !sec3_fail and dc2 >= 25) { - setprop("systems/fctl/sec3", 1); - setprop("systems/failures/spoiler-l1", 0); - setprop("systems/failures/spoiler-r1", 0); - setprop("systems/failures/spoiler-l2", 0); - setprop("systems/failures/spoiler-r2", 0); - } else { - setprop("systems/fctl/sec3", 0); - setprop("systems/failures/spoiler-l1", 1); - setprop("systems/failures/spoiler-r1", 1); - setprop("systems/failures/spoiler-l2", 1); - setprop("systems/failures/spoiler-r2", 1); - } - - if (fac1_sw and !fac1_fail and (ac_ess >= 110 or dc_ess_shed >= 25)) { - setprop("systems/fctl/fac1", 1); - setprop("systems/failures/rudder", 0); - setprop("systems/failures/fac1-fault", 0); - } else if (fac1_sw and (battery1_sw or battery2_sw) and (fac1_fail or ac_ess < 110 or dc_ess_shed < 25)) { - setprop("systems/failures/fac1-fault", 1); - setprop("systems/fctl/fac1", 0); - if (!fac2_sw or fac2_fail) { - setprop("systems/failures/rudder", 1); - } - } else { - setprop("systems/failures/fac1-fault", 0); - setprop("systems/fctl/fac1", 0); - if (!fac2_sw or fac2_fail) { - setprop("systems/failures/rudder", 1); - } - } - - if (fac2_sw and !fac2_fail and (ac2 >= 110 or dc2 >= 25)) { - setprop("systems/fctl/fac2", 1); - setprop("systems/failures/fac2-fault", 0); - } else if (fac2_sw and (fac2_fail or ac2 < 110 or dc2 < 25)) { - setprop("systems/failures/fac2-fault", 1); - setprop("systems/fctl/fac2", 0); - if (!fac1_sw or fac1_fail) { - setprop("systems/failures/rudder", 1); - } - } else { - setprop("systems/fctl/fac2", 0); - setprop("systems/failures/fac2-fault", 0); - if (!fac1_sw or fac1_fail) { - setprop("systems/failures/rudder", 1); - } - } - - var elac1 = getprop("systems/fctl/elac1"); - var elac2 = getprop("systems/fctl/elac2"); - var sec1 = getprop("systems/fctl/sec1"); - var sec2 = getprop("systems/fctl/sec2"); - var sec3 = getprop("systems/fctl/sec3"); - var fac1 = getprop("systems/fctl/fac1"); - var fac2 = getprop("systems/fctl/fac2"); + elac1 = FBW.Computers.elac1.getBoolValue(); + elac2 = FBW.Computers.elac2.getBoolValue(); + sec1 = FBW.Computers.sec1.getBoolValue(); + sec2 = FBW.Computers.sec2.getBoolValue(); + sec3 = FBW.Computers.sec3.getBoolValue(); + fac1 = FBW.Computers.fac1.getBoolValue(); + fac2 = FBW.Computers.fac2.getBoolValue(); law = FBW.activeLaw.getValue(); # Degrade logic, all failures which degrade FBW need to go here. -JD blue = systems.HYD.Psi.blue.getValue(); green = systems.HYD.Psi.green.getValue(); yellow = systems.HYD.Psi.yellow.getValue(); - if (getprop("gear/gear[1]/wow") == 0 and getprop("gear/gear[2]/wow") == 0) { + if (!pts.Gear.wow[1].getBoolValue() and !pts.Gear.wow[2].getBoolValue()) { if (!elac1 and !elac2) { if (law == 0) { FBW.degradeLaw.setValue(1); @@ -273,7 +147,7 @@ var update_loop = func { fcu.athrOff("hard"); } } - if (getprop("systems/electrical/some-electric-thingie/emer-elec-config") == 1) { + if (systems.ELEC.EmerElec.getBoolValue()) { if (law == 0) { FBW.degradeLaw.setValue(1); fcu.apOff("hard", 0); @@ -287,14 +161,14 @@ var update_loop = func { fcu.athrOff("hard"); } } - if (dc_ess < 25 and dc2 < 25) { + if (systems.ELEC.Bus.dcEss.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25) { FBW.degradeLaw.setValue(3); fcu.apOff("hard", 0); fcu.athrOff("hard"); } } - if (getprop("controls/gear/gear-down") == 1 and getprop("it-autoflight/output/ap1") == 0 and getprop("it-autoflight/output/ap2") == 0) { + if (pts.Controls.Gear.gearDown.getBoolValue() and !fmgc.Input.ap1.getBoolValue() and !fmgc.Input.ap2.getBoolValue()) { if (law == 1) { FBW.degradeLaw.setValue(2); } @@ -308,23 +182,24 @@ var update_loop = func { FBW.degradeLaw.setValue(2); } - mmoIAS = (getprop("instrumentation/airspeed-indicator/indicated-speed-kt") / getprop("instrumentation/airspeed-indicator/indicated-mach")) * 0.82; + cas = pts.Instrumentation.AirspeedIndicator.indicatedSpdKt.getValue(); + mmoIAS = (cas / pts.Instrumentation.AirspeedIndicator.indicatedMach.getValue()) * 0.82; if (mmoIAS < 350) { - setprop("it-fbw/speeds/vmo-mmo", mmoIAS); + fmgc.FMGCInternal.vmo_mmo = mmoIAS; } else { - setprop("it-fbw/speeds/vmo-mmo", 350); + fmgc.FMGCInternal.vmo_mmo = 350; } - if (getprop("instrumentation/airspeed-indicator/indicated-speed-kt") > getprop("it-fbw/speeds/vmo-mmo") + 6 and (law == 0 or law == 1)) { - if (getprop("it-autoflight/input/ap1") == 1 or getprop("it-autoflight/input/ap2") == 1) { + if (cas > (fmgc.FMGCInternal.vmo_mmo + 6) and (law == 0 or law == 1)) { + if (fmgc.Input.ap1.getBoolValue() or fmgc.Input.ap2.getBoolValue()) { fcu.apOff("hard", 0); } - if (getprop("it-fbw/protections/overspeed") != 1) { - setprop("it-fbw/protections/overspeed", 1); + if (!FBW.Protections.overspeed.getBoolValue()) { + FBW.Protections.overspeed.setBoolValue(1); } } else { - if (getprop("it-fbw/protections/overspeed") != 0) { - setprop("it-fbw/protections/overspeed", 0); + if (FBW.Protections.overspeed.getBoolValue()) { + FBW.Protections.overspeed.setBoolValue(0); } } } @@ -361,7 +236,7 @@ var fbw_loop = func { FBW.Protections.overspeedRoll.setValue(1); } - if (getprop("it-fbw/override") == 0) { + if (!FBW.override.getBoolValue()) { var active = FBW.activeLaw.getValue(); var degrade = FBW.degradeLaw.getValue(); if (degrade == 0) { @@ -384,12 +259,50 @@ var fbw_loop = func { } if (FBW.activeLaw.getValue() != 0) { - if (getprop("it-autoflight/output/ap1") == 1 or getprop("it-autoflight/output/ap2") == 1) { + if (fmgc.Input.ap1.getBoolValue() or fmgc.Input.ap2.getBoolValue()) { fcu.apOff("hard", 0); fcu.athrOff("hard"); } } } +setlistener("systems/fctl/sec1", func() { + if (FBW.Computers.sec1.getBoolValue()) { + FBW.Failures.spoilerl3.setBoolValue(0); + FBW.Failures.spoilerr3.setBoolValue(0); + FBW.Failures.spoilerl4.setBoolValue(0); + FBW.Failures.spoilerr4.setBoolValue(0); + } else { + FBW.Failures.spoilerl3.setBoolValue(1); + FBW.Failures.spoilerr3.setBoolValue(1); + FBW.Failures.spoilerl4.setBoolValue(1); + FBW.Failures.spoilerr4.setBoolValue(1); + } +}, 0, 0); + +setlistener("systems/fctl/sec2", func() { + if (FBW.Computers.sec2.getBoolValue()) { + FBW.Failures.spoilerl5.setBoolValue(0); + FBW.Failures.spoilerr5.setBoolValue(0); + } else { + FBW.Failures.spoilerl5.setBoolValue(1); + FBW.Failures.spoilerr5.setBoolValue(1); + } +}, 0, 0); + +setlistener("systems/fctl/sec3", func() { + if (FBW.Computers.sec3.getBoolValue()) { + FBW.Failures.spoilerl1.setBoolValue(0); + FBW.Failures.spoilerr1.setBoolValue(0); + FBW.Failures.spoilerl2.setBoolValue(0); + FBW.Failures.spoilerr2.setBoolValue(0); + } else { + FBW.Failures.spoilerl1.setBoolValue(1); + FBW.Failures.spoilerr1.setBoolValue(1); + FBW.Failures.spoilerl2.setBoolValue(1); + FBW.Failures.spoilerr2.setBoolValue(1); + } +}, 0, 0); + var updatet = maketimer(0.1, update_loop); var fbwt = maketimer(0.03, fbw_loop); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 66053ab2..c68809e0 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -71,8 +71,6 @@ var mng_spd_cmd = 0; var kts_sel = 0; var mach_sel = 0; var srsSPD = 0; -var maxspeed = 0; -var minspeed = 0; var mach_switchover = 0; var decel = 0; var mng_alt_spd_cmd = 0; @@ -93,8 +91,6 @@ var thr1 = 0; var thr2 = 0; var altsel = 0; var crzFl = 0; -setprop("/FMGC/internal/maxspeed", 0); -setprop("/FMGC/internal/minspeed", 0); setprop("position/gear-agl-ft", 0); setprop("/FMGC/internal/mng-spd", 157); setprop("/FMGC/internal/mng-spd-cmd", 157); @@ -113,9 +109,10 @@ setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX"); var FMGCinit = func { - setprop("/FMGC/status/to-state", 0); + fmgc.FMGCInternal.takeoffState = 0; + fmgc.FMGCInternal.minspeed = 0; + fmgc.FMGCInternal.maxspeed = 338; fmgc.FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done - setprop("/FMGC/internal/maxspeed", 338); setprop("/FMGC/internal/mng-spd", 157); setprop("/FMGC/internal/mng-spd-cmd", 157); setprop("/FMGC/internal/mng-kts-mach", 0); @@ -137,6 +134,14 @@ var FMGCinit = func { var FMGCInternal = { # phase logic phase: 0, + minspeed: 0, + maxspeed: 0, + takeoffState: 0, + + # speeds + alpha_prot: 0, + alpha_max: 0, + vmo_mmo: 0, # PERF v1: 0, @@ -182,6 +187,7 @@ var FMGCNodes = { toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"), v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"), + toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"), }; ############ @@ -194,7 +200,7 @@ setlistener("/gear/gear[0]/wow", func { var trimReset = func { flaps = getprop("/controls/flight/flaps-pos"); - if (pts.Gear.wow[0].getBoolValue() and getprop("/FMGC/status/to-state") == 0 and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { + if (pts.Gear.wow[0].getBoolValue() and !fmgc.FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { interpolate("/controls/flight/elevator-trim", 0.0, 1.5); } } @@ -503,11 +509,11 @@ var masterFMGC = maketimer(0.2, func { } if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) { - setprop("/FMGC/internal/maxspeed", getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4); + fmgc.FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4; } elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) { - setprop("/FMGC/internal/maxspeed", 284); + fmgc.FMGCInternal.maxspeed = 284; } else { - setprop("/FMGC/internal/maxspeed", getprop("/it-fbw/speeds/vmo-mmo")); + fmgc.FMGCInternal.maxspeed = getprop("/it-fbw/speeds/vmo-mmo"); } ############################ @@ -632,76 +638,83 @@ var masterFMGC = maketimer(0.2, func { aoa = getprop("/systems/navigation/adr/output/aoa-1"); cas = getprop("/systems/navigation/adr/output/cas-1"); if (aoa > -5) { - alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); - alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); + fmgc.FMGCInternal.alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); + fmgc.FMGCInternal.alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); } else { - alpha_prot = 0; - alpha_max = 0; + fmgc.FMGCInternal.alpha_prot = 0; + fmgc.FMGCInternal.alpha_max = 0; } - setprop("/FMGC/internal/computed-speeds/alpha_prot", alpha_prot); - setprop("/FMGC/internal/computed-speeds/alpha_max", alpha_max); setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); - if (getprop("/FMGC/status/to-state") == 1) { - if (flap == 0) { # 0 + if (flap == 0) { # 0 + setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); + fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/clean"); + + if (fmgc.FMGCInternal.takeoffState) { setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.28); - } else if (flap == 1) { # 1 - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.23); - } else { # 1+F - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); - } - } else { - if (flap == 0) { # 0 + } else { setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.23); - } else if (flap == 1) { # 1 - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.23); - } else if (flap == 2) { # 1+F + } + } else if (flap == 1) { # 1 + setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); + fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/slat"); + + if (fmgc.FMGCInternal.takeoffState) { + setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.28); + } else { + setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.23); + } + } else if (flap == 2) { # 1+F + setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f")); + fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/slat"); + + if (fmgc.FMGCInternal.takeoffState) { + setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + } else { setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f")) * 1.23); - } else if (flap == 3) { # 2 + } + } else if (flap == 3) { # 2 + setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); + fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/flap2"); + + if (fmgc.FMGCInternal.takeoffState) { + setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + } else { setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")) * 1.23); - } else if (flap == 4) { # 3 + } + } else if (flap == 4) { # 3 + setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); + fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/flap3"); + + if (fmgc.FMGCInternal.takeoffState) { + setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + } else { setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.23); - } else if (flap == 5) { # FULL + } + } else if (flap == 5) { # FULL + setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); + fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/vapp"); + + if (fmgc.FMGCInternal.takeoffState) { + setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + } else { setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")) * 1.23); } } - if (flap == 0) { # 0 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); - } else if (flap == 1) { # 1 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - } else if (flap == 2) { # 1+F - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f")); - } else if (flap == 3) { # 2 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - } else if (flap == 4) { # 3 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); - } else if (flap == 5) { # FULL - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); - } - - if (flap == 0) { # 0 - setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/clean")); - } else if (flap == 1) { # 1 - setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/slat")); - } else if (flap == 2) { # 1+F - setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/slat")); - } else if (flap == 3) { # 2 - setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/flap2")); - } else if (flap == 4) { # 3 - setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/flap3")); - } else if (flap == 5) { # FULL - setprop("/FMGC/internal/minspeed", getprop("/FMGC/internal/computed-speeds/vapp")); - } - - if (gear0 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) { - setprop("/FMGC/status/to-state", 1); - } - if (pts.Position.gearAglFt.getValue() >= 55) { - setprop("/FMGC/status/to-state", 0); + if (gear0 and flaps < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) { + if (!fmgc.FMGCInternal.takeoffState) { + fmgc.FMGCNodes.toState.setValue(1); + } + fmgc.FMGCInternal.takeoffState = 1; + } elsif (pts.Position.gearAglFt.getValue() >= 55) { + if (fmgc.FMGCInternal.takeoffState) { + fmgc.FMGCNodes.toState.setValue(0); + } + fmgc.FMGCInternal.takeoffState = 0; } ############################ @@ -904,8 +917,6 @@ var ManagedSPD = maketimer(0.25, func { srsSPD = getprop("/it-autoflight/settings/togaspd"); phase = fmgc.FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done flap = getprop("/controls/flight/flaps-pos"); - maxspeed = getprop("/FMGC/internal/maxspeed"); - minspeed = getprop("/FMGC/internal/minspeed"); mach_switchover = getprop("/FMGC/internal/mach-switchover"); decel = getprop("/FMGC/internal/decel"); @@ -936,8 +947,8 @@ var ManagedSPD = maketimer(0.25, func { } if (mng_spd_cmd != 250 and !decel) { setprop("/FMGC/internal/mng-spd-cmd", 250); - } else if (mng_spd_cmd != minspeed and decel) { - setprop("/FMGC/internal/mng-spd-cmd", minspeed); + } else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) { + setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed); } } else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !mach_switchover) { if (mngktsmach) { @@ -973,8 +984,8 @@ var ManagedSPD = maketimer(0.25, func { } if (mng_spd_cmd != mng_alt_spd and !decel) { setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd); - } else if (mng_spd_cmd != minspeed and decel) { - setprop("/FMGC/internal/mng-spd-cmd", minspeed); + } else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) { + setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed); } } else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) { if (mngktsmach) { @@ -982,15 +993,15 @@ var ManagedSPD = maketimer(0.25, func { } if (mng_spd_cmd != 250 and !decel) { setprop("/FMGC/internal/mng-spd-cmd", 250); - } else if (mng_spd_cmd != minspeed and decel) { - setprop("/FMGC/internal/mng-spd-cmd", minspeed); + } else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) { + setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed); } } mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd"); - if (mng_spd_cmd > maxspeed -5) { - setprop("/FMGC/internal/mng-spd", maxspeed -5); + if (mng_spd_cmd > fmgc.FMGCInternal.maxspeed - 5) { + setprop("/FMGC/internal/mng-spd", fmgc.FMGCInternal.maxspeed - 5); } else { setprop("/FMGC/internal/mng-spd", mng_spd_cmd); } diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 8ef19c72..19499df5 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -87,6 +87,7 @@ var Gear = { var Instrumentation = { AirspeedIndicator: { indicatedSpdKt: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-speed-kt"), + indicatedMach: props.globals.getNode("/instrumentation/airspeed-indicator/indicated-mach"), }, Altimeter: { indicatedFt: props.globals.getNode("/instrumentation/altimeter[0]/indicated-altitude-ft"), diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index d76cac1c..fae87556 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -15,6 +15,7 @@ var dc2 = 0; var ELEC = { _timer1On: 0, _timer2On: 0, + EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"), Bus: { acEss: props.globals.getNode("systems/electrical/bus/ac-ess"), acEssShed: props.globals.getNode("systems/electrical/bus/ac-ess-shed"), diff --git a/Nasal/Systems/fuel.nas b/Nasal/Systems/fuel.nas index 94791c0a..31994421 100644 --- a/Nasal/Systems/fuel.nas +++ b/Nasal/Systems/fuel.nas @@ -94,168 +94,6 @@ setlistener("/engines/engine[1]/state", func() { } }, 0, 0); -var FUELx = { - init: func() { - setprop("systems/fuel/gravityfeedL", 0); - setprop("systems/fuel/gravityfeedR", 0); - setprop("systems/fuel/gravityfeedL-output", 0); - setprop("systems/fuel/gravityfeedR-output", 0); - setprop("controls/fuel/x-feed", 0); - setprop("controls/fuel/tank0pump1", 0); - setprop("controls/fuel/tank0pump2", 0); - setprop("controls/fuel/tank1pump1", 0); - setprop("controls/fuel/tank1pump2", 0); - setprop("controls/fuel/tank2pump1", 0); - setprop("controls/fuel/tank2pump2", 0); - setprop("controls/fuel/mode", 1); - setprop("systems/fuel/valves/crossfeed-valve", 0); - setprop("systems/fuel/tank[0]/feed", 0); - setprop("systems/fuel/tank[1]/feed", 0); - setprop("systems/fuel/tank[2]/feed", 0); - setprop("systems/fuel/only-use-ctr-tank", 0); - setprop("systems/fuel/tank0pump1-fault", 0); - setprop("systems/fuel/tank0pump2-fault", 0); - setprop("systems/fuel/tank1pump1-fault", 0); - setprop("systems/fuel/tank1pump2-fault", 0); - setprop("systems/fuel/tank2pump1-fault", 0); - setprop("systems/fuel/tank2pump2-fault", 0); - setprop("systems/fuel/mode-fault", 0); - }, - loop: func() { - xfeed_sw = getprop("controls/fuel/x-feed"); - tank0pump1_sw = getprop("controls/fuel/tank0pump1"); - tank0pump2_sw = getprop("controls/fuel/tank0pump2"); - tank1pump1_sw = getprop("controls/fuel/tank1pump1"); - tank1pump2_sw = getprop("controls/fuel/tank1pump2"); - tank2pump1_sw = getprop("controls/fuel/tank2pump1"); - tank2pump2_sw = getprop("controls/fuel/tank2pump2"); - mode_sw = getprop("controls/fuel/mode"); - xfeed = getprop("systems/fuel/valves/crossfeed-valve"); - ac1 = getprop("systems/electrical/bus/ac-1"); - ac2 = getprop("systems/electrical/bus/ac-2"); - gravityfeedL = getprop("systems/fuel/gravityfeedL"); - gravityfeedR = getprop("systems/fuel/gravityfeedR"); - gload = getprop("accelerations/pilot-gdamped"); - tank0pump1_fail = getprop("systems/failures/tank0pump1"); - tank0pump2_fail = getprop("systems/failures/tank0pump2"); - tank1pump1_fail = getprop("systems/failures/tank1pump1"); - tank1pump2_fail = getprop("systems/failures/tank1pump2"); - tank2pump1_fail = getprop("systems/failures/tank2pump1"); - tank2pump2_fail = getprop("systems/failures/tank2pump2"); - - if (gload >= 0.7 and gravityfeedL) { - setprop("systems/fuel/gravityfeedL-output", 1); - } else { - setprop("systems/fuel/gravityfeedL-output", 0); - } - - if (gload >= 0.7 and gravityfeedR) { - setprop("systems/fuel/gravityfeedR-output", 1); - } else { - setprop("systems/fuel/gravityfeedR-output", 0); - } - - gravityfeedL_output = getprop("systems/fuel/gravityfeedL-output"); - gravityfeedR_output = getprop("systems/fuel/gravityfeedR-output"); - - if ((ac1 >= 110 or ac2 >= 110) and tank0pump1_sw and !tank0pump1_fail) { - setprop("systems/fuel/tank[0]/feed", 1); - } else if ((ac1 >= 110 or ac2 >= 110) and tank0pump2_sw and !tank0pump2_fail) { - setprop("systems/fuel/tank[0]/feed", 1); - } else if (gravityfeedL_output) { - setprop("systems/fuel/tank[0]/feed", 1); - } else { - setprop("systems/fuel/tank[0]/feed", 0); - } - - if ((ac1 >= 110 or ac2 >= 110) and tank1pump1_sw and !tank1pump1_fail) { - setprop("systems/fuel/tank[1]/feed", 1); - } else if ((ac1 >= 110 or ac2 >= 110) and tank1pump2_sw and !tank1pump2_fail) { - setprop("systems/fuel/tank[1]/feed", 1); - } else { - setprop("systems/fuel/tank[1]/feed", 0); - } - - if ((ac1 >= 110 or ac2 >= 110) and tank2pump1_sw and !tank2pump1_fail) { - setprop("systems/fuel/tank[2]/feed", 1); - } else if ((ac1 >= 110 or ac2 >= 110) and tank2pump2_sw and !tank2pump2_fail) { - setprop("systems/fuel/tank[2]/feed", 1); - } else if (gravityfeedR_output) { - setprop("systems/fuel/tank[2]/feed", 1); - } else { - setprop("systems/fuel/tank[2]/feed", 0); - } - - if ((ac1 >= 110 or ac2 >= 110) and xfeed_sw) { - setprop("systems/fuel/valves/crossfeed-valve", 1); - } else { - setprop("systems/fuel/valves/crossfeed-valve", 0); - } - - tank0 = getprop("systems/fuel/tank[0]/feed"); - tank1 = getprop("systems/fuel/tank[1]/feed"); - tank2 = getprop("systems/fuel/tank[2]/feed"); - - if ((ac1 >= 110 or ac2 >= 110) and (tank0pump1_sw or tank0pump2_sw)) { - setprop("systems/fuel/gravityfeedL", 0); - } else { - setprop("systems/fuel/gravityfeedL", 1); - } - - if ((ac1 >= 110 or ac2 >= 110) and (tank2pump1_sw or tank2pump2_sw)) { - setprop("systems/fuel/gravityfeedR", 0); - } else { - setprop("systems/fuel/gravityfeedR", 1); - } - - gravityfeedL = getprop("systems/fuel/gravityfeedL"); - gravityfeedR = getprop("systems/fuel/gravityfeedR"); - - if ((getprop("fdm/jsbsim/propulsion/tank[1]/contents-lbs") >= 50) and (tank1pump1_sw or tank1pump2_sw) and !gravityfeedL and !gravityfeedR) { - setprop("systems/fuel/only-use-ctr-tank", 1); - } else { - setprop("systems/fuel/only-use-ctr-tank", 0); - } - - # Fault lights - if (tank0pump1_sw and tank0pump1_fail) { - setprop("systems/fuel/tank0pump1-fault", 1); - } else { - setprop("systems/fuel/tank0pump1-fault", 0); - } - - if (tank0pump2_sw and tank0pump2_fail) { - setprop("systems/fuel/tank0pump2-fault", 1); - } else { - setprop("systems/fuel/tank0pump2-fault", 0); - } - - if (tank1pump1_sw and tank1pump1_fail) { - setprop("systems/fuel/tank1pump1-fault", 1); - } else { - setprop("systems/fuel/tank1pump1-fault", 0); - } - - if (tank1pump2_sw and tank1pump2_fail) { - setprop("systems/fuel/tank1pump2-fault", 1); - } else { - setprop("systems/fuel/tank1pump2-fault", 0); - } - - if (tank2pump1_sw and tank2pump1_fail) { - setprop("systems/fuel/tank2pump1-fault", 1); - } else { - setprop("systems/fuel/tank2pump1-fault", 0); - } - - if (tank2pump2_sw and tank2pump2_fail) { - setprop("systems/fuel/tank2pump2-fault", 1); - } else { - setprop("systems/fuel/tank2pump2-fault", 0); - } - }, -}; - var ctrTkTimer = maketimer(0.5, func() { if (pts.Sim.Time.elapsedSec.getValue() > (FUEL.timeEngStart + 120)) { FUEL.cmdCtrOn.setValue(0); diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 0efc9c0b..0b11b31e 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -165,7 +165,7 @@ 1 - /FMGC/status/to-state + /FMGC/internal/to-state 1 diff --git a/Systems/a320-fbw.xml b/Systems/a320-fbw.xml index 7dd5c0ba..a61b34d3 100644 --- a/Systems/a320-fbw.xml +++ b/Systems/a320-fbw.xml @@ -248,6 +248,148 @@ + + + + + + /controls/fctl/switches/elac1 eq 1 + /systems/fctl/elac1 eq 0 + + + + + + + /controls/fctl/switches/elac1 eq 1 + /systems/failures/fctl/elac1 eq 0 + + /systems/electrical/bus/dc-ess ge 25 + /systems/electrical/bus/dc-hot-1 ge 25 + + + + + + + + /controls/fctl/switches/elac2 eq 1 + /systems/fctl/elac2 eq 0 + + + + + + + /controls/fctl/switches/elac2 eq 1 + /systems/failures/fctl/elac2 eq 0 + + /systems/electrical/bus/dc-2 ge 25 + /systems/electrical/bus/dc-hot-2 ge 25 + + + + + + + + /controls/fctl/switches/sec1 eq 1 + /systems/fctl/sec1 eq 0 + + + + + + + /controls/fctl/switches/sec1 eq 1 + /systems/failures/fctl/sec1 eq 0 + + /systems/electrical/bus/dc-ess ge 25 + /systems/electrical/bus/dc-hot-1 ge 25 + + + + + + + + /controls/fctl/switches/sec2 eq 1 + /systems/fctl/sec2 eq 0 + + + + + + + /controls/fctl/switches/sec2 eq 1 + /systems/failures/fctl/sec2 eq 0 + /systems/electrical/bus/dc-2 ge 25 + + + + + + + /controls/fctl/switches/sec3 eq 1 + /systems/fctl/sec3 eq 0 + + + + + + + /controls/fctl/switches/sec3 eq 1 + /systems/failures/fctl/sec3 eq 0 + /systems/electrical/bus/dc-2 ge 25 + + + + + + + /controls/fctl/switches/fac1 eq 1 + /systems/fctl/fac1 eq 0 + + + + + + + /controls/fctl/switches/fac1 eq 1 + /systems/failures/fctl/fac1 eq 0 + /systems/electrical/bus/ac-ess ge 110 + /systems/electrical/bus/dc-ess-shed ge 25 + + + + + + + /controls/fctl/switches/fac2 eq 1 + /systems/fctl/fac2 eq 0 + + + + + + + /controls/fctl/switches/fac2 eq 1 + /systems/failures/fctl/fac2 eq 0 + /systems/electrical/bus/ac-2 ge 110 + /systems/electrical/bus/dc-2 ge 25 + + + + + + + /systems/fctl/fac1 eq 0 + /systems/fctl/fac2 eq 0 + + + + + @@ -737,7 +879,7 @@ /controls/flight/flaps-pos ge 4 /controls/engines/engine[0]/throttle lt 0.65 /controls/engines/engine[1]/throttle lt 0.65 - /FMGC/status/to-state eq 0 + /FMGC/internal/to-state eq 0 /it-fbw/law eq 0 position/wow eq 0 @@ -747,7 +889,7 @@ /controls/flight/flaps-pos ge 4 /controls/engines/engine[0]/throttle lt 0.65 /controls/engines/engine[1]/throttle lt 0.65 - /FMGC/status/to-state eq 0 + /FMGC/internal/to-state eq 0 /it-fbw/law eq 0 gear/unit[0]/WOW eq 0 fbw/pitch/flare-gear-switch eq 1 diff --git a/Systems/a320-fuel.xml b/Systems/a320-fuel.xml index 24dd3a95..2653b3e7 100644 --- a/Systems/a320-fuel.xml +++ b/Systems/a320-fuel.xml @@ -791,5 +791,30 @@ propulsion/tank[7]/external-flow-rate-pps + + + + + /consumables/fuel/tank[0]/level-kg + /consumables/fuel/tank[1]/level-kg + + + + /consumables/fuel/tank[3]/level-kg + /consumables/fuel/tank[4]/level-kg + + + + + + + /systems/fuel/quantity/left-wing-kg lt 5000 + /systems/fuel/quantity/right-wing-kg lt 5000 + + /consumables/fuel/tank[2]/level-kg ge 250 + + + + diff --git a/Systems/a320-spoiler.xml b/Systems/a320-spoiler.xml index 1f0db870..889dab98 100644 --- a/Systems/a320-spoiler.xml +++ b/Systems/a320-spoiler.xml @@ -112,7 +112,7 @@ /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 - /systems/failures/spoiler-l1 eq 0 + /systems/failures/spoilers/spoiler-l1 eq 0 0.0 @@ -199,18 +199,18 @@ /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 0 - /systems/failures/spoiler-l2 eq 0 + /systems/failures/spoilers/spoiler-l2 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 1 - /systems/failures/spoiler-l2 eq 0 + /systems/failures/spoilers/spoiler-l2 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-l2 eq 0 + /systems/failures/spoilers/spoiler-l2 eq 0 spoilers/main-cmd eq 0 @@ -266,12 +266,12 @@ /systems/hydraulic/blue-psi ge 1500 - /systems/failures/spoiler-l3 eq 0 + /systems/failures/spoilers/spoiler-l3 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/blue-psi ge 1500 - /systems/failures/spoiler-l3 eq 0 + /systems/failures/spoilers/spoiler-l3 eq 0 spoilers/main-cmd eq 0 @@ -327,12 +327,12 @@ /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-l4 eq 0 + /systems/failures/spoilers/spoiler-l4 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-l4 eq 0 + /systems/failures/spoilers/spoiler-l4 eq 0 spoilers/main-cmd eq 0 @@ -389,12 +389,12 @@ /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 - /systems/failures/spoiler-l5 eq 0 + /systems/failures/spoilers/spoiler-l5 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/green-psi ge 1500 - /systems/failures/spoiler-l5 eq 0 + /systems/failures/spoilers/spoiler-l5 eq 0 spoilers/main-cmd eq 0 @@ -424,7 +424,7 @@ /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 - /systems/failures/spoiler-r1 eq 0 + /systems/failures/spoilers/spoiler-r1 eq 0 0.0 @@ -511,18 +511,18 @@ /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 0 - /systems/failures/spoiler-r2 eq 0 + /systems/failures/spoilers/spoiler-r2 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/yellow-psi ge 1500 spoilers/main-gear-and eq 1 - /systems/failures/spoiler-r2 eq 0 + /systems/failures/spoilers/spoiler-r2 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-r2 eq 0 + /systems/failures/spoilers/spoiler-r2 eq 0 spoilers/main-cmd eq 0 @@ -578,12 +578,12 @@ /systems/hydraulic/blue-psi ge 1500 - /systems/failures/spoiler-r3 eq 0 + /systems/failures/spoilers/spoiler-r3 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/blue-psi ge 1500 - /systems/failures/spoiler-r3 eq 0 + /systems/failures/spoilers/spoiler-r3 eq 0 spoilers/main-cmd eq 0 @@ -639,12 +639,12 @@ /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-r4 eq 0 + /systems/failures/spoilers/spoiler-r4 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/yellow-psi ge 1500 - /systems/failures/spoiler-r4 eq 0 + /systems/failures/spoilers/spoiler-r4 eq 0 spoilers/main-cmd eq 0 @@ -701,12 +701,12 @@ /systems/hydraulic/green-psi ge 1500 spoilers/main-gear-and eq 1 - /systems/failures/spoiler-r5 eq 0 + /systems/failures/spoilers/spoiler-r5 eq 0 spoilers/main-cmd gt 0 /systems/hydraulic/green-psi ge 1500 - /systems/failures/spoiler-r5 eq 0 + /systems/failures/spoilers/spoiler-r5 eq 0 spoilers/main-cmd eq 0