From db5ef87acd06da4651c561f2f60d2305a214aaba Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 4 Jan 2022 17:24:49 +0000 Subject: [PATCH 1/7] Fix FMGC --- Nasal/FMGC/FMGC.nas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 1bdb64a4..aaf29b90 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -216,7 +216,8 @@ var FMGCInternal = { mngSpd: 0, mngSpdCmd: 0, - landingTime: -99, + # This can't be init to -98, because we don't want it to run until WOW has gone to false and back to true + landingTime: -98, blockFuelTime: -99, fuelPredTime: -99, @@ -1142,12 +1143,15 @@ var switchDatabase = func { # Landing to phase 7 setlistener("/gear/gear[1]/wow", func(val) { + print("Called gear"); if (val.getValue() == 0 and timer30secLanding.isRunning) { + print("Stopping timer"); timer30secLanding.stop(); FMGCInternal.landingTime = -99; } if (val.getValue() and FMGCInternal.landingTime == -99) { + print("Starting timer"); timer30secLanding.start(); FMGCInternal.landingTime = pts.Sim.Time.elapsedSec.getValue(); } @@ -1217,8 +1221,9 @@ setlistener("/FMGC/internal/fuel-calculating", func() { # Maketimers var timer30secLanding = maketimer(1, func() { - if (pts.Sim.Time.elapsedSec.getValue() > FMGCInternal.landingTime + 30) { + if (pts.Sim.Time.elapsedSec.getValue() > (FMGCInternal.landingTime + 30)) { FMGCInternal.phase = 7; + FMGCNodes.phase.setValue(7); if (FMGCInternal.costIndexSet) { setprop("/FMGC/internal/last-cost-index", FMGCInternal.costIndex); From 22d8a4bca652c948bbf633093208d2d2f6d6c674 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 4 Jan 2022 17:27:31 +0000 Subject: [PATCH 2/7] Remove debug statements --- Nasal/FMGC/FMGC.nas | 3 --- 1 file changed, 3 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index aaf29b90..ab1c1097 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -1143,15 +1143,12 @@ var switchDatabase = func { # Landing to phase 7 setlistener("/gear/gear[1]/wow", func(val) { - print("Called gear"); if (val.getValue() == 0 and timer30secLanding.isRunning) { - print("Stopping timer"); timer30secLanding.stop(); FMGCInternal.landingTime = -99; } if (val.getValue() and FMGCInternal.landingTime == -99) { - print("Starting timer"); timer30secLanding.start(); FMGCInternal.landingTime = pts.Sim.Time.elapsedSec.getValue(); } From 383ffcf969142b511637394bf2b506ce08fffd07 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 5 Jan 2022 16:38:04 +0000 Subject: [PATCH 3/7] Altitude constraints - add ability to set above / below constraints --- Nasal/MCDU/F-PLN.nas | 51 +++++++++++++++++++++++++++++------------- Nasal/MCDU/VERTREV.nas | 42 +++++++++++++++++++++++++++------- 2 files changed, 69 insertions(+), 24 deletions(-) diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 65c2348c..a83f7c0f 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -122,11 +122,17 @@ var fplnItem = { return [" " ~ fmgc.flightPlanController.fromWptAlt, "mag"]; } elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr > 0) { var tcol = (me.wp.alt_cstr_type == "computed" or me.wp.alt_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed + var cstrAlt = ""; + if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { - return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; + cstrAlt = "FL" ~ math.round(num(me.wp.alt_cstr) / 100); } else { - return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; + cstrAlt = me.wp.alt_cstr; } + + cstrAlt = (me.wp.alt_cstr_type == "above") ? "+" ~ cstrAlt : cstrAlt; + cstrAlt = (me.wp.alt_cstr_type == "below") ? "-" ~ cstrAlt : cstrAlt; + return [sprintf("%6s", cstrAlt), tcol]; } else { return ["------", "wht"]; } @@ -208,25 +214,25 @@ var fplnItem = { } elsif (find("/", scratchpadStore) != -1) { var scratchpadSplit = split("/", scratchpadStore); - if (size(scratchpadSplit[0]) == 0) { - if (num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) { - me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at"); + if (size(scratchpadSplit[0]) != 0) { + if (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350) { + me.wp.setSpeed(scratchpadSplit[0], "at"); mcdu_scratchpad.scratchpads[me.computer].empty(); } else { mcdu_message(me.computer, "FORMAT ERROR"); } + } + + if (right(scratchpadSplit[1], 1) == "+") { + validateAltCstrFpln(left(scratchpadSplit[1], size(scratchpadSplit[1]) - 1), "above", me); + } elsif (right(scratchpadSplit[1], 1) == "-") { + validateAltCstrFpln(left(scratchpadSplit[1], size(scratchpadSplit[1]) - 1), "below", me); + } elsif (left(scratchpadSplit[1], 1) == "+") { + validateAltCstrFpln(right(scratchpadSplit[1], size(scratchpadSplit[1]) - 1), "above", me); + } elsif (left(scratchpadSplit[1], 1) == "-") { + validateAltCstrFpln(right(scratchpadSplit[1], size(scratchpadSplit[1]) - 1), "below", me); } else { - if (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and - num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) { - me.wp.setSpeed(scratchpadSplit[0], "at"); - me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at"); - mcdu_scratchpad.scratchpads[me.computer].empty(); - } elsif (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and size(scratchpadSplit[1]) == 0) { - me.wp.setSpeed(scratchpadSplit[0], "at"); - mcdu_scratchpad.scratchpads[me.computer].empty(); - } else { - mcdu_message(me.computer, "FORMAT ERROR"); - } + validateAltCstrFpln(scratchpadSplit[1], "at", me); } } elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3 and scratchpadStore >= 100 and scratchpadStore <= 350) { me.wp.setSpeed(scratchpadStore, "at"); @@ -240,6 +246,19 @@ var fplnItem = { }, }; +var validateAltCstrFpln = func(scratchpadStore, type, self) { + if (num(scratchpadStore) != nil and (size(scratchpadStore) >= 3 and size(scratchpadStore) <= 5)) { + if (scratchpadStore >= 100 and scratchpadStore <= 39000) { + self.wp.setAltitude(math.round(scratchpadStore, 10), type); + mcdu_scratchpad.scratchpads[self.computer].empty(); + } else { + mcdu_message(self.computer, "ENTRY OUT OF RANGE"); + } + } else { + mcdu_message(self.computer, "FORMAT ERROR"); + } +} + var staticText = { new: func(computer, text) { var sT = {parents:[staticText]}; diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index e3ced48d..000ec6d3 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -55,11 +55,17 @@ var vertRev = { getAlt: func() { if (me.wp.alt_cstr != nil and me.wp.alt_cstr > 0) { var tcol = (me.wp.alt_cstr_type == "computed" or me.wp.alt_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed + var cstrAlt = ""; + if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { - return [sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)) ~ " ", tcol]; + cstrAlt = "FL" ~ math.round(num(me.wp.alt_cstr) / 100); } else { - return [sprintf("%5.0f", me.wp.alt_cstr) ~ " ", tcol]; + cstrAlt = me.wp.alt_cstr; } + + cstrAlt = (me.wp.alt_cstr_type == "above") ? "+" ~ cstrAlt : cstrAlt; + cstrAlt = (me.wp.alt_cstr_type == "below") ? "-" ~ cstrAlt : cstrAlt; + return [cstrAlt ~ (size(cstrAlt) == 6 ? "" : " "), tcol]; } else { return [nil,nil]; } @@ -242,18 +248,38 @@ var vertRev = { mcdu_scratchpad.scratchpads[me.computer].empty(); me._setupPageWithData(); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); - } elsif (num(scratchpadStore) != nil and (size(scratchpadStore) == 4 or size(scratchpadStore) == 5) and scratchpadStore >= 0 and scratchpadStore <= 39000) { - me.wp.setAltitude(math.round(scratchpadStore, 10), "at"); - mcdu_scratchpad.scratchpads[me.computer].empty(); - me._setupPageWithData(); - canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { - mcdu_message(me.computer, "FORMAT ERROR"); + if (right(scratchpadStore, 1) == "+") { + validateAltCstr(left(scratchpadStore, size(scratchpadStore) - 1), "above", me); + } elsif (right(scratchpadStore, 1) == "-") { + validateAltCstr(left(scratchpadStore, size(scratchpadStore) - 1), "below", me); + } elsif (left(scratchpadStore, 1) == "+") { + validateAltCstr(right(scratchpadStore, size(scratchpadStore) - 1), "above", me); + } elsif (left(scratchpadStore, 1) == "-") { + validateAltCstr(right(scratchpadStore, size(scratchpadStore) - 1), "below", me); + } else { + validateAltCstr(scratchpadStore, "at", me); + } } } }, }; +var validateAltCstr = func(scratchpadStore, type, self) { + if (num(scratchpadStore) != nil and (size(scratchpadStore) >= 3 and size(scratchpadStore) <= 5)) { + if (scratchpadStore >= 100 and scratchpadStore <= 39000) { + self.wp.setAltitude(math.round(scratchpadStore, 10), type); + mcdu_scratchpad.scratchpads[self.computer].empty(); + self._setupPageWithData(); + canvas_mcdu.pageSwitch[self.computer].setBoolValue(0); + } else { + mcdu_message(self.computer, "ENTRY OUT OF RANGE"); + } + } else { + mcdu_message(self.computer, "FORMAT ERROR"); + } +} + var updateCrzLvlCallback = func () { if (canvas_mcdu.myVertRev[0] != nil) { canvas_mcdu.myVertRev[0].updateR5(); From fa634ef032056f97efb5e68205e12b0f958de082 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 6 Jan 2022 17:47:03 +0000 Subject: [PATCH 4/7] Add SD pages to level 1 warnings --- Nasal/ECAM/ECAM-logic.nas | 38 +++++++++-- Nasal/ECAM/ECAM-messages.nas | 61 ++++++++++-------- Nasal/ECAM/ECAM-nodes.nas | 1 + Nasal/Systems/hydraulics.nas | 7 ++ Systems/a320-fwc.xml | 120 +++++++++++++++++++++-------------- Systems/ecam-proprules.xml | 22 +++++++ 6 files changed, 168 insertions(+), 81 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index fe6a4406..056a0064 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -626,7 +626,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(park_brk_config); } - if (lrElevFault.clearFlag == 0 and warningNodes.Timers.LRElevFault.getValue()) { + if (lrElevFault.clearFlag == 0 and warningNodes.Timers.LRElevFault.getValue() == 1) { lrElevFault.active = 1; if (lrElevFaultSpeed.clearFlag == 0) { lrElevFaultSpeed.active = 1; @@ -829,6 +829,32 @@ var messages_priority_3 = func { ECAM_controller.warningReset(lavatorySmokeComm); } + # CAB PRESS EXESS RESIDUAL PRESS + if (excessResidPress.clearFlag == 0 and warningNodes.Logic.excessPress.getValue() == 1 and phaseVar == 10) { + if (excessResidPressPack1.clearFlag == 0) { + excessResidPressPack1.active = 1; + } else { + ECAM_controller.warningReset(excessResidPressPack1); + } + + if (excessResidPressPack2.clearFlag == 0) { + excessResidPressPack2.active = 1; + } else { + ECAM_controller.warningReset(excessResidPressPack2); + } + + if (excessResidPressCabCr.clearFlag == 0) { + excessResidPressCabCr.active = 1; + } else { + ECAM_controller.warningReset(excessResidPressCabCr); + } + } else { + ECAM_controller.warningReset(excessResidPress); + ECAM_controller.warningReset(excessResidPressPack1); + ECAM_controller.warningReset(excessResidPressPack2); + ECAM_controller.warningReset(excessResidPressCabCr); + } + # ESS on BAT # NEW EMER ELEC CONFIG if (essBusOnBat.clearFlag == 0 and warningNodes.Timers.staticInverter.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) { @@ -977,13 +1003,13 @@ var messages_priority_3 = func { ECAM_controller.warningReset(hydBYloPrRat); } - if (hydBYloPrYElec.clearFlag == 0 and !systems.HYD.Pump.yellowElec.getValue() and systems.ELEC.Bus.ac2.getValue() >= 110 and systems.HYD.Qty.yellow.getValue() >= 3.5) { + if (hydBYloPrYElec.clearFlag == 0 and !systems.HYD.Pump.yellowElec.getValue() and !systems.HYD.Pump.yellowElecFail.getValue() and systems.ELEC.Bus.ac2.getValue() >= 110 and !systems.HYD.Fail.yellowReservoirAirPressLow.getBoolValue() and !systems.HYD.Warnings.yellowReservoirOvht.getBoolValue() and !systems.HYD.Warnings.yellowLoLvl.getBoolValue()) { hydBYloPrYElec.active = 1; } else { ECAM_controller.warningReset(hydBYloPrYElec); } - if (hydBYloPrRatOn.clearFlag == 0 and systems.HYD.Rat.position.getValue() == 0 and systems.HYD.Qty.blue.getValue() >= 2.4) { + if (hydBYloPrRatOn.clearFlag == 0 and systems.HYD.Rat.position.getValue() == 0 and systems.HYD.Qty.blue.getValue() >= 1.8 and !systems.HYD.Fail.blueReservoirAirPressLow.getBoolValue() and !systems.HYD.Warnings.blueReservoirOvht.getBoolValue() and !systems.HYD.Warnings.blueLoLvl.getBoolValue()) { hydBYloPrRatOn.active = 1; } else { ECAM_controller.warningReset(hydBYloPrRatOn); @@ -1052,7 +1078,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(hydGBloPrRat); } - if (hydGBloPrRatOn.clearFlag == 0 and systems.HYD.Rat.position.getValue() == 0 and systems.HYD.Qty.blue.getValue() >= 2.4) { + if (hydGBloPrRatOn.clearFlag == 0 and systems.HYD.Rat.position.getValue() == 0 and systems.HYD.Qty.blue.getValue() >= 1.8 and !systems.HYD.Fail.blueReservoirAirPressLow.getBoolValue() and !systems.HYD.Warnings.blueReservoirOvht.getBoolValue() and !systems.HYD.Warnings.blueLoLvl.getBoolValue()) { hydGBloPrRatOn.active = 1; } else { ECAM_controller.warningReset(hydGBloPrRatOn); @@ -1105,7 +1131,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(hydGBloPrFmsPredict); } - if (hydGYloPr.clearFlag == 0 and phaseVar3 != 4 and phaseVar3 != 5 and warningNodes.Logic.greenYellow.getValue()) { + if (hydGYloPr.clearFlag == 0 and warningNodes.Logic.greenYellow.getValue()) { hydGYloPr.active = 1; if (hydGYloPrPtu.clearFlag == 0 and systems.HYD.Switch.ptu.getValue() != 0) { hydGYloPrPtu.active = 1; @@ -1125,7 +1151,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(hydGYloPrYEng); } - if (hydGYloPrYElec.clearFlag == 0 and !systems.HYD.Pump.yellowElec.getValue() and systems.ELEC.Bus.ac2.getValue() >= 110 and systems.HYD.Qty.yellow.getValue() >= 3.5) { + if (hydGYloPrYElec.clearFlag == 0 and !systems.HYD.Pump.yellowElec.getValue() and !systems.HYD.Pump.yellowElecFail.getValue() and systems.ELEC.Bus.ac2.getValue() >= 110 and !systems.HYD.Fail.yellowReservoirAirPressLow.getBoolValue() and !systems.HYD.Warnings.yellowReservoirOvht.getBoolValue() and !systems.HYD.Warnings.yellowLoLvl.getBoolValue()) { hydGYloPrYElec.active = 1; } else { ECAM_controller.warningReset(hydGYloPrYElec); diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 0be5d0d9..16f2b6dc 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -18,7 +18,7 @@ var warnings = std.Vector.new([ var overspeedGear = warning.new(msg: "-VLE...........280 /.67", colour: "r"), var overspeedFlap = warning.new(msg: "-VFE................XXX", colour: "r"), - var allEngFail = warning.new(msg: "ENG ALL ENGINES FAILURE", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var allEngFail = warning.new(msg: "ENG ALL ENGINES FAILURE", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "enginePage"), var allEngFailElec = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), var allEngFailSPD1 = warning.new(msg: " OPT RELIGHT SPD.260/.77", colour: "c"), var allEngFailSPD2 = warning.new(msg: " OPT RELIGHT SPD.270/.77", colour: "c"), @@ -40,7 +40,7 @@ var warnings = std.Vector.new([ var eng2ThrLvrAbvIdle2 = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"), # ENG 1 FIRE (flight) - var eng1Fire = warning.new(msg: "ENG 1 FIRE", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var eng1Fire = warning.new(msg: "ENG 1 FIRE", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "enginePage"), var eng1FireFllever = warning.new(msg: " -THR LEVER 1.......IDLE", colour: "c"), var eng1FireFlmaster = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"), var eng1FireFlPB = warning.new(msg: " -ENG 1 FIRE P/B....PUSH", colour: "c"), @@ -63,7 +63,7 @@ var warnings = std.Vector.new([ var eng1FireGnEvac = warning.new(msg: " -EMER EVAC PROC...APPLY", colour: "c"), # ENG 2 FIRE (flight) - var eng2Fire = warning.new(msg: "ENG 2 FIRE", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var eng2Fire = warning.new(msg: "ENG 2 FIRE", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "enginePage"), var eng2FireFllever = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"), var eng2FireFlmaster = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"), var eng2FireFlPB = warning.new(msg: " -ENG 2 FIRE P/B....PUSH", colour: "c"), @@ -85,6 +85,13 @@ var warnings = std.Vector.new([ var eng2FireGnAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"), var eng2FireGnEvac = warning.new(msg: " -EMER EVAC PROC...APPLY", colour: "c"), + # APU FIRE + var apuFire = warning.new(msg: "APU FIRE ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "apuPage"), + var apuFirePB = warning.new(msg: " -APU FIRE P/B......PUSH", colour: "c"), + var apuFireAgentTimer = warning.new(msg: " -AGENT AFT 10 S...DISCH", colour: "c"), + var apuFireAgent = warning.new(msg: " -AGENT............DISCH", colour: "c"), + var apuFireMaster = warning.new(msg: " -MASTER SW..........OFF", colour: "c"), + # ADR 1 + 2 + 3 FAULT var ADR123Fault = warning.new(msg: "NAV ADR1+2+3 FAULT ", colour: "r", aural: 0, light: 0, isMainMsg: 1), var ADR123FaultAP = warning.new(msg: " -AP+FD..............OFF", colour: "c"), @@ -99,28 +106,28 @@ var warnings = std.Vector.new([ var ADR123FaultSTBY = warning.new(msg: " -STBY INST.MAY BE UNREL", colour: "c"), var ADR123FaultPROC = warning.new(msg: " -ALL ADR OFF PROC.APPLY", colour: "c"), - # APU FIRE - var apuFire = warning.new(msg: "APU FIRE ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "apuPage"), - var apuFirePB = warning.new(msg: " -APU FIRE P/B......PUSH", colour: "c"), - var apuFireAgentTimer = warning.new(msg: " -AGENT AFT 10 S...DISCH", colour: "c"), - var apuFireAgent = warning.new(msg: " -AGENT............DISCH", colour: "c"), - var apuFireMaster = warning.new(msg: " -MASTER SW..........OFF", colour: "c"), - # Config var slats_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0), var slats_config_1 = warning.new(msg: "SLATS NOT IN T.O. CONFIG", colour: "r", aural: 0, light: 0), var flaps_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0), var flaps_config_1 = warning.new(msg: "FLAPS NOT IN T.O. CONFIG", colour: "r", aural: 0, light: 0), - var spd_brk_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0), + var spd_brk_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0, sdPage: "fctlPage"), var spd_brk_config_1 = warning.new(msg: "SPD BRK NOT RETRACTED", colour: "r", aural: 0, light: 0), - var pitch_trim_config = warning.new(msg: "CONFIG PITCH TRIM", colour: "r", aural: 0, light: 0), + var pitch_trim_config = warning.new(msg: "CONFIG PITCH TRIM", colour: "r", aural: 0, light: 0, sdPage: "fctlPage"), var pitch_trim_config_1 = warning.new(msg: " NOT IN T.O. RANGE", colour: "r", aural: 0, light: 0), - var rud_trim_config = warning.new(msg: "CONFIG RUD TRIM", colour: "r", aural: 0, light: 0), + var rud_trim_config = warning.new(msg: "CONFIG RUD TRIM", colour: "r", aural: 0, light: 0, sdPage: "fctlPage"), 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), + var l_sidestick_fault = warning.new(msg: "CONFIG L SIDESTICK FAULT", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var l_sidestick_fault_to = warning.new(msg: " (BY TAKE OVER)", colour: "r"), + var l_sidestick_fault_pb = warning.new(msg: " -L TAKE OVER....DEPRESS", colour: "c"), + var r_sidestick_fault = warning.new(msg: "CONFIG R SIDESTICK FAULT", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var r_sidestick_fault_to = warning.new(msg: " (BY TAKE OVER)", colour: "r"), + var r_sidestick_fault_pb = warning.new(msg: " -R TAKE OVER....DEPRESS", colour: "c"), + # EXCESS CAB ALT - var excessCabAlt = warning.new(msg: "CAB PR EXCESS CAB ALT", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var excessCabAlt = warning.new(msg: "CAB PR EXCESS CAB ALT", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "cabPressPage"), var excessCabAltMask = warning.new(msg: " -CREW OXY MASKS.....USE", colour: "c"), var excessCabAltSigns = warning.new(msg: " -SIGNS...............ON", colour: "c"), var excessCabAltEmerD = warning.new(msg: " •EMER DESCENT:", colour: "w"), @@ -137,21 +144,21 @@ var warnings = std.Vector.new([ var excessCabAltMasks = warning.new(msg: " -PAX OXY MASKS...MAN ON", colour: "c"), # ENG 1 OIL LO PR - var eng1OilLoPr = warning.new(msg: "ENG 1 OIL LO PR ", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var eng1OilLoPr = warning.new(msg: "ENG 1 OIL LO PR ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "enginePage"), var eng1OilLoPrIf = warning.new(msg: " •IF OIL PR < 13 PSI :", colour: "w"), var eng1OilLoPrIf2 = warning.new(msg: " •IF OIL PR < 60 PSI :", colour: "w"), var eng1OilLoPrThrot = warning.new(msg: " -THR LEVER 1.......IDLE", colour: "c"), var eng1OilLoPrMaster = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"), # ENG 2 OIL LO PR - var eng2OilLoPr = warning.new(msg: "ENG 2 OIL LO PR ", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var eng2OilLoPr = warning.new(msg: "ENG 2 OIL LO PR ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "enginePage"), var eng2OilLoPrIf = warning.new(msg: " •IF OIL PR < 13 PSI :", colour: "w"), var eng2OilLoPrIf2 = warning.new(msg: " •IF OIL PR < 60 PSI :", colour: "w"), var eng2OilLoPrThrot = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"), var eng2OilLoPrMaster = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"), # FCTL L+R ELEV FAULT - var lrElevFault = warning.new(msg: "F/CTL L+R ELEV FAULT", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var lrElevFault = warning.new(msg: "F/CTL L+R ELEV FAULT", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "fctlPage"), var lrElevFaultSpeed = warning.new(msg: " MAX SPEED.......320/.77", colour: "c"), var lrElevFaultTrim = warning.new(msg: " -MAN PITCH TRIM.....USE", colour: "c"), var lrElevFaultSpdBrk = warning.new(msg: " SPD BRK......DO NOT USE", colour: "c"), @@ -159,7 +166,7 @@ var warnings = std.Vector.new([ # Gear not down var gearNotDown = warning.new(msg: "L/G GEAR NOT DOWN", colour: "r", aural: 0, light: 0, isMainMsg: 1), - var gearNotDownLocked = warning.new(msg: "L/G GEAR NOT DOWNLOCKED", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var gearNotDownLocked = warning.new(msg: "L/G GEAR NOT DOWNLOCKED", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "wheelPage"), var gearNotDownLockedRec = warning.new(msg: " -L/G LEVER......RECYCLE", colour: "c"), var gearNotDownLockedWork = warning.new(msg: " •IF UNSUCCESSFUL:", colour: "w"), var gearNotDownLocked120 = warning.new(msg: " AFTER 120S:", colour: "w"), @@ -169,14 +176,14 @@ var warnings = std.Vector.new([ var ap_offw = warning.new(msg: "AUTO FLT AP OFF", colour: "r", light: 0, isMainMsg: 1), # Cargo smoke - var cargoSmokeFwd = warning.new(msg: "SMOKE FWD CARGO SMOKE", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var cargoSmokeFwd = warning.new(msg: "SMOKE FWD CARGO SMOKE", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "condPage"), var cargoSmokeFwdFans = warning.new(msg: " -CAB FANS...........OFF", colour: "c"), var cargoSmokeFwdGrdClsd = warning.new(msg: " •IF FWD CRG CLSD:", colour: "w"), var cargoSmokeFwdAgent = warning.new(msg: " -AGENT............DISCH", colour: "c"), var cargoSmokeFwdGrd = warning.new(msg: " •WHEN ON GROUND", colour: "w"), var cargoSmokeFwdDoors = warning.new(msg: " BEFORE OPEN CRG DOORS:", colour: "w"), var cargoSmokeFwdDisemb = warning.new(msg: "-PAX..........DISEMBARK", colour: "c"), - var cargoSmokeAft = warning.new(msg: "SMOKE AFT CARGO SMOKE", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var cargoSmokeAft = warning.new(msg: "SMOKE AFT CARGO SMOKE", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "condPage"), var cargoSmokeAftFans = warning.new(msg: " -CAB FANS...........OFF", colour: "c"), var cargoSmokeAftGrdClsd = warning.new(msg: " •IF AFT CRG CLSD:", colour: "w"), var cargoSmokeAftAgent = warning.new(msg: " -AGENT............DISCH", colour: "c"), @@ -189,18 +196,18 @@ var warnings = std.Vector.new([ var lavatorySmokeComm = warning.new(msg: "-CKPT/CAB COM.ESTABLISH ", colour: "c"), # EXCES RESID PR - var excessResidPress = warning.new(msg: "CAB PR EXCES RESIDUAL PR ", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var excessResidPress = warning.new(msg: "CAB PR EXCES RESIDUAL PR ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "cabPressPage"), var excessResidPressPack1 = warning.new(msg: "-PACK 1.............OFF", colour: "c"), var excessResidPressPack2 = warning.new(msg: "-PACK 2.............OFF", colour: "c"), var excessResidPressCabCr = warning.new(msg: "-CABIN CREW.......ALERT", colour: "c"), # ESS Bus on Bat # NEW EMER CONFIG - var essBusOnBat = warning.new(msg: "ELEC ESS BUSES ON BAT", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var essBusOnBat = warning.new(msg: "ELEC ESS BUSES ON BAT", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "elecPage"), var essBusOnBatMinSpeed = warning.new(msg: " MIN RAT SPD......140 KT", colour: "c"), # Emer Config - var emerconfig = warning.new(msg: "ELEC EMER CONFIG", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var emerconfig = warning.new(msg: "ELEC EMER CONFIG", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "elecPage"), var emerconfigMinRat = warning.new(msg: " MIN RAT SPD......140 KT", colour: "c"), var emerconfigGen = warning.new(msg: " -GEN 1+2....OFF THEN ON", colour: "c"), var emerconfigGen2 = warning.new(msg: " •IF UNSUCCESSFUL :", colour: "w"), @@ -219,7 +226,7 @@ var warnings = std.Vector.new([ var emerconfigFMSPRD = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), # B + Y LO PR - var hydBYloPr = warning.new(msg: "HYD B+Y SYS LO PR", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var hydBYloPr = warning.new(msg: "HYD B+Y SYS LO PR", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "hydraulicPage"), var hydBYloPrRat = warning.new(msg: " MIN RAT SPD......140 KT", colour: "c"), var hydBYloPrYElec = warning.new(msg: " -YELLOW ELEC PUMP....ON", colour: "c"), var hydBYloPrRatOn = warning.new(msg: " -RAT.............MAN ON", colour: "c"), @@ -232,7 +239,7 @@ var warnings = std.Vector.new([ var hydBYloPrFmsPredict = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), # G + B LO PR - var hydGBloPr = warning.new(msg: "HYD G+B SYS LO PR", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var hydGBloPr = warning.new(msg: "HYD G+B SYS LO PR", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "hydraulicPage"), var hydGBloPrRat = warning.new(msg: " MIN RAT SPD......140 KT", colour: "c"), var hydGBloPrRatOn = warning.new(msg: " -RAT.............MAN ON", colour: "c"), var hydGBloPrBElec = warning.new(msg: " -BLUE ELEC PUMP.....OFF", colour: "c"), @@ -243,7 +250,7 @@ var warnings = std.Vector.new([ var hydGBloPrFmsPredict = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), # G + Y LO PR - var hydGYloPr = warning.new(msg: "HYD G+Y SYS LO PR", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var hydGYloPr = warning.new(msg: "HYD G+Y SYS LO PR", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "hydraulicPage"), var hydGYloPrPtu = warning.new(msg: " -PTU................OFF", colour: "c"), var hydGYloPrGEng = warning.new(msg: " -GREEN ENG 1 PUMP...OFF", colour: "c"), var hydGYloPrYEng = warning.new(msg: " -YELLOW ENG 2 PUMP..OFF", colour: "c"), @@ -253,7 +260,7 @@ var warnings = std.Vector.new([ var hydGYloPrFmsPredict = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), # AIR BLEED LEAK - var airBleedLeak = warning.new(msg: "AIR BLEED LEAK ", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var airBleedLeak = warning.new(msg: "AIR BLEED LEAK ", colour: "r", aural: 0, light: 0, isMainMsg: 1, sdPage: "bleedPage"), var airBleedLeakShut = warning.new(msg: " -X BLEED..........SHUT", colour: "c"), # LEVEL 2 WARN diff --git a/Nasal/ECAM/ECAM-nodes.nas b/Nasal/ECAM/ECAM-nodes.nas index d19bf137..b13bb41a 100644 --- a/Nasal/ECAM/ECAM-nodes.nas +++ b/Nasal/ECAM/ECAM-nodes.nas @@ -151,6 +151,7 @@ var warningNodes = { gen1Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-1-off"), gen2Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-2-off"), spdBrkOut: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-still-out"), + excessPress: props.globals.initNode("/ECAM/warnings/press/exess-residual-pressure"), }, Timers: { apuFaultOutput: props.globals.initNode("/ECAM/warnings/timer/apu-fault-output"), diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index b0d1ff60..a6c0faac 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -44,6 +44,7 @@ var HYD = { }, Pump: { yellowElec: props.globals.getNode("/systems/hydraulic/sources/yellow-elec/pump-operate"), + yellowElecFail: props.globals.getNode("/ECAM/warnings/hyd/yellow-elec-pump-fail"), }, Qty: { blueInput: props.globals.initNode("/systems/hydraulic/blue-qty-input", 0, "INT"), @@ -74,6 +75,12 @@ var HYD = { blueAbnormLoPr: props.globals.getNode("/ECAM/warnings/hyd/blue-abnorm-lo-pr"), greenAbnormLoPr: props.globals.getNode("/ECAM/warnings/hyd/green-abnorm-lo-pr"), yellowAbnormLoPr: props.globals.getNode("/ECAM/warnings/hyd/yellow-abnorm-lo-pr"), + blueLoLvl: props.globals.getNode("/systems/hydraulic/relays/blue-reservoir-low-qty-switch"), + greenLoLvl: props.globals.getNode("/systems/hydraulic/relays/green-reservoir-low-qty-switch"), + yellowLoLvl: props.globals.getNode("/systems/hydraulic/relays/yellow-reservoir-low-qty-switch"), + blueReservoirOvht: props.globals.getNode("/systems/hydraulic/relays/blue-reservoir-overheat"), + greenReservoirOvht: props.globals.getNode("/systems/hydraulic/relays/green-reservoir-overheat"), + yellowReservoirOvht: props.globals.getNode("/systems/hydraulic/relays/yellow-reservoir-overheat"), }, init: func() { me.resetFail(); diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index b59f0d73..5e52b0f8 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -3146,6 +3146,38 @@ + + + + + + /ECAM/phases/phase-calculation/engines-1-2-not-running eq 1 + /ECAM/timer/ground-calc eq 1 + + + + + /ECAM/warnings/press/exess-residual-pressure-ground-input + 0.14285714285 + 100 + + + + + + /ECAM/warnings/press/exess-residual-pressure-ground eq 1 + /systems/pressurization/deltap-norm ge 0.1 + + + + + /ECAM/warnings/press/exess-residual-pressure-input + 0.2 + 100 + + + + @@ -3644,9 +3676,9 @@ - - /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 + + /ECAM/warnings/logic/eng/JE1NORUN eq 0 + /ECAM/warnings/logic/eng/JE2NORUN eq 0 @@ -3659,8 +3691,8 @@ - /engines/engine[0]/state ne 3 - /engines/engine[1]/state ne 3 + /ECAM/warnings/logic/eng/JE1NORUN eq 1 + /ECAM/warnings/logic/eng/JE2NORUN eq 1 /ECAM/timer/ground-calc eq 0 @@ -3674,7 +3706,7 @@ - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/JE1NORUN eq 0 /ECAM/warning-phase ne 1 /ECAM/warning-phase ne 2 @@ -3693,7 +3725,7 @@ - /engines/engine[1]/state eq 3 + /ECAM/warnings/logic/eng/JE2NORUN eq 0 /ECAM/warning-phase ne 1 /ECAM/warning-phase ne 2 @@ -3781,21 +3813,8 @@ - - - - /ECAM/warning-phase le 2 - /ECAM/warning-phase ge 9 - - /engines/engine[0]/state eq 3 - - - /ECAM/warning-phase gt 2 - /ECAM/warning-phase lt 9 - /ECAM/warning-phase ne 4 - /ECAM/warning-phase ne 5 - - + /ECAM/warning-phase ne 4 + /ECAM/warning-phase ne 5 /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 1 /ECAM/warnings/hyd/green-abnorm-lo-pr eq 1 @@ -3804,21 +3823,8 @@ - - - - /ECAM/warning-phase le 2 - /ECAM/warning-phase ge 9 - - /engines/engine[1]/state eq 3 - - - /ECAM/warning-phase gt 2 - /ECAM/warning-phase lt 9 - /ECAM/warning-phase ne 4 - /ECAM/warning-phase ne 5 - - + /ECAM/warning-phase ne 4 + /ECAM/warning-phase ne 5 /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 1 /ECAM/warnings/hyd/yellow-abnorm-lo-pr eq 1 @@ -3827,8 +3833,7 @@ - /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 + /ECAM/warnings/logic/eng/dual-failure eq 0 /ECAM/warnings/hyd/green-abnorm-lo-pr eq 1 /ECAM/warnings/hyd/yellow-abnorm-lo-pr eq 1 @@ -3837,18 +3842,16 @@ - /ECAM/timer/ground-calc eq 0 - /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 + /ECAM/timer/ground-calc ne 1 + /ECAM/warnings/logic/eng/dual-failure eq 0 - /ECAM/timer/ground-calc eq 0 - /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 + /ECAM/timer/ground-calc ne 1 + /ECAM/warnings/logic/eng/dual-failure eq 0 /ECAM/warnings/logic/SFLAPEXT eq 1 @@ -3872,9 +3875,8 @@ - /ECAM/timer/ground-calc eq 0 - /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 + /ECAM/timer/ground-calc ne 1 + /ECAM/warnings/logic/eng/dual-failure eq 0 /ECAM/warnings/logic/SFLAPEXT eq 1 @@ -3900,6 +3902,28 @@ + + + + /systems/hydraulic/sources/yellow-elec/pump-operate eq 1 + /systems/hydraulic/yellow-psi lt 1450 + + + + + + + + /systems/hydraulic/sources/yellow-elec/pump-operate eq 1 + /systems/hydraulic/yellow-psi ge 1450 + + + /ECAM/warnings/logic/phase-2-pulse-input eq 1 + /ECAM/warnings/logic/phase-2-pulse eq 1 + + + + diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index f389f971..2d30dc21 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -586,6 +586,17 @@ /ECAM/warnings/timer/phase-1-pulse + + monostable + + + /ECAM/warnings/logic/phase-2-pulse-input + + /ECAM/warnings/logic/phase-2-pulse + + monostable + + + RS + + /ECAM/warnings/hyd/yellow-elec-pump-fail-set + + + /ECAM/warnings/hyd/yellow-elec-pump-fail-reset + + /ECAM/warnings/hyd/yellow-elec-pump-fail + From fd5d4676ffaf0e816bbce17ad0d8bb9950ce3348 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 6 Jan 2022 18:41:15 +0000 Subject: [PATCH 5/7] Excess cabin press --- Nasal/ECAM/ECAM-logic.nas | 137 ++++++++++++++++++++++++++++++++++- Nasal/ECAM/ECAM-messages.nas | 1 + Nasal/ECAM/ECAM-nodes.nas | 5 ++ Systems/a320-fwc.xml | 92 +++++++++++++++++++++-- Systems/ecam-proprules.xml | 44 +++++++++++ 5 files changed, 269 insertions(+), 10 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 056a0064..ee4f4747 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -626,6 +626,139 @@ var messages_priority_3 = func { ECAM_controller.warningReset(park_brk_config); } + if (excessCabAlt.clearFlag == 0 and warningNodes.Logic.excessCabAlt.getValue() == 1 and phaseVar3 == 6) { + excessCabAlt.active = 1; + + if (excessCabAltMask.clearFlag == 0 and warningNodes.Flipflops.cabPressExcessFlipflopTop.getValue()) { + excessCabAltMask.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltMask); + } + + if (warningNodes.Flipflops.cabPressExcessFlipflop.getValue()) { + if (excessCabAltSigns.clearFlag == 0 and (!pts.Controls.Lighting.noSmokingSign.getValue() or !pts.Controls.Lighting.seatbeltSign.getValue())) { + excessCabAltSigns.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltSigns); + } + + if (excessCabAltEmerD.clearFlag == 0) { + excessCabAltEmerD.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltEmerD); + } + } else { + ECAM_controller.warningReset(excessCabAltSigns); + ECAM_controller.warningReset(excessCabAltEmerD); + } + + if (excessCabAltDES.clearFlag == 0 and warningNodes.Flipflops.cabPressExcessFlipflopTop.getValue()) { + excessCabAltDES.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltDES); + } + + if (warningNodes.Flipflops.cabPressExcessFlipflop.getValue()) { + if (excessCabAltTHRLVR.clearFlag == 0 and !fmgc.Output.athr.getBoolValue() and warningNodes.Logic.JE1TLAI.getValue() != 0 and warningNodes.Logic.JE2TLAI.getValue() != 0) { + excessCabAltTHRLVR.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltTHRLVR); + } + + if (excessCabAltSPDBRK.clearFlag == 0 and pts.Controls.Flight.speedbrake.getValue() != 1) { + excessCabAltSPDBRK.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltSPDBRK); + } + + if (excessCabAltSPD.clearFlag == 0) { + excessCabAltSPD.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltSPD); + } + + if (excessCabAltENG.clearFlag == 0 and pts.Controls.Engines.startSw.getValue() != 1) { + excessCabAltENG.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltENG); + } + + if (excessCabAltATC.clearFlag == 0) { + excessCabAltATC.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltATC); + } + } else { + ECAM_controller.warningReset(excessCabAltTHRLVR); + ECAM_controller.warningReset(excessCabAltSPDBRK); + ECAM_controller.warningReset(excessCabAltSPD); + ECAM_controller.warningReset(excessCabAltENG); + ECAM_controller.warningReset(excessCabAltATC); + } + + if (warningNodes.Flipflops.cabPressExcessFlipflopTop.getValue() and !warningNodes.Flipflops.cabPressExcessFlipflop.getValue()) { + if (excessCabAltCAB.clearFlag == 0) { + excessCabAltCAB.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltCAB); + } + } else { + ECAM_controller.warningReset(excessCabAltCAB); + } + + if (warningNodes.Flipflops.cabPressExcessFlipflop.getValue()) { + if (excessCabAltPA.clearFlag == 0) { + excessCabAltPA.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltPA); + } + + if (excessCabAltXPDR.clearFlag == 0) { + excessCabAltXPDR.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltXPDR); + } + } else { + ECAM_controller.warningReset(excessCabAltPA); + ECAM_controller.warningReset(excessCabAltXPDR); + } + + if (excessCabAltMEA.clearFlag == 0) { + excessCabAltMEA.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltMEA); + } + + if (excessCabAltCabAlt.clearFlag == 0) { + excessCabAltCabAlt.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltCabAlt); + } + + if (excessCabAltMasks.clearFlag == 0) { + excessCabAltMasks.active = 1; + } else { + ECAM_controller.warningReset(excessCabAltMasks); + } + } else { + ECAM_controller.warningReset(excessCabAlt); + ECAM_controller.warningReset(excessCabAltMask); + ECAM_controller.warningReset(excessCabAltSigns); + ECAM_controller.warningReset(excessCabAltEmerD); + ECAM_controller.warningReset(excessCabAltDES); + ECAM_controller.warningReset(excessCabAltTHRLVR); + ECAM_controller.warningReset(excessCabAltSPDBRK); + ECAM_controller.warningReset(excessCabAltSPD); + ECAM_controller.warningReset(excessCabAltENG); + ECAM_controller.warningReset(excessCabAltCAB); + ECAM_controller.warningReset(excessCabAltATC); + ECAM_controller.warningReset(excessCabAltPA); + ECAM_controller.warningReset(excessCabAltXPDR); + ECAM_controller.warningReset(excessCabAltMEA); + ECAM_controller.warningReset(excessCabAltCabAlt); + ECAM_controller.warningReset(excessCabAltMasks); + } + if (lrElevFault.clearFlag == 0 and warningNodes.Timers.LRElevFault.getValue() == 1) { lrElevFault.active = 1; if (lrElevFaultSpeed.clearFlag == 0) { @@ -3340,7 +3473,7 @@ var messages_config_memo = func { toMemoLine1.colour = "c"; } - if (pts.Controls.Switches.seatbeltSwitch.getValue() and pts.Controls.Switches.noSmokingSwitch.getValue()) { + if (pts.Controls.Lighting.seatbeltSign.getValue() and pts.Controls.Lighting.noSmokingSign.getValue()) { toMemoLine2.msg = " SIGNS ON"; toMemoLine2.colour = "g"; } else { @@ -3406,7 +3539,7 @@ var messages_config_memo = func { ldgMemoLine1.colour = "c"; } - if (pts.Controls.Switches.seatbeltSwitch.getValue() and pts.Controls.Switches.noSmokingSwitch.getValue()) { + if (pts.Controls.Lighting.seatbeltSign.getValue() and pts.Controls.Lighting.noSmokingSign.getValue()) { ldgMemoLine2.msg = " SIGNS ON"; ldgMemoLine2.colour = "g"; } else { diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 16f2b6dc..fb10fbeb 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -136,6 +136,7 @@ var warnings = std.Vector.new([ var excessCabAltSPDBRK = warning.new(msg: " -SPD BRK...........FULL", colour: "c"), var excessCabAltSPD = warning.new(msg: " SPD.....MAX/APPROPRIATE", colour: "c"), var excessCabAltENG = warning.new(msg: " -ENG MODE...........IGN", colour: "c"), + var excessCabAltATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"), var excessCabAltCAB = warning.new(msg: " -CABIN CREW......ADVISE", colour: "c"), var excessCabAltPA = warning.new(msg: " -EMER DES (PA).ANNOUNCE", colour: "c"), var excessCabAltXPDR = warning.new(msg: " -XPDR 7700.....CONSIDER", colour: "c"), diff --git a/Nasal/ECAM/ECAM-nodes.nas b/Nasal/ECAM/ECAM-nodes.nas index b13bb41a..1fcddb63 100644 --- a/Nasal/ECAM/ECAM-nodes.nas +++ b/Nasal/ECAM/ECAM-nodes.nas @@ -74,6 +74,8 @@ var FWC = { var warningNodes = { Logic: { + JE1TLAI: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-tla-idle"), + JE2TLAI: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-tla-idle"), altitudeAlert: props.globals.initNode("/ECAM/warnings/altitude-alert/c-chord"), altitudeAlertSteady: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-steady"), altitudeAlertFlash: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-flash"), @@ -152,6 +154,7 @@ var warningNodes = { gen2Off: props.globals.initNode("/ECAM/warnings/logic/elec/gen-2-off"), spdBrkOut: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-still-out"), excessPress: props.globals.initNode("/ECAM/warnings/press/exess-residual-pressure"), + excessCabAlt: props.globals.initNode("/ECAM/warnings/logic/press/excess-cabin-alt"), }, Timers: { apuFaultOutput: props.globals.initNode("/ECAM/warnings/timer/apu-fault-output"), @@ -215,5 +218,7 @@ var warningNodes = { parkBrk: props.globals.initNode("/ECAM/warnings/config/park-brk/park-brk-output"), eng1ThrLvrAbvIdle: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-thr-lvr-abv-idle"), eng2ThrLvrAbvIdle: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-thr-lvr-abv-idle"), + cabPressExcessFlipflopTop: props.globals.initNode("/ECAM/warnings/logic/press/excess-cabin-alt-flipflop-top"), + cabPressExcessFlipflop: props.globals.initNode("/ECAM/warnings/logic/press/excess-cabin-alt-flipflop"), }, }; \ No newline at end of file diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 5e52b0f8..aa8db4c7 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -2673,9 +2673,9 @@ /ECAM/warnings/logic/eng/eng-1-tla-abv-6-output eq 1 - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/JE1NORUN eq 1 - /engines/engine[1]/state eq 3 + /ECAM/warnings/logic/eng/JE2NORUN eq 1 /ECAM/warnings/logic/eng/eng-2-reverse eq 1 @@ -2692,9 +2692,9 @@ /ECAM/warnings/logic/eng/eng-1-tla-abv-6-2-output eq 1 - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/JE1NORUN eq 1 - /engines/engine[1]/state eq 3 + /ECAM/warnings/logic/eng/JE2NORUN eq 1 /ECAM/warnings/logic/eng/eng-2-tla-idle-output eq 1 @@ -2711,9 +2711,9 @@ /ECAM/warnings/logic/eng/eng-2-tla-abv-6-output eq 1 - /engines/engine[1]/state eq 3 + /ECAM/warnings/logic/eng/JE2NORUN eq 1 - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/JE1NORUN eq 1 /ECAM/warnings/logic/eng/eng-1-reverse eq 1 @@ -2730,9 +2730,9 @@ /ECAM/warnings/logic/eng/eng-2-tla-abv-6-2-output eq 1 - /engines/engine[1]/state eq 3 + /ECAM/warnings/logic/eng/JE2NORUN eq 1 - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/JE1NORUN eq 1 /ECAM/warnings/logic/eng/eng-1-tla-idle-output eq 1 @@ -3176,6 +3176,82 @@ 100 + + + + /systems/pressurization/cabinalt-norm ge 9550 + + + + + /ECAM/warnings/timer/press/excess-cabin-alt-input + 1 + 100 + + + + + + /ECAM/warnings/timer/press/excess-cabin-alt eq 1 + + + + + + + /ECAM/warning-phase eq 3 + /ECAM/warning-phase eq 10 + + + + + + + + + /systems/navigation/adr/computation/baro-alt-corrected-1-capt ge 10000 + /systems/navigation/adr/computation/baro-alt-corrected-2-capt ge 10000 + /systems/navigation/adr/computation/baro-alt-corrected-3-capt ge 10000 + + + /systems/navigation/adr/operating-1 eq 0 + /systems/navigation/adr/operating-2 eq 0 + /systems/navigation/adr/operating-3 eq 0 + + + /ECAM/warnings/logic/press/excess-cabin-alt eq 1 + /ECAM/warnings/logic/press/excess-cabin-alt-pulse eq 1 + + + + + + + + + /systems/navigation/adr/computation/baro-alt-corrected-1-capt ge 16000 + /systems/navigation/adr/computation/baro-alt-corrected-2-capt ge 16000 + /systems/navigation/adr/computation/baro-alt-corrected-3-capt ge 16000 + + + /systems/navigation/adr/operating-1 eq 0 + /systems/navigation/adr/operating-2 eq 0 + /systems/navigation/adr/operating-3 eq 0 + + + /ECAM/warnings/logic/press/excess-cabin-alt eq 1 + /ECAM/warnings/logic/press/excess-cabin-alt-pulse eq 1 + + + + + + + /ECAM/warnings/logic/phase-3-10-pulse-input eq 1 + /ECAM/warnings/logic/phase-3-10-pulse eq 1 + + + diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index 2d30dc21..fe3297cf 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -630,6 +630,17 @@ /ECAM/warnings/logic/phase-9-pulse + + monostable + + + /ECAM/warnings/logic/phase-3-10-pulse-input + + /ECAM/warnings/logic/phase-3-10-pulse + + monostable + + monostable + + + /ECAM/warnings/logic/press/excess-cabin-alt + + /ECAM/warnings/logic/press/excess-cabin-alt-pulse + + monostable + + + SR + + /ECAM/warnings/logic/press/excess-cabin-alt-flipflop-set + + + /ECAM/warnings/logic/press/excess-cabin-alt-flipflop-reset + + /ECAM/warnings/logic/press/excess-cabin-alt-flipflop + + + + SR + + /ECAM/warnings/logic/press/excess-cabin-alt-flipflop-top-set + + + /ECAM/warnings/logic/press/excess-cabin-alt-flipflop-reset + + /ECAM/warnings/logic/press/excess-cabin-alt-flipflop-top + From d7a8bcdf2740ef76b3b21235797580c137c4ad06 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 6 Jan 2022 19:08:12 +0000 Subject: [PATCH 6/7] ADR 1+2+3 FAULT --- Nasal/ECAM/ECAM-logic.nas | 113 +++++++++++++++++++++++++++++++++++++- Nasal/ECAM/ECAM-nodes.nas | 3 + Systems/a320-fwc.xml | 39 +++++++++++-- 3 files changed, 149 insertions(+), 6 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index ee4f4747..cc08febc 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -574,6 +574,61 @@ var messages_priority_3 = func { ECAM_controller.warningReset(apuFireMaster); } + if (ADR123Fault.clearFlag == 0 and warningNodes.Logic.adr123Fault.getValue() and phaseVar3 != 4 and phaseVar3 != 8) { + ADR123Fault.active = 1; + + if (ADR123FaultAP.clearFlag == 0 and (fmgc.Output.ap1.getBoolValue() or fmgc.Output.ap2.getBoolValue() or fmgc.Output.fd1.getBoolValue() or fmgc.Output.fd2.getBoolValue())) { + ADR123FaultAP.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultAP); + } + + if (ADR123FaultATHR.clearFlag == 0 and fmgc.Output.athr.getBoolValue()) { + ADR123FaultATHR.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultATHR); + } + + if (ADR123FaultPRBW.clearFlag == 0) { + ADR123FaultPRBW.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultPRBW); + } + + if (ADR123FaultADRPB.clearFlag == 0 and (systems.ADIRS.Switches.adrSw[0].getBoolValue() or systems.ADIRS.Switches.adrSw[1].getBoolValue() or systems.ADIRS.Switches.adrSw[2].getBoolValue())) { + ADR123FaultADRPB.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultADRPB); + } + + if (ADR123FaultSPD.clearFlag == 0) { + ADR123FaultSPD.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultSPD); + } + + if (ADR123FaultSTBY.clearFlag == 0) { + ADR123FaultSTBY.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultSTBY); + } + + if (ADR123FaultPROC.clearFlag == 0) { + ADR123FaultPROC.active = 1; + } else { + ECAM_controller.warningReset(ADR123FaultPROC); + } + } else { + ECAM_controller.warningReset(ADR123Fault); + ECAM_controller.warningReset(ADR123FaultAP); + ECAM_controller.warningReset(ADR123FaultATHR); + ECAM_controller.warningReset(ADR123FaultPRBW); + ECAM_controller.warningReset(ADR123FaultADRPB); + ECAM_controller.warningReset(ADR123FaultSPD); + ECAM_controller.warningReset(ADR123FaultSTBY); + ECAM_controller.warningReset(ADR123FaultPROC); + } + if ((ecamConfigTest.getValue() and (phaseVar3 == 1 or phaseVar3 == 2 or phaseVar3 == 9)) or phaseVar3 == 3 or phaseVar3 == 4) { takeoffConfig = 1; } else { @@ -659,7 +714,7 @@ var messages_priority_3 = func { } if (warningNodes.Flipflops.cabPressExcessFlipflop.getValue()) { - if (excessCabAltTHRLVR.clearFlag == 0 and !fmgc.Output.athr.getBoolValue() and warningNodes.Logic.JE1TLAI.getValue() != 0 and warningNodes.Logic.JE2TLAI.getValue() != 0) { + if (excessCabAltTHRLVR.clearFlag == 0 and !fmgc.Output.athr.getBoolValue() and warningNodes.Logic.JE1TLAI.getValue() == 0 and warningNodes.Logic.JE2TLAI.getValue() == 0) { excessCabAltTHRLVR.active = 1; } else { ECAM_controller.warningReset(excessCabAltTHRLVR); @@ -695,7 +750,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(excessCabAltENG); ECAM_controller.warningReset(excessCabAltATC); } - + if (warningNodes.Flipflops.cabPressExcessFlipflopTop.getValue() and !warningNodes.Flipflops.cabPressExcessFlipflop.getValue()) { if (excessCabAltCAB.clearFlag == 0) { excessCabAltCAB.active = 1; @@ -759,6 +814,60 @@ var messages_priority_3 = func { ECAM_controller.warningReset(excessCabAltMasks); } + if (eng1OilLoPr.clearFlag == 0 and warningNodes.Logic.eng1OilLoPr.getBoolValue() and phaseVar3 != 1 and phaseVar3 != 10) { + eng1OilLoPr.active = 1; + + if (eng1OilLoPrIf.clearFlag == 0 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { + eng1OilLoPrIf.active = 1; + } else { + ECAM_controller.warningReset(eng1OilLoPrIf); + } + + if (eng1OilLoPrThrot.clearFlag == 0 and !warningNodes.Logic.JE1TLAI.getValue()) { + eng1OilLoPrThrot.active = 1; + } else { + ECAM_controller.warningReset(eng1OilLoPrThrot); + } + + if (eng1OilLoPrMaster.clearFlag == 0 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { + eng1OilLoPrMaster.active = 1; + } else { + ECAM_controller.warningReset(eng1OilLoPrMaster); + } + } else { + ECAM_controller.warningReset(eng1OilLoPr); + ECAM_controller.warningReset(eng1OilLoPrIf); + ECAM_controller.warningReset(eng1OilLoPrThrot); + ECAM_controller.warningReset(eng1OilLoPrMaster); + } + + if (eng2OilLoPr.clearFlag == 0 and warningNodes.Logic.eng2OilLoPr.getBoolValue() and phaseVar3 != 1 and phaseVar3 != 10) { + eng2OilLoPr.active = 1; + + if (eng2OilLoPrIf.clearFlag == 0 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { + eng2OilLoPrIf.active = 1; + } else { + ECAM_controller.warningReset(eng2OilLoPrIf); + } + + if (eng2OilLoPrThrot.clearFlag == 0 and !warningNodes.Logic.JE2TLAI.getValue()) { + eng2OilLoPrThrot.active = 1; + } else { + ECAM_controller.warningReset(eng2OilLoPrThrot); + } + + if (eng2OilLoPrMaster.clearFlag == 0 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { + eng2OilLoPrMaster.active = 1; + } else { + ECAM_controller.warningReset(eng2OilLoPrMaster); + } + } else { + ECAM_controller.warningReset(eng2OilLoPr); + ECAM_controller.warningReset(eng2OilLoPrIf); + ECAM_controller.warningReset(eng2OilLoPrThrot); + ECAM_controller.warningReset(eng2OilLoPrMaster); + } + if (lrElevFault.clearFlag == 0 and warningNodes.Timers.LRElevFault.getValue() == 1) { lrElevFault.active = 1; if (lrElevFaultSpeed.clearFlag == 0) { diff --git a/Nasal/ECAM/ECAM-nodes.nas b/Nasal/ECAM/ECAM-nodes.nas index 1fcddb63..f14b0d0c 100644 --- a/Nasal/ECAM/ECAM-nodes.nas +++ b/Nasal/ECAM/ECAM-nodes.nas @@ -76,6 +76,9 @@ var warningNodes = { Logic: { JE1TLAI: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-tla-idle"), JE2TLAI: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-tla-idle"), + adr123Fault: props.globals.initNode("/ECAM/warnings/navigation/ADR123-fault"), + eng1OilLoPr: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-oil-lo-pr"), + eng2OilLoPr: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-oil-lo-pr"), altitudeAlert: props.globals.initNode("/ECAM/warnings/altitude-alert/c-chord"), altitudeAlertSteady: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-steady"), altitudeAlertFlash: props.globals.initNode("/ECAM/warnings/altitude-alert/altitude-alert-flash"), diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index aa8db4c7..8b626bdd 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -3124,6 +3124,36 @@ + + /controls/engines/engine[0]/cutoff-switch + 0.03333333333 + 100 + + + + + + /ECAM/warnings/logic/eng/eng-1-oil-lo-pr-cutoff-delay eq 0 + /ECAM/warnings/logic/eng/JE1NORUN eq 0 + /engines/engine[0]/oil-psi-actual lt 13 + + + + + /controls/engines/engine[1]/cutoff-switch + 0.03333333333 + 100 + + + + + + /ECAM/warnings/logic/eng/eng-2-oil-lo-pr-cutoff-delay eq 0 + /ECAM/warnings/logic/eng/JE2NORUN eq 0 + /engines/engine[1]/oil-psi-actual lt 13 + + + @@ -4222,7 +4252,7 @@ - + From b1b380f9865889c5b735c8028c39d01ba6860dc0 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Thu, 6 Jan 2022 19:18:40 +0000 Subject: [PATCH 7/7] Bugfix --- Nasal/ECAM/ECAM-messages.nas | 2 +- Systems/a320-fwc.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index fb10fbeb..63e389d8 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -93,7 +93,7 @@ var warnings = std.Vector.new([ var apuFireMaster = warning.new(msg: " -MASTER SW..........OFF", colour: "c"), # ADR 1 + 2 + 3 FAULT - var ADR123Fault = warning.new(msg: "NAV ADR1+2+3 FAULT ", colour: "r", aural: 0, light: 0, isMainMsg: 1), + var ADR123Fault = warning.new(msg: "NAV ADR 1+2+3 FAULT ", colour: "r", aural: 0, light: 0, isMainMsg: 1), var ADR123FaultAP = warning.new(msg: " -AP+FD..............OFF", colour: "c"), var ADR123FaultATHR = warning.new(msg: " -ATHR...............OFF", colour: "c"), var ADR123FaultPRBW = warning.new(msg: " -PROBE/WINDOW HEAT...ON", colour: "c"), diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 8b626bdd..6ce25114 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -1623,7 +1623,7 @@ - /engines/engine[0]/n2-actual ge 59.4 + /engines/engine[1]/n2-actual ge 59.4