diff --git a/A320-main.xml b/A320-main.xml index 5811ce73..0661b639 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -228,6 +228,10 @@ 0 0 0 + 0 + 0 + 0 + 0 @@ -283,6 +287,15 @@ + + Simbrief + + nasal + + + DU @@ -655,6 +668,7 @@ 0 0 + @@ -4360,6 +4374,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 7a1bfbe9..e8cc5544 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -103,6 +103,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/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(); @@ -113,6 +114,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) { @@ -229,6 +231,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/simbrief-username", getprop("/systems/acconfig/options/simbrief-username")); } var writeSettings = func { @@ -240,6 +243,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..322311a8 --- /dev/null +++ b/AircraftConfig/simbrief.xml @@ -0,0 +1,84 @@ + + + + + + + + + simbrief + vbox + + + + acconfig.writeSettings(); + + + + + hbox + + left + Simbrief API + + + right + 20 + 20 + X + Esc + + dialog-close + + + + + + + + vbox + + left + This dialog allows users to pull their flightplan from simbrief. + + + left + 1. ACARS is only available if VHF3 is not in voice mode, and the appropriate electrical power is available. + + + left + 2. Flightplan uplink is only available before engine start, if a flightplan is not yet entered in the MCDU + + + left + 3. GIGO... there is no sanity check on inputs! + + + left + 4. Please enter your username in the following text field (not case sensitive) + + + hbox + + 200 + 25 + Username + /FMGC/simbrief-username + + dialog-apply + + true + + + + + 40 + 10 + Apply / Exit + + dialog-close + + + + + diff --git a/Models/FlightDeck/res/fd_complete.ac b/Models/FlightDeck/res/fd_complete.ac index 5e9c20da..2c827b98 100644 --- a/Models/FlightDeck/res/fd_complete.ac +++ b/Models/FlightDeck/res/fd_complete.ac @@ -72787,7 +72787,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 @@ -72819,7 +72819,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 diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index c98c55f3..e8c19427 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); @@ -74,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); @@ -137,9 +135,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 +146,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 +263,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 +289,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(); @@ -618,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(); @@ -642,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); } @@ -678,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); @@ -803,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); @@ -1655,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(); @@ -1739,31 +1730,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 +1766,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 +1804,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 +1841,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.ac1.getValue() >= 110) { me["ELEC-Line-AC1-ACESS"].show(); } else { me["ELEC-Line-AC1-ACESS"].hide(); @@ -1858,7 +1849,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 +1860,7 @@ var canvas_lowerECAM_elec = { } if (getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") == 1) { - if (ac1.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); @@ -1882,7 +1873,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 030d6b7d..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); @@ -111,49 +109,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); @@ -269,7 +229,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","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -294,6 +255,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(); @@ -310,6 +272,7 @@ var canvas_MCDU_base = { me["IRSINIT"].hide(); me["INITB"].hide(); me["FUELPRED"].hide(); + me["WIND"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); }, @@ -408,6 +371,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(); @@ -1241,9 +1205,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"); @@ -1445,6 +1406,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(); @@ -1860,6 +1822,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(); @@ -1963,7 +1926,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(); @@ -2020,6 +1987,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(); @@ -2237,6 +2205,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(); @@ -2283,7 +2252,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 +2261,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 +2269,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 +2312,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 +2338,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 +2354,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 +2369,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 +2407,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 +2462,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 +2507,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 +2530,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 +2547,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 +2567,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); @@ -2614,6 +2583,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(); @@ -2694,20 +2664,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 +2688,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 +2742,57 @@ 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())); - - 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())); + me["Simple_L6"].setText(sprintf("%.1f", fmgc.FMGCInternal.minDestFob)); + 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 +2801,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 +2812,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 +2832,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); @@ -2896,6 +2862,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(); @@ -3026,6 +2993,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(); @@ -3179,10 +3147,10 @@ var canvas_MCDU_base = { me["Simple_R5"].setFontSize(small); } - if ((zfwSet.getValue() == 1 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(" ---"); @@ -3792,12 +3760,12 @@ 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) { - 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"))); - me["Simple_L5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vapp_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()) { me.fontSizeLeft(0, 0, 0, 0, normal, 0); @@ -3810,7 +3778,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 { @@ -3891,10 +3859,10 @@ 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) { - 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(" ---"); @@ -3907,14 +3875,10 @@ 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(); + me["WIND"].show(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); @@ -3954,12 +3918,44 @@ var canvas_MCDU_base = { me.fontSizeCenter(small, small, small, small, small, normal); } + if (page == "WINDHIST") { + if (fmgc.windController.hist_winds.wind1.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])); + 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]); @@ -4540,6 +4536,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(); @@ -4605,6 +4602,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..365d0760 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -12,7 +12,7 @@ viewBox="0 0 1024 864" version="1.1" id="svg2" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" sodipodi:docname="mcdu.svg"> @@ -37,17 +37,17 @@ guidetolerance="20" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="705" + inkscape:window-width="1440" + inkscape:window-height="819" id="namedview371" showgrid="true" - inkscape:zoom="1.1488097" - inkscape:cx="1021.6506" - inkscape:cy="302.3673" - inkscape:window-x="-8" - inkscape:window-y="-8" - inkscape:window-maximized="1" - inkscape:current-layer="svg2" + 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" @@ -2259,6 +2259,118 @@ 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">. + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2279,9 +2391,9 @@ inkscape:connector-curvature="0" id="path4378" 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" /> + 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" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + inkscape:label="PROG" + sodipodi:insensitive="true"> + 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" /> - - - - - + transform="matrix(1.0807111,0,0,1.0807111,-76.462145,331.52578)" + inkscape:label="#g4324" + id="WEATHERREQSEND" + style="stroke:#179ab7;stroke-opacity:1"> + + + + + 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/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 diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index c32e6084..6ae1eb7b 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); @@ -73,7 +71,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 +128,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"); @@ -221,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) { @@ -246,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) { @@ -275,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; @@ -298,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; @@ -889,6 +884,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); @@ -1197,7 +1205,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) { @@ -1221,7 +1229,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) { @@ -1252,14 +1260,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; } @@ -1399,7 +1407,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; @@ -1433,7 +1441,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; @@ -1467,7 +1475,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; @@ -1506,7 +1514,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; @@ -1531,7 +1539,7 @@ var canvas_PFD_1 = { } } - if (alt_agl.getValue() < 400) { + if (gear_agl.getValue() < 400) { me["S_target"].hide(); me["F_target"].hide(); } @@ -1935,7 +1943,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) { @@ -1959,7 +1967,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) { @@ -1990,14 +1998,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; } @@ -2138,7 +2146,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; @@ -2172,7 +2180,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; @@ -2206,7 +2214,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; @@ -2245,7 +2253,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; @@ -2270,7 +2278,7 @@ var canvas_PFD_2 = { } } - if (alt_agl.getValue() < 400) { + if (gear_agl.getValue() < 400) { me["S_target"].hide(); me["F_target"].hide(); } 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/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..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); @@ -1167,13 +1165,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; @@ -1298,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); @@ -2471,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); @@ -2479,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/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/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/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 07b6c434..c78d9f6c 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); @@ -138,6 +138,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, @@ -177,6 +207,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() { @@ -204,7 +275,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); } } @@ -214,14 +285,36 @@ 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})); } } +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); }; @@ -234,15 +327,10 @@ 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))); - } - # 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; @@ -252,35 +340,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; @@ -290,32 +378,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; } @@ -347,76 +435,84 @@ 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); } } + # 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 (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"); - 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); - setprop("/FMGC/internal/extra-time", sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min)); - } else { - setprop("/FMGC/internal/extra-time", 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 (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 { - 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); + 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; } - 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); } ############################ @@ -523,7 +619,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"); @@ -600,11 +696,58 @@ 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"); + } + + ############################ + # fuel + ############################ + 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.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; + } + } + 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(); + } } ############################ @@ -612,111 +755,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); } } @@ -728,83 +862,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; } ############################ @@ -814,7 +948,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; @@ -845,7 +979,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"); @@ -896,7 +1030,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"); @@ -909,7 +1043,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"); @@ -941,8 +1075,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) { @@ -978,8 +1112,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) { @@ -987,15 +1121,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); } @@ -1113,7 +1247,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 { @@ -1150,7 +1284,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(); @@ -1159,7 +1293,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(); diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas new file mode 100644 index 00000000..f75a56e6 --- /dev/null +++ b/Nasal/FMGC/SimbriefParser.nas @@ -0,0 +1,182 @@ +# A3XX Simbrief Parser +# Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) + +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/A320-family-simbrief.xml") + .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) { + if (data.getChild("OFP") == nil) { + 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() or "") ~ (me.store1.getChild("flight_number").getValue() or ""); + 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; + if (me.store1.getChild("avg_wind_comp").getValue() >= 0) { + fmgc.FMGCInternal.tripWind = "TL" ~ me.store1.getChild("avg_wind_comp").getValue(); + } else { + 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; + + # 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(); + 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(); + 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(); + } + } + + 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 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); + } + fmgc.flightPlanController.destroyTemporaryFlightPlan(3, 1); + + fmgc.windController.updatePlans(); + fmgc.updateRouteManagerAlt(); + + + # 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; + 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 { + fmgc.FMGCInternal.rtePercent = 15.0 + } + fmgc.FMGCInternal.rtePercentSet = 0; + 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/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 1c1e2436..e4018ba7 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; } @@ -820,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; } diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index aa769301..f7aa6575 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 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"), diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index b2c477a1..0d28fdd9 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -93,6 +93,11 @@ var windController = { clb_winds: [0, 0, 0], crz_winds: [0, 0, 0], des_winds: [0, 0, 0], + hist_winds: 0, + fl50_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], @@ -104,6 +109,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 +224,83 @@ 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 + write: func() { + if (me.des_winds[2] != 0) { + var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt"; + var file = io.open(path, "wb"); + var winds_added = 0; + + if (me.fl50_wind[2] != "") { + io.write(file, me.fl50_wind[0] ~ "," ~ me.fl50_wind[1] ~ "," ~ me.fl50_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"); + } + }, insertWind: func(plan, index, value, id) { if (me.windSizes[plan] == index) { 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/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 67e4dbf9..9dd5f0f8 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/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/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index e70cd4a4..59646a87 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 * 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 = perc / 100 * 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 / fmgc.FMGCInternal.tripFuel * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = scratchpad / 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 (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) { + mcdu_message(i, "CHECK MIN DEST FOB"); } } else { mcdu_message(i, "NOT ALLOWED"); @@ -152,16 +127,19 @@ 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 = 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); @@ -169,28 +147,31 @@ 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) { - 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 = 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) { - 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"); @@ -198,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) { - 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 = 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 { @@ -227,12 +211,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/INITA.nas b/Nasal/MCDU/INITA.nas index 1e019e47..3fffc6f9 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; @@ -210,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"); @@ -240,6 +223,26 @@ var initInputA = func(key, i) { mcdu_message(i, "TMPY F-PLN EXISTS"); } } + } else if (key == "R2") { + if (getprop("engines/engine[0]/state") != 3 and getprop("engines/engine[1]/state") != 3) { + 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, "VHF3 VOICE MSG NOT GEN"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else if (key == "R3") { setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); } else if (key == "R4") { diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 9ac78db6..1694d1f4 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 * 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 = perc / 100 * 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 / fmgc.FMGCInternal.tripFuel * 100 <= 15.0) { + fmgc.FMGCInternal.rtePercent = scratchpad / 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 (fmgc.FMGCInternal.minDestFob < 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 = 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); @@ -176,15 +175,14 @@ 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) { - 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 = 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); @@ -198,10 +196,10 @@ 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) { - 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"); @@ -209,13 +207,12 @@ 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) { - 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 = 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 6fffab6b..c9158e19 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; @@ -526,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); @@ -593,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") { @@ -658,7 +659,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); @@ -888,8 +891,8 @@ 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); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { @@ -1068,7 +1071,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")); 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"); 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..f33366c8 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; } } @@ -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 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 94bd5b08..ba5bfc21 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,97 @@ 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"]; + + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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 +140,85 @@ 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) { + 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; + } + 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"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }; \ No newline at end of file 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/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/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 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/Nasal/Systems/fire.nas b/Nasal/Systems/fire.nas index ad949cd8..89044210 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,15 @@ 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 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(); } @@ -59,7 +54,6 @@ var engFireDetectorUnit = { loopTwo: 0, condition: 100, fireProp: "", - wow: "", new: func(sys, fireProp, testProp) { var eF = {parents:[engFireDetectorUnit]}; eF.sys = sys; @@ -68,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; }, @@ -178,8 +171,7 @@ var engFireDetectorUnit = { eng2FireWarn.setBoolValue(1); } elsif (system == 2) { apuFireWarn.setBoolValue(1); - if (me.wow.getValue() == 1) { - apuBleedNode.setValue(0); + 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(); @@ -284,9 +276,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 +303,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 +544,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 +554,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 +587,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 +597,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 +630,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,10 +652,10 @@ 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) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { eng1FireWarn.setBoolValue(1); } } else { @@ -674,9 +665,9 @@ 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) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { eng2FireWarn.setBoolValue(1); } } else { @@ -686,9 +677,9 @@ 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) { + if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) { apuFireWarn.setBoolValue(1); } } else { @@ -698,7 +689,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(); @@ -712,7 +703,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()); @@ -731,7 +722,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()); 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 diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index c3beab5e..df99d463 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -1660,10 +1660,10 @@ 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 + 0.4 @@ -1671,10 +1671,10 @@ 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 + 0.4 @@ -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 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 diff --git a/Systems/a320-fuel.xml b/Systems/a320-fuel.xml index a38d6f79..2000c5de 100644 --- a/Systems/a320-fuel.xml +++ b/Systems/a320-fuel.xml @@ -543,6 +543,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 + @@ -774,7 +800,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 diff --git a/Systems/a320-fwc.xml b/Systems/a320-fwc.xml index 783e1d4b..89a79a4b 100644 --- a/Systems/a320-fwc.xml +++ b/Systems/a320-fwc.xml @@ -335,6 +335,13 @@ 100 0.2 + + + Timer for the ECAM system + /ECAM/warnings/logic/nav-gpws-terr-fault + 100 + 1.0 + @@ -1438,6 +1445,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 + + 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