From 60ea0f62ff6df112d5e5dbe84941c43a29a895db Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Wed, 27 Oct 2021 18:31:27 +0100 Subject: [PATCH] FCU: 250ms delay on failure during transients --- Nasal/ECAM/ECAM-logic.nas | 82 +++++++++++++++++++-------------------- Nasal/ECAM/ECAM-main.nas | 2 +- Nasal/FMGC/FCU.nas | 18 +++++++-- 3 files changed, 56 insertions(+), 46 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 12fb1791..a1c9767b 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -2246,31 +2246,7 @@ var messages_priority_2 = func { ECAM_controller.warningReset(fac2FaultFacOff); } - if (yawDamper1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper1Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { - yawDamper1Fault.active = 1; - } else { - ECAM_controller.warningReset(yawDamper1Fault); - } - - if (yawDamper2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper2Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { - yawDamper2Fault.active = 1; - } else { - ECAM_controller.warningReset(yawDamper2Fault); - } - - if (rudTravLimSys1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu1Fault.getBoolValue()) { - rudTravLimSys1Fault.active = 1; - } else { - ECAM_controller.warningReset(rudTravLimSys1Fault); - } - - if (rudTravLimSys2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu2Fault.getBoolValue()) { - rudTravLimSys2Fault.active = 1; - } else { - ECAM_controller.warningReset(rudTravLimSys2Fault); - } - - if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault.clearFlag == 0) { + if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault.clearFlag == 0) { fcuFault.active = 1; fcuFaultBaro.active = 1; } else { @@ -2278,22 +2254,6 @@ var messages_priority_2 = func { ECAM_controller.warningReset(fcuFaultBaro); } - if (fcu.FCUController.FCU1.failed and !fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault1.clearFlag == 0) { - fcuFault1.active = 1; - fcuFault1Baro.active = 1; - } else { - ECAM_controller.warningReset(fcuFault1); - ECAM_controller.warningReset(fcuFault1Baro); - } - - if (fcu.FCUController.FCU2.failed and !fcu.FCUController.FCU1.failed and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault2.clearFlag == 0) { - fcuFault2.active = 1; - fcuFault2Baro.active = 1; - } else { - ECAM_controller.warningReset(fcuFault2); - ECAM_controller.warningReset(fcuFault2Baro); - } - # FUEL if (wingLoLvl.clearFlag == 0 and warningNodes.Timers.lowLevelBoth.getValue() == 1 and (phaseVar2 <= 2 or phaseVar2 == 6 or phaseVar2 >= 9)) { wingLoLvl.active = 1; @@ -3027,6 +2987,46 @@ var messages_priority_2 = func { ECAM_controller.warningReset(wingIceOpenGndShut); } + if (yawDamper1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper1Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { + yawDamper1Fault.active = 1; + } else { + ECAM_controller.warningReset(yawDamper1Fault); + } + + if (yawDamper2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 == 9 or phaseVar2 == 6) and warningNodes.Timers.yawDamper2Fault.getValue() == 1 and !warningNodes.Logic.yawDamper12Fault.getBoolValue()) { + yawDamper2Fault.active = 1; + } else { + ECAM_controller.warningReset(yawDamper2Fault); + } + + if (rudTravLimSys1Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu1Fault.getBoolValue()) { + rudTravLimSys1Fault.active = 1; + } else { + ECAM_controller.warningReset(rudTravLimSys1Fault); + } + + if (rudTravLimSys2Fault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.rtlu2Fault.getBoolValue()) { + rudTravLimSys2Fault.active = 1; + } else { + ECAM_controller.warningReset(rudTravLimSys2Fault); + } + + if (fcu.FCUController.FCU1.failed and !fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and fcuFault1.clearFlag == 0) { + fcuFault1.active = 1; + fcuFault1Baro.active = 1; + } else { + ECAM_controller.warningReset(fcuFault1); + ECAM_controller.warningReset(fcuFault1Baro); + } + + if (fcu.FCUController.FCU2.failed and !fcu.FCUController.FCU1.failed and systems.ELEC.Bus.dc2.getValue() >= 25 and fcuFault2.clearFlag == 0) { + fcuFault2.active = 1; + fcuFault2Baro.active = 1; + } else { + ECAM_controller.warningReset(fcuFault2); + ECAM_controller.warningReset(fcuFault2Baro); + } + if (wingIceLHiPr.clearFlag == 0 and warningNodes.Timers.waiLhiPr.getValue() == 1 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6)) { wingIceLHiPr.active = 1; wingIceLHiPrThrust.active = 1; diff --git a/Nasal/ECAM/ECAM-main.nas b/Nasal/ECAM/ECAM-main.nas index 521c5c96..9deef84b 100644 --- a/Nasal/ECAM/ECAM-main.nas +++ b/Nasal/ECAM/ECAM-main.nas @@ -233,7 +233,7 @@ var ECAMRecipient = if (math.mod(notifications.frameNotification.FrameCount,10) == 0) { phaseLoop(); } - if (math.mod(notifications.frameNotification.FrameCount,10) == 5) { + if (isint(notifications.frameNotification.FrameCount / 5)) { ECAM_controller.loop(notification); } return emesary.Transmitter.ReceiptStatus_OK; diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index e2257e87..334c5c9c 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -18,8 +18,18 @@ var FCU = { f.elecSupply = elecNode; return f; }, - loop: func() { - me.failed = (me.elecSupply.getValue() < 25 or me.condition == 0) ? 1 : 0; + elec: nil, + powerOffTime: -99, + loop: func(notification) { + me.elec = me.elecSupply.getValue(); + if (me.elec < 25) { + if (me.powerOffTime == -99) { + me.powerOffTime = notification.elapsedTime; + } + } else { + me.powerOffTime = -99; + } + me.failed = ((notification.elapsedTime > (me.powerOffTime + 0.25) and me.elec < 25) or me.condition == 0) ? 1 : 0; }, setFail: func() { me.condition = 0; @@ -44,8 +54,8 @@ var FCUController = { if (me._init == 0) { return; } # Update FCU Power - me.FCU1.loop(); - me.FCU2.loop(); + me.FCU1.loop(notification); + me.FCU2.loop(notification); if (!me.FCU1.failed or !me.FCU2.failed) { me.FCUworking = 1;