diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 85a1d6d4..6aa50709 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -1670,8 +1670,19 @@ nasal - + + + + nasal + + + @@ -1690,8 +1701,19 @@ nasal - + + + + nasal + + + diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index fe443005..59064b80 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -2844,7 +2844,7 @@ - systems/electrical/bus/dc-ess + systems/electrical/bus/dc-service-bus 25 diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index 648741ef..431e936c 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -146,6 +146,7 @@ var status = { }; var ECAM_controller = { + _recallCounter: 0, init: func() { ECAMloopTimer.start(); me.reset(); @@ -295,12 +296,25 @@ var ECAM_controller = { } }, recall: func() { + me._recallCounter = 0; foreach (var w; warnings.vector) { if (w.clearFlag == 1) { w.noRepeat = 0; w.clearFlag = 0; + me._recallCounter += 1; } } + + if (me._recallCounter == 0) { + FWC.Btn.recallStsNormal.setValue(1); + settimer(func() { + if (FWC.Btn.recallStsNormal.getValue() == 1) { # catch unexpected error, trying something new here + FWC.Btn.recallStsNormal.setValue(0); + } else { + die("Exception in ECAM-controller.nas, line 316"); + } + }, 0.1); + } }, warningReset: func(warning) { warning.active = 0; diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 3cc59780..bf44e4c9 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -738,7 +738,7 @@ var messages_priority_3 = func { } if (!systems.cargoTestBtn.getBoolValue()) { - if (cargoSmokeFwd.clearFlag == 0 and systems.fwdCargoFireWarn.getBoolValue() and (getprop("/ECAM/warning-phase") <= 3 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") == 6)) { + if (cargoSmokeFwd.clearFlag == 0 and systems.fwdCargoFireWarn.getBoolValue() and (phaseVar <= 3 or phaseVar >= 9 or phaseVar == 6)) { cargoSmokeFwd.active = 1; } elsif (cargoSmokeFwd.clearFlag == 1 or systems.cargoTestBtnOff.getBoolValue()) { ECAM_controller.warningReset(cargoSmokeFwd); @@ -752,7 +752,7 @@ var messages_priority_3 = func { cargoSmokeFwd.hasSubmsg = 0; } - if (cargoSmokeAft.clearFlag == 0 and systems.aftCargoFireWarn.getBoolValue() and (getprop("/ECAM/warning-phase") <= 3 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") == 6)) { + if (cargoSmokeAft.clearFlag == 0 and systems.aftCargoFireWarn.getBoolValue() and (phaseVar <= 3 or phaseVar >= 9 or phaseVar == 6)) { cargoSmokeAft.active = 1; } elsif (cargoSmokeAft.clearFlag == 1 or systems.cargoTestBtnOff.getBoolValue()) { ECAM_controller.warningReset(cargoSmokeAft); @@ -781,7 +781,7 @@ var messages_priority_3 = func { } # ESS on BAT - if ((!gear.getValue() or !getprop("/controls/gear/gear-down")) and getprop("/systems/electrical/some-electric-thingie/static-inverter-timer") == 1 and getprop("/ECAM/warning-phase") >= 5 and getprop("/ECAM/warning-phase") <= 7) { + if ((!gear.getValue() or !getprop("/controls/gear/gear-down")) and getprop("/systems/electrical/some-electric-thingie/static-inverter-timer") == 1 and phaseVar >= 5 and phaseVar <= 7) { essBusOnBat.active = 1; essBusOnBatLGUplock.active = 1; essBusOnBatManOn.active = 1; @@ -798,7 +798,7 @@ var messages_priority_3 = func { } # EMER CONFIG - if (getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dualFail.active and phaseVar != 4 and phaseVar != 8 and emerconfig.clearFlag == 0) { + if (getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dualFailNode.getBoolValue() and phaseVar != 4 and phaseVar != 8 and emerconfig.clearFlag == 0) { emerconfig.active = 1; if (getprop("/systems/hydraulic/sources/rat/position") != 0 and emerconfigMinRat.clearFlag == 0) { @@ -928,8 +928,9 @@ var messages_priority_3 = func { } var messages_priority_2 = func { + phaseVar = phaseNode.getValue(); # DC EMER CONFIG - if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dcEss.getValue() < 25 and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25) { + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dcEss.getValue() < 25 and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar != 4 and phaseVar != 8) { dcEmerconfig.active = 1; dcEmerconfigManOn.active = 1; } else { @@ -937,6 +938,114 @@ var messages_priority_2 = func { ECAM_controller.warningReset(dcEmerconfigManOn); } + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dcEmerconfig.active and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar != 4 and phaseVar != 8) { + dcBus12Fault.active = 1; + dcBus12FaultBlower.active = 1; + dcBus12FaultExtract.active = 1; + dcBus12FaultBaroRef.active = 1; + dcBus12FaultIcing.active = 1; + dcBus12FaultBrking.active = 1; + } else { + ECAM_controller.warningReset(dcBus12Fault); + ECAM_controller.warningReset(dcBus12FaultBlower); + ECAM_controller.warningReset(dcBus12FaultExtract); + ECAM_controller.warningReset(dcBus12FaultBaroRef); + ECAM_controller.warningReset(dcBus12FaultIcing); + ECAM_controller.warningReset(dcBus12FaultBrking); + } + + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.acEss.getValue() < 110 and phaseVar != 4 and phaseVar != 8) { + AcBusEssFault.active = 1; + if (!systems.ELEC.Switch.acEssFeed.getBoolValue()) { + AcBusEssFaultFeed.active = 1; + } else { + ECAM_controller.warningReset(AcBusEssFaultFeed); + } + AcBusEssFaultAtc.active = 1; + } else { + ECAM_controller.warningReset(AcBusEssFault); + ECAM_controller.warningReset(AcBusEssFaultFeed); + ECAM_controller.warningReset(AcBusEssFaultAtc); + } + + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.ac1.getValue() < 110 and phaseVar != 4 and phaseVar != 8) { + AcBus1Fault.active = 1; + AcBus1FaultBlower.active = 1; + } else { + ECAM_controller.warningReset(AcBus1Fault); + ECAM_controller.warningReset(AcBus1FaultBlower); + } + + if (!dcEmerconfig.active and systems.ELEC.Bus.dcEss.getValue() < 25 and phaseVar != 4 and phaseVar != 8) { + DcEssBusFault.active = 1; + DcEssBusFaultRadio.active = 1; + DcEssBusFaultRadio2.active = 1; + DcEssBusFaultBaro.active = 1; + DcEssBusFaultGPWS.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFault); + ECAM_controller.warningReset(DcEssBusFaultRadio); + ECAM_controller.warningReset(DcEssBusFaultRadio2); + ECAM_controller.warningReset(DcEssBusFaultBaro); + ECAM_controller.warningReset(DcEssBusFaultGPWS); + } + + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.ac2.getValue() < 110 and phaseVar != 4 and phaseVar != 8) { + AcBus2Fault.active = 1; + AcBus2FaultExtract.active = 1; + } else { + ECAM_controller.warningReset(AcBus2Fault); + ECAM_controller.warningReset(AcBus2FaultExtract); + } + + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() >= 25 and phaseVar != 4 and phaseVar != 8) { + dcBus1Fault.active = 1; + dcBus1FaultBlower.active = 1; + dcBus1FaultExtract.active = 1; + } else { + ECAM_controller.warningReset(dcBus1Fault); + ECAM_controller.warningReset(dcBus1FaultBlower); + ECAM_controller.warningReset(dcBus1FaultExtract); + } + + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and systems.ELEC.Bus.dc1.getValue() >= 25 and systems.ELEC.Bus.dc2.getValue() <= 25 and phaseVar != 4 and phaseVar != 8) { + dcBus2Fault.active = 1; + dcBus2FaultAirData.active = 1; + dcBus2FaultBaro.active = 1; + } else { + ECAM_controller.warningReset(dcBus2Fault); + ECAM_controller.warningReset(dcBus2FaultAirData); + ECAM_controller.warningReset(dcBus2FaultBaro); + } + + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !dcEmerconfig.active and systems.ELEC.Bus.dcBat.getValue() < 25 and phaseVar != 4 and phaseVar != 5 and phaseVar != 7 and phaseVar != 8) { + dcBusBatFault.active = 1; + } else { + ECAM_controller.warningReset(dcBusBatFault); + } + + if (!(getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.dcEssShed.getValue() < 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and phaseVar != 4 and phaseVar != 8) { + dcBusEssShed.active = 1; + dcBusEssShedExtract.active = 1; + dcBusEssShedIcing.active = 1; + } else { + ECAM_controller.warningReset(dcBusEssShed); + ECAM_controller.warningReset(dcBusEssShedExtract); + ECAM_controller.warningReset(dcBusEssShedIcing); + } + + if (!(getprop("/systems/electrical/some-electric-thingie/emer-elec-config") and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.acEssShed.getValue() < 110 and systems.ELEC.Bus.acEss.getValue() >= 110 and phaseVar != 4 and phaseVar != 8) { + acBusEssShed.active = 1; + if (!getprop("/systems/electrical/some-electric-thingie/emer-elec-config")) { + acBusEssShedAtc.active = 1; + } else { + ECAM_controller.warningReset(acBusEssShed); + } + } else { + ECAM_controller.warningReset(acBusEssShed); + ECAM_controller.warningReset(acBusEssShedAtc); + } + if (fcu.FCUController.FCU1.failed and fcu.FCUController.FCU2.failed and systems.ELEC.Bus.dcEss.getValue() >= 25 and systems.ELEC.Bus.dcEss.getValue() >= 25) { fcuFault.active = 1; fcuFaultBaro.active = 1; @@ -962,7 +1071,7 @@ var messages_priority_2 = func { } # APU EMER SHUT DOWN - if (apuEmerShutdown.clearFlag == 0 and systems.apuEmerShutdown.getBoolValue() and !getprop("/systems/fire/apu/warning-active") and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (apuEmerShutdown.clearFlag == 0 and systems.apuEmerShutdown.getBoolValue() and !getprop("/systems/fire/apu/warning-active") and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { apuEmerShutdown.active = 1; } elsif (apuEmerShutdown.clearFlag == 1) { ECAM_controller.warningReset(apuEmerShutdown); @@ -976,90 +1085,103 @@ var messages_priority_2 = func { 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 systems.eng1Inop.getBoolValue())) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + 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 systems.eng1Inop.getBoolValue())) and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { eng1FireDetFault.active = 1; } else { ECAM_controller.warningReset(eng1FireDetFault); } - if (eng1LoopAFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[0].loopOne == 9 and systems.engFireDetectorUnits.vector[0].loopTwo != 9 and !systems.eng1Inop.getBoolValue() and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (eng1LoopAFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[0].loopOne == 9 and systems.engFireDetectorUnits.vector[0].loopTwo != 9 and !systems.eng1Inop.getBoolValue() and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { eng1LoopAFault.active = 1; } else { ECAM_controller.warningReset(eng1LoopAFault); } - if (eng1LoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[0].loopOne != 9 and systems.engFireDetectorUnits.vector[0].loopTwo == 9 and !systems.eng1Inop.getBoolValue() and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (eng1LoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[0].loopOne != 9 and systems.engFireDetectorUnits.vector[0].loopTwo == 9 and !systems.eng1Inop.getBoolValue() and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { 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 systems.eng2Inop.getBoolValue())) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + 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 systems.eng2Inop.getBoolValue())) and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { eng2FireDetFault.active = 1; } else { ECAM_controller.warningReset(eng2FireDetFault); } - if (eng2LoopAFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[1].loopOne == 9 and systems.engFireDetectorUnits.vector[1].loopTwo != 9 and !systems.eng2Inop.getBoolValue() and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (eng2LoopAFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[1].loopOne == 9 and systems.engFireDetectorUnits.vector[1].loopTwo != 9 and !systems.eng2Inop.getBoolValue() and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { eng2LoopAFault.active = 1; } else { ECAM_controller.warningReset(eng2LoopAFault); } - if (eng2LoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[1].loopOne != 9 and systems.engFireDetectorUnits.vector[1].loopTwo == 9 and !systems.eng2Inop.getBoolValue() and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (eng2LoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[1].loopOne != 9 and systems.engFireDetectorUnits.vector[1].loopTwo == 9 and !systems.eng2Inop.getBoolValue() and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { 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 systems.apuInop.getBoolValue())) and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + 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 systems.apuInop.getBoolValue())) and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { apuFireDetFault.active = 1; } else { ECAM_controller.warningReset(apuFireDetFault); } - if (apuLoopAFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[2].loopOne == 9 and systems.engFireDetectorUnits.vector[2].loopTwo != 9 and !systems.apuInop.getBoolValue() and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (apuLoopAFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[2].loopOne == 9 and systems.engFireDetectorUnits.vector[2].loopTwo != 9 and !systems.apuInop.getBoolValue() and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { apuLoopAFault.active = 1; } else { ECAM_controller.warningReset(apuLoopAFault); } - if (apuLoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[2].loopOne != 9 and systems.engFireDetectorUnits.vector[2].loopTwo == 9 and !systems.apuInop.getBoolValue() and (getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") >= 9 or getprop("/ECAM/warning-phase") <= 2)) { + if (apuLoopBFault.clearFlag == 0 and systems.engFireDetectorUnits.vector[2].loopOne != 9 and systems.engFireDetectorUnits.vector[2].loopTwo == 9 and !systems.apuInop.getBoolValue() and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { apuLoopBFault.active = 1; } else { ECAM_controller.warningReset(apuLoopBFault); } - 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)) { + if (crgAftFireDetFault.clearFlag == 0 and (systems.cargoSmokeDetectorUnits.vector[0].condition == 0 or systems.cargoSmokeDetectorUnits.vector[1].condition == 0) and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { crgAftFireDetFault.active = 1; } else { ECAM_controller.warningReset(crgAftFireDetFault); } - 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)) { + if (crgFwdFireDetFault.clearFlag == 0 and systems.cargoSmokeDetectorUnits.vector[2].condition == 0 and (phaseVar == 6 or phaseVar >= 9 or phaseVar <= 2)) { crgFwdFireDetFault.active = 1; } else { ECAM_controller.warningReset(crgFwdFireDetFault); } } -var messages_priority_1 = func {} -var messages_priority_0 = func {} +var messages_priority_1 = func { +} + +var messages_priority_0 = func { + if (FWC.Btn.recallStsNormalOutput.getBoolValue()) { + recallNormal.active = 1; + recallNormal1.active = 1; + recallNormal2.active = 1; + } else { + ECAM_controller.warningReset(recallNormal); + ECAM_controller.warningReset(recallNormal1); + ECAM_controller.warningReset(recallNormal2); + } +} var messages_config_memo = func { + phaseVar = phaseNode.getValue(); if (getprop("/controls/flight/flap-lever") == 0 or getprop("/controls/flight/flap-lever") == 4 or getprop("/controls/flight/speedbrake") != 0 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 1.75 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -3.65 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.55 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.55) { setprop("/ECAM/to-config-normal", 0); } else { setprop("/ECAM/to-config-normal", 1); } - if (getprop("/ECAM/to-config-test") and (getprop("/ECAM/warning-phase") == 2 or getprop("/ECAM/warning-phase") == 9)) { + if (getprop("/ECAM/to-config-test") and (phaseVar == 2 or phaseVar == 9)) { setprop("/ECAM/to-config-set", 1); } else { setprop("/ECAM/to-config-set", 0); } - if (!getprop("/ECAM/to-config-normal") or getprop("/ECAM/warning-phase") == 6) { + if (!getprop("/ECAM/to-config-normal") or phaseVar == 6) { setprop("/ECAM/to-config-reset", 1); } else { setprop("/ECAM/to-config-reset", 0); @@ -1105,19 +1227,19 @@ var messages_config_memo = func { toMemoLine5.colour = "c"; } - if (getprop("/ECAM/to-config-test") and (getprop("/ECAM/warning-phase") == 2 or getprop("/ECAM/warning-phase") == 9)) { + if (getprop("/ECAM/to-config-test") and (phaseVar == 2 or phaseVar == 9)) { setprop("/ECAM/to-memo-set", 1); } else { setprop("/ECAM/to-memo-set", 0); } - if (getprop("/ECAM/warning-phase") == 1 or getprop("/ECAM/warning-phase") == 3 or getprop("/ECAM/warning-phase") == 6 or getprop("/ECAM/warning-phase") == 10) { + if (phaseVar == 1 or phaseVar == 3 or phaseVar == 6 or phaseVar == 10) { setprop("/ECAM/to-memo-reset", 1); } else { setprop("/ECAM/to-memo-reset", 0); } - if ((getprop("/ECAM/warning-phase") == 2 and getprop("/ECAM/engine-start-time") != 0 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec")) or getprop("/ECAM/to-memo-flipflop")) { + if ((phaseVar == 2 and getprop("/ECAM/engine-start-time") != 0 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec")) or getprop("/ECAM/to-memo-flipflop")) { toMemoLine1.active = 1; toMemoLine2.active = 1; toMemoLine3.active = 1; @@ -1192,13 +1314,13 @@ var messages_config_memo = func { setprop("/ECAM/ldg-memo-2200-set", 0); } - if (getprop("/ECAM/warning-phase") >= 6 and getprop("/ECAM/warning-phase") <= 8) { + if (phaseVar >= 6 and phaseVar <= 8) { setprop("/ECAM/ldg-memo-2200-reset", 1); } else { setprop("/ECAM/ldg-memo-2200-reset", 0); } - if ((getprop("/ECAM/warning-phase") == 6 and getprop("/ECAM/ldg-memo-flipflop") and getprop("/ECAM/ldg-memo-2200-flipflop")) or getprop("/ECAM/warning-phase") == 7 or getprop("/ECAM/warning-phase") == 8) { + if ((phaseVar == 6 and getprop("/ECAM/ldg-memo-flipflop") and getprop("/ECAM/ldg-memo-2200-flipflop")) or phaseVar == 7 or phaseVar == 8) { ldgMemoLine1.active = 1; ldgMemoLine2.active = 1; ldgMemoLine3.active = 1; @@ -1213,7 +1335,7 @@ var messages_config_memo = func { var messages_memo = func { phaseVar = phaseNode.getValue(); - if (getprop("/services/fuel-truck/enable") == 1 and leftMsgNode.getValue() != "TO-MEMO" and leftMsgNode.getValue() != "LDG-MEMO") { + if (getprop("/services/fuel-truck/enable") == 1) { refuelg.active = 1; } else { refuelg.active = 0; @@ -1225,25 +1347,25 @@ var messages_memo = func { gnd_splrs.active = 0; } - if (getprop("/controls/lighting/seatbelt-sign") == 1 and leftMsgNode.getValue() != "TO-MEMO" and leftMsgNode.getValue() != "LDG-MEMO") { + if (getprop("/controls/lighting/seatbelt-sign") == 1) { seatbelts.active = 1; } else { seatbelts.active = 0; } - if (getprop("/controls/lighting/no-smoking-sign") == 1 and leftMsgNode.getValue() != "TO-MEMO" and leftMsgNode.getValue() != "LDG-MEMO") { # should go off after takeoff assuming switch is in auto due to old logic from the days when smoking was allowed! + if (getprop("/controls/lighting/no-smoking-sign") == 1) { # should go off after takeoff assuming switch is in auto due to old logic from the days when smoking was allowed! nosmoke.active = 1; } else { nosmoke.active = 0; } - if (getprop("/controls/lighting/strobe") == 0 and getprop("/gear/gear[1]/wow") == 0 and leftMsgNode.getValue() != "TO-MEMO" and leftMsgNode.getValue() != "LDG-MEMO") { # todo: use gear branch properties + if (getprop("/controls/lighting/strobe") == 0 and getprop("/gear/gear[1]/wow") == 0) { # todo: use gear branch properties strobe_lt_off.active = 1; } else { strobe_lt_off.active = 0; } - if (getprop("/consumables/fuel/total-fuel-lbs") < 6000 and leftMsgNode.getValue() != "TO-MEMO" and leftMsgNode.getValue() != "LDG-MEMO") { # assuming US short ton 2000lb + if (getprop("/consumables/fuel/total-fuel-lbs") < 6000) { # assuming US short ton 2000lb fob_3T.active = 1; } else { fob_3T.active = 0; @@ -1259,13 +1381,13 @@ var messages_memo = func { var messages_right_memo = func { phaseVar = phaseNode.getValue(); - if (phaseVar >= 3 and phaseVar <= 5) { + if (FWC.Timer.toInhibitOutput.getValue() == 1) { to_inhibit.active = 1; } else { to_inhibit.active = 0; } - if (phaseVar >= 7 and phaseVar <= 7) { + if (FWC.Timer.ldgInhibitOutput.getValue() == 1) { ldg_inhibit.active = 1; } else { ldg_inhibit.active = 0; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 879ea530..5f69f8cf 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -162,8 +162,58 @@ var warnings = std.Vector.new([ var emerconfigMaxSpeed = warning.new(msg: " MAX SPEED........320 KT", colour: "c"), # DC EMER CONFIG - var dcEmerconfig = warning.new(msg: "ELEC DC EMER CONFIG", colour: "a", aural: 1, light: 0, hasSubmsg: 1), - var dcEmerconfigManOn = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), + var dcEmerconfig = warning.new(msg: "ELEC DC EMER CONFIG", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var dcEmerconfigManOn = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), + + # DC BUS 1 OR 2 FAULT + var dcBus12Fault = warning.new(msg: "ELEC DC BUS 1+2 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var dcBus12FaultBlower = warning.new(msg: " -BLOWER............OVRD", colour: "c"), + var dcBus12FaultExtract = warning.new(msg: " -EXTRACT...........OVRD", colour: "c"), + var dcBus12FaultBaroRef = warning.new(msg: " -BARO REF.........CHECK", colour: "c"), + var dcBus12FaultIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), + var dcBus12FaultBrking = warning.new(msg: " MAX BRK........1000 PSI", colour: "c"), + + # AC ESS BUS FAULT + var AcBusEssFault = warning.new(msg: "ELEC AC ESS BUS FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var AcBusEssFaultFeed = warning.new(msg: " -AC ESS FEED.......ALTN", colour: "c"), + var AcBusEssFaultAtc = warning.new(msg: " -ATC..............SYS 2", colour: "c"), + + # AC BUS 1 FAULT + var AcBus1Fault = warning.new(msg: "ELEC AC BUS 1 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var AcBus1FaultBlower = warning.new(msg: " -BLOWER............OVRD", colour: "c"), + + # DC ESS BUS FAULT + var DcEssBusFault = warning.new(msg: "ELEC DC ESS BUS FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var DcEssBusFaultRadio = warning.new(msg: " -VHF 2 OR 3.........USE", colour: "c"), + var DcEssBusFaultRadio2 = warning.new(msg: " -AUDIO SWTG......SELECT", colour: "c"), + var DcEssBusFaultBaro = warning.new(msg: " -BARO REF.........CHECK", colour: "c"), + var DcEssBusFaultGPWS = warning.new(msg: " -GPWS...............OFF", colour: "c"), + + # AC BUS 2 FAULT + var AcBus2Fault = warning.new(msg: "ELEC AC BUS 2 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var AcBus2FaultExtract = warning.new(msg: " -EXTRACT...........OVRD", colour: "c"), + + # DC BUS 1 FAULT + var dcBus1Fault = warning.new(msg: "ELEC DC BUS 1 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var dcBus1FaultBlower = warning.new(msg: " -BLOWER............OVRD", colour: "c"), + var dcBus1FaultExtract = warning.new(msg: " -EXTRACT...........OVRD", colour: "c"), + + # DC BUS 2 FAULT + var dcBus2Fault = warning.new(msg: "ELEC DC BUS 2 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), + var dcBus2FaultAirData = warning.new(msg: " -AIR DATA SWTG......F/O", colour: "c"), + var dcBus2FaultBaro = warning.new(msg: " -BARO REF.........CHECK", colour: "c"), + + # DC BAT BUS FAULT + var dcBusBatFault = warning.new(msg: "ELEC DC BAT BUS FAULT", colour: "a", aural: 1, light: 1), + + # DC ESS BUS SHED + var dcBusEssShed = warning.new(msg: "ELEC DC ESS BUS SHED", colour: "a", aural: 1, light: 1), + var dcBusEssShedExtract = warning.new(msg: " -EXTRACT...........OVRD", colour: "c"), + var dcBusEssShedIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), + + # AC ESS BUS SHED + 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"), # FCU fault var fcuFault = warning.new(msg: "AUTO FLT FCU 1+2 FAULT", colour: "a", aural: 1, light: 1, hasSubmsg: 1), @@ -189,6 +239,11 @@ var warnings = std.Vector.new([ var apuLoopBFault = warning.new(msg: "APU FIRE LOOP B FAULT", colour: "a"), var crgFwdFireDetFault = warning.new(msg: "FWD CRG DET FAULT", colour: "a"), var crgAftFireDetFault = warning.new(msg: "AFT CRG DET FAULT", colour: "a"), + + # Recall + var recallNormal = warning.new(msg: " ", colour: "g", hasSubmsg: 1), + var recallNormal1 = warning.new(msg: " ", colour: "g", hasSubmsg: 1), + var recallNormal2 = warning.new(msg: " NORMAL", colour: "g", hasSubmsg: 1), ]); var configmemos = std.Vector.new([ @@ -216,7 +271,7 @@ var leftmemos = std.Vector.new([ var fob_3T = warning.new(msg: "FOB BELOW 3T" ), var gpws_flap_mode_off = warning.new(msg: "GPWS FLAP MODE OFF" ), var atc_datalink_stby = warning.new(msg: "ATC DATALINK STBY" ), # Not yet implemented - var company_datalink_stby = warning.new(msg: "COMPANY DATALINK STBY") # Not yet implemented + var company_datalink_stby = warning.new(msg: "COMPANY DATALINK STBY"), # Not yet implemented ]); # Right E/WD diff --git a/Nasal/ECAM/ECAM-phases.nas b/Nasal/ECAM/ECAM-phases.nas index 3898bcdb..bdfc3b36 100644 --- a/Nasal/ECAM/ECAM-phases.nas +++ b/Nasal/ECAM/ECAM-phases.nas @@ -21,6 +21,12 @@ var n1lim = nil; var gear_agl_cur = nil; var FWC = { + Btn: { + clr: props.globals.initNode("/ECAM/buttons/clear-btn", 0, "BOOL"), + recall: props.globals.initNode("/ECAM/buttons/recall-btn", 0, "BOOL"), + recallStsNormal: props.globals.initNode("/ECAM/buttons/recall-status-normal", 0, "BOOL"), + recallStsNormalOutput: props.globals.initNode("/ECAM/buttons/recall-status-normal-output", 0, "BOOL"), + }, Monostable: { phase1: props.globals.initNode("/ECAM/phases/monostable/phase-1-300", 0, "BOOL"), phase5: props.globals.initNode("/ECAM/phases/monostable/phase-5", 0, "BOOL"), @@ -43,20 +49,29 @@ var FWC = { phase10Set: props.globals.initNode("/ECAM/phases/flipflop/phase-10-set", 0, "BOOL"), phase10Reset: props.globals.initNode("/ECAM/phases/flipflop/phase-10-reset", 0, "BOOL"), phase10Output: props.globals.initNode("/ECAM/phases/flipflop/phase-10-output", 0, "BOOL"), + recallSet: props.globals.initNode("/ECAM/flipflop/recall-set", 0, "BOOL"), + recallReset: props.globals.initNode("/ECAM/flipflop/recall-reset", 0, "BOOL"), + recallOutput: props.globals.initNode("/ECAM/flipflop/recall-output", 0, "BOOL"), }, Timer: { eng1idle: props.globals.initNode("/ECAM/phases/timer/eng1idle", 0, "INT"), eng2idle: props.globals.initNode("/ECAM/phases/timer/eng2idle", 0, "INT"), eng1or2: props.globals.initNode("/ECAM/phases/timer/eng1or2", 0, "INT"), + toInhibit: props.globals.initNode("/ECAM/phases/timer/to-inhibit", 0, "INT"), + ldgInhibit: props.globals.initNode("/ECAM/phases/timer/ldg-inhibit", 0, "INT"), eng1idleOutput: props.globals.getNode("/ECAM/phases/timer/eng1idle-output"), eng2idleOutput: props.globals.getNode("/ECAM/phases/timer/eng2idle-output"), eng1or2Output: props.globals.initNode("/ECAM/phases/timer/eng1or2-output", 0, "INT"), + toInhibitOutput: props.globals.getNode("/ECAM/phases/timer/to-inhibit-output"), + ldgInhibitOutput: props.globals.getNode("/ECAM/phases/timer/ldg-inhibit-output"), }, speed80: props.globals.initNode("/ECAM/phases/speed-gt-80", 0, "BOOL"), toPower: props.globals.initNode("/ECAM/phases/to-power-set", 0, "BOOL"), }; var phaseLoop = func() { + if (pts.Sim.Replay.replayActive.getBoolValue()) { return; } + gear_agl = pts.Position.gearAglFt.getValue(); gear_comp = pts.Gear.compression[1].getValue(); myPhase = pts.ECAM.fwcWarningPhase.getValue(); @@ -115,14 +130,14 @@ var phaseLoop = func() { if (eng == "IAE") { eprlim = getprop("/controls/engines/epr-limit"); - if ((!getprop("/controls/engines/engine[0]/reverser") and !getprop("/controls/engines/engine[1]/reverser")) and (abs(eng1epr - eprlim) <= 0.005 or abs(eng2epr - eprlim) <= 0.005)) { + if ((!getprop("/controls/engines/engine[0]/reverser") and !getprop("/controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine1.throttle.getValue() >= 0.8 or pts.Controls.Engines.Engine2.throttle.getValue() >= 0.8) and pts.PTSSystems.Thrust.flex.getBoolValue()) or (pts.Controls.Engines.Engine1.throttle.getValue() == 1.0 or pts.Controls.Engines.Engine2.throttle.getValue() == 1.0))) { FWC.toPower.setBoolValue(1); } else { FWC.toPower.setBoolValue(0); } } else { n1lim = getprop("/controls/engines/n1-limit"); - if ((!getprop("/controls/engines/engine[0]/reverser") and !getprop("/controls/engines/engine[1]/reverser")) and (abs(eng1n1 - n1lim) <= 0.1 or abs(eng2n1 - n1lim) <= 0.1)) { + if ((!getprop("/controls/engines/engine[0]/reverser") and !getprop("/controls/engines/engine[1]/reverser")) and (((pts.Controls.Engines.Engine1.throttle.getValue() >= 0.8 or pts.Controls.Engines.Engine2.throttle.getValue() >= 0.8) and pts.PTSSystems.Thrust.flex.getBoolValue()) or (pts.Controls.Engines.Engine1.throttle.getValue() == 1.0 or pts.Controls.Engines.Engine2.throttle.getValue() == 1.0))) { FWC.toPower.setBoolValue(1); } else { FWC.toPower.setBoolValue(0); @@ -229,13 +244,42 @@ var phaseLoop = func() { if ((gnd and twoEngOff and myPhase == 9) and FWC.Monostable.phase1Output.getBoolValue()) { setPhase(10); } + + # FWC Inhibiting + myPhase = pts.ECAM.fwcWarningPhase.getValue(); + if (myPhase >= 3 and myPhase <= 5 and !FWC.Flipflop.recallOutput.getValue()) { + FWC.Timer.toInhibit.setValue(1); + } else { + FWC.Timer.toInhibit.setValue(0); + } + + if (myPhase == 7 or myPhase == 8 and !FWC.Flipflop.recallOutput.getValue()) { + FWC.Timer.ldgInhibit.setValue(1); + } else { + FWC.Timer.ldgInhibit.setValue(0); + } } var _lastPhase = nil; var setPhase = func(newPhase) { if (newPhase >= 1 and newPhase <= 10 and _lastPhase != newPhase) { pts.ECAM.fwcWarningPhase.setValue(newPhase); - print("Phase " ~ newPhase); + FWC.Flipflop.recallReset.setValue(1); + settimer(func() { + if (FWC.Flipflop.recallReset.getValue() == 1) { # catch unexpected error, trying something new here + FWC.Flipflop.recallReset.setValue(0); + } else { + die("Exception in ECAM-phases.nas, line 271"); + } + }, 0.1); _lastPhase = newPhase; } +} + +setlistener("/ECAM/buttons/recall-btn", func() { + FWC.Flipflop.recallSet.setValue(FWC.Btn.recall.getBoolValue()); +}, 0, 0); + +var clrBtn = func(btn) { + FWC.Btn.clr.setValue(btn); } \ No newline at end of file diff --git a/Nasal/property-tree-setup.nas b/Nasal/property-tree-setup.nas index 4ed28c80..bfd30e9c 100644 --- a/Nasal/property-tree-setup.nas +++ b/Nasal/property-tree-setup.nas @@ -10,10 +10,12 @@ var Controls = { Engine1: { cutoffSw: props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"), firePb: props.globals.getNode("/controls/engines/engine[0]/fire-btn"), + throttle: props.globals.getNode("/controls/engines/engine[0]/throttle"), }, Engine2: { cutoffSw: props.globals.getNode("/controls/engines/engine[1]/cutoff-switch"), firePb: props.globals.getNode("/controls/engines/engine[1]/fire-btn"), + throttle: props.globals.getNode("/controls/engines/engine[1]/throttle"), }, }, }; @@ -54,9 +56,18 @@ var Position = { }; var Sim = { + Replay: { + replayActive: props.globals.getNode("/sim/replay/replay-state"), + }, Time: { elapsedSec: props.globals.getNode("/sim/time/elapsed-sec"), }, }; +var PTSSystems = { + Thrust: { + flex: props.globals.getNode("/systems/thrust/lim-flex"), + }, +}; + setprop("/systems/acconfig/property-tree-setup-loaded", 1); diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index 50f064ed..1e28b9c8 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -695,6 +695,42 @@ + + + + /controls/electrical/switches/galley eq 1 + + /systems/electrical/relay/gen-1-glc/output ne 0 + /systems/electrical/relay/gen-2-glc/output ne 0 + + + + + + + + /systems/electrical/relay/galley-bus-1-shed-switch/contact-pos eq 1 + + + + + + + /controls/electrical/switches/galley eq 1 + + /systems/electrical/relay/gen-1-glc/output ne 0 + /systems/electrical/relay/gen-2-glc/output ne 0 + + + + + + + + /systems/electrical/relay/galley-bus-2-shed-switch/contact-pos eq 1 + + + Tell which source is being used for priority purpose @@ -1047,6 +1083,29 @@ + + + + + + + + + /systems/electrical/relay/dc-svc-bus-contactor-tr/contact-pos eq 1 + + + + + + + + + + + /systems/electrical/relay/dc-svc-bus-contactor-bus-2/contact-pos eq 1 + + + Tell which source is being used for priority purpose @@ -1103,6 +1162,15 @@ + + + + /systems/electrical/relay/dc-svc-bus-contactor-tr/output + /systems/electrical/relay/dc-svc-bus-contactor-bus-2/output + + + + @@ -1391,6 +1459,5 @@ - - + diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 9a47e538..0624ae00 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -4,7 +4,7 @@ - + Timer for the ECAM system @@ -26,6 +26,20 @@ 100 0.033 + + + Timer for the ECAM system + /ECAM/phases/timer/to-inhibit + 100 + 0.33 + + + + Timer for the ECAM system + /ECAM/phases/timer/ldg-inhibit + 100 + 0.33 + diff --git a/Systems/upper-ecam.xml b/Systems/upper-ecam.xml index 9dcc243c..b29cccb4 100644 --- a/Systems/upper-ecam.xml +++ b/Systems/upper-ecam.xml @@ -530,6 +530,17 @@ /ECAM/phases/flipflop/phase-10-output + + RS + + /ECAM/flipflop/recall-set + + + /ECAM/flipflop/recall-reset + + /ECAM/flipflop/recall-output + + monostable + + monostable + + + /ECAM/buttons/recall-status-normal + + + /ECAM/buttons/clear-btn + + /ECAM/buttons/recall-status-normal-output + + monostable