diff --git a/A320-100-CFM-set.xml b/A320-100-CFM-set.xml index 3ab703be..c1c7fe31 100644 --- a/A320-100-CFM-set.xml +++ b/A320-100-CFM-set.xml @@ -206,9 +206,9 @@ Aircraft/A320-family/Systems/fadec-cfm.xml - + Aircraft/A320-family/Systems/cfm56-sound.xml - + diff --git a/A320-200-CFM-set.xml b/A320-200-CFM-set.xml index 3c94e222..d604b43b 100644 --- a/A320-200-CFM-set.xml +++ b/A320-200-CFM-set.xml @@ -206,9 +206,9 @@ Aircraft/A320-family/Systems/fadec-cfm.xml - - Aircraft/A320-family/Systems/cfm56-sound.xml - + + Aircraft/A320-family/Systems/cfm56-sound.xml + diff --git a/A320-200-IAE-set.xml b/A320-200-IAE-set.xml index 98fa97d7..7a0f577b 100644 --- a/A320-200-IAE-set.xml +++ b/A320-200-IAE-set.xml @@ -206,9 +206,9 @@ Aircraft/A320-family/Systems/fadec-iae.xml - + Aircraft/A320-family/Systems/v2500-sound.xml - + diff --git a/A320-main.xml b/A320-main.xml index 1330016f..619482ac 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -234,15 +234,15 @@ Aircraft/A320-family/Systems/pfd.xml - + Aircraft/A320-family/Systems/sound-common.xml - - + + Aircraft/A320-family/Systems/a320-lights-proprules.xml - - + + Aircraft/A320-family/Systems/ecam-proprules.xml - + Aircraft/A320-family/Systems/pitot-static.xml @@ -652,6 +652,14 @@ 0 + + + 0 + 0 + 0 + 0 + + @@ -776,6 +784,8 @@ 0 0 + 0 + 0 0 @@ -920,7 +930,7 @@ 0 - 0 + 1 0 0 1 @@ -1348,11 +1358,14 @@ 0 0 - 0 - 0 - 0 - 0 - 0 + + 0 + 0 + 0 + 0 + 0 + 0 + @@ -1385,6 +1398,9 @@ 0 + + 0 + 0 @@ -1637,7 +1653,7 @@ - 0 + 121.5 123.2 true @@ -1825,8 +1841,9 @@ 30 10 30 - 1219 + 1525 true + 0 @@ -1839,8 +1856,9 @@ 30 10 30 - 1219 + 1525 true + 0 @@ -4677,10 +4695,7 @@ Aircraft/A320-family/Nasal/MCDU/ROUTESELECTION.nas Aircraft/A320-family/Nasal/MCDU/INITB.nas Aircraft/A320-family/Nasal/MCDU/FUELPRED.nas - Aircraft/A320-family/Nasal/MCDU/PROGTO.nas - Aircraft/A320-family/Nasal/MCDU/PROGCLB.nas - Aircraft/A320-family/Nasal/MCDU/PROGCRZ.nas - Aircraft/A320-family/Nasal/MCDU/PROGDES.nas + Aircraft/A320-family/Nasal/MCDU/PROG.nas Aircraft/A320-family/Nasal/MCDU/PERFAPPR.nas Aircraft/A320-family/Nasal/MCDU/PERFCLB.nas Aircraft/A320-family/Nasal/MCDU/PERFCRZ.nas @@ -4692,6 +4707,11 @@ Aircraft/A320-family/Nasal/MCDU/DATA2.nas Aircraft/A320-family/Nasal/MCDU/STATUS.nas + + + Aircraft/A320-family/Nasal/Displays/projection.nas + Aircraft/A320-family/Nasal/Displays/traffic.nas + Aircraft/A320-family/Models/Instruments/PFD/PFD.nas diff --git a/A320neo-CFM-set.xml b/A320neo-CFM-set.xml index 68a08ae9..a099581a 100644 --- a/A320neo-CFM-set.xml +++ b/A320neo-CFM-set.xml @@ -206,9 +206,9 @@ Aircraft/A320-family/Systems/fadec-cfm.xml - + Aircraft/A320-family/Systems/leapx-sound.xml - + diff --git a/A320neo-PW-set.xml b/A320neo-PW-set.xml index bd628100..323d8e85 100644 --- a/A320neo-PW-set.xml +++ b/A320neo-PW-set.xml @@ -206,9 +206,9 @@ Aircraft/A320-family/Systems/fadec-cfm.xml - + Aircraft/A320-family/Systems/leapx-sound.xml - + diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index c4c12d7a..e963ddc1 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -56,10 +56,12 @@ var failResetOld = func { setprop("/systems/failures/pump-green", 0); setprop("/systems/failures/pump-yellow-eng", 0); setprop("/systems/failures/pump-yellow-elec", 0); - setprop("/systems/failures/cargo-aft-fire", 0); - setprop("/systems/failures/cargo-fwd-fire", 0); - setprop("/systems/failures/engine-left-fire", 0); - setprop("/systems/failures/engine-right-fire", 0); + setprop("/systems/failures/fire/cargo-aft-fire", 0); + setprop("/systems/failures/fire/cargo-fwd-fire", 0); + setprop("/systems/failures/fire/engine-left-fire", 0); + setprop("/systems/failures/fire/apu-fire", 0); + setprop("/systems/failures/fire/engine-right-fire", 0); + setprop("/systems/failures/fire/lavatory-fire", 0); } failResetOld(); @@ -296,6 +298,7 @@ var colddark = func { setprop("/controls/lighting/overhead-panel-knb", 0); atc.transponderPanel.modeSwitch(1); libraries.systemsInit(); + libraries.variousReset(); failResetOld(); if (getprop("/engines/engine[1]/n2-actual") < 2) { colddark_b(); @@ -341,6 +344,7 @@ var beforestart = func { setprop("/controls/gear/gear-down", 1); setprop("/controls/flight/elevator-trim", 0); libraries.systemsInit(); + libraries.variousReset(); failResetOld(); # Now the Startup! @@ -398,6 +402,9 @@ var beforestart_b = func { setprop("/controls/adirs/mcducbtn", 1); setprop("/controls/switches/beacon", 1); setprop("/controls/lighting/nav-lights-switch", 1); + setprop("/controls/switches/no-smoking-sign", 0.5); + setprop("/controls/switches/seatbelt-sign", 1); + setprop("/controls/switches/emer-lights", 0.5); setprop("/controls/radio/rmp[0]/on", 1); setprop("/controls/radio/rmp[1]/on", 1); setprop("/controls/radio/rmp[2]/on", 1); @@ -432,6 +439,7 @@ var taxi = func { setprop("/controls/gear/gear-down", 1); setprop("/controls/flight/elevator-trim", 0); libraries.systemsInit(); + libraries.variousReset(); failResetOld(); # Now the Startup! @@ -490,6 +498,9 @@ var taxi_b = func { setprop("/controls/switches/beacon", 1); setprop("/controls/switches/wing-lights", 1); setprop("/controls/lighting/nav-lights-switch", 1); + setprop("/controls/switches/no-smoking-sign", 0.5); + setprop("/controls/switches/seatbelt-sign", 1); + setprop("/controls/switches/emer-lights", 0.5); setprop("/controls/radio/rmp[0]/on", 1); setprop("/controls/radio/rmp[1]/on", 1); setprop("/controls/radio/rmp[2]/on", 1); diff --git a/AircraftConfig/fail.xml b/AircraftConfig/fail.xml index cfbe5caa..2f821e17 100644 --- a/AircraftConfig/fail.xml +++ b/AircraftConfig/fail.xml @@ -560,7 +560,7 @@ true - + true @@ -568,9 +568,9 @@ - + left - /systems/failures/cargo-aft-fire + /systems/failures/fire/cargo-aft-fire dialog-apply @@ -578,15 +578,26 @@ - + left - /systems/failures/cargo-fwd-fire + /systems/failures/fire/cargo-fwd-fire dialog-apply true - + + + + left + /systems/failures/fire/lavatory-fire + + dialog-apply + + true + + + hbox @@ -603,7 +614,7 @@ left - /systems/failures/engine-left-fire + /systems/failures/fire/engine-left-fire dialog-apply @@ -613,7 +624,7 @@ left - /systems/failures/apu-fire + /systems/failures/fire/apu-fire dialog-apply @@ -623,7 +634,7 @@ left - /systems/failures/engine-right-fire + /systems/failures/fire/engine-right-fire dialog-apply diff --git a/Models/Engines/NEO/LeapXLeft.xml b/Models/Engines/NEO/LeapXLeft.xml index 2b21519a..75b92db5 100644 --- a/Models/Engines/NEO/LeapXLeft.xml +++ b/Models/Engines/NEO/LeapXLeft.xml @@ -8,7 +8,7 @@ engines/engine[3]/n1 - systems/failures/engine-left-fire + systems/failures/fire/engine-left-fire engines/engine[0]/contrail sim/multiplay/generic/float[2] diff --git a/Models/Engines/NEO/LeapXRight.xml b/Models/Engines/NEO/LeapXRight.xml index cb6a369a..c3cc291e 100644 --- a/Models/Engines/NEO/LeapXRight.xml +++ b/Models/Engines/NEO/LeapXRight.xml @@ -8,7 +8,7 @@ engines/engine[4]/n1 - systems/failures/engine-right-fire + systems/failures/fire/engine-right-fire engines/engine[1]/contrail sim/multiplay/generic/float[3] diff --git a/Models/Engines/NEO/PW1100GLeft.xml b/Models/Engines/NEO/PW1100GLeft.xml index 7022ed79..48535219 100644 --- a/Models/Engines/NEO/PW1100GLeft.xml +++ b/Models/Engines/NEO/PW1100GLeft.xml @@ -13,7 +13,7 @@ engines/engine[3]/n1 - systems/failures/engine-left-fire + systems/failures/fire/engine-left-fire engines/engine[0]/contrail sim/multiplay/generic/float[2] diff --git a/Models/Engines/NEO/PW1100GRight.xml b/Models/Engines/NEO/PW1100GRight.xml index 49688197..6386eec8 100644 --- a/Models/Engines/NEO/PW1100GRight.xml +++ b/Models/Engines/NEO/PW1100GRight.xml @@ -13,7 +13,7 @@ engines/engine[4]/n1 - systems/failures/engine-right-fire + systems/failures/fire/engine-right-fire engines/engine[1]/contrail sim/multiplay/generic/float[3] diff --git a/Models/Engines/XMLs/a320.engine.cfm.left.xml b/Models/Engines/XMLs/a320.engine.cfm.left.xml index 4c53bba1..9dc92347 100644 --- a/Models/Engines/XMLs/a320.engine.cfm.left.xml +++ b/Models/Engines/XMLs/a320.engine.cfm.left.xml @@ -10,7 +10,7 @@ engines/engine[3]/n1 - systems/failures/engine-left-fire + systems/failures/fire/engine-left-fire engines/engine[0]/contrail sim/multiplay/generic/float[2] Aircraft/A320-family/Models/Engines/XMLs/a320.pylon.cfm.left.xml diff --git a/Models/Engines/XMLs/a320.engine.cfm.right.xml b/Models/Engines/XMLs/a320.engine.cfm.right.xml index 9236f4f3..7b26c95f 100644 --- a/Models/Engines/XMLs/a320.engine.cfm.right.xml +++ b/Models/Engines/XMLs/a320.engine.cfm.right.xml @@ -10,7 +10,7 @@ engines/engine[4]/n1 - systems/failures/engine-right-fire + systems/failures/fire/engine-right-fire engines/engine[1]/contrail sim/multiplay/generic/float[3] Aircraft/A320-family/Models/Engines/XMLs/a320.pylon.cfm.right.xml diff --git a/Models/Engines/XMLs/a320.engine.iae.left.xml b/Models/Engines/XMLs/a320.engine.iae.left.xml index 77daff5c..79fe8ccd 100644 --- a/Models/Engines/XMLs/a320.engine.iae.left.xml +++ b/Models/Engines/XMLs/a320.engine.iae.left.xml @@ -10,7 +10,7 @@ engines/engine[3]/n1 - systems/failures/engine-left-fire + systems/failures/fire/engine-left-fire engines/engine[0]/contrail sim/multiplay/generic/float[2] Aircraft/A320-family/Models/Engines/XMLs/a320.pylon.iae.left.xml diff --git a/Models/Engines/XMLs/a320.engine.iae.right.xml b/Models/Engines/XMLs/a320.engine.iae.right.xml index e3ae99a8..6254b942 100644 --- a/Models/Engines/XMLs/a320.engine.iae.right.xml +++ b/Models/Engines/XMLs/a320.engine.iae.right.xml @@ -10,7 +10,7 @@ engines/engine[4]/n1 - systems/failures/engine-right-fire + systems/failures/fire/engine-right-fire engines/engine[1]/contrail sim/multiplay/generic/float[3] Aircraft/A320-family/Models/Engines/XMLs/a320.pylon.iae.right.xml diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index df18e859..09bc8b6f 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -892,7 +892,81 @@ + + + rotate + atc_abv + 35 + 0 + + atc_abv.axis + + controls/atc/abv-blw + + + pick + atc_abv + + + + + property-cycle + controls/atc/abv-blw + -1 + 0 + 1 + + + + + + + property-cycle + controls/atc/abv-blw + 1 + 0 + -1 + + + + + + rotate + atc_thrt + -30 + 0 + + atc_thrt.axis + + controls/atc/thrt-all + + + + pick + atc_thrt + + + + + property-cycle + controls/atc/thrt-all + 0 + 1 + + + + + + + property-cycle + controls/atc/thrt-all + 0 + 1 + + + + PFD1 @@ -1367,14 +1441,32 @@ - - systems/electrical/bus/dc-ess - 25 - + + + systems/electrical/bus/dc-ess + 25 + + property-toggle controls/switches/terr_on_nd_l + + + + + systems/electrical/bus/dc-ess + 25 + + + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit + 0 + + + + property-toggle + instrumentation/efis/inputs/terr + @@ -1408,14 +1500,32 @@ - - systems/electrical/bus/dc-ess - 25 - + + + systems/electrical/bus/dc-ess + 25 + + property-toggle controls/switches/terr_on_nd_r + + + + + systems/electrical/bus/dc-ess + 25 + + + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit + 0 + + + + property-toggle + instrumentation/efis[1]/inputs/terr + @@ -8668,6 +8778,40 @@ + + + pick + chrono_cpt + + + false + + property-cycle + /instrumentation/efis/inputs/CHRONO + 0 + 1 + 2 + + + + + + + pick + chrono_fo + + + false + + property-cycle + /instrumentation/efis[1]/inputs/CHRONO + 0 + 1 + 2 + + + + diff --git a/Models/Fuselages/A320-100/fuselage.xml b/Models/Fuselages/A320-100/fuselage.xml index 380343cb..e326fde7 100644 --- a/Models/Fuselages/A320-100/fuselage.xml +++ b/Models/Fuselages/A320-100/fuselage.xml @@ -32,7 +32,7 @@ 0.95 - systems/failures/apu-fire + systems/failures/fire/apu-fire diff --git a/Models/Fuselages/A320/fuselage.xml b/Models/Fuselages/A320/fuselage.xml index 380343cb..e326fde7 100644 --- a/Models/Fuselages/A320/fuselage.xml +++ b/Models/Fuselages/A320/fuselage.xml @@ -32,7 +32,7 @@ 0.95 - systems/failures/apu-fire + systems/failures/fire/apu-fire diff --git a/Models/Fuselages/A320neo/fuselage.xml b/Models/Fuselages/A320neo/fuselage.xml index 380343cb..e326fde7 100644 --- a/Models/Fuselages/A320neo/fuselage.xml +++ b/Models/Fuselages/A320neo/fuselage.xml @@ -32,7 +32,7 @@ 0.95 - systems/failures/apu-fire + systems/failures/fire/apu-fire diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index cd696c70..9080a003 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -270,8 +270,6 @@ var input = { "altitude_ind": "/instrumentation/altimeter/indicated-altitude-ft-pfd", "altimeter_mode": "/instrumentation/altimeter[0]/std", "attReset": "/instrumentation/iesi/att-reset", - "dcEss": "/systems/electrical/bus/dc-ess", - "dcHot1": "/systems/electrical/bus/dc-hot-1", "iesiBrt": "/controls/lighting/DU/iesi", "iesiInit": "/instrumentation/iesi/iesi-init", "mach": "/instrumentation/airspeed-indicator/indicated-mach", diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index cbfddbc6..feaae20f 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -3010,7 +3010,7 @@ var canvas_lowerECAM_wheel = { rightdoor = gear_door_R.getValue(); nosedoor = gear_door_N.getValue(); gearlvr = gear_down.getValue(); - askidsw = systems.HYD.Brakes.askidSw.getBoolValue(); + askidsw = systems.HYD.Switch.nwsSwitch.getBoolValue(); brakemode = systems.HYD.Brakes.mode.getBoolValue(); accum = systems.HYD.Brakes.accumPressPsi.getBoolValue(); diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 4601d4cd..1142c943 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -151,7 +151,6 @@ var baro = props.globals.getNode("/FMGC/internal/baro", 1); # GA PERF # AOC - SENSORS -var parking_brake = props.globals.getNode("/controls/gear/brake-parking", 1); var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); var doorL1_pos = props.globals.getNode("/sim/model/door-positions/doorl1/position-norm", 1); #FWD door var doorR1_pos = props.globals.getNode("/sim/model/door-positions/doorr1/position-norm", 1); #FWD door @@ -165,6 +164,7 @@ var activeAtsu = [props.globals.getNode("/MCDU[0]/atsu-active", 1), props.global props.globals.initNode("/MCDU[0]/active-system", "", "STRING"); props.globals.initNode("/MCDU[1]/active-system", "", "STRING"); + # Conversion factor pounds to kilogram var LBS2KGS = 0.4535924; @@ -172,6 +172,17 @@ var LBS2KGS = 0.4535924; # Create Nodes: var pageSwitch = [props.globals.initNode("/MCDU[0]/internal/switch", 0, "BOOL"), props.globals.initNode("/MCDU[1]/internal/switch", 0, "BOOL")]; +# Page freeze on POSMON +var pageFreezed = [nil,nil]; +var togglePageFreeze = func(i) { + if (pageFreezed[i] == nil) { + pageFreezed[i] = sprintf("%02d%02d", getprop("/sim/time/utc/hour"), getprop("/sim/time/utc/minute")); + } else { + pageFreezed[i] = nil; + } +} + + var canvas_MCDU_base = { init: func(canvas_group, file) { var font_mapper = func(family, weight) { @@ -227,6 +238,8 @@ var canvas_MCDU_base = { me["PERFGA_OE"].setColor(BLUE); me.page = canvas_group; + + me.updateretard = 0; # skip a few page update to save CPU return me; }, @@ -348,6 +361,10 @@ var canvas_MCDU_base = { me.fontSizeLeftS(small, small, small, small, small, small); me.fontSizeRight(normal, normal, normal, normal, normal, normal); me.fontSizeRightS(small, small, small, small, small, small); + me.fontCenter(default, default, default, default, default, default); + me.fontCenterS(default, default, default, default, default, default); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); + me.fontSizeCenterS(small, small, small, small, small, small); }, standardFontColour: func() { me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); @@ -357,6 +374,43 @@ var canvas_MCDU_base = { me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); }, + getLatLogFormatted: func(rootpropname) { + var dms = getprop(rootpropname ~ "latitude-deg"); + var degrees = int(dms); + var minutes = sprintf("%.1f",abs((dms - degrees) * 60)); + var sign = degrees >= 0 ? "N" : "S"; + var dms2 = getprop(rootpropname ~ "longitude-deg"); + var degrees2 = int(dms2); + var minutes2 = sprintf("%.1f",abs((dms2 - degrees2) * 60)); + var sign2 = degrees2 >= 0 ? "E" : "W"; + return sprintf("%d%.1f%s/%07s%s",abs(degrees),minutes,sign,abs(degrees2) ~ minutes2,sign2); + }, + getLatLogFormatted2: func(rootpropname) { + var dms = getprop(rootpropname ~ "latitude-deg"); + var degrees = int(dms); + var minutes = sprintf("%.1f",abs((dms - degrees) * 60)); + var sign = degrees >= 0 ? "N" : "S"; + var dms2 = getprop(rootpropname ~ "longitude-deg"); + var degrees2 = int(dms2); + var minutes2 = sprintf("%.1f",abs((dms2 - degrees2) * 60)); + var sign2 = degrees2 >= 0 ? "E" : "W"; + return sprintf("%d %.1f%s/%03s %.1f%s",abs(degrees),minutes,sign,abs(degrees2),minutes2,sign2); + }, + getIRSStatus: func(a,b = 0) { + var irsstatus = "INVAL"; + if (systems.ADIRS.ADIRunits[a].operative) { + if (systems.ADIRS.Operating.aligned[a].getValue()) { + irsstatus = (systems.ADIRS.ADIRunits[a].mode == 2) ? "ATT" : "NAV"; + } else { + if (b) { + irsstatus = "ALIGN TTN" ~ sprintf("%2d",math.round(systems.ADIRS.ADIRunits[a]._alignTime) / 60); + } else { + irsstatus = "ALIGN"; + } + } + } + return irsstatus; + }, updateCommon: func(i) { page = pageProp[i].getValue(); if (page != "NOTIFICATION") { @@ -789,8 +843,8 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - me["Simple_R1S"].setText(sprintf("%-10s",(parking_brake.getValue() == 1) ? "SET" : "RELEASED")); - me["Simple_R1"].setText(sprintf("%-10s",(gear0_wow.getValue() == 1) ? "GROUND" : "FLIGHT")); + me["Simple_R1S"].setText(sprintf("%-10s",(pts.Controls.Gear.parkingBrake.getValue() == 1) ? "SET" : "RELEASED")); + me["Simple_R1"].setText(sprintf("%-10s",(pts.Gear.wow[0].getValue() == 1) ? "GROUND" : "FLIGHT")); me["Simple_R2S"].setText(sprintf("%-10s",(doorL1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); me["Simple_R2"].setText(sprintf("%-10s",(doorR1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); me["Simple_R3S"].setText(sprintf("%-10s",(doorL4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED")); @@ -2253,12 +2307,12 @@ var canvas_MCDU_base = { me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); - me["Simple_Title"].setText("POSITION MONITOR"); + me["Simple_Title2"].setColor(GREEN); me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); - me.showLeftS(-1, -1, -1, -1, 1, -1); + me.showLeftS(-1, 1, 1, -1, 1, -1); me.showLeftArrow(-1, -1, -1, -1, -1, 1); me.showCenter(-1, -1, -1, -1, 1, -1); me["Simple_C3B"].hide(); @@ -2276,26 +2330,228 @@ var canvas_MCDU_base = { me.colorRight("grn", "grn", "grn", "grn", "grn", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me["Simple_C5"].setColor(GREEN); + me["Simple_L5"].setFontSize(small); + me["Simple_C5"].setFontSize(small); + me["Simple_R5"].setFontSize(small); + + pageFreezed[i] = nil; + + me.updateretard = 0; pageSwitch[i].setBoolValue(1); } + + if (me.updateretard <= 0) { + if (pageFreezed[i] == nil) { + + me["Simple_Title"].setText("POSITION MONITOR"); + me["Simple_Title2"].hide(); + me["Simple_L6"].setText(" FREEZE"); + + me["Simple_L1"].setText("FMGC1"); + me["Simple_L2"].setText("FMGC2"); + me["Simple_L3"].setText("GPIRS"); + me["Simple_L4"].setText("MIX IRS"); + me["Simple_L5S"].setText(" IRS1"); + me["Simple_R5S"].setText("IRS3 "); + me["Simple_R6S"].setText("SEL "); + me["Simple_R6"].setText("NAVAIDS "); + me["Simple_C5S"].setText("IRS2"); + + var latlog = me.getLatLogFormatted("/position/"); # current sim lat/log (formatted) cached for fast excecution + #TODO - IRS emulation + + if (systems.ADIRS.Operating.aligned[0].getValue()) { # TODO real FMGC1 GPS data + me["Simple_R1"].setText(latlog); + me["Simple_R1"].setColor(GREEN); + me["Simple_L2S"].setText(sprintf("%16s","3IRS/GPS")); + } else { + me["Simple_R1"].setText("----.--/-----.--"); + me["Simple_R1"].setColor(WHITE); + me["Simple_L2S"].setText(""); + } + + if (systems.ADIRS.Operating.aligned[1].getValue()) { # TODO real FMGC2 GPS data + me["Simple_R2"].setText(latlog); + me["Simple_R2"].setColor(GREEN); + me["Simple_L3S"].setText(sprintf("%16s","3IRS/GPS")); + } else { + me["Simple_R2"].setText("----.--/-----.--"); + me["Simple_R2"].setColor(WHITE); + me["Simple_L3S"].setText(""); + } + + if (systems.ADIRS.Operating.aligned[0].getValue() or systems.ADIRS.Operating.aligned[1].getValue() or systems.ADIRS.Operating.aligned[2].getValue()) { + me["Simple_R3"].setText(latlog); # GPIRS + me["Simple_R3"].setColor(GREEN); + me["Simple_R4"].setText(latlog); # MIXIRS + me["Simple_R4"].setColor(GREEN); + } else { + me["Simple_R3"].setText("----.--/-----.--"); # GPIRS not available + me["Simple_R3"].setColor(WHITE); + me["Simple_R4"].setText("----.--/-----.--"); # MIXIRS not available + me["Simple_R4"].setColor(WHITE); + } + + var Simple_row5 = ["Simple_L5","Simple_C5","Simple_R5"]; + + for ( var a=0; a<3; a+=1 ) { + if (systems.ADIRS.Operating.aligned[a].getValue()) { + me[Simple_row5[a]].setText(sprintf("%-8s",(systems.ADIRS.ADIRunits[a].mode == 2) ? "ATT" : "NAV 0.0")); + } else { + me[Simple_row5[a]].setText(sprintf("%-8s",me.getIRSStatus(a))); + } + } + + } else { + + me["Simple_Title"].setText("POSITION FROZEN AT "); + me["Simple_Title2"].setText(sprintf("%23s ",pageFreezed[i])); + me["Simple_Title2"].show(); + me["Simple_L6"].setText(" UNFREEZE"); + + } + + } + + if (me.updateretard < 0) me.updateretard = 2; + else me.updateretard -= 1; + + } else if (page == "IRSMON") { + if (!pageSwitch[i].getBoolValue()) { + + me.defaultHideWithCenter(); + me.standardFontSize(); + + me.defaultPageNumbers(); + + me.showLeft(1, 1, 1, -1, -1, -1); + me.showLeftS(-1, 1, 1, 1, -1, -1); + me.showLeftArrow(1, 1, 1, -1, -1, -1); + me.showCenter(-1, -1, -1, -1, -1, -1); + me.showCenterS(-1, -1, -1, -1, -1, -1); + me.showRight(-1, -1, -1, -1, -1, -1); + me.showRightS(1, 1, 1, 1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + + me["arrowsDepArr"].hide(); + me["PERFAPPR"].hide(); + me["PERFGA"].hide(); + me["Simple_L0S"].hide(); + me["Simple_Title"].show(); + + me.colorLeft("wht", "wht", "wht", "ack", "ack", "ack"); + me.colorLeftS("ack", "grn", "grn", "grn", "ack", "ack"); + me.colorCenter("wht", "grn", "grn", "grn", "ack", "ack"); + me.colorRightS("amb", "grn", "grn", "grn", "ack", "ack"); + me.colorLeftArrow("wht", "wht", "wht", "ack", "ack", "ack"); + + me["Simple_Title"].setText("IRS MONITOR"); + + me["Simple_L1"].setText(" IRS1"); + me["Simple_L2"].setText(" IRS2"); + me["Simple_L3"].setText(" IRS3"); + me["Simple_C1"].setText("EXCESS MOTION"); + me["Simple_C2"].setText("EXCESS MOTION"); + me["Simple_C3"].setText("EXCESS MOTION"); + me["Simple_C1"].setFontSize(small); + me["Simple_C2"].setFontSize(small); + me["Simple_C3"].setFontSize(small); + me["Simple_R1S"].setText(""); + + #TODO - Missing SET HDG on degraded operations + + pageSwitch[i].setBoolValue(1); + } - me["Simple_L1"].setText("FMGC1"); - me["Simple_L2"].setText("FMGC2"); - me["Simple_L3"].setText("GPIRS"); - me["Simple_L4"].setText("MIX IRS"); - me["Simple_L5"].setText("NAV -.-"); - me["Simple_L6"].setText(" FREEZE"); - me["Simple_L5S"].setText(" IRS1"); - me["Simple_R1"].setText("----.-X/-----.-X"); - me["Simple_R2"].setText("----.-X/-----.-X"); - me["Simple_R3"].setText("----.-X/-----.-X"); - me["Simple_R4"].setText("----.-X/-----.-X"); - me["Simple_R5"].setText("NAV -.-"); - me["Simple_R5S"].setText("IRS3 "); - me["Simple_R6S"].setText("SEL "); - me["Simple_C5"].setText("NAV -.-"); - me["Simple_C5S"].setText("IRS2"); + var rows = ["Simple_L2S","Simple_L3S","Simple_L4S"]; + var center = ["Simple_C1","Simple_C2","Simple_C3"]; + for (var a = 0; a<3; a+=1) { + me[rows[a]].setText(" " ~ me.getIRSStatus(a,1)); + if (systems.ADIRS.ADIRunits[a]._excessMotion) { + me[center[a]].show(); + } else { + me[center[a]].hide(); + } + } + + if (fmgc.FMGCInternal.phase == 7) { # DONE phase + if (fmgc.FMGCInternal.arrApt != nil and fmgc.flightPlanController.flightplans[2].departure_runway != nil) { + me["Simple_R1S"].setText(sprintf("DRIFT AT %7s ",fmgc.FMGCInternal.arrApt ~ fmgc.flightPlanController.flightplans[2].departure_runway.id)); + } + me["Simple_R2S"].setText(sprintf("DRIFT %2.1fNM/H ",0)); + me["Simple_R3S"].setText(sprintf("DRIFT %2.1fNM/H ",0)); + me["Simple_R4S"].setText(sprintf("DRIFT %2.1fNM/H ",0)); + } else { + me["Simple_R1S"].setText(""); + me["Simple_R2S"].setText(""); + me["Simple_R3S"].setText(""); + me["Simple_R4S"].setText(""); + } + } else if (page == "GPSMON") { + if (!pageSwitch[i].getBoolValue()) { + + me.defaultHideWithCenter(); + me.standardFontSize(); + + me.defaultPageNumbers(); + + me.showLeft(1, 1, 1, 1, 1, 1); + me.showLeftS(1, 1, 1, 1, 1, 1); + me.showLeftArrow(-1, -1, -1, -1, -1, -1); + me.showCenter(-1, 1, 1, -1, 1, 1); + me.showCenterS(-1, 1, 1, -1, 1, 1); + me.showRight(-1, 1, 1, -1, 1, 1); + me.showRightS(-1, 1, 1, -1, 1, 1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + + me["arrowsDepArr"].hide(); + me["PERFAPPR"].hide(); + me["PERFGA"].hide(); + me["Simple_L0S"].hide(); + me["Simple_Title"].show(); + + me.colorLeft("grn", "grn", "grn", "grn", "grn", "grn"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorCenter("grn", "grn", "grn", "grn", "grn", "grn"); + me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("grn", "grn", "grn", "grn", "grn", "grn"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + + me["Simple_Title"].setText("GPS MONITOR"); + + me["Simple_L1S"].setText("GPS1 POSITION"); + me["Simple_L2S"].setText("TTRK"); + me["Simple_L3S"].setText("MERIT"); + me["Simple_L3"].setText(sprintf("%3d",((rand() * 50) - 25) + 50) ~ "M"); + me["Simple_L4S"].setText("GPS2 POSITION"); + me["Simple_L5S"].setText("TTRK"); + me["Simple_L6S"].setText("MERIT"); + me["Simple_L6"].setText(sprintf("%3d",((rand() * 50) - 25) + 50) ~ "M"); + me["Simple_C2S"].setText("UTC"); + me["Simple_C3S"].setText("GPS ALT"); + me["Simple_C5S"].setText("UTC"); + me["Simple_C6S"].setText("GPS ALT"); + me["Simple_R2S"].setText("GS"); + me["Simple_R3S"].setText("MODE/SAT"); + me["Simple_R3"].setText("NAV/" ~ sprintf("%s",int((rand() * 2) - 1) + 6) ~ " "); + me["Simple_R5S"].setText("GS"); + me["Simple_R6S"].setText("MODE/SAT"); + me["Simple_R6"].setText("NAV/" ~ sprintf("%s",int((rand() * 2) - 1) + 6) ~ " "); + pageSwitch[i].setBoolValue(1); + } + me["Simple_L1"].setText(me.getLatLogFormatted2("/position/")); + me["Simple_L2"].setText(sprintf("%-5.1f",pts.Instrumentation.GPS.trackMag.getValue() + magvar())); + me["Simple_L4"].setText(me.getLatLogFormatted2("/position/")); + me["Simple_L5"].setText(sprintf("%-5.1f",pts.Instrumentation.GPS.trackMag.getValue() + magvar())); + var gmt = string.replace(pts.Sim.Time.gmtString.getValue(),":","."); + me["Simple_C2"].setText(gmt); + me["Simple_C5"].setText(gmt); + me["Simple_C3"].setText(sprintf("%5.0f",pts.Instrumentation.GPS.altitude.getValue())); + me["Simple_C6"].setText(sprintf("%5.0f",pts.Instrumentation.GPS.altitude.getValue())); + me["Simple_R2"].setText(sprintf("%3.0f",pts.Instrumentation.GPS.gs.getValue())); + me["Simple_R5"].setText(sprintf("%3.0f",pts.Instrumentation.GPS.gs.getValue())); } else if (page == "RADNAV") { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); @@ -3576,7 +3832,8 @@ var canvas_MCDU_base = { me["Simple_L6"].setFontSize(small); } - } else if (page == "PROGPREF" or page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { + } else if (page == "PROGPREF" or page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES" or page == "PROGAPPR" or page == "PROGDONE") { + if (fmgc.FMGCInternal.phase == 0) { setprop("/MCDU[" ~ i ~ "]/page", "PROGPREF"); page = "PROGPREF"; @@ -3589,10 +3846,16 @@ var canvas_MCDU_base = { } else if (fmgc.FMGCInternal.phase == 3) { setprop("/MCDU[" ~ i ~ "]/page", "PROGCRZ"); page = "PROGCRZ"; - } else if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { + } else if (fmgc.FMGCInternal.phase == 4) { setprop("/MCDU[" ~ i ~ "]/page", "PROGDES"); page = "PROGDES"; - } + } else if (fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { + setprop("/MCDU[" ~ i ~ "]/page", "PROGAPPR"); + page = "PROGAPPR"; + } else if (fmgc.FMGCInternal.phase == 7) { + setprop("/MCDU[" ~ i ~ "]/page", "PROGDONE"); + page = "PROGDONE"; + } if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -3622,18 +3885,22 @@ var canvas_MCDU_base = { colortext[0] = "CRUISE"; } else if (page == "PROGDES") { colortext[0] = "DESCENT"; + } else if (page == "PROGAPPR") { + colortext[0] = "APPROACH"; + } else if (page == "PROGDONE") { + colortext[0] = "DONE"; } - colortext[1] = (fmgc.FMGCInternal.flightNumSet) ? fmgc.FMGCInternal.flightNum ~ " " : ""; # push title a little left + colortext[1] = (fmgc.FMGCInternal.flightNumSet and page != "PROGDONE") ? fmgc.FMGCInternal.flightNum : ""; #CHECKME - condition useful? - me["Simple_Title"].setText(colortext[0] ~ sprintf("%" ~ (size(colortext[1])+1) ~ "s"," ")); - me["Simple_Title2"].setText(sprintf("%" ~ (size(colortext[0])+1) ~ "s"," ") ~ colortext[1]); + me["Simple_Title"].setText(sprintf(" %-21s",colortext[0])); + me["Simple_Title2"].setText(sprintf("%12s %-11s","",colortext[1])); me["Simple_Title"].show(); - me["Simple_Title"].setColor(GREEN); + me["Simple_Title"].setColor((page != "PROGDONE") ? GREEN : WHITE); me["Simple_Title2"].show(); me["Simple_Title2"].setColor(WHITE); - me["Simple_PageNum"].setText("X/X"); + #me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); @@ -3654,33 +3921,48 @@ var canvas_MCDU_base = { me.fontLeftS(default, default, default, default, default, default); me.fontRight(default, symbol, symbol, symbol, default, default); me.fontRightS(default, default, default, default, default, default); - - if (page == "PROGCRZ") { - me.showLeftS(0, 0, -1, 0, 0, 0); - me.showCenterS(0, 0, 1, 0, 0, 0); - #me.showRight(0, 0, 1, 0, 0, 0); #Add when implement cruise phase - me.fontLeft(0, 0, default, 0, 0, 0); - } else if (page == "PROGDES") { - me.showRight(0, 1, 0, 0, 0, 0); - } - + me.fontSizeLeft(normal, normal, small, small, normal, small); me.fontSizeLeftS(small, small, small, small, small, small); me.fontSizeRight(normal, small, small, small, normal, small); me.fontSizeRightS(small, small, small, small, small, small); - me.fontSizeCenter(small, small, small, small, small, normal); - me.fontSizeCenterS(normal, small, small, small, small, small); + me.fontSizeCenter(small, normal, small, small, small, normal); + me.fontSizeCenterS(normal, small, small, small, small, small); me["Simple_C1S"].setFontSize(small); me.colorLeft("blu", "wht", "blu", "wht", "wht", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("mag", "blu", "blu", "blu", "grn", "grn"); + me.colorRight("mag", "wht", "blu", "blu", "grn", "grn"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorCenter("grn", "wht", "wht", "wht", "wht", "grn"); + me.colorCenter("grn", "grn", "wht", "wht", "wht", "grn"); me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht"); + + if (page == "PROGCRZ") { + me.showLeftS(0, 0, -1, 0, 0, 0); + me.showCenterS(0, 0, 1, 0, 0, 0); + #me.showRight(0, 0, 1, 0, 0, 0); #Add when implement cruise phase + me.fontLeft(0, 0, default, 0, 0, 0); + } else if (page == "PROGDES" or page == "PROGAPPR") { + me.showCenter(0, 1, 0, 0, 0, 0); + me.showRight(0, 1, 0, 0, 0, 0); + #me["Simple_C2"].setFontSize(normal); + #me["Simple_R2"].setFontSize(normal); + } + #else if (page == "PROGAPPR") { # A/C without GPS + # me["Simple_L5S"].setFontSize(small); + # me["Simple_L5S"].setColor(GREEN); + # me["Simple_L5"].setFontSize(small); + # me["Simple_L5"].setColor(GREEN); + # me["Simple_R5S"].setFontSize(small); + # me["Simple_R5S"].setColor(WHITE); + # me["Simple_R5S"].show(); + # me["Simple_R5"].setFontSize(small); + # me["Simple_R5"].setColor(WHITE); + # me.showLeftArrow(-1, 1, -1, -1, -1, -1); + #} pageSwitch[i].setBoolValue(1); } @@ -3692,7 +3974,7 @@ var canvas_MCDU_base = { me["Simple_L1"].setText(sprintf("%s", "FL" ~ fmgc.FMGCInternal.crzProg)); } } else { - me["Simple_L1"].setText("----"); + me["Simple_L1"].setText("-----"); } me["Simple_L2"].setText(" REPORT"); if (page == "PROGCRZ") { @@ -3703,7 +3985,6 @@ var canvas_MCDU_base = { me["PROG_UPDATE"].show(); me["Simple_L3"].setText(" [ ]"); } - me["Simple_L4"].setText(" ---g /----.-"); me["Simple_L5"].setText(" GPS"); me["Simple_L6"].setText("----"); me["Simple_L1S"].setText(" CRZ"); @@ -3711,19 +3992,61 @@ var canvas_MCDU_base = { me["Simple_L4S"].setText(" BRG /DIST"); me["Simple_L5S"].setText(" PREDICTIVE"); me["Simple_L6S"].setText("REQUIRED"); - me["Simple_R1"].setText("FL398"); - me["Simple_R2"].setText("VDEV = + 750 FT"); - me["Simple_R4"].setText("[ ]"); + + if (page != "PROGDONE") { + me["Simple_R1"].setText("FL398 "); + } else { + me["Simple_L1"].setText("_____"); + me["Simple_R1"].setText("----- "); + me["Simple_L1"].setColor(AMBER); + me["Simple_C1"].setColor(WHITE); + me["Simple_R1"].setColor(WHITE); + me["Simple_R5"].hide(); + } + + if (page == "PROGDES" or page == "PROGAPPR") { + var vdev = 750; #CHECKME i dunno the meaning, but I found this value in the source + var vdev_sign = (vdev>=0) ? "+" : "-"; + me["Simple_C2"].setText(sprintf("%17s%4d ",vdev_sign,abs(vdev))); + me["Simple_R2"].setText(sprintf("%30s","VDEV= FT ")); + } + + if (mcdu.bearingDistances[i].displayID != nil) { + me["Simple_R4"].setFont(default); + me["Simple_R4"].setFontSize(normal); + me["Simple_R4"].setText(mcdu.bearingDistances[i].displayID); + } else { + me["Simple_R4"].setFont(symbol); + me["Simple_R4"].setFontSize(small); + me["Simple_R4"].setText("[ ]"); + } + + if (mcdu.bearingDistances[i].selectedPoint != nil) { + me["Simple_L4"].setColor(GREEN); + me["Simple_L4"].setText(sprintf("%3.0fg /%4.1f",mcdu.bearingDistances[i].bearing,mcdu.bearingDistances[i].distance)); + } else { + me["Simple_L4"].setColor(WHITE); + me["Simple_L4"].setText(" ---g /----.-"); + } + me["Simple_R5"].setText("GPS PRIMARY"); me["Simple_R6"].setText("----"); me["Simple_R1S"].setText("REC MAX "); me["Simple_R6S"].setText("ESTIMATED"); - me["Simple_C1"].setText("----"); + me["Simple_C1"].setText("-----"); me["Simple_C1S"].setText("OPT"); me["Simple_C3S"].setText("CONFIRM UPDATE AT"); - me["Simple_C4"].setText(" TO"); + me["Simple_C4"].setText(" TO"); me["Simple_C6S"].setText("ACCUR"); - me["Simple_C6"].setText("HIGH"); + if (systems.ADIRS.Operating.aligned[0].getValue() or systems.ADIRS.Operating.aligned[1].getValue()) me["Simple_C6"].setText("HIGH"); + else me["Simple_C6"].setText("LOW"); + + #if (page == "PROGAPPR") { # A/C without GPS + # me["Simple_L5"].setText(sprintf(" DIR DIST TO DEST=%6d",0)); + # me["Simple_L5S"].setText(sprintf("REQD DIST TO LAND=%6d",0)); + # me["Simple_R5"].setText("MN"); + # me["Simple_R5S"].setText("MN"); + #} } else if (page == "PERFTO") { if (!pageSwitch[i].getBoolValue()) { @@ -3817,12 +4140,12 @@ var canvas_MCDU_base = { me["Simple_L6"].hide(); me["Simple_L6S"].hide(); } - - if (fmgc.FMGCInternal.phase > 0) { # not modifiable from TO phase + + if (fmgc.FMGCInternal.phase == 1) { # GREEN title and not modifiable on TO phase me["Simple_Title"].setColor(GREEN); me.colorLeft("grn", "grn", "grn", "blu", "grn", "wht"); me.colorRight("grn", "blu", "grn", "grn", "grn", "wht"); - } else { + } else { me["Simple_Title"].setColor(WHITE); me.colorLeft("blu", "blu", "blu", "blu", "blu", "wht"); me.colorRight("grn", "blu", "blu", "blu", "blu", "wht"); @@ -3911,6 +4234,7 @@ var canvas_MCDU_base = { me["Simple_C1S"].setText("FLP RETR"); me["Simple_C2S"].setText("SLT RETR"); me["Simple_C3S"].setText("CLEAN "); + } else if (page == "PERFCLB") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -4065,6 +4389,7 @@ var canvas_MCDU_base = { me["Simple_R6S"].setText("NEXT "); me["Simple_R6"].setText("PHASE "); + } else if (page == "PERFCRZ") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -4360,6 +4685,7 @@ var canvas_MCDU_base = { me["Simple_R6S"].setText("NEXT "); me["Simple_R6"].setText("PHASE "); + } else if (page == "PERFAPPR") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -4543,6 +4869,7 @@ var canvas_MCDU_base = { me["Simple_C2S"].setText("SLT RETR"); me["Simple_C3S"].setText("CLEAN "); me["Simple_C5S"].setText("VLS "); + } else if (page == "PERFGA") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); @@ -4860,6 +5187,8 @@ var canvas_MCDU_base = { me.dynamicPageArrowFunc(myVertRev[i]); me.colorLeftArrow(myVertRev[i].arrowsColour[0][0],myVertRev[i].arrowsColour[0][1],myVertRev[i].arrowsColour[0][2],myVertRev[i].arrowsColour[0][3],myVertRev[i].arrowsColour[0][4],myVertRev[i].arrowsColour[0][5]); + me.colorRightArrow(myVertRev[i].arrowsColour[1][0],myVertRev[i].arrowsColour[1][1],myVertRev[i].arrowsColour[1][2],myVertRev[i].arrowsColour[1][3],myVertRev[i].arrowsColour[1][4],myVertRev[i].arrowsColour[1][5]); + me.dynamicPageFontFunc(myVertRev[i]); @@ -5921,6 +6250,46 @@ var canvas_MCDU_base = { me["Simple_L6S"].setFont(f); } }, + fontCenter: func (a, b, c, d, e, f) { + if (a != 0) { + me["Simple_C1"].setFont(a); + } + if (b != 0) { + me["Simple_C2"].setFont(b); + } + if (c != 0) { + me["Simple_C3"].setFont(c); + } + if (d != 0) { + me["Simple_C4"].setFont(d); + } + if (e != 0) { + me["Simple_C5"].setFont(e); + } + if (f != 0) { + me["Simple_C6"].setFont(f); + } + }, + fontCenterS: func (a, b, c, d, e, f) { + if (a != 0) { + me["Simple_C1S"].setFont(a); + } + if (b != 0) { + me["Simple_C2S"].setFont(b); + } + if (c != 0) { + me["Simple_C3S"].setFont(c); + } + if (d != 0) { + me["Simple_C4S"].setFont(d); + } + if (e != 0) { + me["Simple_C5S"].setFont(e); + } + if (f != 0) { + me["Simple_C6S"].setFont(f); + } + }, fontRight: func (a, b, c, d, e, f) { if (a != 0) { me["Simple_R1"].setFont(a); diff --git a/Models/Instruments/ND/canvas/ND.nas b/Models/Instruments/ND/canvas/ND.nas index 809943de..5fe845d3 100644 --- a/Models/Instruments/ND/canvas/ND.nas +++ b/Models/Instruments/ND/canvas/ND.nas @@ -180,6 +180,17 @@ var canvas_nd_base = { }, }; +var ND_change_timer_fn = func { + #me.change_phase += 1; + #if (me.change_phase>2) { # phase 3 - only for older ND? + #if (me.change_phase>1) { # phase 2 hide + me.change_timer.stop(); + me.change_phase = 0; + #} else { + me.map.setVisible(1); # phase 2 + #} +}; + var canvas_ND_1 = { new: func(canvas_group) { var m = {parents: [canvas_ND_1, canvas_nd_base]}; @@ -190,6 +201,8 @@ var canvas_ND_1 = { me.NDCpt.attitude_heading_setting = -1; me.NDCpt.adirs_property = props.globals.getNode("/instrumentation/efis[0]/nd/ir-1",1); me.NDCpt.newMFD(canvas_group); + me.NDCpt.change_phase = 0; + me.NDCpt.change_timer = maketimer(0.6,me.NDCpt,ND_change_timer_fn); me.NDCpt.update(); return m; @@ -213,6 +226,8 @@ var canvas_ND_2 = { me.NDFo.attitude_heading_setting = 1; me.NDFo.adirs_property = props.globals.getNode("/instrumentation/efis[1]/nd/ir-2",1); me.NDFo.newMFD(canvas_group); + me.NDFo.change_phase = 0; + me.NDFo.change_timer = maketimer(0.4,me.NDFo,ND_change_timer_fn); me.NDFo.update(); return m; @@ -338,6 +353,56 @@ setlistener("sim/signals/fdm-initialized", func { ND_2 = canvas_ND_2.new(group_nd2); ND_2_test = canvas_ND_2_test.new(group_nd2_test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg"); + setlistener("/instrumentation/efis[0]/inputs/range-nm", func() { + canvas_nd.ND_1.NDCpt.trafficLayer.camera.range = getprop("/instrumentation/efis[0]/inputs/range-nm"); + }, 1, 0); + + setlistener("/instrumentation/efis[1]/inputs/range-nm", func() { + canvas_nd.ND_2.NDFo.trafficLayer.camera.range = getprop("/instrumentation/efis[1]/inputs/range-nm"); + }, 1, 0); + + setlistener("/instrumentation/efis[0]/inputs/nd-centered", func() { + canvas_nd.ND_1.NDCpt.trafficLayer.camera.screenRange = getprop("/instrumentation/efis[0]/inputs/nd-centered") ? 436.8545 : 710; + canvas_nd.ND_1.NDCpt.trafficLayer.camera.screenCY = getprop("/instrumentation/efis[0]/inputs/nd-centered") ? 512 : 850; + }, 1, 0); + + setlistener("/instrumentation/efis[1]/inputs/nd-centered", func() { + canvas_nd.ND_2.NDFo.trafficLayer.camera.screenRange = getprop("/instrumentation/efis[1]/inputs/nd-centered") ? 436.8545 : 710; + canvas_nd.ND_2.NDFo.trafficLayer.camera.screenCY = getprop("/instrumentation/efis[1]/inputs/nd-centered") ? 512 : 850; + }, 1, 0); + + setlistener("/instrumentation/tcas/inputs/mode", func() { + if (getprop("/instrumentation/efis[0]/nd/canvas-display-mode") != "PLAN") { + canvas_nd.ND_1.NDCpt.trafficGroup.setVisible(pts.Instrumentation.TCAS.Inputs.mode.getValue() >= 2 ? 1 : 0); + } + if (getprop("/instrumentation/efis[1]/nd/canvas-display-mode") != "PLAN") { + canvas_nd.ND_2.NDFo.trafficGroup.setVisible(pts.Instrumentation.TCAS.Inputs.mode.getValue() >= 2 ? 1 : 0); + } + }, 1, 0); + + setlistener("/instrumentation/efis[0]/nd/canvas-display-mode", func() { + canvas_nd.ND_1.NDCpt.trafficGroup.setVisible(getprop("/instrumentation/efis[0]/nd/canvas-display-mode") == "PLAN" ? 0 : 1); + }, 1, 0); + + setlistener("/instrumentation/efis[1]/nd/canvas-display-mode", func() { + canvas_nd.ND_2.NDFo.trafficGroup.setVisible(getprop("/instrumentation/efis[1]/nd/canvas-display-mode") == "PLAN" ? 0 : 1); + }, 1, 0); + + setlistener("/instrumentation/efis[0]/nd/display-mode", func { + startChangePhase(canvas_nd.ND_1.NDCpt,"MODE CHANGE"); + },0,0); + + setlistener("/instrumentation/efis[0]/inputs/range-nm", func { + startChangePhase(canvas_nd.ND_1.NDCpt,"RANGE CHANGE"); + },0,0); + setlistener("/instrumentation/efis[1]/nd/display-mode", func { + startChangePhase(canvas_nd.ND_2.NDFo,"MODE CHANGE"); + },0,0); + + setlistener("/instrumentation/efis[1]/inputs/range-nm", func { + startChangePhase(canvas_nd.ND_2.NDFo,"RANGE CHANGE"); + },0,0); + nd_update.start(); if (getprop("systems/acconfig/options/nd-rate") > 1) { rateApply(); @@ -382,14 +447,22 @@ for (i = 0; i < 2; i = i + 1 ) { }); } -setlistener("/instrumentation/efis[0]/nd/terrain-on-nd", func{ - var terr_on_hd = getprop("instrumentation/efis[0]/nd/terrain-on-nd"); - var alpha = 1; - if (terr_on_hd) { - alpha = 0.5; - } - nd_display.main.setColorBackground(0,0,0,alpha); -}); +var startChangePhase = func(nd,txt) { + nd.change_timer.stop(); + nd.map.setVisible(0); + nd.symbols.nd_msg_change.setText(txt); + nd.change_phase = 1; + nd.change_timer.start(); +} + +#setlistener("/instrumentation/efis[0]/nd/terrain-on-nd", func{ +# var terr_on_hd = getprop("instrumentation/efis[0]/nd/terrain-on-nd"); +# var alpha = 1; +# if (terr_on_hd) { +# alpha = 0.5; +# } +# nd_display.main.setColorBackground(0,0,0,alpha); +#}); setlistener("/flight-management/control/capture-leg", func(n) { var capture_leg = n.getValue(); diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 81d82153..01569ad3 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -13,6 +13,110 @@ var assert_m = canvas.assert_m; var wxr_live_tree = "/instrumentation/wxr"; var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1); +var easeArrow = { + new: func(elem) { + var m = {parents: [easeArrow]}; + m.req_rot_rad = 0; + m.req_rot_deg = 0; + m.last_rot_deg = nil; + m.last_rot_rad = 0; + m.element = elem; + m.time = 0; + m.duration = 0; + m.startval = 0; + m.diffval = 0; + return m; + }, + setVisible: func(v) { + if (v == 1 and me.last_rot_deg == nil) me.reset(); + me.element.setVisible(v); + }, + hide: func { + me.element.hide(); + }, + reset: func { + me.last_rot_deg = 360 - getprop("orientation/heading-deg"); + me.last_rot_rad = me.last_rot_deg * D2R; + me.duration = 0; + print("VOR reset"); + }, + setRotation: func(rad) { + var deg = 0; + var gap = 0; + gap = math.abs(rad - me.req_rot_rad); + if (gap>0.001) { + if (me.duration>0) gap = math.abs(rad - me.last_rot_rad); + if (gap>=180*D2R) gap = 360*D2R - gap; + deg = rad * 57.29578; + me.req_rot_rad = rad; + me.req_rot_deg = deg; + me.duration = 0; + if (gap>0.2) { + if (me.last_rot_deg == nil) me.reset(); + me.startval = me.last_rot_deg; + me.diffval = deg - me.last_rot_deg; + if (me.diffval<0) me.diffval += 360; + me.time = 0; + me.duration = math.round(me.diffval * 0.21); # rad 36/3 + } + if (me.duration < 2) { + me.last_rot_rad = rad; + me.last_rot_deg = deg; + me.element.setRotation(rad); + me.duration = 0; + } + } + if (me.duration > 0) { + var tx = me.time / me.duration; + #thanks to https://easings.net/#easeOutCubic + deg = (1 - math.pow(1 - tx, 3)) * me.diffval + me.startval; + deg = math.mod(deg,360); + #print("DEG: " ~ deg); + me.last_rot_deg = deg; + me.last_rot_rad = deg * D2R; + me.element.setRotation(me.last_rot_rad); + me.time += 1; + if (tx>=1) me.duration = 0; + } + + } +}; + +var symbolDistNM = { + new: func(name, nd) { + var m = {parents: [symbolDistNM] }; + m.group = nd.getElementById(name); + m.expn = nd.getElementById(name ~ "1"); + m.mant = nd.getElementById(name ~ "2"); + return m; + }, + hide: func { + me.group.hide(); + }, + show: func { + me.group.show(); + }, + setText: func(txt) { + var parts = ( txt != "" ) ? split( "." , txt ) : nil; + if ( parts != nil and size(parts) == 2 ) { + me.expn.setText(parts[0]); + me.mant.setText("." ~ parts[1]); + } else { + me.expn.setText(txt); + me.mant.setText(""); + } + }, + setColor: func(r,g,b) { + me.expn.setColor(r,g,b); + me.mant.setColor(r,g,b); + }, + setFloat: func(val) { + var parts = split( "." , sprintf("%03.1f",val) ); + me.expn.setText(parts[0]); + me.mant.setText("." ~ parts[1]); + } +}; + canvas.NavDisplay.set_switch = func(s, v) { var switch = me.efis_switches[s]; if(switch == nil) return nil; @@ -32,8 +136,7 @@ canvas.NavDisplay.get_nav_path = func (type, idx) { return sprintf(path, name, idx); }; -canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update_time=0.05) -{ +canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update_time=0.05) { if (me.inited) die("MFD already was added to scene"); me.range_dependant_layers = []; me.always_update_layers = {}; @@ -69,24 +172,35 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update ### this is the "old" method that"s less flexible, we want to use the style hash instead (see above) # because things are much better configurable that way # now look up all required SVG elements and initialize member fields using the same name to have a convenient handle - foreach(var element; ["dmeLDist","dmeRDist","dmeL","dmeR","vorL","vorR","vorLId","vorRId", - "status.wxr","status.wpt","status.sta","status.arpt"]) + foreach(var element; ["dmeL","dmeR","vorL","vorR","vorLId","vorRId", + "status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead"]) me.symbols[element] = me.nd.getElementById(element); + foreach(var element; ["dmeLDist","dmeRDist"]) + me.symbols[element] = symbolDistNM.new( element, me.nd ); + + me.symbols.dmeLDist.setColor(0.195,0.96,0.097); + me.symbols.dmeRDist.setColor(0.195,0.96,0.097); + # load elements from vector image, and create instance variables using identical names, and call updateCenter() on each # anything that needs updatecenter called, should be added to the vector here # - foreach(var element; ["staArrowL2","staArrowR2","staFromL2","staToL2","staFromR2","staToR2", + foreach(var element; ["staFromL2","staToL2","staFromR2","staToR2", "hdgTrk","trkInd","hdgBug","HdgBugCRT","TrkBugLCD","HdgBugLCD","curHdgPtr", "HdgBugCRT2","TrkBugLCD2","HdgBugLCD2","hdgBug2","selHdgLine","selHdgLine2","curHdgPtr2", - "staArrowL","staArrowR","staToL","staFromL","staToR","staFromR"] ) + "staToL","staFromL","staToR","staFromR"] ) me.symbols[element] = me.nd.getElementById(element).updateCenter(); + foreach(var element; ["staArrowL2","staArrowR2","staArrowL","staArrowR"] ) + me.symbols[element] = easeArrow.new( me.nd.getElementById(element).updateCenter() ); + me.map = me.nd.createChild("map","map") .set("clip", "rect(124, 1024, 1024, 0)") .set("screen-range", 700) .set("z-index",-1); + me.compassHdgTrk = 0; # last compass rotation deg + me.update_sub(); # init some map properties based on switches var vor1_path = "/instrumentation/nav[2]"; @@ -233,6 +347,17 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update event_handler(); } # foreach layer + me.mapCamera = traffic.Camera.new({ + range: 20, + screenRange: 436.8545, + screenCX: 512, + screenCY: 512, + }); + me.trafficGroup = me.nd.createChild("group"); + me.trafficLayer = traffic.TrafficLayer.new(me.mapCamera, me.trafficGroup); + me.trafficLayer.start(); + me.trafficGroup.set("z-index", -1); + #print("navdisplay.mfd:ND layer setup completed"); # TODO: move this to RTE.lcontroller ? @@ -277,20 +402,38 @@ canvas.NavDisplay.update_sub = func(){ me.userTrk=userHdg; } + var reqHdg = 0; + if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") - or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) - { + or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) { userHdgTrk = userTrk; me.userHdgTrk = userTrk; + me.compassHdgTrk = userTrk; userHdgTrkTru = userTrkTru; me.symbols.hdgTrk.setText("TRK"); } else { - userHdgTrk = userHdg; - me.userHdgTrk = userHdg; + if (userHdg != me.compassHdgTrk) { + var dist = userHdg - me.compassHdgTrk; + if (dist>180) dist = dist - 360; + elsif (dist<-180) dist = 360 + dist; + if (dist>0) { + dist = dist * 0.3; + if (dist>10) dist = 10; + me.compassHdgTrk = (dist<0.1) ? userHdg : math.mod(me.compassHdgTrk+dist,360); + } + elsif (dist<0) { + dist = dist * 0.3; + if (dist<-10) dist = -10; + me.compassHdgTrk = (dist>-0.1) ? userHdg : math.mod(me.compassHdgTrk+dist,360); + } + } + userHdgTrk = me.compassHdgTrk; + me.userHdgTrk = me.compassHdgTrk; userHdgTrkTru = userHdgTru; me.symbols.hdgTrk.setText("HDG"); } + # First, update the display position of the map var oldRange = me.map.getRange(); var pos = { @@ -372,6 +515,13 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec else me.map.setTranslation(512,824); } + me.mapCamera.repositon(geo.aircraft_position(), me.aircraft_source.get_hdg_tru()); + me.pos = props.globals.getNode("position"); + me.trafficLayer.setRefAlt(me.pos.getValue("altitude-ft")); + if (me.trafficGroup.getVisible()) { + me.trafficLayer.update(); + me.trafficLayer.redraw(); + } var vor1_path = "/instrumentation/nav[2]"; var vor2_path = "/instrumentation/nav[3]"; var dme1_path = "/instrumentation/dme[2]"; @@ -462,7 +612,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg"); if(!me.get_switch("toggle_centered")) { - if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting))) + if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 or (me.change_phase == 1) and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting))) me.symbols.trkInd.hide(); else me.symbols.trkInd.show(); diff --git a/Models/Instruments/ND/canvas/map/TERRAIN.lcontroller b/Models/Instruments/ND/canvas/map/TERRAIN.lcontroller new file mode 100644 index 00000000..4fba3af4 --- /dev/null +++ b/Models/Instruments/ND/canvas/map/TERRAIN.lcontroller @@ -0,0 +1,51 @@ +# See: http://wiki.flightgear.org/MapStructure +# Class things: +var name = 'TERRAIN'; +var parents = [canvas.SymbolLayer.Controller]; +var __self__ = caller(0)[0]; + +canvas.SymbolLayer.Controller.add(name, __self__); +canvas.SymbolLayer.add(name, { + parents: [MultiSymbolLayer], + type: name, # Symbol type + df_controller: __self__, # controller to use by default -- this one + df_options: { # default configuration options + viewport_radius: 670 + } +}); + +var new = func(layer) { + var m = { + parents: [__self__], + layer: layer, + map: layer.map, + listeners: [], + }; + layer.searcher._equals = func(l,r) l.equals(r); + m.addVisibilityListener(); + return m; +}; + +var del = func() { + #print(name~".lcontroller.del()"); + foreach (var l; me.listeners) + removelistener(l); +}; + +var searchCmd = func { + if(me.map.getRange() == nil) return []; + + var pos = geo.aircraft_position(); + lat = pos.lat(); + lon = pos.lon(); + + var result = geo.Coord.new(); + result.set_latlon(lat, lon); + result.rangeNm = me.map.getRange(); + result.fetchRad = 184; # is this number accurate? + result.equals = func(r){ + me.fetchRad == r.fetchRad and me.lat == r.lat and me.lon == r.lon + }; + + return [result]; +}; diff --git a/Models/Instruments/ND/canvas/map/TERRAIN.symbol b/Models/Instruments/ND/canvas/map/TERRAIN.symbol new file mode 100644 index 00000000..6d226040 --- /dev/null +++ b/Models/Instruments/ND/canvas/map/TERRAIN.symbol @@ -0,0 +1,429 @@ +# See: http://wiki.flightgear.org/MapStructure +# Class things: + +## Airbus Terrain on ND by InuYaksa*2021 +## EGPWS device - Applicable to: MSN 0112 +## Ident.: DSC-31-45-00009586.0012001 / 22 MAY 12 +## Ident.: DSC-31-45-00009586.0009001 / 08 AUG 13 + +## inspired from work on 787-family - thanks a lots +## and a great help from legoboyvdlp + +var name = 'TERRAIN'; +var parents = [DotSym]; +var __self__ = caller(0)[0]; +DotSym.makeinstance( name, __self__ ); + +var element_type = "group"; + +var terrain_minalt = props.globals.initNode("/instrumentation/efis[0]/nd/terrain-on-nd/min-altitude", 0,"INT"); +var terrain_maxalt = props.globals.initNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-altitude", -9999,"INT"); +var terrain_maxcol = props.globals.initNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-color", 0,"INT"); # 0= grn, 1= yel, 2= red + +var terrain_alert = props.globals.getNode("/instrumentation/mk-viii/outputs/alert-mode"); + +var tile_list = [ + nil,"tile_gl.png","tile_gh.png","tile_al.png","tile_ah.png","tile_rh.png", # 0-5 low alt - imho real ND displays as amber-ish color than yellow one + "tile_gl.png","tile_gh.png","tile_gh.png","tile_gs.png", # 6-9 hi alt + "tile_ml.png","tile_cl.png", # 10 magenta - 11 cyan-ish/blue (water) + "tile_as.png","tile_rs.png" # 12-13 alert - solid colors + ]; + +var is_terrain = 0; + +var get_elevation = func (lat, lon) { + var info = geodinfo(lat, lon); + var elevation = 0; + if (info != nil) { + elevation = int(info[0] * 3.2808399); + me.is_terrain = (info[1] == nil) ? 1 : info[1].solid; + } + else { elevation = nil; } + return elevation; +} + +var updateTerrain = func { + + if (me.reference == nil) return; + + if(me.fetching) return; + + me.fetching = 1; + + if (me.request_clear == 1) { + me.request_clear = 0; + me.clear(); + me.group.setVisible(1); + } + + var RAD2DEG = 57.2957795; + var DEG2RAD = 0.016774532925; + + var pos_lat = me.reference.lat(); + var pos_lon = me.reference.lon(); + + var heading = me.refheading; + var altitudeft = me.refaltitudeft; + var lowaltft = me.reflowaltft; + var basealtft = me.basealtitudeft; + var alert_level = me.terrain_alert.getValue(); + + var side = (math.mod(me.radar_beacon,2)==0) ? "L" : "R"; + var a = int(me.radar_beacon/2); + var col = a + 0.5; + + if (side == "R") { + col = -col; + } + + var trn = me.terrlayer[side ~ a]; + + var len = size(trn); + var range = me.range; + + var tiles = me.tile_list; + + #var proj_lon = pos_lon + ((col * (range/30) * math.sin(DEG2RAD * (heading - 90))) / 40); + #var proj_lat = pos_lat + ((col * (range/30) * math.cos(DEG2RAD * (heading - 90))) / 40); + + # if me.tileradiusw == 20 + var range_20f = range / 18.75; + var heading_sin = math.sin(DEG2RAD * heading); + var heading_cos = math.cos(DEG2RAD * heading); + + var proj_lon = pos_lon + ((col * range_20f * math.sin(DEG2RAD * (heading - 90))) / 60); + var proj_lat = pos_lat + ((col * range_20f * math.cos(DEG2RAD * (heading - 90))) / 60); + + var elevft = []; + + me.radar_cleared = 0; + + for (var row = 0; row < len; row += 1) { + + if (trn[row] == nil) { + append(elevft,-1); + continue; + } + + var point_lon = proj_lon + ((row * range_20f / 60) * heading_sin); + var point_lat = proj_lat + ((row * range_20f / 60) * heading_cos); + + var elev = me.get_elevation(point_lat, point_lon); + var grad = 0; #black + if (elev != nil) { + if (elev>me.max_altitude) me.max_altitude = elev; + if (me.is_terrain) { + if (elev=0) { + grad = int(diff/1000) + 3; + if (grad>5) grad = 5; + if (alert_level > 0 and a < 6 and grad > 3) { + if (alert_level == 1 and (grad == 3 or grad == 4)) grad = 12; # solid yellow + else if (alert_level == 2 and grad == 5) grad = 13; # solid red + } + } else { + if (me.hialtmode == 0) { + if (diff>=lowaltft) grad = 3; # lite yellow + else { + grad = int(diff/1000) + 2; + if (grad<0) grad = 0; + } + } else { + if (diff>=lowaltft) grad = 3; # lite yellow + else { + if (me.bands_range > 0 and elev > me.bands_minalt) { + grad = 9 - int((me.bands_maxalt - elev) / me.bands_range); + if (grad>9) grad = 9; # solid green + else if (grad<6) grad = 6; #light green + } + } + } + } + } + } else { + grad = 11; #water/cyan + } + append(elevft,grad); # 0-5 + } else { + append(elevft,0); # no data - black (magenta) + } + + } + + if (me.min_altitude > me.max_altitude) me.min_altitude = me.max_altitude; # occurs on sea areas + + for (var r=0; r < len; r+=1) { + var imgx = elevft[r]; + if (imgx == -1) continue; + if (imgx < 1) trn[r].hide(); + else trn[r].setFile(me.imgpath ~ me.tile_list[imgx]).show(); + } + + me.radar_beacon += 1; + if (me.radar_beacon >= (me.tileradiusw*2)) { + me.restart_beacon(); + } + + me.fetching = 0; +}; + +var update_altitudes = func { + + me.terrain_minalt.setValue(me.min_altitude); + me.terrain_maxalt.setValue(me.max_altitude); + + var altdif = me.max_altitude - me.refaltitudeft; + if (altdif <= 0) { + if (altdif >= me.reflowaltft) me.terrain_maxcol.setValue(1); + else me.terrain_maxcol.setValue(0); + } else { + if (altdif>2000) me.terrain_maxcol.setValue(2); + else me.terrain_maxcol.setValue(1); + } + + if (me.min_altitude == 9999) { + me.avg_minalt = me.min_altitude; + me.avg_maxalt = me.max_altitude; + } else { + #if (me.min_altitude < me.avg_minalt) me.avg_minalt = me.min_altitude;else + me.avg_minalt = math.round((me.avg_minalt * 2 + me.min_altitude) / 3); + #if (me.max_altitude > me.avg_maxalt) me.avg_maxalt = me.max_altitude;else + me.avg_maxalt = math.round((me.avg_maxalt * 2 + me.max_altitude) / 3); + } + + me.avg_peakalt = me.avg_maxalt - me.avg_minalt; + + if (me.onground == 0 and (me.max_altitude + 250) < me.refaltitudeft) { # 250 ft tollerance + me.hialtmode = 1; + var range = math.min(2400,(me.avg_maxalt - me.avg_minalt)) - 400; + if (range < 400) { # min elev number + me.bands_range = 0; + } else { + me.bands_range = int(range / 4); + me.bands_maxalt = me.avg_maxalt; + me.bands_minalt = math.max( me.avg_maxalt - range, me.avg_minalt + 400 ); + } + } else { + me.hialtmode = 0; + #me.avg_minalt = 9999; + } + + me.min_altitude = 9999; + me.max_altitude = -9999; + +} + +var restart_beacon = func { + me.radar_beacon = 0; + me.radar_cycle += 1; + me.reference = nil; +}; + +var init = func { + #print('TERRAIN init'); + me.tile = 33; + me.fetching = 0; + me.fetchRad = me.model.fetchRad; # Radius of radar layer to fetch + me.range = me.model.rangeNm; # Range of Navigation Display + me.viewport_radius = me.getOption('viewport_radius', 670); + me.imgpath = get_local_path('res/terrainv2/'); + me.radar_beacon = 0; + me.radar_cycle = 0; + me.radar_cleared = 1; + me.request_clear = 0; + me.min_altitude = 9999; + me.max_altitude = -9999; + me.avg_minalt = 9999; + me.avg_maxalt = -9999; + me.avg_peakalt = nil; + me.maxalt_col = 0; # 0 = grn, 1 = yel, 2 = red + me.bands_minalt = 0; + me.bands_maxalt = 0; + me.bands_range = 0; + me.basealtitudeft = nil; + me.reference = nil; + me.onfailure = 0; + me.hialtmode = 0; # high aircraft relative altitude mode + me.checkarrival = 0; + me.onground = 1; + + var tile = me.tile; + + var gx = int(me.viewport_radius / tile); + me.tileradius = gx; + + var limx = int((512/tile)+0.5); # display width is smaller than height + me.tileradiusw = limx; + + me.terrlayer = {}; + + var centx = 0; + var centy = -me.viewport_radius; + + var group = me.group.createChild("group").set("z-index", -100); #me.element + + for (var c=0; c499) ? 400 : 140; + + var vspeed30s = int(getprop("velocities/vertical-speed-fps") * 30); + if (vspeed30s<-500) me.refaltitudeft = math.max(me.avg_minalt , me.refaltitudeft + vspeed30s); + + if (me.basealtitudeft == nil) { # first basealt set + me.basealtitudeft = me.groundaltft + flatalt; + me.flatalt = flatalt; + me.checkarrival = 1; + print("set REFALT [init]: "~me.basealtitudeft); + } else if (fmgc.FMGCInternal.phase < 2) { # starting at phase < 2 + if (me.flatalt != flatalt) { + me.basealtitudeft = me.groundaltft + flatalt; + me.flatalt = flatalt; + print("set REFALT [flat]: "~me.basealtitudeft); + } + } else if (fmgc.FMGCInternal.phase == 5) { + if (me.checkarrival == 1) { + me.checkarrival = 0; + me.basealtitudeft = nil; + if (fmgc.FMGCInternal.arrApt != nil) { + var airport = airportinfo(fmgc.FMGCInternal.arrApt); + if (airport != nil) me.basealtitudeft = flatalt + int(airport.elevation * M2FT); + print("set REFALT [arrApt]: "~me.basealtitudeft); + } + if (me.basealtitudeft == nil) { + me.basealtitudeft = flatalt + me.avg_minalt; # that's fun + } + } + } else if (fmgc.FMGCInternal.phase == 6) { + if (me.checkarrival == 0) { + me.checkarrival = 1; + #me.basealtitudeft = 0; + } + } else if (fmgc.FMGCInternal.phase == 7) { + if (me.checkarrival == 0) { + me.checkarrival = 1; + me.basealtitudeft = me.groundaltft + flatalt; + print("set REFALT [done]: "~me.basealtitudeft); + } + } else if (fmgc.FMGCInternal.phase == 2) { + var expdaltft = me.groundaltft + flatalt; + if (me.basealtitudeft > expdaltft) { + me.basealtitudeft = expdaltft; + print("set REFALT [blwbase]: "~me.basealtitudeft); + } + } else if (fmgc.FMGCInternal.phase >= 2) { + me.basealtitudeft = math.avg(me.basealtitudeft,flatalt + me.groundaltft,int(flatalt + me.avg_minalt)); + #if (me.basealtitudeft > me.avg_maxalt) { + # if (me.avg_maxalt < 1000) me.basealtitudeft = 0; # 1000ft min elev number + # else me.basealtitudeft = int(400 + me.avg_minalt); + # print("set REFALT [blwmin]: "~me.basealtitudeft); + #} + #else if (me.basealtitudeft == 0 and me.avg_maxalt >= 1000) { # 1000ft min elev number + # me.basealtitudeft = int(400 + me.avg_minalt); + # print("set REFALT [abvmin]: "~me.basealtitudeft); + #} + } + + } + + } else { + + var range = me.layer.map.getRange(); # Range of Navigation Display + var update_size = (range != me.range); + me.range = range; + + if (update_size) { + me.request_clear = 1; + } + + me.updateTerrain(); # left + me.updateTerrain(); # right + + } + +}; \ No newline at end of file diff --git a/Models/Instruments/ND/canvas/res/airbusND.svg b/Models/Instruments/ND/canvas/res/airbusND.svg index fc7e5289..8197f17a 100644 --- a/Models/Instruments/ND/canvas/res/airbusND.svg +++ b/Models/Instruments/ND/canvas/res/airbusND.svg @@ -7,8 +7,8 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="airbusND_orig.svg" - inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" + sodipodi:docname="airbusND.svg" + inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)" xml:space="preserve" id="svg5180" height="1024" @@ -23,16 +23,16 @@ inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="1056" + inkscape:window-height="1017" id="namedview102" showgrid="false" - inkscape:zoom="0.9002897" - inkscape:cx="467.92702" - inkscape:cy="538.03817" - inkscape:window-x="1920" - inkscape:window-y="0" + inkscape:zoom="3.1081105" + inkscape:cx="904.96427" + inkscape:cy="819.41055" + inkscape:window-x="-8" + inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="layer8" + inkscape:current-layer="terrGroup" inkscape:object-nodes="true" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true" @@ -40,7 +40,8 @@ inkscape:snap-to-guides="false" showguides="true" inkscape:guide-bbox="true" - inkscape:document-rotation="0">image/svg+xmlGijs de RooyGijs de RooyTERRAHEADTERR000000ABCD + style="font-size:36px;line-height:1.25;text-align:end;text-anchor:end">XXXX99X 999.9 999°/ 99 999 999 GS + x="13.895038" + y="33.26786">GS TAS + style="font-size:27.9658px;line-height:1.25;stroke-width:0.776826">TAS VOR 1 + x="39.859375" + y="919.5495">VOR 1 NM + 99.9 -ABC + x="39.9375" + y="956.56171">ABC VOR 2 NM -99.9 + ABC 08 34.4z @@ -1173,50 +1268,42 @@ sodipodi:nodetypes="ccccccccc" />NM + x="967.04547" + y="67.431412">NM ILS + x="807.289" + y="33.929054">ILS 999.99 360 OFST -999999999.9999.9CRS @@ -1656,23 +1821,23 @@ xml:space="preserve" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#ededed;fill-opacity:1;stroke:none" x="854.72168" - y="124.87983" + y="104.87983" id="dmeLbl" inkscape:label="#text7243">  + y="104.87983">  999 @@ -1680,13 +1845,13 @@ xml:space="preserve" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#ededed;fill-opacity:1;stroke:none" x="913.95801" - y="126.12444" + y="106.12444" id="dme" inkscape:label="#text7243">99.9 MAP NOT AVAIL + style="font-size:53.3333px;line-height:1.25;fill:#ff0000">MAP NOT AVAILRANGE CHANGE diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_ah.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_ah.png new file mode 100644 index 00000000..5151f582 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_ah.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_al.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_al.png new file mode 100644 index 00000000..595d7d87 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_al.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_as.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_as.png new file mode 100644 index 00000000..ccfa1f20 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_as.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_ch.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_ch.png new file mode 100644 index 00000000..204cdc8f Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_ch.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_cl.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_cl.png new file mode 100644 index 00000000..91e1e0ff Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_cl.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_gh.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_gh.png new file mode 100644 index 00000000..9d8c864f Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_gh.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_gl.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_gl.png new file mode 100644 index 00000000..ab83824e Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_gl.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_gs.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_gs.png new file mode 100644 index 00000000..6c61a2be Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_gs.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_mh.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_mh.png new file mode 100644 index 00000000..0e351066 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_mh.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_ml.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_ml.png new file mode 100644 index 00000000..b908287e Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_ml.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_rh.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_rh.png new file mode 100644 index 00000000..8eb51fd5 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_rh.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_rl.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_rl.png new file mode 100644 index 00000000..5d63f97c Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_rl.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_rs.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_rs.png new file mode 100644 index 00000000..d02e5503 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_rs.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_yh.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_yh.png new file mode 100644 index 00000000..bb536295 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_yh.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_yl.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_yl.png new file mode 100644 index 00000000..54edd9e5 Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_yl.png differ diff --git a/Models/Instruments/ND/canvas/res/terrainv2/tile_ys.png b/Models/Instruments/ND/canvas/res/terrainv2/tile_ys.png new file mode 100644 index 00000000..544c985d Binary files /dev/null and b/Models/Instruments/ND/canvas/res/terrainv2/tile_ys.png differ diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 04bc5a7b..037ebaf4 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -10,6 +10,17 @@ var NOTHING = func nil; var att_switch = props.globals.getNode("/controls/navigation/switching/att-hdg", 1); var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1); +var vhdg_bug = props.globals.getNode("/it-autoflight/input/hdg",0); # ND compass position deg + +var terrain_minalt = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/min-altitude", 0); +var terrain_maxalt = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-altitude", -9999); +var terrain_maxcol = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-color", 0); +var terrain_alert = props.globals.getNode("/instrumentation/mk-viii/outputs/alert-mode",0); + +var GREEN = [0.0509,0.7529,0.2941]; +var YELLOW = [0.949,0.949,0.207]; +var RED = [1.0000,0.0000,0.0000]; + canvas.NDStyles["Airbus"] = { font_mapper: func(family, weight) { if( family == "Liberation Sans" and weight == "normal" ) @@ -69,7 +80,7 @@ canvas.NDStyles["Airbus"] = { level_off_alt: "/autopilot/route-manager/vnav/level-off-alt", athr: "/it-autoflight/output/athr", app_mode: "/instrumentation/nd/app-mode", - chrono_node: "/instrumentation/chrono", + chrono_node: "/instrumentation/ndchrono", fpln_offset: "/autopilot/route-manager/offset", active_route_color: [0.0509,0.7529,0.2941], inactive_route_color: [0.95,0.95,0.21] @@ -81,15 +92,36 @@ canvas.NDStyles["Airbus"] = { } }, layers: [ + { + name:"TERRAIN", + isMapStructure: 1, + update_on:[ {rate_hz: 10}, "toggle_range","toggle_display_mode","toggle_terrain"], + predicate: func(nd, layer) { + #print("TERRAIN TOGGLE: " ~ nd.get_switch("toggle_terrain")); + var visible = nd.get_switch("toggle_terrain") and + nd.get_switch("toggle_display_mode") != "PLAN" and (nd.rangeNm() <= 40) and + (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); + if (visible) { + layer.update(); + } else { + layer.display_changed = 1; + } + layer.group.setVisible(visible); + }, # end of layer update predicate + options: { + viewport_radius: 670, #512, #706, + }, + "z-index": -100, + }, { name:"WXR_live", isMapStructure:1, always_update: 1, - update_on:[ "toggle_range","toggle_weather","toggle_display_mode","toggle_weather_live"], + update_on:[ "toggle_range","toggle_weather","toggle_display_mode","toggle_weather_live","toggle_terrain"], predicate: func(nd, layer) { var visible=nd.get_switch("toggle_weather") and nd.get_switch("toggle_weather_live") and - nd.get_switch("toggle_display_mode") != "PLAN" and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); + nd.get_switch("toggle_display_mode") != "PLAN" and !nd.get_switch("toggle_terrain") and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)); layer.group.setVisible(visible); if (visible) { layer.update(); @@ -884,6 +916,44 @@ canvas.NDStyles["Airbus"] = { is_false: NOTHING, }, }, + { + id:"hdgBug2ValR", #"hdgBug2ValL"", + impl: { + init: func(nd,symbol), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and + (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)), + is_true: func(nd) { + var bugRot = vhdg_bug.getValue(); + var diffRot = (bugRot>=nd.userHdgTrk) ? (bugRot-nd.userHdgTrk) : (360+bugRot-nd.userHdgTrk); + if (diffRot<180 and diffRot>48) { + nd.symbols.hdgBug2ValR.setText(sprintf("%03d", bugRot+0.5)); #CHECKME - not sure about adding +.5 as "hdg" process + nd.symbols.hdgBug2ValR.show(); + } else { + nd.symbols.hdgBug2ValR.hide(); + } + }, + is_false: func(nd) nd.symbols.hdgBug2ValR.hide(), + }, + }, + { + id:"hdgBug2ValL", + impl: { + init: func(nd,symbol), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and + (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)), + is_true: func(nd) { + var bugRot = vhdg_bug.getValue(); + var diffRot = (bugRot>nd.userHdgTrk) ? (360+nd.userHdgTrk-bugRot) : (nd.userHdgTrk-bugRot); + if (diffRot<180 and diffRot>48) { + nd.symbols.hdgBug2ValL.setText(sprintf("%03d", bugRot-0.5)); #CHECKME - not sure about adding +.5 as "hdg" process + nd.symbols.hdgBug2ValL.show(); + } else { + nd.symbols.hdgBug2ValL.hide(); + } + }, + is_false: func(nd) nd.symbols.hdgBug2ValL.hide(), + }, + }, { id:"hdgGroup", impl: { @@ -1227,9 +1297,9 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd){ - nd.get_switch("toggle_display_mode") == "MAP" and - !nd.get_switch("toggle_centered") and - ( + nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered") + and (nd.change_phase != 1) + and ( getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val or nd.get_switch("toggle_trk_line") ) @@ -1245,6 +1315,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered") + and (nd.change_phase != 1) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { nd.symbols.trkInd2.show(); @@ -1258,7 +1329,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and - nd.get_switch("toggle_centered") and + nd.get_switch("toggle_centered") and (nd.change_phase != 1) and getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), is_true: func(nd) { @@ -1271,7 +1342,7 @@ canvas.NDStyles["Airbus"] = { id:"vorCrsPtr", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered")), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered")) and (nd.change_phase != 1), is_true: func(nd) { nd.symbols.vorCrsPtr.show(); if (is_ils) { @@ -1288,7 +1359,7 @@ canvas.NDStyles["Airbus"] = { id:"vorCrsPtr2", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and nd.get_switch("toggle_centered")), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and nd.get_switch("toggle_centered")) and (nd.change_phase != 1), is_true: func(nd) { nd.symbols.vorCrsPtr2.show(); var is_ils = (nd.get_switch("toggle_display_mode") == "APP"); @@ -1315,7 +1386,7 @@ canvas.NDStyles["Airbus"] = { id: "gsDiamond", impl: { init: func(nd,symbol), - predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]), + predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]) and (nd.change_phase != 1), is_true: func(nd) { if(getprop("/instrumentation/nav/gs-needle-deflection-norm") != nil) nd.symbols.gsDiamond.setTranslation(getprop("/instrumentation/nav[0]/gs-needle-deflection-norm")*150,0); @@ -1383,7 +1454,7 @@ canvas.NDStyles["Airbus"] = { var ils_mode = getprop("/Flight-management/freq/ils-mode"); var has_ils = (nav_id != nil and nav_id != ""); (nd.get_switch("toggle_display_mode") == "MAP" and - !nd.get_switch("toggle_centered") and has_ils and ils_mode); + !nd.get_switch("toggle_centered") and has_ils and ils_mode and (nd.change_phase != 1)); }, is_true: func(nd) { nd.symbols.locTrkPointer.show(); @@ -1403,7 +1474,7 @@ canvas.NDStyles["Airbus"] = { var ils_mode = getprop("/Flight-management/freq/ils-mode"); var has_ils = (nav_id != nil and nav_id != ""); (nd.get_switch("toggle_display_mode") == "MAP" and - nd.get_switch("toggle_centered") and has_ils and ils_mode); + nd.get_switch("toggle_centered") and has_ils and ils_mode and (nd.change_phase != 1)); }, is_true: func(nd) { nd.symbols.locTrkPointer2.show(); @@ -1563,15 +1634,15 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorL.setText("ADF 1"); nd.symbols.vorL.setColor(0.195,0.96,0.097); nd.symbols.vorLId.setColor(0.195,0.96,0.097); - nd.symbols.dmeLDist.setColor(0.195,0.96,0.097); - } - else{ + #nd.symbols.dmeLDist.setColor(0.195,0.96,0.097); + nd.symbols.dmeL.setText(""); + } else { nd.symbols.vorL.setText("VOR 1"); nd.symbols.vorL.setColor(1,1,1); nd.symbols.vorLId.setColor(1,1,1); - nd.symbols.dmeLDist.setColor(1,1,1); + #nd.symbols.dmeLDist.setColor(1,1,1); + nd.symbols.dmeL.setText("NM"); } - nd.symbols.dmeL.setText("NM"); nd.symbols.dmeL.setColor(0,0.59,0.8); }, is_false: func(nd){ @@ -1590,14 +1661,14 @@ canvas.NDStyles["Airbus"] = { nd.symbols.vorR.setText("ADF 2"); nd.symbols.vorR.setColor(0.195,0.96,0.097); nd.symbols.vorRId.setColor(0.195,0.96,0.097); - nd.symbols.dmeRDist.setColor(0.195,0.96,0.097); + nd.symbols.dmeR.setText(""); } else { nd.symbols.vorR.setText("VOR 2"); nd.symbols.vorR.setColor(1,1,1); nd.symbols.vorRId.setColor(1,1,1); - nd.symbols.dmeRDist.setColor(1,1,1); + #nd.symbols.dmeRDist.setColor(1,1,1); + nd.symbols.dmeR.setText("NM"); } - nd.symbols.dmeR.setText("NM"); nd.symbols.dmeR.setColor(0,0.59,0.8); }, is_false: func(nd){ @@ -1653,6 +1724,8 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_lh_vor_adf") != 0), is_true: func(nd) { + if (nd.get_switch("toggle_lh_vor_adf") < 0) nd.symbols.vorLSym.setColor(0.195,0.96,0.097); + else nd.symbols.vorLSym.setColor(1,1,1); nd.symbols.vorLSym.show(); }, is_false: func(nd){ @@ -1708,6 +1781,8 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_rh_vor_adf") != 0), is_true: func(nd) { + if (nd.get_switch("toggle_rh_vor_adf") < 0) nd.symbols.vorRSym.setColor(0.195,0.96,0.097); + else nd.symbols.vorRSym.setColor(1,1,1); nd.symbols.vorRSym.show(); }, is_false: func(nd){ @@ -1919,6 +1994,53 @@ canvas.NDStyles["Airbus"] = { nd.symbols.offsetLbl.hide(); } } + }, + { + id: "terrGroup", + impl: { + init: func(nd,symbol), + predicate: func(nd) ( nd.get_switch("toggle_terrain") and + nd.get_switch("toggle_display_mode") != "PLAN" and (nd.rangeNm() <= 40) and + (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) ), + is_true: func(nd){ + if (terrain_maxalt.getValue() != -9999) { + var alert = terrain_alert.getValue(); + if (alert == 0) { + nd.symbols.TerrLabel.setVisible(1); + nd.symbols.terrAhead.setVisible(0); + } else { + nd.symbols.TerrLabel.setVisible(0); + nd.symbols.terrAhead.setVisible(1); + if (alert == 1) nd.symbols.terrAhead.setColor(YELLOW[0],YELLOW[1],YELLOW[2]); + else nd.symbols.terrAhead.setColor(RED[0],RED[1],RED[2]); + } + nd.symbols.terrLO.setText(sprintf("%03d",math.round(terrain_minalt.getValue()/100))); + nd.symbols.terrHI.setText(sprintf("%03d",math.round(terrain_maxalt.getValue()/100))); + if (terrain_maxcol.getValue() == 0) nd.symbols.terrHI.setColor(GREEN[0],GREEN[1],GREEN[2]); + else if (terrain_maxcol.getValue() == 1) nd.symbols.terrHI.setColor(YELLOW[0],YELLOW[1],YELLOW[2]); + else nd.symbols.terrHI.setColor(RED[0],RED[1],RED[2]); + nd.symbols.terrGroup.show(); + terrain_maxalt.setValue(-9999); #update visual at radar cycle + } + }, + is_false: func(nd){ + nd.symbols.terrGroup.hide(); + } + } + }, + { + id: "nd_msg_change", + impl: { + init: func(nd, symbol), + predicate: func(nd) ( (nd.change_phase != 0) and + (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) ), + is_true: func(nd) { + nd.symbols.nd_msg_change.show(); + }, + is_false: func(nd) { + nd.symbols.nd_msg_change.hide(); + } + } } ], # end of vector with features diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index b5f0c3a9..2448cac4 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -1698,6 +1698,41 @@ property-toggle instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit + + + + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit + 1 + + + property-assign + instrumentation/efis/inputs/terr + 0 + + + + + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit + 1 + + + property-assign + instrumentation/efis[1]/inputs/terr + 0 + + + + + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit + 0 + + + nasal + + nasal diff --git a/Nasal/Displays/projection.nas b/Nasal/Displays/projection.nas new file mode 100644 index 00000000..722e2771 --- /dev/null +++ b/Nasal/Displays/projection.nas @@ -0,0 +1,41 @@ +# Projection-related helper functions for the MFD maps + +var Camera = { + new: func(options) { + var m = { + parents: [Camera], + + camGeo: options['camGeo'] or geo.aircraft_position(), + camHdg: options['camHdg'] or 0, + range: options['range'] or 10.0, + screenRange: options['screenRange'] or 256.0, + screenCX: options['screenCX'] or options['screenRange'] or 256.0, + screenCY: options['screenCY'] or options['screenRange'] or 256.0, + }; + return m; + }, + + setRange: func(range) { + me.range = range; + }, + + repositon: func(geo, hdg) { + me.camGeo = geo; + me.camHdg = hdg; + }, + + project: func(targetGeo) { + var dist = me.camGeo.distance_to(targetGeo) * M2NM; + var bearing = me.camGeo.course_to(targetGeo) - me.camHdg; + return me.projectDistBearing(dist, bearing); + }, + + projectDistBearing: func(dist, bearing) { + var bearingRad = bearing * D2R; + var tx = math.sin(bearingRad) * dist; + var ty = -math.cos(bearingRad) * dist; + var x = tx * me.screenRange / me.range + me.screenCX; + var y = ty * me.screenRange / me.range + me.screenCY; + return [x, y]; + }, +}; diff --git a/Nasal/Displays/traffic.nas b/Nasal/Displays/traffic.nas new file mode 100644 index 00000000..92009a4a --- /dev/null +++ b/Nasal/Displays/traffic.nas @@ -0,0 +1,358 @@ +# Traffic layer + +var ATCSwitchAbvBlw = props.globals.getNode("/controls/atc/abv-blw"); +var ATCSwitchThrtAll = props.globals.getNode("/controls/atc/thrt-all"); + +var colorByLevel = { + # 0: other + 0: [0.8,0.8,0.8], + # 1: proximity + 1: [0.8,0.8,0.8], + # 2: traffic advisory (TA) + 2: [1,0.75,0], + # 3: resolution advisory (RA) + 3: [1,0,0], +}; + +var doFill = { + 0: 0, + 1: 1, + 2: 1, + 3: 1, +}; + +var colorDefault = [0.8,0.8,0.8]; + +var drawBlip = func(elem, threatLvl) { + if (threatLvl == 3) { + # resolution advisory + elem.reset() + .setStrokeLineWidth(0) + .moveTo(-17,-17) + .horiz(34) + .vert(34) + .horiz(-34) + .close(); + } + elsif (threatLvl == 2) { + # traffic advisory + elem.reset() + .moveTo(-17,0) + .setStrokeLineWidth(0) + .arcSmallCW(17,17,0,34,0) + .arcSmallCW(17,17,0,-34,0); + } + elsif (threatLvl == 1) { + # proximate traffic + elem.reset() + .setStrokeLineWidth(0) + .moveTo(-14,0) + .lineTo(0,-17) + .lineTo(14,0) + .lineTo(0,17) + .close(); + } + else { + # other traffic + elem.reset() + .setStrokeLineWidth(4) + .moveTo(-10,0) + .lineTo(0,-14) + .lineTo(10,0) + .lineTo(0,14) + .lineTo(-10,0); + } +}; + + +var TrafficLayer = { + new: func(camera, group) { + var m = { + parents: [TrafficLayer], + camera: camera, + refAlt: 0, + group: group, + items: {}, + sorted: {}, # TODO - only the most 8 relevant advisories + values: {}, + updateKeys: [], + addListener: nil, + delListener: nil, + }; + return m; + }, + + makeElems: func () { + if (me.group == nil) return nil; + var elems = {}; + elems['master'] = me.group.createChild('group'); + elems['blip'] = elems.master.createChild('path') + .setStrokeLineWidth(0); + elems['text'] = elems.master.createChild('text') + .setDrawMode(canvas.Text.TEXT) + .setText(sprintf("0")) + .setFont("LiberationFonts/LiberationSans-Regular.ttf") + .setColor(1,1,1) + .setFontSize(32) + .setAlignment("center-center"); + elems['master'].hide(); + elems['arrowUp'] = elems.master.createChild("text") + .setDrawMode(canvas.Text.TEXT) + .setText(sprintf("↑")) + .setFont("LiberationFonts/LiberationSans-Regular.ttf") + .setColor(1,1,1) + .setFontSize(50) + .setTranslation(16, 2) + .setAlignment("left-center"); + elems['arrowDown'] = elems.master.createChild("text") + .setDrawMode(canvas.Text.TEXT) + .setText(sprintf("↓")) + .setFont("LiberationFonts/LiberationSans-Regular.ttf") + .setColor(1,1,1) + .setFontSize(50) + .setTranslation(16, 2) + .setAlignment("left-center"); + return elems; + }, + + start: func() { + me.stop(); + var self = me; + me.addListener = setlistener('/ai/models/model-added', func(changed, listen, mode, is_child) { + var path = changed.getValue(); + if (path == nil) return; + #printf("ADD: %s", path); + me.values[path] = nil; + var masterProp = props.globals.getNode(path); + var prop = { + 'master': masterProp, + }; + if (me.items[path] == nil) { + me.items[path] = { + prop: prop, + elems: me.makeElems(), + data: {'threatLevel': -2}, + }; + } + else { + me.items[path].prop = prop; + me.items[path].data = {'threatLevel': -2}; + } + }, 1, 1); + me.delListener = setlistener('/ai/models/model-removed', func(changed, listen, mode, is_child) { + var path = changed.getValue(); + if (path == nil) return; + #printf("DEL: %s", path); + me.values[path] = nil; + if (me.items[path] == nil) return; + if (me.items[path] != nil) { + me.items[path].prop = nil; + me.items[path].elems.master.hide(); + me.items[path].data = {}; + } + }, 1, 1); + }, + + stop: func() { + if (me.addListener != nil) { + removelistener(me.addListener); + me.addListener = nil; + } + if (me.delListener != nil) { + removelistener(me.delListener); + me.delListener = nil; + } + me.items = {}; + if (me.group != nil) { + me.group.removeAllChildren(); + } + }, + + nxtupdatetime: 0, + + update: func() { + var _tm = systime(); + if (me.nxtupdatetime != 0) { + if (_tm top or altDiff100 < bottom) { # check TCAS vertical range + me.values[path] = {visible: 0}; + return; + } + + var _val = {visible:1, lat:_lat, lon:_lon, dirty:item.data['threatLevelDirty']}; + + var spd = vspeed * 60; + _val.arrowup = (spd > 500); + _val.arrowdown = (spd < -500); + + if (math.abs(altDiff100) > 0.5) { + _val.text = sprintf("%+03.0f ", altDiff100); + } else { + _val.text = ""; + } + + _val.textpy = (altDiff100 < 0) ? 34 : -30; + + me.values[path] = _val; + + } + + }, + + redrawItem: func (item,val) { + #debug.dump("REDRAW ", item.data); + + if (val != nil and val.visible == 1) { + + var lat = val.lat; + var lon = val.lon; + + var coords = geo.Coord.new(); + coords.set_latlon(lat, lon); + var (x, y) = me.camera.project(coords); + item.elems.master.setTranslation(x, y); + #printf("%f %f", x, y); + if (val.dirty) { + #printf('%s THREAT LVL: %i', item.data['callsign'] or '???', item.data['threatLevel']); + var threatLevel = item.data['threatLevel']; + #debug.dump(item.data, threatLevel); + drawBlip(item.elems.blip, threatLevel); + var rgb = colorByLevel[threatLevel]; + if (rgb == nil) rgb = colorDefault; + var color = canvas._getColor(rgb); + var (r, g, b) = rgb; + if (threatLevel > 0) { + item.elems.blip.setColorFill(r, g, b); + } else { + item.elems.blip.setColor(r, g, b); + } + item.elems.text.setColor(r, g, b); + item.elems.arrowUp.setColor(r, g, b); + item.elems.arrowDown.setColor(r, g, b); + item.elems.master.set('z-index', threatLevel + 2); + item.data['threatLevelDirty'] = 0; + val.dirty = 0; + } + + item.elems.arrowUp.setVisible(val.arrowup); + item.elems.arrowDown.setVisible(val.arrowdown); + + item.elems.text.setText(val.text); + item.elems.text.setTranslation(0, val.textpy); + item.elems.master.show(); + + } else { + + item.elems.master.hide(); + + } + }, + +}; diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index 6461b5e7..aedd52cf 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -12,7 +12,6 @@ var leftOverflow = props.globals.initNode("/ECAM/warnings/overflow-left", 0, "B var rightOverflow = props.globals.initNode("/ECAM/warnings/overflow-right", 0, "BOOL"); var overflow = props.globals.initNode("/ECAM/warnings/overflow", 0, "BOOL"); -var dc_ess = props.globals.getNode("/systems/electrical/bus/dc-ess", 1); var lights = [props.globals.initNode("/ECAM/warnings/master-warning-light", 0, "BOOL"), props.globals.initNode("/ECAM/warnings/master-caution-light", 0, "BOOL")]; var aural = [props.globals.initNode("/sim/sound/warnings/crc", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/chime", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cricket", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/retard", 0, "BOOL"), props.globals.initNode("/sim/sound/warnings/cchord", 0, "BOOL")]; @@ -76,6 +75,33 @@ var warningNodes = { greenYellowFuel: props.globals.initNode("/ECAM/warnings/hyd/green-yellow-fuel-consumpt"), leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault"), rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault"), + flapNotZero: props.globals.initNode("/ECAM/warnings/fctl/flaps-not-zero"), + slatsConfig: props.globals.initNode("/ECAM/warnings/fctl/slats-config-output"), + flapsConfig: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-output"), + spdBrkConfig: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-config-output"), + pitchTrimConfig: props.globals.initNode("/ECAM/warnings/fctl/pitch-trim-config-output"), + rudTrimConfig: props.globals.initNode("/ECAM/warnings/fctl/rudder-trim-config-output"), + parkBrkConfig: props.globals.initNode("/ECAM/warnings/fctl/park-brk-config-output"), + slatsConfig2: props.globals.initNode("/ECAM/warnings/fctl/slats-config-range"), + flapsConfig2: props.globals.initNode("/ECAM/warnings/fctl/flaps-config-range"), + spdBrkConfig2: props.globals.initNode("/ECAM/warnings/fctl/spd-brk-config-range"), + pitchTrimConfig2: props.globals.initNode("/ECAM/warnings/fctl/pitch-trim-config-range"), + rudTrimConfig2: props.globals.initNode("/ECAM/warnings/fctl/rudder-trim-config-range"), + dcEssFuelConsumptionIncreased: props.globals.initNode("/ECAM/warnings/logic/dc-ess-fuel-consumption-increased"), + dcEssFMSPredictions: props.globals.initNode("/ECAM/warnings/logic/dc-ess-fms-predictions-unreliable"), + dc2FuelConsumptionIncreased: props.globals.initNode("/ECAM/warnings/logic/dc-2-fuel-consumption-increased"), + dc2FMSPredictions: props.globals.initNode("/ECAM/warnings/logic/dc-2-fms-predictions-unreliable"), + thrLeversNotSet: props.globals.initNode("/ECAM/warnings/logic/eng/thr-lever-not-set"), + revSet: props.globals.initNode("/ECAM/warnings/logic/eng/reverse-set"), + eng1Fail: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-fail"), + eng2Fail: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-fail"), + phase5Trans: props.globals.initNode("/ECAM/warnings/logic/eng/phase-5-output"), + eng1Shutdown: props.globals.initNode("/ECAM/warnings/logic/eng/eng-1-shutdown"), + eng2Shutdown: props.globals.initNode("/ECAM/warnings/logic/eng/eng-2-shutdown"), + acEssBusAltn: props.globals.initNode("/ECAM/warnings/logic/ac-ess-bus-altn-feed"), + 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"), }, Timers: { apuFaultOutput: props.globals.initNode("/ECAM/warnings/timer/apu-fault-output"), @@ -110,6 +136,20 @@ var warningNodes = { navTerrFault: props.globals.initNode("/ECAM/warnings/timer/nav-gpws-terr-fault"), leftElevFail: props.globals.initNode("/ECAM/warnings/fctl/leftElevFault-output"), rightElevFail: props.globals.initNode("/ECAM/warnings/fctl/rightElevFault-output"), + staticInverter: props.globals.initNode("/systems/electrical/some-electric-thingie/static-inverter-timer"), + dcEmerConfig: props.globals.initNode("/ECAM/warnings/logic/dc-emer-config-output"), + dc12Fault: props.globals.initNode("/ECAM/warnings/logic/dc-1-2-output"), + dcEssFault: props.globals.initNode("/ECAM/warnings/logic/dc-ess-output"), + dc1Fault: props.globals.initNode("/ECAM/warnings/logic/dc-1-output"), + dc2Fault: props.globals.initNode("/ECAM/warnings/logic/dc-2-output"), + dcBatFault: props.globals.initNode("/ECAM/warnings/logic/dc-bat-output"), + ac1Fault: props.globals.initNode("/ECAM/warnings/logic/ac-1-output"), + ac2Fault: props.globals.initNode("/ECAM/warnings/logic/ac-2-output"), + acEssFault: props.globals.initNode("/ECAM/warnings/logic/ac-ess-output"), + dcEssShed: props.globals.initNode("/ECAM/warnings/logic/dc-ess-shed-output"), + acEssShed: props.globals.initNode("/ECAM/warnings/logic/ac-ess-shed-output"), + centerPumpsOff: props.globals.initNode("/ECAM/warnings/fuel/center-pumps-off-output"), + lowLevelBoth: props.globals.initNode("/ECAM/warnings/fuel/lo-level-l-r-output"), }, Flipflops: { apuGenFault: props.globals.initNode("/ECAM/warnings/flipflop/apu-gen-fault"), @@ -389,6 +429,7 @@ var ECAM_controller = { m.active = 0; } } + me._ready = 1; }, clear: func() { hasCleared = 0; @@ -479,7 +520,7 @@ var ECAM_controller = { }; setlistener("/systems/electrical/bus/dc-ess", func { - if (dc_ess.getValue() < 25) { + if (systems.ELEC.Bus.dcEss.getValue() < 25) { ECAM_controller.reset(); } }, 0, 0); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 5a3ce8d8..7dc62249 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -10,6 +10,7 @@ var apWarn = props.globals.getNode("/it-autoflight/output/ap-warning", 1); var athrWarn = props.globals.getNode("/it-autoflight/output/athr-warning", 1); var emerGen = props.globals.getNode("/controls/electrical/switches/emer-gen", 1); +var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var state1Node = props.globals.getNode("/engines/engine[0]/state", 1); var state2Node = props.globals.getNode("/engines/engine[1]/state", 1); var wing_pb = props.globals.getNode("/controls/ice-protection/wing", 1); @@ -40,6 +41,10 @@ var bigThree = nil; var altAlertSteady = 0; var altAlertFlash = 0; +var _SATval = nil; + + +var ecamConfigTest = props.globals.initNode("/ECAM/to-config-test", 0, "BOOL"); var messages_priority_3 = func { phaseVar3 = phaseNode.getValue(); @@ -55,13 +60,13 @@ var messages_priority_3 = func { } # FCTL FLAPS NOT ZERO - if (flap_not_zero.clearFlag == 0 and phaseVar3 == 6 and pts.Controls.Flight.flapsInput.getValue() != 0 and pts.Instrumentation.Altimeter.indicatedFt.getValue() > 22000) { + if (flap_not_zero.clearFlag == 0 and warningNodes.Logic.flapNotZero.getBoolValue()) { flap_not_zero.active = 1; } else { ECAM_controller.warningReset(flap_not_zero); } - if ((phaseVar3 == 1 or (phaseVar3 >= 5 and phaseVar3 <= 7)) and getprop("/systems/navigation/adr/output/overspeed")) { + if (overspeed.clearFlag == 0 and (phaseVar3 == 1 or (phaseVar3 >= 5 and phaseVar3 <= 7)) and getprop("/systems/navigation/adr/output/overspeed")) { overspeed.active = 1; if (getprop("/systems/navigation/adr/computation/overspeed-vmo") or getprop("/systems/navigation/adr/computation/overspeed-mmo")) { overspeedVMO.active = 1; @@ -95,7 +100,7 @@ var messages_priority_3 = func { if (allEngFail.clearFlag == 0 and dualFailNode.getBoolValue()) { allEngFail.active = 1; - if (allEngFailElec.clearFlag == 0 and getprop("/systems/electrical/relay/emer-glc/contact-pos") == 0) { + if (allEngFailElec.clearFlag == 0 and systems.ELEC.Source.EmerGen.relayPos.getValue() == 0) { allEngFailElec.active = 1; } else { ECAM_controller.warningReset(allEngFailElec); @@ -136,7 +141,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(allEngFailAPU); } - if (allEngFailLevers.clearFlag == 0 and (pts.Controls.Engines.Engine.throttleLever[0].getValue() > 0.01 or pts.Controls.Engines.Engine.throttleLever[0].getValue() > 0.01)) { + if (allEngFailLevers.clearFlag == 0 and (pts.Controls.Engines.Engine.throttleLever[0].getValue() > 0.01 or pts.Controls.Engines.Engine.throttleLever[1].getValue() > 0.01)) { allEngFailLevers.active = 1; } else { ECAM_controller.warningReset(allEngFailLevers); @@ -181,7 +186,7 @@ var messages_priority_3 = func { } # ENG ABV IDLE - if (eng1ThrLvrAbvIdle.clearFlag == 0 and ((phaseVar3 >= 1 and phaseVar3 <= 4) or (phaseVar3 >= 6 and phaseVar3 <= 9)) and warningNodes.Flipflops.eng1ThrLvrAbvIdle.getValue()) { # AND NOT RUNWAY TOO SHORT + if (eng1ThrLvrAbvIdle.clearFlag == 0 and ((phaseVar3 >= 2 and phaseVar3 <= 4) or (phaseVar3 >= 6 and phaseVar3 <= 9)) and warningNodes.Flipflops.eng1ThrLvrAbvIdle.getValue()) { # AND NOT RUNWAY TOO SHORT eng1ThrLvrAbvIdle.active = 1; if (eng1ThrLvrAbvIdle2.clearFlag == 0) { eng1ThrLvrAbvIdle2.active = 1; @@ -193,7 +198,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng1ThrLvrAbvIdle2); } - if (eng2ThrLvrAbvIdle.clearFlag == 0 and ((phaseVar3 >= 1 and phaseVar3 <= 4) or (phaseVar3 >= 6 and phaseVar3 <= 9)) and warningNodes.Flipflops.eng2ThrLvrAbvIdle.getValue()) { # AND NOT RUNWAY TOO SHORT + if (eng2ThrLvrAbvIdle.clearFlag == 0 and ((phaseVar3 >= 2 and phaseVar3 <= 4) or (phaseVar3 >= 6 and phaseVar3 <= 9)) and warningNodes.Flipflops.eng2ThrLvrAbvIdle.getValue()) { # AND NOT RUNWAY TOO SHORT eng2ThrLvrAbvIdle.active = 1; if (eng2ThrLvrAbvIdle2.clearFlag == 0) { eng2ThrLvrAbvIdle2.active = 1; @@ -206,19 +211,19 @@ var messages_priority_3 = func { } # ENG FIRE - if ((eng1FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine1/warning-active") == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng1FireGnEvac.clearFlag == 0 and getprop("/systems/fire/engine1/warning-active") == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) { + if ((eng1FireFlAgent2.clearFlag == 0 and systems.eng1FireWarn.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng1FireGnEvac.clearFlag == 0 and systems.eng1FireWarn.getValue() == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) { eng1Fire.active = 1; } else { ECAM_controller.warningReset(eng1Fire); } - if ((eng2FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine2/warning-active") == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng2FireGnEvac.clearFlag == 0 and getprop("/systems/fire/engine2/warning-active") == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) { + if ((eng2FireFlAgent2.clearFlag == 0 and systems.eng2FireWarn.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) or (eng2FireGnEvac.clearFlag == 0 and systems.eng2FireWarn.getValue() == 1 and (phaseVar3 < 5 or phaseVar3 > 7))) { eng2Fire.active = 1; } else { ECAM_controller.warningReset(eng2Fire); } - if (apuFireMaster.clearFlag == 0 and getprop("/systems/fire/apu/warning-active")) { + if (apuFireMaster.clearFlag == 0 and systems.apuFireWarn.getValue() == 1) { apuFire.active = 1; } else { ECAM_controller.warningReset(apuFire); @@ -238,23 +243,23 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng1FireFlmaster); } - if (eng1FireFlPB.clearFlag == 0 and getprop("/controls/engines/engine[0]/fire-btn") == 0) { + if (eng1FireFlPB.clearFlag == 0 and systems.fireButtons[0].getValue() == 0) { eng1FireFlPB.active = 1; } else { ECAM_controller.warningReset(eng1FireFlPB); } - if (getprop("/systems/fire/engine1/agent1-timer") != 0 and getprop("/systems/fire/engine1/agent1-timer") != 99) { - eng1FireFlAgent1Timer.msg = " -AGENT AFT " ~ getprop("/systems/fire/engine1/agent1-timer") ~ " S...DISCH"; + if (systems.eng1AgentTimer.getValue() != 0 and systems.eng1AgentTimer.getValue() != 99) { + eng1FireFlAgent1Timer.msg = " -AGENT AFT " ~ systems.eng1AgentTimer.getValue() ~ " S...DISCH"; } - if (eng1FireFlAgent1.clearFlag == 0 and getprop("/controls/engines/engine[0]/fire-btn") == 1 and !getprop("/systems/fire/engine1/disch1") and getprop("/systems/fire/engine1/agent1-timer") != 0 and getprop("/systems/fire/engine1/agent1-timer") != 99) { + if (eng1FireFlAgent1.clearFlag == 0 and systems.fireButtons[0].getValue() == 1 and !systems.extinguisherBottles.vector[0].lightProp.getValue() and systems.eng1AgentTimer.getValue() != 0 and systems.eng1AgentTimer.getValue() != 99) { eng1FireFlAgent1Timer.active = 1; } else { ECAM_controller.warningReset(eng1FireFlAgent1Timer); } - if (eng1FireFlAgent1.clearFlag == 0 and !getprop("/systems/fire/engine1/disch1") and (getprop("/systems/fire/engine1/agent1-timer") == 0 or getprop("/systems/fire/engine1/agent1-timer") == 99)) { + if (eng1FireFlAgent1.clearFlag == 0 and !systems.extinguisherBottles.vector[0].lightProp.getValue() and (systems.eng1AgentTimer.getValue() == 0 or systems.eng1AgentTimer.getValue() == 99)) { eng1FireFlAgent1.active = 1; } else { ECAM_controller.warningReset(eng1FireFlAgent1); @@ -266,17 +271,17 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng1FireFlATC); } - if (getprop("/systems/fire/engine1/agent2-timer") != 0 and getprop("/systems/fire/engine1/agent2-timer") != 99) { - eng1FireFl30Sec.msg = "•IF FIRE AFTER " ~ getprop("/systems/fire/engine1/agent2-timer") ~ " S:"; + if (systems.eng1Agent2Timer.getValue() != 0 and systems.eng1Agent2Timer.getValue() != 99) { + eng1FireFl30Sec.msg = "•IF FIRE AFTER " ~ systems.eng1Agent2Timer.getValue() ~ " S:"; } - if (eng1FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine1/disch1") and !getprop("/systems/fire/engine1/disch2") and getprop("/systems/fire/engine1/agent2-timer") > 0) { + if (eng1FireFlAgent2.clearFlag == 0 and systems.extinguisherBottles.vector[0].lightProp.getValue() and !systems.extinguisherBottles.vector[1].lightProp.getValue() and systems.eng1Agent2Timer.getValue() > 0) { eng1FireFl30Sec.active = 1; } else { ECAM_controller.warningReset(eng1FireFl30Sec); } - if (eng1FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine1/disch1") and !getprop("/systems/fire/engine1/disch2")) { + if (eng1FireFlAgent2.clearFlag == 0 and systems.extinguisherBottles.vector[0].lightProp.getValue() and !systems.extinguisherBottles.vector[1].lightProp.getValue()) { eng1FireFlAgent2.active = 1; } else { ECAM_controller.warningReset(eng1FireFlAgent2); @@ -324,19 +329,19 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng1FireGnmaster); } - if (eng1FireGnPB.clearFlag == 0 and getprop("/controls/engines/engine[0]/fire-btn") == 0) { + if (eng1FireGnPB.clearFlag == 0 and systems.fireButtons[0].getValue() == 0) { eng1FireGnPB.active = 1; } else { ECAM_controller.warningReset(eng1FireGnPB); } - if (eng1FireGnAgent1.clearFlag == 0 and !getprop("/systems/fire/engine1/disch1")) { + if (eng1FireGnAgent1.clearFlag == 0 and !systems.extinguisherBottles.vector[0].lightProp.getValue()) { eng1FireGnAgent1.active = 1; } else { ECAM_controller.warningReset(eng1FireGnAgent1); } - if (eng1FireGnAgent2.clearFlag == 0 and !getprop("/systems/fire/engine1/disch2")) { + if (eng1FireGnAgent2.clearFlag == 0 and !systems.extinguisherBottles.vector[1].lightProp.getValue()) { eng1FireGnAgent2.active = 1; } else { ECAM_controller.warningReset(eng1FireGnAgent2); @@ -393,23 +398,23 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng2FireFlmaster); } - if (eng2FireFlPB.clearFlag == 0 and getprop("/controls/engines/engine[1]/fire-btn") == 0) { + if (eng2FireFlPB.clearFlag == 0 and systems.fireButtons[1].getValue() == 0) { eng2FireFlPB.active = 1; } else { ECAM_controller.warningReset(eng2FireFlPB); } - if (getprop("/systems/fire/engine2/agent1-timer") != 0 and getprop("/systems/fire/engine2/agent1-timer") != 99) { - eng2FireFlAgent1Timer.msg = " -AGENT AFT " ~ getprop("/systems/fire/engine2/agent1-timer") ~ " S...DISCH"; + if (systems.eng2AgentTimer.getValue() != 0 and systems.eng2AgentTimer.getValue() != 99) { + eng2FireFlAgent1Timer.msg = " -AGENT AFT " ~ systems.eng2AgentTimer.getValue() ~ " S...DISCH"; } - if (eng2FireFlAgent1.clearFlag == 0 and getprop("/controls/engines/engine[1]/fire-btn") == 1 and !getprop("/systems/fire/engine2/disch1") and getprop("/systems/fire/engine2agent1-timer") != 0 and getprop("/systems/fire/engine2/agent1-timer") != 99) { + if (eng2FireFlAgent1.clearFlag == 0 and systems.fireButtons[1].getValue() == 1 and !systems.extinguisherBottles.vector[2].lightProp.getValue() and getprop("/systems/fire/engine2agent1-timer") != 0 and systems.eng2AgentTimer.getValue() != 99) { eng2FireFlAgent1Timer.active = 1; } else { ECAM_controller.warningReset(eng2FireFlAgent1Timer); } - if (eng2FireFlAgent1.clearFlag == 0 and !getprop("/systems/fire/engine2/disch1") and (getprop("/systems/fire/engine2/agent1-timer") == 0 or getprop("/systems/fire/engine2/agent1-timer") == 99)) { + if (eng2FireFlAgent1.clearFlag == 0 and !systems.extinguisherBottles.vector[2].lightProp.getValue() and (systems.eng2AgentTimer.getValue() == 0 or systems.eng2AgentTimer.getValue() == 99)) { eng2FireFlAgent1.active = 1; } else { ECAM_controller.warningReset(eng2FireFlAgent1); @@ -421,17 +426,17 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng2FireFlATC); } - if (getprop("/systems/fire/engine2/agent2-timer") != 0 and getprop("/systems/fire/engine2/agent2-timer") != 99) { - eng2FireFl30Sec.msg = "•IF FIRE AFTER " ~ getprop("/systems/fire/engine2/agent2-timer") ~ " S:"; + if (systems.eng2Agent2Timer.getValue() != 0 and systems.eng2Agent2Timer.getValue() != 99) { + eng2FireFl30Sec.msg = "•IF FIRE AFTER " ~ systems.eng2Agent2Timer.getValue() ~ " S:"; } - if (eng2FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine2/disch1") and !getprop("/systems/fire/engine2/disch2") and getprop("/systems/fire/engine2/agent2-timer") > 0) { + if (eng2FireFlAgent2.clearFlag == 0 and systems.extinguisherBottles.vector[2].lightProp.getValue() and !systems.extinguisherBottles.vector[4].lightProp.getValue() and systems.eng2Agent2Timer.getValue() > 0) { eng2FireFl30Sec.active = 1; } else { ECAM_controller.warningReset(eng2FireFl30Sec); } - if (eng2FireFlAgent2.clearFlag == 0 and getprop("/systems/fire/engine2/disch1") and !getprop("/systems/fire/engine2/disch2")) { + if (eng2FireFlAgent2.clearFlag == 0 and systems.extinguisherBottles.vector[2].lightProp.getValue() and !systems.extinguisherBottles.vector[4].lightProp.getValue()) { eng2FireFlAgent2.active = 1; } else { ECAM_controller.warningReset(eng2FireFlAgent2); @@ -479,19 +484,19 @@ var messages_priority_3 = func { ECAM_controller.warningReset(eng2FireGnmaster); } - if (eng2FireGnPB.clearFlag == 0 and getprop("/controls/engines/engine[1]/fire-btn") == 0) { + if (eng2FireGnPB.clearFlag == 0 and systems.fireButtons[1].getValue() == 0) { eng2FireGnPB.active = 1; } else { ECAM_controller.warningReset(eng2FireGnPB); } - if (eng2FireGnAgent1.clearFlag == 0 and !getprop("/systems/fire/engine2/disch1")) { + if (eng2FireGnAgent1.clearFlag == 0 and !systems.extinguisherBottles.vector[2].lightProp.getValue()) { eng2FireGnAgent1.active = 1; } else { ECAM_controller.warningReset(eng2FireGnAgent1); } - if (eng2FireGnAgent2.clearFlag == 0 and !getprop("/systems/fire/engine2/disch2")) { + if (eng2FireGnAgent2.clearFlag == 0 and !systems.extinguisherBottles.vector[4].lightProp.getValue()) { eng2FireGnAgent2.active = 1; } else { ECAM_controller.warningReset(eng2FireGnAgent2); @@ -542,17 +547,17 @@ var messages_priority_3 = func { ECAM_controller.warningReset(apuFirePB); } - if (getprop("/systems/fire/apu/agent-timer") != 0 and getprop("/systems/fire/apu/agent-timer") != 99) { - apuFireAgentTimer.msg = " -AGENT AFT " ~ getprop("/systems/fire/apu/agent-timer") ~ " S...DISCH"; + if (systems.apuAgentTimer.getValue() != 0 and systems.apuAgentTimer.getValue() != 99) { + apuFireAgentTimer.msg = " -AGENT AFT " ~ systems.apuAgentTimer.getValue() ~ " S...DISCH"; } - if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !getprop("/systems/fire/apu/disch") and getprop("/systems/fire/apu/agent-timer") != 0) { + if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !systems.extinguisherBottles.vector[5].lightProp.getValue() and systems.apuAgentTimer.getValue() != 0) { apuFireAgentTimer.active = 1; } else { ECAM_controller.warningReset(apuFireAgentTimer); } - if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !getprop("/systems/fire/apu/disch") and getprop("/systems/fire/apu/agent-timer") == 0) { + if (apuFireAgent.clearFlag == 0 and systems.APUNodes.Controls.fire.getValue() and !systems.extinguisherBottles.vector[5].lightProp.getValue() and systems.apuAgentTimer.getValue() == 0) { apuFireAgent.active = 1; } else { ECAM_controller.warningReset(apuFireAgent); @@ -570,35 +575,29 @@ var messages_priority_3 = func { ECAM_controller.warningReset(apuFireMaster); } - if ((getprop("/ECAM/to-config-test") and (phaseVar3 == 1 or phaseVar3 == 2 or phaseVar3 == 9)) or phaseVar3 == 3 or phaseVar3 == 4) { + if ((ecamConfigTest.getValue() and (phaseVar3 == 1 or phaseVar3 == 2 or phaseVar3 == 9)) or phaseVar3 == 3 or phaseVar3 == 4) { takeoffConfig = 1; } else { takeoffConfig = 0; } - if ((pts.Controls.Flight.flapsInput.getValue() == 0 or pts.Controls.Flight.flapsInput.getValue() == 4) and takeoffConfig) { - if (slats_config.clearFlag == 0) { - slats_config.active = 1; - slats_config_1.active = 1; - } else { - ECAM_controller.warningReset(slats_config); - ECAM_controller.warningReset(slats_config_1); - } - if (flaps_config.clearFlag == 0) { - flaps_config.active = 1; - flaps_config_1.active = 1; - } else { - ECAM_controller.warningReset(flaps_config); - ECAM_controller.warningReset(flaps_config_1); - } + if (slats_config.clearFlag == 0 and (warningNodes.Logic.slatsConfig.getBoolValue() or (takeoffConfig and warningNodes.Logic.slatsConfig2.getBoolValue()))) { + slats_config.active = 1; + slats_config_1.active = 1; } else { ECAM_controller.warningReset(slats_config); ECAM_controller.warningReset(slats_config_1); + } + + if (flaps_config.clearFlag == 0 and (warningNodes.Logic.flapsConfig.getBoolValue() or (takeoffConfig and warningNodes.Logic.flapsConfig2.getBoolValue()))) { + flaps_config.active = 1; + flaps_config_1.active = 1; + } else { ECAM_controller.warningReset(flaps_config); ECAM_controller.warningReset(flaps_config_1); } - if ((spd_brk_config.clearFlag == 0) and pts.Controls.Flight.speedbrake.getValue() != 0 and takeoffConfig) { + if (spd_brk_config.clearFlag == 0 and (warningNodes.Logic.spdBrkConfig.getBoolValue() or (takeoffConfig and warningNodes.Logic.spdBrkConfig2.getBoolValue()))) { spd_brk_config.active = 1; spd_brk_config_1.active = 1; } else { @@ -606,7 +605,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(spd_brk_config_1); } - if ((pitch_trim_config.clearFlag == 0) and (getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 2.6 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -2.6) and takeoffConfig) { + if (pitch_trim_config.clearFlag == 0 and (warningNodes.Logic.pitchTrimConfig.getBoolValue() or (takeoffConfig and warningNodes.Logic.pitchTrimConfig2.getBoolValue()))) { pitch_trim_config.active = 1; pitch_trim_config_1.active = 1; } else { @@ -614,7 +613,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(pitch_trim_config_1); } - if ((rud_trim_config.clearFlag == 0) and (getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.6 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.6) and takeoffConfig) { + if (rud_trim_config.clearFlag == 0 and (warningNodes.Logic.rudTrimConfig.getBoolValue() or (takeoffConfig and warningNodes.Logic.rudTrimConfig2.getBoolValue()))) { rud_trim_config.active = 1; rud_trim_config_1.active = 1; } else { @@ -622,7 +621,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(rud_trim_config_1); } - if ((park_brk_config.clearFlag == 0) and warningNodes.Flipflops.parkBrk.getValue() and phaseVar3 >= 2 and phaseVar3 <= 3) { + if (park_brk_config.clearFlag == 0 and warningNodes.Logic.parkBrkConfig.getValue() and phaseVar3 >= 2 and phaseVar3 <= 3) { park_brk_config.active = 1; } else { ECAM_controller.warningReset(park_brk_config); @@ -667,7 +666,7 @@ var messages_priority_3 = func { if (gearNotDownLocked.clearFlag == 0 and warningNodes.Logic.gearNotDownLocked.getBoolValue() and phaseVar3 != 3 and phaseVar3 != 4 and phaseVar3 != 5 and phaseVar3 != 8) { gearNotDownLocked.active = 1; - if (gearNotDownLockedRec.clearFlag == 0 and warningNodes.Logic.gearNotDownLockedFlipflop.getBoolValue()) { + if (gearNotDownLockedRec.clearFlag == 0 and warningNodes.Logic.gearNotDownLockedFlipflop.getValue() == 0) { gearNotDownLockedRec.active = 1; gearNotDownLockedWork.active = 1; } else { @@ -725,85 +724,145 @@ var messages_priority_3 = func { altAlertFlash = 0; } - if (!systems.cargoTestBtn.getBoolValue()) { - if (cargoSmokeFwd.clearFlag == 0 and systems.fwdCargoFireWarn.getBoolValue() and (phaseVar3 <= 3 or phaseVar3 >= 9 or phaseVar3 == 6)) { - cargoSmokeFwd.active = 1; - } elsif (cargoSmokeFwd.clearFlag == 1 or systems.cargoTestBtnOff.getBoolValue()) { - ECAM_controller.warningReset(cargoSmokeFwd); - cargoSmokeFwd.isMainMsg = 1; + if (cargoSmokeFwd.clearFlag == 0 and systems.fwdCargoFireWarn.getBoolValue() and (phaseVar3 <= 3 or phaseVar3 >= 9 or phaseVar3 == 6)) { + cargoSmokeFwd.active = 1; + + if (cargoSmokeFwdFans.clearFlag == 0 and systems.PNEU.Switch.cabinFans.getValue()) { + cargoSmokeFwdFans.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeFwdFans); } - if (cargoSmokeFwdAgent.clearFlag == 0 and cargoSmokeFwd.active == 1 and !getprop("/systems/fire/cargo/disch")) { + if (cargoSmokeFwdGrdClsd.clearFlag == 0 and (phaseVar3 == 1 or phaseVar3 == 10)) { + cargoSmokeFwdGrdClsd.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeFwdGrdClsd); + } + + if (cargoSmokeFwdAgent.clearFlag == 0 and !systems.cargoExtinguisherBottles.vector[0].lightProp.getValue()) { cargoSmokeFwdAgent.active = 1; } else { ECAM_controller.warningReset(cargoSmokeFwdAgent); - cargoSmokeFwd.isMainMsg = 0; - } - - if (cargoSmokeAft.clearFlag == 0 and systems.aftCargoFireWarn.getBoolValue() and (phaseVar3 <= 3 or phaseVar3 >= 9 or phaseVar3 == 6)) { - cargoSmokeAft.active = 1; - } elsif (cargoSmokeAft.clearFlag == 1 or systems.cargoTestBtnOff.getBoolValue()) { - ECAM_controller.warningReset(cargoSmokeAft); - cargoSmokeAft.isMainMsg = 1; - systems.cargoTestBtnOff.setBoolValue(0); } - if (cargoSmokeAftAgent.clearFlag == 0 and cargoSmokeAft.active == 1 and !getprop("/systems/fire/cargo/disch")) { - cargoSmokeAftAgent.active = 1; + if (FWC.Timer.gnd.getValue() == 0) { + cargoSmokeFwdGrd.active = 1; } else { - ECAM_controller.warningReset(cargoSmokeAftAgent); - cargoSmokeAft.isMainMsg = 0; + ECAM_controller.warningReset(cargoSmokeFwdGrd); + } + + if (cargoSmokeFwdDoors.clearFlag == 0) { + cargoSmokeFwdDoors.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeFwdDoors); + } + + if (cargoSmokeFwdDisemb.clearFlag == 0) { + cargoSmokeFwdDisemb.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeFwdDisemb); } } else { - if (systems.aftCargoFireWarn.getBoolValue()) { - cargoSmokeFwd.active = 1; - cargoSmokeFwdAgent.active = 1; - cargoSmokeAft.active = 1; + ECAM_controller.warningReset(cargoSmokeFwd); + ECAM_controller.warningReset(cargoSmokeFwdFans); + ECAM_controller.warningReset(cargoSmokeFwdGrdClsd); + ECAM_controller.warningReset(cargoSmokeFwdAgent); + ECAM_controller.warningReset(cargoSmokeFwdGrd); + ECAM_controller.warningReset(cargoSmokeFwdDoors); + ECAM_controller.warningReset(cargoSmokeFwdDisemb); + systems.cargoTestBtnOff.setBoolValue(0); + } + + if (cargoSmokeAft.clearFlag == 0 and systems.aftCargoFireWarn.getBoolValue() and (phaseVar3 <= 3 or phaseVar3 >= 9 or phaseVar3 == 6)) { + cargoSmokeAft.active = 1; + + if (cargoSmokeAftFans.clearFlag == 0 and systems.PNEU.Switch.cabinFans.getValue()) { + cargoSmokeAftFans.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeAftFans); + } + + if (cargoSmokeAftGrdClsd.clearFlag == 0 and (phaseVar3 == 1 or phaseVar3 == 10)) { + cargoSmokeAftGrdClsd.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeAftGrdClsd); + } + + if (cargoSmokeAftAgent.clearFlag == 0 and !systems.cargoExtinguisherBottles.vector[1].lightProp.getValue()) { cargoSmokeAftAgent.active = 1; } else { - ECAM_controller.warningReset(cargoSmokeFwd); - ECAM_controller.warningReset(cargoSmokeFwdAgent); - ECAM_controller.warningReset(cargoSmokeAft); ECAM_controller.warningReset(cargoSmokeAftAgent); } + + if (FWC.Timer.gnd.getValue() == 0) { + cargoSmokeAftGrd.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeAftGrd); + } + + if (cargoSmokeAftDoors.clearFlag == 0) { + cargoSmokeAftDoors.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeAftDoors); + } + + if (cargoSmokeAftDisemb.clearFlag == 0) { + cargoSmokeAftDisemb.active = 1; + } else { + ECAM_controller.warningReset(cargoSmokeAftDisemb); + } + } else { + ECAM_controller.warningReset(cargoSmokeAft); + ECAM_controller.warningReset(cargoSmokeAftFans); + ECAM_controller.warningReset(cargoSmokeAftGrdClsd); + ECAM_controller.warningReset(cargoSmokeAftAgent); + ECAM_controller.warningReset(cargoSmokeAftGrd); + ECAM_controller.warningReset(cargoSmokeAftDoors); + ECAM_controller.warningReset(cargoSmokeAftDisemb); + systems.cargoTestBtnOff.setBoolValue(0); + } + + if (lavatorySmoke.clearFlag == 0 and systems.lavatoryFireWarn.getValue() and phaseVar3 != 4 and phaseVar3 != 5 and phaseVar3 != 7 and phaseVar3 != 8) { + lavatorySmoke.active = 1; + lavatorySmokeComm.active = 1; + } else { + ECAM_controller.warningReset(lavatorySmoke); + ECAM_controller.warningReset(lavatorySmokeComm); } # ESS on BAT - if ((!gear.getValue() or !pts.Controls.Gear.gearDown.getValue()) and getprop("/systems/electrical/some-electric-thingie/static-inverter-timer") == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) { + # NEW EMER ELEC CONFIG + if (essBusOnBat.clearFlag == 0 and warningNodes.Timers.staticInverter.getValue() == 1 and phaseVar3 >= 5 and phaseVar3 <= 7) { essBusOnBat.active = 1; - essBusOnBatLGUplock.active = 1; - essBusOnBatManOn.active = 1; - essBusOnBatRetract.active = 1; - essBusOnBatMinSpeed.active = 1; - essBusOnBatLGCB.active = 1; + if (essBusOnBatMinSpeed.clearFlag == 0 and systems.HYD.Rat.position.getValue() != 0) { + essBusOnBatMinSpeed.active = 1; + } else { + ECAM_controller.warningReset(essBusOnBatMinSpeed); + } } else { ECAM_controller.warningReset(essBusOnBat); - ECAM_controller.warningReset(essBusOnBatLGUplock); - ECAM_controller.warningReset(essBusOnBatManOn); - ECAM_controller.warningReset(essBusOnBatRetract); ECAM_controller.warningReset(essBusOnBatMinSpeed); - ECAM_controller.warningReset(essBusOnBatLGCB); } # EMER CONFIG - if (systems.ELEC.EmerElec.getValue() and !dualFailNode.getBoolValue() and phaseVar3 != 4 and phaseVar3 != 8 and emerconfig.clearFlag == 0 and !getprop("/systems/acconfig/autoconfig-running")) { + if (systems.ELEC.EmerElec.getValue() and !dualFailNode.getBoolValue() and phaseVar3 != 4 and phaseVar3 != 8 and emerconfig.clearFlag == 0 and !pts.Acconfig.running.getBoolValue()) { emerconfig.active = 1; - if (getprop("/systems/hydraulic/sources/rat/position") != 0 and emerconfigMinRat.clearFlag == 0) { + if (systems.HYD.Rat.position.getValue() != 0 and emerconfigMinRat.clearFlag == 0 and FWC.Timer.gnd.getValue() == 0) { emerconfigMinRat.active = 1; } else { ECAM_controller.warningReset(emerconfigMinRat); } - if (!(getprop("/systems/electrical/some-electric-thingie/generator-1-reset") and getprop("/systems/electrical/some-electric-thingie/generator-2-reset")) and emerconfigGen.clearFlag == 0) { + if ((!getprop("/systems/electrical/some-electric-thingie/generator-1-reset") or !getprop("/systems/electrical/some-electric-thingie/generator-2-reset")) and emerconfigGen.clearFlag == 0) { emerconfigGen.active = 1; # EGEN12R TRUE } else { ECAM_controller.warningReset(emerconfigGen); } - if (!(getprop("/systems/electrical/some-electric-thingie/generator-1-reset-bustie") and getprop("/systems/electrical/some-electric-thingie/generator-2-reset-bustie")) and emerconfigGen2.clearFlag == 0) { + if ((!getprop("/systems/electrical/some-electric-thingie/generator-1-reset-bustie") or !getprop("/systems/electrical/some-electric-thingie/generator-2-reset-bustie")) and emerconfigGen2.clearFlag == 0) { emerconfigGen2.active = 1; - if (getprop("/controls/electrical/switches/bus-tie")) { + if (systems.ELEC.Switch.busTie.getBoolValue()) { emerconfigBusTie.active = 1; } else { ECAM_controller.warningReset(emerconfigBusTie); @@ -815,13 +874,13 @@ var messages_priority_3 = func { ECAM_controller.warningReset(emerconfigGen3); } - if (getprop("/systems/electrical/relay/emer-glc/contact-pos") == 0 and emerconfigManOn.clearFlag == 0) { + if (systems.ELEC.Source.EmerGen.relayPos.getValue() == 0 and emerconfigManOn.clearFlag == 0) { emerconfigManOn.active = 1; } else { ECAM_controller.warningReset(emerconfigManOn); } - if (getprop("/controls/engines/engine-start-switch") != 2 and emerconfigEngMode.clearFlag == 0) { + if (pts.Controls.Engines.startSw.getValue() != 2 and emerconfigEngMode.clearFlag == 0) { emerconfigEngMode.active = 1; } else { ECAM_controller.warningReset(emerconfigEngMode); @@ -833,48 +892,64 @@ var messages_priority_3 = func { ECAM_controller.warningReset(emerconfigRadio); } - if (emerconfigIcing.clearFlag == 0) { - emerconfigIcing.active = 1; - } else { - ECAM_controller.warningReset(emerconfigIcing); - } - - if (emerconfigFuelG.clearFlag == 0) { - emerconfigFuelG.active = 1; + if (FWC.Timer.gnd.getValue() == 0) { + if (emerconfigFuelG.clearFlag == 0) { + emerconfigFuelG.active = 1; + } else { + ECAM_controller.warningReset(emerconfigFuelG); + } + + if (emerconfigFuelG2.clearFlag == 0) { + emerconfigFuelG2.active = 1; + } else { + ECAM_controller.warningReset(emerconfigFuelG2); + } + + if (fbw.FBW.Computers.fac1.getBoolValue() == 0 and emerconfigFAC.clearFlag == 0) { + emerconfigFAC.active = 1; + } else { + ECAM_controller.warningReset(emerconfigFAC); + } } else { ECAM_controller.warningReset(emerconfigFuelG); - } - - if (emerconfigFuelG2.clearFlag == 0) { - emerconfigFuelG2.active = 1; - } else { ECAM_controller.warningReset(emerconfigFuelG2); - } - - if (fbw.FBW.Computers.fac1.getBoolValue() == 0 and emerconfigFAC.clearFlag == 0) { - emerconfigFAC.active = 1; - } else { ECAM_controller.warningReset(emerconfigFAC); } - if (!getprop("/controls/electrical/switches/bus-tie") and emerconfigBusTie2.clearFlag == 0) { + if (!systems.ELEC.Switch.busTie.getBoolValue() and emerconfigBusTie2.clearFlag == 0) { emerconfigBusTie2.active = 1; } else { ECAM_controller.warningReset(emerconfigBusTie2); } - if (emerconfigAPU.clearFlag == 0) { - emerconfigAPU.active = 1; + if (FWC.Timer.gnd.getValue() == 0) { + if (emerconfigAPU.clearFlag == 0) { + emerconfigAPU.active = 1; + } else { + ECAM_controller.warningReset(emerconfigAPU); + } + + if (emerconfigVent.clearFlag == 0) { + emerconfigVent.active = 1; + } else { + ECAM_controller.warningReset(emerconfigVent); + } } else { ECAM_controller.warningReset(emerconfigAPU); - } - - if (emerconfigVent.clearFlag == 0) { - emerconfigVent.active = 1; - } else { ECAM_controller.warningReset(emerconfigVent); } + if (emerconfigFuelIN.clearFlag == 0 and warningNodes.Logic.dc2FuelConsumptionIncreased.getValue()) { + emerconfigFuelIN.active = 1; + } else { + ECAM_controller.warningReset(emerconfigFuelIN); + } + + if (emerconfigFMSPRD.clearFlag == 0 and warningNodes.Logic.dc2FMSPredictions.getValue()) { + emerconfigFMSPRD.active = 1; + } else { + ECAM_controller.warningReset(emerconfigFMSPRD); + } } else { ECAM_controller.warningReset(emerconfig); ECAM_controller.warningReset(emerconfigMinRat); @@ -885,16 +960,17 @@ var messages_priority_3 = func { ECAM_controller.warningReset(emerconfigManOn); ECAM_controller.warningReset(emerconfigEngMode); ECAM_controller.warningReset(emerconfigRadio); - ECAM_controller.warningReset(emerconfigIcing); ECAM_controller.warningReset(emerconfigFuelG); ECAM_controller.warningReset(emerconfigFuelG2); ECAM_controller.warningReset(emerconfigFAC); ECAM_controller.warningReset(emerconfigBusTie2); ECAM_controller.warningReset(emerconfigAPU); ECAM_controller.warningReset(emerconfigVent); + ECAM_controller.warningReset(emerconfigFuelIN); + ECAM_controller.warningReset(emerconfigFMSPRD); } - if (hydBYloPr.clearFlag == 0 and phaseVar3 != 4 and phaseVar3 != 5 and warningNodes.Logic.blueYellow.getValue()) { + if (hydBYloPr.clearFlag == 0 and warningNodes.Logic.blueYellow.getValue()) { hydBYloPr.active = 1; if (hydBYloPrRat.clearFlag == 0 and systems.HYD.Rat.position.getValue() != 0) { hydBYloPrRat.active = 1; @@ -969,7 +1045,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(hydBYloPrFmsPredict); } - if (hydGBloPr.clearFlag == 0 and phaseVar3 != 4 and phaseVar3 != 5 and warningNodes.Logic.blueGreen.getValue()) { + if (hydGBloPr.clearFlag == 0 and warningNodes.Logic.blueGreen.getValue()) { hydGBloPr.active = 1; if (hydGBloPrRat.clearFlag == 0 and systems.HYD.Rat.position.getValue() != 0) { hydGBloPrRat.active = 1; @@ -1087,114 +1163,754 @@ var messages_priority_3 = func { var messages_priority_2 = func { phaseVar2 = phaseNode.getValue(); + + if ((phaseVar2 == 2 or phaseVar2 == 3 or phaseVar2 == 9) and warningNodes.Logic.thrLeversNotSet.getValue() and engThrustLvrNotSet.clearFlag == 0) { + engThrustLvrNotSet.active = 1; + + if (fadec.Thrust.limFlex.getValue()) { + engThrustLvrNotSetMCT.active = 1; + ECAM_controller.warningReset(engThrustLvrNotSetMCT); + } else { + engThrustLvrNotSetTO.active = 1; + ECAM_controller.warningReset(engThrustLvrNotSetTO); + } + } else { + ECAM_controller.warningReset(engThrustLvrNotSet); + ECAM_controller.warningReset(engThrustLvrNotSetMCT); + ECAM_controller.warningReset(engThrustLvrNotSetTO); + } + + if ((phaseVar2 >= 5 and phaseVar2 <= 7) and warningNodes.Logic.revSet.getValue() and engRevSet.clearFlag == 0) { + engRevSet.active = 1; + + if (engRevSetLevers.clearFlag == 0) { + engRevSetLevers.active = 1; + } else { + ECAM_controller.warningReset(engRevSetLevers); + } + } else { + ECAM_controller.warningReset(engRevSet); + ECAM_controller.warningReset(engRevSetLevers); + } + + if (warningNodes.Logic.eng1Fail.getValue() and eng1Fail.clearFlag == 0) { + eng1Fail.active = 1; + + if (0 == 1 and thrustMalfunction1.clearFlag == 0) { # OVER THR PROTECT + thrustMalfunction1.active = 1; + } else { + ECAM_controller.warningReset(thrustMalfunction1); + } + + if (0 == 1 and shaftFailure1.clearFlag == 0) { # PW ONLY + shaftFailure1.active = 1; + } else { + ECAM_controller.warningReset(shaftFailure1); + } + + if (phaseVar2 != 2 and phaseVar2 != 9 and pts.Controls.Engines.startSw.getValue() != 2 and eng1FailModeSel.clearFlag == 0) { # and not stall and not EGT protect + eng1FailModeSel.active = 1; + } else { + ECAM_controller.warningReset(eng1FailModeSel); + } + + if (phaseVar2 != 4 and warningNodes.Logic.phase5Trans.getValue() == 1) { + if (eng1FailThrLvrIdle.clearFlag == 0 and pts.Controls.Engines.Engine.throttleLever[0].getValue() > 0.01) { + eng1FailThrLvrIdle.active = 1; + } else { + ECAM_controller.warningReset(eng1FailThrLvrIdle); + } + + if (eng1FailNoRelight.clearFlag == 0 and phaseVar2 != 2 and phaseVar2 != 9 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { + eng1FailNoRelight.active = 1; + } else { + ECAM_controller.warningReset(eng1FailNoRelight); + } + + if (eng1FailMasterOff.clearFlag == 0 and pts.Controls.Engines.Engine.cutoffSw[0].getValue() == 0) { + eng1FailMasterOff.active = 1; + } else { + ECAM_controller.warningReset(eng1FailMasterOff); + } + + if (eng1FailDamage.clearFlag == 0 and systems.fireButtons[0].getValue() == 0) { + eng1FailDamage.active = 1; + } else { + ECAM_controller.warningReset(eng1FailDamage); + } + + if (eng1FailFirePB.clearFlag == 0 and systems.fireButtons[0].getValue() == 0) { + eng1FailFirePB.active = 1; + } else { + ECAM_controller.warningReset(eng1FailFirePB); + } + + if (eng1FailAgent1DischT.clearFlag == 0 and !systems.extinguisherBottles.vector[0].lightProp.getValue()) { + eng1FailAgent1DischT.active = 1; + } else { + ECAM_controller.warningReset(eng1FailAgent1DischT); + } + + if (eng1FailAgent1Disch.clearFlag == 0 and !systems.extinguisherBottles.vector[0].lightProp.getValue()) { + eng1FailAgent1Disch.active = 1; + } else { + ECAM_controller.warningReset(eng1FailAgent1Disch); + } + + if (eng1FailNoDamage.clearFlag == 0) { + eng1FailNoDamage.active = 1; + } else { + ECAM_controller.warningReset(eng1FailNoDamage); + } + + if (eng1FailRelight.clearFlag == 0) { + eng1FailRelight.active = 1; + } else { + ECAM_controller.warningReset(eng1FailRelight); + } + } else { + ECAM_controller.warningReset(eng1FailThrLvrIdle); + ECAM_controller.warningReset(eng1FailNoRelight); + ECAM_controller.warningReset(eng1FailMasterOff); + ECAM_controller.warningReset(eng1FailDamage); + ECAM_controller.warningReset(eng1FailFirePB); + ECAM_controller.warningReset(eng1FailAgent1DischT); + ECAM_controller.warningReset(eng1FailAgent1Disch); + ECAM_controller.warningReset(eng1FailNoDamage); + ECAM_controller.warningReset(eng1FailRelight); + } + } else { + ECAM_controller.warningReset(eng1Fail); + ECAM_controller.warningReset(thrustMalfunction1); + ECAM_controller.warningReset(shaftFailure1); + ECAM_controller.warningReset(eng1FailModeSel); + ECAM_controller.warningReset(eng1FailThrLvrIdle); + ECAM_controller.warningReset(eng1FailNoRelight); + ECAM_controller.warningReset(eng1FailMasterOff); + ECAM_controller.warningReset(eng1FailDamage); + ECAM_controller.warningReset(eng1FailFirePB); + ECAM_controller.warningReset(eng1FailAgent1DischT); + ECAM_controller.warningReset(eng1FailAgent1Disch); + ECAM_controller.warningReset(eng1FailNoDamage); + ECAM_controller.warningReset(eng1FailRelight); + } + + if (warningNodes.Logic.eng1Shutdown.getValue() and eng1ShutDown.clearFlag == 0) { + eng1ShutDown.active = 1; + + if (phaseVar2 != 4 and phaseVar2 != 5 and systems.fireButtons[0].getValue() == 0 and (systems.PNEU.Valves.wingLeft.getValue() or systems.PNEU.Valves.wingRight.getValue())) { + if (eng1ShutDownPack.clearFlag == 0 and systems.PNEU.Switch.pack1.getValue() and systems.PNEU.Switch.pack2.getValue()) { + eng1ShutDownPack.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownPack); + } + + if (eng1ShutDownXBleed.clearFlag == 0 and systems.PNEU.Valves.crossbleed.getValue() == 0) { + eng1ShutDownXBleed.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownXBleed); + } + } else { + ECAM_controller.warningReset(eng1ShutDownPack); + ECAM_controller.warningReset(eng1ShutDownXBleed); + } + + if (FWC.Timer.gnd.getValue() == 0 or systems.fireButtons[0].getValue() == 0) { + if (eng1ShutDownModeSel.clearFlag == 0 and pts.Controls.Engines.startSw.getValue() != 2) { + eng1ShutDownModeSel.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownModeSel); + } + + if (systems.FUEL.Switches.crossfeed.getValue() == 0) { + if (eng1ShutDownFuelLeak.clearFlag == 0) { + eng1ShutDownFuelLeak.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownFuelLeak); + } + + if (eng1ShutDownImbalance.clearFlag == 0) { + eng1ShutDownImbalance.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownImbalance); + } + } else { + ECAM_controller.warningReset(eng1ShutDownFuelLeak); + ECAM_controller.warningReset(eng1ShutDownImbalance); + } + } else { + ECAM_controller.warningReset(eng1ShutDownModeSel); + ECAM_controller.warningReset(eng1ShutDownFuelLeak); + ECAM_controller.warningReset(eng1ShutDownImbalance); + } + + if (eng1ShutDownTCAS.clearFlag == 0 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 2) { + eng1ShutDownTCAS.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownTCAS); + } + + if (0 == 1 and eng1ShutDownBuffet.clearFlag == 0) { # reverser unlocked + eng1ShutDownBuffet.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownBuffet); + } + + if (0 == 1 and eng1ShutDownSpeed.clearFlag == 0) { + eng1ShutDownSpeed.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownSpeed); + } + + if (systems.fireButtons[0].getValue() == 1) { + if (eng1ShutDownXBleedS.clearFlag == 0 and systems.PNEU.Valves.crossbleed.getValue() != 0) { + eng1ShutDownXBleedS.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownXBleedS); + } + + if (eng1ShutDownWingAI.clearFlag == 0 and (systems.PNEU.Valves.wingLeft.getValue() or systems.PNEU.Valves.wingRight.getValue())) { + eng1ShutDownWingAI.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownWingAI); + } + + if (eng1ShutDownIcing.clearFlag == 0) { + eng1ShutDownIcing.active = 1; + } else { + ECAM_controller.warningReset(eng1ShutDownIcing); + } + } else { + ECAM_controller.warningReset(eng1ShutDownXBleedS); + ECAM_controller.warningReset(eng1ShutDownWingAI); + ECAM_controller.warningReset(eng1ShutDownIcing); + } + } else { + ECAM_controller.warningReset(eng1ShutDown); + ECAM_controller.warningReset(eng1ShutDownPack); + ECAM_controller.warningReset(eng1ShutDownXBleed); + ECAM_controller.warningReset(eng1ShutDownModeSel); + ECAM_controller.warningReset(eng1ShutDownImbalance); + ECAM_controller.warningReset(eng1ShutDownTCAS); + ECAM_controller.warningReset(eng1ShutDownFuelLeak); + ECAM_controller.warningReset(eng1ShutDownBuffet); + ECAM_controller.warningReset(eng1ShutDownSpeed); + ECAM_controller.warningReset(eng1ShutDownXBleedS); + ECAM_controller.warningReset(eng1ShutDownWingAI); + ECAM_controller.warningReset(eng1ShutDownIcing); + } + + if (warningNodes.Logic.eng2Fail.getValue() and eng2Fail.clearFlag == 0) { + eng2Fail.active = 1; + + if (0 == 1 and thrustMalfunction2.clearFlag == 0) { # OVER THR PROTECT + thrustMalfunction2.active = 1; + } else { + ECAM_controller.warningReset(thrustMalfunction2); + } + + if (0 == 1 and shaftFailure2.clearFlag == 0) { # PW ONLY + shaftFailure2.active = 1; + } else { + ECAM_controller.warningReset(shaftFailure2); + } + + if (phaseVar2 != 2 and phaseVar2 != 9 and pts.Controls.Engines.startSw.getValue() != 2 and eng2FailModeSel.clearFlag == 0) { # and not stall and not EGT protect + eng2FailModeSel.active = 1; + } else { + ECAM_controller.warningReset(eng2FailModeSel); + } + + if (phaseVar2 != 4 and warningNodes.Logic.phase5Trans.getValue() == 1) { + if (eng2FailThrLvrIdle.clearFlag == 0 and pts.Controls.Engines.Engine.throttleLever[1].getValue() > 0.01) { + eng2FailThrLvrIdle.active = 1; + } else { + ECAM_controller.warningReset(eng2FailThrLvrIdle); + } + + if (eng2FailNoRelight.clearFlag == 0 and phaseVar2 != 2 and phaseVar2 != 9 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { + eng2FailNoRelight.active = 1; + } else { + ECAM_controller.warningReset(eng2FailNoRelight); + } + + if (eng2FailMasterOff.clearFlag == 0 and pts.Controls.Engines.Engine.cutoffSw[1].getValue() == 0) { + eng2FailMasterOff.active = 1; + } else { + ECAM_controller.warningReset(eng2FailMasterOff); + } + + if (eng2FailDamage.clearFlag == 0 and systems.fireButtons[1].getValue() == 0) { + eng2FailDamage.active = 1; + } else { + ECAM_controller.warningReset(eng2FailDamage); + } + + if (eng2FailFirePB.clearFlag == 0 and systems.fireButtons[1].getValue() == 0) { + eng2FailFirePB.active = 1; + } else { + ECAM_controller.warningReset(eng2FailFirePB); + } + + if (eng2FailAgent1DischT.clearFlag == 0 and !systems.extinguisherBottles.vector[2].lightProp.getValue()) { + eng2FailAgent1DischT.active = 1; + } else { + ECAM_controller.warningReset(eng2FailAgent1DischT); + } + + if (eng2FailAgent1Disch.clearFlag == 0 and !systems.extinguisherBottles.vector[2].lightProp.getValue()) { + eng2FailAgent1Disch.active = 1; + } else { + ECAM_controller.warningReset(eng2FailAgent1Disch); + } + + if (eng2FailNoDamage.clearFlag == 0) { + eng2FailNoDamage.active = 1; + } else { + ECAM_controller.warningReset(eng2FailNoDamage); + } + + if (eng2FailRelight.clearFlag == 0) { + eng2FailRelight.active = 1; + } else { + ECAM_controller.warningReset(eng2FailRelight); + } + } else { + ECAM_controller.warningReset(eng2FailThrLvrIdle); + ECAM_controller.warningReset(eng2FailNoRelight); + ECAM_controller.warningReset(eng2FailMasterOff); + ECAM_controller.warningReset(eng2FailDamage); + ECAM_controller.warningReset(eng2FailFirePB); + ECAM_controller.warningReset(eng2FailAgent1DischT); + ECAM_controller.warningReset(eng2FailAgent1Disch); + ECAM_controller.warningReset(eng2FailNoDamage); + ECAM_controller.warningReset(eng2FailRelight); + } + } else { + ECAM_controller.warningReset(eng2Fail); + ECAM_controller.warningReset(thrustMalfunction2); + ECAM_controller.warningReset(shaftFailure2); + ECAM_controller.warningReset(eng2FailModeSel); + ECAM_controller.warningReset(eng2FailThrLvrIdle); + ECAM_controller.warningReset(eng2FailNoRelight); + ECAM_controller.warningReset(eng2FailMasterOff); + ECAM_controller.warningReset(eng2FailDamage); + ECAM_controller.warningReset(eng2FailFirePB); + ECAM_controller.warningReset(eng2FailAgent1DischT); + ECAM_controller.warningReset(eng2FailAgent1Disch); + ECAM_controller.warningReset(eng2FailNoDamage); + ECAM_controller.warningReset(eng2FailRelight); + } + + if (warningNodes.Logic.eng2Shutdown.getValue() and eng2ShutDown.clearFlag == 0) { + eng2ShutDown.active = 1; + + if (phaseVar2 != 4 and phaseVar2 != 5 and systems.fireButtons[1].getValue() == 0 and (systems.PNEU.Valves.wingLeft.getValue() or systems.PNEU.Valves.wingRight.getValue())) { + if (eng2ShutDownPack1.clearFlag == 0 and systems.ELEC.EmerElec.getValue() and systems.PNEU.Switch.pack1.getValue() and systems.PNEU.Switch.pack2.getValue()) { + eng2ShutDownPack1.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownPack1); + } + + if (eng2ShutDownPack.clearFlag == 0 and !systems.ELEC.EmerElec.getValue() and systems.PNEU.Switch.pack1.getValue() and systems.PNEU.Switch.pack2.getValue()) { + eng2ShutDownPack.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownPack); + } + + if (eng2ShutDownXBleed.clearFlag == 0 and systems.PNEU.Valves.crossbleed.getValue() == 0) { + eng2ShutDownXBleed.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownXBleed); + } + } else { + ECAM_controller.warningReset(eng2ShutDownPack); + ECAM_controller.warningReset(eng2ShutDownXBleed); + } + + if (FWC.Timer.gnd.getValue() == 0 or systems.fireButtons[1].getValue() == 0) { + if (eng2ShutDownModeSel.clearFlag == 0 and pts.Controls.Engines.startSw.getValue() != 2) { + eng2ShutDownModeSel.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownModeSel); + } + + if (systems.FUEL.Switches.crossfeed.getValue() == 0) { + if (eng2ShutDownFuelLeak.clearFlag == 0) { + eng2ShutDownFuelLeak.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownFuelLeak); + } + + if (eng2ShutDownImbalance.clearFlag == 0) { + eng2ShutDownImbalance.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownImbalance); + } + } else { + ECAM_controller.warningReset(eng2ShutDownFuelLeak); + ECAM_controller.warningReset(eng2ShutDownImbalance); + } + } else { + ECAM_controller.warningReset(eng2ShutDownModeSel); + ECAM_controller.warningReset(eng2ShutDownFuelLeak); + ECAM_controller.warningReset(eng2ShutDownImbalance); + } + + if (eng2ShutDownTCAS.clearFlag == 0 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 2) { + eng2ShutDownTCAS.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownTCAS); + } + + if (0 == 1 and eng2ShutDownBuffet.clearFlag == 0) { # reverser unlocked + eng2ShutDownBuffet.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownBuffet); + } + + if (0 == 1 and eng2ShutDownSpeed.clearFlag == 0) { + eng2ShutDownSpeed.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownSpeed); + } + + if (systems.fireButtons[1].getValue() == 1) { + if (eng2ShutDownXBleedS.clearFlag == 0 and systems.PNEU.Valves.crossbleed.getValue() != 0) { + eng2ShutDownXBleedS.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownXBleedS); + } + + if (eng2ShutDownWingAI.clearFlag == 0 and (systems.PNEU.Valves.wingLeft.getValue() or systems.PNEU.Valves.wingRight.getValue())) { + eng2ShutDownWingAI.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownWingAI); + } + + if (eng2ShutDownIcing.clearFlag == 0) { + eng2ShutDownIcing.active = 1; + } else { + ECAM_controller.warningReset(eng2ShutDownIcing); + } + } else { + ECAM_controller.warningReset(eng2ShutDownXBleedS); + ECAM_controller.warningReset(eng2ShutDownWingAI); + ECAM_controller.warningReset(eng2ShutDownIcing); + } + } else { + ECAM_controller.warningReset(eng2ShutDown); + ECAM_controller.warningReset(eng2ShutDownPack); + ECAM_controller.warningReset(eng2ShutDownXBleed); + ECAM_controller.warningReset(eng2ShutDownModeSel); + ECAM_controller.warningReset(eng2ShutDownImbalance); + ECAM_controller.warningReset(eng2ShutDownTCAS); + ECAM_controller.warningReset(eng2ShutDownFuelLeak); + ECAM_controller.warningReset(eng2ShutDownBuffet); + ECAM_controller.warningReset(eng2ShutDownSpeed); + ECAM_controller.warningReset(eng2ShutDownXBleedS); + ECAM_controller.warningReset(eng2ShutDownWingAI); + ECAM_controller.warningReset(eng2ShutDownIcing); + } + + # SAT ABOVE FLEX TEMP + if (dmc.DMController.DMCs[1] != nil and dmc.DMController.DMCs[1].outputs[4] != nil) { + _SATval = dmc.DMController.DMCs[1].outputs[4].getValue() or nil; + } else { + _SATval = nil; + } + if (satAbvFlexTemp.clearFlag == 0 and phaseVar2 == 2 and fadec.Thrust.limFlex.getValue() and _SATval != nil and _SATval > fmgc.FMGCNodes.flexTemp.getValue() and !warningNodes.Logic.thrLeversNotSet.getValue()) { + satAbvFlexTemp.active = 1; + + if (satAbvFlexTempCheck.clearFlag == 0) { + satAbvFlexTempCheck.active = 1; + } else { + ECAM_controller.warningReset(satAbvFlexTempCheck); + } + } else { + ECAM_controller.warningReset(satAbvFlexTemp); + ECAM_controller.warningReset(satAbvFlexTempCheck); + } + # DC EMER CONFIG - if (!systems.ELEC.EmerElec.getValue() and systems.ELEC.Bus.dcEss.getValue() < 25 and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar2 != 4 and phaseVar2 != 8 and dcEmerconfig.clearFlag == 0) { + if (warningNodes.Timers.dcEmerConfig.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and dcEmerconfig.clearFlag == 0) { dcEmerconfig.active = 1; - dcEmerconfigManOn.active = 1; + if (systems.ELEC.Source.EmerGen.relayPos.getValue() == 0 and dcEmerconfigManOn.clearFlag == 0) { + dcEmerconfigManOn.active = 1; + } else { + ECAM_controller.warningReset(dcEmerconfigManOn); + } + + if ((warningNodes.Logic.dcEssFuelConsumptionIncreased.getValue() or warningNodes.Logic.dc2FuelConsumptionIncreased.getValue()) and dcEmerconfigFuel.clearFlag == 0) { + dcEmerconfigFuel.active = 1; + } else { + ECAM_controller.warningReset(dcEmerconfigFuel); + } } else { ECAM_controller.warningReset(dcEmerconfig); ECAM_controller.warningReset(dcEmerconfigManOn); + ECAM_controller.warningReset(dcEmerconfigFuel); } - if (!systems.ELEC.EmerElec.getValue() and !dcEmerconfig.active and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() < 25 and phaseVar2 != 4 and phaseVar2 != 8 and dcBus12Fault.clearFlag == 0) { + if (warningNodes.Timers.dc12Fault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and dcBus12Fault.clearFlag == 0) { dcBus12Fault.active = 1; - dcBus12FaultBlower.active = 1; - dcBus12FaultExtract.active = 1; - dcBus12FaultBaroRef.active = 1; - dcBus12FaultIcing.active = 1; - dcBus12FaultBrking.active = 1; + + if (dcBus12FaultBlower.clearFlag == 0) { + dcBus12FaultBlower.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultBlower); + } + + if (dcBus12FaultExtract.clearFlag == 0) { + dcBus12FaultExtract.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultExtract); + } + + if (dcBus12FaultBaroRef.clearFlag == 0) { + dcBus12FaultBaroRef.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultBaroRef); + } + + if (dcBus12FaultFuel.clearFlag == 0 and warningNodes.Logic.dc2FuelConsumptionIncreased.getValue()) { + dcBus12FaultFuel.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultFuel); + } + + if (dcBus12FaultPredict.clearFlag == 0 and warningNodes.Logic.dc2FMSPredictions.getValue()) { + dcBus12FaultPredict.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultPredict); + } + + if (dcBus12FaultIcing.clearFlag == 0) { + dcBus12FaultIcing.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultIcing); + } + + if (dcBus12FaultBrking.clearFlag == 0) { + dcBus12FaultBrking.active = 1; + } else { + ECAM_controller.warningReset(dcBus12FaultBrking); + } } else { ECAM_controller.warningReset(dcBus12Fault); ECAM_controller.warningReset(dcBus12FaultBlower); ECAM_controller.warningReset(dcBus12FaultExtract); ECAM_controller.warningReset(dcBus12FaultBaroRef); + ECAM_controller.warningReset(dcBus12FaultFuel); + ECAM_controller.warningReset(dcBus12FaultPredict); ECAM_controller.warningReset(dcBus12FaultIcing); ECAM_controller.warningReset(dcBus12FaultBrking); } - if (!systems.ELEC.EmerElec.getValue() and systems.ELEC.Bus.acEss.getValue() < 110 and phaseVar2 != 4 and phaseVar2 != 8 and AcBusEssFault.clearFlag == 0) { + if (warningNodes.Timers.acEssFault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and AcBusEssFault.clearFlag == 0) { AcBusEssFault.active = 1; - if (!systems.ELEC.Switch.acEssFeed.getBoolValue()) { + if (!systems.ELEC.Switch.acEssFeed.getBoolValue() and AcBusEssFaultFeed.clearFlag == 0) { AcBusEssFaultFeed.active = 1; } else { ECAM_controller.warningReset(AcBusEssFaultFeed); } - AcBusEssFaultAtc.active = 1; + + if (atc.transponderPanel.atcSel != 2 and AcBusEssFaultAtc.clearFlag == 0) { + AcBusEssFaultAtc.active = 1; + } else { + ECAM_controller.warningReset(AcBusEssFaultAtc); + } } else { ECAM_controller.warningReset(AcBusEssFault); ECAM_controller.warningReset(AcBusEssFaultFeed); ECAM_controller.warningReset(AcBusEssFaultAtc); } - if (!systems.ELEC.EmerElec.getValue() and systems.ELEC.Bus.ac1.getValue() < 110 and phaseVar2 != 4 and phaseVar2 != 8 and AcBus1Fault.clearFlag == 0) { + if (warningNodes.Timers.ac1Fault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and AcBus1Fault.clearFlag == 0) { AcBus1Fault.active = 1; - AcBus1FaultBlower.active = 1; + + if (AcBus1FaultBlower.clearFlag == 0) { + AcBus1FaultBlower.active = 1; + } else { + ECAM_controller.warningReset(AcBus1FaultBlower); + } } else { ECAM_controller.warningReset(AcBus1Fault); ECAM_controller.warningReset(AcBus1FaultBlower); } - if (!dcEmerconfig.active and systems.ELEC.Bus.dcEss.getValue() < 25 and phaseVar2 != 4 and phaseVar2 != 8 and DcEssBusFault.clearFlag == 0) { + if (warningNodes.Timers.dcEssFault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and DcEssBusFault.clearFlag == 0) { DcEssBusFault.active = 1; - DcEssBusFaultRadio.active = 1; - DcEssBusFaultRadio2.active = 1; - DcEssBusFaultBaro.active = 1; - DcEssBusFaultGPWS.active = 1; + if (DcEssBusFaultRadio.clearFlag == 0) { + DcEssBusFaultRadio.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultRadio); + } + if (DcEssBusFaultRadio2.clearFlag == 0) { + DcEssBusFaultRadio2.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultRadio2); + } + + if (DcEssBusFaultBaro.clearFlag == 0) { + DcEssBusFaultBaro.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultBaro); + } + + if (0 == 1 and systems.ELEC.Bus.dc2.getValue() < 25 and systems.ELEC.Bus.dcEss.getValue() < 25 and DcEssBusFaultGear.clearFlag == 0) { # LGCIU12 FAULT + DcEssBusFaultGear.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultGear); + } + + if (DcEssBusFaultGPWS.clearFlag == 0) { + DcEssBusFaultGPWS.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultGPWS); + } + + if (DcEssBusFaultFuel.clearFlag == 0 and warningNodes.Logic.dcEssFuelConsumptionIncreased.getValue()) { + DcEssBusFaultFuel.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultFuel); + } + + if (DcEssBusFaultPredict.clearFlag == 0 and warningNodes.Logic.dcEssFMSPredictions.getValue()) { + DcEssBusFaultPredict.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultPredict); + } + + if (DcEssBusFaultIcing.clearFlag == 0) { + DcEssBusFaultIcing.active = 1; + } else { + ECAM_controller.warningReset(DcEssBusFaultIcing); + } } else { ECAM_controller.warningReset(DcEssBusFault); ECAM_controller.warningReset(DcEssBusFaultRadio); ECAM_controller.warningReset(DcEssBusFaultRadio2); ECAM_controller.warningReset(DcEssBusFaultBaro); + ECAM_controller.warningReset(DcEssBusFaultGear); ECAM_controller.warningReset(DcEssBusFaultGPWS); + ECAM_controller.warningReset(DcEssBusFaultFuel); + ECAM_controller.warningReset(DcEssBusFaultPredict); + ECAM_controller.warningReset(DcEssBusFaultIcing); } - if (!systems.ELEC.EmerElec.getValue() and systems.ELEC.Bus.ac2.getValue() < 110 and phaseVar2 != 4 and phaseVar2 != 8 and AcBus2Fault.clearFlag == 0) { + if (warningNodes.Timers.ac2Fault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and AcBus2Fault.clearFlag == 0) { AcBus2Fault.active = 1; - AcBus2FaultExtract.active = 1; + if (AcBus2FaultExtract.clearFlag == 0) { + AcBus2FaultExtract.active = 1; + } else { + ECAM_controller.warningReset(AcBus2FaultExtract); + } + + if (atc.transponderPanel.atcSel != 1 and AcBus2FaultAtc.clearFlag == 0) { + AcBus2FaultAtc.active = 1; + } else { + ECAM_controller.warningReset(AcBus2FaultAtc); + } } else { ECAM_controller.warningReset(AcBus2Fault); ECAM_controller.warningReset(AcBus2FaultExtract); + ECAM_controller.warningReset(AcBus2FaultAtc); } - if (!systems.ELEC.EmerElec.getValue() and systems.ELEC.Bus.dc1.getValue() < 25 and systems.ELEC.Bus.dc2.getValue() >= 25 and phaseVar2 != 4 and phaseVar2 != 8 and dcBus1Fault.clearFlag == 0) { + if (warningNodes.Timers.dc1Fault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and dcBus1Fault.clearFlag == 0) { dcBus1Fault.active = 1; - dcBus1FaultBlower.active = 1; - dcBus1FaultExtract.active = 1; + + if (dcBus1FaultBlower.clearFlag == 0) { + dcBus1FaultBlower.active = 1; + } else { + ECAM_controller.warningReset(dcBus1FaultBlower); + } + if (dcBus1FaultExtract.clearFlag == 0) { + dcBus1FaultExtract.active = 1; + } else { + ECAM_controller.warningReset(dcBus1FaultExtract); + } + if (dcBus1FaultIcing.clearFlag == 0) { + dcBus1FaultIcing.active = 1; + } else { + ECAM_controller.warningReset(dcBus1FaultIcing); + } } else { ECAM_controller.warningReset(dcBus1Fault); ECAM_controller.warningReset(dcBus1FaultBlower); ECAM_controller.warningReset(dcBus1FaultExtract); + ECAM_controller.warningReset(dcBus1FaultIcing); } - if (!systems.ELEC.EmerElec.getValue() and systems.ELEC.Bus.dc1.getValue() >= 25 and systems.ELEC.Bus.dc2.getValue() <= 25 and phaseVar2 != 4 and phaseVar2 != 8 and dcBus2Fault.clearFlag == 0) { + if (warningNodes.Timers.dc2Fault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and dcBus2Fault.clearFlag == 0) { dcBus2Fault.active = 1; - dcBus2FaultAirData.active = 1; - dcBus2FaultBaro.active = 1; + + if (dcBus2FaultAirData.clearFlag == 0 and systems.SwitchingPanel.Switches.airData.getValue() != 1) { + dcBus2FaultAirData.active = 1; + } else { + ECAM_controller.warningReset(dcBus2FaultAirData); + } + + if (dcBus2FaultBaro.clearFlag == 0) { + dcBus2FaultBaro.active = 1; + } else { + ECAM_controller.warningReset(dcBus2FaultBaro); + } + + if (0 == 1 and systems.ELEC.Bus.dc2.getValue() < 25 and systems.ELEC.Bus.dcEss.getValue() < 25 and dcBus2FaultGear.clearFlag == 0) { # LGCIU12 FAULT + dcBus2FaultGear.active = 1; + } else { + ECAM_controller.warningReset(dcBus2FaultGear); + } + + if (dcBus2FaultFuel.clearFlag == 0 and warningNodes.Logic.dc2FuelConsumptionIncreased.getValue()) { + dcBus2FaultFuel.active = 1; + } else { + ECAM_controller.warningReset(dcBus2FaultFuel); + } + + if (dcBus2FaultPredict.clearFlag == 0 and warningNodes.Logic.dc2FMSPredictions.getValue()) { + dcBus2FaultPredict.active = 1; + } else { + ECAM_controller.warningReset(dcBus2FaultPredict); + } } else { ECAM_controller.warningReset(dcBus2Fault); ECAM_controller.warningReset(dcBus2FaultAirData); ECAM_controller.warningReset(dcBus2FaultBaro); + ECAM_controller.warningReset(dcBus2FaultGear); + ECAM_controller.warningReset(dcBus2FaultFuel); + ECAM_controller.warningReset(dcBus2FaultPredict); } - if (!systems.ELEC.EmerElec.getValue() and !dcEmerconfig.active and systems.ELEC.Bus.dcBat.getValue() < 25 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and dcBusBatFault.clearFlag == 0) { + if (warningNodes.Timers.dcBatFault.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and dcBusBatFault.clearFlag == 0) { dcBusBatFault.active = 1; } else { ECAM_controller.warningReset(dcBusBatFault); } - if (!(systems.ELEC.EmerElec.getValue() and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.dcEssShed.getValue() < 25 and systems.ELEC.Bus.dcEss.getValue() >= 25 and phaseVar2 != 4 and phaseVar2 != 8 and dcBusEssShed.clearFlag == 0) { + if (warningNodes.Timers.dcEssShed.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and dcBusEssShed.clearFlag == 0) { dcBusEssShed.active = 1; - dcBusEssShedExtract.active = 1; - dcBusEssShedIcing.active = 1; + if (dcBusEssShedExtract.clearFlag == 0) { + dcBusEssShedExtract.active = 1; + } else { + ECAM_controller.warningReset(dcBusEssShedExtract); + } + if (dcBusEssShedIcing.clearFlag == 0) { + dcBusEssShedIcing.active = 1; + } else { + ECAM_controller.warningReset(dcBusEssShedIcing); + } } else { ECAM_controller.warningReset(dcBusEssShed); ECAM_controller.warningReset(dcBusEssShedExtract); ECAM_controller.warningReset(dcBusEssShedIcing); } - if (!(systems.ELEC.EmerElec.getValue() and !getprop("/systems/electrical/relay/emer-glc/contact-pos")) and systems.ELEC.Bus.acEssShed.getValue() < 110 and systems.ELEC.Bus.acEss.getValue() >= 110 and phaseVar2 != 4 and phaseVar2 != 8 and acBusEssShed.clearFlag == 0) { + if (warningNodes.Timers.acEssShed.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 8 and acBusEssShed.clearFlag == 0) { acBusEssShed.active = 1; - if (!systems.ELEC.EmerElec.getValue()) { + if (!systems.ELEC.EmerElec.getValue() and atc.transponderPanel.atcSel != 2 and acBusEssShedAtc.clearFlag == 0) { acBusEssShedAtc.active = 1; } else { ECAM_controller.warningReset(acBusEssShed); @@ -1204,6 +1920,7 @@ var messages_priority_2 = func { ECAM_controller.warningReset(acBusEssShedAtc); } + # GEN 1 FAULT if (gen1fault.clearFlag == 0 and warningNodes.Flipflops.gen1Fault.getValue() and (phaseVar2 == 2 or phaseVar2 == 3 or phaseVar2 == 6 or phaseVar2 == 9)) { gen1fault.active = 1; if (!warningNodes.Flipflops.gen1FaultOnOff.getValue()) { @@ -1226,6 +1943,14 @@ var messages_priority_2 = func { ECAM_controller.warningReset(gen1faultGen3); } + # ESS TR FAULT + if (essTRFault.clearFlag == 0 and systems.ELEC.Fail.essTrFault.getValue() and (phaseVar2 == 6 or phaseVar2 >= 9 or phaseVar2 <= 2)) { + essTRFault.active = 1; + } else { + ECAM_controller.warningReset(essTRFault); + } + + # GEN 2 FAULT if (gen2fault.clearFlag == 0 and warningNodes.Flipflops.gen2Fault.getValue() and (phaseVar2 == 2 or phaseVar2 == 3 or phaseVar2 == 6 or phaseVar2 == 9)) { gen2fault.active = 1; if (!warningNodes.Flipflops.gen2FaultOnOff.getValue()) { @@ -1270,6 +1995,27 @@ var messages_priority_2 = func { ECAM_controller.warningReset(apuGenfaultGen3); } + # GEN OFF + if (gen1Off.clearFlag == 0 and warningNodes.Logic.gen1Off.getValue() and (phaseVar2 == 2 or phaseVar2 == 3 or phaseVar2 == 6 or phaseVar2 == 9)) { + gen1Off.active = 1; + } else { + ECAM_controller.warningReset(gen1Off); + } + + if (gen2Off.clearFlag == 0 and warningNodes.Logic.gen2Off.getValue() and (phaseVar2 == 2 or phaseVar2 == 3 or phaseVar2 == 6 or phaseVar2 == 9)) { + gen2Off.active = 1; + } else { + ECAM_controller.warningReset(gen2Off); + } + + # ELEC AC ESS BUS ALTN + if (acEssBusAltn.clearFlag == 0 and warningNodes.Logic.acEssBusAltn.getValue() and (phaseVar2 >= 9 or phaseVar2 <= 2)) { + acEssBusAltn.active = 1; + } else { + ECAM_controller.warningReset(acEssBusAltn); + } + + # L ELEV FAULT if (lElevFault.clearFlag == 0 and warningNodes.Timers.leftElevFail.getValue() and phaseVar2 != 4 and phaseVar2 != 5) { lElevFault.active = 1; if (lElevFaultCare.clearFlag == 0) { @@ -1306,6 +2052,12 @@ var messages_priority_2 = func { ECAM_controller.warningReset(rElevFaultPitch); } + if (fctlSpdBrkStillOut.clearFlag == 0 and warningNodes.Logic.spdBrkOut.getValue() and (phaseVar2 == 6 or phaseVar2 == 7)) { + fctlSpdBrkStillOut.active = 1; + } else { + ECAM_controller.warningReset(fctlSpdBrkStillOut); + } + if (directLaw.clearFlag == 0 and warningNodes.Timers.directLaw.getValue() and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8) { directLaw.active = 1; directLawProt.active = 1; @@ -1534,6 +2286,119 @@ var messages_priority_2 = func { 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; + + if (wingLoLvlManMode.clearFlag == 0 and systems.FUEL.Switches.centerTkMode.getValue() == 0 and systems.FUEL.Quantity.center.getValue() >= 550) { + wingLoLvlManMode.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlManMode); + } + + if (wingLoLvlPumpL1.clearFlag == 0 and !systems.FUEL.Switches.pumpLeft1.getValue()) { + wingLoLvlPumpL1.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlPumpL1); + } + + if (wingLoLvlPumpL2.clearFlag == 0 and !systems.FUEL.Switches.pumpLeft2.getValue()) { + wingLoLvlPumpL2.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlPumpL2); + } + + if (wingLoLvlPumpC1.clearFlag == 0 and !systems.FUEL.Switches.pumpCenter1.getValue()) { + wingLoLvlPumpC1.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlPumpC1); + } + + if (wingLoLvlPumpR1.clearFlag == 0 and !systems.FUEL.Switches.pumpRight1.getValue()) { + wingLoLvlPumpR1.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlPumpR1); + } + + if (wingLoLvlPumpR2.clearFlag == 0 and !systems.FUEL.Switches.pumpRight2.getValue()) { + wingLoLvlPumpR2.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlPumpR2); + } + + if (wingLoLvlPumpC2.clearFlag == 0 and !systems.FUEL.Switches.pumpCenter2.getValue()) { + wingLoLvlPumpC2.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlPumpC2); + } + + if (systems.FUEL.Switches.crossfeed.getValue() == 0) { + if (wingLoLvlLeak.clearFlag == 0) { + wingLoLvlLeak.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlLeak); + } + + if (wingLoLvlXFeed.clearFlag == 0) { + wingLoLvlXFeed.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlXFeed); + } + } else { + ECAM_controller.warningReset(wingLoLvlLeak); + ECAM_controller.warningReset(wingLoLvlXFeed); + } + + if (systems.FUEL.Switches.crossfeed.getValue() == 1) { + if (wingLoLvlGrav.clearFlag == 0) { + wingLoLvlGrav.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlGrav); + } + + if (wingLoLvlXFeedOff.clearFlag == 0) { + wingLoLvlXFeedOff.active = 1; + } else { + ECAM_controller.warningReset(wingLoLvlXFeedOff); + } + } else { + ECAM_controller.warningReset(wingLoLvlGrav); + ECAM_controller.warningReset(wingLoLvlXFeedOff); + } + } else { + ECAM_controller.warningReset(wingLoLvl); + ECAM_controller.warningReset(wingLoLvlManMode); + ECAM_controller.warningReset(wingLoLvlPumpL1); + ECAM_controller.warningReset(wingLoLvlPumpL2); + ECAM_controller.warningReset(wingLoLvlPumpC1); + ECAM_controller.warningReset(wingLoLvlPumpR1); + ECAM_controller.warningReset(wingLoLvlPumpR2); + ECAM_controller.warningReset(wingLoLvlPumpC2); + ECAM_controller.warningReset(wingLoLvlLeak); + ECAM_controller.warningReset(wingLoLvlXFeed); + ECAM_controller.warningReset(wingLoLvlGrav); + ECAM_controller.warningReset(wingLoLvlXFeedOff); + } + + if (ctrPumpsOff.clearFlag == 0 and warningNodes.Timers.centerPumpsOff.getValue() == 1 and (phaseVar2 == 2 or phaseVar2 == 6)) { + ctrPumpsOff.active = 1; + + if (ctrPumpsOffPump1.clearFlag == 0 and !systems.FUEL.Switches.pumpCenter1.getValue()) { + ctrPumpsOffPump1.active = 1; + } else { + ECAM_controller.warningReset(ctrPumpsOffPump1); + } + if (ctrPumpsOffPump2.clearFlag == 0 and !systems.FUEL.Switches.pumpCenter2.getValue()) { + ctrPumpsOffPump2.active = 1; + } else { + ECAM_controller.warningReset(ctrPumpsOffPump2); + } + } else { + ECAM_controller.warningReset(ctrPumpsOff); + ECAM_controller.warningReset(ctrPumpsOffPump1); + ECAM_controller.warningReset(ctrPumpsOffPump2); + } + # APU EMER SHUT DOWN if (apuEmerShutdown.clearFlag == 0 and systems.APUController.APU.signals.autoshutdown and systems.APUController.APU.signals.emer and !getprop("/systems/fire/apu/warning-active") and (phaseVar2 == 6 or phaseVar2 >= 9 or phaseVar2 <= 2)) { apuEmerShutdown.active = 1; @@ -1568,7 +2433,7 @@ var messages_priority_2 = func { warningNodes.Timers.bleed1Fault.setValue(0); } - if (bleed1Fault.clearFlag == 0 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 9) and warningNodes.Timers.bleed1FaultOutput.getValue() == 1 and (!systems.PNEU.Switch.pack1.getBoolValue() or !systems.PNEU.Switch.pack2.getBoolValue() or !(getprop("/ECAM/phases/wing-anti-ice-pulse") and getprop("/controls/ice-protection/wing")))) { # inverse pulse + if (bleed1Fault.clearFlag == 0 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 9) and warningNodes.Timers.bleed1FaultOutput.getValue() == 1 and (!systems.PNEU.Switch.pack1.getBoolValue() or !systems.PNEU.Switch.pack2.getBoolValue() or !(getprop("/ECAM/phases/wing-anti-ice-pulse") and wing_pb.getValue()))) { # inverse pulse bleed1Fault.active = 1; } else { ECAM_controller.warningReset(bleed1Fault); @@ -1605,7 +2470,7 @@ var messages_priority_2 = func { warningNodes.Timers.bleed2Fault.setValue(0); } - if (bleed2Fault.clearFlag == 0 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 9) and warningNodes.Timers.bleed2FaultOutput.getValue() == 1 and (!systems.PNEU.Switch.pack1.getBoolValue() or !systems.PNEU.Switch.pack2.getBoolValue() or !(getprop("/ECAM/phases/wing-anti-ice-pulse") and getprop("/controls/ice-protection/wing")))) { # inverse pulse + if (bleed2Fault.clearFlag == 0 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 9) and warningNodes.Timers.bleed2FaultOutput.getValue() == 1 and (!systems.PNEU.Switch.pack1.getBoolValue() or !systems.PNEU.Switch.pack2.getBoolValue() or !(getprop("/ECAM/phases/wing-anti-ice-pulse") and wing_pb.getValue()))) { # inverse pulse bleed2Fault.active = 1; } else { ECAM_controller.warningReset(bleed2Fault); @@ -1657,32 +2522,29 @@ var messages_priority_2 = func { # Crossbleed if (xBleedFault.clearFlag == 0 and (phaseVar2 <= 2 or phaseVar2 >= 9 or phaseVar2 == 6) and warningNodes.Logic.crossbleedFault.getValue()) { xBleedFault.active = 1; - } else { - ECAM_controller.warningReset(xBleedFault); - } - - if (xBleedFault.active) { - if (systems.PNEU.Switch.xbleed.getValue() == 1) { + + if (xBleedFaultMan.clearFlag == 0 and systems.PNEU.Switch.xbleed.getValue() == 1) { xBleedFaultMan.active = 1; } else { ECAM_controller.warningReset(xBleedFaultMan); } - if (warningNodes.Logic.crossbleedWai.getValue()) { - if (getprop("/controls/ice-protection/wing")) { - xBleedOff.active = 1; - } else { - ECAM_controller.warningReset(xBleedOff); - } - xBleedIcing.active = 1; + if (xBleedFaultWAI.clearFlag == 0 and wing_pb.getValue() and warningNodes.Logic.crossbleedWai.getValue()) { + xBleedFaultWAI.active = 1; } else { - ECAM_controller.warningReset(xBleedOff); - ECAM_controller.warningReset(xBleedIcing); + ECAM_controller.warningReset(xBleedFaultWAI); + } + + if (xBleedFaultICE.clearFlag == 0 and warningNodes.Logic.crossbleedWai.getValue()) { + xBleedFaultICE.active = 1; + } else { + ECAM_controller.warningReset(xBleedFaultICE); } } else { + ECAM_controller.warningReset(xBleedFault); ECAM_controller.warningReset(xBleedFaultMan); - ECAM_controller.warningReset(xBleedOff); - ECAM_controller.warningReset(xBleedIcing); + ECAM_controller.warningReset(xBleedFaultWAI); + ECAM_controller.warningReset(xBleedFaultICE); } if (bleed1Off.clearFlag == 0 and (warningNodes.Timers.bleed1Off60Output.getValue() == 1 or warningNodes.Timers.bleed1Off5Output.getValue() == 1) and FWC.Timer.eng1idleOutput.getBoolValue() and (phaseVar2 == 2 or phaseVar2 == 6)) { @@ -2126,7 +2988,7 @@ var messages_priority_2 = func { } else { ECAM_controller.warningReset(wingIceSysFaultXbld); } - if ((warningNodes.Logic.waiLclosed.getValue() or warningNodes.Logic.waiRclosed.getValue()) and getprop("/controls/ice-protection/wing")) { + if ((warningNodes.Logic.waiLclosed.getValue() or warningNodes.Logic.waiRclosed.getValue()) and wing_pb.getValue()) { wingIceSysFaultOff.active = 1; } else { ECAM_controller.warningReset(wingIceSysFaultOff); @@ -2147,7 +3009,7 @@ var messages_priority_2 = func { if (wingIceOpenGnd.clearFlag == 0 and warningNodes.Logic.waiGndFlight.getValue() and (phaseVar2 <= 2 or phaseVar2 >= 9)) { wingIceOpenGnd.active = 1; - if (pts.Gear.wow[1].getValue() and getprop("/controls/ice-protection/wing")) { + if (pts.Gear.wow[1].getValue() and wing_pb.getValue()) { wingIceOpenGndShut.active = 1; } else { ECAM_controller.warningReset(wingIceOpenGndShut); @@ -2276,7 +3138,7 @@ var messages_config_memo = func { setprop("/ECAM/to-config-normal", 1); } - if (getprop("/ECAM/to-config-test") and (phaseVarMemo == 1 or phaseVarMemo == 2 or phaseVarMemo == 9)) { + if (ecamConfigTest.getValue() and (phaseVarMemo == 1 or phaseVarMemo == 2 or phaseVarMemo == 9)) { setprop("/ECAM/to-config-set", 1); } else { setprop("/ECAM/to-config-set", 0); @@ -2328,7 +3190,7 @@ var messages_config_memo = func { toMemoLine5.colour = "c"; } - if (getprop("/ECAM/to-config-test") and (phaseVarMemo == 2 or phaseVarMemo == 9)) { + if (ecamConfigTest.getValue() and (phaseVarMemo == 2 or phaseVarMemo == 9)) { setprop("/ECAM/to-memo-set", 1); } else { setprop("/ECAM/to-memo-set", 0); @@ -2511,10 +3373,17 @@ var messages_memo = func { outr_tk_fuel_xfrd.active = 0; } - if (pts.Consumables.Fuel.totalFuelLbs.getValue() < 6000 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # assuming US short ton 2000lb - fob_3T.active = 1; + if (pts.Consumables.Fuel.totalFuelLbs.getValue() < 6613 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { # assuming US short ton 2000lb + if (acconfig_weight_kgs.getValue()) { + fob_3T.active = 1; + fob_66L.active = 0; + } else { + fob_3T.active = 0; + fob_66L.active = 1; + } } else { fob_3T.active = 0; + fob_66L.active = 0; } if (getprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override") == 1 and toMemoLine1.active != 1 and ldgMemoLine1.active != 1) { @@ -2544,7 +3413,7 @@ var messages_right_memo = func { ldg_inhibit.active = 0; } - if ((!pts.Gear.wow[1].getValue()) and (systems.ELEC.EmerElec.getValue() or getprop("/systems/fire/engine1/warning-active") == 1 or getprop("/systems/fire/engine2/warning-active") == 1 or getprop("/systems/fire/apu/warning-active") == 1 or getprop("/systems/failures/cargo-aft-fire") == 1 or getprop("/systems/failures/cargo-fwd-fire") == 1) or (((systems.HYD.Psi.green.getValue() < 1500 and pts.Engines.Engine.state[0].getValue() == 3) and (systems.HYD.Psi.yellow.getValue() < 1500 and pts.Engines.Engine.state[1].getValue() == 3)) or ((systems.HYD.Psi.green.getValue() < 1500 or systems.HYD.Psi.yellow.getValue() < 1500) and pts.Engines.Engine.state[0].getValue() == 3 and pts.Engines.Engine.state[1].getValue() == 3) and phaseVarMemo3 >= 3 and phaseVarMemo3 <= 8)) { + if ((!pts.Gear.wow[1].getValue()) and (systems.ELEC.EmerElec.getValue() or getprop("/systems/fire/engine1/warning-active") == 1 or getprop("/systems/fire/engine2/warning-active") == 1 or getprop("/systems/fire/apu/warning-active") == 1 or getprop("/systems/failures/fire/cargo-aft-fire") == 1 or getprop("/systems/failures/fire/cargo-fwd-fire") == 1) or (((systems.HYD.Psi.green.getValue() < 1500 and pts.Engines.Engine.state[0].getValue() == 3) and (systems.HYD.Psi.yellow.getValue() < 1500 and pts.Engines.Engine.state[1].getValue() == 3)) or ((systems.HYD.Psi.green.getValue() < 1500 or systems.HYD.Psi.yellow.getValue() < 1500) and pts.Engines.Engine.state[0].getValue() == 3 and pts.Engines.Engine.state[1].getValue() == 3) and phaseVarMemo3 >= 3 and phaseVarMemo3 <= 8)) { # todo: emer elec land_asap_r.active = 1; } else { @@ -2605,7 +3474,7 @@ var messages_right_memo = func { ptu.active = 0; } - if (getprop("/systems/hydraulic/sources/rat/position") != 0) { + if (systems.HYD.Rat.position.getValue() != 0) { rat.active = 1; } else { rat.active = 0; @@ -2617,7 +3486,7 @@ var messages_right_memo = func { rat.colour = "g"; } - if (getprop("/systems/electrical/relay/emer-glc/contact-pos") == 1 and getprop("/systems/hydraulic/sources/rat/position") != 0 and !pts.Gear.wow[1].getValue()) { + if (systems.ELEC.Source.EmerGen.relayPos.getValue() == 1 and systems.HYD.Rat.position.getValue() != 0 and !pts.Gear.wow[1].getValue()) { emer_gen.active = 1; } else { emer_gen.active = 0; @@ -2694,13 +3563,13 @@ var messages_right_memo = func { eng_aice.active = 0; } - if (getprop("/controls/ice-protection/wing") == 1) { + if (wing_pb.getValue() == 1) { wing_aice.active = 1; } else { wing_aice.active = 0; } - if (getprop("instrumentation/comm[2]/frequencies/selected-mhz") != 0 and (phaseVarMemo3 == 1 or phaseVarMemo3 == 2 or phaseVarMemo3 == 6 or phaseVarMemo3 == 9 or phaseVarMemo3 == 10)) { + if (!getprop("/systems/radio/vhf3-data-mode") and (phaseVarMemo3 == 1 or phaseVarMemo3 == 2 or phaseVarMemo3 == 6 or phaseVarMemo3 == 9 or phaseVarMemo3 == 10)) { vhf3_voice.active = 1; } else { vhf3_voice.active = 0; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 5354529c..a0d2c854 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -10,6 +10,7 @@ # Left E/WD var warnings = std.Vector.new([ + # LEVEL 3 WARN var stall = warning.new(msg: "", aural: 2), var flap_not_zero = warning.new(msg: "F/CTL FLAP LVR NOT ZERO", colour: "r", aural: 0, light: 0, isMainMsg: 1), @@ -47,12 +48,12 @@ var warnings = std.Vector.new([ var eng1FireFlAgent1Timer = warning.new(msg: " -AGENT 1 AFT 10 S.DISCH", colour: "w"), var eng1FireFlAgent1 = warning.new(msg: " -AGENT 1..........DISCH", colour: "c"), var eng1FireFlATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"), - var eng1FireFl30Sec = warning.new(msg: " •IF FIRE AFTER 30 S:", colour: "w", isMainMsg: 1), + var eng1FireFl30Sec = warning.new(msg: " •IF FIRE AFTER 30 S:", colour: "w"), var eng1FireFlAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"), # ENG 1 FIRE (ground) var eng1FireGnlever = warning.new(msg: " -THR LEVERS........IDLE", colour: "c"), - var eng1FireGnstopped = warning.new(msg: " •WHEN A/C IS STOPPED:", colour: "w", isMainMsg: 1), + var eng1FireGnstopped = warning.new(msg: " •WHEN A/C IS STOPPED:", colour: "w"), var eng1FireGnparkbrk = warning.new(msg: " -PARKING BRK.........ON", colour: "c"), var eng1FireGnATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"), var eng1FireGncrew = warning.new(msg: " -CABIN CREW.......ALERT", colour: "c"), @@ -70,12 +71,12 @@ var warnings = std.Vector.new([ var eng2FireFlAgent1Timer = warning.new(msg: " -AGENT 1 AFT 10 S.DISCH", colour: "w"), var eng2FireFlAgent1 = warning.new(msg: " -AGENT 1..........DISCH", colour: "c"), var eng2FireFlATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"), - var eng2FireFl30Sec = warning.new(msg: " •IF FIRE AFTER 30 S:", colour: "w", isMainMsg: 1), + var eng2FireFl30Sec = warning.new(msg: " •IF FIRE AFTER 30 S:", colour: "w"), var eng2FireFlAgent2 = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"), # ENG 2 FIRE (ground) var eng2FireGnlever = warning.new(msg: " -THR LEVERS........IDLE", colour: "c"), - var eng2FireGnstopped = warning.new(msg: " •WHEN A/C IS STOPPED:", colour: "w", isMainMsg: 1), + var eng2FireGnstopped = warning.new(msg: " •WHEN A/C IS STOPPED:", colour: "w"), var eng2FireGnparkbrk = warning.new(msg: " -PARKING BRK.........ON", colour: "c"), var eng2FireGnATC = warning.new(msg: " -ATC.............NOTIFY", colour: "c"), var eng2FireGncrew = warning.new(msg: " -CABIN CREW.......ALERT", colour: "c"), @@ -85,6 +86,20 @@ 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"), + # 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"), + var ADR123FaultATHR = warning.new(msg: " -ATHR...............OFF", colour: "c"), + var ADR123FaultPRBW = warning.new(msg: " -PROBE/WINDOW HEAT...ON", colour: "c"), + var ADR123FaultBUSSC = warning.new(msg: " -CAPT BKUP SPD/ALT...ON", colour: "c"), + var ADR123FaultBUSSF = warning.new(msg: " -FO BKUP SPD/ALT.....ON", colour: "c"), + var ADR123FaultADRPB = warning.new(msg: " -ADR 1+2+3 P/B......OFF", colour: "c"), + var ADR123FaultSPD = warning.new(msg: " -SPD......FLY THE GREEN", colour: "c"), + var ADR123FaultAOADISAG = warning.new(msg: " •IF AOA DISAGREE: ", colour: "w"), + var ADR123FaultBUSSINOP = warning.new(msg: " BKUP SPD/ALT.DO NOT USE", colour: "c"), + 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: "apu"), var apuFirePB = warning.new(msg: " -APU FIRE P/B......PUSH", colour: "c"), @@ -105,6 +120,37 @@ var warnings = std.Vector.new([ 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), + # EXCESS CAB ALT + var excessCabAlt = warning.new(msg: "CAB PR EXCESS CAB ALT", colour: "r", aural: 0, light: 0, isMainMsg: 1), + 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"), + var excessCabAltDES = warning.new(msg: " -DESCENT.......INITIATE", colour: "c"), + var excessCabAltTHRLVR = warning.new(msg: " -THR LEVERS........IDLE", colour: "c"), + 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 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"), + var excessCabAltMEA = warning.new(msg: " MAX FL.....100/MEA-MORA", colour: "c"), + var excessCabAltCabAlt = warning.new(msg: " •IF CAB ALT>14000 FT:", colour: "w"), + 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 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 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 lrElevFaultSpeed = warning.new(msg: " MAX SPEED.......320/.77", colour: "c"), @@ -116,8 +162,8 @@ var warnings = std.Vector.new([ var gearNotDownLocked = warning.new(msg: "L/G GEAR NOT DOWNLOCKED", colour: "r", aural: 0, light: 0, isMainMsg: 1), var gearNotDownLockedRec = warning.new(msg: " -L/G LEVER......RECYCLE", colour: "c"), - var gearNotDownLockedWork = warning.new(msg: " •IF UNSUCCESSFUL:", colour: "c"), - var gearNotDownLocked120 = warning.new(msg: " AFTER 120S:", colour: "c"), + var gearNotDownLockedWork = warning.new(msg: " •IF UNSUCCESSFUL:", colour: "w"), + var gearNotDownLocked120 = warning.new(msg: " AFTER 120S:", colour: "w"), var gearNotDownLockedGrav = warning.new(msg: " -L/G.........GRVTY EXTN", colour: "c"), # Autopilot off involuntary @@ -125,18 +171,34 @@ var warnings = std.Vector.new([ # Cargo smoke var cargoSmokeFwd = warning.new(msg: "SMOKE FWD CARGO SMOKE", colour: "r", aural: 0, light: 0, isMainMsg: 1), + 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 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"), + var cargoSmokeAftGrd = warning.new(msg: " •WHEN ON GROUND", colour: "w"), + var cargoSmokeAftDoors = warning.new(msg: " BEFORE OPEN CRG DOORS:", colour: "w"), + var cargoSmokeAftDisemb = warning.new(msg: "-PAX..........DISEMBARK", colour: "c"), + + # Lavatory SMOKE + var lavatorySmoke = warning.new(msg: "SMOKE LAVATORY SMOKE ", colour: "r", aural: 0, light: 0, isMainMsg: 1), + 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 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 essBusOnBatLGUplock = warning.new(msg: " •WHEN L/G UPLOCKED :", colour: "w"), - var essBusOnBatManOn = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), - var essBusOnBatRetract = warning.new(msg: " •IF L/G RETRACT FAULT:", colour: "w"), - var essBusOnBatMinSpeed = warning.new(msg: " MIN RAT SPD......180 KT", colour: "c"), - var essBusOnBatLGCB = warning.new(msg: " -LGCIU1 C/B (C09)..PULL", colour: "c"), - var essBusOnBatManOn2 = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), + 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), @@ -148,13 +210,14 @@ var warnings = std.Vector.new([ var emerconfigManOn = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), var emerconfigEngMode = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c"), var emerconfigRadio = warning.new(msg: " -VHF1/ATC1..........USE", colour: "c"), - var emerconfigIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), var emerconfigFuelG = warning.new(msg: " FUEL GRVTY FEED", colour: "c"), var emerconfigFuelG2 = warning.new(msg: " PROC:GRVTY FUEL FEEDING", colour: "c"), var emerconfigFAC = warning.new(msg: " -FAC 1......OFF THEN ON", colour: "c"), var emerconfigBusTie2 = warning.new(msg: " -BUS TIE...........AUTO", colour: "c"), var emerconfigAPU = warning.new(msg: " -APU (IF AVAIL)...START", colour: "c"), var emerconfigVent = warning.new(msg: " -BLOWER + EXTRACT..OVRD", colour: "c"), + var emerconfigFuelIN = warning.new(msg: " FUEL CONSUMPT INCRSD", colour: "c"), + 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), @@ -190,15 +253,140 @@ var warnings = std.Vector.new([ var hydGYloPrFuelCnsmpt = warning.new(msg: " FUEL CONSUMPT INCRSD", colour: "c"), 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 airBleedLeakShut = warning.new(msg: " -X BLEED..........SHUT", colour: "c"), + + # LEVEL 2 WARN + # THR LEVERS NOT SET + var engThrustLvrNotSet = warning.new(msg: "ENG THR LEVERS NOT SET ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var engThrustLvrNotSetMCT = warning.new(msg: " -THR LEVERS ....MCT/FLX", colour: "c"), + var engThrustLvrNotSetTO = warning.new(msg: " -THR LEVERS.......TO/GA", colour: "c"), + + # REV SET + var engRevSet = warning.new(msg: "ENG REV SET ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var engRevSetLevers = warning.new(msg: " -THR LEVER......FWD THR", colour: "c"), + + # ENG 1 FAIL + var eng1Fail = warning.new(msg: "ENG 1 FAIL ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var thrustMalfunction1 = warning.new(msg: " THRUST MALFUNCTION ", colour: "a"), + var shaftFailure1 = warning.new(msg: " SHAFT FAILURE ", colour: "a"), + var eng1FailModeSel = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c"), + var eng1FailThrLvrIdle = warning.new(msg: " -THR LEVER 1.......IDLE", colour: "c"), + var eng1FailNoRelight = warning.new(msg: "•IF NO RELIGHT AFTER 30S", colour: "w"), + var eng1FailMasterOff = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"), + var eng1FailDamage = warning.new(msg: " IF DAMAGE : ", colour: "w"), + var eng1FailFirePB = warning.new(msg: " -ENG 1 FIRE P/B....PUSH", colour: "c"), + var eng1FailAgent1DischT = warning.new(msg: " -AGENT1 AFTER 10S.DISCH", colour: "c"), + var eng1FailAgent1Disch = warning.new(msg: " -AGENT 1..........DISCH", colour: "c"), + var eng1FailNoDamage = warning.new(msg: " IF NO DAMAGE : ", colour: "w"), + var eng1FailRelight = warning.new(msg: " -ENG 1 RELIGHT.CONSIDER", colour: "c"), + + # ENG 1 OIL HI TEMP + var eng1OilHiTemp = warning.new(msg: "ENG 1 OIL HI TEMP ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var eng1OilHiTempIdle = warning.new(msg: " -THR LEVER 1.......IDLE", colour: "c"), + var eng1OilHiTempSuccess = warning.new(msg: " •IF UNSUCCESSFUL: ", colour: "w"), + var eng1OilHiTempMaster = warning.new(msg: " -ENG MASTER 1.......OFF", colour: "c"), + + # ENG 1 SHUT DOWN + var eng1ShutDown = warning.new(msg: "ENG 1 SHUT DOWN ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var eng1ShutDownPack = warning.new(msg: " -PACK 1.............OFF", colour: "c"), + var eng1ShutDownXBleed = warning.new(msg: " -X BLEED...........OPEN", colour: "c"), + var eng1ShutDownModeSel = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c"), + var eng1ShutDownFuelLeak = warning.new(msg: " •IF NO FUEL LEAK :", colour: "w"), + var eng1ShutDownImbalance = warning.new(msg: " -IMBALANCE......MONITOR", colour: "c"), + var eng1ShutDownTCAS = warning.new(msg: " -TCAS MODE SEL.......TA", colour: "c"), + var eng1ShutDownBuffet = warning.new(msg: " •IF BUFFET : ", colour: "w"), + var eng1ShutDownSpeed = warning.new(msg: " MAX SPEED...........240", colour: "c"), + var eng1ShutDownXBleedS = warning.new(msg: " -X BLEED...........SHUT", colour: "c"), + var eng1ShutDownWingAI = warning.new(msg: " -WING ANTI ICE......OFF", colour: "c"), + var eng1ShutDownIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), + + # ENG 2 FAIL + var eng2Fail = warning.new(msg: "ENG 2 FAIL ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var thrustMalfunction2 = warning.new(msg: " THRUST MALFUNCTION ", colour: "a"), + var shaftFailure2 = warning.new(msg: " SHAFT FAILURE ", colour: "a"), + var eng2FailModeSel = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c"), + var eng2FailThrLvrIdle = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"), + var eng2FailNoRelight = warning.new(msg: "•IF NO RELIGHT AFTER 30S", colour: "w"), + var eng2FailMasterOff = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"), + var eng2FailDamage = warning.new(msg: " IF DAMAGE : ", colour: "w"), + var eng2FailFirePB = warning.new(msg: " -ENG 2 FIRE P/B....PUSH", colour: "c"), + var eng2FailAgent1DischT = warning.new(msg: " -AGENT2 AFTER 10S.DISCH", colour: "c"), + var eng2FailAgent1Disch = warning.new(msg: " -AGENT 2..........DISCH", colour: "c"), + var eng2FailNoDamage = warning.new(msg: " IF NO DAMAGE : ", colour: "w"), + var eng2FailRelight = warning.new(msg: " -ENG 2 RELIGHT.CONSIDER", colour: "c"), + + # ENG 2 OIL HI TEMP + var eng2OilHiTemp = warning.new(msg: "ENG 2 OIL HI TEMP ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var eng2OilHiTempIdle = warning.new(msg: " -THR LEVER 2.......IDLE", colour: "c"), + var eng2OilHiTempSuccess = warning.new(msg: " •IF UNSUCCESSFUL: ", colour: "w"), + var eng2OilHiTempMaster = warning.new(msg: " -ENG MASTER 2.......OFF", colour: "c"), + + # ENG 2 SHUT DOWN + var eng2ShutDown = warning.new(msg: "ENG 2 SHUT DOWN ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var eng2ShutDownPack1 = warning.new(msg: " -PACK 1.............OFF", colour: "c"), + var eng2ShutDownPack = warning.new(msg: " -PACK 2.............OFF", colour: "c"), + var eng2ShutDownXBleed = warning.new(msg: " -X BLEED...........OPEN", colour: "c"), + var eng2ShutDownModeSel = warning.new(msg: " -ENG MODE SEL.......IGN", colour: "c"), + var eng2ShutDownFuelLeak = warning.new(msg: " •IF NO FUEL LEAK :", colour: "w"), + var eng2ShutDownImbalance = warning.new(msg: " -IMBALANCE......MONITOR", colour: "c"), + var eng2ShutDownTCAS = warning.new(msg: " -TCAS MODE SEL.......TA", colour: "c"), + var eng2ShutDownBuffet = warning.new(msg: " •IF BUFFET : ", colour: "w"), + var eng2ShutDownSpeed = warning.new(msg: " MAX SPEED...........240", colour: "c"), + var eng2ShutDownXBleedS = warning.new(msg: " -X BLEED...........SHUT", colour: "c"), + var eng2ShutDownWingAI = warning.new(msg: " -WING ANTI ICE......OFF", colour: "c"), + var eng2ShutDownIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), + + # SAT ABOVE FLEX TEMP + var satAbvFlexTemp = warning.new(msg: "ENG SAT ABOVE FLEX TEMP", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var satAbvFlexTempCheck = warning.new(msg: " -T.O DATA.........CHECK", colour: "c"), + + # B RSVR LO LVL + var hydBSysLoLvl = warning.new(msg: "HYD B RSVR LO LVL ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var hydBSysLoLvlPump = warning.new(msg: " -BLUE ELEC PUMP.....OFF ", colour: "c"), + + # G RSVR LO LVL + var hydGSysLoLvl = warning.new(msg: "HYD G RSVR LO LVL ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var hydGSysLoLvlPtu = warning.new(msg: " -PTU................OFF ", colour: "c"), + var hydGSysLoLvlPump = warning.new(msg: " -GREEN ENG 1 PUMP...OFF ", colour: "c"), + + # Y RSVR LO LVL + var hydYSysLoLvl = warning.new(msg: "HYD Y RSVR LO LVL ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var hydYSysLoLvlPtu = warning.new(msg: " -PTU................OFF ", colour: "c"), + var hydYSysLoLvlPump = warning.new(msg: " -YELLOW ENG 2 PUMP..OFF ", colour: "c"), + var hydYSysLoLvlElec = warning.new(msg: " -YELLOW ELEC PUMP...OFF ", colour: "c"), + + # B SYS LO PR + var hydBSysLoPr = warning.new(msg: "HYD B SYS LO PR ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var hydBSysLoPrFuel = warning.new(msg: " FUEL CONSUMPT INCRSD ", colour: "c"), + var hydBSysLoPrFmsPred = warning.new(msg: " FMS PRED UNRELIABLE ", colour: "c"), + + # G SYS LO PR + var hydGSysLoPr = warning.new(msg: "HYD G SYS LO PR ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var hydGSysLoPrFuel = warning.new(msg: " FUEL CONSUMPT INCRSD ", colour: "c"), + var hydGSysLoPrFmsPred = warning.new(msg: " FMS PRED UNRELIABLE ", colour: "c"), + var hydGSysLoPrEngPump = warning.new(msg: " G ENG 1 PUMP LO PR ", colour: "a"), + + # Y SYS LO PR + var hydYSysLoPr = warning.new(msg: "HYD Y SYS LO PR ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var hydYSysLoPrAccu = warning.new(msg: " BRK Y ACCU PR MONITOR ", colour: "c"), + var hydYSysLoPrFuel = warning.new(msg: " FUEL CONSUMPT INCRSD ", colour: "c"), + var hydYSysLoPrFmsPred = warning.new(msg: " FMS PRED UNRELIABLE ", colour: "c"), + var hydYSysLoPrEngPump = warning.new(msg: " Y ENG 2 PUMP LO PR ", colour: "a"), + # DC EMER CONFIG var dcEmerconfig = warning.new(msg: "ELEC DC EMER CONFIG", colour: "a", aural: 1, light: 1, isMainMsg: 1), var dcEmerconfigManOn = warning.new(msg: " -EMER ELEC PWR...MAN ON", colour: "c"), + var dcEmerconfigFuel = warning.new(msg: " FUEL CONSUMPT INCRSD", 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, isMainMsg: 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 dcBus12FaultFuel = warning.new(msg: " FUEL CONSUMPT INCRSD", colour: "c"), + var dcBus12FaultPredict = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), var dcBus12FaultIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), var dcBus12FaultBrking = warning.new(msg: " MAX BRK........1000 PSI", colour: "c"), @@ -216,21 +404,30 @@ var warnings = std.Vector.new([ 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"), + var DcEssBusFaultGear = warning.new(msg: " -L/G.........GRVTY EXTN", colour: "c"), + var DcEssBusFaultGPWS = warning.new(msg: " -GPWS SYS...........OFF", colour: "c"), + var DcEssBusFaultFuel = warning.new(msg: " FUEL CONSUMPT INCRSD", colour: "c"), + var DcEssBusFaultPredict = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), + var DcEssBusFaultIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), # AC BUS 2 FAULT var AcBus2Fault = warning.new(msg: "ELEC AC BUS 2 FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), var AcBus2FaultExtract = warning.new(msg: " -EXTRACT...........OVRD", colour: "c"), + var AcBus2FaultAtc = warning.new(msg: " -ATC..............SYS 1", colour: "c"), # DC BUS 1 FAULT var dcBus1Fault = warning.new(msg: "ELEC DC BUS 1 FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), var dcBus1FaultBlower = warning.new(msg: " -BLOWER............OVRD", colour: "c"), var dcBus1FaultExtract = warning.new(msg: " -EXTRACT...........OVRD", colour: "c"), + var dcBus1FaultIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), # DC BUS 2 FAULT var dcBus2Fault = warning.new(msg: "ELEC DC BUS 2 FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), var dcBus2FaultAirData = warning.new(msg: " -AIR DATA SWTG......F/O", colour: "c"), var dcBus2FaultBaro = warning.new(msg: " -BARO REF.........CHECK", colour: "c"), + var dcBus2FaultGear = warning.new(msg: " -L/G.........GRVTY EXTN", colour: "c"), + var dcBus2FaultFuel = warning.new(msg: " FUEL CONSUMPT INCRSD", colour: "c"), + var dcBus2FaultPredict = warning.new(msg: " FMS PRED UNRELIABLE", colour: "c"), # DC BAT BUS FAULT var dcBusBatFault = warning.new(msg: "ELEC DC BAT BUS FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), @@ -244,23 +441,39 @@ var warnings = std.Vector.new([ var acBusEssShed = warning.new(msg: "ELEC AC ESS BUS SHED", colour: "a", aural: 1, light: 1, isMainMsg: 1), var acBusEssShedAtc = warning.new(msg: " -ATC..............SYS 2", colour: "c"), + # IDG 1 DISCONNECTED + var idg1Disc = warning.new(msg: "ELEC IDG 1 DISCONNECTED", colour: "a", aural: 1, light: 1, isMainMsg: 1), + + # IDG 2 DISCONNECTED + var idg2Disc = warning.new(msg: "ELEC IDG 2 DISCONNECTED", colour: "a", aural: 1, light: 1, isMainMsg: 1), + # GEN 1 FAULT var gen1fault = warning.new(msg: "ELEC GEN 1 FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), - var gen1faultGen = warning.new(msg: "-GEN 1......OFF THEN ON", colour: "c"), + var gen1faultGen = warning.new(msg: " -GEN 1......OFF THEN ON", colour: "c"), var gen1faultGen2 = warning.new(msg: " •IF UNSUCCESSFUL :", colour: "w"), - var gen1faultGen3 = warning.new(msg: "-GEN 1..............OFF", colour: "c"), + var gen1faultGen3 = warning.new(msg: " -GEN 1..............OFF", colour: "c"), + + # ESS TR FAULT + var essTRFault = warning.new(msg: "ELEC ESS TR FAULT ", colour: "a", aural: 1, light: 1, isMainMsg: 1), # GEN 2 FAULT var gen2fault = warning.new(msg: "ELEC GEN 2 FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), - var gen2faultGen = warning.new(msg: "-GEN 2......OFF THEN ON", colour: "c"), + var gen2faultGen = warning.new(msg: " -GEN 2......OFF THEN ON", colour: "c"), var gen2faultGen2 = warning.new(msg: " •IF UNSUCCESSFUL :", colour: "w"), - var gen2faultGen3 = warning.new(msg: "-GEN 2..............OFF", colour: "c"), + var gen2faultGen3 = warning.new(msg: " -GEN 2..............OFF", colour: "c"), # APU GEN FAULT var apuGenfault = warning.new(msg: "ELEC APU GEN FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), - var apuGenfaultGen = warning.new(msg: "-APU GEN....OFF THEN ON", colour: "c"), + var apuGenfaultGen = warning.new(msg: " -APU GEN....OFF THEN ON", colour: "c"), var apuGenfaultGen2 = warning.new(msg: " •IF UNSUCCESSFUL :", colour: "w"), - var apuGenfaultGen3 = warning.new(msg: "-APU GEN............OFF", colour: "c"), + var apuGenfaultGen3 = warning.new(msg: " -APU GEN............OFF", colour: "c"), + + # GEN OFF + var gen1Off = warning.new(msg: "ELEC GEN 1 OFF ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var gen2Off = warning.new(msg: "ELEC GEN 2 OFF ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + + # APU GEN FAULT + var acEssBusAltn = warning.new(msg: "ELEC AC ESS BUS ALTN", colour: "a", aural: 1, light: 1, isMainMsg: 1), # L ELEV FAULT var lElevFault = warning.new(msg: "F/CTL L ELEV FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), @@ -272,6 +485,9 @@ var warnings = std.Vector.new([ var rElevFaultCare = warning.new(msg: " MANEUVER WITH CARE", colour: "c"), var rElevFaultPitch = warning.new(msg: " FOR GA:MAX PITCH 15 DEG", colour: "c"), + # F/CTL SPD BRK STILL OUT + var fctlSpdBrkStillOut = warning.new(msg: "F/CTL SPD BRK STILL OUT ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + # DIRECT LAW var directLaw = warning.new(msg: "F/CTL DIRECT LAW", colour: "a", aural: 1, light: 1, isMainMsg: 1), var directLawProt = warning.new(msg: " (PROT LOST)", colour: "a"), @@ -342,6 +558,24 @@ var warnings = std.Vector.new([ var fcuFault2 = warning.new(msg: "AUTO FLT FCU 2 FAULT", colour: "a", isMainMsg: 1), var fcuFault2Baro = warning.new(msg: " -BARO REF.......X CHECK", colour: "c"), + # FUEL + var wingLoLvl = warning.new(msg: "FUEL L+R WING TK LO LVL", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var wingLoLvlManMode = warning.new(msg: " -FUEL MODE SEL......MAN", colour: "c"), + var wingLoLvlPumpL1 = warning.new(msg: " -L TK PUMP 1.........ON", colour: "c"), + var wingLoLvlPumpL2 = warning.new(msg: " -L TK PUMP 2.........ON", colour: "c"), + var wingLoLvlPumpC1 = warning.new(msg: " -CTR TK PUMP 1.......ON", colour: "c"), + var wingLoLvlPumpR1 = warning.new(msg: " -R TK PUMP 1.........ON", colour: "c"), + var wingLoLvlPumpR2 = warning.new(msg: " -R TK PUMP 2.........ON", colour: "c"), + var wingLoLvlPumpC2 = warning.new(msg: " -CTR TK PUMP 2.......ON", colour: "c"), + var wingLoLvlLeak = warning.new(msg: " •IF NO FUEL LEAK: ", colour: "w"), + var wingLoLvlXFeed = warning.new(msg: " -FUEL X FEED.........ON", colour: "c"), + var wingLoLvlGrav = warning.new(msg: " •IF GRVTY FEED: ", colour: "w"), + var wingLoLvlXFeedOff = warning.new(msg: " -FUEL X FEED........OFF", colour: "c"), + + var ctrPumpsOff = warning.new(msg: "FUEL CTR TK PUMPS OFF ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var ctrPumpsOffPump1 = warning.new(msg: " -CTR TK PUMP 1.......ON", colour: "c"), + var ctrPumpsOffPump2 = warning.new(msg: " -CTR TK PUMP 2.......ON", colour: "c"), + # APU shutdown var apuEmerShutdown = warning.new(msg: "APU EMER SHUT DOWN", colour: "a", aural: 1, light: 1, isMainMsg: 1), var apuEmerShutdownMast = warning.new(msg: " -MASTER SW..........OFF", colour: "c"), @@ -362,8 +596,8 @@ var warnings = std.Vector.new([ var hpValve2Fault = warning.new(msg: "AIR ENG 2 HP VALVE FAULT", colour: "a"), var xBleedFault = warning.new(msg: "AIR X BLEED FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), var xBleedFaultMan = warning.new(msg: " -X BLEED........MAN CTL", colour: "c"), - var xBleedOff = warning.new(msg: " -WING ANTI ICE......OFF", colour: "c"), - var xBleedIcing = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), + var xBleedFaultWAI = warning.new(msg: " -WING ANTI ICE......OFF", colour: "c"), + var xBleedFaultICE = warning.new(msg: " AVOID ICING CONDITIONS", colour: "c"), var bleed1Off = warning.new(msg: "AIR BLEED 1 OFF", colour: "a", aural: 1, light: 1, isMainMsg: 1), var bleed2Off = warning.new(msg: "AIR BLEED 2 OFF", colour: "a", aural: 1, light: 1, isMainMsg: 1), var engBleedLowTemp = warning.new(msg: "AIR ENG 1+2 BLEED LO TEMP", colour: "a", aural: 1, light: 1, isMainMsg: 1), @@ -525,9 +759,11 @@ var leftmemos = std.Vector.new([ var strobe_lt_off = warning.new(msg: "STROBE LT OFF" ), var outr_tk_fuel_xfrd = warning.new(msg: "OUTR TK FUEL XFRD" ), var fob_3T = warning.new(msg: "FOB BELOW 3T" ), + var fob_66L = warning.new(msg: "FOB BELOW 6600LBS" ), 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 acars_stby = warning.new(msg: "ACARS STBY" ), # Not yet implemented ]); # Right E/WD diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 8a2a6a78..2ca20a91 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -66,7 +66,7 @@ var FCUController = { me.FCU2 = FCU.new(systems.ELEC.Bus.dc2); me._init = 1; }, - loop: func() { + loop: func(notification) { if (me._init == 0) { return; } # Update FCU Power @@ -82,11 +82,11 @@ var FCUController = { } foreach (var update_item; me.update_items) { - update_item.update(nil); + update_item.update(notification); } }, update_items: [ - props.UpdateManager.FromPropertyHashList(["/it-autoflight/output/fd1","/it-autoflight/output/fd2", "/it-autoflight/output/ap1", "/it-autoflight/output/ap2"], 1, func(notification) + props.UpdateManager.FromPropertyHashList(["/it-autoflight/output/fd1","/it-autoflight/output/fd2", "/it-autoflight/output/ap1", "/it-autoflight/output/ap2"], nil, func(notification) { updateActiveFMGC(); } diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 087c1f44..9c4b7d21 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -134,12 +134,14 @@ var SimbriefParser = { fmgc.flightPlanController.flightplans[3].destination_runway = runwayStore; } - var alternateID = me.OFP.getNode("alternate/icao_code").getValue(); - var alternates = findAirportsByICAO(alternateID); - if (alternates != nil and size(alternates) != 0) { - fmgc.FMGCInternal.altAirport = alternateID; - atsu.ATISInstances[2].newStation(alternateID); - fmgc.FMGCInternal.altAirportSet = 1; + var alternateID = me.OFP.getNode("alternate/icao_code") == nil ? nil : me.OFP.getNode("alternate/icao_code").getValue(); + if (alternateID != nil) { + var alternates = findAirportsByICAO(alternateID); + if (size(alternates) != 0) { + fmgc.FMGCInternal.altAirport = alternateID; + atsu.ATISInstances[2].newStation(alternateID); + fmgc.FMGCInternal.altAirportSet = 1; + } } var wps = []; diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index b98e0dbb..cb71f578 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -428,13 +428,14 @@ var flightPlanController = { # flag: is it a navaids DUPLICATENAMES page or not? # plan: plan # flagPBD: do we return back to PBD handler or to default waypoint handler? + # flagPROG: do we return back to PROG handler or to default waypoint handler (only if flagPBD false) - createDuplicateNames: func(ghostContainer, index, flag, plan, flagPBD = 0, bearing = -999, distance = -99) { + createDuplicateNames: func(ghostContainer, index, flag, plan, flagPBD = 0, bearing = -999, distance = -99, flagPROG = 0) { if (canvas_mcdu.myDuplicate[plan] != nil) { canvas_mcdu.myDuplicate[plan].del(); } canvas_mcdu.myDuplicate[plan] = nil; - canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(ghostContainer, index, flag, plan, flagPBD, bearing, distance); + canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(ghostContainer, index, flag, plan, flagPBD, bearing, distance, flagPROG); setprop("MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES"); }, @@ -639,9 +640,9 @@ var flightPlanController = { } } else { if (type == "navaid") { - me.createDuplicateNames(wpGhostContainer, index, 1, plan, 1, num(textSplit[1]), num(textSplit[2])); + me.createDuplicateNames(wpGhostContainer, index, 1, plan, 1, num(textSplit[1]), num(textSplit[2]), 0); } else { - me.createDuplicateNames(wpGhostContainer, index, 0, plan, 1, num(textSplit[1]), num(textSplit[2])); + me.createDuplicateNames(wpGhostContainer, index, 0, plan, 1, num(textSplit[1]), num(textSplit[2]), 0); } return 2; } diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index 289abfb2..24dbb3a6 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -32,7 +32,7 @@ var variousReset = func() { setprop("/controls/CVR/gndctl", 0); setprop("/controls/CVR/erase", 0); setprop("/controls/switches/pneumatics/cabin-fans", 1); - setprop("/controls/oxygen/crewOxyPB", 1); # 0 = OFF 1 = AUTO + setprop("/controls/oxygen/crewOxyPB", 0); # 0 = OFF 1 = AUTO setprop("/controls/switches/emerCallLtO", 0); # ON light, flashes white for 10s setprop("/controls/switches/emerCallLtC", 0); # CALL light, flashes amber for 10s setprop("/controls/switches/emerCall", 0); @@ -62,8 +62,9 @@ var variousReset = func() { setprop("/modes/fcu/hdg-time", -45); setprop("/controls/navigation/switching/att-hdg", 0); setprop("/controls/navigation/switching/air-data", 0); - setprop("/controls/switches/no-smoking-sign", 0.5); - setprop("/controls/switches/seatbelt-sign", 1); + setprop("/controls/switches/no-smoking-sign", 0.0); + setprop("/controls/switches/seatbelt-sign", 0); + setprop("/controls/switches/emer-lights", 0); } var BUTTONS = { diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index c5b05971..0e15b916 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -174,19 +174,18 @@ var update_items = [ var systemsLoop = func(notification) { if (!systemsInitialized) { return; } - systems.ELEC.loop(); - systems.PNEU.loop(); - systems.HYD.loop(); - systems.ADIRS.loop(); + systems.PNEU.loop(notification); + systems.ADIRS.loop(notification); + systems.BrakeSys.update(notification); + systems.HFLoop(notification); systems.APUController.loop(); - systems.BrakeSys.update(); fadec.FADEC.loop(); rmp.rmpUpdate(); - fcu.FCUController.loop(); + fcu.FCUController.loop(notification); + atc.Transponders.vector[atc.transponderPanel.atcSel - 1].update(notification); dmc.DMController.loop(); atsu.ATSU.loop(); libraries.BUTTONS.update(); - systems.HFLoop(notification); if ((notification.engine1State == 2 or notification.engine1State == 3) and collectorTankL.getValue() < 1) { systems.cutoff_one(); @@ -203,10 +202,12 @@ var systemsLoop = func(notification) { # GPWS var GPWS = { inhibitNode: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit"), + tatcfInhibit: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit"), volume: props.globals.getNode("/instrumentation/mk-viii/speaker/volume"), flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"), flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"), flapOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override"), + alertMode: props.globals.initNode("/instrumentation/mk-viii/outputs/alert-mode",0,"INT"), }; setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func() { @@ -233,6 +234,20 @@ setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override updateGPWSFlap(); }, 0, 0); +# GPWS alert pooling for get mode change - a little esoteric way but it works +var gpws_alert_watch = maketimer(0.8,func { + var alert = 0; + if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-warning")) alert = 2; # MODE2 - warning - RED + else if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-alert")) alert = 1; # MODE1 - caution - YELLOW + if (GPWS.alertMode.getValue()!=alert) GPWS.alertMode.setValue(alert); +}); + +setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{ # detect GPWS switch status + var failure = GPWS.tatcfInhibit.getBoolValue(); + if (!failure) gpws_alert_watch.start(); + else gpws_alert_watch.stop(); +},1,0); + # Replay var replayState = props.globals.getNode("/sim/replay/replay-state"); setlistener("/sim/replay/replay-state", func() { diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index deba6c97..ed512e14 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -173,6 +173,13 @@ var Instrumentation = { pnlModeNum: [props.globals.initNode("/instrumentation/efis[0]/mfd/pnl_mode-num", 2, "INT"), props.globals.initNode("/instrumentation/efis[1]/mfd/pnl_mode-num", 2, "INT")], }, }, + GPS: { + altitude: props.globals.getNode("/instrumentation/gps/indicated-altitude-ft"), + latitude: props.globals.getNode("/instrumentation/gps/indicated-latitude-deg"), + longitude: props.globals.getNode("/instrumentation/gps/indicated-longitude-deg"), + trackMag: props.globals.getNode("/instrumentation/gps/indicated-track-magnetic-deg"), + gs: props.globals.getNode("/instrumentation/gps/indicated-ground-speed-kt"), + }, MKVII: { Inputs: { Discretes: { @@ -245,6 +252,7 @@ var Sim = { Time: { deltaRealtimeSec: props.globals.getNode("/sim/time/delta-realtime-sec"), elapsedSec: props.globals.getNode("/sim/time/elapsed-sec"), + gmtString: props.globals.getNode("/sim/time/gmt-string"), UTC: { day: props.globals.getNode("/sim/time/utc/day"), month: props.globals.getNode("/sim/time/utc/month"), diff --git a/Nasal/MCDU/CLOSESTAIRPORT.nas b/Nasal/MCDU/CLOSESTAIRPORT.nas index fa72faba..033ae1e6 100644 --- a/Nasal/MCDU/CLOSESTAIRPORT.nas +++ b/Nasal/MCDU/CLOSESTAIRPORT.nas @@ -74,29 +74,44 @@ var closestAirportPage = { me._range += 250; } } - - me.L1 = [me.airports[0].id, nil, "grn"]; - me.R1 = ["----", "UTC ", "grn"]; - me.L2 = [me.airports[1].id, nil, "grn"]; - me.R2 = ["----", nil, "grn"]; - me.L3 = [me.airports[2].id, nil, "grn"]; - me.R3 = ["----", nil, "grn"]; - me.L4 = [me.airports[3].id, nil, "grn"]; - me.R4 = ["----", nil, "grn"]; + if (size(me.airports) >= 1) { + me.L1 = [me.airports[0].id, nil, "grn"]; + me.R1 = ["----", "UTC ", "grn"]; + } + if (size(me.airports) >= 2) { + me.L2 = [me.airports[1].id, nil, "grn"]; + me.R2 = ["----", nil, "grn"]; + } + if (size(me.airports) >= 3) { + me.L3 = [me.airports[2].id, nil, "grn"]; + me.R3 = ["----", nil, "grn"]; + } + if (size(me.airports) >= 4) { + me.L4 = [me.airports[3].id, nil, "grn"]; + me.R4 = ["----", nil, "grn"]; + } me.listPopulated = 1; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateBrgDist: func() { if (!me.listPopulated) { return; } - me.cdVector[0] = courseAndDistance(me.airports[0]); - me.cdVector[1] = courseAndDistance(me.airports[1]); - me.cdVector[2] = courseAndDistance(me.airports[2]); - me.cdVector[3] = courseAndDistance(me.airports[3]); var magvarLocal = magvar(); - me.C1 = [math.round(me.cdVector[0][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"]; - me.C2 = [math.round(me.cdVector[1][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[1][1]) , nil, "grn"]; - me.C3 = [math.round(me.cdVector[2][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"]; - me.C4 = [math.round(me.cdVector[3][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"]; + if (size(me.airports) >= 1) { + me.cdVector[0] = courseAndDistance(me.airports[0]); + me.C1 = [math.round(me.cdVector[0][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"]; + } + if (size(me.airports) >= 2) { + me.cdVector[1] = courseAndDistance(me.airports[1]); + me.C2 = [math.round(me.cdVector[1][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[1][1]) , nil, "grn"]; + } + if (size(me.airports) >= 3) { + me.cdVector[2] = courseAndDistance(me.airports[2]); + me.C3 = [math.round(me.cdVector[2][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"]; + } + if (size(me.airports) >= 4) { + me.cdVector[3] = courseAndDistance(me.airports[3]); + me.C4 = [math.round(me.cdVector[3][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"]; + } if (me.manAirport != nil) { me.C5 = [math.round(courseAndDistance(me.manAirport)[0] - magvarLocal) ~ " " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"]; } diff --git a/Nasal/MCDU/DATA.nas b/Nasal/MCDU/DATA.nas index 92de6155..8093bcc3 100644 --- a/Nasal/MCDU/DATA.nas +++ b/Nasal/MCDU/DATA.nas @@ -5,19 +5,18 @@ var dataInput = func(key, i) { if (key == "L1") { setprop("MCDU[" ~ i ~ "]/page", "POSMON"); - } - if (key == "L2") { + } elsif (key == "L2") { setprop("MCDU[" ~ i ~ "]/page", "IRSMON"); - } - if (key == "L5") { + } elsif (key == "L3") { + setprop("MCDU[" ~ i ~ "]/page", "GPSMON"); + } elsif (key == "L5") { if (canvas_mcdu.myClosestAirport[i] != nil) { canvas_mcdu.myClosestAirport[i].del(); } canvas_mcdu.myClosestAirport[i] = nil; canvas_mcdu.myClosestAirport[i] = closestAirportPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "CLOSESTAIRPORT"); - } - if (key == "R5") { + } elsif (key == "R5") { setprop("MCDU[" ~ i ~ "]/page", "PRINTFUNC"); } } @@ -25,23 +24,17 @@ var dataInput = func(key, i) { var printInput = func(key, i) { if (key == "L1") { setprop("FMGC/print/mcdu/page1/L1auto", 1); - } - if (key == "L2") { + } elsif (key == "L2") { setprop("FMGC/print/mcdu/page1/L2auto", 1); - } - if (key == "L3") { + } elsif (key == "L3") { setprop("FMGC/print/mcdu/page1/L3auto", 1); - } - if (key == "L5") { + } elsif (key == "L5") { setprop("MCDU[" ~ i ~ "]/page", "DATA"); - } - if (key == "R1") { + } elsif (key == "R1") { setprop("FMGC/print/mcdu/page1/R1req", 1); - } - if (key == "R2") { + } elsif (key == "R2") { setprop("FMGC/print/mcdu/page1/R2req", 1); - } - if (key == "R3") { + } elsif (key == "R3") { setprop("FMGC/print/mcdu/page1/R3req", 1); } } @@ -49,29 +42,21 @@ var printInput = func(key, i) { var printInput2 = func(key, i) { if (key == "L1") { setprop("FMGC/print/mcdu/page2/L1auto", 1); - } - if (key == "L2") { + } elsif (key == "L2") { setprop("FMGC/print/mcdu/page2/L2auto", 1); - } - if (key == "L3") { + } elsif (key == "L3") { setprop("FMGC/print/mcdu/page2/L3auto", 1); - } - if (key == "L4") { + } elsif (key == "L4") { setprop("FMGC/print/mcdu/page2/L4auto", 1); - } - if (key == "L6") { + } elsif (key == "L6") { setprop("MCDU[" ~ i ~ "]/page", "DATA"); - } - if (key == "R1") { + } elsif (key == "R1") { setprop("FMGC/print/mcdu/page2/R1req", 1); - } - if (key == "R2") { + } elsif (key == "R2") { setprop("FMGC/print/mcdu/page2/R2req", 1); - } - if (key == "R3") { + } elsif (key == "R3") { setprop("FMGC/print/mcdu/page2/R3req", 1); - } - if (key == "R4") { + } elsif (key == "R4") { setprop("FMGC/print/mcdu/page2/R4req", 1); } } diff --git a/Nasal/MCDU/DUPLICATE.nas b/Nasal/MCDU/DUPLICATE.nas index ace8d133..9e6c58ee 100644 --- a/Nasal/MCDU/DUPLICATE.nas +++ b/Nasal/MCDU/DUPLICATE.nas @@ -28,7 +28,7 @@ var duplicateNamesPage = { enableScroll: 0, scroll: 0, distances: nil, - new: func(vector, index, type, computer, flagPBD = 0, pbdBrg = -999, pbdDist = -99) { + new: func(vector, index, type, computer, flagPBD = 0, pbdBrg = -999, pbdDist = -99, flagProg = 0) { var dn = {parents:[duplicateNamesPage]}; dn.vector = vector; dn.index = index; @@ -37,6 +37,7 @@ var duplicateNamesPage = { dn.bearing = pbdBrg; dn.distance = pbdDist; dn.computer = computer; + dn.flagPROG = flagProg; dn._setupPageWithData(); dn.distances = []; return dn; @@ -134,7 +135,7 @@ var duplicateNamesPage = { }, pushButtonLeft: func(indexSelect) { if (!dirToFlag) { - if (!me.flagPBD) { + if (!me.flagPBD and !me.flagPROG) { if (size(me.vector[0].id) == 5) { fmgc.flightPlanController.insertFix(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1); setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); @@ -145,9 +146,16 @@ var duplicateNamesPage = { fmgc.flightPlanController.insertNavaid(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1); setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); } - } else { + } elsif (me.flagPBD) { fmgc.flightPlanController.getWPforPBD(me.vector[0].id ~ "/" ~ me.bearing ~ "/" ~ me.distance, me.index, me.computer, 1, indexSelect - 1); setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); + } else { + if (me.type == 0) { + mcdu.bearingDistances[me.computer].newPointResult(me.vector, 1, indexSelect - 1); + } else { + mcdu.bearingDistances[me.computer].newPointNavaid(me.vector, 1, indexSelect - 1); + } + pagebutton("prog",me.computer); } } else { canvas_mcdu.myDirTo[me.computer].fieldL1(me.vector[0].id, 1, indexSelect - 1); diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f3cab9a5..65c2348c 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -117,15 +117,15 @@ var fplnItem = { }, getAlt: func() { if (me.index == 0 and left(me.wp.wp_name, 4) == fmgc.FMGCInternal.depApt and fmgc.flightPlanController.flightplans[me.plan].departure != nil) { - return [" " ~ sprintf("%5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "grn"]; #fixed - aligned to right + return [" " ~ sprintf("%5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "grn"]; } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) { 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 if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { - return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; #fixed - aligned to right + return [" " ~ sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), tcol]; } else { - return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; #fixed - aligned to right + return [" " ~ sprintf("%5.0f", me.wp.alt_cstr), tcol]; } } else { return ["------", "wht"]; diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index c8550c1f..cffe7bd4 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -128,6 +128,7 @@ var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/positio # Detect OFF without IN var lastgs0 = 0; +#var lastgear0 = 0; var lastgsrestart = 0; # Check for A/C state change - advice me for a better method, please :/ @@ -144,7 +145,6 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision if (gs > 9) { # imho - it's useful few speed tollerance, 10kts min speed on taxiways - CHECKME - better with pushback detection? FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); expectedOOOIState = 1; - lastgear0 = 0; } } } else if (expectedOOOIState == 1) { # OFF @@ -162,7 +162,7 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision if (gear0 and (phase == 7 or phase == 0)) { #done or preflight FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); expectedOOOIState = 3; - lastgear0 = 0; + lastgs0 = 0; lastgsrestart = 0; } } else if (expectedOOOIState == 3) { # IN @@ -177,9 +177,9 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision } } else if (!gear0) { # OFF without IN -> TO without stop and opening doors - if (lastgear0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgear0)); # IN (estimated) + if (lastgs0>0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgs0)); # IN (estimated) FlightLogDatabase.addPage(); - if (lastgsrestart) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated) + if (lastgsrestart>0) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated) expectedOOOIState = 1; # go on to OFF state } else if (gs > 9 and lastgsrestart == 0) { # try to detect OFF without IN diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e96f0df2..9d048ea0 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -238,6 +238,7 @@ var initInputA = func(key, i) { fmgc.flightPlanController.reset(2); fmgc.flightPlanController.init(); Simbrief.SimbriefParser.inhibit = 0; + fmgc.updateARPT(); mcdu_scratchpad.scratchpads[i].empty(); #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 0; @@ -264,6 +265,7 @@ var initInputA = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); fmgc.FMGCInternal.altSelected = 0; + fmgc.updateARPT(); fmgc.updateArptLatLon(); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); } else { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index d1fd839d..592f6f26 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -241,7 +241,7 @@ var lskbutton = func(btn, i) { progTOInput("L1",i); # same fn as TO } else if (page == "PROGTO") { progTOInput("L1",i); - } else if (page == "PROGCLB") { + } else if (page == "PROGCLB" or page == "PROGAPPR") { # APPR restore to CLB progCLBInput("L1",i); } else if (page == "PROGCRZ") { progCRZInput("L1",i); @@ -534,6 +534,8 @@ var lskbutton = func(btn, i) { statusInput("L3",i); } else if (page == "RADNAV") { radnavInput("L3",i); + } else if (page == "DATA") { + dataInput("L3",i); } else if (page == "PRINTFUNC") { printInput("L3",i); } else if (page == "PRINTFUNC2") { @@ -634,6 +636,8 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "VERTREV") { + canvas_mcdu.myVertRev[i].pushButtonLeft(3); } else if (page == "MCDUTEXT") { atsu.freeTexts[i].selection = 2; atsu.freeTexts[i].changed = 1; @@ -853,7 +857,13 @@ var lskbutton = func(btn, i) { } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(6); } else if (page == "LATREV" or page == "VERTREV" or page == "DUPLICATENAMES") { - pageNode[i].setValue("F-PLNA"); + if (page != "DUPLICATENAMES") { + pageNode[i].setValue("F-PLNA"); + } else { + if (canvas_mcdu.myDuplicate[i] != nil and canvas_mcdu.myDuplicate[i].flagPROG) { + pagebutton("prog",i); + } + } } else if (page == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(6); } else if (page == "DEPARTURE" or page == "HOLD" or page == "AIRWAYS") { @@ -887,6 +897,8 @@ var lskbutton = func(btn, i) { pageNode[i].setValue("ATIS"); } else if (page == "AOCCONFIG") { pageNode[i].setValue("AOCMENU"); + } else if (page == "POSMON") { + canvas_mcdu.togglePageFreeze(i); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -1075,6 +1087,8 @@ var rskbutton = func(btn, i) { atsu.freeTexts[i].changed = 1; } else if (page == "ATCMENU") { pageNode[i].setValue("MCDUTEXT"); + } else if (page == "VERTREV") { + canvas_mcdu.myVertRev[i].pushButtonRight(3); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -1121,6 +1135,8 @@ var rskbutton = func(btn, i) { } } pageNode[i].setValue("WINDCRZ"); + } else if (find("PROG",page) != -1) { + progGENInput("R4",i); } else if (page == "PERFTO") { perfTOInput("R4",i); } else if (page == "PERFAPPR") { @@ -1430,8 +1446,12 @@ var pagebutton = func(btn, i) { pageNode[i].setValue("PROGCLB"); } else if (fmgc.FMGCInternal.phase == 3) { pageNode[i].setValue("PROGCRZ"); - } else if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { + } else if (fmgc.FMGCInternal.phase == 4) { pageNode[i].setValue("PROGDES"); + } else if (fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { + pageNode[i].setValue("PROGAPPR"); + } else if (fmgc.FMGCInternal.phase == 7) { + pageNode[i].setValue("PROGDONE"); } } else if (btn == "perf") { if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index d4cdcd29..7571aa52 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -19,91 +19,81 @@ var perfTOCheckVSpeeds = func(i) { } } -var perfTOInput = func(key, i) { +var perfTOInput = func(key, i) { + var modifiable = (fmgc.FMGCInternal.phase == 1) ? 0 : 1; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L1") { - if (fmgc.FMGCInternal.phase != 1) { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.v1 = 0; - fmgc.FMGCInternal.v1set = 0; - fmgc.FMGCNodes.v1.setValue(0); - fmgc.FMGCNodes.v1set.setValue(0); - mcdu_scratchpad.scratchpads[i].empty(); - } else { - var tfs = size(scratchpad); - if (tfs == 3) { - if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { - fmgc.FMGCInternal.v1 = scratchpad; - fmgc.FMGCInternal.v1set = 1; - - # for sounds: - fmgc.FMGCNodes.v1.setValue(scratchpad); - fmgc.FMGCNodes.v1set.setValue(1); - mcdu_scratchpad.scratchpads[i].empty(); - perfTOCheckVSpeeds(i); # do V-speeds validation - } else { - mcdu_message(i, "NOT ALLOWED"); - } + if (key == "L1" and modifiable) { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.v1 = 0; + fmgc.FMGCInternal.v1set = 0; + fmgc.FMGCNodes.v1.setValue(0); + fmgc.FMGCNodes.v1set.setValue(0); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { + fmgc.FMGCInternal.v1 = scratchpad; + fmgc.FMGCInternal.v1set = 1; + + # for sounds: + fmgc.FMGCNodes.v1.setValue(scratchpad); + fmgc.FMGCNodes.v1set.setValue(1); + mcdu_scratchpad.scratchpads[i].empty(); + + perfTOCheckVSpeeds(i); # do V-speeds validation } else { mcdu_message(i, "NOT ALLOWED"); } + } else { + mcdu_message(i, "NOT ALLOWED"); } - } else { - mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "L2") { - if (fmgc.FMGCInternal.phase != 1) { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.vr = 0; - fmgc.FMGCInternal.vrset = 0; - mcdu_scratchpad.scratchpads[i].empty(); - } else { - var tfs = size(scratchpad); - if (tfs == 3) { - if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { - fmgc.FMGCInternal.vr = scratchpad; - fmgc.FMGCInternal.vrset = 1; - mcdu_scratchpad.scratchpads[i].empty(); + } else if (key == "L2" and modifiable) { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.vr = 0; + fmgc.FMGCInternal.vrset = 0; + mcdu_scratchpad.scratchpads[i].empty(); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { + fmgc.FMGCInternal.vr = scratchpad; + fmgc.FMGCInternal.vrset = 1; + mcdu_scratchpad.scratchpads[i].empty(); - perfTOCheckVSpeeds(i); # do V-speeds validation - } else { - mcdu_message(i, "NOT ALLOWED"); - } + perfTOCheckVSpeeds(i); # do V-speeds validation } else { mcdu_message(i, "NOT ALLOWED"); } + } else { + mcdu_message(i, "NOT ALLOWED"); } - } else { - mcdu_message(i, "NOT ALLOWED"); } - } else if (key == "L3") { - if (fmgc.FMGCInternal.phase != 1) { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.v2 = 0; - fmgc.FMGCInternal.v2set = 0; - setprop("/it-autoflight/settings/togaspd", 157); - mcdu_scratchpad.scratchpads[i].empty(); - } else { - var tfs = size(scratchpad); - if (tfs == 3) { - if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { - fmgc.FMGCInternal.v2 = scratchpad; - fmgc.FMGCInternal.v2set = 1; - fmgc.updatePitchArm2(); - setprop("/it-autoflight/settings/togaspd", scratchpad); - mcdu_scratchpad.scratchpads[i].empty(); + } else if (key == "L3" and modifiable) { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.v2 = 0; + fmgc.FMGCInternal.v2set = 0; + setprop("/it-autoflight/settings/togaspd", 157); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + var tfs = size(scratchpad); + if (tfs == 3) { + if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { + fmgc.FMGCInternal.v2 = scratchpad; + fmgc.FMGCInternal.v2set = 1; + fmgc.updatePitchArm2(); + setprop("/it-autoflight/settings/togaspd", scratchpad); + mcdu_scratchpad.scratchpads[i].empty(); - perfTOCheckVSpeeds(i); # do V-speeds validation - } else { - mcdu_message(i, "NOT ALLOWED"); - } + perfTOCheckVSpeeds(i); # do V-speeds validation } else { mcdu_message(i, "NOT ALLOWED"); } + } else { + mcdu_message(i, "NOT ALLOWED"); } - } else { - mcdu_message(i, "NOT ALLOWED"); } } else if (key == "L4") { if (scratchpad == "CLR") { @@ -120,7 +110,7 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "L5") { + } else if (key == "L5" and modifiable) { if (scratchpad == "CLR") { setprop("/systems/thrust/clbreduc-ft", 1500); setprop("/FMGC/internal/accel-agl-ft", 1500); @@ -160,7 +150,7 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "R3") { + } else if (key == "R3" and modifiable) { if (scratchpad == "CLR") { setprop("/FMGC/internal/to-flap", 0); setprop("/FMGC/internal/to-ths", "0.0"); @@ -230,7 +220,7 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "R4") { + } else if (key == "R4" and modifiable) { if (scratchpad == "CLR") { setprop("/FMGC/internal/flex", 0); setprop("/FMGC/internal/flex-set", 0); @@ -251,7 +241,7 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } - } else if (key == "R5") { + } else if (key == "R5" and modifiable) { if (scratchpad == "CLR") { setprop("/FMGC/internal/eng-out-reduc", "1500"); setprop("MCDUC/reducacc-set", 0); @@ -268,5 +258,7 @@ var perfTOInput = func(key, i) { } } else if (key == "R6") { setprop("MCDU[" ~ i ~ "]/page", "PERFCLB"); - } + } else { + mcdu_message(i, "NOT ALLOWED"); + } } diff --git a/Nasal/MCDU/PROG.nas b/Nasal/MCDU/PROG.nas new file mode 100644 index 00000000..116c5c44 --- /dev/null +++ b/Nasal/MCDU/PROG.nas @@ -0,0 +1,284 @@ +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var altSet = props.globals.getNode("it-autoflight/input/alt", 1); +var brgDistResult = nil; + +var progGENInput = func(key, i) { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (key == "R4") { + if (scratchpad == "CLR") { + bearingDistances[i].selectedPoint = nil; + bearingDistances[i].displayID = nil; + mcdu_scratchpad.scratchpads[i].empty(); + } else { + brgDistResult = bearingDistances[i].newPoint(mcdu_scratchpad.scratchpads[i].scratchpad); + if (brgDistResult != 1) { + mcdu_message(i, "NOT IN DATA BASE"); + } else { + mcdu_scratchpad.scratchpads[i].empty(); + } + } + } +} + +var progTOInput = func(key, i) { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (key == "L1") { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; + mcdu_scratchpad.scratchpads[i].empty(); + } else if (int(scratchpad) != nil) { + var crzs = size(scratchpad); + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100 and fmgc.FMGCInternal.crzSet) { + fmgc.FMGCInternal.crzProg = scratchpad; + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } +} + +var progCLBInput = func(key, i) { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (key == "L1") { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; + if (fmgc.FMGCInternal.phase == 5) { + fmgc.FMGCInternal.phase = 3; + setprop("/FMGC/internal/activate-once", 0); + setprop("/FMGC/internal/activate-twice", 0); + setprop("/FMGC/internal/decel", 0); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else if (int(scratchpad) != nil) { + var crzs = size(scratchpad); + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { + fmgc.FMGCInternal.crzProg = scratchpad; + mcdu_scratchpad.scratchpads[i].empty(); + if (fmgc.FMGCInternal.phase == 5) { + fmgc.FMGCInternal.phase = 3; + setprop("/FMGC/internal/activate-once", 0); + setprop("/FMGC/internal/activate-twice", 0); + setprop("/FMGC/internal/decel", 0); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } +} + +var progCRZInput = func(key, i) { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (key == "L1") { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; + if (fmgc.FMGCInternal.phase == 5) { + fmgc.FMGCInternal.phase = 3; + setprop("/FMGC/internal/activate-once", 0); + setprop("/FMGC/internal/activate-twice", 0); + setprop("/FMGC/internal/decel", 0); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else if (int(scratchpad) != nil) { + var crzs = size(scratchpad); + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { + fmgc.FMGCInternal.crzProg = scratchpad; + mcdu_scratchpad.scratchpads[i].empty(); + if (fmgc.FMGCInternal.phase == 5) { + fmgc.FMGCInternal.phase = 3; + setprop("/FMGC/internal/activate-once", 0); + setprop("/FMGC/internal/activate-twice", 0); + setprop("/FMGC/internal/decel", 0); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } +} + +var progDESInput = func(key, i) { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (key == "L1") { + if (scratchpad == "CLR") { + fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; + if (fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { + fmgc.FMGCInternal.phase = 3; + setprop("/FMGC/internal/activate-once", 0); + setprop("/FMGC/internal/activate-twice", 0); + setprop("/FMGC/internal/decel", 0); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else if (int(scratchpad) != nil) { + var crzs = size(scratchpad); + if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { + fmgc.FMGCInternal.crzProg = scratchpad; + mcdu_scratchpad.scratchpads[i].empty(); + if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { + fmgc.FMGCInternal.phase = 3; + setprop("/FMGC/internal/activate-once", 0); + setprop("/FMGC/internal/activate-twice", 0); + setprop("/FMGC/internal/decel", 0); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } +} + +var _result = [nil, nil]; +var _courseAndDistance = [nil, nil]; +var bearingDistanceInstance = { + new: func(id) { + var bd = {parents: [bearingDistanceInstance]}; + bd.id = id; + bd.bearing = 360; + bd.distance = 0; + bd.selectedPoint = nil; + bd.displayID = nil; + return bd; + }, + newPointResult: func(result, duplicateNames = 0, duplicateNamesIndex = nil) { + if (duplicateNames != 0) { + me.selectedPoint = result[duplicateNamesIndex]; + me.displayID = result[duplicateNamesIndex].id; + } elsif (size(result) > 1) { + if (canvas_mcdu.myDuplicate[me.id] != nil) { + canvas_mcdu.myDuplicate[me.id].del(); + } + canvas_mcdu.myDuplicate[me.id] = nil; + canvas_mcdu.myDuplicate[me.id] = mcdu.duplicateNamesPage.new(result, 0, 0, me.id, 0, -999, -999, 1); + setprop("MCDU[" ~ me.id ~ "]/page", "DUPLICATENAMES"); + } else { + me.selectedPoint = result[0]; + me.displayID = result[0].id; + } + return 1; + }, + newPointNavaid: func(result, duplicateNames = 0, duplicateNamesIndex = nil) { + if (duplicateNames != 0) { + me.selectedPoint = result[duplicateNamesIndex]; + me.displayID = result[duplicateNamesIndex].id; + } elsif (size(result) > 1) { + if (canvas_mcdu.myDuplicate[me.id] != nil) { + canvas_mcdu.myDuplicate[me.id].del(); + } + canvas_mcdu.myDuplicate[me.id] = nil; + canvas_mcdu.myDuplicate[me.id] = mcdu.duplicateNamesPage.new(result, 0, 1, me.id, 0, -999, -999, 1); + setprop("MCDU[" ~ me.id ~ "]/page", "DUPLICATENAMES"); + } else { + me.selectedPoint = result[0]; + me.displayID = result[0].id; + print("YES"); + } + return 1; + }, + newPointRWY: func(result,ID) { + if (size(result) > 1) { + #spawnPAGE + } else { + var string = split(left(ID,4),ID)[1]; + if (find("C",string) != -1 or find("L",string) != -1 or find("R",string) != -1) { + if (size(string) == 2) { + string = "0" ~ string; + } + } else { + if (size(string) == 1) { + string = "0" ~ string; + } + } + + if (contains(result[0].runways,string)) { + me.selectedPoint = {lat: result[0].runways[string].lat, lon: result[0].runways[string].lon}; + me.displayID = left(ID,4) ~ string; + return 1; + } else { + return 0; + } + } + return 1; + }, + newPointLatLon: func(result) { + return 0; + }, + newPoint: func(id) { + _result[me.id] = fmgc.WaypointDatabase.getWP(id); + if (_result[me.id] != nil) { + me.selectedPoint = _result[me.id]; + me.displayID = _result[me.id].id; + return 1; + } + + if (size(id) >= 2 and size(id) <= 3) { + _result[me.id] = findNavaidsByID(id); + if (size(_result[me.id]) != 0) { + return me.newPointNavaid(_result[me.id]); + } else { + _result[me.id] = findAirportsByICAO(id); # consider 3 letter ICAOs + if (size(_result[me.id]) != 0) { + return me.newPointResult(_result[me.id]); + } + } + return 0; + } elsif (size(id) == 4) { + _result[me.id] = findAirportsByICAO(id); + if (size(_result[me.id]) != 0) { + return me.newPointResult(_result[me.id]); + } else { + _result[me.id] = findFixesByID(id); + if (size(_result[me.id]) != 0) { + return me.newPointResult(_result[me.id]); + } + } + return 0; + } elsif (size(id) >= 5 and size(id) <= 7) { + _result[me.id] = findFixesByID(id); + if (size(_result[me.id]) != 0) { + return me.newPointResult(_result[me.id]); + } else { + _result[me.id] = findAirportsByICAO(left(id,4)); + if (size(_result[me.id]) != 0) { + return me.newPointRWY(_result[me.id],id); + } + } + return 0; + } elsif (size(id) >= 12) { + _result[me.id] = fetchLatLon(id); + if (size(_result[me.id]) != 0) { + return me.newPointLatLon(_result[me.id]); + } + return 0; + } + return 0; + }, + update: func() { + if (me.selectedPoint == nil) { + return; + } + if (find("PROG",canvas_mcdu.pageProp[me.id].getValue()) == -1) { + return; + } + _courseAndDistance[me.id] = courseAndDistance(me.selectedPoint); + me.bearing = _courseAndDistance[me.id][0]; + me.distance = _courseAndDistance[me.id][1]; + }, +}; + +var bearingDistances = [bearingDistanceInstance.new(0),bearingDistanceInstance.new(1)]; + +var BDTimer = maketimer(2, func(){ + bearingDistances[0].update(); + bearingDistances[1].update(); +}); +BDTimer.start(); \ No newline at end of file diff --git a/Nasal/MCDU/PROGCLB.nas b/Nasal/MCDU/PROGCLB.nas deleted file mode 100644 index 66770ddd..00000000 --- a/Nasal/MCDU/PROGCLB.nas +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2020 Matthew Maring (mattmaring) - -var progCLBInput = func(key, i) { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L1") { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - if (fmgc.FMGCInternal.phase == 5) { - fmgc.FMGCInternal.phase = 3; - setprop("/FMGC/internal/activate-once", 0); - setprop("/FMGC/internal/activate-twice", 0); - setprop("/FMGC/internal/decel", 0); - } - mcdu_scratchpad.scratchpads[i].empty(); - } else if (int(scratchpad) != nil) { - var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { - fmgc.FMGCInternal.crzProg = scratchpad; - mcdu_scratchpad.scratchpads[i].empty(); - if (fmgc.FMGCInternal.phase == 5) { - fmgc.FMGCInternal.phase = 3; - setprop("/FMGC/internal/activate-once", 0); - setprop("/FMGC/internal/activate-twice", 0); - setprop("/FMGC/internal/decel", 0); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } -} diff --git a/Nasal/MCDU/PROGCRZ.nas b/Nasal/MCDU/PROGCRZ.nas deleted file mode 100644 index 7d188609..00000000 --- a/Nasal/MCDU/PROGCRZ.nas +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2020 Matthew Maring (mattmaring) - -var progCRZInput = func(key, i) { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L1") { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - if (fmgc.FMGCInternal.phase == 5) { - fmgc.FMGCInternal.phase = 3; - setprop("/FMGC/internal/activate-once", 0); - setprop("/FMGC/internal/activate-twice", 0); - setprop("/FMGC/internal/decel", 0); - } - mcdu_scratchpad.scratchpads[i].empty(); - } else if (int(scratchpad) != nil) { - var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { - fmgc.FMGCInternal.crzProg = scratchpad; - mcdu_scratchpad.scratchpads[i].empty(); - if (fmgc.FMGCInternal.phase == 5) { - fmgc.FMGCInternal.phase = 3; - setprop("/FMGC/internal/activate-once", 0); - setprop("/FMGC/internal/activate-twice", 0); - setprop("/FMGC/internal/decel", 0); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } -} diff --git a/Nasal/MCDU/PROGDES.nas b/Nasal/MCDU/PROGDES.nas deleted file mode 100644 index c915f35f..00000000 --- a/Nasal/MCDU/PROGDES.nas +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2020 Matthew Maring (mattmaring) - -var progDESInput = func(key, i) { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L1") { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - if (fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { - fmgc.FMGCInternal.phase = 3; - setprop("/FMGC/internal/activate-once", 0); - setprop("/FMGC/internal/activate-twice", 0); - setprop("/FMGC/internal/decel", 0); - } - mcdu_scratchpad.scratchpads[i].empty(); - } else if (int(scratchpad) != nil) { - var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100) { - fmgc.FMGCInternal.crzProg = scratchpad; - mcdu_scratchpad.scratchpads[i].empty(); - if (fmgc.FMGCInternal.phase == 4 or fmgc.FMGCInternal.phase == 5 or fmgc.FMGCInternal.phase == 6) { - fmgc.FMGCInternal.phase = 3; - setprop("/FMGC/internal/activate-once", 0); - setprop("/FMGC/internal/activate-twice", 0); - setprop("/FMGC/internal/decel", 0); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } -} diff --git a/Nasal/MCDU/PROGTO.nas b/Nasal/MCDU/PROGTO.nas deleted file mode 100644 index 5e0f96d4..00000000 --- a/Nasal/MCDU/PROGTO.nas +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2020 Matthew Maring (mattmaring) - -var altSet = props.globals.getNode("it-autoflight/input/alt", 1); - -var progTOInput = func(key, i) { - var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; - if (key == "L1") { - if (scratchpad == "CLR") { - fmgc.FMGCInternal.crzProg = fmgc.FMGCInternal.crzFl; - mcdu_scratchpad.scratchpads[i].empty(); - } else if (int(scratchpad) != nil) { - var crzs = size(scratchpad); - if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and fmgc.FMGCInternal.crzSet <= scratchpad * 100 and fmgc.FMGCInternal.crzSet) { - fmgc.FMGCInternal.crzProg = scratchpad; - mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else { - mcdu_message(i, "NOT ALLOWED"); - } - } -} diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index 05513585..e3ced48d 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -1,3 +1,5 @@ +var scratchpadStore = nil; + var vertRev = { title: [nil, nil, nil], subtitle: [nil, nil], @@ -42,6 +44,28 @@ var vertRev = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } }, + getSpd: func() { + if (me.wp.speed_cstr != nil and me.wp.speed_cstr > 0) { + var tcol = (me.wp.speed_cstr_type == "computed" or me.wp.speed_cstr_type == "computed_mach") ? "grn" : "mag"; # TODO - check if only computed + return [" " ~ sprintf("%3.0f", me.wp.speed_cstr), tcol]; + } else { + return [nil,nil]; + } + }, + 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 + if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) { + return [sprintf("%5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)) ~ " ", tcol]; + } else { + return [sprintf("%5.0f", me.wp.alt_cstr) ~ " ", tcol]; + } + } else { + return [nil,nil]; + } + }, + alt: nil, + speed: nil, _setupPageWithData: func() { if (me.type == 3) { me.title = ["VERT REV", " AT ", "PPOS"]; @@ -57,15 +81,30 @@ var vertRev = { me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; } elsif (me.type == 2) { me.title = ["VERT REV", " AT ", me.id]; + me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0]]; me.L1 = ["", " EFOB ---.-", "wht"]; me.R1 = ["", "EXTRA ---.- ", "wht"]; me.L2 = ["250/10000", " CLB SPD LIM", "mag"]; - me.L3 = [" [ ]", " SPD CSTR", "blu"]; + me.speed = me.getSpd(); + if (me.speed[0] == nil) { + me.L3 = [" [ ]", " SPD CSTR", "blu"]; + me.fontMatrix[0][2] = 1; + } else { + me.L3 = [me.speed[0], " SPD CSTR", me.speed[1]]; + me.fontMatrix[0][2] = 0; + } me.L4 = [" CONSTANT MACH", nil, "wht"]; me.L5 = [" WIND DATA", nil, "wht"]; me.L6 = [" CLB", nil, "amb"]; me.R2 = ["RTA ", nil, "wht"]; - me.R3 = ["[ ] ", "ALT CSTR ", "blu"]; + me.alt = me.getAlt(); + if (me.alt[0] == nil) { + me.R3 = ["[ ] ", "ALT CSTR ", "blu"]; + me.fontMatrix[1][2] = 1; + } else { + me.R3 = [me.alt[0], "ALT CSTR ", me.alt[1]]; + me.fontMatrix[1][2] = 0; + } me.R6 = ["DES ", nil, "amb"]; # When the system does vertical planning, L6 should be RETURN and R6 not used if the MCDU knows the waypoint is during climb or descent. # The CLB or DES prompts should only be shown for a vertical revision in the cruise phase. @@ -74,7 +113,6 @@ var vertRev = { # The 'arrows' for CLB/DES should actually be asterisks. me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 1]]; me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "amb"], ["ack", "wht", "ack", "ack", "wht", "amb"]]; - me.fontMatrix = [[0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0]]; } else { me.title = ["VERT REV", " AT ", me.id]; @@ -135,8 +173,22 @@ var vertRev = { } }, pushButtonLeft: func(index) { - if (index == 5) { - #print("role: ", me.wp.wp_role, ", type: ", me.wp.wp_type); + scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad; + if (index == 3 and me.type == 2) { + if (scratchpadStore == "CLR") { + me.wp.setSpeed("delete"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3 and scratchpadStore >= 100 and scratchpadStore <= 350) { + me.wp.setSpeed(scratchpadStore, "at"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } else { + mcdu_message(me.computer, "FORMAT ERROR"); + } + } elsif (index == 5) { if (me.wp.wp_role == "sid") { if (canvas_mcdu.myCLBWIND[me.computer] == nil) { canvas_mcdu.myCLBWIND[me.computer] = windCLBPage.new(me.computer); @@ -182,6 +234,24 @@ var vertRev = { mcdu_message(me.computer, "NOT ALLOWED"); } }, + pushButtonRight: func(index) { + scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad; + if (index == 3 and me.type == 2) { + if (scratchpadStore == "CLR") { + me.wp.setAltitude("delete"); + 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"); + } + } + }, }; var updateCrzLvlCallback = func () { diff --git a/Nasal/Panels/atc.nas b/Nasal/Panels/atc.nas index 5cf13a00..d5abadfb 100644 --- a/Nasal/Panels/atc.nas +++ b/Nasal/Panels/atc.nas @@ -20,13 +20,12 @@ var Transponder = { activeADIRS: 1, condition: 0, failed: 0, - codeDigitsNodes: [props.globals.getNode("instrumentation/transponder/inputs/digit[0]", 1), props.globals.getNode("instrumentation/transponder/inputs/digit[1]", 1), props.globals.getNode("instrumentation/transponder/inputs/digit[2]", 1), props.globals.getNode("instrumentation/transponder/inputs/digit[3]", 1)], - serviceableNode: props.globals.getNode("instrumentation/transponder/serviceable", 1), - knobNode: props.globals.getNode("instrumentation/transponder/inputs/knob-mode", 1), - identNode: props.globals.getNode("instrumentation/transponder/inputs/ident-btn", 1), - ac1Node: props.globals.getNode("/systems/electrical/bus/ac-1", 1), - tcasNode: props.globals.getNode("instrumentation/tcas/inputs/mode"), - aglNode: props.globals.getNode("position/gear-agl-ft", 1), + codeDigitsNodes: [props.globals.getNode("/instrumentation/transponder/inputs/digit[0]", 1), props.globals.getNode("/instrumentation/transponder/inputs/digit[1]", 1), props.globals.getNode("/instrumentation/transponder/inputs/digit[2]", 1), props.globals.getNode("instrumentation/transponder/inputs/digit[3]", 1)], + serviceableNode: props.globals.getNode("/instrumentation/transponder/serviceable", 1), + knobNode: props.globals.getNode("/instrumentation/transponder/inputs/knob-mode", 1), + identNode: props.globals.getNode("/instrumentation/transponder/inputs/ident-btn", 1), + tcasNode: props.globals.getNode("/instrumentation/tcas/inputs/mode"), + aglNode: props.globals.getNode("/position/gear-agl-ft", 1), electricNode: props.globals.getNode("/systems/electrical/outputs/transponder", 1), # communicate to generic systems new: func(elecSrc, ADIRS) { var t = {parents:[Transponder]}; @@ -40,9 +39,9 @@ var Transponder = { return t; }, - update: func() { + update: func(notification) { # TCAS - on seperate electrical source, so has to be before transponder electrical checking - if (me.ac1Node.getValue() < 110) { + if (notification.elecAC1 < 110) { me.tcasNode.setValue(0); # off } else { if (me.mode >= 1 and me.mode <= 3) { @@ -285,7 +284,6 @@ var transponderPanel = { var init = func() { transponderPanel.atcSwitch(1); transponderPanel.updateAirData(); - transponderTimer.start(); } # Handler for code change from generic dialog @@ -297,9 +295,6 @@ setlistener("/instrumentation/transponder/id-code", func { var Transponders = std.Vector.new([Transponder.new("/systems/electrical/bus/ac-ess-shed", 1), Transponder.new("/systems/electrical/bus/ac-2", 2)]); -var transponderTimer = maketimer(0.1, func() { - Transponders.vector[transponderPanel.atcSel - 1].update(); -}); setlistener("/systems/navigation/adr/operating-1", func() { transponderPanel.updateADR1(systems.ADIRS.Operating.adr[0].getValue()); diff --git a/Nasal/Panels/clock.nas b/Nasal/Panels/clock.nas index 558cac2c..30985b60 100644 --- a/Nasal/Panels/clock.nas +++ b/Nasal/Panels/clock.nas @@ -1,8 +1,10 @@ # -# Chrono - Clock - ET +# Chrono - Clock - ET # var chr = aircraft.timer.new("instrumentation/chrono[0]/elapsetime-sec",1); var clk = aircraft.timer.new("instrumentation/clock/elapsetime-sec",1); +var chrono_cpt = aircraft.timer.new("instrumentation/ndchrono[0]/elapsetime-sec",1); +var chrono_fo = aircraft.timer.new("instrumentation/ndchrono[1]/elapsetime-sec",1); var chr_min = nil; var chr_sec = nil; @@ -49,6 +51,22 @@ var chrono = { started: props.globals.getNode("/instrumentation/chrono[0]/started"), }; +#Cpt chrono +var cpt_chrono = { + etHh_cpt: props.globals.initNode("/instrumentation/ndchrono[0]/etHh_cpt", 0, "INT"), + etMin_cpt: props.globals.initNode("/instrumentation/ndchrono[0]/etMin_cpt", 0, "INT"), + etSec_cpt: props.globals.initNode("/instrumentation/ndchrono[0]/etSec_cpt", 0, "INT"), + text: props.globals.initNode("/instrumentation/ndchrono[0]/text", "0' 00''", "STRING"), +}; + +#Fo chrono +var fo_chrono = { + etHh_fo: props.globals.initNode("/instrumentation/ndchrono[1]/etHh_fo", 0, "INT"), + etMin_fo: props.globals.initNode("/instrumentation/ndchrono[1]/etMin_fo", 0, "INT"), + etSec_fo: props.globals.initNode("/instrumentation/ndchrono[1]/etSec_fo", 0, "INT"), + text: props.globals.initNode("/instrumentation/ndchrono[1]/text", "0' 00''", "STRING"), +}; + var rudderTrim = { rudderTrimDisplay: props.globals.initNode("/controls/flight/rudder-trim-display", 0, "STRING"), rudderTrimDisplayLetter: props.globals.initNode("/controls/flight/rudder-trim-letter-display", "", "STRING"), @@ -59,6 +77,8 @@ setlistener("sim/signals/fdm-initialized", func { chr.reset(); clk.stop(); clk.reset(); + chrono_cpt.reset(); + chrono_fo.reset(); rudderTrim.rudderTrimDisplay.setValue(sprintf("%2.1f", pts.Fdm.JSBsim.Hydraulics.Rudder.trimDeg.getValue())); start_loop.start(); }); @@ -120,6 +140,31 @@ setlistener("/instrumentation/chrono[0]/chrono-reset", func(et){ }; }, 0, 0); +#Chrono +setlistener("instrumentation/efis[0]/inputs/CHRONO", func(et){ + chrono0 = et.getValue(); + if (chrono0 == 1){ + chrono_cpt.start(); + } elsif (chrono0 == 2) { + chrono_cpt.stop(); + } elsif (chrono0 == 0) { + chrono_cpt.reset(); + setprop("instrumentation/ndchrono[0]/elapsetime-sec", 0); + } +}, 0, 0); + +setlistener("instrumentation/efis[1]/inputs/CHRONO", func(et){ + chrono1 = et.getValue(); + if (chrono1 == 1){ + chrono_fo.start(); + } elsif (chrono1 == 2) { + chrono_fo.stop(); + } elsif (chrono1 == 0) { + chrono_fo.reset(); + setprop("instrumentation/ndchrono[1]/elapsetime-sec", 0); + } +}, 0, 0); + setlistener("instrumentation/clock/et-selector", func(et){ tmp1 = et.getValue(); if (tmp1 == 2){ @@ -225,6 +270,40 @@ var start_loop = maketimer(0.1, func { item.update(nil); } } + + #Cpt Chrono + chr0_tmp = getprop("instrumentation/ndchrono[0]/elapsetime-sec"); + if (chr0_tmp >= 360000) { + setprop("instrumentation/ndchrono[0]/elapsetime-sec", getprop("instrumentation/ndchrono[0]/elapsetime-sec") - 360000); + }; + chr0_hh = int(chr0_tmp * 0.000277777777778); + chr0_min = int((chr0_tmp * 0.0166666666667) - (chr0_hh * 60)); + chr0_sec = int(chr0_tmp - (chr0_min * 60) - (chr0_hh * 3600)); + setprop("instrumentation/ndchrono[0]/etHh_cpt", chr0_hh); + setprop("instrumentation/ndchrono[0]/etMin_cpt", chr0_min); + setprop("instrumentation/ndchrono[0]/etSec_cpt", chr0_sec); + if (chr0_tmp >= 3600) { + setprop("instrumentation/ndchrono[0]/text", sprintf("%02d H %02d'", chr0_hh, chr0_min)); + } else { + setprop("instrumentation/ndchrono[0]/text", sprintf("%02d' %02d''", chr0_min, chr0_sec)); + } + + #Fo Chrono + chr1_tmp = getprop("instrumentation/ndchrono[1]/elapsetime-sec"); + if (chr1_tmp >= 360000) { + setprop("instrumentation/ndchrono[1]/elapsetime-sec", getprop("instrumentation/ndchrono[1]/elapsetime-sec") - 360000); + }; + chr1_hh = int(chr1_tmp * 0.000277777777778); + chr1_min = int(chr1_tmp * 0.0166666666667); + chr1_sec = int(chr1_tmp - (chr1_min * 60) - (chr1_hh * 3600)); + setprop("instrumentation/ndchrono[1]/etHh_fo", chr1_hh); + setprop("instrumentation/ndchrono[1]/etMin_fo", chr1_min); + setprop("instrumentation/ndchrono[1]/etSec_fo", chr1_sec); + if (chr1_tmp >= 3600) { + setprop("instrumentation/ndchrono[1]/text", sprintf("%02d H %02d'", chr1_hh, chr1_min)); + } else { + setprop("instrumentation/ndchrono[1]/text", sprintf("%02d' %02d''", chr1_min, chr1_sec)); + } }); var updateRudderTrim = func() { @@ -255,4 +334,4 @@ var update_items = [ ), ]; -setlistener("/controls/switches/annun-test", updateRudderTrim, 0, 0); \ No newline at end of file +setlistener("/controls/switches/annun-test", updateRudderTrim, 0, 0); diff --git a/Nasal/Panels/rmp.nas b/Nasal/Panels/rmp.nas index 06b77d17..2f661011 100644 --- a/Nasal/Panels/rmp.nas +++ b/Nasal/Panels/rmp.nas @@ -96,6 +96,9 @@ var am_mode_rmp3 = props.globals.initNode("/systems/radio/rmp[2]/am-active", 0, var sel_crs_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/select-crs", 1, "BOOL"); var sel_crs_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/select-crs", 1, "BOOL"); +var vhf3_data_mode = props.globals.initNode("/systems/radio/vhf3-data-mode", 1, "BOOL"); +var data_mode_stby_rmp = props.globals.initNode("/systems/radio/data-mode-stby-rmp", 0, "INT"); + var init = func() { chan_rmp1.setValue("vhf1"); chan_rmp2.setValue("vhf2"); @@ -153,57 +156,52 @@ var update_active_vhf = func(vhf) { var sel3 = chan_rmp3.getValue(); if (vhf == 1) { - if (sel1 == "vhf1" or sel2 == "vhf1") { - var act = sprintf("%3.3f", act_vhf1.getValue()); + var act = sprintf("%3.3f", act_vhf1.getValue()); - if (sel1 == "vhf1") { - act_display_rmp1.setValue(act); - } - if (sel2 == "vhf1") { - act_display_rmp2.setValue(act); - } - if (sel3 == "vhf1") { - act_display_rmp3.setValue(act); - } + if (sel1 == "vhf1") { + act_display_rmp1.setValue(act); + } + if (sel2 == "vhf1") { + act_display_rmp2.setValue(act); + } + if (sel3 == "vhf1") { + act_display_rmp3.setValue(act); } } else if (vhf == 2) { - if (sel1 == "vhf2" or sel2 == "vhf2") { - var act = sprintf("%3.3f", act_vhf2.getValue()); + var act = sprintf("%3.3f", act_vhf2.getValue()); - if (sel1 == "vhf2") { - act_display_rmp1.setValue(act); - } - if (sel2 == "vhf2") { - act_display_rmp2.setValue(act); - } - if (sel3 == "vhf2") { - act_display_rmp3.setValue(act); - } + if (sel1 == "vhf2") { + act_display_rmp1.setValue(act); + } + if (sel2 == "vhf2") { + act_display_rmp2.setValue(act); + } + if (sel3 == "vhf2") { + act_display_rmp3.setValue(act); } } else if (vhf == 3) { - if (sel1 == "vhf3" or sel2 == "vhf3") { - var act = sprintf("%3.3f", act_vhf3.getValue()); + var act = sprintf("%3.3f", act_vhf3.getValue()); + var data_mode = vhf3_data_mode.getValue(); - if (sel1 == "vhf3") { - if (act == 0) { - act_display_rmp1.setValue("data"); - } else { - act_display_rmp1.setValue(act); - } + if (sel1 == "vhf3") { + if (data_mode == 1) { + act_display_rmp1.setValue("data"); + } else { + act_display_rmp1.setValue(act); } - if (sel2 == "vhf3") { - if (act == 0) { - act_display_rmp2.setValue("data"); - } else { - act_display_rmp2.setValue(act); - } + } + if (sel2 == "vhf3") { + if (data_mode == 1) { + act_display_rmp2.setValue("data"); + } else { + act_display_rmp2.setValue(act); } - if (sel3 == "vhf3") { - if (act == 0) { - act_display_rmp3.setValue("data"); - } else { - act_display_rmp3.setValue(act); - } + } + if (sel3 == "vhf3") { + if (data_mode == 1) { + act_display_rmp3.setValue("data"); + } else { + act_display_rmp3.setValue(act); } } } else if (vhf == 4) { @@ -283,6 +281,7 @@ var update_displays_nav = func(nav) { } var update_stby_freq = func(rmp_no, freq) { + var data_mode = vhf3_data_mode.getValue(); if (rmp_no == 0) { if (freq == 1) { var stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue()); @@ -296,7 +295,7 @@ var update_stby_freq = func(rmp_no, freq) { var stby = sprintf("%5.0f", stby_rmp1_hf2.getValue()); } - if (stby == 0) { + if (data_mode == 0 and data_mode_stby_rmp.getValue() == 0) { stby_display_rmp1.setValue("data"); } else { stby_display_rmp1.setValue(stby); @@ -314,7 +313,7 @@ var update_stby_freq = func(rmp_no, freq) { var stby = sprintf("%5.0f", stby_rmp2_hf2.getValue()); } - if (stby == 0) { + if (data_mode == 0 and data_mode_stby_rmp.getValue() == 1) { stby_display_rmp2.setValue("data"); } else { stby_display_rmp2.setValue(stby); @@ -332,7 +331,7 @@ var update_stby_freq = func(rmp_no, freq) { var stby = sprintf("%5.0f", stby_rmp3_hf2.getValue()); } - if (stby == 0) { + if (data_mode == 0 and data_mode_stby_rmp.getValue() == 2) { stby_display_rmp3.setValue("data"); } else { stby_display_rmp3.setValue(stby); @@ -399,6 +398,18 @@ var transfer = func(rmp_no) { var sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs"); if (string.match(sel_chan, "vhf[1-3]")) { + var data_mode = vhf3_data_mode.getValue(); + if (string.match(sel_chan, "vhf3") and ((data_mode_stby_rmp.getValue() == rmp_no and data_mode == 0) or data_mode == 1)) { + if (data_mode == 0) + { + vhf3_data_mode.setValue(1); + } + else + { + vhf3_data_mode.setValue(0); + data_mode_stby_rmp.setValue(rmp_no); + } + } var mod1 = int(string.replace(sel_chan, "vhf", "")); var mod = mod1 - 1; diff --git a/Nasal/Systems/ADIRS/ADR.nas b/Nasal/Systems/ADIRS/ADR.nas index 59cf9668..08d6d57d 100644 --- a/Nasal/Systems/ADIRS/ADR.nas +++ b/Nasal/Systems/ADIRS/ADR.nas @@ -144,6 +144,7 @@ var ADIRU = { call(canvas_nd.ND_2.NDFo.predicates[predicate]); } }, + _excessMotion: 0, alignLoop: func() { me._roll = pts.Orientation.roll.getValue(); me._pitch = pts.Orientation.pitch.getValue(); @@ -152,13 +153,18 @@ var ADIRU = { # todo use IR values if (me._gs > 5 or abs(me._pitch) > 5 or abs(me._roll) > 10) { me.stopAlignNoAlign(); + me._excessMotion = 1; print("Excessive motion, restarting"); me.update(); # update operative me.align(calcAlignTime(pts.Position.latitude.getValue())); } elsif (me.operative == 0) { me.stopAlignNoAlign(); + me._excessMotion = 0; } elsif (pts.Sim.Time.elapsedSec.getValue() >= me._alignTime) { me.stopAlignAligned(); + me._excessMotion = 0; + } else { + me._excessMotion = 0; } if (!me.operating and pts.Sim.Time.elapsedSec.getValue() >= me._pfdTime) { @@ -318,7 +324,7 @@ var ADIRS = { } ), ], - loop: func() { + loop: func(notification) { if (me._init) { for (i = 0; i < _NUMADIRU; i = i + 1) { # update ADR units power @@ -342,7 +348,6 @@ var ADIRS = { } # Update VFE - notification = nil; foreach (var update_item; me.update_items) { update_item.update(notification); } diff --git a/Nasal/Systems/FADEC/fadec-common.nas b/Nasal/Systems/FADEC/fadec-common.nas index 60a49de4..64d7bf0b 100644 --- a/Nasal/Systems/FADEC/fadec-common.nas +++ b/Nasal/Systems/FADEC/fadec-common.nas @@ -448,4 +448,4 @@ setlistener("/systems/thrust/thr-locked", func { }, 0, 0); var lockTimer = maketimer(0.1, checkLockThr); -var lockTimer2 = maketimer(0.1, checkLockThr2); +var lockTimer2 = maketimer(0.1, checkLockThr2); \ No newline at end of file diff --git a/Nasal/Systems/brakesystem.nas b/Nasal/Systems/brakesystem.nas index ca021df9..b460b2cc 100755 --- a/Nasal/Systems/brakesystem.nas +++ b/Nasal/Systems/brakesystem.nas @@ -111,7 +111,7 @@ var BrakeSystem = }, # update brake energy - update : func() + update : func(notification) { if (me.counter == 0) { me.counter = 1; @@ -122,10 +122,10 @@ var BrakeSystem = LThermalEnergy = me.thermalEnergy[0]; RThermalEnergy = me.thermalEnergy[1]; - me.CurrentTime = pts.Sim.Time.elapsedSec.getValue(); + me.CurrentTime = notification.elapsedTime; dt = me.CurrentTime - me.LastSimTime; - LBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[0].getValue(); - RBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[1].getValue(); + LBrakeLevel = notification.leftBrakeFCS; + RBrakeLevel = notification.rightBrakeFCS; tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0; if (pts.Sim.replayState.getValue() == 0 and dt < 1.0) { @@ -137,7 +137,7 @@ var BrakeSystem = LCoolingRatio = LCoolingRatio * 3; RCoolingRatio = RCoolingRatio * 3; }; - airspeed = pts.Velocities.airspeed.getValue(); + airspeed = notification.airspeedV; if (pts.Gear.position[1].getValue()) { #increase CoolingRatio if gear down according to airspeed LCoolingRatio = LCoolingRatio * airspeed; @@ -168,7 +168,7 @@ var BrakeSystem = L_Thrust = 0; R_Thrust = 0; - if (pts.Gear.wow[1].getValue()) { + if (notification.gear1Wow) { var V1 = pts.Velocities.groundspeed.getValue(); var Mass = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() * me.ScalingDivisor; @@ -179,7 +179,7 @@ var BrakeSystem = LThermalEnergy += (Mass * pts.Gear.compression[1].getValue() * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); if (pts.Controls.Gear.chocks.getValue()) { - if (!pts.Controls.Gear.parkingBrake.getValue()) { + if (!notification.parkingBrake) { # cooling effect: reduce thermal energy by (LnCoolFactor) * dt LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); } else { @@ -188,7 +188,7 @@ var BrakeSystem = LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); }; } else { - if (!pts.Controls.Gear.parkingBrake.getValue()) { + if (!notification.parkingBrake) { if (LBrakeLevel>0) { if (V2_L>0) { #LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust; @@ -212,7 +212,7 @@ var BrakeSystem = RThermalEnergy += (Mass * pts.Gear.compression[2].getValue() * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); if (pts.Controls.Gear.chocks.getValue()) { - if (!pts.Controls.Gear.parkingBrake.getValue()) { + if (!notification.parkingBrake) { # cooling effect: reduce thermal energy by (RnCoolFactor) * dt RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); } else { @@ -221,7 +221,7 @@ var BrakeSystem = RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); }; } else { - if (!pts.Controls.Gear.parkingBrake.getValue()) { + if (!notification.parkingBrake) { if (RBrakeLevel>0) { if (V2_R>0) { #RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust; @@ -271,7 +271,7 @@ var BrakeSystem = if (LThermalEnergy>1 and !me.LSmokeActive) { # start smoke processing me.LSmokeActive = 1; - settimer(func { BrakeSys.Lsmoke(); },0); + settimer(func { BrakeSys.Lsmoke(); },0); # is settimer needed? }; if (RThermalEnergy>1 and !me.RSmokeActive) { # start smoke processing @@ -406,7 +406,7 @@ var Autobrake = { me._mode = me.mode.getValue(); me._active = me.active.getBoolValue(); if (me._gnd_speed > 72) { - if (me._mode != 0 and pts.Controls.Engines.Engine.throttle[0].getValue() < 0.15 and pts.Controls.Engines.Engine.throttle[1].getValue() < 0.15 and me._wow0 and systems.HYD.Brakes.askidSw.getValue() and systems.HYD.Psi.green.getValue() >= 2500 ) { + if (me._mode != 0 and pts.Controls.Engines.Engine.throttle[0].getValue() < 0.15 and pts.Controls.Engines.Engine.throttle[1].getValue() < 0.15 and me._wow0 and systems.HYD.Switch.nwsSwitch.getBoolValue() and systems.HYD.Psi.green.getValue() >= 2500 ) { me.active.setBoolValue(1); } elsif (me._active) { me.active.setBoolValue(0); diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index 4089fcd3..120115d1 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -13,8 +13,6 @@ var dc2 = 0; # Main class var ELEC = { - _timer1On: 0, - _timer2On: 0, EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"), Bus: { acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"), @@ -122,6 +120,7 @@ var ELEC = { volts: props.globals.getNode("/systems/electrical/sources/emer-gen/output-volt"), hertz: props.globals.getNode("/systems/electrical/sources/emer-gen/output-hertz"), voltsRelay: props.globals.getNode("/systems/electrical/relay/emer-glc/output"), + relayPos: props.globals.getNode("/systems/electrical/relay/emer-glc/contact-pos"), }, Ext: { volts: props.globals.getNode("/systems/electrical/sources/ext/output-volt"), @@ -207,36 +206,65 @@ var ELEC = { me.Fail.tr1Fault.setBoolValue(0); me.Fail.tr2Fault.setBoolValue(0); }, - loop: func() { + _FMGC1: 0, + _FMGC2: 0, + _activeFMGC: nil, + _timer1On: 0, + _timer2On: 0, + loop: func(notification) { # Autopilot Disconnection routines - if (me.Bus.dcEssShed.getValue() < 25) { - if (fmgc.Output.ap1.getValue() and !me._timer1On) { + me._activeFMGC = fcu.FCUController.activeFMGC.getValue(); + me._FMGC1 = fmgc.Output.ap1.getValue(); + me._FMGC2 = fmgc.Output.ap2.getValue(); + + if (notification.dcEssShed < 25) { + if (me._FMGC1 and !me._timer1On) { # delay 1 cycle to avoid spurious me._timer1On = 1; - settimer(func() { - if (me.Bus.dcEssShed.getValue() < 25) { - fcu.apOff("hard", 1); - if (fcu.FCUController.activeFMGC.getValue() == 1) { - fcu.athrOff("hard"); - } + } elsif (me._FMGC1) { + if (notification.dcEssShed < 25) { + fcu.apOff("hard", 1); + if (me._activeFMGC == 1) { + fcu.athrOff("hard"); } - me._timer1On = 0; - }, 0.1); + } + me._timer1On = 0; } } - if (me.Bus.dc2.getValue() < 25) { - if (fmgc.Output.ap2.getValue() and !me._timer2On) { + if (notification.dc2 < 25) { + if (me._FMGC2 and !me._timer2On) { # delay 1 cycle to avoid spurious me._timer2On = 1; - settimer(func() { - if (me.Bus.dc2.getValue() < 25) { - fcu.apOff("hard", 2); - if (fcu.FCUController.activeFMGC.getValue() == 2) { - fcu.athrOff("hard"); - } + } elsif (me._FMGC2) { + if (notification.dc2 < 25) { + fcu.apOff("hard", 2); + if (me._activeFMGC == 2) { + fcu.athrOff("hard"); } - me._timer2On = 0; - }, 0.1); + } + me._timer2On = 0; } } }, +}; + +# Emesary +var A320Electrical = notifications.SystemRecipient.new("A320 Electrical",ELEC.loop,ELEC); +emesary.GlobalTransmitter.Register(A320Electrical); + +var input = { + "elecAC1": "/systems/electrical/bus/ac-1", + "elecAC2": "/systems/electrical/bus/ac-2", + "elecACEss": "/systems/electrical/bus/ac-ess", + "elecACEssShed": "/systems/electrical/bus/ac-ess-shed", + "dc1": "/systems/electrical/bus/dc-1", + "dc2": "/systems/electrical/bus/dc-2", + "dcBat": "/systems/electrical/bus/dc-bat", + "dcEss": "/systems/electrical/bus/dc-ess", + "dcEssShed": "/systems/electrical/bus/dc-ess-shed", + "dcHot1": "/systems/electrical/bus/dc-hot-1", + "dcHot2": "/systems/electrical/bus/dc-hot-2", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Electrical", name, input[name])); } \ No newline at end of file diff --git a/Nasal/Systems/fire.nas b/Nasal/Systems/fire.nas index 433e6335..d7c74a47 100644 --- a/Nasal/Systems/fire.nas +++ b/Nasal/Systems/fire.nas @@ -17,6 +17,7 @@ var cargoTestBtnOff = props.globals.initNode("/controls/fire/cargo/test-off", 0, var eng1FireWarn = props.globals.initNode("/systems/fire/engine1/warning-active", 0, "BOOL"); var eng2FireWarn = props.globals.initNode("/systems/fire/engine2/warning-active", 0, "BOOL"); var apuFireWarn = props.globals.initNode("/systems/fire/apu/warning-active", 0, "BOOL"); +var lavatoryFireWarn = props.globals.getNode("/systems/fire/lavatory/warning", 1); var eng1Inop = props.globals.initNode("/systems/fire/engine1/det-inop", 0, "BOOL"); var eng2Inop = props.globals.initNode("/systems/fire/engine2/det-inop", 0, "BOOL"); var apuInop = props.globals.initNode("/systems/fire/apu/det-inop", 0, "BOOL"); @@ -33,13 +34,15 @@ var eng1Agent2TimerTime = props.globals.initNode("/systems/fire/engine1/agent2-t var eng2Agent2TimerTime = props.globals.initNode("/systems/fire/engine2/agent2-timer-time", 0, "INT"); var apuAgentTimerTime = props.globals.initNode("/systems/fire/apu/agent-timer-time", 0, "INT"); +var fireButtons = [props.globals.getNode("/controls/engines/engine[0]/fire-btn"),props.globals.getNode("/controls/engines/engine[1]/fire-btn"),props.globals.getNode("/controls/apu/fire-btn")]; + var fire_init = func { setprop("/controls/OH/protectors/fwddisch", 0); setprop("/controls/OH/protectors/aftdisch", 0); setprop("/controls/fire/cargo/fwddisch", 0); setprop("/controls/fire/cargo/aftdisch", 0); - setprop("/systems/failures/cargo-fwd-fire", 0); - setprop("/systems/failures/cargo-aft-fire", 0); + setprop("/systems/failures/fire/cargo-fwd-fire", 0); + setprop("/systems/failures/fire/cargo-aft-fire", 0); setprop("/controls/fire/cargo/test", 0); fire_timer.start(); } @@ -276,9 +279,9 @@ var detectorLoop = { } }, sendSignal: func(system, typeLoop) { - if (system == 0 and !getprop("/systems/failures/engine-left-fire")) { return; } - elsif (system == 1 and !getprop("/systems/failures/engine-right-fire")) { return; } - elsif (system == 2 and !getprop("/systems/failures/apu-fire")) { return; } + if (system == 0 and !getprop("/systems/failures/fire/engine-left-fire")) { return; } + elsif (system == 1 and !getprop("/systems/failures/fire/engine-right-fire")) { return; } + elsif (system == 2 and !getprop("/systems/failures/fire/apu-fire")) { return; } engFireDetectorUnits.vector[system].receiveSignal(typeLoop); } }; @@ -303,8 +306,8 @@ var cargoDetectorLoop = { } }, sendSignal: func(system, typeLoop) { - if ((system == 0 or system == 1) and !getprop("/systems/failures/cargo-aft-fire")) { return; } - elsif (system == 2 and !getprop("/systems/failures/cargo-fwd-fire")) { return; } + if ((system == 0 or system == 1) and !getprop("/systems/failures/fire/cargo-aft-fire")) { return; } + elsif (system == 2 and !getprop("/systems/failures/fire/cargo-fwd-fire")) { return; } cargoSmokeDetectorUnits.vector[system].receiveSignal(typeLoop); } @@ -488,29 +491,29 @@ var checkTwoInop2Timer = maketimer(0.1, checkTwoInop2); var checkTwoInop3Timer = maketimer(0.1, checkTwoInop3); # Create fire systems -var engFireDetectorUnits = std.Vector.new([ engFireDetectorUnit.new(0, "/systems/failures/engine-left-fire", "/controls/fire/test-btn-1"), engFireDetectorUnit.new(1, "/systems/failures/engine-right-fire", "/controls/fire/test-btn-2"), engFireDetectorUnit.new(2, "/systems/failures/apu-fire", "/controls/fire/apu-test-btn") ]); -var cargoSmokeDetectorUnits = std.Vector.new([cargoSmokeDetectorUnit.new(0, "/systems/failures/cargo-aft-fire"), cargoSmokeDetectorUnit.new(1, "/systems/failures/cargo-aft-fire"), cargoSmokeDetectorUnit.new(1, "/systems/failures/cargo-fwd-fire")]); +var engFireDetectorUnits = std.Vector.new([ engFireDetectorUnit.new(0, "/systems/failures/fire/engine-left-fire", "/controls/fire/test-btn-1"), engFireDetectorUnit.new(1, "/systems/failures/fire/engine-right-fire", "/controls/fire/test-btn-2"), engFireDetectorUnit.new(2, "/systems/failures/fire/apu-fire", "/controls/fire/apu-test-btn") ]); +var cargoSmokeDetectorUnits = std.Vector.new([cargoSmokeDetectorUnit.new(0, "/systems/failures/fire/cargo-aft-fire"), cargoSmokeDetectorUnit.new(1, "/systems/failures/fire/cargo-aft-fire"), cargoSmokeDetectorUnit.new(1, "/systems/failures/fire/cargo-fwd-fire")]); # Create detector loops var engDetectorLoops = std.Vector.new([ -detectorLoop.new(0, 1, "/systems/fire/engine1/temperature", "/systems/electrical/bus/dc-ess", "/systems/failures/engine-left-fire"), detectorLoop.new(0, 2, "/systems/fire/engine1/temperature", "/systems/electrical/bus/dc-2", "/systems/failures/engine-left-fire"), -detectorLoop.new(1, 1, "/systems/fire/engine2/temperature", "/systems/electrical/bus/dc-2", "/systems/failures/engine-right-fire"), detectorLoop.new(1, 2, "/systems/fire/engine2/temperature", "/systems/electrical/bus/dc-ess", "/systems/failures/engine-right-fire"), -detectorLoop.new(2, 1, "/systems/fire/apu/temperature", "/systems/electrical/bus/dc-bat", "/systems/failures/apu-fire"), detectorLoop.new(2, 2, "/systems/fire/apu/temperature", "/systems/electrical/bus/dc-bat", "/systems/failures/apu-fire") +detectorLoop.new(0, 1, "/systems/fire/engine1/temperature", "/systems/electrical/bus/dc-ess", "/systems/failures/fire/engine-left-fire"), detectorLoop.new(0, 2, "/systems/fire/engine1/temperature", "/systems/electrical/bus/dc-2", "/systems/failures/fire/engine-left-fire"), +detectorLoop.new(1, 1, "/systems/fire/engine2/temperature", "/systems/electrical/bus/dc-2", "/systems/failures/fire/engine-right-fire"), detectorLoop.new(1, 2, "/systems/fire/engine2/temperature", "/systems/electrical/bus/dc-ess", "/systems/failures/fire/engine-right-fire"), +detectorLoop.new(2, 1, "/systems/fire/apu/temperature", "/systems/electrical/bus/dc-bat", "/systems/failures/fire/apu-fire"), detectorLoop.new(2, 2, "/systems/fire/apu/temperature", "/systems/electrical/bus/dc-bat", "/systems/failures/fire/apu-fire") ]); var cargoDetectorLoops = std.Vector.new([ -cargoDetectorLoop.new(0, 1, "/systems/fire/cargo/aft/temperature", "/systems/failures/cargo-aft-fire"), cargoDetectorLoop.new(0, 2, "/systems/fire/cargo/aft/temperature", "/systems/failures/cargo-aft-fire"), -cargoDetectorLoop.new(1, 1, "/systems/fire/cargo/aft/temperature", "/systems/failures/cargo-aft-fire"), cargoDetectorLoop.new(1, 2, "/systems/fire/cargo/aft/temperature", "/systems/failures/cargo-aft-fire"), -cargoDetectorLoop.new(2, 1, "/systems/fire/cargo/fwd/temperature", "/systems/failures/cargo-fwd-fire"), cargoDetectorLoop.new(2, 2, "/systems/fire/cargo/fwd/temperature", "/systems/failures/cargo-fwd-fire") +cargoDetectorLoop.new(0, 1, "/systems/fire/cargo/aft/temperature", "/systems/failures/fire/cargo-aft-fire"), cargoDetectorLoop.new(0, 2, "/systems/fire/cargo/aft/temperature", "/systems/failures/fire/cargo-aft-fire"), +cargoDetectorLoop.new(1, 1, "/systems/fire/cargo/aft/temperature", "/systems/failures/fire/cargo-aft-fire"), cargoDetectorLoop.new(1, 2, "/systems/fire/cargo/aft/temperature", "/systems/failures/fire/cargo-aft-fire"), +cargoDetectorLoop.new(2, 1, "/systems/fire/cargo/fwd/temperature", "/systems/failures/fire/cargo-fwd-fire"), cargoDetectorLoop.new(2, 2, "/systems/fire/cargo/fwd/temperature", "/systems/failures/fire/cargo-fwd-fire") ]); # Create extinguisher bottles -var extinguisherBottles = std.Vector.new([extinguisherBottle.new(0, "/systems/fire/engine1/disch1", "/systems/electrical/bus/dc-hot-1", "/systems/failures/engine-left-fire", "/systems/fire/engine1/warning-active"), extinguisherBottle.new(1, "/systems/fire/engine1/disch2", "/systems/electrical/bus/dc-2", "/systems/failures/engine-left-fire", "/systems/fire/engine1/warning-active"), -extinguisherBottle.new(0, "/systems/fire/engine2/disch1", "/systems/electrical/bus/dc-hot-2", "/systems/failures/engine-right-fire", "/systems/fire/engine2/warning-active"), extinguisherBottle.new(1, "/systems/fire/engine2/disch2", "/systems/electrical/bus/dc-2", "/systems/failures/engine-right-fire", "/systems/fire/engine2/warning-active"), -extinguisherBottle.new(9, "/systems/fire/apu/disch", "/systems/electrical/bus/dc-bat", "/systems/failures/apu-fire", "/systems/fire/apu/warning-active") ]); +var extinguisherBottles = std.Vector.new([extinguisherBottle.new(0, "/systems/fire/engine1/disch1", "/systems/electrical/bus/dc-hot-1", "/systems/failures/fire/engine-left-fire", "/systems/fire/engine1/warning-active"), extinguisherBottle.new(1, "/systems/fire/engine1/disch2", "/systems/electrical/bus/dc-2", "/systems/failures/fire/engine-left-fire", "/systems/fire/engine1/warning-active"), +extinguisherBottle.new(0, "/systems/fire/engine2/disch1", "/systems/electrical/bus/dc-hot-2", "/systems/failures/fire/engine-right-fire", "/systems/fire/engine2/warning-active"), extinguisherBottle.new(1, "/systems/fire/engine2/disch2", "/systems/electrical/bus/dc-2", "/systems/failures/fire/engine-right-fire", "/systems/fire/engine2/warning-active"), +extinguisherBottle.new(9, "/systems/fire/apu/disch", "/systems/electrical/bus/dc-bat", "/systems/failures/fire/apu-fire", "/systems/fire/apu/warning-active") ]); # There is only one bottle but the system will think there are two, so other parts work -var cargoExtinguisherBottles = std.Vector.new([extinguisherBottle.new(8, "/systems/fire/cargo/disch", "/systems/electrical/bus/dc-bat", "/systems/failures/cargo-aft-fire", "/systems/fire/cargo/aft/warning-active", 250), extinguisherBottle.new(7, "/systems/fire/cargo/disch", "/systems/electrical/bus/dc-bat", "/systems/failures/cargo-fwd-fire", "/systems/fire/cargo/fwd/warning-active", 250)]); +var cargoExtinguisherBottles = std.Vector.new([extinguisherBottle.new(8, "/systems/fire/cargo/disch", "/systems/electrical/bus/dc-bat", "/systems/failures/fire/cargo-aft-fire", "/systems/fire/cargo/aft/warning-active", 250), extinguisherBottle.new(7, "/systems/fire/cargo/disch", "/systems/electrical/bus/dc-bat", "/systems/failures/fire/cargo-fwd-fire", "/systems/fire/cargo/fwd/warning-active", 250)]); # Create CIDS channels var CIDSchannels = std.Vector.new([CIDSchannel.new("/systems/electrical/bus/dc-ess"), CIDSchannel.new("/systems/electrical/bus/dc-2")]); @@ -544,7 +547,7 @@ var createCargoFireBottleListener = func(prop, index) { # Listeners setlistener("/controls/engines/engine[0]/fire-btn", func() { - if (getprop("/controls/engines/engine[0]/fire-btn") == 1) { + if (systems.fireButtons[0].getValue() == 1) { ecam.shutUpYou(); eng1AgentTimerMakeTimer.stop(); eng1AgentTimer.setValue(10); @@ -587,7 +590,7 @@ eng1Agent2TimerMakeTimerFunc = func() { } setlistener("/controls/engines/engine[1]/fire-btn", func() { - if (getprop("/controls/engines/engine[1]/fire-btn") == 1) { + if (systems.fireButtons[1].getValue() == 1) { ecam.shutUpYou(); eng2AgentTimerMakeTimer.stop(); eng2AgentTimer.setValue(10); @@ -652,7 +655,7 @@ apuAgentTimerMakeTimerFunc = func() { } setlistener("/controls/fire/test-btn-1", func() { - if (getprop("/systems/failures/engine-left-fire")) { return; } + if (getprop("/systems/failures/fire/engine-left-fire")) { return; } if (testBtn.getValue() == 1) { if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { @@ -665,7 +668,7 @@ setlistener("/controls/fire/test-btn-1", func() { }, 0, 0); setlistener("/controls/fire/test-btn-2", func() { - if (getprop("/systems/failures/engine-right-fire")) { return; } + if (getprop("/systems/failures/fire/engine-right-fire")) { return; } if (testBtn2.getValue() == 1) { if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { eng2FireWarn.setBoolValue(1); @@ -677,7 +680,7 @@ setlistener("/controls/fire/test-btn-2", func() { }, 0, 0); setlistener("/controls/fire/apu-test-btn", func() { - if (getprop("/systems/failures/apu-fire")) { return; } + if (getprop("/systems/failures/fire/apu-fire")) { return; } if (apuTestBtn.getValue() == 1) { if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { apuFireWarn.setBoolValue(1); @@ -689,7 +692,7 @@ setlistener("/controls/fire/apu-test-btn", func() { }, 0, 0); setlistener("/controls/fire/cargo/test", func() { - if (getprop("/systems/failures/aft-cargo-fire") or getprop("/systems/failures/fwd-cargo-fire") or systems.ELEC.Bus.dcBat.getValue() < 25 or systems.ELEC.Bus.dcEss.getValue() < 25) { return; } + if (getprop("/systems/failures/fire/aft-cargo-fire") or getprop("/systems/failures/fire/fwd-cargo-fire") or systems.ELEC.Bus.dcBat.getValue() < 25 or systems.ELEC.Bus.dcEss.getValue() < 25) { return; } if (cargoTestBtn.getBoolValue()) { cargoTestTime.setValue(elapsedTime.getValue()); cargoTestChecker.start(); diff --git a/Nasal/Systems/hydraulics.nas b/Nasal/Systems/hydraulics.nas index c3cb02c2..204c40b5 100644 --- a/Nasal/Systems/hydraulics.nas +++ b/Nasal/Systems/hydraulics.nas @@ -10,7 +10,6 @@ var HYD = { accumPressPsi: props.globals.initNode("/systems/hydraulic/yellow-accumulator-psi-cmd", 0, "INT"), leftPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-left-psi", 0, "INT"), rightPressPsi: props.globals.initNode("/systems/hydraulic/brakes/pressure-right-psi", 0, "INT"), - askidSw: props.globals.initNode("/systems/hydraulic/brakes/askidnwssw", 1, "BOOL"), mode: props.globals.initNode("/systems/hydraulic/brakes/mode", 0, "INT"), leftbrake: props.globals.getNode("/controls/gear/brake-left"), rightbrake: props.globals.getNode("/controls/gear/brake-right"), @@ -57,6 +56,7 @@ var HYD = { rat: props.globals.getNode("/controls/hydraulic/switches/rat-man"), yellowEDP: props.globals.getNode("/controls/hydraulic/switches/yellow-edp"), yellowElec: props.globals.getNode("/controls/hydraulic/switches/yellow-elec"), + nwsSwitch: props.globals.getNode("/controls/gear/nws-switch"), }, Valve: { yellowFire: props.globals.getNode("/systems/hydraulic/sources/yellow-edp/fire-valve"), @@ -85,97 +85,91 @@ var HYD = { me.Fail.yellowElec.setBoolValue(0); me.Fail.yellowLeak.setBoolValue(0); }, - loop: func() { - if (props.globals.getValue("/controls/gear/nws-switch") == 1) { - me.Brakes.askidSw.setBoolValue(1); #true - } else { - me.Brakes.askidSw.setBoolValue(0); #false - } - + loop: func(notification) { # Decrease accumPressPsi when green and yellow hydraulic's aren't pressurized - if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { + if (me.Brakes.leftbrake.getValue() > 0 or notification.brakesMode == 0) { lcont = lcont + 1; } else { lcont = 0; } - if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { + if (me.Brakes.rightbrake.getValue() > 0 or notification.brakesMode == 0) { rcont = rcont + 1; } else { rcont = 0; } - if (me.Psi.yellow.getValue() < me.Brakes.accumPressPsi.getValue() and me.Brakes.accumPressPsi.getValue() > 0) { + if (notification.yellow < notification.accumPressPsi and notification.accumPressPsi > 0) { if (lcont == 1) { - me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); + me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200); } if (rcont == 1) { - me.Brakes.accumPressPsi.setValue(me.Brakes.accumPressPsi.getValue() - 200); + me.Brakes.accumPressPsi.setValue(notification.accumPressPsi - 200); } - if (me.Brakes.accumPressPsi.getValue() < 0) { + if (notification.accumPressPsi < 0) { me.Brakes.accumPressPsi.setValue(0); } } # Braking Pressure - if (me.Brakes.mode.getValue() == 1 or (me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() >= 2500)) { + if (notification.brakesMode == 1 or (notification.brakesMode == 2 and notification.green >= 2500)) { # Normal braking - Green OK - if (me.Brakes.leftbrake.getValue() > 0) { - me.Brakes.leftPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + if (notification.leftBrake > 0) { + me.Brakes.leftPressPsi.setValue(notification.green * notification.leftBrakeFCS); } else { me.Brakes.leftPressPsi.setValue(0); } - if (me.Brakes.rightbrake.getValue() > 0) { - me.Brakes.rightPressPsi.setValue(me.Psi.green.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + if (notification.rightBrake > 0) { + me.Brakes.rightPressPsi.setValue(notification.green * notification.rightBrakeFCS); } else { me.Brakes.rightPressPsi.setValue(0); } } else { - if ((me.Brakes.mode.getValue() == 2 and me.Psi.green.getValue() < 2500) or me.Brakes.mode.getValue() == 0) { + if ((notification.brakesMode == 2 and notification.green < 2500) or notification.brakesMode == 0) { # Alternate Braking (Yellow OK + Antiskid ON + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { - if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + if (notification.yellow >= 2500 and notification.NWSSwitch and (notification.dc1 >= 24 or notification.dc2 >= 24 or notification.dcEss >= 24)) { + if (notification.leftBrake > 0 or notification.brakesMode == 0) { + me.Brakes.leftPressPsi.setValue(notification.yellow * notification.leftBrakeFCS); } else { me.Brakes.leftPressPsi.setValue(0); } - if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(me.Psi.yellow.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + if (notification.rightBrake > 0 or notification.brakesMode == 0) { + me.Brakes.rightPressPsi.setValue(notification.yellow * notification.rightBrakeFCS); } else { me.Brakes.rightPressPsi.setValue(0); } } else { # Alternate Braking (Yellow OK + Antiskid OFF + electric OK) - missing condition: BSCU OK-KO - if (me.Psi.yellow.getValue() >= 2500 and !me.Brakes.askidSw.getValue() and (systems.ELEC.Bus.dc1.getValue() >= 24 or systems.ELEC.Bus.dc2.getValue() >= 24 or systems.ELEC.Bus.dcEss.getValue() >= 24)) { - if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + if (notification.yellow >= 2500 and !notification.NWSSwitch and (notification.dc1 >= 24 or notification.dc2 >= 24 or notification.dcEss >= 24)) { + if (notification.leftBrake > 0 or notification.brakesMode == 0) { + me.Brakes.leftPressPsi.setValue(1000 * notification.leftBrakeFCS); } else { me.Brakes.leftPressPsi.setValue(0); } - if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + if (notification.rightBrake > 0 or notification.brakesMode == 0) { + me.Brakes.rightPressPsi.setValue(1000 * notification.rightBrakeFCS); } else { me.Brakes.rightPressPsi.setValue(0); } } else { # Alternate Braking (Yellow KO or Antiskid KO or electric KO) - missing condition: BSCU OK-KO - if (me.Brakes.accumPressPsi.getValue() < 1000 and (me.Psi.yellow.getValue() < 2500 or !me.Brakes.askidSw.getValue() or (systems.ELEC.Bus.dc1.getValue() < 24 and systems.ELEC.Bus.dc2.getValue() < 24 and systems.ELEC.Bus.dcEss.getValue() < 24))) { - if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + if (notification.accumPressPsi < 1000 and (notification.yellow < 2500 or !notification.NWSSwitch or (notification.dc1 < 24 and notification.dc2 < 24 and notification.dcEss < 24))) { + if (notification.leftBrake > 0 or notification.brakesMode == 0) { + me.Brakes.leftPressPsi.setValue(notification.accumPressPsi * notification.leftBrakeFCS); } else { me.Brakes.leftPressPsi.setValue(0); } - if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(me.Brakes.accumPressPsi.getValue() * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + if (notification.rightBrake > 0 or notification.brakesMode == 0) { + me.Brakes.rightPressPsi.setValue(notification.accumPressPsi * notification.rightBrakeFCS); } else { me.Brakes.rightPressPsi.setValue(0); } } else { - if (me.Brakes.leftbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.leftPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[0].getValue()); + if (notification.leftBrake > 0 or notification.brakesMode == 0) { + me.Brakes.leftPressPsi.setValue(1000 * notification.leftBrakeFCS); } else { me.Brakes.leftPressPsi.setValue(0); } - if (me.Brakes.rightbrake.getValue() > 0 or me.Brakes.mode.getValue() == 0) { - me.Brakes.rightPressPsi.setValue(1000 * pts.Fdm.JSBsim.Fcs.brake[1].getValue()); + if (notification.rightBrake > 0 or notification.brakesMode == 0) { + me.Brakes.rightPressPsi.setValue(1000 * notification.rightBrakeFCS); } else { me.Brakes.rightPressPsi.setValue(0); } @@ -192,3 +186,25 @@ setlistener("/controls/gear/gear-down", func { pts.Controls.Gear.gearDown.setValue(1); } }); + +# Emesary +var A320Hydraulic = notifications.SystemRecipient.new("A320 Hydraulic",HYD.loop,HYD); +emesary.GlobalTransmitter.Register(A320Hydraulic); + +var input = { + "blue": "/systems/hydraulic/blue-psi", + "green": "/systems/hydraulic/green-psi", + "yellow": "/systems/hydraulic/yellow-psi", + + "brakesMode": "/systems/hydraulic/brakes/mode", + "accumPressPsi": "/systems/hydraulic/yellow-accumulator-psi-cmd", + "leftBrake": "/controls/gear/brake-left", + "rightBrake": "/controls/gear/brake-right", + "leftBrakeFCS": "/fdm/jsbsim/fcs/left-brake-cmd-norm", + "rightBrakeFCS": "/fdm/jsbsim/fcs/right-brake-cmd-norm", + "NWSSwitch": "/controls/gear/nws-switch", +}; + +foreach (var name; keys(input)) { + emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 Hydraulic", name, input[name])); +} \ No newline at end of file diff --git a/Nasal/Systems/pneumatics.nas b/Nasal/Systems/pneumatics.nas index d52864d0..97425c63 100644 --- a/Nasal/Systems/pneumatics.nas +++ b/Nasal/Systems/pneumatics.nas @@ -99,6 +99,8 @@ var PNEU = { hotAir: props.globals.getNode("/systems/air-conditioning/valves/hot-air"), starter1: props.globals.getNode("/systems/pneumatics/valves/starter-valve-1"), starter2: props.globals.getNode("/systems/pneumatics/valves/starter-valve-2"), + wingLeft: props.globals.getNode("/systems/pneumatics/valves/wing-ice-1"), + wingRight: props.globals.getNode("/systems/pneumatics/valves/wing-ice-2"), }, pressMode: props.globals.getNode("/systems/pressurization/mode", 1), init: func() { @@ -159,9 +161,9 @@ var PNEU = { me.Fail.trimValveFwd.setBoolValue(0); me.Fail.xbleed.setBoolValue(0); }, - loop: func() { - wowl = getprop("gear/gear[1]/wow"); - wowr = getprop("gear/gear[2]/wow"); + loop: func(notification) { + wowl = notification.gear1Wow; + wowr = notification.gear2Wow; # Legacy pressurization cabinalt = getprop("/systems/pressurization/cabinalt"); diff --git a/Nasal/emesary/M_frame_notification.nas b/Nasal/emesary/M_frame_notification.nas index 228b79c1..cb44c3e3 100644 --- a/Nasal/emesary/M_frame_notification.nas +++ b/Nasal/emesary/M_frame_notification.nas @@ -100,4 +100,28 @@ var frameNotification = FrameNotification.new(1); # Frame count # 5 = ECAM # 7 = FWC phases -# 10 = ECAM messages \ No newline at end of file +# 10 = ECAM messages + + +var SystemRecipient = +{ + new: func(_ident,loopFunc, instance) + { + var NewSystemRecipient = emesary.Recipient.new(_ident); + NewSystemRecipient.Receive = func(notification) + { + if (notification.NotificationType == "FrameNotification") + { + if (math.mod(notifications.frameNotification.FrameCount,5) == 0) { + call(loopFunc,[notification],instance, nil, var errors = []); + if (size(errors) > 0) { + debug.printerror(errors); + } + } + return emesary.Transmitter.ReceiptStatus_OK; + } + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + return NewSystemRecipient; + }, +}; \ No newline at end of file diff --git a/Nasal/emesary/exec.nas b/Nasal/emesary/exec.nas index af3ad265..eda3c5e9 100644 --- a/Nasal/emesary/exec.nas +++ b/Nasal/emesary/exec.nas @@ -42,13 +42,14 @@ input = { frame_rate: "/sim/frame-rate", elapsedTime: "/sim/time/elapsed-sec", FWCPhase: "/ECAM/warning-phase", - gear0Wow: "/gear/gear[0]/wow", # Just about everything uses these properties at some stage, lets add them here! - elecAC1: "/systems/electrical/bus/ac-1", - elecAC2: "/systems/electrical/bus/ac-2", - elecACEss: "/systems/electrical/bus/ac-ess", - elecACEssShed: "/systems/electrical/bus/ac-ess-shed", + gear0Wow: "/gear/gear[0]/wow", + gear1Wow: "/gear/gear[1]/wow", + gear2Wow: "/gear/gear[2]/wow", + parkingBrake: "/controls/gear/brake-parking", + airspeedV: "/velocities/airspeed-kt", + groundspeed: "/velocities/groundspeed-kt", engine1State: "/engines/engine[0]/state", engine2State: "/engines/engine[1]/state", }; diff --git a/README.md b/README.md index 53eeea83..5710623f 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ It is highly reccomended to purchase a NAVIGRAPH subscription and download their To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml. +## Remote MCDU +If you want to run the MCDU on a phone or tablet for better realism and easier input, put mcdu.html into the FGDATA/Phi folder, run FlightGear with enabled HTTP server (i.e. command line --httpd=8080) and open http://your-flightgear-computer:8080/mcdu.html in the browser on your phone or tablet. + ## Installation If you have issues installing, please check INSTALL.MD! Specifically, make sure you remove -dev from the folder name! diff --git a/Systems/a320-adr.xml b/Systems/a320-adr.xml index 8e6ce63f..2a125dcf 100644 --- a/Systems/a320-adr.xml +++ b/Systems/a320-adr.xml @@ -914,7 +914,7 @@ - + /instrumentation/radar-altimeter[1]/radar-altitude-ft 1 diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index 49cd64b0..111baeab 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -1977,6 +1977,7 @@ /systems/electrical/some-electric-thingie/emer-elec-config eq 1 /systems/electrical/some-electric-thingie/generator-1-pb eq 1 + /controls/electrical/switches/gen-1 eq 1 /controls/electrical/switches/bus-tie eq 0 @@ -1986,6 +1987,7 @@ /systems/electrical/some-electric-thingie/emer-elec-config eq 1 /systems/electrical/some-electric-thingie/generator-2-pb eq 1 + /controls/electrical/switches/gen-2 eq 1 /controls/electrical/switches/bus-tie eq 0 @@ -1995,6 +1997,7 @@ /systems/electrical/some-electric-thingie/emer-elec-config eq 1 /systems/electrical/some-electric-thingie/generator-1-pb eq 1 + /controls/electrical/switches/gen-1 eq 1 @@ -2003,6 +2006,7 @@ /systems/electrical/some-electric-thingie/emer-elec-config eq 1 /systems/electrical/some-electric-thingie/generator-2-pb eq 1 + /controls/electrical/switches/gen-2 eq 1 diff --git a/Systems/a320-engine-fire.xml b/Systems/a320-engine-fire.xml index 9778bf50..e43b8325 100644 --- a/Systems/a320-engine-fire.xml +++ b/Systems/a320-engine-fire.xml @@ -3,13 +3,13 @@ - + /systems/fire/engine1/temperature - /systems/failures/engine-left-fire + /systems/failures/fire/engine-left-fire 0 -5 1 30 @@ -26,13 +26,13 @@ /systems/fire/engine1/temperature - + /systems/fire/engine2/temperature
- /systems/failures/engine-right-fire + /systems/failures/fire/engine-right-fire 0 -5 1 30 @@ -49,13 +49,13 @@ /systems/fire/engine2/temperature - + /systems/fire/apu/temperature
- /systems/failures/apu-fire + /systems/failures/fire/apu-fire 0 -5 1 45 @@ -74,13 +74,13 @@ - + /systems/fire/cargo/fwd/temperature
- /systems/failures/cargo-fwd-fire + /systems/failures/fire/cargo-fwd-fire 0 -5 1 30 @@ -97,13 +97,13 @@ /systems/fire/cargo/fwd/temperature - + /systems/fire/cargo/aft/temperature
- /systems/failures/cargo-aft-fire + /systems/failures/fire/cargo-aft-fire 0 -5 1 45 @@ -119,5 +119,35 @@ /systems/fire/cargo/aft/temperature + + + + + /systems/fire/lavatory/temperature + +
+ /systems/failures/fire/lavatory-fire + + 0 -5 + 1 45 + +
+ simulation/channel-dt +
+
+
+ + 0 + 300 + + /systems/fire/lavatory/temperature +
+ + + + + /systems/fire/lavatory/temperature ge 295 + +
diff --git a/Systems/a320-fuel.xml b/Systems/a320-fuel.xml index 76648294..9267dd76 100644 --- a/Systems/a320-fuel.xml +++ b/Systems/a320-fuel.xml @@ -632,9 +632,9 @@ /systems/fuel/quantity/center-low eq 1 /systems/fuel/feed-center-2 eq 0 - /systems/fuel/feed-left-inner eq 0 /systems/fuel/feed-right-inner eq 1 /systems/fuel/valves/crossfeed-valve eq 1 + /consumables/fuel/tank[1]/level-gal_us le /consumables/fuel/tank[3]/unusable-gal_us /consumables/fuel/tank[3]/level-gal_us gt /consumables/fuel/tank[3]/unusable-gal_us propulsion/tank[5]/contents-lbs lt 9 @@ -648,9 +648,9 @@ /systems/fuel/feed-center-1 eq 0 /systems/fuel/feed-left-inner eq 1 - /systems/fuel/feed-right-inner eq 0 /systems/fuel/valves/crossfeed-valve eq 1 /consumables/fuel/tank[1]/level-gal_us gt /consumables/fuel/tank[1]/unusable-gal_us + /consumables/fuel/tank[3]/level-gal_us le /consumables/fuel/tank[3]/unusable-gal_us propulsion/tank[6]/contents-lbs lt 9 diff --git a/Systems/a320-fwc-phases.xml b/Systems/a320-fwc-phases.xml index 23412c65..0426d80a 100644 --- a/Systems/a320-fwc-phases.xml +++ b/Systems/a320-fwc-phases.xml @@ -229,6 +229,14 @@ + + + + + /ECAM/warning-phase eq 8 + + + diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index e10632dd..fdd7df53 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -4,7 +4,7 @@ - + Timer for the ECAM system @@ -62,6 +62,19 @@ 0.1 + + Timer for the ECAM system + /ECAM/warnings/logic/crossbleed-fault-timer-was-one + 0.1 + 120 + + + + Timer for the ECAM system + /controls/engines/engine[0]/fire-btn + 0.06666666666 + + Timer for the ECAM system /ECAM/warnings/logic/prv-1-not-shut-apu @@ -335,27 +348,6 @@ 1.0 - - Timer for the ECAM system - /ECAM/warnings/logic/gen-1-fault-set - 120 - 0.1818 - - - - Timer for the ECAM system - /ECAM/warnings/logic/gen-2-fault-set - 120 - 0.1818 - - - - Timer for the ECAM system - /ECAM/warnings/logic/apu-gen-fault-set - 120 - 0.2 - - Timer for the ECAM system /ECAM/warnings/logic/apu-gen-fault-reset @@ -364,7 +356,7 @@ - + @@ -474,13 +466,27 @@ + + + + /ECAM/warnings/timer/xbleed-fault-output eq 1 + + + + /ECAM/warnings/timer/xbleed-fault-output eq 1 - /ECAM/warnings/timer/xbleed-fault-output-10 eq 1 - /ECAM/warnings/timer/xbleed-fault-output-15 eq 0 + + /ECAM/warnings/timer/xbleed-fault-output eq 0 + /ECAM/warnings/timer/xbleed-fault-output-10 ne 0 + + + /ECAM/warnings/timer/xbleed-fault-eng-fire eq 0 + /ECAM/warnings/timer/xbleed-fault-eng-fire eq 1 + @@ -1447,8 +1453,8 @@ - /systems/hydraulics/warnings/green-lo-pr eq 0 - /systems/hydraulics/warnings/yellow-lo-pr eq 0 + /systems/hydraulic/warnings/green-lo-pr eq 0 + /systems/hydraulic/warnings/yellow-lo-pr eq 0 @@ -1485,7 +1491,7 @@ - + @@ -1504,6 +1510,13 @@ + + Timer for the ECAM system + /ECAM/warnings/logic/gen-1-fault-set + 120 + 0.1818 + + @@ -1565,6 +1578,13 @@ + + Timer for the ECAM system + /ECAM/warnings/logic/gen-2-fault-set + 120 + 0.1818 + + @@ -1625,6 +1645,13 @@ + + Timer for the ECAM system + /ECAM/warnings/logic/apu-gen-fault-set + 120 + 0.2 + + @@ -1657,30 +1684,505 @@ + + + + /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 1 + /systems/electrical/some-electric-thingie/emer-elec-config eq 1 + /systems/electrical/some-electric-thingie/emer-elec-config-20-sec eq 1 + + + + + /controls/electrical/switches/gen-1 + 0.2 + 120 + + + + /controls/electrical/switches/gen-2 + 0.2 + 120 + + + + + + /ECAM/warning-phase eq 6 + + + + + /ECAM/warnings/logic/elec/gen-off-60-sec + 0.01666666666 + 120 + + + + + + /ECAM/warning-phase ne 6 + /engines/engine[0]/state eq 3 + + + + + /ECAM/warnings/logic/elec/gen-1-off-60-sec-2 + 0.01666666666 + 120 + + + + + + /ECAM/warning-phase ne 6 + /engines/engine[1]/state eq 3 + + + + + /ECAM/warnings/logic/elec/gen-2-off-60-sec-2 + 0.01666666666 + 120 + + + + + + /ECAM/warnings/logic/elec/gen-1-pb eq 0 + /ECAM/warnings/flipflop/gen-1-fault eq 0 + /controls/electrical/switches/idg-1-disc eq 1 + + /ECAM/warnings/logic/elec/gen-off-60-sec-output eq 1 + /ECAM/warnings/logic/elec/gen-1-off-60-sec-2-output eq 1 + + /ECAM/warning-phase eq 6 + /ECAM/warnings/logic/gen-1-2-no-oper eq 1 + + + + + + + + + /ECAM/warnings/logic/elec/gen-2-pb eq 0 + /ECAM/warnings/flipflop/gen-2-fault eq 0 + /controls/electrical/switches/idg-2-disc eq 1 + + /ECAM/warnings/logic/elec/gen-off-60-sec-output eq 1 + /ECAM/warnings/logic/elec/gen-2-off-60-sec-2-output eq 1 + + /ECAM/warning-phase eq 6 + /ECAM/warnings/logic/gen-1-2-no-oper eq 1 + + + + + + + + + /ECAM/warnings/logic/BLUE-EMER-ELEC NE 1 + fcs/slat-pos-rate eq 0 + fcs/slat-pos-deg ge 2 + + + + + + + fcs/flap-pos-rate eq 0 + fcs/flap-pos-deg ge 2 + + + + + + + + /ECAM/warnings/flipflop/gen-1-fault eq 1 + /controls/electrical/switches/idg-1-disc eq 0 + /ECAM/warnings/logic/elec/gen-1-off eq 1 + + + /ECAM/warnings/flipflop/gen-2-fault eq 1 + /controls/electrical/switches/idg-2-disc eq 0 + /ECAM/warnings/logic/elec/gen-2-off eq 1 + + + + + + + + /ECAM/timer/ground-calc eq 0 + /ECAM/dual-failure-enabled eq 0 + + + + /ECAM/warnings/hyd/green-abnorm-lo-pr eq 1 + /systems/electrical/bus/dc-ess lt 25 + + /ECAM/warnings/logic/SFLAPEXT eq 1 + + + + /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 1 + /systems/electrical/bus/dc-ess lt 25 + + /ECAM/warnings/logic/SSLATEXT eq 1 + + + + + hydraulics/aileron-l/pressure-switch-or eq 1 + + /systems/fctl/elac1 eq 0 + /systems/hydraulic/blue-psi lt 1500 + + /ECAM/warnings/logic/BLUE-EMER-ELEC ne 1 + + + hydraulics/aileron-r/pressure-switch-or eq 1 + + /systems/fctl/elac1 eq 0 + /systems/hydraulic/green-psi lt 1500 + + + + + /gear/gear[0]/position-norm eq 0 + /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 0 + + + + + + + + + + /ECAM/timer/ground-calc eq 0 + /ECAM/dual-failure-enabled eq 0 + + + + /ECAM/warnings/hyd/yellow-abnorm-lo-pr eq 1 + /systems/electrical/bus/dc-2 lt 25 + + /ECAM/warnings/logic/SFLAPEXT eq 1 + + + + + /ECAM/warnings/hyd/blue-abnorm-lo-pr ne 1 + /ECAM/warnings/hyd/green-abnorm-lo-pr eq 1 + + /systems/electrical/bus/dc-2 lt 25 + + /ECAM/warnings/logic/SSLATEXT eq 1 + + /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 0 + /systems/electrical/bus/ac-1 ge 110 + + + + + + hydraulics/aileron-l/pressure-switch-or eq 1 + + /systems/fctl/elac2 eq 0 + /systems/hydraulic/green-psi lt 1500 + + /ECAM/warnings/logic/BLUE-EMER-ELEC ne 1 + + + hydraulics/aileron-r/pressure-switch-or eq 1 + + /systems/fctl/elac2 eq 0 + /systems/hydraulic/blue-psi lt 1500 + + + + + + /systems/electrical/bus/ac-1 ge 110 + /ECAM/warnings/hyd/green-abnorm-lo-pr eq 0 + + + /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 1 + + hydraulics/spoiler-l3/final-deg gt 0.01 + hydraulics/spoiler-r3/final-deg gt 0.01 + + + + /ECAM/warnings/hyd/blue-abnorm-lo-pr eq 1 + + + hydraulics/aileron-l/pressure-switch-or eq 1 + + /systems/fctl/elac2 eq 0 + /systems/hydraulic/green-psi lt 1500 + + /ECAM/warnings/logic/BLUE-EMER-ELEC ne 1 + + + hydraulics/aileron-r/pressure-switch-or eq 1 + + /systems/fctl/elac1 eq 0 + /systems/hydraulic/green-psi lt 1500 + + + + + + + + + + + + + + + /ECAM/warnings/logic/dc-2-fuel-consumption-increased eq 1 + /systems/electrical/relay/dc-ess-shed-switch/contact-pos eq 0 + + + + + + + /ECAM/warnings/logic/dc-ess-fuel-consumption-increased eq 1 + /systems/electrical/bus/dc-2 ge 25 + + + + + + + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + /systems/electrical/bus/dc-1 lt 25 + /systems/electrical/bus/dc-2 lt 25 + /systems/electrical/bus/dc-ess lt 25 + + + + + /ECAM/warnings/logic/dc-emer-config + 120 + 5 + + + + + + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + /systems/electrical/bus/dc-1 lt 25 + /systems/electrical/bus/dc-2 lt 25 + /ECAM/warnings/logic/dc-emer-config ne 1 + + + + + /ECAM/warnings/logic/dc-1-2 + 120 + 0.5 + + + + + + /systems/electrical/bus/dc-ess lt 25 + /ECAM/warnings/logic/dc-emer-config ne 1 + + + + + /ECAM/warnings/logic/dc-ess-fault + 120 + 0.5 + + + + + + /systems/electrical/bus/dc-bat lt 25 + /ECAM/warnings/logic/dc-emer-config ne 1 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + /ECAM/warnings/logic/dc-bat-fault + 120 + 5 + + + + + + /systems/electrical/bus/dc-1 lt 25 + /systems/electrical/bus/dc-2 ge 25 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + /ECAM/warnings/logic/dc-1-fault + 120 + 0.5 + + + + + + /systems/electrical/bus/dc-2 lt 25 + /systems/electrical/bus/dc-1 ge 25 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + /ECAM/warnings/logic/dc-2-fault + 120 + 0.5 + + + + + + /systems/electrical/bus/ac-1 lt 110 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + /ECAM/warnings/logic/ac-1-fault + 120 + 5 + + + + + + /systems/electrical/bus/ac-2 lt 110 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + /ECAM/warnings/logic/ac-2-fault + 120 + 5 + + + + + + /systems/electrical/bus/ac-ess lt 110 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + /ECAM/warnings/logic/ac-ess-fault + 120 + 5 + + + + + + /systems/electrical/bus/dc-ess-shed lt 25 + /systems/electrical/bus/dc-ess ge 25 + + /systems/electrical/some-electric-thingie/emer-elec-config-10-sec ne 1 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + + /ECAM/warnings/logic/dc-ess-shed-fault + 120 + 0.5 + + + + + + /systems/electrical/bus/ac-ess-shed lt 110 + /systems/electrical/bus/ac-ess ge 110 + + /systems/electrical/some-electric-thingie/emer-elec-config-10-sec ne 1 + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + + + + + + /ECAM/warnings/logic/ac-ess-shed-fault + 120 + 0.5 + + + + + + /systems/electrical/bus/ac-1 ge 110 + /controls/electrical/switches/ac-ess-feed eq 0 + /systems/electrical/relay/ac-ess-feed-2/output ge 110 + + + + + /ECAM/warnings/logic/ac-ess-bus-altn-feed-input + 120 + 2 + + + + + + /systems/electrical/some-electric-thingie/emer-elec-config ne 1 + /systems/electrical/bus/ac-ess ge 25 + /ECAM/warnings/logic/ac-ess-bus-altn-feed-output eq 1 + + + - + + + + + + /ECAM/warning-phase eq 4 + + - /ECAM/warnings/logic/stall/phase-8-output eq 0 + + /ECAM/warnings/logic/stall/phase-8-output eq 0 + /ECAM/phases/monostable/phase-8 eq 0 + /ECAM/warning-phase eq 7 - /ECAM/warnings/logic/stall/phase-4-output eq 0 + + /ECAM/warnings/logic/stall/phase-4-output eq 0 + /ECAM/warnings/logic/stall/phase-4 eq 0 + /ECAM/warning-phase eq 5 - - - - - /ECAM/warning-phase eq 4 - - @@ -1688,18 +2190,14 @@ /ECAM/warning-phase eq 5 - - - - - /ECAM/warning-phase eq 8 - - - /ECAM/warnings/logic/stall/phase-5-output eq 0 + + /ECAM/warnings/logic/stall/phase-5-output eq 0 + /ECAM/warnings/logic/stall/phase-5 eq 0 + /ECAM/warning-phase eq 6 @@ -1707,9 +2205,9 @@ - /instrumentation/radar-altimeter[0]/radar-altitude-ft lt 1500 - /instrumentation/radar-altimeter[1]/radar-altitude-ft lt 1500 - /it-fbw/law ne 0 + /instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected lt 1500 + /instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected lt 1500 + /it-fbw/law eq 0 /ECAM/warnings/logic/stall/phase-flipflop eq 1 @@ -1719,27 +2217,73 @@ + /it-fbw/law eq 0 /fdm/jsbsim/fcs/slat-pos-deg lt 15 - /systems/navigation/adr/output/aoa-1 ge 15 - /systems/navigation/adr/output/aoa-2 ge 15 - /systems/navigation/adr/output/aoa-3 ge 15 + + /systems/navigation/adr/output/aoa-1 ge 13.5 + /systems/navigation/adr/operating-1 eq 1 + + + /systems/navigation/adr/output/aoa-2 ge 13.5 + /systems/navigation/adr/operating-2 eq 1 + + + /systems/navigation/adr/output/aoa-3 ge 13.5 + /systems/navigation/adr/operating-3 eq 1 + + /it-fbw/law eq 0 /fdm/jsbsim/fcs/slat-pos-deg ge 15 - - /systems/navigation/adr/output/aoa-1 ge 23 - /systems/navigation/adr/output/aoa-2 ge 23 - /systems/navigation/adr/output/aoa-3 ge 23 + + /systems/navigation/adr/output/aoa-1 ge 22 + /systems/navigation/adr/operating-1 eq 1 + + + /systems/navigation/adr/output/aoa-2 ge 22 + /systems/navigation/adr/operating-2 eq 1 + + + /systems/navigation/adr/output/aoa-3 ge 22 + /systems/navigation/adr/operating-3 eq 1 + + + + /it-fbw/law ne 0 + /fdm/jsbsim/fcs/slat-pos-deg lt 15 + + + /systems/navigation/adr/output/aoa-1 ge 8 + /systems/navigation/adr/operating-1 eq 1 + + + /systems/navigation/adr/output/aoa-2 ge 8 + /systems/navigation/adr/operating-2 eq 1 + + + /systems/navigation/adr/output/aoa-3 ge 8 + /systems/navigation/adr/operating-3 eq 1 + + + + + /it-fbw/law ne 0 + /fdm/jsbsim/fcs/slat-pos-deg ge 15 + + /systems/navigation/adr/output/aoa-1 ge 14 + /systems/navigation/adr/operating-1 eq 1 + + + /systems/navigation/adr/output/aoa-2 ge 14 + /systems/navigation/adr/operating-2 eq 1 + + + /systems/navigation/adr/output/aoa-3 ge 14 + /systems/navigation/adr/operating-3 eq 1 - - /it-fbw/law ne 0 - - /systems/navigation/adr/operating-1 eq 1 - /systems/navigation/adr/operating-2 eq 1 - /systems/navigation/adr/operating-3 eq 1 @@ -1759,7 +2303,7 @@ - + @@ -1778,11 +2322,18 @@ - /ECAM/timer/ground-calc eq 0 - /ECAM/warning-phase eq 6 - /ECAM/warning-phase eq 7 + /ECAM/timer/ground-calc eq 1 /ECAM/warnings/logic/eng/ground-spoilers-output eq 1 - /ECAM/phases/monostable/phase-8-output eq 1 + + + /ECAM/warning-phase eq 6 + /ECAM/warning-phase eq 7 + + + /ECAM/phases/monostable/phase-8 eq 0 + /ECAM/phases/monostable/phase-8-output eq 0 + + @@ -1897,12 +2448,15 @@ /ECAM/warnings/logic/eng/eng-1-tla-abv-6-output eq 1 /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 - - /ECAM/warnings/logic/eng/eng-2-reverse-output eq 1 - - /ECAM/warnings/logic/eng/eng-2-reverse eq 1 - /ECAM/warnings/logic/eng/eng-1-retard-case-2-fall-output eq 0 + + /engines/engine[1]/state eq 3 + + + /ECAM/warnings/logic/eng/eng-2-reverse eq 1 + /ECAM/warnings/logic/eng/eng-1-retard-case-2 eq 0 + /ECAM/warnings/logic/eng/eng-1-retard-case-2-fall-output eq 0 + + /ECAM/warnings/logic/eng/eng-2-reverse-output eq 1 @@ -1913,12 +2467,15 @@ /ECAM/warnings/logic/eng/eng-1-tla-abv-6-2-output eq 1 /engines/engine[0]/state eq 3 - /engines/engine[1]/state eq 3 - - /ECAM/warnings/logic/eng/eng-2-tla-idle-output eq 1 - - /ECAM/warnings/logic/eng/eng-2-reverse-fall eq 0 - /ECAM/warnings/logic/eng/eng-2-tla-idle eq 1 + + /engines/engine[1]/state eq 3 + + /ECAM/warnings/logic/eng/eng-2-tla-idle-output eq 1 + + /ECAM/warnings/logic/eng/eng-2-reverse-fall eq 0 + /ECAM/warnings/logic/eng/eng-2-reverse eq 0 + /ECAM/warnings/logic/eng/eng-2-tla-idle eq 1 + @@ -1927,14 +2484,17 @@ - /ECAM/warnings/logic/eng/eng-2-tla-abv-6-2-output eq 1 - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/eng-2-tla-abv-6-output eq 1 /engines/engine[1]/state eq 3 - - /ECAM/warnings/logic/eng/eng-1-reverse-output eq 1 - - /ECAM/warnings/logic/eng/eng-1-reverse eq 1 - /ECAM/warnings/logic/eng/eng-2-retard-case-2-fall-output eq 0 + + /engines/engine[0]/state eq 3 + + + /ECAM/warnings/logic/eng/eng-1-reverse eq 1 + /ECAM/warnings/logic/eng/eng-2-retard-case-2 eq 0 + /ECAM/warnings/logic/eng/eng-2-retard-case-2-fall-output eq 0 + + /ECAM/warnings/logic/eng/eng-1-reverse-output eq 1 @@ -1943,14 +2503,17 @@ - /ECAM/warnings/logic/eng/eng-2-tla-abv-6-output eq 1 - /engines/engine[0]/state eq 3 + /ECAM/warnings/logic/eng/eng-2-tla-abv-6-2-output eq 1 /engines/engine[1]/state eq 3 - - /ECAM/warnings/logic/eng/eng-1-tla-idle-output eq 1 - - /ECAM/warnings/logic/eng/eng-1-reverse-fall eq 0 - /ECAM/warnings/logic/eng/eng-1-tla-idle eq 1 + + /engines/engine[0]/state eq 3 + + /ECAM/warnings/logic/eng/eng-1-tla-idle-output eq 1 + + /ECAM/warnings/logic/eng/eng-1-reverse-fall eq 0 + /ECAM/warnings/logic/eng/eng-1-reverse eq 0 + /ECAM/warnings/logic/eng/eng-1-tla-idle eq 1 + @@ -2002,9 +2565,298 @@ + + + + /ECAM/warnings/logic/eng/eng-1-thr-lvr-abv-idle eq 1 + /ECAM/warnings/logic/eng/eng-2-thr-lvr-abv-idle eq 1 + + + + + + + /engines/engine[0]/n2-actual ge 59.4 + /controls/engines/engine[0]/throttle-pos ge 0.60 + /controls/engines/engine[0]/throttle-pos lt 0.78 + + + + + /ECAM/warnings/logic/eng/thr-lever-1-mcl-mct + 120 + 0.25 + + + + + + /engines/engine[0]/n2-actual ge 59.4 + /controls/engines/engine[0]/throttle-pos ge 0.60 + /controls/engines/engine[0]/throttle-pos lt 0.83 + + + + + /ECAM/warnings/logic/eng/thr-lever-1-mct + 120 + 0.25 + + + + + + /engines/engine[1]/n2-actual ge 59.4 + /controls/engines/engine[1]/throttle-pos ge 0.60 + /controls/engines/engine[1]/throttle-pos lt 0.78 + + + + + /ECAM/warnings/logic/eng/thr-lever-2-mcl-mct + 120 + 0.25 + + + + + + /engines/engine[1]/n2-actual ge 59.4 + /controls/engines/engine[1]/throttle-pos ge 0.60 + /controls/engines/engine[1]/throttle-pos lt 0.83 + + + + + /ECAM/warnings/logic/eng/thr-lever-2-mct + 120 + 0.25 + + + + + + /ECAM/warnings/logic/eng/new-retard-logic ne 1 + + + /systems/thrust/lim-flex eq 0 + + /ECAM/warnings/logic/eng/thr-lever-2-mct-output eq 1 + /ECAM/warnings/logic/eng/thr-lever-2-mcl-mct-output eq 1 + + + + /systems/thrust/lim-flex eq 1 + /ECAM/warnings/logic/eng/thr-lever-2-mcl-mct-output eq 1 + + + /systems/thrust/lim-flex eq 0 + + /ECAM/warnings/logic/eng/thr-lever-1-mct-output eq 1 + /ECAM/warnings/logic/eng/thr-lever-1-mcl-mct-output eq 1 + + + + /systems/thrust/lim-flex eq 1 + /ECAM/warnings/logic/eng/thr-lever-1-mcl-mct-output eq 1 + + + + + + + + + /ECAM/timer/ground-calc eq 0 + + /gear/gear[1]/rollspeed-ms lt 36 + /ECAM/warning-phase ne 7 + + + /controls/engines/engine[0]/throttle-rev gt 0.0 + /controls/engines/engine[1]/throttle-rev gt 0.0 + + + + + + + + /engines/engine[0]/n2-actual ge 59.4 + + + + + /ECAM/warnings/logic/eng/eng-1-fail-cond-set-input + 120 + 0.3333 + + + + + + /controls/engines/engine[0]/cutoff-switch eq 1 + /controls/engines/engine[0]/fire-btn eq 1 + + + + + + + /engines/engine[1]/n2-actual ge 59.4 + + + + + /ECAM/warnings/logic/eng/eng-2-fail-cond-set-input + 120 + 0.3333 + + + + + + /controls/engines/engine[1]/cutoff-switch eq 1 + /controls/engines/engine[1]/fire-btn eq 1 + + + + + + + /controls/engines/engine[0]/cutoff-switch eq 0 + /controls/engines/engine[0]/fire-btn eq 0 + /engines/engine[0]/n2-actual lt 59.4 + /ECAM/warnings/logic/eng/eng-1-fail-cond eq 1 + + + + + + + /controls/engines/engine[1]/cutoff-switch eq 0 + /controls/engines/engine[1]/fire-btn eq 0 + /engines/engine[1]/n2-actual lt 59.4 + /ECAM/warnings/logic/eng/eng-2-fail-cond eq 1 + + + + + + + /engines/engine[0]/n2-actual ge 59.4 + /ECAM/dual-failure-enabled eq 1 + + + + + + + /engines/engine[1]/n2-actual ge 59.4 + /ECAM/dual-failure-enabled eq 1 + + + + + /controls/engines/engine[0]/cutoff-switch + 120 + 0.01666666666 + + + + /controls/engines/engine[1]/cutoff-switch + 120 + 0.01666666666 + + + + + + + /ECAM/warnings/logic/stall/phase-4-output eq 0 + /ECAM/warnings/logic/stall/phase-4 eq 0 + /ECAM/warning-phase eq 5 + + + + + + + + + /ECAM/warnings/logic/eng/phase-5-output eq 1 + /ECAM/warnings/logic/eng/phase-5-output-2 eq 1 + /ECAM/warnings/logic/eng/eng-1-master-60-sec eq 0 + + /ECAM/warnings/logic/eng/eng-1-fail-output eq 1 + + + + + + + + /ECAM/warnings/logic/eng/phase-5-output eq 1 + /ECAM/warnings/logic/eng/phase-5-output-2 eq 1 + /ECAM/warnings/logic/eng/eng-2-master-60-sec eq 0 + + /ECAM/warnings/logic/eng/eng-2-fail-output eq 1 + + + + + + + /ECAM/warning-phase eq 1 + /ECAM/warning-phase eq 2 + /ECAM/warning-phase eq 9 + /ECAM/warning-phase eq 10 + + + + + + + /ECAM/dual-failure-enabled eq 0 + + + + /ECAM/warnings/logic/eng/eng-shutdown-phase eq 1 + /ECAM/timer/ground-calc eq 0 + + /controls/engines/engine[0]/fire-btn eq 1 + + + /ECAM/warnings/logic/eng/eng-shutdown-phase eq 0 + /controls/engines/engine[0]/cutoff-switch eq 1 + + + + + + + + + /ECAM/dual-failure-enabled eq 0 + + + + /ECAM/warnings/logic/eng/eng-shutdown-phase eq 1 + /ECAM/timer/ground-calc eq 0 + + /controls/engines/engine[1]/fire-btn eq 1 + + + /ECAM/warnings/logic/eng/eng-shutdown-phase eq 0 + /controls/engines/engine[1]/cutoff-switch eq 1 + + + + + - + @@ -2024,7 +2876,7 @@ - + @@ -2163,8 +3015,8 @@ - /instrumentation/radar-altimeter[0]/radar-altitude-ft lt 750 - /instrumentation/radar-altimeter[1]/radar-altitude-ft lt 750 + /instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected lt 750 + /instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected lt 750 /ECAM/phases/phase-calculation/takeoff-power eq 0 @@ -2199,8 +3051,8 @@ - /instrumentation/radar-altimeter[0]/radar-altitude-ft lt 750 - /instrumentation/radar-altimeter[1]/radar-altitude-ft lt 750 + /instrumentation/radar-altimeter[0]/radar-altitude-ft-corrected lt 750 + /instrumentation/radar-altimeter[1]/radar-altitude-ft-corrected lt 750 /ECAM/phases/phase-calculation/takeoff-power eq 0 @@ -2227,11 +3079,7 @@ /ECAM/warnings/fctl/gear-lever-down-pulse eq 1 /ECAM/warnings/fctl/gear-lever-down eq 1 - - /gear/gear[0]/position-norm ne 1 - /gear/gear[1]/position-norm ne 1 - /gear/gear[2]/position-norm ne 1 - + /ECAM/warnings/fctl/gear-not-down-locked eq 1 @@ -2275,9 +3123,251 @@ /gear/gear[2]/position-norm eq 1 + + + + + /ECAM/warning-phase eq 6 + /controls/flight/flaps-input ne 0 + + /systems/navigation/adr/computation/baro-alt-corrected-1-capt ge 22000 + /systems/navigation/adr/computation/baro-alt-corrected-2-capt ge 22000 + /systems/navigation/adr/computation/baro-alt-corrected-3-capt ge 22000 + + + + + + + + fcs/flap-pos-deg lt 2 + fcs/flap-pos-deg ge 24 + + + + + + + + /ECAM/warning-phase eq 3 + /ECAM/warning-phase eq 4 + + /ECAM/warnings/fctl/flaps-config-range eq 1 + + + + + + + /ECAM/warning-phase eq 5 + /ECAM/warnings/fctl/flaps-config-range ne 1 + + + + + + + fcs/slat-pos-deg lt 17 + fcs/slat-pos-deg ge 25 + + + + + + + + /ECAM/warning-phase eq 3 + /ECAM/warning-phase eq 4 + + /ECAM/warnings/fctl/slats-config-range eq 1 + + + + + + + /ECAM/warning-phase eq 5 + /ECAM/warnings/fctl/slats-config-range ne 1 + + + + + + + /controls/flight/speedbrake gt 0.0 + + + + + + + + /ECAM/warning-phase eq 3 + /ECAM/warning-phase eq 4 + + /ECAM/warnings/fctl/spd-brk-config-range eq 1 + + + + + + + /ECAM/warning-phase eq 5 + /ECAM/warnings/fctl/spd-brk-config-range ne 1 + + + + + + + hydraulics/elevator-trim/final-deg gt 2.9 + hydraulics/elevator-trim/final-deg lt -2.9 + + + + + + + + /ECAM/warning-phase eq 3 + /ECAM/warning-phase eq 4 + + /ECAM/warnings/fctl/pitch-trim-config-range eq 1 + + + + + + + /ECAM/warning-phase eq 5 + /ECAM/warnings/fctl/pitch-trim-config-range ne 1 + + + + + + + hydraulics/rudder/trim-deg gt 3.6 + hydraulics/rudder/trim-deg lt -3.6 + + + + + + + + /ECAM/warning-phase eq 3 + /ECAM/warning-phase eq 4 + + /ECAM/warnings/fctl/rudder-trim-config-range eq 1 + + + + + + + /ECAM/warning-phase eq 5 + /ECAM/warnings/fctl/rudder-trim-config-range ne 1 + + + + + + + /ECAM/warning-phase eq 3 + /controls/gear/brake-parking eq 1 + + + + + + + /ECAM/warning-phase eq 5 + /controls/gear/brake-parking eq 0 + + + + + + + /controls/flight/speedbrake gt 0.0 + + + + + /ECAM/warnings/fctl/spd-brk-still-out-50-seconds-input + 120 + 0.02 + + + + + + /ECAM/warnings/fctl/spd-brk-still-out-50-seconds eq 1 + /engines/both-at-idle eq 1 + + + + + /ECAM/warnings/fctl/spd-brk-still-out-10-seconds-input + 120 + 0.1 + + + + + + /ECAM/warning-phase eq 6 + /ECAM/warnings/fctl/spd-brk-still-out-50-seconds eq 1 + /ECAM/warnings/fctl/spd-brk-still-out-10-seconds eq 0 + + + + + /ECAM/warnings/fctl/spd-brk-still-out-1-input + 120 + 0.03333333333 + + + + + + /ECAM/warning-phase eq 7 + /controls/flight/speedbrake gt 0.0 + + + + + /ECAM/warnings/fctl/spd-brk-still-out-2-input + 120 + 0.2 + + + + + + + + + + + /ECAM/warnings/fctl/spd-brk-still-out-1 eq 1 + /ECAM/warnings/fctl/spd-brk-still-out-2 eq 1 + + + + - + @@ -2349,7 +3439,7 @@ - /systems/hydraulics/warnings/blue-lo-pr eq 1 + /systems/hydraulic/warnings/blue-lo-pr eq 1 /ECAM/warnings/hyd/engines-2-online eq 1 /ECAM/warnings/hyd/engines-2-off-in-air-output eq 1 @@ -2360,7 +3450,7 @@ - /systems/hydraulics/warnings/green-lo-pr eq 1 + /systems/hydraulic/warnings/green-lo-pr eq 1 /ECAM/warnings/hyd/engine-1-start-output eq 1 @@ -2368,7 +3458,7 @@ - /systems/hydraulics/warnings/yellow-lo-pr eq 1 + /systems/hydraulic/warnings/yellow-lo-pr eq 1 /ECAM/warnings/hyd/engine-2-start-output eq 1 @@ -2418,6 +3508,21 @@ + + + + /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/warnings/hyd/blue-abnorm-lo-pr eq 1 /ECAM/warnings/hyd/green-abnorm-lo-pr eq 1 @@ -2426,6 +3531,21 @@ + + + + /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/warnings/hyd/blue-abnorm-lo-pr eq 1 /ECAM/warnings/hyd/yellow-abnorm-lo-pr eq 1 @@ -2457,16 +3577,21 @@ /engines/engine[0]/state eq 3 /engines/engine[1]/state eq 3 - fcs/flap-pos-deg ne 0 - hydraulics/spoiler-l1/final-deg gt 0 - hydraulics/spoiler-r1/final-deg gt 0 - hydraulics/spoiler-l2/final-deg gt 0 - hydraulics/spoiler-r2/final-deg gt 0 - hydraulics/spoiler-l4/final-deg gt 0 - hydraulics/spoiler-r4/final-deg gt 0 - hydraulics/spoiler-l5/final-deg gt 0 - hydraulics/spoiler-r5/final-deg gt 0 - + + /ECAM/warnings/logic/SFLAPEXT eq 1 + /systems/electrical/bus/dc-ess lt 25 + + hydraulics/spoiler-l2/final-deg gt 0.01 + hydraulics/spoiler-r2/final-deg gt 0.01 + hydraulics/spoiler-l3/final-deg gt 0.01 + hydraulics/spoiler-r3/final-deg gt 0.01 + hydraulics/spoiler-l4/final-deg gt 0.01 + hydraulics/spoiler-r4/final-deg gt 0.01 + + /systems/fctl/elac1 eq 0 + /systems/fctl/elac2 eq 0 + /systems/hydraulic/green-psi lt 1500 + @@ -2477,12 +3602,34 @@ /ECAM/timer/ground-calc eq 0 /engines/engine[0]/state eq 3 /engines/engine[1]/state eq 3 + + + /ECAM/warnings/logic/SFLAPEXT eq 1 + /systems/electrical/bus/dc-ess lt 25 + + hydraulics/spoiler-l1/final-deg gt 0.01 + hydraulics/spoiler-r1/final-deg gt 0.01 + hydraulics/spoiler-l2/final-deg gt 0.01 + hydraulics/spoiler-r2/final-deg gt 0.01 + hydraulics/spoiler-l4/final-deg gt 0.01 + hydraulics/spoiler-r4/final-deg gt 0.01 + hydraulics/spoiler-l5/final-deg gt 0.01 + hydraulics/spoiler-r5/final-deg gt 0.01 + + + /systems/fctl/elac1 eq 0 + /systems/fctl/elac2 eq 0 + /systems/hydraulic/blue-psi lt 1500 + + /ECAM/warnings/logic/BLUE-EMER-ELEC ne 1 + + - + @@ -2666,4 +3813,57 @@ + + + + + + /controls/fuel/switches/pump-center-1 eq 0 + /controls/fuel/switches/pump-center-2 eq 0 + /controls/fuel/switches/center-mode eq 1 + /systems/fuel/quantity/center-low eq 0 + /ECAM/warning-phase eq 6 + + + + + + /ECAM/warnings/fuel/center-pumps-off + 120 + 0.1 + + + + + + /systems/fuel/quantity/left-wing-inner-low eq 1 + /systems/fuel/quantity/right-wing-inner-low eq 1 + + + + + /ECAM/warnings/fuel/lo-level-l-r + 120 + 0.03333333333 + + + + + + diff --git a/Systems/a320-hydraulic.xml b/Systems/a320-hydraulic.xml index 097c3c47..30264be1 100644 --- a/Systems/a320-hydraulic.xml +++ b/Systems/a320-hydraulic.xml @@ -528,12 +528,12 @@ /controls/gear/brake-parking ne 1 - /systems/hydraulic/brakes/askidnwssw eq 1 + /controls/gear/nws-switch eq 1 /systems/hydraulic/green-psi ge 2500 /controls/gear/brake-parking ne 1 - /systems/hydraulic/brakes/askidnwssw eq 1 + /controls/gear/nws-switch eq 1 /systems/hydraulic/yellow-psi ge 2500 @@ -610,34 +610,34 @@ - + /systems/hydraulic/blue-psi lt 1750 - /systems/hydraulics/warnings/blue-lo-pr eq 1 + /systems/hydraulic/warnings/blue-lo-pr eq 1 /systems/hydraulic/blue-psi lt 1450 - + /systems/hydraulic/green-psi lt 1750 - /systems/hydraulics/warnings/green-lo-pr eq 1 + /systems/hydraulic/warnings/green-lo-pr eq 1 /systems/hydraulic/green-psi lt 1450 - + /systems/hydraulic/yellow-psi lt 1750 - /systems/hydraulics/warnings/yellow-lo-pr eq 1 + /systems/hydraulic/warnings/yellow-lo-pr eq 1 /systems/hydraulic/yellow-psi lt 1450 diff --git a/Systems/a320-pneumatic.xml b/Systems/a320-pneumatic.xml index bfe656d7..1ada48d2 100644 --- a/Systems/a320-pneumatic.xml +++ b/Systems/a320-pneumatic.xml @@ -1183,28 +1183,47 @@ 120 - + /systems/pneumatics/valves/crossbleed-valve-cmd eq 1 /systems/pneumatics/valves/crossbleed-valve ne 1 /controls/pneumatics/switches/x-bleed eq 2 + + + + /systems/pneumatics/valves/crossbleed-valve-cmd eq 1 /systems/pneumatics/valves/crossbleed-valve ne 1 /controls/pneumatics/switches/x-bleed eq 1 - /systems/electrical/bus/dc-2 ge 25 - - + + + + + /systems/pneumatics/warnings/crossbleed-disag-open-man eq 1 + + /systems/pneumatics/warnings/crossbleed-disag-open-auto eq 1 + /systems/electrical/bus/dc-2 ge 25 + + + + + /systems/pneumatics/valves/crossbleed-valve-cmd eq 0 /systems/pneumatics/valves/crossbleed-valve ne 0 - + + + + + + /systems/pneumatics/warnings/crossbleed-disag-closed eq 1 /systems/pneumatics/warnings/crossbleed-disag-open eq 1 diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index e89c7dfc..9aca49cd 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -6,24 +6,22 @@ monostable - true - /controls/electrical/switches/gen-1 + /controls/electrical/switches/gen-1 /systems/electrical/some-electric-thingie/generator-1-pb monostable - true - /controls/electrical/switches/gen-2 + /controls/electrical/switches/gen-2 /systems/electrical/some-electric-thingie/generator-2-pb @@ -80,6 +78,29 @@ /systems/electrical/some-electric-thingie/generator-2-reset + + monostable + + + /systems/electrical/some-electric-thingie/emer-elec-config + + /systems/electrical/some-electric-thingie/emer-elec-config-10-sec + + + + monostable + + + /systems/electrical/some-electric-thingie/emer-elec-config + + /systems/electrical/some-electric-thingie/emer-elec-config-20-sec + + + RS @@ -303,7 +324,7 @@ ECAM/warnings/altitude-alert/gear-downlocked-output - + monostable true @@ -311,9 +332,9 @@ 4.5 - ECAM/phases/monostable/phase-8 + /ECAM/phases/monostable/phase-8 - ECAM/phases/monostable/phase-8-output + /ECAM/phases/monostable/phase-8-output @@ -412,30 +433,6 @@ - - monostable - true - - - /ECAM/warnings/timer/xbleed-fault-output - - /ECAM/warnings/timer/xbleed-fault-output-10 - - - - monostable - true - - - /controls/engines/engine[0]/fire-btn - - /ECAM/warnings/timer/xbleed-fault-output-15 - - SR @@ -926,7 +923,7 @@ 1.0 - /ECAM/warnings/logic/stall/phase-8 + /ECAM/phases/monostable/phase-8 /ECAM/warnings/logic/stall/phase-8-output @@ -1029,4 +1026,139 @@ /ECAM/phases/phase-calculation/altitude-ge-800 + + + SR + + /ECAM/warnings/fctl/flaps-config-set + + + /ECAM/warnings/fctl/flaps-config-reset + + /ECAM/warnings/fctl/flaps-config-output + + + + SR + + /ECAM/warnings/fctl/slats-config-set + + + /ECAM/warnings/fctl/slats-config-reset + + /ECAM/warnings/fctl/slats-config-output + + + + SR + + /ECAM/warnings/fctl/spd-brk-config-set + + + /ECAM/warnings/fctl/spd-brk-config-reset + + /ECAM/warnings/fctl/spd-brk-config-output + + + + SR + + /ECAM/warnings/fctl/pitch-trim-config-set + + + /ECAM/warnings/fctl/pitch-trim-config-reset + + /ECAM/warnings/fctl/pitch-trim-config-output + + + + SR + + /ECAM/warnings/fctl/rudder-trim-config-set + + + /ECAM/warnings/fctl/rudder-trim-config-reset + + /ECAM/warnings/fctl/rudder-trim-config-output + + + + SR + + /ECAM/warnings/fctl/park-brk-config-set + + + /ECAM/warnings/fctl/park-brk-config-reset + + /ECAM/warnings/fctl/park-brk-config-output + + + + RS + + /ECAM/warnings/logic/eng/eng-1-fail-cond-set + + + /ECAM/warnings/logic/eng/eng-1-fail-cond-reset + + /ECAM/warnings/logic/eng/eng-1-fail-cond + + + + RS + + /ECAM/warnings/logic/eng/eng-2-fail-cond-set + + + /ECAM/warnings/logic/eng/eng-2-fail-cond-reset + + /ECAM/warnings/logic/eng/eng-2-fail-cond + + + + RS + + /ECAM/warnings/logic/eng/eng-1-fail-set + + + /ECAM/warnings/logic/eng/eng-1-fail-reset + + /ECAM/warnings/logic/eng/eng-1-fail-output + + + + RS + + /ECAM/warnings/logic/eng/eng-2-fail-set + + + /ECAM/warnings/logic/eng/eng-2-fail-reset + + /ECAM/warnings/logic/eng/eng-2-fail-output + + + + monostable + true + + + /ECAM/warnings/logic/eng/phase-5 + + /ECAM/warnings/logic/eng/phase-5-output + + + + + monostable + true + + + /ECAM/warnings/logic/eng/phase-5-output + + /ECAM/warnings/logic/eng/phase-5-output-2 + diff --git a/Systems/fadec-cfm.xml b/Systems/fadec-cfm.xml index 40447f9a..82fdbec5 100644 --- a/Systems/fadec-cfm.xml +++ b/Systems/fadec-cfm.xml @@ -10,7 +10,7 @@ OAT Thrust Scale gain 1.0 - 0.05 + 0.05 @@ -28,7 +28,7 @@ FLX Thrust Scalegain1.0 - 0.05 + 0.05
@@ -46,7 +46,7 @@ IDLE Limitgain1.0 - 0.05 + 0.05 @@ -80,12 +80,45 @@ 0 /controls/engines/idle-limit - + + + Engines At Idle Stage 1 + gain + 1.0 + + + +
+ + /engines/engine[0]/n1-actual + /engines/engine[1]/n1-actual + + 18.90 + 103.81 +
+ 0.005 + +
+ + /engines/highest-n1-buffer + + + + Engines At Idle Stage 2 + + + /engines/highest-n1-buffer + /controls/engines/idle-limit + + + /engines/both-at-idle + + MAN One gain 1.0 - 0.05 + 0.05 @@ -107,7 +140,7 @@ MAN Twogain1.0 - 0.05 + 0.05
@@ -129,7 +162,7 @@ MAN CMD Onegain1.0 - 0.05 + 0.05 @@ -154,7 +187,7 @@ MAN CMD Two gain 1.0 - 0.05 + 0.05 @@ -179,7 +212,7 @@ N1 CMD 1 gain 1.0 - 0.05 + 0.05 @@ -220,7 +253,7 @@ N1 CMD 2 gain 1.0 - 0.05 + 0.05 @@ -1057,7 +1090,7 @@ N1 Limit TOGA gain 1.0 - 0.05 + 0.05
@@ -1077,7 +1110,7 @@ N1 Limit MCTgain1.0 - 0.05 + 0.05
@@ -1097,7 +1130,7 @@ N1 Limit FLXgain1.0 - 0.05 + 0.05
@@ -1117,7 +1150,7 @@ N1 Limit CLBgain1.0 - 0.05 + 0.05
diff --git a/Systems/fadec-iae.xml b/Systems/fadec-iae.xml index d6275615..52b8c510 100644 --- a/Systems/fadec-iae.xml +++ b/Systems/fadec-iae.xml @@ -10,7 +10,7 @@ OAT Thrust Scalegain1.0 - 0.05 + 0.05
@@ -28,7 +28,7 @@ FLX Thrust Scalegain1.0 - 0.05 + 0.05
@@ -46,7 +46,7 @@ IDLE Limitgain1.0 - 0.05 + 0.05 @@ -80,12 +80,45 @@ 0 /controls/engines/idle-limit - + + + Engines At Idle Stage 1 + gain + 1.0 + + + +
+ + /engines/engine[0]/n1-actual + /engines/engine[1]/n1-actual + + 22.40 + 103.81 +
+ 0.005 + +
+ + /engines/highest-n1-buffer +
+ + + Engines At Idle Stage 2 + + + /engines/highest-n1-buffer + /controls/engines/idle-limit + + + /engines/both-at-idle + + MAN One gain 1.0 - 0.05 + 0.05 @@ -107,7 +140,7 @@ MAN Twogain1.0 - 0.05 + 0.05
@@ -129,7 +162,7 @@ MAN CMD Onegain1.0 - 0.05 + 0.05 @@ -154,7 +187,7 @@ MAN CMD Two gain 1.0 - 0.05 + 0.05 @@ -1345,7 +1378,7 @@ EPR Limit TOGA gain 1.0 - 0.05 + 0.05
@@ -1373,7 +1406,7 @@ EPR CMD TOGAgain1.0 - 0.05 + 0.05 @@ -1389,7 +1422,7 @@ EPR Limit MCT gain 1.0 - 0.05 + 0.05
@@ -1417,7 +1450,7 @@ EPR CMD MCTgain1.0 - 0.05 + 0.05 @@ -1433,7 +1466,7 @@ EPR Limit FLX gain 1.0 - 0.05 + 0.05
@@ -1461,7 +1494,7 @@ EPR CMD FLXgain1.0 - 0.05 + 0.05 @@ -1477,7 +1510,7 @@ EPR Limit CLB gain 1.0 - 0.05 + 0.05
@@ -1505,7 +1538,7 @@ EPR CMD CLBgain1.0 - 0.05 + 0.05 diff --git a/mcdu.html b/mcdu.html new file mode 100644 index 00000000..28e57ea7 --- /dev/null +++ b/mcdu.html @@ -0,0 +1,211 @@ + + + + MCDU + + + + + +
+ + + + + + + + + + + + +
  
11
22
33
44
55
66
  
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ABCDE
FGHIJ
KLMNO
PQRST
UVWXY
Z/SPOVFYCLR
+ + + + + + + + + + + + + +
AIR
PORT
+ + + + + + + + + + + + + + + + + + + + + +
123
456
789
.0-
+ + diff --git a/revision.txt b/revision.txt index abc4eff6..31ff414b 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -46 \ No newline at end of file +48 \ No newline at end of file