From 928144a072068e33235fff1773abc6eb5d5aa3a9 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 1 Jan 2020 21:30:13 +0000 Subject: [PATCH 1/4] Bugfix FCU, RAT MAN light, and ECAM autopilot message --- Models/FlightDeck/a320.flightdeck.xml | 21 ++++++++++++++------- Models/Instruments/OHpanel/OHpanel.xml | 11 +---------- Nasal/ECAM/ECAM-controller.nas | 14 ++++++++------ Nasal/ECAM/ECAM-logic.nas | 25 +++++++++++++------------ Nasal/ECAM/ECAM-messages.nas | 16 +++++++++------- Nasal/FMGC/FCU.nas | 5 ++++- Systems/a320-electrical.xml | 2 +- 7 files changed, 50 insertions(+), 44 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 2056f527..442c7f43 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -462,7 +462,6 @@ select - alt-text-test atc-test audio_att_sgn audio_call_hf2_led @@ -478,19 +477,27 @@ engine_fault_1 engine_fault_2 exped_led - hdg-text-test qnh-test radio_opt_led rudder-trim-test - spd-text-test terr_on_nd_on ver.fmgc + + controls/switches/annun-test + + + + + select + alt-text-test + hdg-text-test + spd-text-test vs-text-test - - controls/switches/annun-test - 1 - + + /FMGC/FCU-working + /controls/switches/annun-test + diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index cad8a698..a0363d59 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -3701,16 +3701,7 @@ 25 - - - systems/electrical/bus/ac-1 - 0 - - - systems/electrical/bus/ac-2 - 0 - - + /systems/electrical/light/rat-emer-gen-fault controls/switches/annun-test 1 diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index dd0b868b..0cb83edb 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -51,19 +51,21 @@ var warning = { if (me.active == 0) { return; } me.wasActive = 1; lineIndex = 0; - while (lineIndex < 7 and lines[lineIndex].getValue() != "") { + while (lineIndex <= 7 and lines[lineIndex].getValue() != "") { lineIndex = lineIndex + 1; # go to next line until empty line } - if (lineIndex == 7) { + if (lineIndex == 8) { leftOverflow.setBoolValue(1); } elsif (leftOverflow.getBoolValue()) { leftOverflow.setBoolValue(0); } - if (lines[lineIndex].getValue() == "" and me.msg != "" and lineIndex <= 7) { # at empty line. Also checks if message is not blank to allow for some warnings with no displayed msg, eg stall - lines[lineIndex].setValue(me.msg); - linesCol[lineIndex].setValue(me.colour); + if (lineIndex <= 7) { + if (lines[lineIndex].getValue() == "" and me.msg != "") { # at empty line. Also checks if message is not blank to allow for some warnings with no displayed msg, eg stall + lines[lineIndex].setValue(me.msg); + linesCol[lineIndex].setValue(me.colour); + } } }, warnlight: func() { @@ -309,7 +311,7 @@ var ECAM_controller = { } } - if (statusFlag == 1) { + if (statusFlag == 1 and lines[0].getValue() == "") { libraries.SystemDisplay.manCall("sts"); statusFlag = 0; } diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 42ecd00f..72f28d7b 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -1058,6 +1058,19 @@ var messages_priority_2 = func { ECAM_controller.warningReset(acBusEssShedAtc); } + if ((athr_offw.clearFlag == 0) and athrWarn.getValue() == 2 and phaseVar != 4 and phaseVar != 8 and phaseVar != 10) { + athr_offw.active = 1; + athr_offw_1.active = 1; + } else { + ECAM_controller.warningReset(athr_offw); + ECAM_controller.warningReset(athr_offw_1); + if (getprop("/it-autoflight/output/athr-warning") == 2) { + setprop("/it-autoflight/output/athr-warning", 0); + setprop("/ECAM/Lower/light/clr", 0); + setprop("/ECAM/warnings/master-caution-light", 0); + } + } + if ((athr_lock.clearFlag == 0) and phaseVar >= 5 and phaseVar <= 7 and getprop("/systems/thrust/thr-locked-alert") == 1) { if (getprop("/systems/thrust/thr-locked-flash") == 0) { athr_lock.msg = " "; @@ -1071,18 +1084,6 @@ var messages_priority_2 = func { ECAM_controller.warningReset(athr_lock_1); } - if ((athr_offw.clearFlag == 0) and athrWarn.getValue() == 2 and phaseVar != 4 and phaseVar != 8 and phaseVar != 10) { - athr_offw.active = 1; - athr_offw_1.active = 1; - } else { - ECAM_controller.warningReset(athr_offw); - ECAM_controller.warningReset(athr_offw_1); - if (getprop("/it-autoflight/output/athr-warning") == 2) { - setprop("/it-autoflight/output/athr-warning", 0); - setprop("/ECAM/Lower/light/clr", 0); - setprop("/ECAM/warnings/master-caution-light", 0); - } - } if ((athr_lim.clearFlag == 0) and getprop("/it-autoflight/output/athr") == 1 and ((getprop("/systems/thrust/eng-out") != 1 and (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN")) or (getprop("/systems/thrust/eng-out") == 1 and (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN" or (getprop("/systems/thrust/state1") == "MAN THR" and getprop("/controls/engines/engine[0]/throttle-pos") <= 0.83) or (getprop("/systems/thrust/state2") == "MAN THR" and getprop("/controls/engines/engine[0]/throttle-pos") <= 0.83)))) and (phaseVar >= 5 and phaseVar <= 7)) { athr_lim.active = 1; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 2ee2e3bf..a476031f 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -122,14 +122,8 @@ var warnings = std.Vector.new([ var rud_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", colour: "r", aural: 0, light: 0), var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", colour: "r", aural: 0, light: 0), - # Autopilot + # Autopilot off involuntary var ap_offw = warning.new(msg: "AUTO FLT AP OFF", colour: "r", light: 0), - var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", colour: "a", aural: 1, light: 1, hasSubmsg: 1), - var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"), - var athr_lock = warning.new(msg: "ENG THRUST LOCKED", colour: "a", aural: 1, light: 1, hasSubmsg: 1), - var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"), - var athr_lim = warning.new(msg: "AUTO FLT A/THR LIMITED", colour: "a", aural: 1, light: 1, hasSubmsg: 1), - var athr_lim_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"), # Cargo smoke var cargoSmokeFwd = warning.new(msg: "SMOKE FWD CARGO SMOKE", colour: "r", aural: 0, light: 0, hasSubmsg: 1), @@ -221,6 +215,14 @@ var warnings = std.Vector.new([ var acBusEssShed = warning.new(msg: "ELEC DC ESS BUS SHED", colour: "a", aural: 1, light: 1), var acBusEssShedAtc = warning.new(msg: " -ATC..............SYS 2", colour: "c"), + # Autothrust + var athr_offw = warning.new(msg: "AUTO FLT A/THR OFF", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var athr_offw_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"), + var athr_lock = warning.new(msg: "ENG THRUST LOCKED", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var athr_lock_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"), + var athr_lim = warning.new(msg: "AUTO FLT A/THR LIMITED", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var athr_lim_1 = warning.new(msg: "-THR LEVERS........MOVE", colour: "c"), + # TCAS FAULT var tcasFault = warning.new(msg: "NAV TCAS FAULT", colour: "a", aural: 1, light: 1), diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index ac46f876..b42bbccb 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -34,6 +34,7 @@ var vertModeInput = props.globals.getNode("/it-autoflight/input/vert", 1); var vsModeInput = props.globals.getNode("/it-autoflight/input/vs", 1); var locArm = props.globals.getNode("/it-autoflight/output/loc-armed", 1); var apprArm = props.globals.getNode("/it-autoflight/output/appr-armed", 1); +var FCUworkingNode = props.globals.initNode("/FMGC/FCU-working", 0, "BOOL"); var FCU = { elecSupply: "", @@ -73,10 +74,12 @@ var FCUController = { me.FCU1.loop(); me.FCU2.loop(); - if (!me.FCU1.failed and !me.FCU2.failed) { + if (!me.FCU1.failed or !me.FCU2.failed) { me.FCUworking = 1; + FCUworkingNode.setValue(1); } else { me.FCUworking = 0; + FCUworkingNode.setValue(0); } notification = nil; diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index d94ccaed..c9c235d0 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -1452,7 +1452,7 @@ - + /systems/electrical/relay/dc-ess-feed-tr/output eq 0 /systems/electrical/bus/ac-1 eq 0 /systems/electrical/bus/ac-2 eq 0 From bf3d7eb95c6281b8246bc1a54a40abd2219202bf Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 1 Jan 2020 21:38:55 +0000 Subject: [PATCH 2/4] remove old code --- Nasal/ECAM/ECAM-logic.nas | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 72f28d7b..7522adc5 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -1064,11 +1064,6 @@ var messages_priority_2 = func { } else { ECAM_controller.warningReset(athr_offw); ECAM_controller.warningReset(athr_offw_1); - if (getprop("/it-autoflight/output/athr-warning") == 2) { - setprop("/it-autoflight/output/athr-warning", 0); - setprop("/ECAM/Lower/light/clr", 0); - setprop("/ECAM/warnings/master-caution-light", 0); - } } if ((athr_lock.clearFlag == 0) and phaseVar >= 5 and phaseVar <= 7 and getprop("/systems/thrust/thr-locked-alert") == 1) { From d44a794859ffff419af5a41803a1c405d7dbb091 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 1 Jan 2020 21:41:32 +0000 Subject: [PATCH 3/4] Remove non-sensical condition --- Models/Instruments/OHpanel/OHpanel.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index a0363d59..dfd85dc8 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -3696,10 +3696,6 @@ EmerGenInd1F - - systems/electrical/bus/dc-ess - 25 - /systems/electrical/light/rat-emer-gen-fault From ba51c852f595f1a5ec6716c8a042d673869bbd0f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 1 Jan 2020 21:49:44 +0000 Subject: [PATCH 4/4] Add timer to elec to wait a short time before tripping autopilot if there is a failure, to account for transient failures --- Nasal/ECAM/ECAM-controller.nas | 1 + Nasal/Systems/electrical.nas | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index 0cb83edb..04e42e0b 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -349,6 +349,7 @@ var ECAM_controller = { warning.active = 0; warning.noRepeat = 0; warning.noRepeat2 = 0; + # don't set .wasActive to 0, warnlight / sound funcs do that }, }; diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index d83fe6ed..fd175ebb 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -13,6 +13,8 @@ var dc2 = 0; # Main class var ELEC = { + _timer1On: 0, + _timer2On: 0, Bus: { acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"), acEssShed: props.globals.getNode("/systems/electrical/bus/ac-ess-shed"), @@ -227,20 +229,32 @@ var ELEC = { # Autopilot Disconnection routines if (me.Bus.dcEssShed.getValue() < 25) { - if (getprop("/it-autoflight/output/ap1") == 1) { - fcu.apOff("hard", 1); - if (fcu.FCUController.activeFMGC.getValue() == 1) { - fcu.athrOff("hard"); - } + if (getprop("/it-autoflight/output/ap1") == 1 and !me._timer1On) { + me._timer1On = 1; + settimer(func() { + if (me.Bus.dcEssShed.getValue() < 25) { + fcu.apOff("hard", 1); + if (fcu.FCUController.activeFMGC.getValue() == 1) { + fcu.athrOff("hard"); + } + } + me._timer1On = 0; + }, 0.1); } } if (me.Bus.dc2.getValue() < 25) { - if (getprop("/it-autoflight/output/ap2") == 1) { - fcu.apOff("hard", 2); - if (fcu.FCUController.activeFMGC.getValue() == 2) { - fcu.athrOff("hard"); - } + if (getprop("/it-autoflight/output/ap2") == 1 and !me._timer2On) { + me._timer2On = 1; + settimer(func() { + if (me.Bus.dc2.getValue() < 25) { + fcu.apOff("hard", 2); + if (fcu.FCUController.activeFMGC.getValue() == 2) { + fcu.athrOff("hard"); + } + } + me._timer2On = 0; + }, 0.1); } } },