From 31e82699969fac183d51a323001f6fd24292bb19 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 14:04:33 +0100 Subject: [PATCH 01/45] Simbrief initial downloader --- A320-main.xml | 13 +++++++ AircraftConfig/acconfig.nas | 4 ++ AircraftConfig/simbrief.xml | 69 +++++++++++++++++++++++++++++++++++ Nasal/FMGC/SimbriefParser.nas | 25 +++++++++++++ Nasal/FMGC/mcdu-messages.nas | 1 + Nasal/MCDU/INITA.nas | 6 +++ Nasal/MCDU/MCDU.nas | 4 +- 7 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 AircraftConfig/simbrief.xml create mode 100644 Nasal/FMGC/SimbriefParser.nas diff --git a/A320-main.xml b/A320-main.xml index be504dd6..238b6852 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -269,6 +269,15 @@ + + + + nasal + + + @@ -635,6 +644,7 @@ 0 0 + @@ -4336,6 +4346,9 @@ Aircraft/A320-family/Nasal/Systems/save.nas + + Aircraft/A320-family/Nasal/FMGC/SimbriefParser.nas + diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index b52e10f4..7ff2d44d 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -102,6 +102,7 @@ var error_mismatch = gui.Dialog.new("/sim/gui/dialogs/acconfig/error/mismatch/di var fuel_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/fuel/dialog", "Aircraft/A320-family/AircraftConfig/fuel.xml"); var groundservices_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/groundsrvc/dialog", "Aircraft/A320-family/AircraftConfig/groundservices.xml"); var loadflightplan_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/loadfpln/dialog","Aircraft/A320-family/AircraftConfig/load-flightplan.xml"); +var simbrief_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/loadfpln/dialog","Aircraft/A320-family/AircraftConfig/simbrief.xml"); var du_quality = gui.Dialog.new("/sim/gui/dialogs/acconfig/du-quality/dialog", "Aircraft/A320-family/AircraftConfig/du-quality.xml"); var rendering_dlg = gui.Dialog.new("/sim/gui/dialogs/rendering/dialog", "Aircraft/A320-family/AircraftConfig/rendering.xml"); spinning.start(); @@ -112,6 +113,7 @@ var current_revision = io.readfile(revisionFile); print("A320-family Revision: " ~ current_revision); setprop("/systems/acconfig/revision", current_revision); setprop("/systems/acconfig/options/fo-view", 0); +setprop("/systems/acconfig/options/simbrief-username", ""); setlistener("/systems/acconfig/new-revision", func { if (getprop("/systems/acconfig/new-revision") > current_revision) { @@ -228,6 +230,7 @@ var readSettings = func { setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route")); setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip")); setprop("/options/system/fo-view", getprop("/systems/acconfig/options/fo-view")); + setprop("/FMGC/internal/simbrief-username", getprop("/systems/acconfig/options/simbrief-username")); } var writeSettings = func { @@ -239,6 +242,7 @@ var writeSettings = func { setprop("/systems/acconfig/options/autopush/show-route", getprop("/sim/model/autopush/route/show")); setprop("/systems/acconfig/options/autopush/show-wingtip", getprop("/sim/model/autopush/route/show-wingtip")); setprop("/systems/acconfig/options/fo-view", getprop("/options/system/fo-view")); + setprop("/systems/acconfig/options/simbrief-username", getprop("/FMGC/simbrief-username")); io.write_properties(getprop("/sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options"); } diff --git a/AircraftConfig/simbrief.xml b/AircraftConfig/simbrief.xml new file mode 100644 index 00000000..bdb63a86 --- /dev/null +++ b/AircraftConfig/simbrief.xml @@ -0,0 +1,69 @@ + + + + + + + + + simbrief + vbox + + + hbox + + left + + + + + + + + + vbox + + left + + + + left + + + + left + + + + left + + + + hbox + + left + + + + + 200 + 25 + /FMGC/simbrief-username + + dialog-apply + + true + + + + + diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas new file mode 100644 index 00000000..39455603 --- /dev/null +++ b/Nasal/FMGC/SimbriefParser.nas @@ -0,0 +1,25 @@ +# A3XX Simbrief Parser +# Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) + +var SimbriefParser = { + node: nil, + fetch: func(username, i) { + var stamp = systime(); + http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml") + .fail(func mcdu.mcdu_message(i, "SIMBRIEF FAILED")) + .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml")); + }, + read: func(xml) { + var data = io.readxml(xml); + if (data != nil) { + if (data.getChild("OFP") == nil) { + print("XML file " ~ xml ~ " not a valid Simbrief file"); + } else { + me.node = data; + debug.dump(me.node.getChild("OFP").getChild("fetch").getChild("status")); + } + } else { + print("Error reading " ~ xml); + } + }, +}; \ No newline at end of file diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index aa769301..fe39417f 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -172,6 +172,7 @@ var MessageController = { TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), + TypeIMessage.new("SIMBRIEF FAILED"),TypeIMessage.new("MISSING USERNAME"), ]), 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"), diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 1e019e47..e1103c02 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -240,6 +240,12 @@ var initInputA = func(key, i) { mcdu_message(i, "TMPY F-PLN EXISTS"); } } + } else if (key == "R2") { + if (getprop("/FMGC/simbrief-username") == "") { + mcdu.mcdu_message(i, "MISSING USERNAME") + } else { + Simbrief.SimbriefParser.fetch(getprop("/FMGC/simbrief-username"), i); + } } else if (key == "R3") { setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); } else if (key == "R4") { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 6fffab6b..db3948fe 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -658,7 +658,9 @@ var rskbutton = func(btn, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "2") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { + if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + initInputA("R2",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R2",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { perfAPPRInput("R2",i); From fc25237eb23b9c23d45c131250d193c1d55720dc Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 15:04:54 +0100 Subject: [PATCH 02/45] INITA linked in --- Models/Instruments/MCDU/MCDU.nas | 6 +++++- Nasal/FMGC/SimbriefParser.nas | 8 +++++--- Nasal/FMGC/mcdu-messages.nas | 2 +- Nasal/MCDU/INITA.nas | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 030d6b7d..b5f10629 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -1963,7 +1963,11 @@ var canvas_MCDU_base = { me["Simple_L2"].setText("----/----------"); me.showRight(-1, 1, 0, 0, 0, 0); me["Simple_R2S"].show(); - me["INITA_InitRequest"].show(); + if (!Simbrief.SimbriefParser.inhibit) { + me["INITA_InitRequest"].show(); + } else { + me["INITA_InitRequest"].hide(); + } } if (ADIRSMCDUBTN.getValue() != 1) { me["INITA_AlignIRS"].show(); diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 39455603..abb80fef 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -3,20 +3,22 @@ var SimbriefParser = { node: nil, + inhibit: 0, fetch: func(username, i) { + me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml") .fail(func mcdu.mcdu_message(i, "SIMBRIEF FAILED")) - .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml")); + .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml"), 1); }, - read: func(xml) { + read: func(xml, i) { var data = io.readxml(xml); if (data != nil) { if (data.getChild("OFP") == nil) { print("XML file " ~ xml ~ " not a valid Simbrief file"); } else { me.node = data; - debug.dump(me.node.getChild("OFP").getChild("fetch").getChild("status")); + mcdu.mcdu_message(i, "AOC ACT F-PLN UPLINK"); } } else { print("Error reading " ~ xml); diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index fe39417f..85fbcda2 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -172,7 +172,7 @@ var MessageController = { TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), - TypeIMessage.new("SIMBRIEF FAILED"),TypeIMessage.new("MISSING USERNAME"), + TypeIMessage.new("SIMBRIEF FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"), ]), 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"), diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e1103c02..4dea8526 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -186,6 +186,7 @@ var initInputA = func(key, i) { } fmgc.flightPlanController.reset(2); fmgc.flightPlanController.init(); + Simbrief.SimbriefParser.inhibit = 0; mcdu_scratchpad.scratchpads[i].empty(); #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 0; From fb41cf842421640a0f6ca7bc33daa1478378c8e7 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 16:30:16 +0100 Subject: [PATCH 03/45] INITA loading --- AircraftConfig/simbrief.xml | 6 +++- Nasal/FMGC/FMGC.nas | 22 +++++++++++++ Nasal/FMGC/SimbriefParser.nas | 60 ++++++++++++++++++++++++++++++++++- Nasal/FMGC/flightplan.nas | 1 - Nasal/MCDU/INITA.nas | 32 ++++++------------- 5 files changed, 96 insertions(+), 25 deletions(-) diff --git a/AircraftConfig/simbrief.xml b/AircraftConfig/simbrief.xml index bdb63a86..28fe1398 100644 --- a/AircraftConfig/simbrief.xml +++ b/AircraftConfig/simbrief.xml @@ -45,7 +45,11 @@ left - + + + + left + hbox diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 29006c93..f313d4d4 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -224,6 +224,28 @@ var updateARPT = func { } } +var updateArptLatLon = func { + #ref lat + dms = getprop("/FMGC/flightplan[2]/wp[0]/lat"); + degrees = int(dms); + minutes = sprintf("%.1f",abs((dms - degrees) * 60)); + sign = degrees >= 0 ? "N" : "S"; + setprop("/FMGC/internal/align-ref-lat-degrees", degrees); + setprop("/FMGC/internal/align-ref-lat-minutes", minutes); + setprop("/FMGC/internal/align-ref-lat-sign", sign); + #ref long + dms = getprop("/FMGC/flightplan[2]/wp[0]/lon"); + degrees = int(dms); + minutes = sprintf("%.1f",abs((dms - degrees) * 60)); + sign = degrees >= 0 ? "E" : "W"; + setprop("/FMGC/internal/align-ref-long-degrees", degrees); + setprop("/FMGC/internal/align-ref-long-minutes", minutes); + setprop("/FMGC/internal/align-ref-long-sign", sign); + #ref edit + setprop("/FMGC/internal/align-ref-lat-edit", 0); + setprop("/FMGC/internal/align-ref-long-edit", 0); +} + updateRouteManagerAlt = func() { setprop("autopilot/route-manager/cruise/altitude-ft", FMGCInternal.crzFt); }; diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index abb80fef..731b03cf 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -3,13 +3,16 @@ var SimbriefParser = { node: nil, + OFP: nil, + store1: nil, + store2: nil, inhibit: 0, fetch: func(username, i) { me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml") .fail(func mcdu.mcdu_message(i, "SIMBRIEF FAILED")) - .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml"), 1); + .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml", i)); }, read: func(xml, i) { var data = io.readxml(xml); @@ -18,10 +21,65 @@ var SimbriefParser = { print("XML file " ~ xml ~ " not a valid Simbrief file"); } else { me.node = data; + me.parseOFP(); mcdu.mcdu_message(i, "AOC ACT F-PLN UPLINK"); } } else { print("Error reading " ~ xml); } }, + parseOFP: func() { + me.OFP = me.node.getChild("OFP"); + me.store1 = nil; + me.store2 = nil; + + me.store1 = me.OFP.getChild("general"); + me.store2 = me.OFP.getChild("alternate"); + fmgc.FMGCInternal.flightNum = me.store1.getChild("icao_airline").getValue() ~ me.store1.getChild("flight_number").getValue(); + fmgc.FMGCInternal.flightNumSet = 1; + fmgc.FMGCInternal.costIndex = me.store1.getChild("costindex").getValue(); + fmgc.FMGCInternal.costIndexSet = 1; + fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); + fmgc.FMGCInternal.tropo = me.store1.getChild("avg_tropopause").getValue(); + fmgc.FMGCInternal.tropoSet = 1; + fmgc.FMGCInternal.crzFt = me.store1.getChild("initial_altitude").getValue(); + fmgc.FMGCInternal.crzFl = me.store1.getChild("initial_altitude").getValue() / 100; + fmgc.altvert(); + fmgc.FMGCInternal.crzSet = 1; + mcdu.updateCrzLvlCallback(); + fmgc.FMGCInternal.crzTemp = (((me.store1.getChild("initial_altitude").getValue() / 1000) * -2) + 15) + me.store1.getChild("avg_temp_dev").getValue(); + fmgc.FMGCInternal.crzTempSet = 1; + fmgc.FMGCInternal.crzProg = me.store1.getChild("initial_altitude").getValue() / 100; + + fmgc.FMGCInternal.altAirport = me.store2.getChild("icao_code").getValue(); + fmgc.FMGCInternal.altAirportSet = 1; + + # Flightplan stuff + fmgc.flightPlanController.flightplans[3] = createFlightplan(); + + # INITA + me.store1 = me.OFP.getChild("origin"); + me.store2 = me.OFP.getChild("destination"); + + fmgc.FMGCInternal.depApt = me.store1.getChild("icao_code").getValue(); + fmgc.FMGCInternal.arrApt = me.store2.getChild("icao_code").getValue(); + fmgc.FMGCInternal.toFromSet = 1; + fmgc.FMGCNodes.toFromSet.setValue(1); + fmgc.flightPlanController.flightplans[3].departure = airportinfo(fmgc.FMGCInternal.depApt); + fmgc.flightPlanController.flightplans[3].destination = airportinfo(fmgc.FMGCInternal.arrApt); + fmgc.FMGCInternal.altSelected = 0; + fmgc.updateArptLatLon(); + fmgc.updateARPT(); + + + fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); + + fmgc.windController.updatePlans(); + fmgc.updateRouteManagerAlt(); + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + + }, }; \ No newline at end of file diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 1c1e2436..4915fff8 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -167,7 +167,6 @@ var flightPlanController = { me.currentToWptIndex.setValue(0); me.arrivalIndex = [0, 0, 0]; # reset arrival index calculations } - me.addDiscontinuity(1, plan); # reset mcdu if it exists if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].scroll = 0; } diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 4dea8526..57be5da3 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -211,25 +211,7 @@ var initInputA = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); fmgc.flightPlanController.updateAirports(fromto[0], fromto[1], 2); fmgc.FMGCInternal.altSelected = 0; - #ref lat - dms = getprop("/FMGC/flightplan[2]/wp[0]/lat"); - degrees = int(dms); - minutes = sprintf("%.1f",abs((dms - degrees) * 60)); - sign = degrees >= 0 ? "N" : "S"; - setprop("/FMGC/internal/align-ref-lat-degrees", degrees); - setprop("/FMGC/internal/align-ref-lat-minutes", minutes); - setprop("/FMGC/internal/align-ref-lat-sign", sign); - #ref long - dms = getprop("/FMGC/flightplan[2]/wp[0]/lon"); - degrees = int(dms); - minutes = sprintf("%.1f",abs((dms - degrees) * 60)); - sign = degrees >= 0 ? "E" : "W"; - setprop("/FMGC/internal/align-ref-long-degrees", degrees); - setprop("/FMGC/internal/align-ref-long-minutes", minutes); - setprop("/FMGC/internal/align-ref-long-sign", sign); - #ref edit - setprop("/FMGC/internal/align-ref-lat-edit", 0); - setprop("/FMGC/internal/align-ref-long-edit", 0); + fmgc.updateArptLatLon(); #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); } else { mcdu_message(i, "NOT ALLOWED"); @@ -242,10 +224,16 @@ var initInputA = func(key, i) { } } } else if (key == "R2") { - if (getprop("/FMGC/simbrief-username") == "") { - mcdu.mcdu_message(i, "MISSING USERNAME") + if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { + if (getprop("/FMGC/simbrief-username") == "") { + mcdu.mcdu_message(i, "MISSING USERNAME") + } elsif (!Simbrief.SimbriefParser.inhibit) { + Simbrief.SimbriefParser.fetch(getprop("/FMGC/simbrief-username"), i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { - Simbrief.SimbriefParser.fetch(getprop("/FMGC/simbrief-username"), i); + mcdu_message(i, "NOT ALLOWED"); } } else if (key == "R3") { setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); From 92ec285cf0bd349a615e7b8d928bcd4b0593ab9f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 21:25:45 +0100 Subject: [PATCH 04/45] Alright, so now loads waypoints -- I checked these situations: - With DCT first waypoint - With SID to first waypoint - With SID (not in DB) to first waypoint - PROBLEMS with runway mismatch - With DCT runway - With STAR to runway - With STAR (not in DB) to last waypoint - PROBLEMS with runway mismatch --- AircraftConfig/simbrief.xml | 6 ++- Nasal/FMGC/SimbriefParser.nas | 82 +++++++++++++++++++++++++++++++++-- Nasal/FMGC/flightplan.nas | 2 +- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/AircraftConfig/simbrief.xml b/AircraftConfig/simbrief.xml index 28fe1398..b7fd94fd 100644 --- a/AircraftConfig/simbrief.xml +++ b/AircraftConfig/simbrief.xml @@ -49,7 +49,11 @@ left - + + + + left + hbox diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 731b03cf..cabc34f2 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -50,6 +50,13 @@ var SimbriefParser = { fmgc.FMGCInternal.crzTemp = (((me.store1.getChild("initial_altitude").getValue() / 1000) * -2) + 15) + me.store1.getChild("avg_temp_dev").getValue(); fmgc.FMGCInternal.crzTempSet = 1; fmgc.FMGCInternal.crzProg = me.store1.getChild("initial_altitude").getValue() / 100; + if (me.store1.getChild("avg_wind_comp").getValue() >= 0) { + setprop("/FMGC/internal/trip-wind", "TL" ~ me.store1.getChild("avg_wind_comp").getValue()); + setprop("/FMGC/internal/trip-wind-value", me.store1.getChild("avg_wind_comp").getValue()); + } else { + setprop("/FMGC/internal/trip-wind", "HD" ~ me.store1.getChild("avg_wind_comp").getValue()); + setprop("/FMGC/internal/trip-wind-value", me.store1.getChild("avg_wind_comp").getValue()); + } fmgc.FMGCInternal.altAirport = me.store2.getChild("icao_code").getValue(); fmgc.FMGCInternal.altAirportSet = 1; @@ -70,16 +77,85 @@ var SimbriefParser = { fmgc.FMGCInternal.altSelected = 0; fmgc.updateArptLatLon(); fmgc.updateARPT(); + call(func() { + fmgc.flightPlanController.flightplans[3].departure_runway = airportinfo(fmgc.FMGCInternal.depApt).runways[me.store1.getChild("plan_rwy").getValue()]; + fmgc.flightPlanController.flightplans[3].destination_runway = airportinfo(fmgc.FMGCInternal.arrApt).runways[me.store2.getChild("plan_rwy").getValue()]; + }); + me.store1 = me.OFP.getChild("navlog").getChildren(); + var firstIsSID = 0; + var SIDID = ""; + if (me.store1[0].getChild("is_sid_star").getValue() == 1) { + if (fmgc.flightPlanController.flightplans[3].departure.getSid(me.store1[0].getChild("via_airway").getValue()) != nil) { + firstIsSID = 1; + SIDID = me.store1[0].getChild("via_airway").getValue(); + } + } + var lastIsSTAR = 0; + var STARID = ""; + if (me.store1[-1].getChild("is_sid_star").getValue() == 1) { + if (fmgc.flightPlanController.flightplans[3].destination.getStar(me.store1[-1].getChild("via_airway").getValue()) != nil) { + lastIsSTAR = 1; + STARID = me.store1[-1].getChild("via_airway").getValue(); + } + } + var lastSIDIndex = -999; + var firstSTARIndex = -999; + var TOCinSIDflag = 0; + var TODinSTARflag = 0; + for (var i = 0; i < size(me.store1); i = i + 1) { + if (firstIsSID) { + if (me.store1[i].getChild("is_sid_star").getValue() == 0 or me.store1[i].getChild("via_airway").getValue() != SIDID) { + lastSIDIndex = i - 1; + break; + } + } + } + + for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex; i < size(me.store1); i = i + 1) { + if (STARID != "") { + if (me.store1[i].getChild("is_sid_star").getValue() == 1 and me.store1[i].getChild("via_airway").getValue() == STARID) { + firstSTARIndex = i; + break; + } + } + } + + var max = firstSTARIndex == -999 ? size(me.store1) - 1 : firstSTARIndex - 1; + for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex + 2; i < max; i = i + 1) { + if (me.store1[i].getChild("ident").getValue() == "TOC" or me.store1[i].getChild("ident").getValue() == "TOD") { continue; } + var coord = geo.Coord.new(); + coord.set_latlon(me.store1[i].getChild("pos_lat").getValue(), me.store1[i].getChild("pos_long").getValue()); + var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); + fmgc.flightPlanController.flightplans[3].appendWP(WP); + } + fmgc.flightPlanController.flightplans[3].sid = fmgc.flightPlanController.flightplans[3].departure.getSid(SIDID); + fmgc.flightPlanController.flightplans[3].star = fmgc.flightPlanController.flightplans[3].destination.getStar(STARID); fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); fmgc.windController.updatePlans(); fmgc.updateRouteManagerAlt(); - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 0); - setprop("/FMGC/internal/fuel-calculating", 1); + + + # INITB + me.store1 = me.OFP.getChild("fuel"); + setprop("/FMGC/internal/taxi-fuel", me.store1.getChild("taxi").getValue() / 1000); + setprop("/FMGC/internal/taxi-fuel-set", 1); + setprop("/FMGC/internal/alt-fuel", me.store1.getChild("alternate_burn").getValue() / 1000); + setprop("/FMGC/internal/alt-fuel-set", 1); + setprop("/FMGC/internal/final-fuel", me.store1.getChild("reserve").getValue() / 1000); + setprop("/FMGC/internal/final-fuel-set", 1); + setprop("/FMGC/internal/rte-rsv", me.store1.getChild("contingency").getValue() / 1000); + setprop("/FMGC/internal/rte-rsv-set", 1); + if ((me.store1.getChild("contingency").getValue() / 1000) / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) { + setprop("/FMGC/internal/rte-percent", (me.store1.getChild("contingency").getValue() / 1000) / num(getprop("/FMGC/internal/trip-fuel")) * 100); + } else { + setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value } + setprop("/FMGC/internal/block", me.store1.getChild("plan_ramp").getValue() / 1000); + setprop("/FMGC/internal/block-set", 1); + setprop("/FMGC/internal/block-calculating", 0); }, }; \ No newline at end of file diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 4915fff8..e4018ba7 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -819,7 +819,7 @@ var flightPlanController = { if (me.flightplans[2].getWP(me.arrivalIndex[2]) == nil or me.flightplans[2].getWP(1) == nil) { me.arrivalDist = 9999; - print(me.arrivalIndex[2]); + #print(me.arrivalIndex[2]); } else { me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist; } From 701e52198ee4234603af127a33673fcdec1b4285 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 21:53:57 +0100 Subject: [PATCH 05/45] bugfix --- Nasal/MCDU/MCDU.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 6fffab6b..ba5739b4 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -1068,7 +1068,7 @@ var pagebutton = func(btn, i) { setprop("/MCDU[" ~ i ~ "]/page", "DATA"); } else if (btn == "mcdu") { var page = getprop("/MCDU[" ~ i ~ "]/page"); - if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") { + if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") { setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page")); } else { setprop("/MCDU[" ~ i ~ "]/last-atsu-page", getprop("/MCDU[" ~ i ~ "]/page")); From c175461ea4d894656c9e0a15364717126940368f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 1 Aug 2020 22:26:25 +0100 Subject: [PATCH 06/45] Fix that engines wouldn't shutdown when LP valves are commanded closed --- Systems/a320-fuel.xml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Systems/a320-fuel.xml b/Systems/a320-fuel.xml index 95938e57..32b0d053 100644 --- a/Systems/a320-fuel.xml +++ b/Systems/a320-fuel.xml @@ -542,6 +542,32 @@ + + + + /systems/acconfig/autoconfig-running eq 0 + /systems/fuel/valves/engine-1-lp-valve eq 0 + + propulsion/tank[5]/unusable-volume-gal + + + + + + /systems/acconfig/autoconfig-running eq 0 + /systems/fuel/valves/engine-2-lp-valve eq 0 + + propulsion/tank[6]/unusable-volume-gal + + + + + + /systems/acconfig/autoconfig-running eq 0 + /systems/fuel/valves/apu-lp-valve eq 0 + + propulsion/tank[7]/unusable-volume-gal + @@ -773,7 +799,7 @@ /systems/fuel/internal/left-wing-tank-eng-1 /systems/fuel/internal/right-wing-tank-eng-1 - /systems/fuel/internal/center-tank-eng-2 + /systems/fuel/internal/center-tank-eng-1 propulsion/tank[5]/external-flow-rate-pps From 067a87f1e8743dfa965a9e4953436ac2b764e910 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 2 Aug 2020 13:01:06 +0100 Subject: [PATCH 07/45] Fix that cost index 0 would prevent managed speed --- Nasal/FMGC/FMGC.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 29006c93..3b8e07b2 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -898,7 +898,7 @@ var reset_FMGC = func { ################# var ManagedSPD = maketimer(0.25, func { - if (FMGCInternal.crzSet and FMGCInternal.costIndex) { + if (FMGCInternal.crzSet and FMGCInternal.costIndexSet) { if (getprop("/it-autoflight/input/spd-managed") == 1) { altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); mode = getprop("/modes/pfd/fma/pitch-mode"); From 31f9b6f78c9650cc0827b479e6221fbe6f1029c0 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 2 Aug 2020 13:48:30 +0100 Subject: [PATCH 08/45] README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 96d909f6..e9538fd9 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. +## Installation +If you have issues installing, please check INSTALL.MD! + ## External tools Some external tools you might want to checkout and use with this Model. NOTE: These are external tools so make sure to check their terms of use From 34e15b176574f500f659276b7335d8b34ea66a5c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 2 Aug 2020 23:42:04 +0100 Subject: [PATCH 09/45] VS pointer improvements on PFD --- Models/Instruments/PFD/PFD.nas | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 7e1bc2fb..1f255ec3 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -73,7 +73,6 @@ var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1); var ground_diff = props.globals.getNode("/instrumentation/pfd/ground-diff", 1); var landing_diff = props.globals.getNode("/instrumentation/pfd/landing-diff", 1); var ap_alt = props.globals.getNode("/it-autoflight/internal/alt", 1); -var alt_agl = props.globals.getNode("/position/altitude-agl-ft", 1); var vs_needle = props.globals.getNode("/instrumentation/pfd/vs-needle", 1); var vs_digit = props.globals.getNode("/instrumentation/pfd/vs-digit-trans", 1); var ap_vs_pfd = props.globals.getNode("/it-autoflight/internal/vert-speed-fpm-pfd", 1); @@ -131,8 +130,6 @@ var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1 var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1); # Create Nodes: -var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE"); -var vs_needle_trans = props.globals.initNode("/instrumentation/pfd/vs-digit-trans", 0.0, "DOUBLE"); var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); var ground_diff = props.globals.initNode("/instrumentation/pfd/ground-diff", 0.0, "DOUBLE"); var landing_diff = props.globals.initNode("/instrumentation/pfd/landing-diff", 0.0, "DOUBLE"); @@ -889,6 +886,19 @@ var canvas_PFD_base = { me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur)); } + var vs_itaf = fmgc.Internal.vs.getValue(); + var gearAgl = gear_agl.getValue(); + + if (abs(vs_itaf) >= 6000 or (vs_itaf <= -2000 and gearAgl <= 2500) or (vs_itaf <= -1200 and gearAgl <= 1000)) { + me["VS_digit"].setColor(0.7333,0.3803,0); + me["VS_pointer"].setColor(0.7333,0.3803,0); + me["VS_pointer"].setColorFill(0.7333,0.3803,0); + } else { + me["VS_digit"].setColor(0.0509,0.7529,0.2941); + me["VS_pointer"].setColor(0.0509,0.7529,0.2941); + me["VS_pointer"].setColorFill(0.0509,0.7529,0.2941); + } + # ILS me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0); me["GS_pointer"].setTranslation(0, gs.getValue() * -197); @@ -1531,7 +1541,7 @@ var canvas_PFD_1 = { } } - if (alt_agl.getValue() < 400) { + if (gear_agl.getValue() < 400) { me["S_target"].hide(); me["F_target"].hide(); } @@ -2270,7 +2280,7 @@ var canvas_PFD_2 = { } } - if (alt_agl.getValue() < 400) { + if (gear_agl.getValue() < 400) { me["S_target"].hide(); me["F_target"].hide(); } From c75df53506d4c78e92bff2b1b064d62677c2699d Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 1 Aug 2020 09:57:19 -0400 Subject: [PATCH 10/45] Remove setprop/getprop from fuel, min dest fob bug fix --- Models/Instruments/MCDU/MCDU.nas | 392 ++++++++++++++----------------- Nasal/FMGC/FMGC.nas | 153 +++++++----- Nasal/MCDU/FUELPRED.nas | 137 +++++------ Nasal/MCDU/INITB.nas | 205 ++++++++-------- Nasal/MCDU/MCDU.nas | 75 +++--- 5 files changed, 467 insertions(+), 495 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 030d6b7d..3df678c1 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -111,49 +111,11 @@ var align_set = props.globals.getNode("/FMGC/internal/align-set", 1); # ROUTE SELECTION # INT-B -var zfwcg = props.globals.getNode("/FMGC/internal/zfwcg", 1); -var zfwcgSet = props.globals.getNode("/FMGC/internal/zfwcg-set", 1); -var zfw = props.globals.getNode("/FMGC/internal/zfw", 1); -var zfwSet = props.globals.getNode("/FMGC/internal/zfw-set", 1); -var block = props.globals.getNode("/FMGC/internal/block", 1); -var blockSet = props.globals.getNode("/FMGC/internal/block-set", 1); -var taxi_fuel = props.globals.getNode("/FMGC/internal/taxi-fuel", 1); -var trip_fuel = props.globals.getNode("/FMGC/internal/trip-fuel", 1); -var trip_time = props.globals.getNode("/FMGC/internal/trip-time", 1); -var rte_rsv = props.globals.getNode("/FMGC/internal/rte-rsv", 1); -var rte_rsv_set = props.globals.getNode("/FMGC/internal/rte-rsv-set", 1); -var rte_percent = props.globals.getNode("/FMGC/internal/rte-percent", 1); -var rte_percent_set = props.globals.getNode("/FMGC/internal/rte-percent-set", 1); -var alt_fuel = props.globals.getNode("/FMGC/internal/alt-fuel", 1); -var alt_time = props.globals.getNode("/FMGC/internal/alt-time", 1); -var final_fuel = props.globals.getNode("/FMGC/internal/final-fuel", 1); -var final_time = props.globals.getNode("/FMGC/internal/final-time", 1); -var min_dest_fob = props.globals.getNode("/FMGC/internal/min-dest-fob", 1); -var tow = props.globals.getNode("/FMGC/internal/tow", 1); -var lw = props.globals.getNode("/FMGC/internal/lw", 1); -var trip_wind = props.globals.getNode("/FMGC/internal/trip-wind", 1); -var trip_wind_value = props.globals.getNode("/FMGC/internal/trip-wind-value", 1); -var extra_fuel = props.globals.getNode("/FMGC/internal/extra-fuel", 1); -var extra_time = props.globals.getNode("/FMGC/internal/extra-time", 1); -var taxi_fuel_set = props.globals.getNode("/FMGC/internal/taxi-fuel-set", 1); -var rte_set = props.globals.getNode("/FMGC/internal/rte-set", 1); -var alt_fuel_set = props.globals.getNode("/FMGC/internal/alt-fuel-set", 1); -var final_fuel_set = props.globals.getNode("/FMGC/internal/final-fuel-set", 1); -var final_time_set = props.globals.getNode("/FMGC/internal/final-time-set", 1); -var min_dest_fob_set = props.globals.getNode("/FMGC/internal/min-dest-fob-set", 1); # FUELPRED var state1 = props.globals.getNode("/engines/engine[0]/state", 1); var state2 = props.globals.getNode("/engines/engine[1]/state", 1); var engrdy = props.globals.getNode("/engines/ready", 1); -var pri_utc = props.globals.getNode("/FMGC/internal/pri-utc", 1); -var alt_utc = props.globals.getNode("/FMGC/internal/alt-utc", 1); -var pri_efob = props.globals.getNode("/FMGC/internal/pri-efob", 1); -var alt_efob = props.globals.getNode("/FMGC/internal/alt-efob", 1); -var fob = props.globals.getNode("/FMGC/internal/fob", 1); -var fffq_sensor = props.globals.getNode("/FMGC/internal/fffq-sensor", 1); -var gw = props.globals.getNode("/FMGC/internal/fuel-pred-gw", 1); -var cg = props.globals.getNode("/FMGC/internal/cg", 1); # PERF var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1); @@ -2283,7 +2245,7 @@ var canvas_MCDU_base = { } me["Simple_L1S"].setText("TAXI"); - me["Simple_L1"].setText(sprintf("%2.1f", taxi_fuel.getValue())); + me["Simple_L1"].setText(sprintf("%2.1f", fmgc.FMGCInternal.taxiFuel)); me["Simple_L2S"].setText("TRIP/TIME"); me["Simple_L3S"].setText("RTE RSV/PCT"); me["Simple_L4S"].setText("ALTN/TIME"); @@ -2292,7 +2254,7 @@ var canvas_MCDU_base = { me["Simple_R2S"].setText("BLOCK"); me["Simple_R4S"].setText("TOW/ LW"); me["Simple_R5S"].setText("TRIP WIND"); - me["Simple_R5"].setText(trip_wind.getValue()); + me["Simple_R5"].setText(fmgc.FMGCInternal.tripWind); me["Simple_R6S"].setText("EXTRA/TIME"); me["Simple_Title"].setColor(1, 1, 1); @@ -2300,21 +2262,21 @@ var canvas_MCDU_base = { if (!getprop("/FMGC/internal/fuel-request-set")) { me["Simple_L2"].setText("---.-/----"); me["Simple_L3"].setText("---.-"); - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); me["Simple_L4"].setText("---.-/----"); me["Simple_C4"].hide(); me["Simple_L5"].setText("---.-"); - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); me["Simple_L6"].setText("---.-"); - if (blockSet.getValue() == 1) { + if (fmgc.FMGCInternal.blockSet) { me["Simple_R2"].show(); me["INITB_Block"].hide(); - me["Simple_R2"].setText(sprintf("%3.1f", block.getValue())); + me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block)); } else { me["Simple_R2"].hide(); me["INITB_Block"].show(); } - if (zfwSet.getValue() == 1) { + if (fmgc.FMGCInternal.zfwSet) { me["Simple_R3S"].show(); me["Simple_R3"].show(); me["Simple_R3S"].setText("FUEL"); @@ -2343,11 +2305,11 @@ var canvas_MCDU_base = { if (getprop("/FMGC/internal/block-calculating")) { me["Simple_L2"].setText("---.-/----"); me["Simple_L3"].setText("---.-"); - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); me["Simple_L4"].setText("---.-/----"); me["Simple_C4"].hide(); me["Simple_L5"].setText("---.-"); - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); me["Simple_L6"].setText("---.-"); me["Simple_R2"].show(); me["Simple_R2"].setText("---.-"); @@ -2369,15 +2331,15 @@ var canvas_MCDU_base = { if (!getprop("/FMGC/internal/block-confirmed")) { me["Simple_L2"].setText("---.-/----"); me["Simple_L3"].setText("---.-"); - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); me["Simple_L4"].setText("---.-/----"); me["Simple_C4"].hide(); me["Simple_L5"].setText("---.-"); - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); me["Simple_L6"].setText("---.-"); me["Simple_R2"].show(); me["INITB_Block"].hide(); - me["Simple_R2"].setText(sprintf("%3.1f", block.getValue())); + me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block)); me["Simple_R3S"].show(); me["Simple_R3"].show(); me["Simple_R3S"].setText("BLOCK"); @@ -2385,10 +2347,10 @@ var canvas_MCDU_base = { me["Simple_R3_Arrow"].show(); me["Simple_R3_Arrow"].setColor(AMBER); me["Simple_C4B"].show(); - if (num(tow.getValue()) >= 100.0) { - me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue())); + if (num(fmgc.FMGCInternal.tow) >= 100.0) { + me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow)); } else { - me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue())); + me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow)); } me["Simple_R4"].setText("---.-"); me["Simple_R6"].setText("---.-/----"); @@ -2400,37 +2362,37 @@ var canvas_MCDU_base = { if (getprop("/FMGC/internal/fuel-calculating")) { me["Simple_L2"].setText("---.-/----"); me["Simple_L3"].setText("---.-"); - if (rte_rsv_set.getValue() == 1) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (rte_percent_set.getValue() == 1) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + if (fmgc.FMGCInternal.rteRsvSet) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (fmgc.FMGCInternal.rtePercentSet) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } me["Simple_L4"].setText("---.-/----"); me["Simple_C4"].hide(); me["Simple_L5"].setText("---.-"); - if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); - } else if (final_fuel_set.getValue() == 1) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); - } else if (final_time_set.getValue() == 1) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); + } else if (fmgc.FMGCInternal.finalFuelSet) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); + } else if (fmgc.FMGCInternal.finalTimeSet) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } me["Simple_L6"].setText("---.-"); me["Simple_R2"].show(); me["INITB_Block"].hide(); - me["Simple_R2"].setText(sprintf("%3.1f", block.getValue())); + me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block)); me["Simple_R3S"].hide(); me["Simple_R3"].hide(); me["Simple_R3_Arrow"].hide(); me["Simple_C4B"].show(); - if (num(tow.getValue()) >= 100.0) { - me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue())); + if (num(fmgc.FMGCInternal.tow) >= 100.0) { + me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow)); } else { - me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue())); + me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow)); } me["Simple_R4"].setText("---.-"); me["Simple_R6"].setText("---.-/----"); @@ -2438,54 +2400,54 @@ var canvas_MCDU_base = { me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht"); me.colorRight("ack", "blu", "ack", "wht", "ack", "wht"); } else { - me["Simple_L2"].setText(sprintf("%.1f/" ~ trip_time.getValue(), trip_fuel.getValue())); - me["Simple_L3"].setText(sprintf("%.1f", rte_rsv.getValue())); - if (rte_rsv_set.getValue() == 1) { - if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_rsv.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_percent.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_L2"].setText(sprintf("%.1f/" ~ fmgc.FMGCInternal.tripTime, fmgc.FMGCInternal.tripFuel)); + me["Simple_L3"].setText(sprintf("%.1f", fmgc.FMGCInternal.rteRsv)); + if (fmgc.FMGCInternal.rteRsvSet) { + if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } - } else if (rte_percent_set.getValue() == 1) { - if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_rsv.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_percent.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + } else if (fmgc.FMGCInternal.rtePercentSet) { + if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } } else { - if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_rsv.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_percent.getValue()) > 9.9) { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } } if (fmgc.FMGCInternal.altAirportSet) { - me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); + me["Simple_L4"].setText(sprintf("%.1f", fmgc.FMGCInternal.altFuel)); me["Simple_L4"].setColor(BLUE); me["Simple_C4"].show(); - if (alt_fuel_set.getValue() == 1) { - if (num(alt_fuel.getValue()) > 9.9) { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + if (fmgc.FMGCInternal.altFuelSet) { + if (num(fmgc.FMGCInternal.altFuel) > 9.9) { + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } else { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } } else { - if (num(alt_fuel.getValue()) > 9.9) { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + if (num(fmgc.FMGCInternal.altFuel) > 9.9) { + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } else { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } } } else { @@ -2493,42 +2455,42 @@ var canvas_MCDU_base = { me["Simple_L4"].setColor(WHITE); me["Simple_C4"].hide(); } - me["Simple_L5"].setText(sprintf("%.1f", final_fuel.getValue())); - if (final_time_set.getValue() == 1 and final_fuel_set.getValue() == 1) { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_L5"].setText(sprintf("%.1f", fmgc.FMGCInternal.finalFuel)); + if (fmgc.FMGCInternal.finalTimeSet and fmgc.FMGCInternal.finalFuelSet) { + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } - } else if (final_time_set.getValue() == 1) { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + } else if (fmgc.FMGCInternal.finalTimeSet) { + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } - } else if (final_fuel_set.getValue() == 1) { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + } else if (fmgc.FMGCInternal.finalFuelSet) { + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } } else { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } } - me["Simple_L6"].setText(sprintf("%.1f", min_dest_fob.getValue())); + me["Simple_L6"].setText(sprintf("%.1f", fmgc.FMGCInternal.minDestFob)); me["Simple_R2"].show(); me["INITB_Block"].hide(); - me["Simple_R2"].setText(sprintf("%3.1f", block.getValue())); + me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block)); me["Simple_R3S"].hide(); me["Simple_R3"].hide(); me["Simple_R3_Arrow"].hide(); me["Simple_C4B"].hide(); - me["Simple_R4"].setText(sprintf("%4.1f/", tow.getValue()) ~ sprintf("%4.1f", lw.getValue())); - me["Simple_R6"].setText(sprintf("%.1f/" ~ extra_time.getValue(), extra_fuel.getValue())); + me["Simple_R4"].setText(sprintf("%4.1f/", fmgc.FMGCInternal.tow) ~ sprintf("%4.1f", fmgc.FMGCInternal.lw)); + me["Simple_R6"].setText(sprintf("%.1f/" ~ fmgc.FMGCInternal.extraTime, fmgc.FMGCInternal.extraFuel)); me.colorLeft("ack", "grn", "blu", "ack", "blu", "blu"); me.colorRight("ack", "blu", "ack", "grn", "ack", "grn"); @@ -2538,21 +2500,21 @@ var canvas_MCDU_base = { } me["Simple_R1S"].setText("ZFW/ZFWCG"); - me["Simple_R1"].setText(sprintf("%3.1f", zfwcg.getValue())); + me["Simple_R1"].setText(sprintf("%3.1f", fmgc.FMGCInternal.zfwcg)); me["INITB_ZFWCG"].hide(); me["INITB_ZFWCG_S"].show(); me["Simple_R1"].show(); - if (zfwcgSet.getValue() == 1) { + if (fmgc.FMGCInternal.zfwcgSet) { me["Simple_R1"].setFontSize(normal); } else { me["Simple_R1"].setFontSize(small); } - if (zfwSet.getValue() == 1) { - if (zfw.getValue() < 100) { - me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + if (fmgc.FMGCInternal.zfwSet) { + if (fmgc.FMGCInternal.zfw < 100) { + me["Simple_C1"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw)); } else { - me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + me["Simple_C1"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw)); } me["Simple_C1"].show(); me["INITB_ZFW"].hide(); @@ -2561,16 +2523,16 @@ var canvas_MCDU_base = { me["INITB_ZFW"].show(); } - if (taxi_fuel_set.getValue() == 1) { + if (fmgc.FMGCInternal.taxiFuelSet) { me["Simple_L1"].setFontSize(normal); } else { me["Simple_L1"].setFontSize(small); } - if (rte_rsv_set.getValue() == 1) { + if (fmgc.FMGCInternal.rteRsvSet) { me["Simple_L3"].setFontSize(normal); me["Simple_C3"].setFontSize(small); - } else if (rte_percent_set.getValue() == 1) { + } else if (fmgc.FMGCInternal.rtePercentSet) { me["Simple_L3"].setFontSize(small); me["Simple_C3"].setFontSize(normal); } else { @@ -2578,19 +2540,19 @@ var canvas_MCDU_base = { me["Simple_C3"].setFontSize(small); } - if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) { + if (fmgc.FMGCInternal.altFuelSet and fmgc.FMGCInternal.crzSet) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); } - if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) { + if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) { me["Simple_L5"].setFontSize(normal); me["Simple_C5"].setFontSize(normal); - } else if (final_fuel_set.getValue() == 1) { + } else if (fmgc.FMGCInternal.finalFuelSet) { me["Simple_L5"].setFontSize(normal); me["Simple_C5"].setFontSize(small); - } else if (final_time_set.getValue() == 1) { + } else if (fmgc.FMGCInternal.finalTimeSet) { me["Simple_L5"].setFontSize(small); me["Simple_C5"].setFontSize(normal); } else { @@ -2598,7 +2560,7 @@ var canvas_MCDU_base = { me["Simple_C5"].setFontSize(small); } - if (min_dest_fob_set.getValue() == 1) { + if (fmgc.FMGCInternal.minDestFobSet) { me["Simple_L6"].setFontSize(normal); } else { me["Simple_L6"].setFontSize(small); @@ -2694,20 +2656,20 @@ var canvas_MCDU_base = { if (!getprop("/FMGC/internal/fuel-request-set") or !getprop("/FMGC/internal/block-confirmed") or getprop("/FMGC/internal/fuel-calculating")) { me["Simple_L3"].setText("---.-"); - if (rte_rsv_set.getValue() == 1) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (rte_percent_set.getValue() == 1) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + if (fmgc.FMGCInternal.rteRsvSet) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (fmgc.FMGCInternal.rtePercentSet) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } me["Simple_L4"].setText("---.-/----"); me["Simple_C4"].hide(); me["Simple_L5"].setText("---.-"); - if (final_fuel_set.getValue() == 1 or final_time_set.getValue() == 1) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + if (fmgc.FMGCInternal.finalFuelSet or fmgc.FMGCInternal.finalTimeSet) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } me["Simple_L6"].setText("---.-"); @@ -2718,53 +2680,53 @@ var canvas_MCDU_base = { me.colorLeft("ack", "ack", "wht", "wht", "wht", "wht"); me.colorRight("ack", "ack", "ack", "wht", "wht", "wht"); } else { - me["Simple_L3"].setText(sprintf("%.1f", rte_rsv.getValue())); - if (rte_rsv_set.getValue() == 1) { - if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_rsv.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_percent.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_L3"].setText(sprintf("%.1f", fmgc.FMGCInternal.rteRsv)); + if (fmgc.FMGCInternal.rteRsvSet) { + if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } - } else if (rte_percent_set.getValue() == 1) { - if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_rsv.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_percent.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + } else if (fmgc.FMGCInternal.rtePercentSet) { + if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } } else { - if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_rsv.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); - } else if (num(rte_percent.getValue()) > 9.9) { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); + } else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) { + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } else { - me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); + me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent)); } } if (fmgc.FMGCInternal.altAirportSet) { - me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); + me["Simple_L4"].setText(sprintf("%.1f", fmgc.FMGCInternal.altFuel)); me["Simple_L4"].setColor(BLUE); me["Simple_C4"].show(); - if (alt_fuel_set.getValue() == 1) { - if (num(alt_fuel.getValue()) > 9.9) { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + if (fmgc.FMGCInternal.altFuelSet) { + if (num(fmgc.FMGCInternal.altFuel) > 9.9) { + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } else { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } } else { - if (num(alt_fuel.getValue()) > 9.9) { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + if (num(fmgc.FMGCInternal.altFuel) > 9.9) { + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } else { - me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue())); + me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime)); } } } else { @@ -2772,61 +2734,61 @@ var canvas_MCDU_base = { me["Simple_L4"].setColor(WHITE); me["Simple_C4"].hide(); } - me["Simple_L5"].setText(sprintf("%.1f", final_fuel.getValue())); - if (final_time_set.getValue() == 1 and final_fuel_set.getValue() == 1) { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_L5"].setText(sprintf("%.1f", fmgc.FMGCInternal.finalFuel)); + if (fmgc.FMGCInternal.finalTimeSet and fmgc.FMGCInternal.finalFuelSet) { + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } - } else if (final_time_set.getValue() == 1) { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + } else if (fmgc.FMGCInternal.finalTimeSet) { + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } - } else if (final_fuel_set.getValue() == 1) { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + } else if (fmgc.FMGCInternal.finalFuelSet) { + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } } else { - if (num(final_fuel.getValue()) > 9.9) { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + if (num(fmgc.FMGCInternal.finalFuel) > 9.9) { + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } else { - me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue())); + me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime)); } } - me["Simple_L6"].setText(sprintf("%.1f", min_dest_fob.getValue())); + me["Simple_L6"].setText(sprintf("%.1f", fmgc.FMGCInternal.minDestFob)); - setprop("/FMGC/internal/fob", num(getprop("/consumables/fuel/total-fuel-lbs") / 1000)); - setprop("/FMGC/internal/fuel-pred-gw", num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000)); - setprop("/FMGC/internal/cg", num(getprop("/FMGC/internal/zfwcg"))); - me["Simple_R4"].setText(sprintf("%4.1f/" ~ fffq_sensor.getValue(), fob.getValue())); - me["Simple_R5"].setText(sprintf("%4.1f/", gw.getValue()) ~ sprintf("%4.1f", cg.getValue())); - me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue())); + fmgc.FMGCInternal.fob = num(getprop("/consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.fuelPredGw = num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000); + fmgc.FMGCInternal.cg = num(getprop("/FMGC/internal/zfwcg")); + me["Simple_R4"].setText(sprintf("%4.1f/" ~ fmgc.FMGCInternal.fffqSensor, fmgc.FMGCInternal.fob)); + me["Simple_R5"].setText(sprintf("%4.1f/", fmgc.FMGCInternal.fuelPredGw) ~ sprintf("%4.1f", fmgc.FMGCInternal.cg)); + me["Simple_R6"].setText(sprintf("%4.1f/" ~ fmgc.FMGCInternal.extraTime, fmgc.FMGCInternal.extraFuel)); me.colorLeft("ack", "ack", "blu", "ack", "blu", "blu"); me.colorRight("ack", "ack", "blu", "grn", "grn", "grn"); } me["Simple_R3S"].setText("ZFW/ZFWCG"); - me["Simple_R3"].setText(sprintf("%3.1f", zfwcg.getValue())); + me["Simple_R3"].setText(sprintf("%3.1f", fmgc.FMGCInternal.zfwcg)); me["Simple_R3"].show(); me["FUELPRED_ZFWCG"].hide(); me["FUELPRED_ZFWCG_S"].show(); - if (zfwcgSet.getValue() == 1) { + if (fmgc.FMGCInternal.zfwcgSet) { me["Simple_R3"].setFontSize(normal); } else { me["Simple_R3"].setFontSize(small); } - if (zfwSet.getValue() == 1) { - if (zfw.getValue() < 100) { - me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + if (fmgc.FMGCInternal.zfwSet) { + if (fmgc.FMGCInternal.zfw < 100) { + me["Simple_C3"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw)); } else { - me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + me["Simple_C3"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw)); } me["Simple_C3"].show(); me["FUELPRED_ZFW"].hide(); @@ -2835,10 +2797,10 @@ var canvas_MCDU_base = { me["FUELPRED_ZFW"].show(); } - if (rte_rsv_set.getValue() == 1) { + if (fmgc.FMGCInternal.rteRsvSet) { me["Simple_L3"].setFontSize(normal); me["Simple_C3B"].setFontSize(small); - } else if (rte_percent_set.getValue() == 1) { + } else if (fmgc.FMGCInternal.rtePercentSet) { me["Simple_L3"].setFontSize(small); me["Simple_C3B"].setFontSize(normal); } else { @@ -2846,19 +2808,19 @@ var canvas_MCDU_base = { me["Simple_C3B"].setFontSize(small); } - if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) { + if (fmgc.FMGCInternal.altFuelSet and fmgc.FMGCInternal.crzSet == 1) { me["Simple_L4"].setFontSize(normal); } else { me["Simple_L4"].setFontSize(small); } - if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) { + if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) { me["Simple_L5"].setFontSize(normal); me["Simple_C5"].setFontSize(normal); - } else if (final_fuel_set.getValue() == 1) { + } else if (fmgc.FMGCInternal.finalFuelSet) { me["Simple_L5"].setFontSize(normal); me["Simple_C5"].setFontSize(small); - } else if (final_time_set.getValue() == 1) { + } else if (fmgc.FMGCInternal.finalTimeSet) { me["Simple_L5"].setFontSize(small); me["Simple_C5"].setFontSize(normal); } else { @@ -2866,7 +2828,7 @@ var canvas_MCDU_base = { me["Simple_C5"].setFontSize(small); } - if (min_dest_fob_set.getValue() == 1) { + if (fmgc.FMGCInternal.minDestFobSet) { me["Simple_L6"].setFontSize(normal); } else { me["Simple_L6"].setFontSize(small); @@ -3179,7 +3141,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setFontSize(small); } - if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) { + if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) { me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_to"))); me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_to"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_to"))); @@ -3792,7 +3754,7 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("PHASE "); me["Simple_L5S"].setText(" VAPP"); - if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) { + if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) { me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr"))); me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); @@ -3891,7 +3853,7 @@ var canvas_MCDU_base = { me["Simple_R5"].setText(sprintf("%3.0f", engOutAcc.getValue())); me["Simple_R5S"].setText("ENG OUT ACC"); - if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) { + if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) { me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr"))); me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 3b8e07b2..2431541e 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -179,6 +179,47 @@ var FMGCInternal = { tropo: 36090, tropoSet: 0, toFromSet: 0, + + # INIT B + zfw: 0, + zfwSet: 0, + zfwcg: 25.0, + zfwcgSet: 0, + block: 0.0, + blockSet: 0, + taxiFuel: 0.4, + taxiFuelSet: 0, + tripFuel: 0, + tripTime: "0000", + rteRsv: 0, + rteRsvSet: 0, + rtePercent: 5.0, + rtePercentSet: 0, + altFuel: 0, + altFuelSet: 0, + altTime: "0000", + finalFuel: 0, + finalFuelSet: 0, + finalTime: "0030", + finalTimeSet: 0, + minDestFob: 0, + minDestFobSet: 0, + tow: 0, + lw: 0, + tripWind: "HD000", + tripWindValue: 0, + fffqSensor: "FF+FQ", + extraFuel: 0, + extraTime: "0000", + + # FUELPRED + priUtc: "0000", + altUtc: "0000", + priEfob: 0, + altEfob: 0, + fob: 0, + fuelPredGw: 0, + cg: 0, }; var postInit = func() { @@ -238,13 +279,13 @@ updateRouteManagerAlt = func() { var updateFuel = func { # Check engine status if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { - setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1))); + FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)); } # Calculate (final) holding fuel - if (getprop("/FMGC/internal/final-fuel-set")) { - final_fuel = 1000 * getprop("/FMGC/internal/final-fuel"); - zfw = 1000 * getprop("/FMGC/internal/zfw"); + if (FMGCInternal.finalFuelSet) { + final_fuel = 1000 * FMGCInternal.finalFuel; + zfw = 1000 * FMGCInternal.zfw; final_time = final_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines if (final_time < 0) { final_time = 0; @@ -254,35 +295,35 @@ var updateFuel = func { if (num(final_time) >= 60) { final_min = int(math.mod(final_time, 60)); final_hour = int((final_time - final_min) / 60); - setprop("/FMGC/internal/final-time", sprintf("%02d", final_hour) ~ sprintf("%02d", final_min)); + FMGCInternal.finalTime = sprintf("%02d", final_hour) ~ sprintf("%02d", final_min); } else { - setprop("/FMGC/internal/final-time", sprintf("%04d", final_time)); + FMGCInternal.finalTime = sprintf("%04d", final_time); } } else { - if (!getprop("/FMGC/internal/final-time-set")) { - setprop("/FMGC/internal/final-time", "0030"); + if (!FMGCInternal.finalTimeSet) { + FMGCInternal.finalTime = "0030"; } - final_time = int(getprop("/FMGC/internal/final-time")); + final_time = int(FMGCInternal.finalTime); if (final_time >= 100) { final_time = final_time - 100 + 60; # can't be set above 90 (0130) } - zfw = 1000 * getprop("/FMGC/internal/zfw"); + zfw = 1000 * FMGCInternal.zfw; final_fuel = final_time * 2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903); # x2 for 2 engines if (final_fuel < 0) { final_fuel = 0; } else if (final_fuel > 80000) { final_fuel = 80000; } - setprop("/FMGC/internal/final-fuel", final_fuel / 1000); + FMGCInternal.finalFuel = final_fuel / 1000; } # Calculate alternate fuel - if (!getprop("/FMGC/internal/alt-fuel-set") and fmgc.FMGCInternal.altAirportSet) { + if (!FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) { #calc - } else if (getprop("/FMGC/internal/alt-fuel-set") and fmgc.FMGCInternal.altAirportSet) { + } else if (FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) { #dummy calc for now - alt_fuel = 1000 * num(getprop("/FMGC/internal/alt-fuel")); - zfw = 1000 * getprop("/FMGC/internal/zfw"); + alt_fuel = 1000 * num(FMGCInternal.altFuel); + zfw = 1000 * FMGCInternal.zfw; alt_time = alt_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines if (alt_time < 0) { alt_time = 0; @@ -292,32 +333,32 @@ var updateFuel = func { if (num(alt_time) >= 60) { alt_min = int(math.mod(alt_time, 60)); alt_hour = int((alt_time - alt_min) / 60); - setprop("/FMGC/internal/alt-time", sprintf("%02d", alt_hour) ~ sprintf("%02d", alt_min)); + FMGCInternal.altTime = sprintf("%02d", alt_hour) ~ sprintf("%02d", alt_min); } else { - setprop("/FMGC/internal/alt-time", sprintf("%04d", alt_time)); + FMGCInternal.altTime = sprintf("%04d", alt_time); } - } else if (!getprop("/FMGC/internal/alt-fuel-set")) { - setprop("/FMGC/internal/alt-fuel", 0.0); - setprop("/FMGC/internal/alt-time", "0000"); + } else if (!FMGCInternal.altFuelSet) { + FMGCInternal.altFuel = 0.0; + FMGCInternal.altTime = "0000"; } # Calculate min dest fob (final + alternate) - if (!getprop("/FMGC/internal/min-dest-fob-set")) { - setprop("/FMGC/internal/min-dest-fob", num(getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel"))); + if (!FMGCInternal.minDestFobSet) { + FMGCInternal.minDestFob = num(FMGCInternal.altFuel + FMGCInternal.finalFuel); } - if (getprop("/FMGC/internal/zfw-set")) { - setprop("/FMGC/internal/lw", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel"))); + if (FMGCInternal.zfwSet) { + FMGCInternal.lw = num(FMGCInternal.zfw + FMGCInternal.altFuel + FMGCInternal.finalFuel); } # Calculate trip fuel - if (FMGCInternal.toFromSet and FMGCInternal.crzSet and FMGCInternal.crzTempSet and getprop("/FMGC/internal/zfw-set")) { + if (FMGCInternal.toFromSet and FMGCInternal.crzSet and FMGCInternal.crzTempSet and FMGCInternal.zfwSet) { crz = FMGCInternal.crzFl; temp = FMGCInternal.crzTemp; dist = flightPlanController.arrivalDist; - trpWind = getprop("/FMGC/internal/trip-wind"); - wind_value = getprop("/FMGC/internal/trip-wind-value"); + trpWind = FMGCInternal.tripWind; + wind_value = FMGCInternal.tripWindValue; if (find("HD", trpWind) != -1 or find("-", trpWind) != -1 or find("H", trpWind) != -1) { wind_value = wind_value * -1; } @@ -349,54 +390,54 @@ var updateFuel = func { # trip_fuel = trip_fuel * 1.02; #} - zfw = getprop("/FMGC/internal/zfw"); + zfw = FMGCInternal.zfw; landing_weight_correction = 9.951e+00 + (dist*-2.064e+00) + (dist*dist*2.030e-03) + (dist*dist*dist*8.179e-08) + (dist*dist*dist*dist*-3.941e-11) + (dist*dist*dist*dist*dist*2.443e-15) + (crz*2.771e+00) + (dist*crz*3.067e-02) + (dist*dist*crz*-1.861e-05) + (dist*dist*dist*crz*2.516e-10) + (dist*dist*dist*dist*crz*5.452e-14) + (crz*crz*-4.483e-02) + (dist*crz*crz*-1.645e-04) + (dist*dist*crz*crz*5.212e-08) + (dist*dist*dist*crz*crz*-8.721e-13) + (crz*crz*crz*2.609e-04) + (dist*crz*crz*crz*3.898e-07) + (dist*dist*crz*crz*crz*-4.617e-11) + (crz*crz*crz*crz*-6.488e-07) + (dist*crz*crz*crz*crz*-3.390e-10) + (crz*crz*crz*crz*crz*5.835e-10); - trip_fuel = trip_fuel + (landing_weight_correction * (getprop("/FMGC/internal/lw") * 1000 - 121254.24421) / 2204.622622); + trip_fuel = trip_fuel + (landing_weight_correction * (FMGCInternal.lw * 1000 - 121254.24421) / 2204.622622); if (trip_fuel < 400) { trip_fuel = 400; } else if (trip_fuel > 80000) { trip_fuel = 80000; } - setprop("/FMGC/internal/trip-fuel", trip_fuel / 1000); + FMGCInternal.tripFuel = trip_fuel / 1000; if (num(trip_time) >= 60) { trip_min = int(math.mod(trip_time, 60)); trip_hour = int((trip_time - trip_min) / 60); - setprop("/FMGC/internal/trip-time", sprintf("%02d", trip_hour) ~ sprintf("%02d", trip_min)); + FMGCInternal.tripTime = sprintf("%02d", trip_hour) ~ sprintf("%02d", trip_min); } else { - setprop("/FMGC/internal/trip-time", sprintf("%04d", trip_time)); + FMGCInternal.tripTime = sprintf("%04d", trip_time); } } else { - setprop("/FMGC/internal/trip-fuel", 0.0); - setprop("/FMGC/internal/trip-time", "0000"); + FMGCInternal.tripFuel = 0.0; + FMGCInternal.tripTime = "0000"; } # Calculate reserve fuel - if (getprop("/FMGC/internal/rte-rsv-set")) { - if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) { - setprop("/FMGC/internal/rte-percent", 0.0); + if (FMGCInternal.rteRsvSet) { + if (num(FMGCInternal.tripFuel) == 0.0) { + FMGCInternal.rtePercent = 0.0; } else { - if (num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0) <= 15.0) { - setprop("/FMGC/internal/rte-percent", num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0)); + if (num(FMGCInternal.rteRsv / FMGCInternal.tripFuel * 100.0) <= 15.0) { + FMGCInternal.rtePercent = num(FMGCInternal.rteRsv / FMGCInternal.tripFuel * 100.0); } else { - setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value + FMGCInternal.rtePercent = 15.0; # need reasearch on this value } } - } else if (getprop("/FMGC/internal/rte-percent-set")) { - setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0)); + } else if (FMGCInternal.rtePercentSet) { + FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0); } else { - if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) { - setprop("/FMGC/internal/rte-percent", 5.0); + if (num(FMGCInternal.tripFuel) == 0.0) { + FMGCInternal.rtePercent = 5.0; } else { - setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0)); + FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0); } } # Calcualte extra fuel - if (getprop("/FMGC/internal/block-set")) { - extra_fuel = 1000 * num(getprop("/FMGC/internal/block") - getprop("/FMGC/internal/trip-fuel") - getprop("/FMGC/internal/min-dest-fob") - getprop("/FMGC/internal/taxi-fuel") - getprop("/FMGC/internal/rte-rsv")); - setprop("/FMGC/internal/extra-fuel", extra_fuel / 1000); - lw = 1000 * getprop("/FMGC/internal/lw"); + if (FMGCInternal.blockSet) { + extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); + FMGCInternal.extraFuel = extra_fuel / 1000; + lw = 1000 * FMGCInternal.lw; extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines if (extra_time < 0) { extra_time = 0; @@ -406,19 +447,19 @@ var updateFuel = func { if (num(extra_time) >= 60) { extra_min = int(math.mod(extra_time, 60)); extra_hour = int((extra_time - extra_min) / 60); - setprop("/FMGC/internal/extra-time", sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min)); + FMGCInternal.extraTime = sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min); } else { - setprop("/FMGC/internal/extra-time", sprintf("%04d", extra_time)); + FMGCInternal.extraTime = sprintf("%04d", extra_time); } - if (getprop("/FMGC/internal/extra-fuel") > -0.1 and getprop("/FMGC/internal/extra-fuel") < 0.1) { - setprop("/FMGC/internal/extra-fuel", 0.0); + if (FMGCInternal.extraFuel > -0.1 and FMGCInternal.extraFuel < 0.1) { + FMGCInternal.extraFuel = 0.0; } } else { - setprop("/FMGC/internal/block", num(getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/trip-fuel") + getprop("/FMGC/internal/rte-rsv") + getprop("/FMGC/internal/taxi-fuel"))); - setprop("/FMGC/internal/block-set", 1); + FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel); + FMGCInternal.blockSet = 1; } - setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); + FMGCInternal.tow = num(FMGCInternal.zfw + FMGCInternal.block - FMGCInternal.taxiFuel); } ############################ diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index e70cd4a4..910b03ce 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -3,63 +3,38 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) # From INIT-B -var zfwcg = props.globals.getNode("FMGC/internal/zfwcg", 1); -var zfwcgSet = props.globals.getNode("FMGC/internal/zfwcg-set", 1); -var zfw = props.globals.getNode("FMGC/internal/zfw", 1); -var zfwSet = props.globals.getNode("FMGC/internal/zfw-set", 1); -var block = props.globals.getNode("FMGC/internal/block", 1); -var blockSet = props.globals.getNode("FMGC/internal/block-set", 1); -var taxi_fuel = props.globals.getNode("FMGC/internal/taxi-fuel", 1); -var trip_fuel = props.globals.getNode("FMGC/internal/trip-fuel", 1); -var trip_time = props.globals.getNode("FMGC/internal/trip-time", 1); -var rte_rsv = props.globals.getNode("FMGC/internal/rte-rsv", 1); -var rte_percent = props.globals.getNode("FMGC/internal/rte-percent", 1); -var alt_fuel = props.globals.getNode("FMGC/internal/alt-fuel", 1); -var alt_time = props.globals.getNode("FMGC/internal/alt-time", 1); -var final_fuel = props.globals.getNode("FMGC/internal/final-fuel", 1); -var final_time = props.globals.getNode("FMGC/internal/final-time", 1); -var min_dest_fob = props.globals.getNode("FMGC/internal/min-dest-fob", 1); -var tow = props.globals.getNode("FMGC/internal/tow", 1); -var lw = props.globals.getNode("FMGC/internal/lw", 1); -var trip_wind = props.globals.getNode("FMGC/internal/trip-wind", 1); -var trip_wind_value = props.globals.getNode("FMGC/internal/trip-wind", 1); -var fob = props.globals.getNode("FMGC/internal/fob", 1); -var fffq_sensor = props.globals.getNode("FMGC/internal/fffq-sensor", 1); -var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1); -var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1); - var fuelPredInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel"))); - setprop("/FMGC/internal/rte-rsv-set", 0); - setprop("/FMGC/internal/rte-percent", 5.0); - setprop("/FMGC/internal/rte-percent-set", 0); + fmgc.FMGCInternal.rteRsv = 0.05 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsvSet = 0; + fmgc.FMGCInternal.rtePercent = 5.0; + fmgc.FMGCInternal.rtePercentSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); - } else if (getprop("/FMGC/internal/trip-fuel") != 0) { + } else if (fmgc.FMGCInternal.tripFuel != 0) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { var perc = num(split("/", scratchpad)[1]); if (perc != nil and perc >= 0.0 and perc <= 15.0) { - setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel"))); - setprop("/FMGC/internal/rte-rsv-set", 0); - setprop("/FMGC/internal/rte-percent", perc); - setprop("/FMGC/internal/rte-percent-set", 1); + fmgc.FMGCInternal.rteRsv = num(perc) / 100 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsvSet = 0; + fmgc.FMGCInternal.rtePercent = perc; + fmgc.FMGCInternal.rtePercentSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { - setprop("/FMGC/internal/rte-rsv", scratchpad); - setprop("/FMGC/internal/rte-rsv-set", 1); - if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) { - setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100); + fmgc.FMGCInternal.rteRsv = scratchpad; + fmgc.FMGCInternal.rteRsvSet = 1; + if (scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100; } else { - setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value + fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value } - setprop("/FMGC/internal/rte-percent-set", 0); + fmgc.FMGCInternal.rtePercentSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -70,18 +45,18 @@ var fuelPredInput = func(key, i) { } } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/alt-fuel", 0.0); - setprop("/FMGC/internal/alt-time", "0000"); - setprop("/FMGC/internal/alt-fuel-set", 0); + fmgc.FMGCInternal.altFuel = 0.0; + fmgc.FMGCInternal.altTime = "0000"; + fmgc.FMGCInternal.altFuelSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) { - setprop("/FMGC/internal/alt-fuel", tf); - setprop("/FMGC/internal/alt-time", "0000"); - setprop("/FMGC/internal/alt-fuel-set", 1); + fmgc.FMGCInternal.altFuel = tf; + fmgc.FMGCInternal.altTime = "0000"; + fmgc.FMGCInternal.altFuelSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -92,18 +67,18 @@ var fuelPredInput = func(key, i) { } } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/final-fuel", 0.0); - setprop("/FMGC/internal/final-time", "0030"); - setprop("/FMGC/internal/final-fuel-set", 0); - setprop("/FMGC/internal/final-time-set", 0); + fmgc.FMGCInternal.finalFuel = 0.0; + fmgc.FMGCInternal.finalTime = "0030"; + fmgc.FMGCInternal.finalFuelSet = 0; + fmgc.FMGCInternal.finalTimeSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) { - setprop("/FMGC/internal/final-fuel", tf); - setprop("/FMGC/internal/final-fuel-set", 1); + fmgc.FMGCInternal.finalFuel = tf; + fmgc.FMGCInternal.finalFuelSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -113,8 +88,8 @@ var fuelPredInput = func(key, i) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { - setprop("/FMGC/internal/final-time", scratchpad); - setprop("/FMGC/internal/final-time-set", 1); + fmgc.FMGCInternal.finalTime = scratchpad; + fmgc.FMGCInternal.finalTimeSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -123,20 +98,20 @@ var fuelPredInput = func(key, i) { } } else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/min-dest-fob", 0); - setprop("/FMGC/internal/min-dest-fob-set", 0); + fmgc.FMGCInternal.minDestFob = 0; + fmgc.FMGCInternal.minDestFobSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) { - setprop("/FMGC/internal/min-dest-fob", tf); - setprop("/FMGC/internal/min-dest-fob-set", 1); + fmgc.FMGCInternal.minDestFob = tf; + fmgc.FMGCInternal.minDestFobSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); - if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) { - genericMessage(i, "CHECK MIN DEST FOB", "wht"); + if (num(fmgc.FMGCInternal.minDestFob) < num(fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel)) { + mcdu_message(i, "CHECK MIN DEST FOB"); } } else { mcdu_message(i, "NOT ALLOWED"); @@ -152,11 +127,11 @@ var fuelPredInput = func(key, i) { var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); - setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); - setprop("/FMGC/internal/zfw-set", 1); - if (getprop("/FMGC/internal/block-set") != 1) { - setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); - setprop("/FMGC/internal/block-set", 1); + fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1)); + fmgc.FMGCInternal.zfwSet = 1; + if (fmgc.FMGCInternal.blockSet != 1) { + fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -171,13 +146,13 @@ var fuelPredInput = func(key, i) { var zfwcgs = size(zfwi[1]); if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) { - setprop("/FMGC/internal/zfw", zfw); - setprop("/FMGC/internal/zfw-set", 1); - setprop("/FMGC/internal/zfwcg", zfwcg); - setprop("/FMGC/internal/zfwcg-set", 1); - if (getprop("/FMGC/internal/block-set") != 1) { - setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); - setprop("/FMGC/internal/block-set", 1); + fmgc.FMGCInternal.zfw = zfw; + fmgc.FMGCInternal.zfwSet = 1; + fmgc.FMGCInternal.zfwcg = zfwcg; + fmgc.FMGCInternal.zfwcgSet = 1; + if (fmgc.FMGCInternal.blockSet != 1) { + fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -189,8 +164,8 @@ var fuelPredInput = func(key, i) { } } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { if (zfwcg >= 8.0 and zfwcg <= 45.0) { - setprop("/FMGC/internal/zfwcg", zfwcg); - setprop("/FMGC/internal/zfwcg-set", 1); + fmgc.FMGCInternal.zfwcg = zfwcg; + fmgc.FMGCInternal.zfwcgSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); @@ -200,11 +175,11 @@ var fuelPredInput = func(key, i) { } } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) { if (scratchpad >= zfw_min and scratchpad <= zfw_max) { - setprop("/FMGC/internal/zfw", scratchpad); - setprop("/FMGC/internal/zfw-set", 1); - if (getprop("/FMGC/internal/block-set") != 1) { - setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); - setprop("/FMGC/internal/block-set", 1); + fmgc.FMGCInternal.zfw = scratchpad; + fmgc.FMGCInternal.zfwSet = 1; + if (fmgc.FMGCInternal.blockSet != 1) { + fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -227,12 +202,12 @@ var fuelPredInput = func(key, i) { } } else if (key == "R4") { if (scratchpad == "CLR") { - setprop("/FMGC/internal/fffq-sensor", "FF+FQ"); + fmgc.FMGCInternal.fffqSensor = "FF+FQ"; mcdu_scratchpad.scratchpads[i].empty(); } else if (find("/", scratchpad) == 0) { var sensor = substr(scratchpad, 1); if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") { - setprop("FMGC/internal/fffq-sensor", sensor); + fmgc.FMGCInternal.fffqSensor = sensor; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 9ac78db6..6cca70c8 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -6,8 +6,8 @@ var initInputB = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L1" and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/taxi-fuel", 0.4); - setprop("/FMGC/internal/taxi-fuel-set", 0); + fmgc.FMGCInternal.taxiFuel = 0.4; + fmgc.FMGCInternal.taxiFuelSet = 0; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } else if (getprop("/FMGC/internal/fuel-request-set")) { @@ -18,8 +18,8 @@ var initInputB = func(key, i) { var tfs = size(scratchpad); if (tfs >= 1 and tfs <= 4) { if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) { - setprop("/FMGC/internal/taxi-fuel", scratchpad); - setprop("/FMGC/internal/taxi-fuel-set", 1); + fmgc.FMGCInternal.taxiFuel = scratchpad; + fmgc.FMGCInternal.taxiFuelSet = 1; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } else if (getprop("/FMGC/internal/fuel-request-set")) { @@ -31,38 +31,38 @@ var initInputB = func(key, i) { } } else { mcdu_message(i, "NOT ALLOWED"); - } + } } } else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel"))); - setprop("/FMGC/internal/rte-rsv-set", 0); - setprop("/FMGC/internal/rte-percent", 5.0); - setprop("/FMGC/internal/rte-percent-set", 0); + fmgc.FMGCInternal.rteRsv = 0.05 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsvSet = 0; + fmgc.FMGCInternal.rtePercent = 5.0; + fmgc.FMGCInternal.rtePercentSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); - } else if (getprop("/FMGC/internal/trip-fuel") != 0) { + } else if (fmgc.FMGCInternal.tripFuel != 0) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { var perc = num(split("/", scratchpad)[1]); if (perc != nil and perc >= 0.0 and perc <= 15.0) { - setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel"))); - setprop("/FMGC/internal/rte-rsv-set", 0); - setprop("/FMGC/internal/rte-percent", perc); - setprop("/FMGC/internal/rte-percent-set", 1); + fmgc.FMGCInternal.rteRsv = num(perc) / 100 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsvSet = 0; + fmgc.FMGCInternal.rtePercent = perc; + fmgc.FMGCInternal.rtePercentSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { - setprop("/FMGC/internal/rte-rsv", scratchpad); - setprop("/FMGC/internal/rte-rsv-set", 1); - if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) { - setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100); + fmgc.FMGCInternal.rteRsv = scratchpad; + fmgc.FMGCInternal.rteRsvSet = 1; + if (scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100; } else { - setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value + fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value } - setprop("/FMGC/internal/rte-percent-set", 0); + fmgc.FMGCInternal.rtePercentSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -73,18 +73,18 @@ var initInputB = func(key, i) { } } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/alt-fuel", 0.0); - setprop("/FMGC/internal/alt-time", "0000"); - setprop("/FMGC/internal/alt-fuel-set", 0); + fmgc.FMGCInternal.altFuel = 0.0; + fmgc.FMGCInternal.altTime = "0000"; + fmgc.FMGCInternal.altFuelSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) { - setprop("/FMGC/internal/alt-fuel", tf); - setprop("/FMGC/internal/alt-time", "0000"); - setprop("/FMGC/internal/alt-fuel-set", 1); + fmgc.FMGCInternal.altFuel = tf; + fmgc.FMGCInternal.altTime = "0000"; + fmgc.FMGCInternal.altFuelSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -95,18 +95,18 @@ var initInputB = func(key, i) { } } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/final-fuel", 0.0); - setprop("/FMGC/internal/final-time", "0030"); - setprop("/FMGC/internal/final-fuel-set", 0); - setprop("/FMGC/internal/final-time-set", 0); + fmgc.FMGCInternal.finalFuel = 0.0; + fmgc.FMGCInternal.finalTime = "0030"; + fmgc.FMGCInternal.finalFuelSet = 0; + fmgc.FMGCInternal.finalTimeSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) { - setprop("/FMGC/internal/final-fuel", tf); - setprop("/FMGC/internal/final-fuel-set", 1); + fmgc.FMGCInternal.finalFuel = tf; + fmgc.FMGCInternal.finalFuelSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -116,8 +116,8 @@ var initInputB = func(key, i) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { - setprop("/FMGC/internal/final-time", scratchpad); - setprop("/FMGC/internal/final-time-set", 1); + fmgc.FMGCInternal.finalTime = scratchpad; + fmgc.FMGCInternal.finalTimeSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else { @@ -126,20 +126,20 @@ var initInputB = func(key, i) { } } else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/min-dest-fob", 0); - setprop("/FMGC/internal/min-dest-fob-set", 0); + fmgc.FMGCInternal.minDestFob = 0; + fmgc.FMGCInternal.minDestFobSet = 0; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (find(".", scratchpad) != -1) { var tf = num(scratchpad); var tfs = size(scratchpad); if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) { - setprop("/FMGC/internal/min-dest-fob", tf); - setprop("/FMGC/internal/min-dest-fob-set", 1); + fmgc.FMGCInternal.minDestFob = tf; + fmgc.FMGCInternal.minDestFobSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); - if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) { - genericMessage(i, "CHECK MIN DEST FOB", "wht"); + if (num(fmgc.FMGCInternal.minDestFob) < num(fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel)) { + mcdu_message(i, "CHECK MIN DEST FOB"); } } else { mcdu_message(i, "NOT ALLOWED"); @@ -155,11 +155,10 @@ var initInputB = func(key, i) { var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); - setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); - setprop("/FMGC/internal/zfw-set", 1); - if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) { - setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); - setprop("/FMGC/internal/tow-set", 1); + fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1)); + fmgc.FMGCInternal.zfwSet = 1; + if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { + fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -178,13 +177,12 @@ var initInputB = func(key, i) { var zfwcgs = size(zfwi[1]); if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) { - setprop("/FMGC/internal/zfw", zfw); - setprop("/FMGC/internal/zfw-set", 1); - setprop("/FMGC/internal/zfwcg", zfwcg); - setprop("/FMGC/internal/zfwcg-set", 1); - if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) { - setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); - setprop("/FMGC/internal/tow-set", 1); + fmgc.FMGCInternal.zfw = zfw; + fmgc.FMGCInternal.zfwSet = 1; + fmgc.FMGCInternal.zfwcg = zfwcg; + fmgc.FMGCInternal.zfwcgSet = 1; + if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { + fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -200,8 +198,8 @@ var initInputB = func(key, i) { } } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { if (zfwcg >= 8.0 and zfwcg <= 45.0) { - setprop("/FMGC/internal/zfwcg", zfwcg); - setprop("/FMGC/internal/zfwcg-set", 1); + fmgc.FMGCInternal.zfwcg = zfwcg; + fmgc.FMGCInternal.zfwcgSet = 1; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); @@ -211,11 +209,10 @@ var initInputB = func(key, i) { } } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) { if (scratchpad >= zfw_min and scratchpad <= zfw_max) { - setprop("/FMGC/internal/zfw", scratchpad); - setprop("/FMGC/internal/zfw-set", 1); - if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) { - setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); - setprop("/FMGC/internal/tow-set", 1); + fmgc.FMGCInternal.zfw = scratchpad; + fmgc.FMGCInternal.zfwSet = 1; + if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { + fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -242,32 +239,32 @@ var initInputB = func(key, i) { } } else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/block", 0.0); - setprop("/FMGC/internal/block-set", 0); - setprop("/FMGC/internal/taxi-fuel", 0.4); - setprop("/FMGC/internal/taxi-fuel-set", 0); - setprop("/FMGC/internal/trip-fuel", 0); - setprop("/FMGC/internal/trip-time", "0000"); - setprop("/FMGC/internal/rte-rsv", 0); - setprop("/FMGC/internal/rte-rsv-set", 0); - setprop("/FMGC/internal/rte-percent", 5.0); - setprop("/FMGC/internal/rte-percent-set", 0); - setprop("/FMGC/internal/alt-fuel", 0); - setprop("/FMGC/internal/alt-fuel-set", 0); - setprop("/FMGC/internal/alt-time", "0000"); - setprop("/FMGC/internal/final-fuel", 0); - setprop("/FMGC/internal/final-fuel-set", 0); - setprop("/FMGC/internal/final-time", "0030"); - setprop("/FMGC/internal/final-time-set", 0); - setprop("/FMGC/internal/min-dest-fob", 0); - setprop("/FMGC/internal/min-dest-fob-set", 0); - setprop("/FMGC/internal/tow", 0); - setprop("/FMGC/internal/lw", 0); - setprop("/FMGC/internal/trip-wind", "HD000"); - setprop("/FMGC/internal/trip-wind-value", 0); - setprop("/FMGC/internal/fffq-sensor", "FF+FQ"); - setprop("/FMGC/internal/extra-fuel", 0); - setprop("/FMGC/internal/extra-time", "0000"); + fmgc.FMGCInternal.block = 0.0; + fmgc.FMGCInternal.blockSet = 0; + fmgc.FMGCInternal.taxiFuel = 0.4; + fmgc.FMGCInternal.taxiFuelSet = 0; + fmgc.FMGCInternal.tripFuel = 0; + fmgc.FMGCInternal.tripTime = "0000"; + fmgc.FMGCInternal.rteRsv = 0; + fmgc.FMGCInternal.rteRsvSet = 0; + fmgc.FMGCInternal.rtePercent = 5.0; + fmgc.FMGCInternal.rtePercentSet = 0; + fmgc.FMGCInternal.altFuel = 0; + fmgc.FMGCInternal.altFuelSet = 0; + fmgc.FMGCInternal.altTime = "0000"; + fmgc.FMGCInternal.finalFuel = 0; + fmgc.FMGCInternal.finalFuelSet = 0; + fmgc.FMGCInternal.finalTime = "0030"; + fmgc.FMGCInternal.finalTimeSet = 0; + fmgc.FMGCInternal.minDestFob = 0; + fmgc.FMGCInternal.minDestFobSet = 0; + fmgc.FMGCInternal.tow = 0; + fmgc.FMGCInternal.lw = 0; + fmgc.FMGCInternal.tripWind = "HD000"; + fmgc.FMGCInternal.tripWindValue = 0; + fmgc.FMGCInternal.fffqSensor = "FF+FQ"; + fmgc.FMGCInternal.extraFuel = 0; + fmgc.FMGCInternal.extraTime = "0000"; setprop("/FMGC/internal/fuel-request-set", 0); setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/block-calculating", 0); @@ -277,11 +274,10 @@ var initInputB = func(key, i) { var tfs = size(scratchpad); var maxblock = getprop("/options/maxblock"); if (tfs == 0) { - setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1))); - setprop("/FMGC/internal/block-set", 1); - if (getprop("/FMGC/internal/zfw-set")) { - setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); - setprop("/FMGC/internal/tow-set", 1); + fmgc.FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)); + fmgc.FMGCInternal.blockSet = 1; + if (fmgc.FMGCInternal.zfwSet) { + fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -289,11 +285,10 @@ var initInputB = func(key, i) { } } else if (tfs >= 1 and tfs <= 5) { if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) { - setprop("/FMGC/internal/block", scratchpad); - setprop("/FMGC/internal/block-set", 1); - if (getprop("/FMGC/internal/zfw-set")) { - setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); - setprop("/FMGC/internal/tow-set", 1); + fmgc.FMGCInternal.block = scratchpad; + fmgc.FMGCInternal.blockSet = 1; + if (fmgc.FMGCInternal.zfwSet) { + fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -308,10 +303,10 @@ var initInputB = func(key, i) { } } } else if (key == "R3") { - if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and !getprop("/FMGC/internal/fuel-request-set")) { + if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and !getprop("/FMGC/internal/fuel-request-set")) { setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/block-calculating", 1); - } else if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) { + } else if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) { setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/fuel-calculating", 1); } else { @@ -319,8 +314,8 @@ var initInputB = func(key, i) { } } else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - setprop("/FMGC/internal/trip-wind", "HD000"); - setprop("/FMGC/internal/trip-wind-value", 0); + fmgc.FMGCInternal.tripWind = "HD000"; + fmgc.FMGCInternal.tripWindValue = 0; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } @@ -329,8 +324,8 @@ var initInputB = func(key, i) { if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) { var effwind = substr(scratchpad, 2); if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { - setprop("/FMGC/internal/trip-wind", scratchpad); - setprop("/FMGC/internal/trip-wind-value", effwind); + fmgc.FMGCInternal.tripWind = scratchpad; + fmgc.FMGCInternal.tripWindValue = effwind; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } @@ -341,8 +336,8 @@ var initInputB = func(key, i) { } else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) { var effwind = substr(scratchpad, 1); if (int(effwind) != nil and effwind >= 0 and effwind <= 500) { - setprop("/FMGC/internal/trip-wind", scratchpad); - setprop("/FMGC/internal/trip-wind-value", effwind); + fmgc.FMGCInternal.tripWind = scratchpad; + fmgc.FMGCInternal.tripWindValue = effwind; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } @@ -352,8 +347,8 @@ var initInputB = func(key, i) { } } else { if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) { - setprop("/FMGC/internal/trip-wind", scratchpad); - setprop("/FMGC/internal/trip-wind-value", scratchpad); + fmgc.FMGCInternal.tripWind = scratchpad; + fmgc.FMGCInternal.tripWindValue = scratchpad; if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index ba5739b4..87c18337 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -92,50 +92,49 @@ var MCDU_reset = func(i) { fmgc.FMGCInternal.altSelected = 0; # INT-B - setprop("/FMGC/internal/zfw", 0); - setprop("/FMGC/internal/zfw-set", 0); - setprop("/FMGC/internal/zfwcg", 25.0); - setprop("/FMGC/internal/zfwcg-set", 0); - setprop("/FMGC/internal/block", 0.0); - setprop("/FMGC/internal/block-set", 0); - setprop("/FMGC/internal/taxi-fuel", 0.4); - setprop("/FMGC/internal/taxi-fuel-set", 0); - setprop("/FMGC/internal/trip-fuel", 0); - setprop("/FMGC/internal/trip-time", "0000"); - setprop("/FMGC/internal/rte-rsv", 0); - setprop("/FMGC/internal/rte-rsv-set", 0); - setprop("/FMGC/internal/rte-percent", 5.0); - setprop("/FMGC/internal/rte-percent-set", 0); - setprop("/FMGC/internal/alt-fuel", 0); - setprop("/FMGC/internal/alt-fuel-set", 0); - setprop("/FMGC/internal/alt-time", "0000"); - setprop("/FMGC/internal/final-fuel", 0); - setprop("/FMGC/internal/final-fuel-set", 0); - setprop("/FMGC/internal/final-time", "0030"); - setprop("/FMGC/internal/final-time-set", 0); - setprop("/FMGC/internal/min-dest-fob", 0); - setprop("/FMGC/internal/min-dest-fob-set", 0); - setprop("/FMGC/internal/tow", 0); - setprop("/FMGC/internal/lw", 0); - setprop("/FMGC/internal/trip-wind", "HD000"); - setprop("/FMGC/internal/trip-wind-value", 0); - setprop("/FMGC/internal/fffq-sensor", "FF+FQ"); - setprop("/FMGC/internal/extra-fuel", 0); - setprop("/FMGC/internal/extra-time", "0000"); + fmgc.FMGCInternal.zfw = 0; + fmgc.FMGCInternal.zfwSet = 0; + fmgc.FMGCInternal.zfwcg = 25.0; + fmgc.FMGCInternal.zfwcgSet = 0; + fmgc.FMGCInternal.block = 0.0; + fmgc.FMGCInternal.blockSet = 0; + fmgc.FMGCInternal.taxiFuel = 0.4; + fmgc.FMGCInternal.taxiFuelSet = 0; + fmgc.FMGCInternal.tripFuel = 0; + fmgc.FMGCInternal.tripTime = "0000"; + fmgc.FMGCInternal.rteRsv = 0; + fmgc.FMGCInternal.rteRsvSet = 0; + fmgc.FMGCInternal.rtePercent = 5.0; + fmgc.FMGCInternal.rtePercentSet = 0; + fmgc.FMGCInternal.altFuel = 0; + fmgc.FMGCInternal.altFuelSet = 0; + fmgc.FMGCInternal.altTime = "0000"; + fmgc.FMGCInternal.finalFuel = 0; + fmgc.FMGCInternal.finalFuelSet = 0; + fmgc.FMGCInternal.finalTime = "0030"; + fmgc.FMGCInternal.finalTimeSet = 0; + fmgc.FMGCInternal.minDestFob = 0; + fmgc.FMGCInternal.minDestFobSet = 0; + fmgc.FMGCInternal.tow = 0; + fmgc.FMGCInternal.lw = 0; + fmgc.FMGCInternal.tripWind = "HD000"; + fmgc.FMGCInternal.tripWindValue = 0; + fmgc.FMGCInternal.fffqSensor = "FF+FQ"; + fmgc.FMGCInternal.extraFuel = 0; + fmgc.FMGCInternal.extraTime = "0000"; setprop("/FMGC/internal/fuel-request-set", 0); setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-confirmed", 0); setprop("/FMGC/internal/fuel-calculating", 0); # FUELPRED - setprop("/FMGC/internal/alt-airport", ""); - setprop("/FMGC/internal/pri-utc", "0000"); - setprop("/FMGC/internal/alt-utc", "0000"); - setprop("/FMGC/internal/pri-efob", 0); - setprop("/FMGC/internal/alt-efob", 0); - setprop("/FMGC/internal/fob", 0); - setprop("/FMGC/internal/fuel-pred-gw", 0); - setprop("/FMGC/internal/cg", 0); + fmgc.FMGCInternal.priUtc = "0000"; + fmgc.FMGCInternal.altUtc = "0000"; + fmgc.FMGCInternal.priEfob = 0; + fmgc.FMGCInternal.altEfob = 0; + fmgc.FMGCInternal.fob = 0; + fmgc.FMGCInternal.fuelPredGw = 0; + fmgc.FMGCInternal.cg = 0; # PROG fmgc.FMGCInternal.crzProg = 100; From 7edaf22381a6d3e9822cf1e25150fe01386c0719 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 1 Aug 2020 12:49:54 -0400 Subject: [PATCH 11/45] Move speed calcs away from setprop/getprop --- Models/Instruments/MCDU/MCDU.nas | 4 +- Models/Instruments/PFD/PFD.nas | 36 ++-- Nasal/FMGC/FMGC.nas | 291 +++++++++++++++++-------------- Nasal/MCDU/FUELPRED.nas | 16 +- Nasal/MCDU/INITB.nas | 16 +- 5 files changed, 192 insertions(+), 171 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 3df678c1..d2b90210 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3759,7 +3759,7 @@ var canvas_MCDU_base = { me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); me["Simple_C5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vls_appr"))); - me["Simple_L5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vapp_appr"))); + me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr)); me.fontLeft(0, 0, 0, 0, default, 0); if (vapp_speed_set.getValue()) { me.fontSizeLeft(0, 0, 0, 0, normal, 0); @@ -3772,7 +3772,7 @@ var canvas_MCDU_base = { me["Simple_C3"].setText(" ---"); me["Simple_C5"].setText(" ---"); if (vapp_speed_set.getValue()) { - me["Simple_L5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vapp_appr"))); + me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr)); me.fontLeft(0, 0, 0, 0, default, 0); me.fontSizeLeft(0, 0, 0, 0, normal, 0); } else { diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 1f255ec3..fd03d8c1 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -1207,7 +1207,7 @@ var canvas_PFD_1 = { me["ASI_max"].setTranslation(0, me.ASImax * -6.6); if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { - me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min"); + me.FMGC_vls = fmgc.FMGCInternal.vls_min; if (me.FMGC_vls <= 30) { me.VLSmin = 0 - me.ASI; } else if (me.FMGC_vls >= 420) { @@ -1231,7 +1231,7 @@ var canvas_PFD_1 = { } else { me.ALPHAmax = me.FMGC_max - 30 - me.ASI; } - me.FMGC_vsw = getprop("/FMGC/internal/computed-speeds/vsw"); + me.FMGC_vsw = fmgc.FMGCInternal.vsw; if (me.FMGC_vsw <= 30) { me.ALPHAvsw = 0 - me.ASI; } else if (me.FMGC_vsw >= 420) { @@ -1262,14 +1262,14 @@ var canvas_PFD_1 = { if (managed_spd.getValue() == 1) { if (getprop("/FMGC/internal/decel") == 1) { if (getprop("/FMGC/internal/vapp-speed-set")) { - vapp = getprop("/FMGC/internal/computed-speeds/vapp_appr"); + vapp = fmgc.FMGCInternal.vapp_appr; } else { - vapp = getprop("/FMGC/internal/computed-speeds/vapp"); + vapp = fmgc.FMGCInternal.vapp; } tgt_ias = vapp; tgt_kts = vapp; } else if (fmgc.FMGCInternal.phase == 6) { - clean = getprop("/FMGC/internal/computed-speeds/clean"); + clean = fmgc.FMGCInternal.clean; tgt_ias = clean; tgt_kts = clean; } @@ -1409,7 +1409,7 @@ var canvas_PFD_1 = { me["F_target"].hide(); me["clean_speed"].hide(); - tgt_S = getprop("/FMGC/internal/computed-speeds/slat"); + tgt_S = fmgc.FMGCInternal.slat; if (tgt_S <= 30) { me.Strgt = 0 - me.ASI; @@ -1443,7 +1443,7 @@ var canvas_PFD_1 = { me["S_target"].hide(); me["clean_speed"].hide(); - tgt_F = getprop("/FMGC/internal/computed-speeds/flap2"); + tgt_F = fmgc.FMGCInternal.flap2; if (tgt_F <= 30) { me.Ftrgt = 0 - me.ASI; @@ -1477,7 +1477,7 @@ var canvas_PFD_1 = { me["S_target"].hide(); me["clean_speed"].hide(); - tgt_F = getprop("/FMGC/internal/computed-speeds/flap3"); + tgt_F = fmgc.FMGCInternal.flap3; if (tgt_F <= 30) { me.Ftrgt = 0 - me.ASI; @@ -1516,7 +1516,7 @@ var canvas_PFD_1 = { me["S_target"].hide(); me["F_target"].hide(); - tgt_clean = getprop("/FMGC/internal/computed-speeds/clean"); + tgt_clean = fmgc.FMGCInternal.clean; me.cleantrgt = tgt_clean - 30 - me.ASI; me.SPDcleantrgtdiff = tgt_clean - ind_spd; @@ -1945,7 +1945,7 @@ var canvas_PFD_2 = { me["ASI_max"].setTranslation(0, me.ASImax * -6.6); if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) { - me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min"); + me.FMGC_vls = fmgc.FMGCInternal.vls_min; if (me.FMGC_vls <= 30) { me.VLSmin = 0 - me.ASI; } else if (me.FMGC_vls >= 420) { @@ -1969,7 +1969,7 @@ var canvas_PFD_2 = { } else { me.ALPHAmax = me.FMGC_max - 30 - me.ASI; } - me.FMGC_vsw = getprop("/FMGC/internal/computed-speeds/vsw"); + me.FMGC_vsw = fmgc.FMGCInternal.vsw; if (me.FMGC_vsw <= 30) { me.ALPHAvsw = 0 - me.ASI; } else if (me.FMGC_vsw >= 420) { @@ -2000,14 +2000,14 @@ var canvas_PFD_2 = { if (managed_spd.getValue() == 1) { if (getprop("/FMGC/internal/decel") == 1) { if (getprop("/FMGC/internal/vapp-speed-set")) { - vapp = getprop("/FMGC/internal/computed-speeds/vapp_appr"); + vapp = fmgc.FMGCInternal.vapp_appr; } else { - vapp = getprop("/FMGC/internal/computed-speeds/vapp"); + vapp = fmgc.FMGCInternal.vapp; } tgt_ias = vapp; tgt_kts = vapp; } else if (fmgc.FMGCInternal.phase == 6) { - clean = getprop("/FMGC/internal/computed-speeds/clean"); + clean = fmgc.FMGCInternal.clean; tgt_ias = clean; tgt_kts = clean; } @@ -2148,7 +2148,7 @@ var canvas_PFD_2 = { me["F_target"].hide(); me["clean_speed"].hide(); - tgt_S = tgt_S = getprop("/FMGC/internal/computed-speeds/slat"); + tgt_S = tgt_S = fmgc.FMGCInternal.slat; if (tgt_S <= 30) { me.Strgt = 0 - me.ASI; @@ -2182,7 +2182,7 @@ var canvas_PFD_2 = { me["S_target"].hide(); me["clean_speed"].hide(); - tgt_F = tgt_S = getprop("/FMGC/internal/computed-speeds/flap2"); + tgt_F = tgt_S = fmgc.FMGCInternal.flap2; if (tgt_F <= 30) { me.Ftrgt = 0 - me.ASI; @@ -2216,7 +2216,7 @@ var canvas_PFD_2 = { me["S_target"].hide(); me["clean_speed"].hide(); - tgt_F = tgt_S = getprop("/FMGC/internal/computed-speeds/flap3"); + tgt_F = tgt_S = fmgc.FMGCInternal.flap3; if (tgt_F <= 30) { me.Ftrgt = 0 - me.ASI; @@ -2255,7 +2255,7 @@ var canvas_PFD_2 = { me["S_target"].hide(); me["F_target"].hide(); - tgt_clean = tgt_S = getprop("/FMGC/internal/computed-speeds/clean"); + tgt_clean = tgt_S = fmgc.FMGCInternal.clean; me.cleantrgt = tgt_clean - 30 - me.ASI; me.SPDcleantrgtdiff = tgt_clean - ind_spd; diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 2431541e..f6be7d21 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -109,10 +109,10 @@ setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX"); var FMGCinit = func { - fmgc.FMGCInternal.takeoffState = 0; - fmgc.FMGCInternal.minspeed = 0; - fmgc.FMGCInternal.maxspeed = 338; - fmgc.FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done + FMGCInternal.takeoffState = 0; + FMGCInternal.minspeed = 0; + FMGCInternal.maxspeed = 338; + FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done setprop("/FMGC/internal/mng-spd", 157); setprop("/FMGC/internal/mng-spd-cmd", 157); setprop("/FMGC/internal/mng-kts-mach", 0); @@ -140,6 +140,36 @@ var FMGCInternal = { alpha_prot: 0, alpha_max: 0, vmo_mmo: 0, + vsw: 0, + vls_min: 0, + clean: 0, + vs1g_clean: 0, + vs1g_conf_1: 0, + vs1g_conf_1f: 0, + vs1g_conf_2: 0, + vs1g_conf_3: 0, + vs1g_conf_full: 0, + slat: 0, + flap2: 0, + flap3: 0, + vls: 0, + vapp: 0, + clean_to: 0, + vs1g_clean_to: 0, + vs1g_conf_2_to: 0, + vs1g_conf_3_to: 0, + vs1g_conf_full_to: 0, + slat_to: 0, + flap2_to: 0, + clean_appr: 0, + vs1g_clean_appr: 0, + vs1g_conf_2_appr: 0, + vs1g_conf_3_appr: 0, + vs1g_conf_full_appr: 0, + slat_appr: 0, + flap2_appr: 0, + vls_appr: 0, + vapp_appr: 0, # PERF transAlt: 18000, @@ -247,7 +277,7 @@ setlistener("/gear/gear[0]/wow", func { var trimReset = func { flaps = getprop("/controls/flight/flaps-pos"); - if (pts.Gear.wow[0].getBoolValue() and !fmgc.FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { + if (pts.Gear.wow[0].getBoolValue() and !FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { interpolate("/controls/flight/elevator-trim", 0.0, 1.5); } } @@ -257,9 +287,9 @@ var trimReset = func { ############### var updateARPT = func { - setprop("autopilot/route-manager/departure/airport", fmgc.FMGCInternal.depApt); - setprop("autopilot/route-manager/destination/airport", fmgc.FMGCInternal.arrApt); - setprop("autopilot/route-manager/alternate/airport", fmgc.FMGCInternal.altAirport); + setprop("autopilot/route-manager/departure/airport", FMGCInternal.depApt); + setprop("autopilot/route-manager/destination/airport", FMGCInternal.arrApt); + setprop("autopilot/route-manager/alternate/airport", FMGCInternal.altAirport); if (getprop("/autopilot/route-manager/active") != 1) { fgcommand("activate-flightplan", props.Node.new({"activate": 1})); } @@ -566,7 +596,7 @@ var masterFMGC = maketimer(0.2, func { # cruiseft = FMGCInternal.crzFt; # cruiseft_b = FMGCInternal.crzFt - 200; newcruise = getprop("/it-autoflight/internal/alt"); - phase = fmgc.FMGCInternal.phase; + phase = FMGCInternal.phase; state1 = getprop("/systems/thrust/state1"); state2 = getprop("/systems/thrust/state2"); wowl = getprop("/gear/gear[1]/wow"); @@ -643,11 +673,11 @@ var masterFMGC = maketimer(0.2, func { } if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) { - fmgc.FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4; + FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4; } elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) { - fmgc.FMGCInternal.maxspeed = 284; + FMGCInternal.maxspeed = 284; } else { - fmgc.FMGCInternal.maxspeed = getprop("/it-fbw/speeds/vmo-mmo"); + FMGCInternal.maxspeed = getprop("/it-fbw/speeds/vmo-mmo"); } ############################ @@ -655,111 +685,102 @@ var masterFMGC = maketimer(0.2, func { ############################ flap = getprop("/controls/flight/flaps-pos"); weight_lbs = getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000; - tow = getprop("/FMGC/internal/tow") or 0; - lw = getprop("/FMGC/internal/lw") or 0; altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); # current speeds - clean = 2 * weight_lbs * 0.45359237 + 85; + FMGCInternal.clean = 2 * weight_lbs * 0.45359237 + 85; if (altitude > 20000) { - clean += (altitude - 20000) / 1000; + FMGCInternal.clean += (altitude - 20000) / 1000; } - setprop("/FMGC/internal/computed-speeds/clean", clean); - setprop("/FMGC/internal/computed-speeds/vs1g_clean", 0.0024 * weight_lbs * weight_lbs + 0.124 * weight_lbs + 88.942); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_1", -0.0007 * weight_lbs * weight_lbs + 0.6795 * weight_lbs + 44.673); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_1f", -0.0001 * weight_lbs * weight_lbs + 0.5211 * weight_lbs + 49.027); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_2", -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 44.279); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_3", -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 43.279); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_full", -0.0007 * weight_lbs * weight_lbs + 0.6002 * weight_lbs + 38.479); - setprop("/FMGC/internal/computed-speeds/slat", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.23); - setprop("/FMGC/internal/computed-speeds/flap2", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")) * 1.47); - setprop("/FMGC/internal/computed-speeds/flap3", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.36); + FMGCInternal.vs1g_clean = 0.0024 * weight_lbs * weight_lbs + 0.124 * weight_lbs + 88.942; + FMGCInternal.vs1g_conf_1 = -0.0007 * weight_lbs * weight_lbs + 0.6795 * weight_lbs + 44.673; + FMGCInternal.vs1g_conf_1f = -0.0001 * weight_lbs * weight_lbs + 0.5211 * weight_lbs + 49.027; + FMGCInternal.vs1g_conf_2 = -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 44.279; + FMGCInternal.vs1g_conf_3 = -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 43.279; + FMGCInternal.vs1g_conf_full = -0.0007 * weight_lbs * weight_lbs + 0.6002 * weight_lbs + 38.479; + FMGCInternal.slat = FMGCInternal.vs1g_clean * 1.23; + FMGCInternal.flap2 = FMGCInternal.vs1g_conf_2 * 1.47; + FMGCInternal.flap3 = FMGCInternal.vs1g_conf_3 * 1.36; if (getprop("/FMGC/internal/ldg-config-3-set")) { - vls = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.23; + FMGCInternal.vls = FMGCInternal.vs1g_conf_3 * 1.23; } else { - vls = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")) * 1.23 + FMGCInternal.vls = FMGCInternal.vs1g_conf_full * 1.23 } - if (vls < 113) { - vls = 113; + if (FMGCInternal.vls < 113) { + FMGCInternal.vls = 113; } - setprop("/FMGC/internal/computed-speeds/vls", vls); if (!getprop("/FMGC/internal/vapp-speed-set")) { - if (fmgc.FMGCInternal.destWind < 5) { - vapp = vls + 5; - } else if (fmgc.FMGCInternal.destWind > 15) { - vapp = vls + 15; + if (FMGCInternal.destWind < 5) { + FMGCInternal.vapp = FMGCInternal.vls + 5; + } else if (FMGCInternal.destWind > 15) { + FMGCInternal.vapp = FMGCInternal.vls + 15; } else { - vapp = vls + fmgc.FMGCInternal.destWind; + FMGCInternal.vapp = FMGCInternal.vls + FMGCInternal.destWind; } - setprop("/FMGC/internal/computed-speeds/vapp", vapp); } # predicted takeoff speeds if (FMGCInternal.phase == 1) { - setprop("/FMGC/internal/computed-speeds/clean_to", getprop("/FMGC/internal/computed-speeds/clean")); - setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); - setprop("/FMGC/internal/computed-speeds/slat_to", getprop("/FMGC/internal/computed-speeds/slat")); - setprop("/FMGC/internal/computed-speeds/flap2_to", getprop("/FMGC/internal/computed-speeds/flap2")); + FMGCInternal.clean_to = FMGCInternal.clean; + FMGCInternal.vs1g_clean_to = FMGCInternal.vs1g_clean; + FMGCInternal.vs1g_conf_2_to = FMGCInternal.vs1g_conf_2; + FMGCInternal.vs1g_conf_3_to = FMGCInternal.vs1g_conf_3; + FMGCInternal.vs1g_conf_full_to = FMGCInternal.vs1g_conf_full; + FMGCInternal.slat_to = FMGCInternal.slat; + FMGCInternal.flap2_to = FMGCInternal.flap2; } else { - clean_to = 2 * tow * 0.45359237 + 85; + FMGCInternal.clean_to = 2 * FMGCInternal.tow * 0.45359237 + 85; if (altitude > 20000) { - clean_to += (altitude - 20000) / 1000; + FMGCInternal.clean_to += (altitude - 20000) / 1000; } - setprop("/FMGC/internal/computed-speeds/clean_to", clean_to); - setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", 0.0024 * tow * tow + 0.124 * tow + 88.942); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", -0.0005 * tow * tow + 0.5488 * tow + 44.279); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_to", -0.0005 * tow * tow + 0.5488 * tow + 43.279); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_to", -0.0007 * tow * tow + 0.6002 * tow + 38.479); - setprop("/FMGC/internal/computed-speeds/slat_to", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean_to")) * 1.23); - setprop("/FMGC/internal/computed-speeds/flap2_to", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to")) * 1.47); + FMGCInternal.vs1g_clean_to = 0.0024 * FMGCInternal.tow * FMGCInternal.tow + 0.124 * FMGCInternal.tow + 88.942; + FMGCInternal.vs1g_conf_2_to = -0.0005 * FMGCInternal.tow * FMGCInternal.tow + 0.5488 * FMGCInternal.tow + 44.279; + FMGCInternal.vs1g_conf_3_to = -0.0005 * FMGCInternal.tow * FMGCInternal.tow + 0.5488 * FMGCInternal.tow + 43.279; + FMGCInternal.vs1g_conf_full_to = -0.0007 * FMGCInternal.tow * FMGCInternal.tow + 0.6002 * FMGCInternal.tow + 38.479; + FMGCInternal.slat_to = FMGCInternal.vs1g_clean_to * 1.23; + FMGCInternal.flap2_to = FMGCInternal.vs1g_conf_2_to * 1.47; } # predicted approach (temp go-around) speeds if (FMGCInternal.phase == 5 or FMGCInternal.phase == 6) { - setprop("/FMGC/internal/computed-speeds/clean_appr", getprop("/FMGC/internal/computed-speeds/clean")); - setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); - setprop("/FMGC/internal/computed-speeds/slat_appr", getprop("/FMGC/internal/computed-speeds/slat")); - setprop("/FMGC/internal/computed-speeds/flap2_appr", getprop("/FMGC/internal/computed-speeds/flap2")); - setprop("/FMGC/internal/computed-speeds/vls_appr", getprop("/FMGC/internal/computed-speeds/vls")); + FMGCInternal.clean_appr = FMGCInternal.clean; + FMGCInternal.vs1g_clean_appr = FMGCInternal.vs1g_clean; + FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2; + FMGCInternal.vs1g_conf_3_appr = FMGCInternal.vs1g_conf_3; + FMGCInternal.vs1g_conf_full_appr = FMGCInternal.vs1g_conf_full; + FMGCInternal.slat_appr = FMGCInternal.slat; + FMGCInternal.flap2_appr = FMGCInternal.flap2; + FMGCInternal.vls_appr = FMGCInternal.vls; if (!getprop("/FMGC/internal/vapp-speed-set")) { - setprop("/FMGC/internal/computed-speeds/vapp_appr", getprop("/FMGC/internal/computed-speeds/vapp")); + FMGCInternal.vapp_appr = FMGCInternal.vapp; } } else { - clean_appr = 2 * lw * 0.45359237 + 85; + FMGCInternal.clean_appr = 2 * FMGCInternal.lw * 0.45359237 + 85; if (altitude > 20000) { - clean_appr += (altitude - 20000) / 1000; + FMGCInternal.clean_appr += (altitude - 20000) / 1000; } - setprop("/FMGC/internal/computed-speeds/clean_appr", clean_appr); - setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", 0.0024 * lw * lw + 0.124 * lw + 88.942); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", -0.0005 * lw * lw + 0.5488 * lw + 44.279); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", -0.0005 * lw * lw + 0.5488 * lw + 43.279); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", -0.0007 * lw * lw + 0.6002 * lw + 38.479); - setprop("/FMGC/internal/computed-speeds/slat_appr", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean_appr")) * 1.23); - setprop("/FMGC/internal/computed-speeds/flap2_appr", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr")) * 1.47); + FMGCInternal.vs1g_clean_appr = 0.0024 * FMGCInternal.lw * FMGCInternal.lw + 0.124 * FMGCInternal.lw + 88.942; + FMGCInternal.vs1g_conf_2_appr = -0.0005 * FMGCInternal.lw * FMGCInternal.lw + 0.5488 * FMGCInternal.lw + 44.279; + FMGCInternal.vs1g_conf_3_appr = -0.0005 * FMGCInternal.lw * FMGCInternal.lw + 0.5488 * FMGCInternal.lw + 43.279; + FMGCInternal.vs1g_conf_full_appr = -0.0007 * FMGCInternal.lw * FMGCInternal.lw + 0.6002 * FMGCInternal.lw + 38.479; + FMGCInternal.slat_appr = FMGCInternal.vs1g_clean_appr * 1.23; + FMGCInternal.flap2_appr = FMGCInternal.vs1g_conf_2_appr * 1.47; if (getprop("/FMGC/internal/ldg-config-3-set")) { - vls_appr = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr")) * 1.23; + FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_3_appr * 1.23; } else { - vls_appr = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr")) * 1.23 + FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_full_appr * 1.23 } - if (vls_appr < 113) { - vls_appr = 113; + if (FMGCInternal.vls_appr < 113) { + FMGCInternal.vls_appr = 113; } - setprop("/FMGC/internal/computed-speeds/vls_appr", vls_appr); if (!getprop("/FMGC/internal/vapp-speed-set")) { - if (fmgc.FMGCInternal.destWind < 5) { - vapp_appr = vls_appr + 5; - } else if (fmgc.FMGCInternal.destWind > 15) { - vapp_appr = vls_appr + 15; + if (FMGCInternal.destWind < 5) { + FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5; + } else if (FMGCInternal.destWind > 15) { + FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 15; } else { - vapp_appr = vls_appr + fmgc.FMGCInternal.destWind; + FMGCInternal.vapp_appr = FMGCInternal.vls_appr + FMGCInternal.destWind; } - setprop("/FMGC/internal/computed-speeds/vapp_appr", vapp_appr); } } @@ -771,83 +792,83 @@ var masterFMGC = maketimer(0.2, func { aoa = getprop("/systems/navigation/adr/output/aoa-1"); cas = getprop("/systems/navigation/adr/output/cas-1"); if (aoa > -5) { - fmgc.FMGCInternal.alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); - fmgc.FMGCInternal.alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); + FMGCInternal.alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); + FMGCInternal.alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); } else { - fmgc.FMGCInternal.alpha_prot = 0; - fmgc.FMGCInternal.alpha_max = 0; + FMGCInternal.alpha_prot = 0; + FMGCInternal.alpha_max = 0; } - setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); - setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); + #FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2; + #FMGCInternal.vs1g_conf_3_appr = FMGCInternal.vs1g_conf_3; + #FMGCInternal.vs1g_conf_full_appr = FMGCInternal.vs1g_conf_full; if (flap == 0) { # 0 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_clean")); - fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/clean"); + FMGCInternal.vsw = FMGCInternal.vs1g_clean; + FMGCInternal.minspeed = FMGCInternal.clean; - if (fmgc.FMGCInternal.takeoffState) { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.28); + if (FMGCInternal.takeoffState) { + FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.28; } else { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.23); + FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.23; } } else if (flap == 1) { # 1 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/slat"); + FMGCInternal.vsw = FMGCInternal.vs1g_conf_2; + FMGCInternal.minspeed = FMGCInternal.slat; - if (fmgc.FMGCInternal.takeoffState) { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.28); + if (FMGCInternal.takeoffState) { + FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1 * 1.28; } else { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.23); + FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1 * 1.23; } } else if (flap == 2) { # 1+F - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f")); - fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/slat"); + FMGCInternal.vsw = FMGCInternal.vs1g_conf_1f; + FMGCInternal.minspeed = FMGCInternal.slat; - if (fmgc.FMGCInternal.takeoffState) { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + if (FMGCInternal.takeoffState) { + FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13; } else { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f")) * 1.23); + FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1f * 1.23; } } else if (flap == 3) { # 2 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")); - fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/flap2"); + FMGCInternal.vsw = FMGCInternal.vs1g_conf_2; + FMGCInternal.minspeed = FMGCInternal.flap2; - if (fmgc.FMGCInternal.takeoffState) { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + if (FMGCInternal.takeoffState) { + FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13; } else { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")) * 1.23); + FMGCInternal.vls_min = FMGCInternal.vs1g_conf_2 * 1.23; } } else if (flap == 4) { # 3 - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")); - fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/flap3"); + FMGCInternal.vsw = FMGCInternal.vs1g_conf_3; + FMGCInternal.minspeed = FMGCInternal.flap3; - if (fmgc.FMGCInternal.takeoffState) { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + if (FMGCInternal.takeoffState) { + FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13; } else { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.23); + FMGCInternal.vls_min = FMGCInternal.vs1g_conf_3 * 1.23; } } else if (flap == 5) { # FULL - setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")); - fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/vapp"); + FMGCInternal.vsw = FMGCInternal.vs1g_conf_full; + FMGCInternal.minspeed = FMGCInternal.vapp; - if (fmgc.FMGCInternal.takeoffState) { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13); + if (FMGCInternal.takeoffState) { + FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13; } else { - setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")) * 1.23); + FMGCInternal.vls_min = FMGCInternal.vs1g_conf_full * 1.23; } } if (gear0 and flaps < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) { - if (!fmgc.FMGCInternal.takeoffState) { + if (!FMGCInternal.takeoffState) { fmgc.FMGCNodes.toState.setValue(1); } - fmgc.FMGCInternal.takeoffState = 1; + FMGCInternal.takeoffState = 1; } elsif (pts.Position.gearAglFt.getValue() >= 55) { - if (fmgc.FMGCInternal.takeoffState) { + if (FMGCInternal.takeoffState) { fmgc.FMGCNodes.toState.setValue(0); } - fmgc.FMGCInternal.takeoffState = 0; + FMGCInternal.takeoffState = 0; } ############################ @@ -857,7 +878,7 @@ var masterFMGC = maketimer(0.2, func { departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway; destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway; if (destination_rwy != nil and phase >= 2) { - var airport = airportinfo(fmgc.FMGCInternal.arrApt); + var airport = airportinfo(FMGCInternal.arrApt); setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg")); runway_ils = destination_rwy.ils_frequency_mhz; @@ -888,7 +909,7 @@ var masterFMGC = maketimer(0.2, func { }); var reset_FMGC = func { - fmgc.FMGCInternal.phase = 0; + FMGCInternal.phase = 0; fd1 = getprop("/it-autoflight/input/fd1"); fd2 = getprop("/it-autoflight/input/fd2"); spd = getprop("/it-autoflight/input/kts"); @@ -952,7 +973,7 @@ var ManagedSPD = maketimer(0.25, func { kts_sel = getprop("/it-autoflight/input/kts"); mach_sel = getprop("/it-autoflight/input/mach"); srsSPD = getprop("/it-autoflight/settings/togaspd"); - phase = fmgc.FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done + phase = FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done flap = getprop("/controls/flight/flaps-pos"); mach_switchover = getprop("/FMGC/internal/mach-switchover"); decel = getprop("/FMGC/internal/decel"); @@ -984,8 +1005,8 @@ var ManagedSPD = maketimer(0.25, func { } if (mng_spd_cmd != 250 and !decel) { setprop("/FMGC/internal/mng-spd-cmd", 250); - } else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) { - setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed); + } else if (mng_spd_cmd != FMGCInternal.minspeed and decel) { + setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed); } } else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !mach_switchover) { if (mngktsmach) { @@ -1021,8 +1042,8 @@ var ManagedSPD = maketimer(0.25, func { } if (mng_spd_cmd != mng_alt_spd and !decel) { setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd); - } else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) { - setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed); + } else if (mng_spd_cmd != FMGCInternal.minspeed and decel) { + setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed); } } else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) { if (mngktsmach) { @@ -1030,15 +1051,15 @@ var ManagedSPD = maketimer(0.25, func { } if (mng_spd_cmd != 250 and !decel) { setprop("/FMGC/internal/mng-spd-cmd", 250); - } else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) { - setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed); + } else if (mng_spd_cmd != FMGCInternal.minspeed and decel) { + setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed); } } mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd"); - if (mng_spd_cmd > fmgc.FMGCInternal.maxspeed - 5) { - setprop("/FMGC/internal/mng-spd", fmgc.FMGCInternal.maxspeed - 5); + if (mng_spd_cmd > FMGCInternal.maxspeed - 5) { + setprop("/FMGC/internal/mng-spd", FMGCInternal.maxspeed - 5); } else { setprop("/FMGC/internal/mng-spd", mng_spd_cmd); } @@ -1156,7 +1177,7 @@ setlistener("/FMGC/internal/fuel-calculating", func() { # Maketimers var timer30secLanding = maketimer(1, func() { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) { - fmgc.FMGCInternal.phase = 7; + FMGCInternal.phase = 7; if (FMGCInternal.costIndexSet) { setprop("/FMGC/internal/last-cost-index", FMGCInternal.costIndex); } else { diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 910b03ce..3dfebe52 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -7,7 +7,7 @@ var fuelPredInput = func(key, i) { var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - fmgc.FMGCInternal.rteRsv = 0.05 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsv = 0.05 * fmgc.FMGCInternal.tripFuel; fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = 5.0; fmgc.FMGCInternal.rtePercentSet = 0; @@ -19,7 +19,7 @@ var fuelPredInput = func(key, i) { if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { var perc = num(split("/", scratchpad)[1]); if (perc != nil and perc >= 0.0 and perc <= 15.0) { - fmgc.FMGCInternal.rteRsv = num(perc) / 100 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsv = perc / 100 * fmgc.FMGCInternal.tripFuel; fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = perc; fmgc.FMGCInternal.rtePercentSet = 1; @@ -29,8 +29,8 @@ var fuelPredInput = func(key, i) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { fmgc.FMGCInternal.rteRsv = scratchpad; fmgc.FMGCInternal.rteRsvSet = 1; - if (scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) { - fmgc.FMGCInternal.rtePercent = scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100; + if (scratchpad / fmgc.FMGCInternal.tripFuel * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = scratchpad / fmgc.FMGCInternal.tripFuel * 100; } else { fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value } @@ -110,7 +110,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.minDestFobSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); - if (num(fmgc.FMGCInternal.minDestFob) < num(fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel)) { + if (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) { mcdu_message(i, "CHECK MIN DEST FOB"); } } else { @@ -130,7 +130,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1)); fmgc.FMGCInternal.zfwSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { - fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); @@ -151,7 +151,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.zfwcg = zfwcg; fmgc.FMGCInternal.zfwcgSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { - fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); @@ -178,7 +178,7 @@ var fuelPredInput = func(key, i) { fmgc.FMGCInternal.zfw = scratchpad; fmgc.FMGCInternal.zfwSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { - fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 6cca70c8..a63e91a6 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -35,7 +35,7 @@ var initInputB = func(key, i) { } } else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { - fmgc.FMGCInternal.rteRsv = 0.05 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsv = 0.05 * fmgc.FMGCInternal.tripFuel; fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = 5.0; fmgc.FMGCInternal.rtePercentSet = 0; @@ -47,7 +47,7 @@ var initInputB = func(key, i) { if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { var perc = num(split("/", scratchpad)[1]); if (perc != nil and perc >= 0.0 and perc <= 15.0) { - fmgc.FMGCInternal.rteRsv = num(perc) / 100 * num(fmgc.FMGCInternal.tripFuel); + fmgc.FMGCInternal.rteRsv = perc / 100 * fmgc.FMGCInternal.tripFuel; fmgc.FMGCInternal.rteRsvSet = 0; fmgc.FMGCInternal.rtePercent = perc; fmgc.FMGCInternal.rtePercentSet = 1; @@ -57,8 +57,8 @@ var initInputB = func(key, i) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { fmgc.FMGCInternal.rteRsv = scratchpad; fmgc.FMGCInternal.rteRsvSet = 1; - if (scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) { - fmgc.FMGCInternal.rtePercent = scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100; + if (scratchpad / fmgc.FMGCInternal.tripFuel * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = scratchpad / fmgc.FMGCInternal.tripFuel * 100; } else { fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value } @@ -138,7 +138,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.minDestFobSet = 1; setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); - if (num(fmgc.FMGCInternal.minDestFob) < num(fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel)) { + if (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) { mcdu_message(i, "CHECK MIN DEST FOB"); } } else { @@ -158,7 +158,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1)); fmgc.FMGCInternal.zfwSet = 1; if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { - fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -182,7 +182,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.zfwcg = zfwcg; fmgc.FMGCInternal.zfwcgSet = 1; if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { - fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); @@ -212,7 +212,7 @@ var initInputB = func(key, i) { fmgc.FMGCInternal.zfw = scratchpad; fmgc.FMGCInternal.zfwSet = 1; if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) { - fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel); + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); From 3a43829772522fdc26c5d27361e853b47a460fc2 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 1 Aug 2020 16:44:10 -0400 Subject: [PATCH 12/45] Bug fixes for v-speeds --- Models/Instruments/MCDU/MCDU.nas | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index d2b90210..2c7279f5 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3141,10 +3141,10 @@ var canvas_MCDU_base = { me["Simple_R5"].setFontSize(small); } - if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) { - me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_to"))); - me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_to"))); - me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_to"))); + if ((fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet) or fmgc.FMGCInternal.phase == 1) { + me["Simple_C1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.flap2_to)); + me["Simple_C2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.slat_to)); + me["Simple_C3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.clean_to)); } else { me["Simple_C1"].setText(" ---"); me["Simple_C2"].setText(" ---"); @@ -3754,11 +3754,11 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("PHASE "); me["Simple_L5S"].setText(" VAPP"); - if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) { - me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr"))); - me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); - me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); - me["Simple_C5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vls_appr"))); + if ((fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet) or fmgc.FMGCInternal.phase == 5) { + me["Simple_C1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.flap2_appr)); + me["Simple_C2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.slat_appr)); + me["Simple_C3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.clean_appr)); + me["Simple_C5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vls_appr)); me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr)); me.fontLeft(0, 0, 0, 0, default, 0); if (vapp_speed_set.getValue()) { @@ -3853,10 +3853,10 @@ var canvas_MCDU_base = { me["Simple_R5"].setText(sprintf("%3.0f", engOutAcc.getValue())); me["Simple_R5S"].setText("ENG OUT ACC"); - if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) { - me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr"))); - me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr"))); - me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr"))); + if ((fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet) or fmgc.FMGCInternal.phase == 6) { + me["Simple_C1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.flap2_appr)); + me["Simple_C2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.slat_appr)); + me["Simple_C3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.clean_appr)); } else { me["Simple_C1"].setText(" ---"); me["Simple_C2"].setText(" ---"); From 6801002120f53614f47794568476d55d8c61a19c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 3 Aug 2020 17:50:08 +0100 Subject: [PATCH 13/45] Nothing --- Nasal/Systems/Comm/CPDLC.nas | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Nasal/Systems/Comm/CPDLC.nas diff --git a/Nasal/Systems/Comm/CPDLC.nas b/Nasal/Systems/Comm/CPDLC.nas new file mode 100644 index 00000000..ca01dc3c --- /dev/null +++ b/Nasal/Systems/Comm/CPDLC.nas @@ -0,0 +1,48 @@ +# A3XX CPDLC +# Jonathan Redpath + +# Copyright (c) 2020 Josh Davidson (Octal450) +var DictionaryItem = { + new: func(item, string) { + var DI = {parents: [DictionaryItem]}; + DI.item = item; + DI.string = string; + return DI; + }, +}; + +var Dictionary = { + database: std.Vector.new(), + addToDatabase: func(dictItem) { + me.database.append(dictItem); + }, + fetchString: func(string) { + foreach (var item; me.database.vector) { + if (me.item.string == string) { + return item; + } + } + }, + fetchItem: func(itemObj) { + foreach (var item; me.database.vector) { + if (item.item == itemObj) { + return item; + } + } + }, +}; + +makeNewDictionaryItem = func(item, string) { + var dictItem = DictionaryItem.new(item, string); + Dictionary.addToDatabase(dictItem); +}; + +var CPDLCmessage = { + new: func(text) { + var cpdlcMessage = {parents: [CPDLCmessage] }; + cpdlcMessage.text = text; + return cpdlcMessage; + }, +}; + +makeNewDictionaryItem(CPDLCmessage.new("CONNECT"), "CONNECT"); \ No newline at end of file From 409781828aacbb60a8120d8f0ea473942aaa4760 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 3 Aug 2020 18:28:06 +0100 Subject: [PATCH 14/45] fixes --- AircraftConfig/simbrief.xml | 6 +----- Nasal/FMGC/SimbriefParser.nas | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/AircraftConfig/simbrief.xml b/AircraftConfig/simbrief.xml index b7fd94fd..28fe1398 100644 --- a/AircraftConfig/simbrief.xml +++ b/AircraftConfig/simbrief.xml @@ -49,11 +49,7 @@ left - - - - left - + hbox diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index cabc34f2..626ae1b8 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -51,12 +51,11 @@ var SimbriefParser = { fmgc.FMGCInternal.crzTempSet = 1; fmgc.FMGCInternal.crzProg = me.store1.getChild("initial_altitude").getValue() / 100; if (me.store1.getChild("avg_wind_comp").getValue() >= 0) { - setprop("/FMGC/internal/trip-wind", "TL" ~ me.store1.getChild("avg_wind_comp").getValue()); - setprop("/FMGC/internal/trip-wind-value", me.store1.getChild("avg_wind_comp").getValue()); + fmgc.FMGCInternal.tripWind = "TL" ~ me.store1.getChild("avg_wind_comp").getValue(); } else { - setprop("/FMGC/internal/trip-wind", "HD" ~ me.store1.getChild("avg_wind_comp").getValue()); - setprop("/FMGC/internal/trip-wind-value", me.store1.getChild("avg_wind_comp").getValue()); + fmgc.FMGCInternal.tripWind = "HD" ~ me.store1.getChild("avg_wind_comp").getValue(); } + fmgc.FMGCInternal.tripWindValue = me.store1.getChild("avg_wind_comp").getValue(); fmgc.FMGCInternal.altAirport = me.store2.getChild("icao_code").getValue(); fmgc.FMGCInternal.altAirportSet = 1; @@ -140,21 +139,22 @@ var SimbriefParser = { # INITB me.store1 = me.OFP.getChild("fuel"); - setprop("/FMGC/internal/taxi-fuel", me.store1.getChild("taxi").getValue() / 1000); - setprop("/FMGC/internal/taxi-fuel-set", 1); - setprop("/FMGC/internal/alt-fuel", me.store1.getChild("alternate_burn").getValue() / 1000); - setprop("/FMGC/internal/alt-fuel-set", 1); - setprop("/FMGC/internal/final-fuel", me.store1.getChild("reserve").getValue() / 1000); - setprop("/FMGC/internal/final-fuel-set", 1); - setprop("/FMGC/internal/rte-rsv", me.store1.getChild("contingency").getValue() / 1000); - setprop("/FMGC/internal/rte-rsv-set", 1); - if ((me.store1.getChild("contingency").getValue() / 1000) / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) { - setprop("/FMGC/internal/rte-percent", (me.store1.getChild("contingency").getValue() / 1000) / num(getprop("/FMGC/internal/trip-fuel")) * 100); + fmgc.FMGCInternal.taxiFuel = me.store1.getChild("taxi").getValue() / 1000; + fmgc.FMGCInternal.taxiFuelSet = 1; + fmgc.FMGCInternal.altFuel = me.store1.getChild("alternate_burn").getValue() / 1000; + fmgc.FMGCInternal.altFuelSet = 1; + fmgc.FMGCInternal.finalFuel = me.store1.getChild("reserve").getValue() / 1000; + fmgc.FMGCInternal.finalFuelSet = 1; + fmgc.FMGCInternal.rteRsv = me.store1.getChild("contingency").getValue() / 1000; + fmgc.FMGCInternal.rteRsvSet = 1; + if ((me.store1.getChild("contingency").getValue() / 1000) / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = (me.store1.getChild("contingency").getValue() / 1000) / num(fmgc.FMGCInternal.tripFuel) * 100; } else { - setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value + fmgc.FMGCInternal.rtePercent = 15.0 } - setprop("/FMGC/internal/block", me.store1.getChild("plan_ramp").getValue() / 1000); - setprop("/FMGC/internal/block-set", 1); + fmgc.FMGCInternal.rtePercentSet = 0; + fmgc.FMGCInternal.block = me.store1.getChild("plan_ramp").getValue() / 1000; + fmgc.FMGCInternal.blockSet = 1; setprop("/FMGC/internal/block-calculating", 0); }, From 0f8d8596f8fc93192b4fc5c54e5f4f8b79ef6cce Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Mon, 3 Aug 2020 17:47:30 -0400 Subject: [PATCH 15/45] Fix zfwcg entry bug, improve simbrief fuel integration --- Nasal/FMGC/SimbriefParser.nas | 9 ++++++++- Nasal/MCDU/FUELPRED.nas | 19 ++++++++++++++----- Nasal/MCDU/INITB.nas | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 626ae1b8..eac37743 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -139,6 +139,7 @@ var SimbriefParser = { # INITB me.store1 = me.OFP.getChild("fuel"); + me.store2 = me.OFP.getChild("weights"); fmgc.FMGCInternal.taxiFuel = me.store1.getChild("taxi").getValue() / 1000; fmgc.FMGCInternal.taxiFuelSet = 1; fmgc.FMGCInternal.altFuel = me.store1.getChild("alternate_burn").getValue() / 1000; @@ -153,9 +154,15 @@ var SimbriefParser = { fmgc.FMGCInternal.rtePercent = 15.0 } fmgc.FMGCInternal.rtePercentSet = 0; - fmgc.FMGCInternal.block = me.store1.getChild("plan_ramp").getValue() / 1000; + fmgc.FMGCInternal.block = me.store1.getChild("plan_ramp").getValue() / 1000; fmgc.FMGCInternal.blockSet = 1; + fmgc.FMGCInternal.zfw = me.store2.getChild("est_zfw").getValue() / 1000; + fmgc.FMGCInternal.zfwSet = 1; + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; + setprop("/FMGC/internal/fuel-request-set", 1); + setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); + setprop("/FMGC/internal/block-confirmed", 1); }, }; \ No newline at end of file diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 3dfebe52..59646a87 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -132,11 +132,14 @@ var fuelPredInput = func(key, i) { if (fmgc.FMGCInternal.blockSet != 1) { fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; fmgc.FMGCInternal.blockSet = 1; + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-confirmed", 1); - } + } else if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 1); + } mcdu_scratchpad.scratchpads[i].empty(); } else if (find("/", scratchpad) != -1) { var zfwi = split("/", scratchpad); @@ -144,7 +147,7 @@ var fuelPredInput = func(key, i) { var zfwcg = num(zfwi[1]); var zfws = size(zfwi[0]); var zfwcgs = size(zfwi[1]); - if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + if (zfw != nil and zfws > 0 and zfws <= 5 and (find(".", zfwi[0]) == -1 or size(split(".", zfwi[0])[1]) <= 1) and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and (find(".", zfwi[1]) == -1 or size(split(".", zfwi[1])[1]) <= 1)) { if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) { fmgc.FMGCInternal.zfw = zfw; fmgc.FMGCInternal.zfwSet = 1; @@ -153,16 +156,19 @@ var fuelPredInput = func(key, i) { if (fmgc.FMGCInternal.blockSet != 1) { fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; fmgc.FMGCInternal.blockSet = 1; + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-confirmed", 1); - } + } else if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 1); + } mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "ENTRY OUT OF RANGE"); } - } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and (find(".", zfwi[1]) == -1 or size(split(".", zfwi[1])[1]) <= 1)) { if (zfwcg >= 8.0 and zfwcg <= 45.0) { fmgc.FMGCInternal.zfwcg = zfwcg; fmgc.FMGCInternal.zfwcgSet = 1; @@ -173,17 +179,20 @@ var fuelPredInput = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) { + } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and (find(".", scratchpad) == -1 or size(split(".", scratchpad)[1]) <= 1)) { if (scratchpad >= zfw_min and scratchpad <= zfw_max) { fmgc.FMGCInternal.zfw = scratchpad; fmgc.FMGCInternal.zfwSet = 1; if (fmgc.FMGCInternal.blockSet != 1) { fmgc.FMGCInternal.block = getprop("consumables/fuel/total-fuel-lbs") / 1000; fmgc.FMGCInternal.blockSet = 1; + fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel; setprop("/FMGC/internal/fuel-request-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-confirmed", 1); + } else if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 1); } mcdu_scratchpad.scratchpads[i].empty(); } else { diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index a63e91a6..1694d1f4 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -175,7 +175,7 @@ var initInputB = func(key, i) { var zfwcg = num(zfwi[1]); var zfws = size(zfwi[0]); var zfwcgs = size(zfwi[1]); - if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + if (zfw != nil and zfws > 0 and zfws <= 5 and (find(".", zfwi[0]) == -1 or size(split(".", zfwi[0])[1]) <= 1) and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and (find(".", zfwi[1]) == -1 or size(split(".", zfwi[1])[1]) <= 1)) { if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) { fmgc.FMGCInternal.zfw = zfw; fmgc.FMGCInternal.zfwSet = 1; @@ -196,7 +196,7 @@ var initInputB = func(key, i) { } else { mcdu_message(i, "ENTRY OUT OF RANGE"); } - } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and (find(".", zfwi[1]) == -1 or size(split(".", zfwi[1])[1]) <= 1)) { if (zfwcg >= 8.0 and zfwcg <= 45.0) { fmgc.FMGCInternal.zfwcg = zfwcg; fmgc.FMGCInternal.zfwcgSet = 1; @@ -207,7 +207,7 @@ var initInputB = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) { + } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and (find(".", scratchpad) == -1 or size(split(".", scratchpad)[1]) <= 1)) { if (scratchpad >= zfw_min and scratchpad <= zfw_max) { fmgc.FMGCInternal.zfw = scratchpad; fmgc.FMGCInternal.zfwSet = 1; From a21e1078810b895e6f0bf69f1e7aba327c135891 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Mon, 3 Aug 2020 18:18:44 -0400 Subject: [PATCH 16/45] Disable block fuel recalculation --- Nasal/FMGC/FMGC.nas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 1bee0837..3925c37e 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -330,9 +330,9 @@ updateRouteManagerAlt = func() { var updateFuel = func { # Check engine status - if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { - FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)); - } + # if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { + # FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)); + # } # Calculate (final) holding fuel if (FMGCInternal.finalFuelSet) { From 4c246d8efcd4b20f3f22c38ebda62e7abb11dc1d Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Mon, 3 Aug 2020 18:54:14 -0400 Subject: [PATCH 17/45] Extra fuel now based on FOB when engines running --- Models/Instruments/MCDU/MCDU.nas | 4 ---- Nasal/FMGC/FMGC.nas | 35 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 12b8c38e..c7be2241 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -2765,10 +2765,6 @@ var canvas_MCDU_base = { } } me["Simple_L6"].setText(sprintf("%.1f", fmgc.FMGCInternal.minDestFob)); - - fmgc.FMGCInternal.fob = num(getprop("/consumables/fuel/total-fuel-lbs") / 1000); - fmgc.FMGCInternal.fuelPredGw = num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000); - fmgc.FMGCInternal.cg = num(getprop("/FMGC/internal/zfwcg")); me["Simple_R4"].setText(sprintf("%4.1f/" ~ fmgc.FMGCInternal.fffqSensor, fmgc.FMGCInternal.fob)); me["Simple_R5"].setText(sprintf("%4.1f/", fmgc.FMGCInternal.fuelPredGw) ~ sprintf("%4.1f", fmgc.FMGCInternal.cg)); me["Simple_R6"].setText(sprintf("%4.1f/" ~ fmgc.FMGCInternal.extraTime, fmgc.FMGCInternal.extraFuel)); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 3925c37e..6dcb8f9c 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -329,11 +329,6 @@ updateRouteManagerAlt = func() { # var updateFuel = func { - # Check engine status - # if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { - # FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)); - # } - # Calculate (final) holding fuel if (FMGCInternal.finalFuelSet) { final_fuel = 1000 * FMGCInternal.finalFuel; @@ -485,9 +480,23 @@ var updateFuel = func { } } + # extra fuel calcs + updateEnrouteFuel(); + + FMGCInternal.tow = num(FMGCInternal.zfw + FMGCInternal.block - FMGCInternal.taxiFuel); +} + +var updateEnrouteFuel = func { + fmgc.FMGCInternal.fob = num(getprop("/consumables/fuel/total-fuel-lbs") / 1000); + fmgc.FMGCInternal.fuelPredGw = num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000); + # Calcualte extra fuel if (FMGCInternal.blockSet) { - extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); + if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { + extra_fuel = 1000 * num(FMGCInternal.fob - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); + } else { + extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); + } FMGCInternal.extraFuel = extra_fuel / 1000; lw = 1000 * FMGCInternal.lw; extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines @@ -506,12 +515,11 @@ var updateFuel = func { if (FMGCInternal.extraFuel > -0.1 and FMGCInternal.extraFuel < 0.1) { FMGCInternal.extraFuel = 0.0; } - } else { - FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel); - FMGCInternal.blockSet = 1; } - - FMGCInternal.tow = num(FMGCInternal.zfw + FMGCInternal.block - FMGCInternal.taxiFuel); + # else { +# FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel); +# FMGCInternal.blockSet = 1; +# } } ############################ @@ -702,6 +710,11 @@ var masterFMGC = maketimer(0.2, func { FMGCInternal.maxspeed = getprop("/it-fbw/speeds/vmo-mmo"); } + ############################ + # fuel + ############################ + updateEnrouteFuel(); + ############################ # calculate speeds ############################ From 4c33cefa5e42a2ba1ee5e7e94214fb4c47107e87 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Tue, 4 Aug 2020 06:43:18 -0400 Subject: [PATCH 18/45] Live updates of fuel --- Nasal/FMGC/FMGC.nas | 75 +++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 6dcb8f9c..abcf26d2 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -461,7 +461,7 @@ var updateFuel = func { # Calculate reserve fuel if (FMGCInternal.rteRsvSet) { - if (num(FMGCInternal.tripFuel) == 0.0) { + if (num(FMGCInternal.tripFuel) <= 0.0) { FMGCInternal.rtePercent = 0.0; } else { if (num(FMGCInternal.rteRsv / FMGCInternal.tripFuel * 100.0) <= 15.0) { @@ -473,53 +473,48 @@ var updateFuel = func { } else if (FMGCInternal.rtePercentSet) { FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0); } else { - if (num(FMGCInternal.tripFuel) == 0.0) { + if (num(FMGCInternal.tripFuel) <= 0.0) { FMGCInternal.rtePercent = 5.0; } else { FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0); } } - # extra fuel calcs - updateEnrouteFuel(); - - FMGCInternal.tow = num(FMGCInternal.zfw + FMGCInternal.block - FMGCInternal.taxiFuel); -} - -var updateEnrouteFuel = func { + # Misc fuel claclulations + if (getprop("/FMGC/internal/block-calculating")) { + FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel); + FMGCInternal.blockSet = 1; + } fmgc.FMGCInternal.fob = num(getprop("/consumables/fuel/total-fuel-lbs") / 1000); fmgc.FMGCInternal.fuelPredGw = num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000); + fmgc.FMGCInternal.cg = fmgc.FMGCInternal.zfwcg; # Calcualte extra fuel - if (FMGCInternal.blockSet) { - if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { - extra_fuel = 1000 * num(FMGCInternal.fob - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); - } else { - extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); - } - FMGCInternal.extraFuel = extra_fuel / 1000; - lw = 1000 * FMGCInternal.lw; - extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines - if (extra_time < 0) { - extra_time = 0; - } else if (extra_time > 480) { - extra_time = 480; - } - if (num(extra_time) >= 60) { - extra_min = int(math.mod(extra_time, 60)); - extra_hour = int((extra_time - extra_min) / 60); - FMGCInternal.extraTime = sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min); - } else { - FMGCInternal.extraTime = sprintf("%04d", extra_time); - } - if (FMGCInternal.extraFuel > -0.1 and FMGCInternal.extraFuel < 0.1) { - FMGCInternal.extraFuel = 0.0; - } + if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) { + extra_fuel = 1000 * num(FMGCInternal.fob - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); + } else { + extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv); } - # else { -# FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel); -# FMGCInternal.blockSet = 1; -# } + FMGCInternal.extraFuel = extra_fuel / 1000; + lw = 1000 * FMGCInternal.lw; + extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines + if (extra_time < 0) { + extra_time = 0; + } else if (extra_time > 480) { + extra_time = 480; + } + if (num(extra_time) >= 60) { + extra_min = int(math.mod(extra_time, 60)); + extra_hour = int((extra_time - extra_min) / 60); + FMGCInternal.extraTime = sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min); + } else { + FMGCInternal.extraTime = sprintf("%04d", extra_time); + } + if (FMGCInternal.extraFuel > -0.1 and FMGCInternal.extraFuel < 0.1) { + FMGCInternal.extraFuel = 0.0; + } + + FMGCInternal.tow = num(FMGCInternal.zfw + FMGCInternal.block - FMGCInternal.taxiFuel); } ############################ @@ -713,7 +708,7 @@ var masterFMGC = maketimer(0.2, func { ############################ # fuel ############################ - updateEnrouteFuel(); + updateFuel(); ############################ # calculate speeds @@ -1249,7 +1244,7 @@ var timer48gpsAlign3 = maketimer(1, func() { var timer3blockFuel = maketimer(1, func() { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/block-fuel-time") + 3) { - updateFuel(); + #updateFuel(); setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-fuel-time", -99); timer3blockFuel.stop(); @@ -1258,7 +1253,7 @@ var timer3blockFuel = maketimer(1, func() { var timer5fuelPred = maketimer(1, func() { if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/fuel-pred-time") + 5) { - updateFuel(); + #updateFuel(); setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-pred-time", -99); timer5fuelPred.stop(); From f8508feccbe6deebc4944c3507376da43400ecbf Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 4 Aug 2020 12:25:51 +0100 Subject: [PATCH 19/45] Correct path to simbrief -- there shouldn't be any danger in having this, since you can't press it more than once during parsing, anyway --- Nasal/FMGC/SimbriefParser.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index eac37743..e33ee451 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -10,9 +10,9 @@ var SimbriefParser = { fetch: func(username, i) { me.inhibit = 1; var stamp = systime(); - http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml") + http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") .fail(func mcdu.mcdu_message(i, "SIMBRIEF FAILED")) - .done(func me.read(getprop('/sim/fg-home') ~ "/Export/simbrief" ~ stamp ~ ".xml", i)); + .done(func me.read(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml", i)); }, read: func(xml, i) { var data = io.readxml(xml); From 5eefa330dd09c291357c93ca14949433a21cf3bf Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 4 Aug 2020 13:00:31 +0100 Subject: [PATCH 20/45] Fix simbrief dialog --- AircraftConfig/acconfig.nas | 2 +- AircraftConfig/simbrief.xml | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 7ff2d44d..7f9e31f6 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -230,7 +230,7 @@ var readSettings = func { setprop("/sim/model/autopush/route/show", getprop("/systems/acconfig/options/autopush/show-route")); setprop("/sim/model/autopush/route/show-wingtip", getprop("/systems/acconfig/options/autopush/show-wingtip")); setprop("/options/system/fo-view", getprop("/systems/acconfig/options/fo-view")); - setprop("/FMGC/internal/simbrief-username", getprop("/systems/acconfig/options/simbrief-username")); + setprop("/FMGC/simbrief-username", getprop("/systems/acconfig/options/simbrief-username")); } var writeSettings = func { diff --git a/AircraftConfig/simbrief.xml b/AircraftConfig/simbrief.xml index 28fe1398..322311a8 100644 --- a/AircraftConfig/simbrief.xml +++ b/AircraftConfig/simbrief.xml @@ -9,6 +9,12 @@ simbrief vbox + + + acconfig.writeSettings(); + + + hbox @@ -49,25 +55,30 @@ left - + hbox - - left - - - 200 25 + /FMGC/simbrief-username dialog-apply - true + true + + From c7cc93caf0ecede1dbae81ba529d6bcec8c45989 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 4 Aug 2020 16:35:01 +0100 Subject: [PATCH 21/45] Correct power supply / VHF3 interaction of simbrief --- Nasal/MCDU/INITA.nas | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 57be5da3..3fffc6f9 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -225,12 +225,20 @@ var initInputA = func(key, i) { } } else if (key == "R2") { if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { - if (getprop("/FMGC/simbrief-username") == "") { - mcdu.mcdu_message(i, "MISSING USERNAME") - } elsif (!Simbrief.SimbriefParser.inhibit) { - Simbrief.SimbriefParser.fetch(getprop("/FMGC/simbrief-username"), i); + if (!ecam.vhf3_voice.active) { + if (atsu.ATSU.working) { + if (getprop("/FMGC/simbrief-username") == "") { + mcdu.mcdu_message(i, "MISSING USERNAME") + } elsif (!Simbrief.SimbriefParser.inhibit) { + Simbrief.SimbriefParser.fetch(getprop("/FMGC/simbrief-username"), i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NO COMM MSG NOT GEN"); + } } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "VHF3 VOICE MSG NOT GEN"); } } else { mcdu_message(i, "NOT ALLOWED"); From e45baeeb0d4bacdcc630129a1810671e44ea9d73 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 4 Aug 2020 18:04:00 +0100 Subject: [PATCH 22/45] Bugfix MCDU, bugfix the flightplan dialog --- AircraftConfig/acconfig.nas | 2 +- Models/Instruments/MCDU/MCDU.nas | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 7f9e31f6..ed346cc7 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -102,7 +102,7 @@ var error_mismatch = gui.Dialog.new("/sim/gui/dialogs/acconfig/error/mismatch/di var fuel_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/fuel/dialog", "Aircraft/A320-family/AircraftConfig/fuel.xml"); var groundservices_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/groundsrvc/dialog", "Aircraft/A320-family/AircraftConfig/groundservices.xml"); var loadflightplan_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/loadfpln/dialog","Aircraft/A320-family/AircraftConfig/load-flightplan.xml"); -var simbrief_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/loadfpln/dialog","Aircraft/A320-family/AircraftConfig/simbrief.xml"); +var simbrief_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/simbrief/dialog","Aircraft/A320-family/AircraftConfig/simbrief.xml"); var du_quality = gui.Dialog.new("/sim/gui/dialogs/acconfig/du-quality/dialog", "Aircraft/A320-family/AircraftConfig/du-quality.xml"); var rendering_dlg = gui.Dialog.new("/sim/gui/dialogs/rendering/dialog", "Aircraft/A320-family/AircraftConfig/rendering.xml"); spinning.start(); diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index c7be2241..85e9a267 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -1203,9 +1203,6 @@ var canvas_MCDU_base = { me.colorRightS("grn", "blu", "blu", "wht", "wht", "blu"); me.colorRightArrow("wht", "blu", "blu", "wht", "wht", "wht"); - me["Simple_L1S"].setFontSize(normal); - me["Simple_C1S"].setFontSize(normal); - me["Simple_R1S"].setFontSize(normal); me["Simple_L1S"].setText(" AUTO"); me["Simple_C1S"].setText("SITA725 "); me["Simple_L2S"].setText(" SITA725"); From 536f61d197648e970ba146345b5a0d70b45f5ccd Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 5 Aug 2020 05:36:25 -0400 Subject: [PATCH 23/45] Implement history winds --- Nasal/FMGC/winds.nas | 61 ++++++++++++++ Nasal/MCDU/MCDU.nas | 24 ++++-- Nasal/MCDU/WINDHIST.nas | 175 ++++++++++++++++++++++++++++++---------- 3 files changed, 208 insertions(+), 52 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index b2c477a1..3819c494 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -93,6 +93,7 @@ var windController = { clb_winds: [0, 0, 0], crz_winds: [0, 0, 0], des_winds: [0, 0, 0], + hist_winds: 0, winds: [[], [], []], #waypoint winds used if route includes navaids nav_indicies: [[], [], []], windSizes: [0, 0, 0], @@ -104,6 +105,8 @@ var windController = { me.clb_winds[2] = waypoint_winds.new("climb", "waypoint", 1); me.crz_winds[2] = waypoint_winds.new("cruize", "waypoint", 1); me.des_winds[2] = waypoint_winds.new("descent", "waypoint", 1); + me.hist_winds = waypoint_winds.new("history", "waypoint", 1); + me.read(); }, reset: func() { @@ -217,6 +220,62 @@ var windController = { me.waypointsChanged(); #me.temporaryFlag[n] = 0; }, + # read - read from hist wind file, create one if it doesn't exist + read: func() { + var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt"; + # create file if it doesn't exist + if (io.stat(path) == nil) { + me.write(); + } + var file = io.open(path); + if (file != nil) { + var line = io.readln(file); + var temp_line = split(",", line); + me.hist_winds.wind1.heading = temp_line[0]; + me.hist_winds.wind1.magnitude = temp_line[1]; + me.hist_winds.wind1.altitude = temp_line[2]; + + line = io.readln(file); + temp_line = split(",", line); + me.hist_winds.wind2.heading = temp_line[0]; + me.hist_winds.wind2.magnitude = temp_line[1]; + me.hist_winds.wind2.altitude = temp_line[2]; + + line = io.readln(file); + temp_line = split(",", line); + me.hist_winds.wind3.heading = temp_line[0]; + me.hist_winds.wind3.magnitude = temp_line[1]; + me.hist_winds.wind3.altitude = temp_line[2]; + + line = io.readln(file); + temp_line = split(",", line); + me.hist_winds.wind4.heading = temp_line[0]; + me.hist_winds.wind4.magnitude = temp_line[1]; + me.hist_winds.wind4.altitude = temp_line[2]; + + line = io.readln(file); + temp_line = split(",", line); + me.hist_winds.wind5.heading = temp_line[0]; + me.hist_winds.wind5.magnitude = temp_line[1]; + me.hist_winds.wind5.altitude = temp_line[2]; + } + }, + # write - write to hist wind file, called whenever winds changed + # note - using previous descent winds, in future actually record the values + write: func() { + if (me.des_winds[2] != 0) { + var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt"; + var file = io.open(path, "wb"); + io.write(file, me.des_winds[2].wind1.heading ~ "," ~ me.des_winds[2].wind1.magnitude ~ "," ~ me.des_winds[2].wind1.altitude ~ "\n"); + io.write(file, me.des_winds[2].wind2.heading ~ "," ~ me.des_winds[2].wind2.magnitude ~ "," ~ me.des_winds[2].wind2.altitude ~ "\n"); + io.write(file, me.des_winds[2].wind3.heading ~ "," ~ me.des_winds[2].wind3.magnitude ~ "," ~ me.des_winds[2].wind3.altitude ~ "\n"); + io.write(file, me.des_winds[2].wind4.heading ~ "," ~ me.des_winds[2].wind4.magnitude ~ "," ~ me.des_winds[2].wind4.altitude ~ "\n"); + io.write(file, me.des_winds[2].wind5.heading ~ "," ~ me.des_winds[2].wind5.magnitude ~ "," ~ me.des_winds[2].wind5.altitude ~ "\n"); + io.close(file); + } else { + print("no wind data"); + } + }, insertWind: func(plan, index, value, id) { if (me.windSizes[plan] == index) { @@ -398,5 +457,7 @@ var windController = { if (canvas_mcdu.myHISTWIND[0] != nil) { canvas_mcdu.myHISTWIND[0].reload(); } + + me.write(); } }; diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 699ba6bd..6a996cd1 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -525,8 +525,6 @@ var lskbutton = func(btn, i) { canvas_mcdu.myCRZWIND[i].pushButtonLeft(6); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(6); - #} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { - # canvas_mcdu.myHISTWIND[i].pushButtonRight(6); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); @@ -592,12 +590,16 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { - if (canvas_mcdu.myHISTWIND[i] == nil) { - canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); + if (fmgc.FMGCInternal.phase == 0) { + if (canvas_mcdu.myHISTWIND[i] == nil) { + canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); + } else { + canvas_mcdu.myHISTWIND[i].reload(); + } + setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); } else { - canvas_mcdu.myHISTWIND[i].reload(); + mcdu_message(i, "NOT ALLOWED"); } - setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonRight(1); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { @@ -889,8 +891,14 @@ var rskbutton = func(btn, i) { canvas_mcdu.myCRZWIND[i].pushButtonRight(6); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonRight(6); - #} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { - # canvas_mcdu.myHISTWIND[i].pushButtonRight(6); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { + canvas_mcdu.myHISTWIND[i].pushButtonRight(6); + if (canvas_mcdu.myCLBWIND[i] == nil) { + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + } else { + canvas_mcdu.myCLBWIND[i].reload(); + } + setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 94bd5b08..d24a7d78 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -33,7 +33,7 @@ var windHISTPage = { var whp = {parents:[windHISTPage]}; whp.computer = computer; whp._setupPageWithData(); - whp.updateTmpy(); + #whp.updateTmpy(); return whp; }, del: func() { @@ -42,17 +42,63 @@ var windHISTPage = { _setupPageWithData: func() { me.title = "HISTORY WIND"; me.titleColour = "wht"; - me.L1 = ["----/---", "", "blu"]; - me.L2 = ["----/---", "", "blu"]; - me.L3 = ["----/---", "", "blu"]; - me.L4 = ["----/---", "", "blu"]; - me.L5 = ["----/---", "", "blu"]; + + if (fmgc.windController.hist_winds.wind1.altitude != "") { + me.L1 = [sprintf("%03d/", fmgc.windController.hist_winds.wind1.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind1.magnitude), "", "grn"]; + me.C1 = [fmgc.windController.hist_winds.wind1.altitude, "", "grn"]; + fmgc.windController.hist_winds.wind1.set = 1; + } else { + me.L1 = ["", "", "grn"]; + me.C1 = ["", "", "grn"]; + #me.L1 = ["----/---", "", "grn"]; + #me.C1 = ["FL050", "", "grn"]; + } + + if (fmgc.windController.hist_winds.wind2.altitude != "") { + me.L2 = [sprintf("%03d/", fmgc.windController.hist_winds.wind2.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind2.magnitude), "", "grn"]; + me.C2 = [fmgc.windController.hist_winds.wind2.altitude, "", "grn"]; + fmgc.windController.hist_winds.wind2.set = 1; + } else { + me.L2 = ["", "", "grn"]; + me.C2 = ["", "", "grn"]; + #me.L2 = ["----/---", "", "grn"]; + #me.C2 = ["FL150", "", "grn"]; + } + + if (fmgc.windController.hist_winds.wind3.altitude != "") { + me.L3 = [sprintf("%03d/", fmgc.windController.hist_winds.wind3.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind3.magnitude), "", "grn"]; + me.C3 = [fmgc.windController.hist_winds.wind3.altitude, "", "grn"]; + fmgc.windController.hist_winds.wind3.set = 1; + } else { + me.L3 = ["", "", "grn"]; + me.C3 = ["", "", "grn"]; + #me.L3 = ["----/---", "", "grn"]; + #me.C3 = ["FL250", "", "grn"]; + } + + if (fmgc.windController.hist_winds.wind4.altitude != "") { + me.L4 = [sprintf("%03d/", fmgc.windController.hist_winds.wind4.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind4.magnitude), "", "grn"]; + me.C4 = [fmgc.windController.hist_winds.wind4.altitude, "", "grn"]; + fmgc.windController.hist_winds.wind4.set = 1; + } else { + me.L4 = ["", "", "grn"]; + me.C4 = ["", "", "grn"]; + #me.L4 = ["----/---", "", "grn"]; + #me.C4 = [" FL--- CRZ FL", "", "grn"]; + } + + if (fmgc.windController.hist_winds.wind5.altitude != "") { + me.L5 = [sprintf("%03d/", fmgc.windController.hist_winds.wind5.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind5.magnitude), "", "grn"]; + me.C5 = [fmgc.windController.hist_winds.wind5.altitude, "", "grn"]; + fmgc.windController.hist_winds.wind5.set = 1; + } else { + me.L5 = ["", "", "grn"]; + me.C5 = ["", "", "grn"]; + #me.L5 = ["----/---", "", "grn"]; + #me.C5 = ["FL370", "", "grn"]; + } + me.L6 = [" CLIMB WIND", "", "wht"]; - me.C1 = ["FL050", "", "blu"]; - me.C2 = ["FL150", "", "blu"]; - me.C3 = ["FL250", "", "blu"]; - me.C4 = [" FL--- CRZ FL", "", "blu"]; - me.C5 = ["FL370", "", "blu"]; me.R6 = ["SELECT ", "", "amb"]; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; @@ -60,40 +106,81 @@ var windHISTPage = { me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, - makeTmpy: func() { - if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); - } - }, - updateTmpy: func() { - if (fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.L1[2] = "yel"; - me.L2[2] = "yel"; - me.L3[2] = "yel"; - me.L4[2] = "yel"; - me.L5[2] = "yel"; - me.C1[2] = "yel"; - me.C2[2] = "yel"; - me.C3[2] = "yel"; - me.C4[2] = "yel"; - me.C5[2] = "yel"; - canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); - } else { - me.L1[2] = "blu"; - me.L2[2] = "blu"; - me.L3[2] = "blu"; - me.L4[2] = "blu"; - me.L5[2] = "blu"; - me.C1[2] = "blu"; - me.C2[2] = "blu"; - me.C3[2] = "blu"; - me.C4[2] = "blu"; - me.C5[2] = "blu"; - canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); - } - }, + # makeTmpy: func() { +# if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { +# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); +# } +# }, + # updateTmpy: func() { +# if (fmgc.flightPlanController.temporaryFlag[me.computer]) { +# me.L1[2] = "yel"; +# me.L2[2] = "yel"; +# me.L3[2] = "yel"; +# me.L4[2] = "yel"; +# me.L5[2] = "yel"; +# me.C1[2] = "yel"; +# me.C2[2] = "yel"; +# me.C3[2] = "yel"; +# me.C4[2] = "yel"; +# me.C5[2] = "yel"; +# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); +# } else { +# me.L1[2] = "blu"; +# me.L2[2] = "blu"; +# me.L3[2] = "blu"; +# me.L4[2] = "blu"; +# me.L5[2] = "blu"; +# me.C1[2] = "blu"; +# me.C2[2] = "blu"; +# me.C3[2] = "blu"; +# me.C4[2] = "blu"; +# me.C5[2] = "blu"; +# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); +# } +# }, reload: func() { me._setupPageWithData(); - me.updateTmpy(); + #me.updateTmpy(); + }, + pushButtonRight: func(index) { + if (index == 6) { + var hist_winds = fmgc.windController.hist_winds; + if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) { + if (hist_winds.wind1.set) { + fmgc.windController.clb_winds[2].wind1.heading = hist_winds.wind1.heading; + fmgc.windController.clb_winds[2].wind1.magnitude = hist_winds.wind1.magnitude; + fmgc.windController.clb_winds[2].wind1.altitude = hist_winds.wind1.altitude; + fmgc.windController.clb_winds[2].wind1.set = 1; + } + if (hist_winds.wind2.set) { + fmgc.windController.clb_winds[2].wind2.heading = hist_winds.wind2.heading; + fmgc.windController.clb_winds[2].wind2.magnitude = hist_winds.wind2.magnitude; + fmgc.windController.clb_winds[2].wind2.altitude = hist_winds.wind2.altitude; + fmgc.windController.clb_winds[2].wind2.set = 1; + } + if (hist_winds.wind3.set) { + fmgc.windController.clb_winds[2].wind3.heading = hist_winds.wind3.heading; + fmgc.windController.clb_winds[2].wind3.magnitude = hist_winds.wind3.magnitude; + fmgc.windController.clb_winds[2].wind3.altitude = hist_winds.wind3.altitude; + fmgc.windController.clb_winds[2].wind3.set = 1; + } + if (hist_winds.wind4.set) { + fmgc.windController.clb_winds[2].wind4.heading = hist_winds.wind4.heading; + fmgc.windController.clb_winds[2].wind4.magnitude = hist_winds.wind4.magnitude; + fmgc.windController.clb_winds[2].wind4.altitude = hist_winds.wind4.altitude; + fmgc.windController.clb_winds[2].wind4.set = 1; + } + if (hist_winds.wind5.set) { + fmgc.windController.clb_winds[2].wind5.heading = hist_winds.wind5.heading; + fmgc.windController.clb_winds[2].wind5.magnitude = hist_winds.wind5.magnitude; + fmgc.windController.clb_winds[2].wind5.altitude = hist_winds.wind5.altitude; + fmgc.windController.clb_winds[2].wind5.set = 1; + } + } else { + mcdu_message(me.computer, "NO WINDS"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }; \ No newline at end of file From 0f820ece04d9aa30592c72864ccb2263599dc01e Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 5 Aug 2020 05:47:16 -0400 Subject: [PATCH 24/45] Bug fix if no winds stored --- Nasal/MCDU/MCDU.nas | 6 ------ Nasal/MCDU/WINDHIST.nas | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 6a996cd1..c9158e19 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -893,12 +893,6 @@ var rskbutton = func(btn, i) { canvas_mcdu.myDESWIND[i].pushButtonRight(6); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { canvas_mcdu.myHISTWIND[i].pushButtonRight(6); - if (canvas_mcdu.myCLBWIND[i] == nil) { - canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); - } else { - canvas_mcdu.myCLBWIND[i].reload(); - } - setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index d24a7d78..855096b0 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -176,6 +176,12 @@ var windHISTPage = { fmgc.windController.clb_winds[2].wind5.altitude = hist_winds.wind5.altitude; fmgc.windController.clb_winds[2].wind5.set = 1; } + if (canvas_mcdu.myCLBWIND[me.computer] == nil) { + canvas_mcdu.myCLBWIND[me.computer] = windCLBPage.new(me.computer); + } else { + canvas_mcdu.myCLBWIND[me.computer].reload(); + } + setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCLB"); } else { mcdu_message(me.computer, "NO WINDS"); } From 366382c9ccbf6bacf9f18680aedf1d3f5e536e2d Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 5 Aug 2020 19:37:26 -0400 Subject: [PATCH 25/45] Actually record previous flight's wind, add missing degree symbols --- Nasal/FMGC/FMGC.nas | 42 ++++++++++++++++++++++++++++++++ Nasal/FMGC/winds.nas | 39 +++++++++++++++++++++++------ Nasal/MCDU/WINDCLB.nas | 10 ++++---- Nasal/MCDU/WINDCRZ.nas | 16 ++++++------ Nasal/MCDU/WINDDES.nas | 12 ++++----- Nasal/MCDU/WINDHIST.nas | 54 +++++++++++++++++++++++++++++++++-------- 6 files changed, 136 insertions(+), 37 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index abcf26d2..24a02626 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -710,6 +710,48 @@ var masterFMGC = maketimer(0.2, func { ############################ updateFuel(); + ############################ + # wind + ############################ + if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) { + var windsDidChange = 0; + if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) { + if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl050_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl050_wind[1]) { + fmgc.windController.fl050_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/")); + fmgc.windController.fl050_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/")); + fmgc.windController.fl050_wind[2] = "FL050"; + windsDidChange = 1; + } + } + if (FMGCInternal.crzFt > 15000 and alt > 14980 and alt < 15020) { + if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl150_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl150_wind[1]) { + fmgc.windController.fl150_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/")); + fmgc.windController.fl150_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/")); + fmgc.windController.fl150_wind[2] = "FL150"; + windsDidChange = 1; + } + } + if (FMGCInternal.crzFt > 25000 and alt > 24980 and alt < 25020) { + if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl250_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl250_wind[1]) { + fmgc.windController.fl250_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/")); + fmgc.windController.fl250_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/")); + fmgc.windController.fl250_wind[2] = "FL250"; + windsDidChange = 1; + } + } + if (FMGCInternal.crzSet and alt > FMGCInternal.crzFt - 20 and alt < FMGCInternal.crzFt + 20) { + if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.flcrz_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.flcrz_wind[1]) { + fmgc.windController.flcrz_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/")); + fmgc.windController.flcrz_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/")); + fmgc.windController.flcrz_wind[2] = "FL" ~ FMGCInternal.crzFl; + windsDidChange = 1; + } + } + if (windsDidChange) { + fmgc.windController.write(); + } + } + ############################ # calculate speeds ############################ diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 3819c494..b2c78036 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -94,6 +94,10 @@ var windController = { crz_winds: [0, 0, 0], des_winds: [0, 0, 0], hist_winds: 0, + fl050_wind: [-1, -1, ""], + fl150_wind: [-1, -1, ""], + fl250_wind: [-1, -1, ""], + flcrz_wind: [-1, -1, ""], winds: [[], [], []], #waypoint winds used if route includes navaids nav_indicies: [[], [], []], windSizes: [0, 0, 0], @@ -261,16 +265,37 @@ var windController = { } }, # write - write to hist wind file, called whenever winds changed - # note - using previous descent winds, in future actually record the values write: func() { if (me.des_winds[2] != 0) { var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt"; var file = io.open(path, "wb"); - io.write(file, me.des_winds[2].wind1.heading ~ "," ~ me.des_winds[2].wind1.magnitude ~ "," ~ me.des_winds[2].wind1.altitude ~ "\n"); - io.write(file, me.des_winds[2].wind2.heading ~ "," ~ me.des_winds[2].wind2.magnitude ~ "," ~ me.des_winds[2].wind2.altitude ~ "\n"); - io.write(file, me.des_winds[2].wind3.heading ~ "," ~ me.des_winds[2].wind3.magnitude ~ "," ~ me.des_winds[2].wind3.altitude ~ "\n"); - io.write(file, me.des_winds[2].wind4.heading ~ "," ~ me.des_winds[2].wind4.magnitude ~ "," ~ me.des_winds[2].wind4.altitude ~ "\n"); - io.write(file, me.des_winds[2].wind5.heading ~ "," ~ me.des_winds[2].wind5.magnitude ~ "," ~ me.des_winds[2].wind5.altitude ~ "\n"); + var winds_added = 0; + + if (me.fl050_wind[2] != "") { + io.write(file, me.fl050_wind[0] ~ "," ~ me.fl050_wind[1] ~ "," ~ me.fl050_wind[2] ~ "\n"); + winds_added += 1; + } + + if (me.fl150_wind[2] != "") { + io.write(file, me.fl150_wind[0] ~ "," ~ me.fl150_wind[1] ~ "," ~ me.fl150_wind[2] ~ "\n"); + winds_added += 1; + } + + if (me.fl250_wind[2] != "") { + io.write(file, me.fl250_wind[0] ~ "," ~ me.fl250_wind[1] ~ "," ~ me.fl250_wind[2] ~ "\n"); + winds_added += 1; + } + + if (me.flcrz_wind[2] != "") { + io.write(file, me.flcrz_wind[0] ~ "," ~ me.flcrz_wind[1] ~ "," ~ me.flcrz_wind[2] ~ "\n"); + winds_added += 1; + } + + while (winds_added < 5) { + io.write(file, "-1,-1,\n"); + winds_added += 1; + } + io.close(file); } else { print("no wind data"); @@ -457,7 +482,5 @@ var windController = { if (canvas_mcdu.myHISTWIND[0] != nil) { canvas_mcdu.myHISTWIND[0].reload(); } - - me.write(); } }; diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 00e6d044..a3b574dc 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -71,7 +71,7 @@ var windCLBPage = { me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { - me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L5 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][4] = 1; } } else { @@ -84,7 +84,7 @@ var windCLBPage = { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; } } else { @@ -97,7 +97,7 @@ var windCLBPage = { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; } } else { @@ -110,7 +110,7 @@ var windCLBPage = { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; } } else { @@ -123,7 +123,7 @@ var windCLBPage = { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } } diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index ea422864..00de8535 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -98,7 +98,7 @@ var windCRZPage = { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; } } else { @@ -111,7 +111,7 @@ var windCRZPage = { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; } } else { @@ -124,7 +124,7 @@ var windCRZPage = { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; } } else { @@ -137,7 +137,7 @@ var windCRZPage = { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } } @@ -157,7 +157,7 @@ var windCRZPage = { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; } } else { @@ -170,7 +170,7 @@ var windCRZPage = { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; } } else { @@ -183,7 +183,7 @@ var windCRZPage = { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; } } else { @@ -196,7 +196,7 @@ var windCRZPage = { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } } diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 93333358..3ae5f763 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -72,7 +72,7 @@ var windDESPage = { me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { - me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L5 = ["[ ]/°[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][4] = 1; } } else { @@ -85,7 +85,7 @@ var windDESPage = { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; } } else { @@ -98,7 +98,7 @@ var windDESPage = { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; } } else { @@ -111,7 +111,7 @@ var windDESPage = { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; } } else { @@ -124,7 +124,7 @@ var windDESPage = { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } } @@ -137,7 +137,7 @@ var windDESPage = { me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 1; } else { - me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; + me.R1 = ["[ ]°/[ ]", "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 1; } } else { diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 855096b0..86c2c6a4 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -43,9 +43,27 @@ var windHISTPage = { me.title = "HISTORY WIND"; me.titleColour = "wht"; + var lastIndex = 0; + + if (fmgc.windController.hist_winds.wind5.altitude != "") { + lastIndex = 5; + } else if (fmgc.windController.hist_winds.wind4.altitude != "") { + lastIndex = 4; + } else if (fmgc.windController.hist_winds.wind3.altitude != "") { + lastIndex = 3; + } else if (fmgc.windController.hist_winds.wind2.altitude != "") { + lastIndex = 2; + } else if (fmgc.windController.hist_winds.wind1.altitude != "") { + lastIndex = 1; + } + if (fmgc.windController.hist_winds.wind1.altitude != "") { - me.L1 = [sprintf("%03d/", fmgc.windController.hist_winds.wind1.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind1.magnitude), "", "grn"]; - me.C1 = [fmgc.windController.hist_winds.wind1.altitude, "", "grn"]; + me.L1 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind1.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind1.magnitude), "", "grn"]; + if (lastIndex == 1) { + me.C1 = [" " ~ fmgc.windController.hist_winds.wind1.altitude ~ " CRZ FL", "", "grn"]; + } else { + me.C1 = [fmgc.windController.hist_winds.wind1.altitude, "", "grn"]; + } fmgc.windController.hist_winds.wind1.set = 1; } else { me.L1 = ["", "", "grn"]; @@ -55,8 +73,12 @@ var windHISTPage = { } if (fmgc.windController.hist_winds.wind2.altitude != "") { - me.L2 = [sprintf("%03d/", fmgc.windController.hist_winds.wind2.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind2.magnitude), "", "grn"]; - me.C2 = [fmgc.windController.hist_winds.wind2.altitude, "", "grn"]; + me.L2 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind2.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind2.magnitude), "", "grn"]; + if (lastIndex == 2) { + me.C2 = [" " ~ fmgc.windController.hist_winds.wind2.altitude ~ " CRZ FL", "", "grn"]; + } else { + me.C2 = [fmgc.windController.hist_winds.wind2.altitude, "", "grn"]; + } fmgc.windController.hist_winds.wind2.set = 1; } else { me.L2 = ["", "", "grn"]; @@ -66,8 +88,12 @@ var windHISTPage = { } if (fmgc.windController.hist_winds.wind3.altitude != "") { - me.L3 = [sprintf("%03d/", fmgc.windController.hist_winds.wind3.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind3.magnitude), "", "grn"]; - me.C3 = [fmgc.windController.hist_winds.wind3.altitude, "", "grn"]; + me.L3 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind3.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind3.magnitude), "", "grn"]; + if (lastIndex == 3) { + me.C3 = [" " ~ fmgc.windController.hist_winds.wind3.altitude ~ " CRZ FL", "", "grn"]; + } else { + me.C3 = [fmgc.windController.hist_winds.wind3.altitude, "", "grn"]; + } fmgc.windController.hist_winds.wind3.set = 1; } else { me.L3 = ["", "", "grn"]; @@ -77,8 +103,12 @@ var windHISTPage = { } if (fmgc.windController.hist_winds.wind4.altitude != "") { - me.L4 = [sprintf("%03d/", fmgc.windController.hist_winds.wind4.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind4.magnitude), "", "grn"]; - me.C4 = [fmgc.windController.hist_winds.wind4.altitude, "", "grn"]; + me.L4 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind4.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind4.magnitude), "", "grn"]; + if (lastIndex == 4) { + me.C4 = [" " ~ fmgc.windController.hist_winds.wind4.altitude ~ " CRZ FL", "", "grn"]; + } else { + me.C4 = [fmgc.windController.hist_winds.wind4.altitude, "", "grn"]; + } fmgc.windController.hist_winds.wind4.set = 1; } else { me.L4 = ["", "", "grn"]; @@ -88,8 +118,12 @@ var windHISTPage = { } if (fmgc.windController.hist_winds.wind5.altitude != "") { - me.L5 = [sprintf("%03d/", fmgc.windController.hist_winds.wind5.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind5.magnitude), "", "grn"]; - me.C5 = [fmgc.windController.hist_winds.wind5.altitude, "", "grn"]; + me.L5 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind5.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind5.magnitude), "", "grn"]; + if (lastIndex == 5) { + me.C5 = [" " ~ fmgc.windController.hist_winds.wind5.altitude ~ " CRZ FL", "", "grn"]; + } else { + me.C5 = [fmgc.windController.hist_winds.wind5.altitude, "", "grn"]; + } fmgc.windController.hist_winds.wind5.set = 1; } else { me.L5 = ["", "", "grn"]; From cde92dd5afb2e8a93ef2cac553b7d29a58995eb7 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 5 Aug 2020 21:42:43 -0400 Subject: [PATCH 26/45] Fix vapp bug --- Nasal/MCDU/PERFAPPR.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/MCDU/PERFAPPR.nas b/Nasal/MCDU/PERFAPPR.nas index a1e88d17..5486c0a7 100644 --- a/Nasal/MCDU/PERFAPPR.nas +++ b/Nasal/MCDU/PERFAPPR.nas @@ -81,7 +81,7 @@ var perfAPPRInput = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { setprop("/FMGC/internal/vapp-speed-set", 1); - setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad); + fmgc.FMGCInternal.vapp_appr = scratchpad; mcdu_scratchpad.scratchpads[i].empty(); } else { mcdu_message(i, "NOT ALLOWED"); From e48e060ef6afb1fa2e766f2717e6dcfe67a9b704 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 7 Aug 2020 11:44:03 +0100 Subject: [PATCH 27/45] Invalid flightplan input won't crash flightgear --- Nasal/FMGC/SimbriefParser.nas | 4 ++-- Nasal/FMGC/mcdu-messages.nas | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index e33ee451..1aebecfd 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -11,7 +11,7 @@ var SimbriefParser = { me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") - .fail(func mcdu.mcdu_message(i, "SIMBRIEF FAILED")) + .fail(func mcdu.mcdu_message(i, "SIMBRIEF DOWNLOAD FAILED")) .done(func me.read(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml", i)); }, read: func(xml, i) { @@ -35,7 +35,7 @@ var SimbriefParser = { me.store1 = me.OFP.getChild("general"); me.store2 = me.OFP.getChild("alternate"); - fmgc.FMGCInternal.flightNum = me.store1.getChild("icao_airline").getValue() ~ me.store1.getChild("flight_number").getValue(); + fmgc.FMGCInternal.flightNum = me.store1.getChild("icao_airline").getValue() or "" ~ me.store1.getChild("flight_number").getValue() or ""; fmgc.FMGCInternal.flightNumSet = 1; fmgc.FMGCInternal.costIndex = me.store1.getChild("costindex").getValue(); fmgc.FMGCInternal.costIndexSet = 1; diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 85fbcda2..f7aa6575 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -172,7 +172,7 @@ var MessageController = { TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), - TypeIMessage.new("SIMBRIEF FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"), + TypeIMessage.new("SIMBRIEF DOWNLOAD FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"), ]), 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"), From 1b9c2667bf8c7893ac36c85fcb8361d9bbfeff0e Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 7 Aug 2020 12:44:22 +0100 Subject: [PATCH 28/45] Fix DCT routing simbrief parser --- Nasal/FMGC/SimbriefParser.nas | 88 ++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 1aebecfd..070e584e 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -82,55 +82,57 @@ var SimbriefParser = { }); me.store1 = me.OFP.getChild("navlog").getChildren(); - var firstIsSID = 0; - var SIDID = ""; - if (me.store1[0].getChild("is_sid_star").getValue() == 1) { - if (fmgc.flightPlanController.flightplans[3].departure.getSid(me.store1[0].getChild("via_airway").getValue()) != nil) { - firstIsSID = 1; - SIDID = me.store1[0].getChild("via_airway").getValue(); - } - } - var lastIsSTAR = 0; - var STARID = ""; - if (me.store1[-1].getChild("is_sid_star").getValue() == 1) { - if (fmgc.flightPlanController.flightplans[3].destination.getStar(me.store1[-1].getChild("via_airway").getValue()) != nil) { - lastIsSTAR = 1; - STARID = me.store1[-1].getChild("via_airway").getValue(); - } - } - - var lastSIDIndex = -999; - var firstSTARIndex = -999; - var TOCinSIDflag = 0; - var TODinSTARflag = 0; - for (var i = 0; i < size(me.store1); i = i + 1) { - if (firstIsSID) { - if (me.store1[i].getChild("is_sid_star").getValue() == 0 or me.store1[i].getChild("via_airway").getValue() != SIDID) { - lastSIDIndex = i - 1; - break; + if (size(me.store1) != 0) { + var firstIsSID = 0; + var SIDID = ""; + if (me.store1[0].getChild("is_sid_star").getValue() == 1) { + if (fmgc.flightPlanController.flightplans[3].departure.getSid(me.store1[0].getChild("via_airway").getValue()) != nil) { + firstIsSID = 1; + SIDID = me.store1[0].getChild("via_airway").getValue(); + } + } + var lastIsSTAR = 0; + var STARID = ""; + if (me.store1[-1].getChild("is_sid_star").getValue() == 1) { + if (fmgc.flightPlanController.flightplans[3].destination.getStar(me.store1[-1].getChild("via_airway").getValue()) != nil) { + lastIsSTAR = 1; + STARID = me.store1[-1].getChild("via_airway").getValue(); } } - } - for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex; i < size(me.store1); i = i + 1) { - if (STARID != "") { - if (me.store1[i].getChild("is_sid_star").getValue() == 1 and me.store1[i].getChild("via_airway").getValue() == STARID) { - firstSTARIndex = i; - break; + var lastSIDIndex = -999; + var firstSTARIndex = -999; + var TOCinSIDflag = 0; + var TODinSTARflag = 0; + for (var i = 0; i < size(me.store1); i = i + 1) { + if (firstIsSID) { + if (me.store1[i].getChild("is_sid_star").getValue() == 0 or me.store1[i].getChild("via_airway").getValue() != SIDID) { + lastSIDIndex = i - 1; + break; + } } } + + for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex; i < size(me.store1); i = i + 1) { + if (STARID != "") { + if (me.store1[i].getChild("is_sid_star").getValue() == 1 and me.store1[i].getChild("via_airway").getValue() == STARID) { + firstSTARIndex = i; + break; + } + } + } + + var max = firstSTARIndex == -999 ? size(me.store1) - 1 : firstSTARIndex - 1; + for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex + 2; i < max; i = i + 1) { + if (me.store1[i].getChild("ident").getValue() == "TOC" or me.store1[i].getChild("ident").getValue() == "TOD") { continue; } + var coord = geo.Coord.new(); + coord.set_latlon(me.store1[i].getChild("pos_lat").getValue(), me.store1[i].getChild("pos_long").getValue()); + var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); + fmgc.flightPlanController.flightplans[3].appendWP(WP); + } + fmgc.flightPlanController.flightplans[3].sid = fmgc.flightPlanController.flightplans[3].departure.getSid(SIDID); + fmgc.flightPlanController.flightplans[3].star = fmgc.flightPlanController.flightplans[3].destination.getStar(STARID); } - - var max = firstSTARIndex == -999 ? size(me.store1) - 1 : firstSTARIndex - 1; - for (var i = lastSIDIndex == -999 ? 0 : lastSIDIndex + 2; i < max; i = i + 1) { - if (me.store1[i].getChild("ident").getValue() == "TOC" or me.store1[i].getChild("ident").getValue() == "TOD") { continue; } - var coord = geo.Coord.new(); - coord.set_latlon(me.store1[i].getChild("pos_lat").getValue(), me.store1[i].getChild("pos_long").getValue()); - var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); - fmgc.flightPlanController.flightplans[3].appendWP(WP); - } - fmgc.flightPlanController.flightplans[3].sid = fmgc.flightPlanController.flightplans[3].departure.getSid(SIDID); - fmgc.flightPlanController.flightplans[3].star = fmgc.flightPlanController.flightplans[3].destination.getStar(STARID); fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); fmgc.windController.updatePlans(); From b8c31535c4400c2b314364e110f1205c0c12cb84 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 7 Aug 2020 12:48:47 +0100 Subject: [PATCH 29/45] Fix the flight number. --- Nasal/FMGC/SimbriefParser.nas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 070e584e..79c4bb61 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -35,7 +35,7 @@ var SimbriefParser = { me.store1 = me.OFP.getChild("general"); me.store2 = me.OFP.getChild("alternate"); - fmgc.FMGCInternal.flightNum = me.store1.getChild("icao_airline").getValue() or "" ~ me.store1.getChild("flight_number").getValue() or ""; + fmgc.FMGCInternal.flightNum = (me.store1.getChild("icao_airline").getValue() or "") ~ (me.store1.getChild("flight_number").getValue() or ""); fmgc.FMGCInternal.flightNumSet = 1; fmgc.FMGCInternal.costIndex = me.store1.getChild("costindex").getValue(); fmgc.FMGCInternal.costIndexSet = 1; From 0aefdda66df7dbffd36bb07f88b7d006c9f11d05 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 7 Aug 2020 13:01:15 +0100 Subject: [PATCH 30/45] Better error messaging for simbrief download failure --- Nasal/FMGC/SimbriefParser.nas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 79c4bb61..d5589bca 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -11,9 +11,13 @@ var SimbriefParser = { me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") - .fail(func mcdu.mcdu_message(i, "SIMBRIEF DOWNLOAD FAILED")) + .fail(func me.failure(i)) .done(func me.read(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml", i)); }, + failure: func(i) { + mcdu.mcdu_message(i, "SIMBRIEF DOWNLOAD FAILED"); + me.inhibit = 0; + }, read: func(xml, i) { var data = io.readxml(xml); if (data != nil) { From 601d733e4655a0510c801e3da29a201a5a6b6b8a Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 8 Aug 2020 08:55:49 -0400 Subject: [PATCH 31/45] Fix FL in history wind --- Nasal/FMGC/FMGC.nas | 8 ++++---- Nasal/FMGC/winds.nas | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 24a02626..532532ea 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -716,10 +716,10 @@ var masterFMGC = maketimer(0.2, func { if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) { var windsDidChange = 0; if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) { - if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl050_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl050_wind[1]) { - fmgc.windController.fl050_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/")); - fmgc.windController.fl050_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/")); - fmgc.windController.fl050_wind[2] = "FL050"; + if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl50_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl50_wind[1]) { + fmgc.windController.fl50_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/")); + fmgc.windController.fl50_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/")); + fmgc.windController.fl50_wind[2] = "FL50"; windsDidChange = 1; } } diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index b2c78036..0d28fdd9 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -94,7 +94,7 @@ var windController = { crz_winds: [0, 0, 0], des_winds: [0, 0, 0], hist_winds: 0, - fl050_wind: [-1, -1, ""], + fl50_wind: [-1, -1, ""], fl150_wind: [-1, -1, ""], fl250_wind: [-1, -1, ""], flcrz_wind: [-1, -1, ""], @@ -271,8 +271,8 @@ var windController = { var file = io.open(path, "wb"); var winds_added = 0; - if (me.fl050_wind[2] != "") { - io.write(file, me.fl050_wind[0] ~ "," ~ me.fl050_wind[1] ~ "," ~ me.fl050_wind[2] ~ "\n"); + if (me.fl50_wind[2] != "") { + io.write(file, me.fl50_wind[0] ~ "," ~ me.fl50_wind[1] ~ "," ~ me.fl50_wind[2] ~ "\n"); winds_added += 1; } From b80cd82aa35cf4baf22cf7e72465ab7fc5c12cdd Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 8 Aug 2020 13:35:51 -0400 Subject: [PATCH 32/45] Add stars and arrows to wind page --- Models/Instruments/MCDU/MCDU.nas | 34 +- Models/Instruments/MCDU/res/mcdu.svg | 4876 +++++++++++++------------- 2 files changed, 2501 insertions(+), 2409 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 85e9a267..62883c06 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -231,7 +231,8 @@ var canvas_MCDU_base = { "FUELPRED_ZFWCG","FUELPRED_ZFWCG_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR", "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", - "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; + "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND", + "WIND","WIND_CANCEL","WIND_INSERT_star","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -256,6 +257,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); @@ -272,6 +274,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); }, @@ -370,6 +373,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["PERFAPPR"].hide(); @@ -1404,6 +1408,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].show(); @@ -1819,6 +1824,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); @@ -1983,6 +1989,7 @@ var canvas_MCDU_base = { me["IRSINIT"].show(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); @@ -2200,6 +2207,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].show(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); @@ -2577,6 +2585,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].show(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); @@ -2855,6 +2864,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].show(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); @@ -2985,6 +2995,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].show(); me["arrowsDepArr"].hide(); @@ -3874,6 +3885,7 @@ var canvas_MCDU_base = { me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); + me["WIND"].show(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); @@ -3913,6 +3925,24 @@ var canvas_MCDU_base = { me.fontSizeCenter(small, small, small, small, small, normal); } + if (page == "WINDHIST") { + var hist_winds = fmgc.windController.hist_winds; + if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) { + me["WIND_INSERT_star"].show(); + } else { + me["WIND_INSERT_star"].hide(); + } + me["WIND_CANCEL"].hide(); + } else { + if (fmgc.flightPlanController.temporaryFlag[i]) { + me["WIND_CANCEL"].show(); + me["WIND_INSERT_star"].show(); + } else { + me["WIND_CANCEL"].hide(); + me["WIND_INSERT_star"].hide(); + } + } + if (myWind[i] != nil) { if (page == "WINDCRZ") { me["Simple_Title"].setText(sprintf("%s", myWind[i].title[0] ~ myWind[i].title[1] ~ myWind[i].title[2])); @@ -4499,6 +4529,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].show(); @@ -4564,6 +4595,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); me["arrowsDepArr"].hide(); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 62495789..8f784603 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -7,13 +7,13 @@ 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" - width="1280" - height="1080" - viewBox="0 0 1024 864" - version="1.1" + sodipodi:docname="mcdu.svg" + inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" id="svg2" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)" - sodipodi:docname="mcdu.svg"> + version="1.1" + viewBox="0 0 1024 864" + height="1080" + width="1280"> @@ -29,1599 +29,2362 @@ + inkscape:snap-global="false" + showguides="false" + inkscape:current-layer="layer1" + inkscape:window-maximized="0" + inkscape:window-y="23" + inkscape:window-x="480" + inkscape:cy="934.8252" + inkscape:cx="1254.0678" + inkscape:zoom="2.763457" + showgrid="true" + id="namedview371" + inkscape:window-height="819" + inkscape:window-width="1440" + inkscape:pageshadow="2" + inkscape:pageopacity="1" + guidetolerance="20" + gridtolerance="20" + objecttolerance="20" + borderopacity="1" + bordercolor="#666666" + pagecolor="#000000"> + id="grid5153" + type="xygrid" /> SCRATCHPAD + x="20.138426" + y="836.87567" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">SCRATCHPAD + id="ArrowLeft"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> - - - - - + + + + + + inkscape:groupmode="layer"> + inkscape:groupmode="layer"> TEXT + x="521.1662" + id="tspan4238" + sodipodi:role="line">TEXT TEXT + x="521.1662" + y="304.457" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="521.1662" + id="tspan4248" + sodipodi:role="line">TEXT TEXT - TEXT TEXT + TEXT + x="521.1662" + y="773.87396" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="520.20905" + y="130.38777" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="520.20905" + id="tspan4270" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT TEXT + TEXT + TEXT + + TITLE + X/X + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + + + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + + + + + + + + + TEXT - - TITLE - X/X - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - - - - - - - - - - - - - - CALLSIG - - CALLSIG + + TMPY + x="350.9628" + id="tspan3617" + sodipodi:role="line">TMPY - ERASE + id="FPLN_TMPY_ERASE" + inkscape:label="#g3715"> ERASE + TMPY + x="70.001091" + id="tspan3629" + sodipodi:role="line">TMPY + transform="matrix(1.0000008,0,0,0.99998914,-895.98809,710.38932)" + style="stroke:#bb6100;stroke-opacity:1"> + - + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="FPLN_TMPY_INSERT" + inkscape:label="#g3746"> + TMPY TMPY - INSERT + x="972.33221" + y="773.87335" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:end;text-anchor:end;fill:#bb6100;fill-opacity:1">INSERT + transform="matrix(1.0807108,0,0,1.0807111,-76.371959,450.13459)"> - + FROM + x="177.72771" + y="68.861366" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.2px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">FROM + inkscape:label="#g3767" + id="DIRTO_TMPY_group"> + id="DIRTO_TMPY_ERASE" + inkscape:label="#g3715"> ERASE - ERASE + DIR TO + x="73.163895" + id="tspan176" + sodipodi:role="line">DIR TO + transform="matrix(1.0000008,0,0,0.99998914,-895.98809,710.38932)" + style="stroke:#bb6100;stroke-opacity:1"> + - + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="g207" + inkscape:label="#g3746"> + DIR TO DIR TO - INSERT + x="972.33221" + y="773.87335" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:end;text-anchor:end;fill:#bb6100;fill-opacity:1">INSERT + transform="matrix(1.0807108,0,0,1.0807111,-76.371959,450.13459)"> - + + inkscape:label="arrowsDepArr" + id="arrowsDepArr"> + transform="matrix(1.0000008,0,0,0.99998914,-895.98809,589.53826)" + style="stroke:#bb6100;stroke-opacity:1"> + d="M 952.4036,47.432743 H 923.87395" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:label="arrow4L" + id="arrow4L"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="M 936.70791,32.6968 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + transform="matrix(1.0000008,0,0,0.99998914,-895.98809,353.79358)" + style="stroke:#bb6100;stroke-opacity:1"> + d="M 952.4036,47.432743 H 923.87395" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:label="arrow2L" + id="arrow2L"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="M 936.70791,32.6968 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + transform="matrix(1.0000008,0,0,0.99998914,-895.98809,118.0489)" + style="stroke:#bb6100;stroke-opacity:1"> + d="M 952.4036,47.432743 H 923.87395" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:label="arrow5R" + id="arrow5R"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="M 936.70791,32.6968 921.8587,47.4328" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> - - - - - + transform="matrix(-1.0000008,0,0,0.99998914,1920.5256,353.79358)" + inkscape:label="arrow3R" + id="arrow3R"> + + + + + + inkscape:groupmode="layer"> + inkscape:label="#g4241" + id="INITA_AlignIRS"> + + + + + + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + . + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - / - - - - - - - - - - - - + inkscape:label="#g4310-0" + id="PERFTO_V1" + transform="translate(-833.84951,0.00320079)"> + + + - - - - - - - - + id="PERFTO_V2" + transform="translate(-833.84951,236.72)"> - - - - - - - - - - - - - - - - - - - / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / - - . - / - - - - - - - - - - - - - . - - - . - - - - - - - - + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">F + S / - - . - / - - - - - - - - - - - - - . - + id="tspan4399" + x="398.21817" + y="422.15305" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">O + = + = + = + inkscape:label="PERFAPPR" + id="PERFAPPR" + inkscape:groupmode="layer"> + F + S + O + = + = + = + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - - - - - - - - - - F - S - O - = - = - = - - - F - S - O - = - = - = - - - - - - - - - - - - - - + transform="matrix(1.0807111,0,0,1.0807111,-76.462145,331.52578)"> - + + + + + + + + + + inkscape:groupmode="layer"> F - S + x="399.48752" + y="187.10254" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">F O + id="tspan1132" + sodipodi:role="line">S = + id="tspan1135" + x="398.21817" + y="422.15305" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">O = = + = + style="stroke:#179ab7;stroke-opacity:1;opacity:0.94000004"> + id="path1243" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 994.54102,294.79468 -20.17351,-20.1735" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 974.36752,294.79468 20.17349,-20.1735" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + transform="translate(-833.84414,-0.00452979)" + style="opacity:0.87000002"> - + - + - + + width="39.4547" + height="41.350403" + x="1007.8361" + y="145.35753" /> + id="NOTIFY_AIRPORT"> - + + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-76.372598,-141.09805)"> + d="M 998.71909,284.70793 H 970.18944" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 984.45427,298.97275 -10e-6,-28.52964" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + style="opacity:0.88;stroke:#ffffff;stroke-opacity:1"> - + + id="COMM-ADS" + style="opacity:0.97000002;stroke:#179ab7;stroke-opacity:1"> - + + + + + + + - - - - - - + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-76.462145,331.52578)"> - + - - - - - + style="stroke:#179ab7;stroke-opacity:1" + id="WEATHERREQSEND" + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-76.462145,331.52578)"> + + + + + From 6f69dee2acde6849d1619f1a4af35b3a81b53b0e Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 9 Aug 2020 08:38:46 -0400 Subject: [PATCH 33/45] Add up/down arrows to winds, support navaid/fix import --- Models/Instruments/MCDU/MCDU.nas | 25 +- Models/Instruments/MCDU/res/mcdu.svg | 5075 +++++++++++++------------- Nasal/FMGC/SimbriefParser.nas | 12 +- Nasal/MCDU/WINDHIST.nas | 12 +- 4 files changed, 2596 insertions(+), 2528 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 62883c06..500fe2c1 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -232,7 +232,7 @@ var canvas_MCDU_base = { "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND", - "WIND","WIND_CANCEL","WIND_INSERT_star","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; + "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -3877,11 +3877,6 @@ var canvas_MCDU_base = { } else if (page == "WINDCLB" or page == "WINDCRZ" or page == "WINDDES" or page == "WINDHIST") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); - # if (page == "WINDCRZ") { - # up/down arrows show - # } else { - # up/down arrows hide - # } me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); @@ -3926,8 +3921,7 @@ var canvas_MCDU_base = { } if (page == "WINDHIST") { - var hist_winds = fmgc.windController.hist_winds; - if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) { + if (fmgc.windController.hist_winds.wind1.set) { me["WIND_INSERT_star"].show(); } else { me["WIND_INSERT_star"].hide(); @@ -3946,9 +3940,24 @@ var canvas_MCDU_base = { if (myWind[i] != nil) { if (page == "WINDCRZ") { me["Simple_Title"].setText(sprintf("%s", myWind[i].title[0] ~ myWind[i].title[1] ~ myWind[i].title[2])); + if (fmgc.flightPlanController.temporaryFlag[i]) { + if (size(fmgc.windController.nav_indicies[i]) > 1) { + me["WIND_UPDOWN"].show(); + } else { + me["WIND_UPDOWN"].hide(); + } + } else { + if (size(fmgc.windController.nav_indicies[2]) > 1) { + me["WIND_UPDOWN"].show(); + } else { + me["WIND_UPDOWN"].hide(); + } + } } else { me["Simple_Title"].setText(sprintf("%s", myWind[i].title)); + me["WIND_UPDOWN"].hide(); } + me["Simple_Title"].setColor(getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/r"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/g"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/b")); me.dynamicPageArrowFunc(myWind[i]); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 8f784603..365d0760 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -7,13 +7,13 @@ 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="mcdu.svg" - inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" - id="svg2" - version="1.1" - viewBox="0 0 1024 864" + width="1280" height="1080" - width="1280"> + viewBox="0 0 1024 864" + version="1.1" + id="svg2" + inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + sodipodi:docname="mcdu.svg"> @@ -29,749 +29,656 @@ + borderopacity="1" + objecttolerance="20" + gridtolerance="20" + guidetolerance="20" + inkscape:pageopacity="1" + inkscape:pageshadow="2" + inkscape:window-width="1440" + inkscape:window-height="819" + id="namedview371" + showgrid="true" + inkscape:zoom="0.78947164" + inkscape:cx="929.63178" + inkscape:cy="751.57487" + inkscape:window-x="481" + inkscape:window-y="23" + inkscape:window-maximized="0" + inkscape:current-layer="WIND" + showguides="false" + inkscape:snap-global="false" + units="px" + inkscape:document-rotation="0"> + type="xygrid" + id="grid5153" /> SCRATCHPAD + x="20.138426" + id="tspan4242" + sodipodi:role="line">SCRATCHPAD + transform="translate(-1.2,-0.2)"> - - - - - + + + + + + inkscape:label="Simple"> + inkscape:label="Simple_Center"> TEXT + x="521.1662" + y="187.10254" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="521.1662" + id="tspan4243" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT TEXT + TEXT + x="520.20905" + id="tspan4266" + sodipodi:role="line">TEXT TEXT + x="520.20905" + y="247.74202" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="520.20905" + id="tspan4274" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT + id="tspan4286" + x="520.20905" + y="717.159" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + TEXT TITLE + x="521.74713" + y="69.238266" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TITLE X/X + id="tspan4217" + sodipodi:role="line">X/X + cy="15.471865" + r="1.5" /> + cy="15.754708" + r="1.5" /> + cy="16.320395" + r="1.5" /> + cx="796.48511" + cy="13.774809" + r="3" /> TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT + id="Simple_L1_Arrow" + style="fill:#ffffff;fill-opacity:1"> TEXT + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT + transform="matrix(1.0000018,0,0,0.99998906,-895.98862,236.8439)" + style="fill:#ffffff;fill-opacity:1"> TEXT + id="Simple_L3_Arrow" + style="fill:#ffffff;fill-opacity:1"> TEXT + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT + transform="matrix(1.0000018,0,0,0.99998906,-895.98862,473.56068)" + style="fill:#ffffff;fill-opacity:1"> TEXT + + + + + TEXT + + + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + TEXT + id="Simple_R2_Arrow" + style="fill:#ffffff;fill-opacity:1"> @@ -779,1612 +686,942 @@ xml:space="preserve" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="1022.194" - y="773.87396" - id="Simple_R6" + y="421.81125" + id="Simple_R3" transform="scale(0.991516,1.0085566)" inkscape:label="#text4244">TEXT + transform="matrix(-1.000002,0,0,0.99998904,1919.9892,355.20231)" + style="fill:#ffffff;fill-opacity:1"> - TEXT TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - - - - - - - - - - - - - CALLSIG - - TMPY - - ERASE - TMPY - - - - - - - - TMPY - INSERT - - - - - - - - - FROM - - - - ERASE - DIR TO - - - - - - - - DIR TO - INSERT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="Simple_R4_Arrow" + style="fill:#ffffff;fill-opacity:1"> + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + TEXT + id="Simple_R5_Arrow" + inkscape:label="#g4241" + transform="matrix(-1.000002,0,0,0.99998904,1919.9892,591.91912)" + style="fill:#ffffff;fill-opacity:1"> - + id="path4319" + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + TEXT + + id="path4327" + d="M 936.70791,32.6968 921.8587,47.4328" + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + + + + + inkscape:label="INITA" + id="INITA-9" + style="display:inline" /> + + + / + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1" + y="69.238258" + x="750.78857" + id="tspan4388" + sodipodi:role="line">CALLSIG - - - - + id="FPLN_TMPY_group" + inkscape:label="#g3767"> + TMPY + + ERASE + TMPY + + + + + + + + TMPY + INSERT + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / + id="FPLN_FROM" + y="68.861366" + x="177.72771" + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve">FROM + + + + ERASE + DIR TO + + + + + + + + DIR TO + INSERT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:groupmode="layer" + id="INITA" + inkscape:label="INITA"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / - - . - / - - - - - - - - - - - - - . - - - . - - - - - - - - - / - - . - / - - - - - - - - - - - - - . - - - - - + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path4482" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - - + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - + id="INITA_FromTo" + inkscape:label="#g4320"> + / + + + + + + + + + + + + + + + + + + + + id="INITA_FltNbr" + transform="translate(-833.84951,236.71687)"> + + + + + + + + + + - + + + + + + + + + F - S - O - = - = - = + x="1113.7798" + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve">/ + - F - S - O - = - = - = + inkscape:groupmode="layer" + id="IRSINIT" + inkscape:label="IRSINIT"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + . + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + transform="translate(-833.84951,0.00320079)" + id="PERFTO_V1" + inkscape:label="#g4310-0"> + + + - - - - - - + inkscape:label="#g4310-0" + id="PERFTO_VR" + transform="translate(-833.84951,118.3616)"> + + + + + + + + - - - F F + S + S - O - = + x="398.21817" + id="tspan4399" + sodipodi:role="line">O = = + = + F + S + O + = + = + = + + + + + + + + + + + + + + + + + + + + + + + F + S + O + = + = + = + + + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-76.372598,-23.411021)"> + d="m 998.71909,284.70793 -28.52965,0" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 984.45427,298.97275 -10e-6,-28.52964" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + id="NOTIFY_FLTNBR" + inkscape:label="#g4310-0"> - + - + - + - + - + + inkscape:label="#g1271"> - + + style="opacity:0.94000005;stroke:#179ab7;stroke-opacity:1"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 994.54102,294.79468 -20.17351,-20.1735" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 974.36752,294.79468 20.17349,-20.1735" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-1029.0108,-141.09805)"> - + - + - - - - - - + transform="matrix(1.0807111,0,0,1.0807111,-1029.7034,213.33078)"> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - + + id="path1279" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + transform="matrix(1.0807111,0,0,1.0807111,-76.606518,451.54255)"> + style="fill:none;stroke:#ffffff;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#ffffff;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="MODEVHF3" + style="stroke:#ffffff;stroke-opacity:1"> - + + + + + + + diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index d5589bca..f75a56e6 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -131,8 +131,16 @@ var SimbriefParser = { if (me.store1[i].getChild("ident").getValue() == "TOC" or me.store1[i].getChild("ident").getValue() == "TOD") { continue; } var coord = geo.Coord.new(); coord.set_latlon(me.store1[i].getChild("pos_lat").getValue(), me.store1[i].getChild("pos_long").getValue()); - var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); - fmgc.flightPlanController.flightplans[3].appendWP(WP); + var fixes = findFixesByID(coord, me.store1[i].getChild("ident").getValue()); + var navaids = findNavaidsByID(coord, me.store1[i].getChild("ident").getValue()); + if (size(fixes) > 0) { + fmgc.flightPlanController.flightplans[3].appendWP(createWPFrom(fixes[0])); + } else if (size(navaids) > 0) { + fmgc.flightPlanController.flightplans[3].appendWP(createWPFrom(navaids[0])); + } else { + var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); + fmgc.flightPlanController.flightplans[3].appendWP(WP); + } } fmgc.flightPlanController.flightplans[3].sid = fmgc.flightPlanController.flightplans[3].departure.getSid(SIDID); fmgc.flightPlanController.flightplans[3].star = fmgc.flightPlanController.flightplans[3].destination.getStar(STARID); diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 86c2c6a4..ba5bfc21 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -179,13 +179,11 @@ var windHISTPage = { pushButtonRight: func(index) { if (index == 6) { var hist_winds = fmgc.windController.hist_winds; - if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) { - if (hist_winds.wind1.set) { - fmgc.windController.clb_winds[2].wind1.heading = hist_winds.wind1.heading; - fmgc.windController.clb_winds[2].wind1.magnitude = hist_winds.wind1.magnitude; - fmgc.windController.clb_winds[2].wind1.altitude = hist_winds.wind1.altitude; - fmgc.windController.clb_winds[2].wind1.set = 1; - } + if (hist_winds.wind1.set) { + fmgc.windController.clb_winds[2].wind1.heading = hist_winds.wind1.heading; + fmgc.windController.clb_winds[2].wind1.magnitude = hist_winds.wind1.magnitude; + fmgc.windController.clb_winds[2].wind1.altitude = hist_winds.wind1.altitude; + fmgc.windController.clb_winds[2].wind1.set = 1; if (hist_winds.wind2.set) { fmgc.windController.clb_winds[2].wind2.heading = hist_winds.wind2.heading; fmgc.windController.clb_winds[2].wind2.magnitude = hist_winds.wind2.magnitude; From e3266e5325ce5e3a8bf1a640a5d157f4e2eac0b4 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 9 Aug 2020 09:18:47 -0400 Subject: [PATCH 34/45] Crz wind bug fix --- Nasal/MCDU/WINDCRZ.nas | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 00de8535..f33366c8 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -519,27 +519,31 @@ var windCRZPage = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { computer_temp = me.computer; } - if (me.cur_location < size(fmgc.windController.nav_indicies[computer_temp]) - 1) { - me.cur_location = me.cur_location + 1; - } else { - me.cur_location = 0; + if (size(fmgc.windController.nav_indicies[computer_temp]) > 1) { + if (me.cur_location < size(fmgc.windController.nav_indicies[computer_temp]) - 1) { + me.cur_location = me.cur_location + 1; + } else { + me.cur_location = 0; + } + me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; + me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location); + me.reload(); } - me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; - me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location); - me.reload(); }, pushButtonDown: func() { var computer_temp = 2; if (fmgc.flightPlanController.temporaryFlag[me.computer]) { computer_temp = me.computer; } - if (me.cur_location > 0) { - me.cur_location = me.cur_location - 1; - } else { - me.cur_location = size(fmgc.windController.nav_indicies[computer_temp]) - 1; + if (size(fmgc.windController.nav_indicies[computer_temp]) > 1) { + if (me.cur_location > 0) { + me.cur_location = me.cur_location - 1; + } else { + me.cur_location = size(fmgc.windController.nav_indicies[computer_temp]) - 1; + } + me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; + me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location); + me.reload(); } - me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; - me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location); - me.reload(); } }; \ No newline at end of file From 5fe512a9137e1a0024d0cb59362198eccae0a32f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 10:45:08 +0100 Subject: [PATCH 35/45] APU: correct un-init property, and ensure start signal is ended when master switch is turned off in pre-init phase --- Nasal/Systems/APU.nas | 17 +++++++----- Nasal/Systems/fire.nas | 63 ++++++++++++++++++++---------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index bb33a3ee..6ab5dac0 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -19,7 +19,7 @@ var APUNodes = { var APU = { state: 0, # off, power up, watch, starting preparation, starting, run, cooldown, shutdown - inletFlap: aircraft.door.new("controls/apu/inlet-flap", 12), + inletFlap: aircraft.door.new("/controls/apu/inlet-flap", 12), fuelValveCmd: props.globals.getNode("/systems/fuel/valves/apu-lp-valve-cmd"), fuelValvePos: props.globals.getNode("/systems/fuel/valves/apu-lp-valve"), inletFlapPos: props.globals.getNode("/controls/apu/inlet-flap/position-norm"), @@ -95,7 +95,7 @@ var APU = { me.checkOil(); me.listenSignals = 1; settimer(func() { - if (APUNodes.Controls.master.getValue() and !getprop("systems/acconfig/autoconfig-running")) { + if (APUNodes.Controls.master.getValue() and !getprop("/systems/acconfig/autoconfig-running")) { me.setState(2); } }, 3); @@ -103,7 +103,7 @@ var APU = { }, startCommand: func(fast = 0) { if (me.listenSignals and (me.state == 1 or me.state == 2)) { - me.signals.startInProgress.setValue(1); + me.signals.startInProgress.setBoolValue(1); me.setState(3); checkApuStartTimer.start(); me.fastStart = fast; @@ -137,7 +137,7 @@ var APU = { waitStart2: func() { if (pts.APU.rpm.getValue() >= 99.9) { me.GenericControls.starter.setValue(0); - me.signals.startInProgress.setValue(0); + me.signals.startInProgress.setBoolValue(0); me.signals.available.setValue(1); me.setState(5); apuStartTimer2.stop(); @@ -187,11 +187,14 @@ var APU = { # Signal generators / receivers stop: func() { if (me.listenStopSignal and me.state == 4) { - me.signals.startInProgress.setValue(0); + me.signals.startInProgress.setBoolValue(0); me.stopAPU(); me.setState(7); shutdownTimer.start(); } else { + if (me.signals.startInProgress.getBoolValue()) { + me.signals.startInProgress.setBoolValue(0); + } if (me.signals.bleedWasUsed) { if (me.bleedTime == 0) { me.shutBleed(); } if (120 - (pts.Sim.Time.elapsedSec.getValue() - me.bleedTime) > 0) { @@ -290,7 +293,7 @@ var APUController = { }; var _masterTime = 0; -setlistener("controls/apu/master", func() { +setlistener("/controls/apu/master", func() { if (APUController.APU != nil) { if (APUNodes.Controls.master.getValue() and APUController.APU.state == 0) { shutdownTimer.stop(); @@ -304,7 +307,7 @@ setlistener("controls/apu/master", func() { } }, 0, 0); -setlistener("controls/pneumatics/switches/apu", func() { +setlistener("/controls/pneumatics/switches/apu", func() { if (APUController.APU != nil) { if (APUNodes.Controls.bleed.getValue()) { APUController.APU.signals.bleedWasUsed = 1; diff --git a/Nasal/Systems/fire.nas b/Nasal/Systems/fire.nas index ad949cd8..39ff7216 100644 --- a/Nasal/Systems/fire.nas +++ b/Nasal/Systems/fire.nas @@ -3,10 +3,10 @@ # Copyright (c) 2020 Josh Davidson (Octal450) -var elapsedTime = props.globals.getNode("sim/time/elapsed-sec"); -var apuTestBtn = props.globals.getNode("controls/fire/apu-test-btn", 1); -var testBtn = props.globals.getNode("controls/fire/test-btn-1", 1); -var testBtn2 = props.globals.getNode("controls/fire/test-btn-2", 1); +var elapsedTime = props.globals.getNode("/sim/time/elapsed-sec"); +var apuTestBtn = props.globals.getNode("/controls/fire/apu-test-btn", 1); +var testBtn = props.globals.getNode("/controls/fire/test-btn-1", 1); +var testBtn2 = props.globals.getNode("/controls/fire/test-btn-2", 1); var dischTest = props.globals.initNode("/systems/fire/cargo/disch-test", 0, "BOOL"); var cargoTestBtn = props.globals.initNode("/controls/fire/cargo/test", 0, "BOOL"); var cargoTestTime = props.globals.initNode("/controls/fire/cargo/test-time", 0, "DOUBLE"); @@ -32,20 +32,19 @@ var eng2AgentTimerTime = props.globals.initNode("/systems/fire/engine2/agent1-ti var eng1Agent2TimerTime = props.globals.initNode("/systems/fire/engine1/agent2-timer-time", 0, "INT"); 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 wow = props.globals.getNode("fdm/jsbsim/position/wow", 1); -var dcbatNode = props.globals.getNode("systems/electrical/bus/dc-bat", 1); -var dcessNode = props.globals.getNode("systems/electrical/bus/dc-ess", 1); -var apuBleedNode = props.globals.getNode("systems/apu/bleed-used", 1); -var apuMaster = props.globals.getNode("controls/apu/master", 1); +var wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1); +var dcbatNode = props.globals.getNode("/systems/electrical/bus/dc-bat", 1); +var dcessNode = props.globals.getNode("/systems/electrical/bus/dc-ess", 1); +var apuMaster = props.globals.getNode("/controls/apu/master", 1); 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("controls/fire/cargo/test", 0); + 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("/controls/fire/cargo/test", 0); fire_timer.start(); } @@ -68,7 +67,7 @@ var engFireDetectorUnit = { eF.loopTwo = 0; eF.fireProp = props.globals.getNode(fireProp, 1); eF.testProp = props.globals.getNode(testProp, 1); - eF.wow = props.globals.getNode("fdm/jsbsim/position/wow", 1); + eF.wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1); eF.condition = 100; return eF; }, @@ -179,7 +178,6 @@ var engFireDetectorUnit = { } elsif (system == 2) { apuFireWarn.setBoolValue(1); if (me.wow.getValue() == 1) { - apuBleedNode.setValue(0); systems.APUController.APU.emergencyStop(); settimer(func() { # 3 sec delay - source TTM ATA 26 FIRE PROTECTION p102 extinguisherBottles.vector[4].discharge(); @@ -284,9 +282,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/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; } engFireDetectorUnits.vector[system].receiveSignal(typeLoop); } }; @@ -311,8 +309,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/cargo-aft-fire")) { return; } + elsif (system == 2 and !getprop("/systems/failures/cargo-fwd-fire")) { return; } cargoSmokeDetectorUnits.vector[system].receiveSignal(typeLoop); } @@ -552,7 +550,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 (getprop("/controls/engines/engine[0]/fire-btn") == 1) { ecam.shutUpYou(); eng1AgentTimerMakeTimer.stop(); eng1AgentTimer.setValue(10); @@ -562,7 +560,7 @@ setlistener("/controls/engines/engine[0]/fire-btn", func() { }, 0, 0); setlistener("/systems/fire/engine1/disch1", func() { - if (getprop("systems/fire/engine1/disch1") == 1) { + if (getprop("/systems/fire/engine1/disch1") == 1) { eng1Agent2TimerMakeTimer.stop(); eng1Agent2Timer.setValue(30); eng1Agent2TimerTime.setValue(elapsedTime.getValue() + 31); @@ -595,7 +593,7 @@ eng1Agent2TimerMakeTimerFunc = func() { } setlistener("/controls/engines/engine[1]/fire-btn", func() { - if (getprop("controls/engines/engine[1]/fire-btn") == 1) { + if (getprop("/controls/engines/engine[1]/fire-btn") == 1) { ecam.shutUpYou(); eng2AgentTimerMakeTimer.stop(); eng2AgentTimer.setValue(10); @@ -605,7 +603,7 @@ setlistener("/controls/engines/engine[1]/fire-btn", func() { }, 0, 0); setlistener("/systems/fire/engine2/disch1", func() { - if (getprop("systems/fire/engine2/disch1") == 1) { + if (getprop("/systems/fire/engine2/disch1") == 1) { eng2Agent2TimerMakeTimer.stop(); eng2Agent2Timer.setValue(30); eng2Agent2TimerTime.setValue(elapsedTime.getValue() + 31); @@ -638,9 +636,8 @@ eng2Agent2TimerMakeTimerFunc = func() { } setlistener("/controls/apu/fire-btn", func() { - if (getprop("controls/apu/fire-btn") == 1) { + if (getprop("/controls/apu/fire-btn") == 1) { ecam.shutUpYou(); - apuBleedNode.setValue(0); systems.APUController.APU.emergencyStop(); apuAgentTimerMakeTimer.stop(); apuAgentTimer.setValue(10); @@ -661,7 +658,7 @@ apuAgentTimerMakeTimerFunc = func() { } setlistener("/controls/fire/test-btn-1", func() { - if (getprop("systems/failures/engine-left-fire")) { return; } + if (getprop("/systems/failures/engine-left-fire")) { return; } if (testBtn.getValue() == 1) { if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) { @@ -674,7 +671,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/engine-right-fire")) { return; } if (testBtn2.getValue() == 1) { if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) { eng2FireWarn.setBoolValue(1); @@ -686,7 +683,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/apu-fire")) { return; } if (apuTestBtn.getValue() == 1) { if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) { apuFireWarn.setBoolValue(1); @@ -698,7 +695,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 dcbatNode.getValue() < 25 or dcessNode.getValue() < 25) { return; } + if (getprop("/systems/failures/aft-cargo-fire") or getprop("/systems/failures/fwd-cargo-fire") or dcbatNode.getValue() < 25 or dcessNode.getValue() < 25) { return; } if (cargoTestBtn.getBoolValue()) { cargoTestTime.setValue(elapsedTime.getValue()); cargoTestChecker.start(); From 4ba0d35b14ab6bd614897bde2fec002746b1953e Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 10:58:13 +0100 Subject: [PATCH 36/45] Better relay sounds --- A320-main.xml | 4 ++++ Nasal/Libraries/libraries.nas | 22 ++++++++++++++++++++++ Sounds/A320-common-sound.xml | 8 ++++---- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 238b6852..fc2d731c 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -214,6 +214,10 @@ 0 0 0 + 0 + 0 + 0 + 0 diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index ac4da6ba..41b5284a 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -134,6 +134,28 @@ setlistener("/sim/sounde/spdbrk-click", func { }, 0.4); }); +var relayBatt1 = func { + setprop("/sim/sounde/relay-batt-1",1); + settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35); +} +var relayBatt2 = func { + setprop("/sim/sounde/relay-batt-2",1); + settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35); +} +var relayApu = func { + setprop("/sim/sounde/relay-apu",1); + settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35); +} +var relayExt = func { + setprop("/sim/sounde/relay-ext",1); + settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35); +} + +setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0); +setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0); +setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0); +setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0); + ######### # Doors # ######### diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index c3beab5e..15b8f71f 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -1660,7 +1660,7 @@ RelayBatt1 once Aircraft/A320-family/Sounds/Cockpit/relay-battery.wav - /systems/electrical/sources/bat-1/contact + /sim/sounde/relay-batt-1 /sim/current-view/internal 0.8 @@ -1671,7 +1671,7 @@ RelayBatt2 once Aircraft/A320-family/Sounds/Cockpit/relay-battery.wav - /systems/electrical/sources/bat-2/contact + /sim/sounde/relay-batt-2 /sim/current-view/internal 0.8 @@ -1682,7 +1682,7 @@ RelayEXT once Aircraft/A320-family/Sounds/Cockpit/relay-external.wav - /systems/electrical/relay/ext-epc/contact-pos + /sim/sounde/relay-ext /sim/current-view/internal 0.8 @@ -1693,7 +1693,7 @@ RelayAPU once Aircraft/A320-family/Sounds/Cockpit/relay-apu.wav - /systems/electrical/relay/apu-glc/contact-pos + /sim/sounde/relay-apu /sim/current-view/internal 0.8 From 95613c43df7d3616111e8ea89070b1e97253c493 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 11:16:27 +0100 Subject: [PATCH 37/45] GPWS: activate TERR switch --- Models/Instruments/OHpanel/OHpanel.xml | 14 +++++++------- Nasal/Libraries/buttons.nas | 4 ++-- Sounds/A320-common-sound.xml | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 6168f2e5..64eca44e 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -1678,7 +1678,7 @@ - + select @@ -1716,7 +1716,7 @@ 0 - instrumentation/mk-viii/inputs/discretes/terr-inhibit + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit 0 @@ -1734,7 +1734,7 @@ - instrumentation/mk-viii/inputs/discretes/terr-inhibit + instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit 1 @@ -1829,7 +1829,7 @@ property-toggle - instrumentation/mk-viii/inputs/discretes/glideslope-cancel + instrumentation/mk-viii/inputs/discretes/glideslope-inhibit nasal @@ -1844,7 +1844,7 @@ - instrumentation/mk-viii/inputs/discretes/glideslope-cancel + instrumentation/mk-viii/inputs/discretes/glideslope-inhibit 1 diff --git a/Nasal/Libraries/buttons.nas b/Nasal/Libraries/buttons.nas index b989d4a2..58c8f0e6 100644 --- a/Nasal/Libraries/buttons.nas +++ b/Nasal/Libraries/buttons.nas @@ -23,9 +23,9 @@ var variousReset = func { setprop("controls/fadec/n1mode1", 0); setprop("controls/fadec/n1mode2", 0); setprop("instrumentation/mk-viii/serviceable", 1); - setprop("instrumentation/mk-viii/inputs/discretes/terr-inhibit", 0); + setprop("instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", 0); setprop("instrumentation/mk-viii/inputs/discretes/gpws-inhibit", 0); - setprop("instrumentation/mk-viii/inputs/discretes/glideslope-cancel", 0); + setprop("instrumentation/mk-viii/inputs/discretes/glideslope-inhibit", 0); setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", 0); setprop("instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", 0); setprop("controls/switches/cabinCall", 0); diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 15b8f71f..df99d463 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -1663,7 +1663,7 @@ /sim/sounde/relay-batt-1 /sim/current-view/internal - 0.8 + 0.4 @@ -1674,7 +1674,7 @@ /sim/sounde/relay-batt-2 /sim/current-view/internal - 0.8 + 0.4 From 258eae0fda3452bb66580265d333c7e8fb04fd0c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 11:32:28 +0100 Subject: [PATCH 38/45] GPWS warning for TERR --- Nasal/ECAM/ECAM-controller.nas | 1 + Nasal/ECAM/ECAM-logic.nas | 14 +++++++++++++- Nasal/ECAM/ECAM-messages.nas | 4 ++++ Systems/a320-fwc.xml | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Nasal/ECAM/ECAM-controller.nas b/Nasal/ECAM/ECAM-controller.nas index c9668762..c1ace389 100644 --- a/Nasal/ECAM/ECAM-controller.nas +++ b/Nasal/ECAM/ECAM-controller.nas @@ -87,6 +87,7 @@ var warningNodes = { trimAirFault: props.globals.initNode("/ECAM/warnings/timer/trim-air-fault"), yawDamper1Fault: props.globals.initNode("/ECAM/warnings/timer/yaw-damper-1-fault"), yawDamper2Fault: props.globals.initNode("/ECAM/warnings/timer/yaw-damper-2-fault"), + navTerrFault: props.globals.initNode("/ECAM/warnings/timer/nav-gpws-terr-fault"), }, Flipflops: { bleed1LowTemp: props.globals.initNode("/ECAM/warnings/logic/bleed-1-low-temp-flipflop-output"), diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 07bdeb9b..482d0c78 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -1167,13 +1167,25 @@ var messages_priority_2 = func { ECAM_controller.warningReset(athr_lim_1); } - if (getprop("instrumentation/tcas/serviceable") == 0 and phaseVar2 != 3 and phaseVar2 != 4 and phaseVar2 != 7 and systems.ELEC.Bus.ac1.getValue() >= 110 and pts.Instrumentation.TCAS.Inputs.mode.getValue() != 1 and tcasFault.clearFlag == 0) { tcasFault.active = 1; } else { ECAM_controller.warningReset(tcasFault); } + if (warningNodes.Timers.navTerrFault.getValue() == 1 and (phaseVar2 == 2 or phaseVar2 == 6 or phaseVar2 == 7 or phaseVar2 == 9)) { + gpwsTerrFault.active = 1; + + if (!getprop("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit")) { + gpwsTerrFaultOff.active = 1; + } else { + ECAM_controller.warningReset(gpwsTerrFaultOff); + } + } else { + ECAM_controller.warningReset(gpwsTerrFault); + ECAM_controller.warningReset(gpwsTerrFaultOff); + } + if (fac12Fault.clearFlag == 0 and phaseVar2 != 4 and phaseVar2 != 5 and phaseVar2 != 7 and phaseVar2 != 8 and warningNodes.Logic.fac12Fault.getBoolValue()) { fac12Fault.active = 1; fac12FaultRud.active = 1; diff --git a/Nasal/ECAM/ECAM-messages.nas b/Nasal/ECAM/ECAM-messages.nas index f268784c..1e0cc66b 100644 --- a/Nasal/ECAM/ECAM-messages.nas +++ b/Nasal/ECAM/ECAM-messages.nas @@ -225,6 +225,10 @@ var warnings = std.Vector.new([ # TCAS FAULT var tcasFault = warning.new(msg: "NAV TCAS FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var gpwsFault = warning.new(msg: "NAV GPWS FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var gpwsFaultOff = warning.new(msg: "-GPWS...............OFF", colour: "c"), + var gpwsTerrFault = warning.new(msg: "NAV GPWS TERR DET FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), + var gpwsTerrFaultOff = warning.new(msg: "-GPWS TERR..........OFF", colour: "c"), # FAC and Rudder System var fac12Fault = warning.new(msg: "AUTO FLT FAC 1+2 FAULT", colour: "a", aural: 1, light: 1, isMainMsg: 1), diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 3e77e0ec..b74add82 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -334,6 +334,13 @@ 100 0.2 + + + Timer for the ECAM system + /ECAM/warnings/logic/nav-gpws-terr-fault + 100 + 1.0 + @@ -1437,6 +1444,19 @@ /ECAM/warnings/logic/yaw-damper-2-fault eq 1 + + + + + /ECAM/irs-in-align eq 0 + /systems/navigation/adr/operating-1 eq 1 + /systems/electrical/bus/ac-1 ge 110 + /ECAM/warning-phase ne 1 + /ECAM/warning-phase ne 10 + /FMGC/FCU-working eq 1 + /instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit eq 1 + + From a443e0aa837438cffbbd249e4b8a230283cb6d9b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 19:54:58 +0100 Subject: [PATCH 39/45] Fix battery percent --- Nasal/Systems/electrical.nas | 2 -- Systems/a320-electrical.xml | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index fae87556..7848532b 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -137,8 +137,6 @@ var ELEC = { me.Switch.idg1Disc.setBoolValue(1); me.Switch.idg2Disc.setBoolValue(1); me.Switch.emerElecManOn.setBoolValue(0); - me.Source.Bat1.percent.setValue(math.round((rand() * 50) + 50 , 0.1)); # Random between 50 and 100 - me.Source.Bat2.percent.setValue(math.round((rand() * 50) + 50 , 0.1)); # Random between 50 and 100 }, resetFail: func() { me.Fail.acEssBusFault.setBoolValue(0); diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index ead9f997..85687401 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -172,9 +172,11 @@ /systems/electrical/sources/bat-1/load-kw ne 0 + /systems/electrical/sources/bat-1/direction eq 1 /systems/electrical/sources/bat-1/contact eq 1 + /systems/electrical/sources/bat-1/direction eq -1 @@ -342,9 +344,11 @@ /systems/electrical/sources/bat-2/load-kw ne 0 + /systems/electrical/sources/bat-2/direction eq 1 /systems/electrical/sources/bat-2/contact eq 1 + /systems/electrical/sources/bat-2/direction eq -1 From 8ff974e4122ff6fcfdf41e99e3645cfdc670f5a5 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 20:24:17 +0100 Subject: [PATCH 40/45] Mitigate somewhat the BLEED 2 NOT CLOSED error --- Systems/ecam-proprules.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Systems/ecam-proprules.xml b/Systems/ecam-proprules.xml index 565bc263..e6545cf2 100644 --- a/Systems/ecam-proprules.xml +++ b/Systems/ecam-proprules.xml @@ -472,7 +472,7 @@ - RS + SR /ECAM/warnings/timer/prv-1-not-shut-apu-output @@ -486,7 +486,7 @@ - RS + SR /ECAM/warnings/timer/prv-2-not-shut-apu-output From 7398cc155c90788aec5f6981bac8c02c2d78c96e Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 13 Aug 2020 20:55:36 +0100 Subject: [PATCH 41/45] Attempt to correct case sensitivity --- Models/FlightDeck/res/fd_complete.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Models/FlightDeck/res/fd_complete.ac b/Models/FlightDeck/res/fd_complete.ac index 1876e386..e663bcd1 100644 --- a/Models/FlightDeck/res/fd_complete.ac +++ b/Models/FlightDeck/res/fd_complete.ac @@ -72761,7 +72761,7 @@ name "ecam_glare_down" data 15 CU1_curve_.1252 crease 40.0 -texture "ECAM_glare.png" +texture "ecam_glare.png" texrep 1 1 numvert 8 -0.40392 -0.06108 -0.10745 @@ -72793,7 +72793,7 @@ name "ecam_glare_up" data 15 CU1_curve_.1253 crease 40.0 -texture "ECAM_glare.png" +texture "ecam_glare.png" texrep 1 1 numvert 4 -0.40892 -0.06801 0.10755 From 25942cb834a23452b22741560df140a5410b6b70 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 14 Aug 2020 19:22:47 +0100 Subject: [PATCH 42/45] Electrical: use nodes --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 38 ++++++++------------ Models/Instruments/MCDU/MCDU.nas | 2 -- Models/Instruments/PFD/PFD.nas | 10 +++--- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 5 ++- Nasal/FMGC/FMGC-b.nas | 7 ++-- Nasal/Systems/fire.nas | 14 ++++---- 6 files changed, 30 insertions(+), 46 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index c98c55f3..5a470834 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -43,7 +43,6 @@ LBS2KGS = 0.4535924; # Fetch Nodes var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1); -var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1); var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1); var ecam_page = props.globals.getNode("/ECAM/Lower/page", 1); @@ -137,9 +136,6 @@ var tr1_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/ var tr2_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output", 1); var tr1_amps = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output-amp", 1); var tr2_amps = props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output-amp", 1); -var dc1 = props.globals.getNode("/systems/electrical/bus/dc-1", 1); -var dc2 = props.globals.getNode("/systems/electrical/bus/dc-2", 1); -var dc_ess = props.globals.getNode("/systems/electrical/bus/dc-ess", 1); var switch_emer_gen = props.globals.getNode("/systems/electrical/sources/emer-gen/output-volt", 1); var switch_gen1 = props.globals.getNode("/controls/electrical/switches/gen-1", 1); var switch_gen2 = props.globals.getNode("/controls/electrical/switches/gen-2", 1); @@ -151,10 +147,6 @@ var ext_volts = props.globals.getNode("/systems/electrical/sources/ext/output-vo var ext_hz = props.globals.getNode("/systems/electrical/sources/ext/output-hertz", 1); var galleyshed = props.globals.getNode("/systems/electrical/some-electric-thingie/galley-shed", 1); var switch_galley = props.globals.getNode("/controls/electrical/switches/galley", 1); -var dcbat = props.globals.getNode("/systems/electrical/bus/dc-bat", 1); -var ac_ess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1); -var ac1 = props.globals.getNode("/systems/electrical/bus/ac-1", 1); -var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1); var switch_ac_ess_feed = props.globals.getNode("/controls/electrical/switches/ac-ess-feed", 1); var tr1_fault = props.globals.getNode("/systems/failures/electrical/tr-1", 1); var tr2_fault = props.globals.getNode("/systems/failures/electrical/tr-2", 1); @@ -272,7 +264,7 @@ var canvas_lowerECAM_base = { updateDu4: func() { var elapsedtime = elapsed_sec.getValue(); - if (ac2.getValue() >= 110) { + if (systems.ELEC.Bus.ac2.getValue() >= 110) { if (du4_offtime.getValue() + 3 < elapsedtime) { if (gear0_wow.getValue() == 1) { if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) { @@ -298,7 +290,7 @@ var canvas_lowerECAM_base = { update: func() { var elapsedtime = elapsed_sec.getValue(); - if (ac2.getValue() >= 110 and lighting_du4.getValue() > 0.01) { + if (systems.ELEC.Bus.ac2.getValue() >= 110 and lighting_du4.getValue() > 0.01) { if (du4_test_time.getValue() + du4_test_amount.getValue() >= elapsedtime) { lowerECAM_apu.page.hide(); lowerECAM_bleed.page.hide(); @@ -1739,31 +1731,31 @@ var canvas_lowerECAM_elec = { } # Bus indicators - if (dcbat.getValue() > 25) { + if (systems.ELEC.Bus.dcBat.getValue() > 25) { me["ELEC-DCBAT-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0); } - if (dc1.getValue() > 25) { + if (systems.ELEC.Bus.dc1.getValue() > 25) { me["ELEC-DC1-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-DC1-label"].setColor(0.7333,0.3803,0); } - if (dc2.getValue() > 25) { + if (systems.ELEC.Bus.dc2.getValue() > 25) { me["ELEC-DC2-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-DC2-label"].setColor(0.7333,0.3803,0); } - if (dc_ess.getValue() > 25) { + if (systems.ELEC.Bus.dcEss.getValue() > 25) { me["ELEC-DCESS-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-DCESS-label"].setColor(0.7333,0.3803,0); } - if (ac_ess.getValue() >= 110) { + if (systems.ELEC.Bus.acEss.getValue() >= 110) { me["ELEC-ACESS-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-ACESS-label"].setColor(0.7333,0.3803,0); @@ -1775,13 +1767,13 @@ var canvas_lowerECAM_elec = { me["ACESS-SHED"].show(); } - if (ac1.getValue() >= 110) { + if (systems.ELEC.Bus.ac1.getValue() >= 110) { me["ELEC-AC1-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-AC1-label"].setColor(0.7333,0.3803,0); } - if (ac2.getValue() >= 110) { + if (systems.ELEC.Bus.ac2.getValue() >= 110) { me["ELEC-AC2-label"].setColor(0.0509,0.7529,0.2941); } else { me["ELEC-AC2-label"].setColor(0.7333,0.3803,0); @@ -1813,13 +1805,13 @@ var canvas_lowerECAM_elec = { me["ELEC-Line-GEN2-AC2"].hide(); } - if (ac1.getValue() >= 110) { + if (systems.ELEC.Bus.ac1.getValue() >= 110) { me["AC1-in"].show(); } else { me["AC1-in"].hide(); } - if (ac2.getValue() >= 110) { + if (systems.ELEC.Bus.ac2.getValue() >= 110) { me["AC2-in"].show(); } else { me["AC2-in"].hide(); @@ -1850,7 +1842,7 @@ var canvas_lowerECAM_elec = { } if (getprop("/systems/electrical/relay/ac-ess-feed-1/contact-pos") == 1) { - if (ac1.getValue() >= 110) { + if (systems.ELEC.Bus.ac2.getValue() >= 110) { me["ELEC-Line-AC1-ACESS"].show(); } else { me["ELEC-Line-AC1-ACESS"].hide(); @@ -1858,7 +1850,7 @@ var canvas_lowerECAM_elec = { me["ELEC-Line-AC2-ACESS"].hide(); } elsif (getprop("/systems/electrical/relay/ac-ess-feed-2/contact-pos") == 1) { me["ELEC-Line-AC1-ACESS"].hide(); - if (ac2.getValue() >= 110) { + if (systems.ELEC.Bus.ac2.getValue() >= 110) { me["ELEC-Line-AC2-ACESS"].show(); } else { me["ELEC-Line-AC2-ACESS"].hide(); @@ -1869,7 +1861,7 @@ var canvas_lowerECAM_elec = { } if (getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") == 1) { - if (ac1.getValue() < 110) { + if (systems.ELEC.Bus.ac2.getValue() < 110) { me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0); } else { me["ELEC-Line-AC1-TR1"].setColorFill(0.0509,0.7529,0.2941); @@ -1882,7 +1874,7 @@ var canvas_lowerECAM_elec = { } if (getprop("/systems/electrical/relay/tr-contactor-2/contact-pos") == 1) { - if (ac2.getValue() < 110) { + if (systems.ELEC.Bus.ac2.getValue() < 110) { me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0); } else { me["ELEC-Line-AC2-TR2"].setColorFill(0.0509,0.7529,0.2941); diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 500fe2c1..08ace4a8 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -74,8 +74,6 @@ var mcdu_keyboard_left = props.globals.getNode("/FMGC/keyboard-left", 0); var mcdu_keyboard_right = props.globals.getNode("/FMGC/keyboard-right", 0); #ACCONFIG -var ac1 = props.globals.getNode("/systems/electrical/bus/ac-1", 1); -var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1); var mcdu1_lgt = props.globals.getNode("/controls/lighting/DU/mcdu1", 1); var mcdu2_lgt = props.globals.getNode("/controls/lighting/DU/mcdu2", 1); var acType = props.globals.getNode("/MCDUC/type", 1); diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index fd03d8c1..29bdb447 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -37,8 +37,6 @@ var wow2 = props.globals.getNode("/gear/gear[2]/wow"); var pitch = props.globals.getNode("/orientation/pitch-deg", 1); var roll = props.globals.getNode("/orientation/roll-deg", 1); var elapsedtime = props.globals.getNode("/sim/time/elapsed-sec", 1); -var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1); -var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1); var du1_lgt = props.globals.getNode("/controls/lighting/DU/du1", 1); var du6_lgt = props.globals.getNode("/controls/lighting/DU/du6", 1); var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); @@ -218,7 +216,7 @@ var canvas_PFD_base = { }, updateDu1: func() { var elapsedtime_act = elapsedtime.getValue(); - if (acess.getValue() >= 110) { + if (systems.ELEC.Bus.acEss.getValue() >= 110) { if (du1_offtime.getValue() + 3 < elapsedtime_act) { if (wow0.getValue() == 1) { if (acconfig.getValue() != 1 and du1_test.getValue() != 1) { @@ -243,7 +241,7 @@ var canvas_PFD_base = { }, updateDu6: func() { var elapsedtime_act = elapsedtime.getValue(); - if (ac2.getValue() >= 110) { + if (systems.ELEC.Bus.ac2.getValue() >= 110) { if (du6_offtime.getValue() + 3 < elapsedtime_act) { if (wow0.getValue() == 1) { if (acconfig.getValue() != 1 and du6_test.getValue() != 1) { @@ -272,7 +270,7 @@ var canvas_PFD_base = { if (acconfig_mismatch.getValue() == "0x000") { PFD_1_mismatch.page.hide(); PFD_2_mismatch.page.hide(); - if (acess.getValue() >= 110 and du1_lgt.getValue() > 0.01) { + if (systems.ELEC.Bus.acEss.getValue() >= 110 and du1_lgt.getValue() > 0.01) { if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() != 1) { PFD_1_test.update(); updateL = 0; @@ -295,7 +293,7 @@ var canvas_PFD_base = { PFD_1_test.page.hide(); PFD_1.page.hide(); } - if (ac2.getValue() >= 110 and du6_lgt.getValue() > 0.01) { + if (systems.ELEC.Bus.ac2.getValue() >= 110 and du6_lgt.getValue() > 0.01) { if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() != 1) { PFD_2_test.update(); updateR = 0; diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 96da4856..25869d0a 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -40,7 +40,6 @@ var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash" var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var et = props.globals.getNode("/sim/time/elapsed-sec", 1); var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); -var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1); var eng_option = props.globals.getNode("/options/eng", 1); var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1); var rev_1 = props.globals.getNode("/engines/engine[0]/reverser-pos-norm", 1); @@ -143,7 +142,7 @@ var canvas_upperECAM_base = { updateDu3: func() { var elapsedtime = et.getValue(); - if (acess.getValue() >= 110) { + if (systems.ELEC.Bus.acEss.getValue() >= 110) { if (du3_offtime.getValue() + 3 < elapsedtime) { if (wow0.getValue() == 1) { if (acconfig.getValue() != 1 and du3_test.getValue() != 1) { @@ -170,7 +169,7 @@ var canvas_upperECAM_base = { var elapsedtime = et.getValue(); cur_eng_option = eng_option.getValue(); - if (acess.getValue() >= 110 and du3_lgt.getValue() > 0.01) { + if (systems.ELEC.Bus.acEss.getValue() >= 110 and du3_lgt.getValue() > 0.01) { if (du3_test_time.getValue() + du3_test_amount.getValue() >= elapsedtime) { upperECAM_cfm_eis2.page.hide(); upperECAM_iae_eis2.page.hide(); diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 74bec869..81ce43ac 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -39,7 +39,6 @@ var Gear = { }; var Misc = { - acEss: props.globals.getNode("/systems/electrical/bus/ac-ess", 1), elapsedSec: props.globals.getNode("/sim/time/elapsed-sec", 1), fbwLaw: props.globals.getNode("/it-fbw/law", 1), flapNorm: props.globals.getNode("/surface-positions/flap-pos-norm", 1), @@ -442,7 +441,7 @@ var ITAF = { }, ap1Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and Misc.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { me.revertBasicMode(); Output.ap1.setBoolValue(1); Output.latTemp = Output.lat.getValue(); @@ -463,7 +462,7 @@ var ITAF = { }, ap2Master: func(s) { if (s == 1) { - if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and Misc.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { + if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) { me.revertBasicMode(); Output.ap2.setBoolValue(1); Output.latTemp = Output.lat.getValue(); @@ -493,7 +492,7 @@ var ITAF = { }, athrMaster: func(s) { if (s == 1) { - if (Misc.acEss.getValue() >= 110) { + if (systems.ELEC.Bus.acEss.getValue() >= 110) { Output.athr.setBoolValue(1); Custom.ThrLock.setValue(0); Custom.Sound.enableAthrOff = 1; diff --git a/Nasal/Systems/fire.nas b/Nasal/Systems/fire.nas index 39ff7216..cb25e0c6 100644 --- a/Nasal/Systems/fire.nas +++ b/Nasal/Systems/fire.nas @@ -33,8 +33,6 @@ 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 wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1); -var dcbatNode = props.globals.getNode("/systems/electrical/bus/dc-bat", 1); -var dcessNode = props.globals.getNode("/systems/electrical/bus/dc-ess", 1); var apuMaster = props.globals.getNode("/controls/apu/master", 1); var fire_init = func { @@ -661,7 +659,7 @@ setlistener("/controls/fire/test-btn-1", func() { if (getprop("/systems/failures/engine-left-fire")) { return; } if (testBtn.getValue() == 1) { - if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { eng1FireWarn.setBoolValue(1); } } else { @@ -673,7 +671,7 @@ setlistener("/controls/fire/test-btn-1", func() { setlistener("/controls/fire/test-btn-2", func() { if (getprop("/systems/failures/engine-right-fire")) { return; } if (testBtn2.getValue() == 1) { - if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { eng2FireWarn.setBoolValue(1); } } else { @@ -685,7 +683,7 @@ setlistener("/controls/fire/test-btn-2", func() { setlistener("/controls/fire/apu-test-btn", func() { if (getprop("/systems/failures/apu-fire")) { return; } if (apuTestBtn.getValue() == 1) { - if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { apuFireWarn.setBoolValue(1); } } else { @@ -695,7 +693,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 dcbatNode.getValue() < 25 or dcessNode.getValue() < 25) { return; } + 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 (cargoTestBtn.getBoolValue()) { cargoTestTime.setValue(elapsedTime.getValue()); cargoTestChecker.start(); @@ -709,7 +707,7 @@ setlistener("/controls/fire/cargo/test", func() { }, 0, 0); var doCargoTest = func() { - if (dcbatNode.getValue() >= 25 or dcessNode.getValue() >= 25) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { aftCargoFireWarn.setBoolValue(1); fwdCargoFireWarn.setBoolValue(1); cargoTestTime2.setValue(elapsedTime.getValue()); @@ -728,7 +726,7 @@ var doCargoTest2 = func() { var doCargoTest3 = func() { dischTest.setBoolValue(0); - if (dcbatNode.getValue() >= 25 or dcessNode.getValue() >= 25) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { aftCargoFireWarn.setBoolValue(1); fwdCargoFireWarn.setBoolValue(1); cargoTestTime4.setValue(elapsedTime.getValue()); From 7fcd0a1089d40b050a5255e0f16d3ac666732598 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 14 Aug 2020 19:28:50 +0100 Subject: [PATCH 43/45] Corrections --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 5a470834..8767911a 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -1842,7 +1842,7 @@ var canvas_lowerECAM_elec = { } if (getprop("/systems/electrical/relay/ac-ess-feed-1/contact-pos") == 1) { - if (systems.ELEC.Bus.ac2.getValue() >= 110) { + if (systems.ELEC.Bus.ac1.getValue() >= 110) { me["ELEC-Line-AC1-ACESS"].show(); } else { me["ELEC-Line-AC1-ACESS"].hide(); @@ -1861,7 +1861,7 @@ var canvas_lowerECAM_elec = { } if (getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") == 1) { - if (systems.ELEC.Bus.ac2.getValue() < 110) { + if (systems.ELEC.Bus.ac1.getValue() < 110) { me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0); } else { me["ELEC-Line-AC1-TR1"].setColorFill(0.0509,0.7529,0.2941); From a8d62ac9168c197acd55b3cf3d7e0b75667b3343 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 14 Aug 2020 19:34:48 +0100 Subject: [PATCH 44/45] Correct old property reference --- Models/Instruments/OHpanel/OHpanelEPR.xml | 12 ++++++------ Models/Instruments/OHpanel/SteepAppr.xml | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Models/Instruments/OHpanel/OHpanelEPR.xml b/Models/Instruments/OHpanel/OHpanelEPR.xml index 7dbe1530..ffb0bd0b 100644 --- a/Models/Instruments/OHpanel/OHpanelEPR.xml +++ b/Models/Instruments/OHpanel/OHpanelEPR.xml @@ -14,11 +14,11 @@ - systems/electrical/bus/dc1 + systems/electrical/bus/dc-1 25 - systems/electrical/bus/dc2 + systems/electrical/bus/dc-2 25 @@ -42,11 +42,11 @@ - systems/electrical/bus/dc1 + systems/electrical/bus/dc-1 25 - systems/electrical/bus/dc2 + systems/electrical/bus/dc-2 25 @@ -143,11 +143,11 @@ - systems/electrical/bus/dc1 + systems/electrical/bus/dc-1 25 - systems/electrical/bus/dc2 + systems/electrical/bus/dc-2 25 diff --git a/Models/Instruments/OHpanel/SteepAppr.xml b/Models/Instruments/OHpanel/SteepAppr.xml index 055fbf49..bb56c86e 100644 --- a/Models/Instruments/OHpanel/SteepAppr.xml +++ b/Models/Instruments/OHpanel/SteepAppr.xml @@ -14,11 +14,11 @@ - systems/electrical/bus/dc1 + systems/electrical/bus/dc-1 25 - systems/electrical/bus/dc2 + systems/electrical/bus/dc-2 25 @@ -39,11 +39,11 @@ - systems/electrical/bus/dc1 + systems/electrical/bus/dc-1 25 - systems/electrical/bus/dc2 + systems/electrical/bus/dc-2 25 From c08ebae3d1711feb908eff0d3d6097ab479b354d Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 14 Aug 2020 19:51:57 +0100 Subject: [PATCH 45/45] More nodes --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 13 ++++++------- Nasal/ECAM/ECAM-logic.nas | 10 ++++------ Nasal/ECAM/ECAM-main.nas | 2 +- Nasal/Libraries/property-tree-setup.nas | 4 +++- Nasal/Panels/atc.nas | 3 +-- Nasal/Systems/fire.nas | 6 +----- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 8767911a..e8c19427 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -73,7 +73,6 @@ var final_deg = props.globals.getNode("/fdm/jsbsim/hydraulics/rudder/final-deg", var temperature_degc = props.globals.getNode("/environment/temperature-degc", 1); var gw = props.globals.getNode("/fdm/jsbsim/inertia/weight-lbs", 1); var tank3_content_lbs = props.globals.getNode("/fdm/jsbsim/propulsion/tank[2]/contents-lbs", 1); -var apu_master = props.globals.getNode("/controls/apu/master", 1); var ir2_knob = props.globals.getNode("/controls/adirs/ir[1]/knob", 1); var switch_bleedapu = props.globals.getNode("/controls/pneumatics/switches/apu", 1); var apuBleedNotOn = props.globals.getNode("/systems/pneumatics/warnings/apu-bleed-not-on", 1); @@ -610,7 +609,7 @@ var canvas_lowerECAM_apu = { me["APUGenHz"].setColor(0.7333,0.3803,0); } - if (apu_master.getValue() == 1 or apu_rpm.getValue() >= 94.9) { + if (systems.APUNodes.Controls.master.getValue() == 1 or apu_rpm.getValue() >= 94.9) { me["APUGenbox"].show(); me["APUGenHz"].show(); me["APUGenVolt"].show(); @@ -634,9 +633,9 @@ var canvas_lowerECAM_apu = { me["APUGenOnline"].hide(); } - if ((apu_master.getValue() == 0) or ((apu_master.getValue() == 1) and (gen_apu.getValue() == 1) and (apu_rpm.getValue() > 94.9))) { + if ((systems.APUNodes.Controls.master.getValue() == 0) or ((systems.APUNodes.Controls.master.getValue() == 1) and (gen_apu.getValue() == 1) and (apu_rpm.getValue() > 94.9))) { me["APUGentext"].setColor(0.8078,0.8039,0.8078); - } else if ((apu_master.getValue() == 1) and (gen_apu.getValue() == 0) and (apu_rpm.getValue() < 94.9)) { + } else if ((systems.APUNodes.Controls.master.getValue() == 1) and (gen_apu.getValue() == 0) and (apu_rpm.getValue() < 94.9)) { me["APUGentext"].setColor(0.7333,0.3803,0); } @@ -670,7 +669,7 @@ var canvas_lowerECAM_apu = { # APU N and EGT - if (apu_master.getValue() == 1) { + if (systems.APUNodes.Controls.master.getValue() == 1) { me["APUN"].setColor(0.0509,0.7529,0.2941); me["APUN"].setText(sprintf("%s", math.round(apu_rpm.getValue() or 0))); me["APUEGT"].setColor(0.0509,0.7529,0.2941); @@ -795,7 +794,7 @@ var canvas_lowerECAM_bleed = { # APU BLEED valve var apu_valve_state2 = apu_valve_state.getValue(); - if (apu_master.getValue()) { + if (systems.APUNodes.Controls.master.getValue()) { me["BLEED-APU-LINES"].show(); if (apu_valve_state2 == 1) { me["BLEED-APU-CIRCLE"].setRotation(0); @@ -1647,7 +1646,7 @@ var canvas_lowerECAM_elec = { } # APU - if (apu_master.getValue() == 0) { + if (systems.APUNodes.Controls.master.getValue() == 0) { me["APU-content"].hide(); me["APUGEN-off"].hide(); me["APU-border"].hide(); diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 482d0c78..f16b9cca 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -12,10 +12,8 @@ var emerGen = props.globals.getNode("/controls/electrical/switches/emer-gen var state1Node = props.globals.getNode("/engines/engine[0]/state", 1); var state2Node = props.globals.getNode("/engines/engine[1]/state", 1); -var wowNode = props.globals.getNode("/fdm/jsbsim/position/wow", 1); var apu_rpm = props.globals.getNode("/engines/engine[2]/n1", 1); var wing_pb = props.globals.getNode("/controls/ice-protection/wing", 1); -var apumaster = props.globals.getNode("/controls/apu/master", 1); var apu_bleedSw = props.globals.getNode("/controls/pneumatics/switches/apu", 1); var gear = props.globals.getNode("/gear/gear-pos-norm", 1); var cutoff1 = props.globals.getNode("/controls/engines/engine[0]/cutoff-switch", 1); @@ -226,7 +224,7 @@ var messages_priority_3 = func { ECAM_controller.warningReset(dualFailmasteroff); } - if (dualFailapuoff.clearFlag == 0 and apumaster.getBoolValue()) { + if (dualFailapuoff.clearFlag == 0 and systems.APUNodes.Controls.master.getBoolValue()) { dualFailapuoff.active = 1; } else { ECAM_controller.warningReset(dualFailapuoff); @@ -1310,7 +1308,7 @@ var messages_priority_2 = func { ECAM_controller.warningReset(apuAutoShutdown); } - if (apuAutoShutdownMast.clearFlag == 0 and pts.APU.masterSw.getValue() and apuAutoShutdown.active == 1) { + if (apuAutoShutdownMast.clearFlag == 0 and systems.APUNodes.Controls.master.getValue() and apuAutoShutdown.active == 1) { apuAutoShutdownMast.active = 1; } else { ECAM_controller.warningReset(apuAutoShutdownMast); @@ -2483,7 +2481,7 @@ var messages_right_memo = func { } setlistener("/engines/engine[0]/state", func() { - if ((state1Node.getValue() != 3 and state2Node.getValue() != 3) and wowNode.getValue() == 0) { + if ((state1Node.getValue() != 3 and state2Node.getValue() != 3) and !pts.Fdm.JSBsim.Position.wow.getBoolValue()) { dualFailNode.setBoolValue(1); } else { dualFailNode.setBoolValue(0); @@ -2491,7 +2489,7 @@ setlistener("/engines/engine[0]/state", func() { }, 0, 0); setlistener("/engines/engine[1]/state", func() { - if ((state1Node.getValue() != 3 and state2Node.getValue() != 3) and wowNode.getValue() == 0) { + if ((state1Node.getValue() != 3 and state2Node.getValue() != 3) and !pts.Fdm.JSBsim.Position.wow.getBoolValue()) { dualFailNode.setBoolValue(1); } else { dualFailNode.setBoolValue(0); diff --git a/Nasal/ECAM/ECAM-main.nas b/Nasal/ECAM/ECAM-main.nas index 189a2b8b..db1b2dc8 100644 --- a/Nasal/ECAM/ECAM-main.nas +++ b/Nasal/ECAM/ECAM-main.nas @@ -223,7 +223,7 @@ var SystemDisplay = { }, update: func() { phase = pts.ECAM.fwcWarningPhase.getValue(); - APUMaster = pts.APU.masterSw.getValue(); + APUMaster = systems.APUNodes.Controls.master.getValue(); APURPM = pts.APU.rpm.getValue(); engModeSel = pts.Controls.Engines.startSw.getValue(); elapsedSec = pts.Sim.Time.elapsedSec.getValue(); diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index 4f6b2a8a..fe9151fb 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -9,7 +9,6 @@ var Acconfig = { }; var APU = { - masterSw: props.globals.getNode("/controls/apu/master"), rpm: props.globals.getNode("/engines/engine[2]/n1"), }; @@ -74,6 +73,9 @@ var Fdm = { aileron: props.globals.getNode("/fdm/jsbsim/fbw/aileron-sidestick"), elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"), }, + Position: { + wow: props.globals.getNode("/fdm/jsbsim/position/wow"), + }, Propulsion: { Engine: { fuelUsed: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs")], diff --git a/Nasal/Panels/atc.nas b/Nasal/Panels/atc.nas index 216cf0a8..d1f3d267 100644 --- a/Nasal/Panels/atc.nas +++ b/Nasal/Panels/atc.nas @@ -24,7 +24,6 @@ var Transponder = { 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), - wowNode: props.globals.getNode("fdm/jsbsim/position/wow"), 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), @@ -84,7 +83,7 @@ var Transponder = { me.setMode(4); # on } } else if (me.mode >= 3) { - if (me.wowNode.getBoolValue()) { + if (pts.Fdm.JSBsim.Position.wow.getBoolValue()) { if (me.knobNode.getValue() != 3) { me.setMode(3); # gnd } diff --git a/Nasal/Systems/fire.nas b/Nasal/Systems/fire.nas index cb25e0c6..89044210 100644 --- a/Nasal/Systems/fire.nas +++ b/Nasal/Systems/fire.nas @@ -32,8 +32,6 @@ var eng2AgentTimerTime = props.globals.initNode("/systems/fire/engine2/agent1-ti var eng1Agent2TimerTime = props.globals.initNode("/systems/fire/engine1/agent2-timer-time", 0, "INT"); 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 wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1); -var apuMaster = props.globals.getNode("/controls/apu/master", 1); var fire_init = func { setprop("/controls/OH/protectors/fwddisch", 0); @@ -56,7 +54,6 @@ var engFireDetectorUnit = { loopTwo: 0, condition: 100, fireProp: "", - wow: "", new: func(sys, fireProp, testProp) { var eF = {parents:[engFireDetectorUnit]}; eF.sys = sys; @@ -65,7 +62,6 @@ var engFireDetectorUnit = { eF.loopTwo = 0; eF.fireProp = props.globals.getNode(fireProp, 1); eF.testProp = props.globals.getNode(testProp, 1); - eF.wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1); eF.condition = 100; return eF; }, @@ -175,7 +171,7 @@ var engFireDetectorUnit = { eng2FireWarn.setBoolValue(1); } elsif (system == 2) { apuFireWarn.setBoolValue(1); - if (me.wow.getValue() == 1) { + if (pts.Fdm.JSBsim.Position.wow.getValue() == 1) { systems.APUController.APU.emergencyStop(); settimer(func() { # 3 sec delay - source TTM ATA 26 FIRE PROTECTION p102 extinguisherBottles.vector[4].discharge();