From 436f5292ea05c8cd642c507deba10a731f572ea6 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 17 Jan 2022 12:55:37 +0000 Subject: [PATCH 01/13] ND: fix bug --- Models/Instruments/ND/canvas/framework/navdisplay.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 757757cb..931bd27d 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -638,8 +638,8 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } # Hide heading bug 45 secs after change - var vhdg_bug = getprop("/it-autoflight/input/hdg") or 0; - var hdg_bug_active = getprop("/it-autoflight/custom/show-hdg") or 1; + var vhdg_bug = fmgc.Input.hdg.getValue(); + var hdg_bug_active = fmgc.Custom.showHdg.getBoolValue(); 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")) From afa8385fa9ee27872f6de18d931317d10d704276 Mon Sep 17 00:00:00 2001 From: Andrea Vezzali Date: Mon, 17 Jan 2022 15:47:54 +0100 Subject: [PATCH 02/13] MCDU Flightlog and Sensors pages (Bugfix) set FOB output in kgs or lbs according to config option --- Nasal/MCDU/FLIGHTLOG.nas | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index e9da0033..339173c9 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -5,11 +5,7 @@ var OOOIReport = { new: func(state,time=0,fob="") { var report = {parents:[OOOIReport]}; report.state = state; - if (acconfig_weight_kgs.getValue() == 1) { - report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob * LBS2KGS; - } else { - report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; - } + report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob; if (time != 0) { report.time = formatSecToHHMM(time); report.elapsed = time; From 71e07b81ce907ed26fadaa7bba9bc03ff35ce956 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 22 Jan 2022 18:51:27 +0000 Subject: [PATCH 03/13] IESI: fix size of boxes after new font --- Models/Instruments/IESI/res/iesi.svg | 52 +++++++++++++++------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/Models/Instruments/IESI/res/iesi.svg b/Models/Instruments/IESI/res/iesi.svg index 8bdc1875..6f7810b2 100644 --- a/Models/Instruments/IESI/res/iesi.svg +++ b/Models/Instruments/IESI/res/iesi.svg @@ -5,7 +5,7 @@ viewBox="0 0 1024 1024" version="1.1" id="svg2" - inkscape:version="1.1 (c68e22c387, 2021-05-23)" + inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" sodipodi:docname="iesi.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" @@ -38,16 +38,16 @@ inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="986" + inkscape:window-height="974" id="namedview371" showgrid="true" - inkscape:zoom="0.93517029" - inkscape:cx="815.35952" - inkscape:cy="762.42799" + inkscape:zoom="0.66126526" + inkscape:cx="369.74572" + inkscape:cy="772.76099" inkscape:window-x="-11" inkscape:window-y="-11" inkscape:window-maximized="1" - inkscape:current-layer="ATTflag" + inkscape:current-layer="MsgBox" showguides="true" inkscape:snap-global="false" units="pt" @@ -72,11 +72,11 @@ inkscape:label="MsgBox"> + style="fill:#c9d121;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.48539;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + id="ATTflag" + style="display:inline"> + style="fill:#c9d121;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.48538;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> ATT : RST + width="280.59842" + height="91.115768" + x="361.70129" + y="287.18335" /> + inkscape:label="#g4573" + style="display:inline"> Date: Mon, 17 Jan 2022 22:18:46 +0100 Subject: [PATCH 04/13] better control on cockpit door switch --- Models/FlightDeck/a320.flightdeck.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 1b00c24a..3c09c3cc 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -1521,11 +1521,12 @@ - slider + knob CockpitDoorSwitch CockpitDoorSwitch.mark controls/doors/doorc-switch vertical + 14 property-adjust From 871c645fbaa0f689cb3a2f753fc2bc94eed366e1 Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Mon, 17 Jan 2022 22:19:29 +0100 Subject: [PATCH 05/13] Better long pressed CLR and check numeric format on plus/minus --- Models/Instruments/MCDU/MCDU1.xml | 31 ++++++++++++++++++---- Models/Instruments/MCDU/MCDU2.xml | 33 +++++++++++++++++++----- Nasal/MCDU/MCDU.nas | 43 ++++++++++++------------------- 3 files changed, 69 insertions(+), 38 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml index 2133e61a..54116e98 100644 --- a/Models/Instruments/MCDU/MCDU1.xml +++ b/Models/Instruments/MCDU/MCDU1.xml @@ -1678,7 +1678,7 @@ overfly - true + false nasal @@ -1703,11 +1703,23 @@ true + + property-adjust + /MCDU[0]/clrbtn-timeout + 1 + 0 + 6 + false + nasal - + + + /MCDU[0]/clrbtn-timeout + 5 + systems/electrical/bus/ac-1 110 @@ -1718,17 +1730,21 @@ - + nasal - + + + /MCDU[0]/clrbtn-timeout + 5 + systems/electrical/bus/ac-1 110 - + controls/lighting/DU/mcdu1 0.01 @@ -1736,6 +1752,11 @@ + + property-assign + /MCDU[0]/clrbtn-timeout + 0 + diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml index d49c0a8d..6da38c5c 100644 --- a/Models/Instruments/MCDU/MCDU2.xml +++ b/Models/Instruments/MCDU/MCDU2.xml @@ -1678,7 +1678,7 @@ overfly - true + false nasal @@ -1703,32 +1703,48 @@ true + + property-adjust + /MCDU[1]/clrbtn-timeout + 1 + 0 + 6 + false + nasal - + + + /MCDU[1]/clrbtn-timeout + 5 + systems/electrical/bus/ac-2 110 - + controls/lighting/DU/mcdu2 0.01 - + nasal - + + + /MCDU[1]/clrbtn-timeout + 5 + systems/electrical/bus/ac-2 110 - + controls/lighting/DU/mcdu2 0.01 @@ -1736,6 +1752,11 @@ + + property-assign + /MCDU[1]/clrbtn-timeout + 0 + diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 2ecd3c93..160b8831 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -1499,8 +1499,6 @@ var pagebutton = func(btn, i) { } } -var buttonCLRDown = [0,0]; # counter for down event - var button = func(btn, i, event = "") { page = pageNode[i].getValue(); if (page != "MCDU") { @@ -1510,41 +1508,32 @@ var button = func(btn, i, event = "") { } else if (btn == "SP") { mcdu_scratchpad.scratchpads[i].addChar(" "); } else if (btn == "CLR") { - if (event == "down") { - if (size(scratchpad) > 0) { - if (buttonCLRDown[i] > 4) { - mcdu_scratchpad.scratchpads[i].empty(); - } - buttonCLRDown[i] = buttonCLRDown[i] + 1; - } - } - else if (event == "" or buttonCLRDown[i]<=4) { - buttonCLRDown[i] = 0; - #var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless?? - if (size(scratchpad) == 0) { - mcdu_scratchpad.scratchpads[i].addChar("CLR"); - } else { - mcdu_scratchpad.scratchpads[i].clear(); - } - } else { # up with buttonCLRDown[i]>4 - buttonCLRDown[i] = 0; + if (size(scratchpad) == 0) { + mcdu_scratchpad.scratchpads[i].addChar("CLR"); + } else { + mcdu_scratchpad.scratchpads[i].clear(); } } else if (btn == "LONGCLR") { mcdu_scratchpad.scratchpads[i].empty(); } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); } else if (btn == "PLUSMINUS") { - if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") { - mcdu_scratchpad.scratchpads[i].clear(); - mcdu_scratchpad.scratchpads[i].addChar("+"); - } else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") { - mcdu_scratchpad.scratchpads[i].clear(); + if (size(scratchpad)==0) { + mcdu_message(i, "NOT ALLOWED"); + } else if (isint(scratchpad)==1) { mcdu_scratchpad.scratchpads[i].addChar("-"); } else { - mcdu_scratchpad.scratchpads[i].addChar("-"); + var _toggle = right(scratchpad,1); + if (find(_toggle,"-+")!=-1) { + _toggle = (_toggle == "-") ? "+" : "-"; + mcdu_scratchpad.scratchpads[i].clear(); + mcdu_scratchpad.scratchpads[i].addChar(_toggle); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } } else if (btn == "OVFY") { - if (mcdu_scratchpad.scratchpads[i].scratchpad == "") { + if (size(scratchpad)==0) { mcdu_scratchpad.scratchpads[i].addChar("@"); } else { mcdu_message(i, "NOT ALLOWED"); From e7e4ac503f7bb2a7e83f0231226e37f2ca578c94 Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Wed, 19 Jan 2022 22:27:10 +0100 Subject: [PATCH 06/13] Comment to unused KT-.70 --- Systems/instrumentation.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Systems/instrumentation.xml b/Systems/instrumentation.xml index 1941fa4f..a77898e7 100644 --- a/Systems/instrumentation.xml +++ b/Systems/instrumentation.xml @@ -168,10 +168,10 @@ /systems/vacuum/suction-inhg - + magnetic-compass From 016b8670f20a6b89316ba082b7fd9108fe9d2f73 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 24 Jan 2022 20:43:30 +0000 Subject: [PATCH 07/13] Don't comment out - better to remove it entirely --- Systems/instrumentation.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Systems/instrumentation.xml b/Systems/instrumentation.xml index a77898e7..8b55dd87 100644 --- a/Systems/instrumentation.xml +++ b/Systems/instrumentation.xml @@ -168,11 +168,6 @@ /systems/vacuum/suction-inhg - - magnetic-compass 0 From 57c84a2f80ed32ca8681e198738e7aa0e00335d9 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 24 Jan 2022 21:27:52 +0000 Subject: [PATCH 08/13] Move autopilot electrical failure to JSBSim. Add 5 second delay before you can engagge autopilot. Fix FCU in power loss scenario --- Models/FlightDeck/a320.flightdeck.xml | 22 ++++++-- Nasal/FMGC/FMGC-b.nas | 7 +-- Nasal/FMGC/FMGC.nas | 4 ++ Nasal/Systems/electrical.nas | 74 +++++++++------------------ Systems/a320-fmgc.xml | 65 +++++++++++++++++++++++ 5 files changed, 116 insertions(+), 56 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 3c09c3cc..19147edc 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -4706,6 +4706,8 @@ controls/switches/annun-test 1 + + FMGC/FCU-working it-autoflight/input/kts-mach 1 @@ -4731,6 +4733,7 @@ it-autoflight/input/spd-managed 0 + FMGC/FCU-working @@ -4752,6 +4755,7 @@ it-autoflight/input/spd-managed 0 + FMGC/FCU-working @@ -4794,6 +4798,7 @@ controls/switches/annun-test 1 + FMGC/FCU-working it-autoflight/custom/trk-fpa 0 @@ -4812,6 +4817,7 @@ controls/switches/annun-test 1 + FMGC/FCU-working it-autoflight/custom/trk-fpa 1 @@ -4833,6 +4839,7 @@ it-autoflight/custom/show-hdg 1 + FMGC/FCU-working @@ -4879,10 +4886,13 @@ select alt-text - - controls/switches/annun-test - 1 - + + FMGC/FCU-working + + controls/switches/annun-test + 1 + + @@ -4931,6 +4941,7 @@ controls/switches/annun-test 1 + FMGC/FCU-working it-autoflight/custom/trk-fpa 1 @@ -4953,6 +4964,7 @@ it-autoflight/output/vert 1 + FMGC/FCU-working @@ -4970,6 +4982,7 @@ it-autoflight/output/vert 5 + FMGC/FCU-working @@ -4991,6 +5004,7 @@ it-autoflight/output/vert 5 + FMGC/FCU-working diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 4d80baf0..6cf56285 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -46,6 +46,7 @@ var Misc = { }; var Position = { + airborne5Secs: props.globals.getNode("/systems/fmgc/airborne-5-secs"), gearAglFtTemp: 0, gearAglFt: props.globals.getNode("/position/gear-agl-ft", 1), indicatedAltitudeFt: props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1), @@ -442,7 +443,7 @@ var ITAF = { }, ap1Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and FMGCNodes.Power.FMGC1Powered.getBoolValue() and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100 and Position.airborne5Secs.getBoolValue()) { Output.ap1.setBoolValue(1); me.updateFma(); Output.latTemp = Output.lat.getValue(); @@ -464,7 +465,7 @@ var ITAF = { }, ap2Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and FMGCNodes.Power.FMGC2Powered.getBoolValue() and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100 and Position.airborne5Secs.getBoolValue()) { Output.ap2.setBoolValue(1); me.updateFma(); Output.latTemp = Output.lat.getValue(); @@ -495,7 +496,7 @@ var ITAF = { }, athrMaster: func(s) { if (s == 1) { - if (systems.ELEC.Bus.acEss.getValue() >= 110 and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { + if ((FMGCNodes.Power.FMGC1Powered.getBoolValue() or FMGCNodes.Power.FMGC2Powered.getBoolValue()) and !pts.FMGC.CasCompare.casRejectAll.getBoolValue() and fbw.FBW.apOff == 0) { Output.athr.setBoolValue(1); Custom.ThrLock.setValue(0); Custom.Sound.enableAthrOff = 1; diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index d5c42f84..79e539de 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -262,6 +262,10 @@ var FMGCNodes = { ktsToMachFactor: props.globals.getNode("/FMGC/internal/kts-to-mach-factor"), machToKtsFactor: props.globals.getNode("/FMGC/internal/mach-to-kts-factor"), mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"), + Power: { + FMGC1Powered: props.globals.getNode("systems/fmgc/power/power-1-on"), + FMGC2Powered: props.globals.getNode("systems/fmgc/power/power-2-on"), + }, toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"), toState: props.globals.initNode("/FMGC/internal/to-state", 0, "BOOL"), v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"), diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index d3bf6556..7a9b8efe 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -1,15 +1,5 @@ # A3XX Electrical System -# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp) - -# Local vars -var battery1_sw = 0; -var battery2_sw = 0; -var batt1_fail = 0; -var batt2_fail = 0; -var battery1_percent = 0; -var battery2_percent = 0; -var dc1 = 0; -var dc2 = 0; +# Copyright (c) 2021 Jonathan Redpath (legoboyvdlp) # Main class var ELEC = { @@ -202,47 +192,33 @@ var ELEC = { me.Fail.tr1Fault.setBoolValue(0); me.Fail.tr2Fault.setBoolValue(0); }, - _FMGC1: 0, - _FMGC2: 0, - _activeFMGC: nil, - _timer1On: 0, - _timer2On: 0, - loop: func(notification) { - # Autopilot Disconnection routines - 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; - } elsif (me._FMGC1) { - if (notification.dcEssShed < 25) { - fcu.apOff("hard", 1); - if (me._activeFMGC == 1) { - fcu.athrOff("hard"); - } - } - me._timer1On = 0; - } - } - - if (notification.dc2 < 25) { - if (me._FMGC2 and !me._timer2On) { # delay 1 cycle to avoid spurious - me._timer2On = 1; - } elsif (me._FMGC2) { - if (notification.dc2 < 25) { - fcu.apOff("hard", 2); - if (me._activeFMGC == 2) { - fcu.athrOff("hard"); - } - } - me._timer2On = 0; - } - } + loop: func() { + # Empty }, }; +setlistener("/systems/fmgc/power/power-1-on", func(val) { + if (!val.getBoolValue()) { + if (fmgc.Output.ap1.getValue()) { + fcu.apOff("hard", 1); + } + if (fcu.FCUController.activeFMGC.getValue() == 1 and fmgc.Output.athr.getValue()) { + fcu.athrOff("hard"); + } + } +}, 0, 0); + +setlistener("/systems/fmgc/power/power-2-on", func(val) { + if (!val.getBoolValue()) { + if (fmgc.Output.ap2.getValue()) { + fcu.apOff("hard", 2); + } + if (fcu.FCUController.activeFMGC.getValue() == 2 and fmgc.Output.athr.getValue()) { + fcu.athrOff("hard"); + } + } +}, 0, 0); + # Emesary var A320Electrical = notifications.SystemRecipient.new("A320 Electrical",ELEC.loop,ELEC); emesary.GlobalTransmitter.Register(A320Electrical); diff --git a/Systems/a320-fmgc.xml b/Systems/a320-fmgc.xml index cb4bc86a..5f12bbed 100644 --- a/Systems/a320-fmgc.xml +++ b/Systems/a320-fmgc.xml @@ -4,7 +4,72 @@ + + + + + + /systems/electrical/bus/dc-ess-shed ge 25 + + + + + + + /systems/electrical/bus/dc-2 ge 25 + + + + + /systems/fmgc/power/power-1 + 5 + 100 + + + + /systems/fmgc/power/power-2 + 5 + 100 + + + + + + /systems/fmgc/power/power-1-timer ne 0 + + + + + + + /systems/fmgc/power/power-2-timer ne 0 + + + + + + + + + + /gear/gear[1]/wow eq 0 + /gear/gear[2]/wow eq 0 + + + + + /systems/fmgc/airborne + 100 + 0.2 + + + + + + /systems/fmgc/airborne-timer eq 1 + + From 604b1b0ab906aee8611f4837e1a020d92d8156f9 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 25 Jan 2022 09:42:04 +0000 Subject: [PATCH 09/13] Improve V1 / VR / V2 disagree message --- Nasal/FMGC/mcdu-messages.nas | 2 +- Nasal/MCDU/PERFTO.nas | 44 ++++++++++++++++++++++++--------- Systems/a320-fmgc.xml | 48 ++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 13 deletions(-) diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 4446ec8f..65ce950c 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -195,7 +195,7 @@ var MessageController = { typeIIMessages: std.Vector.new([ TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0), - TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0), + TypeIIMessage.new("TO SPEEDS TOO LOW", "amb", 0), TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533 TypeIIMessage.new("GPS PRIMARY"),TypeIIMessage.new("GPS PRIMARY LOST", "amb", 0), ]), diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index 7571aa52..2838c5d5 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -3,20 +3,40 @@ # Copyright (c) 2020 Josh Davidson (Octal450) # Copyright (c) 2020 Matthew Maring (mattmaring) +# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT)) + +var doneMessageDisag = 0; +var perfTOCheckVSpeedsConsistency = func(i) { + if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { + if (!(fmgc.FMGCInternal.v1 <= fmgc.FMGCInternal.vr and fmgc.FMGCInternal.vr <= fmgc.FMGCInternal.v2)) { + if (doneMessageDisag) { + mcdu_scratchpad.messageQueues[i].deleteWithText("V1/VR/V2 DISAGREE"); + } + mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("V1/VR/V2 DISAGREE")); + doneMessageDisag = 1; + } + } +} + # VMCA 109.5 at 0ft # VMCG 106.5 at 0ft all conf -var standard_VMCA = 109.5; # TODO calculate VMCA/VMCG on altitude (ft) of departure airport (read below) -var standard_VMCG = 106.5; +var VMCA = props.globals.getNode("/FMGC/internal/vmca-kt"); +var VMCG = props.globals.getNode("/FMGC/internal/vmcg-kt"); -# TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT)) - -var perfTOCheckVSpeeds = func(i) { - if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { # only when v1/vr/v2 all sets - if (fmgc.FMGCInternal.v1>fmgc.FMGCInternal.vr or fmgc.FMGCInternal.vr > fmgc.FMGCInternal.v2) mcdu_messageTypeII(i,"V1/VR/V2 DISAGREE"); - else if (fmgc.FMGCInternal.v1 + + + + + + + /position/altitude-ft + + -2000 112.0 + 0 110.0 + 2000 108.0 + 4000 107.5 + 6000 105.5 + 8000 103.0 + 9200 101.2 + 10000 100.0 + 12000 96.5 + 14100 93.5 + +
+
+
+ + + + + + /position/altitude-ft + fcs/flap-pos-deg + + 10 15 20 + -2000 111.5 109.5 109.0 + 0 109.5 107.5 107.0 + 2000 107.5 105.5 105.0 + 4000 107.0 105.0 104.5 + 6000 105.0 103.0 103.0 + 8000 103.0 101.0 100.5 + 9200 101.0 99.0 98.5 + 10000 100.0 98.0 97.5 + 12000 96.5 94.5 94.0 + 14100 93.0 91.0 91.0 + +
+
+
+ +
+ From 35fa1ff22415e3c941adde61f47ec8331e294c3d Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 25 Jan 2022 09:42:09 +0000 Subject: [PATCH 10/13] Revert "Better long pressed CLR and check numeric format on plus/minus" This reverts commit 871c645fbaa0f689cb3a2f753fc2bc94eed366e1. --- Models/Instruments/MCDU/MCDU1.xml | 31 ++++------------------ Models/Instruments/MCDU/MCDU2.xml | 33 +++++------------------- Nasal/MCDU/MCDU.nas | 43 +++++++++++++++++++------------ 3 files changed, 38 insertions(+), 69 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU1.xml b/Models/Instruments/MCDU/MCDU1.xml index 54116e98..2133e61a 100644 --- a/Models/Instruments/MCDU/MCDU1.xml +++ b/Models/Instruments/MCDU/MCDU1.xml @@ -1678,7 +1678,7 @@ overfly - false + true nasal @@ -1703,23 +1703,11 @@ true - - property-adjust - /MCDU[0]/clrbtn-timeout - 1 - 0 - 6 - false - nasal - + - - /MCDU[0]/clrbtn-timeout - 5 - systems/electrical/bus/ac-1 110 @@ -1730,21 +1718,17 @@ - + nasal - + - - /MCDU[0]/clrbtn-timeout - 5 - systems/electrical/bus/ac-1 110 - + controls/lighting/DU/mcdu1 0.01 @@ -1752,11 +1736,6 @@ - - property-assign - /MCDU[0]/clrbtn-timeout - 0 - diff --git a/Models/Instruments/MCDU/MCDU2.xml b/Models/Instruments/MCDU/MCDU2.xml index 6da38c5c..d49c0a8d 100644 --- a/Models/Instruments/MCDU/MCDU2.xml +++ b/Models/Instruments/MCDU/MCDU2.xml @@ -1678,7 +1678,7 @@ overfly - false + true nasal @@ -1703,48 +1703,32 @@ true - - property-adjust - /MCDU[1]/clrbtn-timeout - 1 - 0 - 6 - false - nasal - + - - /MCDU[1]/clrbtn-timeout - 5 - systems/electrical/bus/ac-2 110 - + controls/lighting/DU/mcdu2 0.01 - + nasal - + - - /MCDU[1]/clrbtn-timeout - 5 - systems/electrical/bus/ac-2 110 - + controls/lighting/DU/mcdu2 0.01 @@ -1752,11 +1736,6 @@ - - property-assign - /MCDU[1]/clrbtn-timeout - 0 - diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 160b8831..2ecd3c93 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -1499,6 +1499,8 @@ var pagebutton = func(btn, i) { } } +var buttonCLRDown = [0,0]; # counter for down event + var button = func(btn, i, event = "") { page = pageNode[i].getValue(); if (page != "MCDU") { @@ -1508,32 +1510,41 @@ var button = func(btn, i, event = "") { } else if (btn == "SP") { mcdu_scratchpad.scratchpads[i].addChar(" "); } else if (btn == "CLR") { - if (size(scratchpad) == 0) { - mcdu_scratchpad.scratchpads[i].addChar("CLR"); - } else { - mcdu_scratchpad.scratchpads[i].clear(); + if (event == "down") { + if (size(scratchpad) > 0) { + if (buttonCLRDown[i] > 4) { + mcdu_scratchpad.scratchpads[i].empty(); + } + buttonCLRDown[i] = buttonCLRDown[i] + 1; + } + } + else if (event == "" or buttonCLRDown[i]<=4) { + buttonCLRDown[i] = 0; + #var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; <- useless?? + if (size(scratchpad) == 0) { + mcdu_scratchpad.scratchpads[i].addChar("CLR"); + } else { + mcdu_scratchpad.scratchpads[i].clear(); + } + } else { # up with buttonCLRDown[i]>4 + buttonCLRDown[i] = 0; } } else if (btn == "LONGCLR") { mcdu_scratchpad.scratchpads[i].empty(); } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); } else if (btn == "PLUSMINUS") { - if (size(scratchpad)==0) { - mcdu_message(i, "NOT ALLOWED"); - } else if (isint(scratchpad)==1) { + if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") { + mcdu_scratchpad.scratchpads[i].clear(); + mcdu_scratchpad.scratchpads[i].addChar("+"); + } else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") { + mcdu_scratchpad.scratchpads[i].clear(); mcdu_scratchpad.scratchpads[i].addChar("-"); } else { - var _toggle = right(scratchpad,1); - if (find(_toggle,"-+")!=-1) { - _toggle = (_toggle == "-") ? "+" : "-"; - mcdu_scratchpad.scratchpads[i].clear(); - mcdu_scratchpad.scratchpads[i].addChar(_toggle); - } else { - mcdu_message(i, "NOT ALLOWED"); - } + mcdu_scratchpad.scratchpads[i].addChar("-"); } } else if (btn == "OVFY") { - if (size(scratchpad)==0) { + if (mcdu_scratchpad.scratchpads[i].scratchpad == "") { mcdu_scratchpad.scratchpads[i].addChar("@"); } else { mcdu_message(i, "NOT ALLOWED"); From 7201e89498841cd7ee7f786d0ed84e723c4d58bc Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 25 Jan 2022 09:51:59 +0000 Subject: [PATCH 11/13] OVFY and PLUSMINUS --- Nasal/MCDU/MCDU.nas | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 2ecd3c93..8c29aa38 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -1534,17 +1534,16 @@ var button = func(btn, i, event = "") { } else if (btn == "DOT") { mcdu_scratchpad.scratchpads[i].addChar("."); } else if (btn == "PLUSMINUS") { - if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "-") { + var _toggle = right(scratchpad,1); + if (_toggle == "+" or _toggle == "-") { + _toggle = (_toggle == "-") ? "+" : "-"; mcdu_scratchpad.scratchpads[i].clear(); - mcdu_scratchpad.scratchpads[i].addChar("+"); - } else if (right(mcdu_scratchpad.scratchpads[i].scratchpad, 1) == "+") { - mcdu_scratchpad.scratchpads[i].clear(); - mcdu_scratchpad.scratchpads[i].addChar("-"); + mcdu_scratchpad.scratchpads[i].addChar(_toggle); } else { mcdu_scratchpad.scratchpads[i].addChar("-"); } } else if (btn == "OVFY") { - if (mcdu_scratchpad.scratchpads[i].scratchpad == "") { + if (size(scratchpad) == 0) { mcdu_scratchpad.scratchpads[i].addChar("@"); } else { mcdu_message(i, "NOT ALLOWED"); From 772d920c30b8fff9be1eaa8b0d6ddf5ba0406f57 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 25 Jan 2022 12:30:35 +0000 Subject: [PATCH 12/13] Add some extra error checking on PERFTO --- Models/Instruments/MCDU/MCDU.nas | 11 +-- Nasal/FMGC/FMGC.nas | 3 + Nasal/FMGC/mcdu-messages.nas | 2 +- Nasal/MCDU/DEPARTURE.nas | 13 ++++ Nasal/MCDU/FUELPRED.nas | 3 + Nasal/MCDU/INITB.nas | 3 + Nasal/MCDU/MCDU.nas | 6 +- Nasal/MCDU/PERFTO.nas | 123 +++++++++++++++++++++---------- 8 files changed, 116 insertions(+), 48 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 14e88beb..a3b3b86e 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -101,9 +101,6 @@ var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altit var clbReducFt = props.globals.getNode("/systems/thrust/clbreduc-ft", 1); var reducFt = props.globals.getNode("/FMGC/internal/accel-agl-ft", 1); # It's not AGL anymore var thrAccSet = props.globals.getNode("/MCDUC/thracc-set", 1); -var flapTO = props.globals.getNode("/FMGC/internal/to-flap", 1); -var THSTO = props.globals.getNode("/FMGC/internal/to-ths", 1); -var flapTHSSet = props.globals.getNode("/FMGC/internal/flap-ths-set", 1); var flex = props.globals.getNode("/FMGC/internal/flex", 1); var flexSet = props.globals.getNode("/FMGC/internal/flex-set", 1); var engOutAcc = props.globals.getNode("/FMGC/internal/eng-out-reduc", 1); @@ -4120,12 +4117,12 @@ var canvas_MCDU_base = { me["Simple_L5"].setFontSize(small); } - if (flapTHSSet.getValue() == 1) { + if (fmgc.FMGCInternal.toFlapThsSet) { me["Simple_R3"].setFontSize(normal); - if (THSTO.getValue() >= 0) { - me["Simple_R3"].setText(sprintf("%s", flapTO.getValue()) ~ sprintf("/UP%2.1f", THSTO.getValue())); + if (fmgc.FMGCInternal.toThs) { + me["Simple_R3"].setText(sprintf("%s", fmgc.FMGCInternal.toFlap) ~ sprintf("/UP%2.1f", fmgc.FMGCInternal.toThs)); } else { - me["Simple_R3"].setText(sprintf("%s", flapTO.getValue()) ~ sprintf("/DN%2.1f", -1 * THSTO.getValue())); + me["Simple_R3"].setText(sprintf("%s", fmgc.FMGCInternal.toFlap) ~ sprintf("/DN%2.1f", -1 * fmgc.FMGCInternal.toThs)); } } else { me["Simple_R3"].setFontSize(small); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 79e539de..57333e3b 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -130,6 +130,9 @@ var FMGCInternal = { vrset: 0, v2: 0, v2set: 0, + toFlap: 0, + toThs: 0, + toFlapThsSet: 0, # PERF APPR destMag: 0, diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 65ce950c..1a22e03e 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -195,7 +195,7 @@ var MessageController = { typeIIMessages: std.Vector.new([ TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0), - TypeIIMessage.new("TO SPEEDS TOO LOW", "amb", 0), + TypeIIMessage.new("T.O SPEEDS TOO LOW", "amb", 0),TypeIIMessage.new("CHECK TAKE OFF DATA", "amb", 0), TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533 TypeIIMessage.new("GPS PRIMARY"),TypeIIMessage.new("GPS PRIMARY LOST", "amb", 0), ]), diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas index ee3ab6b7..24d307a3 100644 --- a/Nasal/MCDU/DEPARTURE.nas +++ b/Nasal/MCDU/DEPARTURE.nas @@ -558,6 +558,19 @@ var departurePage = { me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]); me.makeTmpy(); fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway; + mcdu.perfToCheckTakeoffData(me.computer); + if (fmgc.FMGCInternal.v1set) { + fmgc.FMGCInternal.v1set = 0; + fmgc.FMGCInternal.v1 = 0; + } + if (fmgc.FMGCInternal.vrset) { + fmgc.FMGCInternal.vrset = 0; + fmgc.FMGCInternal.vr = 0; + } + if (fmgc.FMGCInternal.v2set) { + fmgc.FMGCInternal.v2set = 0; + fmgc.FMGCInternal.v2 = 0; + } me.updateRunways(); me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 78d2b32e..957f314d 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -169,6 +169,7 @@ var fuelPredInput = func(key, i) { fmgc.fuelCalculating.setValue(1); } mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); } else if (find("/", scratchpad) != -1) { if (acconfig_weight_kgs.getValue() == 1) { scratchpad = scratchpad / LBS2KGS; @@ -199,6 +200,7 @@ var fuelPredInput = func(key, i) { fmgc.fuelCalculating.setValue(1); } mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); } @@ -235,6 +237,7 @@ var fuelPredInput = func(key, i) { fmgc.fuelCalculating.setValue(1); } mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); } diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 13ca2d34..ad9c116b 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -207,6 +207,7 @@ var initInputB = func(key, i) { fmgc.blockCalculating.setValue(1); } mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); } else if (find("/", scratchpad) != -1) { if (acconfig_weight_kgs.getValue() == 1) { scratchpad = scratchpad / LBS2KGS; @@ -238,6 +239,7 @@ var initInputB = func(key, i) { fmgc.blockCalculating.setValue(1); } mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); } @@ -275,6 +277,7 @@ var initInputB = func(key, i) { fmgc.blockCalculating.setValue(1); } mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 8c29aa38..6b2559ef 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -155,9 +155,9 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.v2set = 0; setprop("/FMGC/internal/accel-agl-ft", 1500); #eventually set to 1500 above runway setprop("/MCDUC/thracc-set", 0); - setprop("/FMGC/internal/to-flap", 0); - setprop("/FMGC/internal/to-ths", "0.0"); - setprop("/FMGC/internal/flap-ths-set", 0); + fmgc.FMGCInternal.toFlap = 0; + fmgc.FMGCInternal.toThs = 0.0; + fmgc.FMGCInternal.toFlapThsSet = 0; setprop("/FMGC/internal/flex", 0); setprop("/FMGC/internal/flex-set", 0); setprop("/FMGC/internal/eng-out-reduc", "1500"); diff --git a/Nasal/MCDU/PERFTO.nas b/Nasal/MCDU/PERFTO.nas index 2838c5d5..1ccd9cc8 100644 --- a/Nasal/MCDU/PERFTO.nas +++ b/Nasal/MCDU/PERFTO.nas @@ -5,9 +5,20 @@ # TODO - DepArp elevation or current elevation (on ground only!!) -> math.round(fmgc.flightPlanController.flightplans[2].departure.elevation * M2FT)) +var doneMessageCheck = 0; +var perfToCheckTakeoffData = func(i) { + if (fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set) { + if (doneMessageCheck) { + mcdu_scratchpad.messageQueues[i].deleteWithText("CHECK TAKE OFF DATA"); + } + mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("CHECK TAKE OFF DATA")); + doneMessageCheck = 1; + } +} + var doneMessageDisag = 0; var perfTOCheckVSpeedsConsistency = func(i) { - if (fmgc.FMGCInternal.v1set == 1 and fmgc.FMGCInternal.vrset == 1 and fmgc.FMGCInternal.v2set == 1) { + if (fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set) { if (!(fmgc.FMGCInternal.v1 <= fmgc.FMGCInternal.vr and fmgc.FMGCInternal.vr <= fmgc.FMGCInternal.v2)) { if (doneMessageDisag) { mcdu_scratchpad.messageQueues[i].deleteWithText("V1/VR/V2 DISAGREE"); @@ -18,25 +29,30 @@ var perfTOCheckVSpeedsConsistency = func(i) { } } -# VMCA 109.5 at 0ft -# VMCG 106.5 at 0ft all conf - var VMCA = props.globals.getNode("/FMGC/internal/vmca-kt"); var VMCG = props.globals.getNode("/FMGC/internal/vmcg-kt"); -# When ZFW, BLOCK, or CONF are entered -# Above or takeoff thrust (FLEX or throttle) modified -# Engines started +var chooseVS1G = func() { + if (fmgc.FMGCInternal.toFlap == 1) { + return fmgc.FMGCInternal.vs1g_conf_1f; + } elsif (fmgc.FMGCInternal.toFlap == 2) { + return fmgc.FMGCInternal.vs1g_conf_2; + } elsif (fmgc.FMGCInternal.toFlap == 3) { + return fmgc.FMGCInternal.vs1g_conf_3; + } +}; + var doneMessageToLow = 0; var perfTOCheckVSpeedsLimitations = func(i) { - if (fmgc.FMGCInternal.v1 < VMCG.getValue() or fmgc.FMGCInternal.vr < (VMCA.getValue() * 1.05) or fmgc.FMGCInternal.v2 < (VMCA.getValue() * 1.10)) { - if (doneMessageToLow) { - mcdu_scratchpad.messageQueues[i].deleteWithText("TO SPEEDS TOO LOW"); + if (fmgc.FMGCInternal.toFlapThsSet and fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet and fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set) { + if (fmgc.FMGCInternal.v1 < VMCG.getValue() or fmgc.FMGCInternal.vr < (VMCA.getValue() * 1.05) or fmgc.FMGCInternal.v2 < (VMCA.getValue() * 1.10) or fmgc.FMGCInternal.v2 < (1.13 * chooseVS1G())) { + if (doneMessageToLow) { + mcdu_scratchpad.messageQueues[i].deleteWithText("T.O SPEEDS TOO LOW"); + } + mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("T.O SPEEDS TOO LOW")); + doneMessageToLow = 1; } - mcdu_scratchpad.messageQueues[i].addNewMsg(mcdu_scratchpad.MessageController.getTypeIIMsgByText("TO SPEEDS TOO LOW")); - doneMessageToLow = 1; } - #else if (Vr= 0 and num(trima) <= 7.0; var validtrimb = num(trimb) != nil and num(trimb) >= 0 and num(trimb) <= 7.0; - if (flaps == 0 and getprop("/FMGC/internal/flap-ths-set")) { + + if (flaps == 0 and fmgc.FMGCInternal.toFlapThsSet) { if (trims == 5 and find("DN", trim) != -1 and validtrima) { - setprop("/FMGC/internal/to-ths", -1 * trima); + fmgc.FMGCInternal.toThs = -1 * trima; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + perfToCheckTakeoffData(i); } else if (trims == 5 and find("DN", trim) != -1 and validtrimb) { - setprop("/FMGC/internal/to-ths", -1 * trimb); + fmgc.FMGCInternal.toThs = -1 * trimb; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + perfToCheckTakeoffData(i); } else if (trims == 5 and find("UP", trim) != -1 and validtrima) { - setprop("/FMGC/internal/to-ths", trima); + fmgc.FMGCInternal.toThs = trima; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + perfToCheckTakeoffData(i); } else if (trims == 5 and find("UP", trim) != -1 and validtrimb) { - setprop("/FMGC/internal/to-ths", trimb); + fmgc.FMGCInternal.toThs = trimb; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + perfToCheckTakeoffData(i); } else { mcdu_message(i, "NOT ALLOWED"); } } else if (flaps == 1 and num(flap) != nil and flap >= 0 and flap <= 3) { if (trims == 5 and find("DN", trim) != -1 and validtrima) { - setprop("/FMGC/internal/to-flap", flap); - setprop("/FMGC/internal/to-ths", -1 * trima); - setprop("/FMGC/internal/flap-ths-set", 1); + fmgc.FMGCInternal.toFlap = flap; + fmgc.FMGCInternal.toThs = -1 * trima; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + if (fmgc.FMGCInternal.toFlapThsSet) { + perfToCheckTakeoffData(i); + } + fmgc.FMGCInternal.toFlapThsSet = 1; } else if (trims == 5 and find("DN", trim) != -1 and validtrimb) { - setprop("/FMGC/internal/to-flap", flap); - setprop("/FMGC/internal/to-ths", -1 * trimb); - setprop("/FMGC/internal/flap-ths-set", 1); + fmgc.FMGCInternal.toFlap = flap; + fmgc.FMGCInternal.toThs = -1 * trimb; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + if (fmgc.FMGCInternal.toFlapThsSet) { + perfToCheckTakeoffData(i); + } + fmgc.FMGCInternal.toFlapThsSet = 1; } else if (trims == 5 and find("UP", trim) != -1 and validtrima) { - setprop("/FMGC/internal/to-flap", flap); - setprop("/FMGC/internal/to-ths", trima); - setprop("/FMGC/internal/flap-ths-set", 1); + fmgc.FMGCInternal.toFlap = flap; + fmgc.FMGCInternal.toThs = trima; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + if (fmgc.FMGCInternal.toFlapThsSet) { + perfToCheckTakeoffData(i); + } + fmgc.FMGCInternal.toFlapThsSet = 1; } else if (trims == 5 and find("UP", trim) != -1 and validtrimb) { - setprop("/FMGC/internal/to-flap", flap); - setprop("/FMGC/internal/to-ths", trimb); - setprop("/FMGC/internal/flap-ths-set", 1); + fmgc.FMGCInternal.toFlap = flap; + fmgc.FMGCInternal.toThs = trimb; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + if (fmgc.FMGCInternal.toFlapThsSet) { + perfToCheckTakeoffData(i); + } + fmgc.FMGCInternal.toFlapThsSet = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -231,11 +276,13 @@ var perfTOInput = func(key, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (size(scratchpad) == 1 and num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 3) { - setprop("/FMGC/internal/to-flap", scratchpad); - if (!getprop("/FMGC/internal/flap-ths-set")) { - setprop("/FMGC/internal/flap-ths-set", 1); - } + fmgc.FMGCInternal.toFlap = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); + perfTOCheckVSpeedsLimitations(i); + if (fmgc.FMGCInternal.toFlapThsSet) { + perfToCheckTakeoffData(i); + } + fmgc.FMGCInternal.toFlapThsSet = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -253,6 +300,8 @@ var perfTOInput = func(key, i) { setprop("/FMGC/internal/flex-set", 1); var flex_calc = getprop("/FMGC/internal/flex") - getprop("environment/temperature-degc"); setprop("/FMGC/internal/flex-cmd", flex_calc); + perfTOCheckVSpeedsLimitations(i); + perfToCheckTakeoffData(i); mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); From 0b05a15bc6053bc301a38340cafbb75412feba2f Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 25 Jan 2022 14:42:05 +0000 Subject: [PATCH 13/13] Add ECAM messages for Takeoff Securing Function --- Nasal/ECAM/ECAM-logic.nas | 35 +++++++++++++++++++++++++++++++++++ Nasal/ECAM/ECAM-messages.nas | 6 ++++++ 2 files changed, 41 insertions(+) diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index cc08febc..6ddc3699 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -19,6 +19,7 @@ var engOpt = props.globals.getNode("/options/eng", 1); var thrustState = [nil, nil]; # local variables +var takeoffConfig = 0; var transmitFlag1 = 0; var transmitFlag2 = 0; var phaseVar3 = nil; @@ -2325,6 +2326,40 @@ var messages_priority_2 = func { ECAM_controller.warningReset(fctlSpdBrkStillOut); } + if (fctlPitchTrimDisag.clearFlag == 0 and takeoffConfig and fmgc.FMGCInternal.toFlapThsSet and abs(-getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") - fmgc.FMGCInternal.toThs) >= 1.3) { + fctlPitchTrimDisag.active = 1; + fctlPitchTrimDisag2.active = 1; + } else { + ECAM_controller.warningReset(fctlPitchTrimDisag); + ECAM_controller.warningReset(fctlPitchTrimDisag2); + } + + if (fctlFlapsDisag.clearFlag == 0 and takeoffConfig and fmgc.FMGCInternal.toFlapThsSet and (fmgc.FMGCInternal.toFlap + 1 != pts.Controls.Flight.flapsPos.getValue())) { + fctlFlapsDisag.active = 1; + } else { + ECAM_controller.warningReset(fctlFlapsDisag); + } + + if (toSpdsDisag.clearFlag == 0 and takeoffConfig and fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set and !(fmgc.FMGCInternal.v1 <= fmgc.FMGCInternal.vr and fmgc.FMGCInternal.vr <= fmgc.FMGCInternal.v2)) { + toSpdsDisag.active = 1; + } else { + ECAM_controller.warningReset(toSpdsDisag); + } + + if (toSpdsTooLow.clearFlag == 0 and takeoffConfig and + fmgc.FMGCInternal.toFlapThsSet and fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet and fmgc.FMGCInternal.v1set and fmgc.FMGCInternal.vrset and fmgc.FMGCInternal.v2set + and (fmgc.FMGCInternal.v1 < mcdu.VMCG.getValue() or fmgc.FMGCInternal.vr < (mcdu.VMCA.getValue() * 1.05) or fmgc.FMGCInternal.v2 < (mcdu.VMCA.getValue() * 1.10) or fmgc.FMGCInternal.v2 < (1.13 * mcdu.chooseVS1G()))) { + toSpdsTooLow.active = 1; + } else { + ECAM_controller.warningReset(toSpdsTooLow); + } + + if (toSpdsNotInserted.clearFlag == 0 and takeoffConfig and (!fmgc.FMGCInternal.v1set or !fmgc.FMGCInternal.vrset or !fmgc.FMGCInternal.v2set)) { + toSpdsNotInserted.active = 1; + } else { + ECAM_controller.warningReset(toSpdsNotInserted); + } + gearPosition = pts.Gear.position[1].getValue(); if (directLaw.clearFlag == 0 and warningNodes.Timers.directLaw.getValue() == 1 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8) { directLaw.active = 1; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index 4526a370..6898d406 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -494,6 +494,12 @@ var warnings = std.Vector.new([ # 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), + var fctlPitchTrimDisag = warning.new(msg: "F/CTL", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var fctlPitchTrimDisag2 = warning.new(msg: "PITCH TRIM/MCDU/CG DISAGREE", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var fctlFlapsDisag = warning.new(msg: "F/CTL FLAPS/MCDU DISAGREE", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var toSpdsDisag = warning.new(msg: "T.O V1/VR/V2 DISAGREE ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var toSpdsTooLow = warning.new(msg: "T.O SPEEDS TOO LOW ", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var toSpdsNotInserted = warning.new(msg: "T.O SPEEDS NOT INSERTED ", 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),