From 8b003bf8afc58b9f9757ab7b7cdf92d8c735d0e2 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 1 May 2019 12:59:05 +0100 Subject: [PATCH] Add fire detection warnings to engine system --- Nasal/ECAM/ECAM-logic.nas | 54 ++++++++++++++++++++++++++++++++++++ Nasal/ECAM/ECAM-messages.nas | 13 ++++++++- Nasal/fire.nas | 4 +-- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index eefaeea0..97b700b5 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -792,6 +792,60 @@ var messages_priority_2 = func { ECAM_controller.warningReset(apuEmerShutdownMast); apuEmerShutdown.hasSubmsg = 0; } + + if (eng1FireDetFault.clearFlag == 0 and (systems.engFireDetectorUnits.vector[0].condition == 0 or (systems.engFireDetectorUnits.vector[0].loopOne == 9 and systems.engFireDetectorUnits.vector[0].loopTwo == 9)) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + eng1FireDetFault.active = 1; + } else { + ECAM_controller.warningReset(eng1FireDetFault); + } + + if (eng1LoopAFault.clearFlag == 0 and (systems.engFireDetectorUnits.vector[0].loopOne == 9 or systems.engFireDetectorUnits.vector[0].loopOne == 8) and systems.engFireDetectorUnits.vector[0].loopTwo != 9 and systems.engFireDetectorUnits.vector[0].loopTwo != 8) { + eng1LoopAFault.active = 1; + } else { + ECAM_controller.warningReset(eng1LoopAFault); + } + + if (eng1LoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[0].loopOne != 9 and systems.engFireDetectorUnits.vector[0].loopOne != 8 and (systems.engFireDetectorUnits.vector[0].loopTwo == 9 or systems.engFireDetectorUnits.vector[0].loopTwo == 8)) { + eng1LoopBFault.active = 1; + } else { + ECAM_controller.warningReset(eng1LoopBFault); + } + + if (eng2FireDetFault.clearFlag == 0 and (systems.engFireDetectorUnits.vector[1].condition == 0 or (systems.engFireDetectorUnits.vector[1].loopOne == 9 and systems.engFireDetectorUnits.vector[1].loopTwo == 9)) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + eng2FireDetFault.active = 1; + } else { + ECAM_controller.warningReset(eng2FireDetFault); + } + + if (eng2LoopAFault.clearFlag == 0 and (systems.engFireDetectorUnits.vector[1].loopOne == 9 or systems.engFireDetectorUnits.vector[1].loopOne == 8) and systems.engFireDetectorUnits.vector[1].loopTwo != 9 and systems.engFireDetectorUnits.vector[1].loopTwo != 8) { + eng2LoopAFault.active = 1; + } else { + ECAM_controller.warningReset(eng2LoopAFault); + } + + if (eng2LoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[1].loopOne != 9 and systems.engFireDetectorUnits.vector[1].loopOne != 8 and (systems.engFireDetectorUnits.vector[1].loopTwo == 9 or systems.engFireDetectorUnits.vector[1].loopTwo == 8)) { + eng2LoopBFault.active = 1; + } else { + ECAM_controller.warningReset(eng2LoopBFault); + } + + if (apuFireDetFault.clearFlag == 0 and (systems.engFireDetectorUnits.vector[2].condition == 0 or (systems.engFireDetectorUnits.vector[2].loopOne == 9 and systems.engFireDetectorUnits.vector[2].loopTwo == 9)) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + apuFireDetFault.active = 1; + } else { + ECAM_controller.warningReset(apuFireDetFault); + } + + if (apuLoopAFault.clearFlag == 0 and (systems.engFireDetectorUnits.vector[2].loopOne == 9 or systems.engFireDetectorUnits.vector[2].loopOne == 8) and systems.engFireDetectorUnits.vector[2].loopTwo != 9 and systems.engFireDetectorUnits.vector[2].loopTwo != 8) { + apuLoopAFault.active = 1; + } else { + ECAM_controller.warningReset(apuLoopAFault); + } + + if (apuLoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[2].loopOne != 9 and systems.engFireDetectorUnits.vector[2].loopOne != 8 and (systems.engFireDetectorUnits.vector[2].loopTwo == 9 or systems.engFireDetectorUnits.vector[2].loopTwo == 8)) { + apuLoopBFault.active = 1; + } else { + ECAM_controller.warningReset(apuLoopBFault); + } } var messages_priority_1 = func {} diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index ce85f494..450df99e 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -132,8 +132,19 @@ var warnings = std.Vector.new([ var cargoSmokeAftAgent = warning.new(msg: "-AGENT............DISCH", colour: "c"), # APU shutdown - var apuEmerShutdown = warning.new(msg: "APU EMER SHUTDOWN", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var apuEmerShutdown = warning.new(msg: "APU EMER SHUT DOWN", colour: "a", aural: 1, light: 1, hasSubmsg: 1), var apuEmerShutdownMast = warning.new(msg: " -MASTER SW..........OFF", colour: "c"), + + # FIRE det fault + var eng1FireDetFault = warning.new(msg: "ENG 1 FIRE DET FAULT", colour: "a", aura: 1, light: 1), + var eng1LoopAFault = warning.new(msg: "ENG 1 FIRE LOOP A FAULT", colour: "a"), + var eng1LoopBFault = warning.new(msg: "ENG 1 FIRE LOOP B FAULT", colour: "a"), + var eng2FireDetFault = warning.new(msg: "ENG 2 FIRE DET FAULT", colour: "a", aura: 1, light: 1), + var eng2LoopAFault = warning.new(msg: "ENG 2 FIRE LOOP A FAULT", colour: "a"), + var eng2LoopBFault = warning.new(msg: "ENG 2 FIRE LOOP B FAULT", colour: "a"), + var apuFireDetFault = warning.new(msg: "APU FIRE DET FAULT", colour: "a", aura: 1, light: 1), + var apuLoopAFault = warning.new(msg: "APU FIRE LOOP A FAULT", colour: "a"), + var apuLoopBFault = warning.new(msg: "APU FIRE LOOP B FAULT", colour: "a"), ]); var leftmemos = std.Vector.new([ diff --git a/Nasal/fire.nas b/Nasal/fire.nas index db19ece5..f6a1de73 100644 --- a/Nasal/fire.nas +++ b/Nasal/fire.nas @@ -89,9 +89,9 @@ var engFireDetectorUnit = { } }, receiveSignal: func(type) { - if (type == 1 and me.loopOne != 9 and me.condition != 0) { + if (type == 1 and me.loopOne != 9 and me.loopOne != 8 and me.condition != 0) { me.loopOne = 1; - } elsif (type == 2 and me.loopTwo != 9 and me.condition != 0) { + } elsif (type == 2 and me.loopTwo != 9 and me.loopTwo != 8 and me.condition != 0) { me.loopTwo = 1; } },