From 1861639991af835d316dfe63e3e5383ea4abd3fc Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 2 May 2019 12:31:26 +0100 Subject: [PATCH] Add fire button, fix major bug in engine fire --- .../Instruments/Pedestal_up/Pedestal_up.xml | 79 +++++++++++++++++++ Nasal/ECAM/ECAM-logic.nas | 4 +- Nasal/fire.nas | 21 ++++- 3 files changed, 99 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/Pedestal_up/Pedestal_up.xml b/Models/Instruments/Pedestal_up/Pedestal_up.xml index 82ee7fd4..0a38d4a1 100644 --- a/Models/Instruments/Pedestal_up/Pedestal_up.xml +++ b/Models/Instruments/Pedestal_up/Pedestal_up.xml @@ -106,4 +106,83 @@ vu112_aids vu112_dfdr + + + select + engine_fire_1 + + systems/fire/engine1/warning-active + + + + + material + engine_fire_1 + + systems/fire/engine1/warning-active + + + 1.0 + 1.0 + 1.0 + + + + + select + engine_fault_1 + + systems/unused/unused-ped + + + + + select + engine_fire_1 + + systems/fire/engine1/warning-active + + + + + material + engine_fire_1 + + systems/fire/engine1/warning-active + + + 1.0 + 1.0 + 1.0 + + + + + select + engine_fault_2 + + systems/unused/unused-ped + + + + + select + engine_fire_2 + + systems/fire/engine2/warning-active + + + + + material + engine_fire_2 + + systems/fire/engine2/warning-active + + + 1.0 + 1.0 + 1.0 + + diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 745270e4..11afb03f 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -847,13 +847,13 @@ var messages_priority_2 = func { ECAM_controller.warningReset(apuLoopBFault); } - if (crgAftFireDetFault.clearFlag == 0 and (cargoSmokeDetectorUnits.vector[0].condition == 0 or cargoSmokeDetectorUnits.vector[1].condition == 0) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (crgAftFireDetFault.clearFlag == 0 and (systems.cargoSmokeDetectorUnits.vector[0].condition == 0 or systems.cargoSmokeDetectorUnits.vector[1].condition == 0) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { crgAftFireDetFault.active = 1; } else { ECAM_controller.warningReset(crgAftFireDetFault); } - if (crgFwdFireDetFault.clearFlag == 0 and cargoSmokeDetectorUnits.vector[2].condition == 0 and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (crgFwdFireDetFault.clearFlag == 0 and systems.cargoSmokeDetectorUnits.vector[2].condition == 0 and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { crgFwdFireDetFault.active = 1; } else { ECAM_controller.warningReset(crgFwdFireDetFault); diff --git a/Nasal/fire.nas b/Nasal/fire.nas index f6a1de73..4593f8f7 100644 --- a/Nasal/fire.nas +++ b/Nasal/fire.nas @@ -72,7 +72,6 @@ var engFireDetectorUnit = { }, update: func() { if (me.condition == 0) { return; } - foreach(var detector; engDetectorLoops.vector) { detector.updateTemp(detector.sys, detector.type); } @@ -84,7 +83,7 @@ var engFireDetectorUnit = { return; } - if ((me.loopOne == 1 and me.loopTwo == 1) or ((me.loopOne == 9 or me.loopOne == 8) and me.loopTwo == 1) or (me.loopOne == 1 and (me.loopTwo == 9 or me.loopTwo == 8))) { + if ((me.loopOne == 1 and me.loopTwo == 1) or ((me.loopOne == 9 or me.loopOne == 8) and me.loopTwo == 1) or (me.loopOne == 1 and (me.loopTwo == 9 or me.loopTwo == 8))) { me.TriggerWarning(me.sys); } }, @@ -98,6 +97,9 @@ var engFireDetectorUnit = { failUnit: func() { me.condition = 0; }, + restoreUnit: func() { + me.condition = 100; + }, fail: func(loop) { if (loop != 1 and loop != 2) { return; } @@ -106,12 +108,23 @@ var engFireDetectorUnit = { me.startFailTimer(loop); }, + restore: func(loop) { + if (loop != 1 and loop != 2) { return; } + if (loop == 1) { me.loopOne = 0; } + else { me.loopTwo = 0; } + }, noElec: func(loop) { if (loop != 1 and loop != 2) { return; } if (loop == 1) { me.loopOne = 8; } else { me.loopTwo = 8; } }, + restoreElec: func(loop) { + if (loop != 1 and loop != 2) { return; } + + if (loop == 1) { me.loopOne = 0; } + else { me.loopTwo = 0; } + }, startFailTimer: func(loop) { if (me.sys != 2) { if (loop == 1) { @@ -240,7 +253,9 @@ var detectorLoop = { updateTemp: func(system, typeLoop) { if ((me.temperature.getValue() > 250 and me.fireProp.getBoolValue()) and me.elecProp.getValue() >= 25) { me.sendSignal(system, typeLoop); - } elsif (me.elecProp.getValue() < 25) { + } elsif (me.elecProp.getValue() >= 25) { + engFireDetectorUnits.vector[system].restoreElec(typeLoop); + } else { engFireDetectorUnits.vector[system].noElec(typeLoop); } },