From 1cd3e66d2481951e1be3bc4a65074bd47c349372 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 3 May 2020 13:29:46 -0400 Subject: [PATCH] Add temporary wind temp (simplified for testing) --- Models/Instruments/MCDU/MCDU.nas | 1 + Nasal/FMGC/FMGC.nas | 16 ++++++---------- Nasal/MCDU/FUELPRED.nas | 1 + Nasal/MCDU/INITB.nas | 5 +++++ Nasal/MCDU/MCDU.nas | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index e347359a..4dc7ca15 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -139,6 +139,7 @@ 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); diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index befa621f..4e4d827b 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -224,16 +224,12 @@ var updateFuel = func { dist = 0; } - # wind = getprop("/FMGC/internal/trip-wind"); -# if (find("TL", wind) != -1 or find("HD", wind) != -1) { -# effwind = substr(wind, 2); -# -# } else if (find("-", wind) != -1 or find("+", wind) != -1 or find("T", wind) != -1 or find("H", wind) != -1) { -# effwind = substr(wind, 1); -# -# } else { -# #positive tail wind -# } + wind = getprop("/FMGC/internal/trip-wind"); + wind_value = getprop("/FMGC/internal/trip-wind-value"); + if (find("HD", wind) != -1 or find("-", wind) != -1 or find("H", wind) != -1) { + wind_value = wind_value * -1; + } + dist = dist - (dist * wind_value * 0.002); trip_fuel = 4.003e+02 + (dist * -5.399e+01) + (dist * dist * -7.322e-02) + (dist * dist * dist * 1.091e-05) + (dist * dist * dist * dist * 2.962e-10) + (dist * dist * dist * dist * dist * -1.178e-13) + (dist * dist * dist * dist * dist * dist * 6.322e-18) + (crz * 5.387e+01) + (dist * crz * 1.583e+00) + (dist * dist * crz * 7.695e-04) + (dist * dist * dist * crz * -1.057e-07) + (dist * dist * dist * dist * crz * 1.138e-12) + (dist * dist * dist * dist * dist * crz * 1.736e-16) + (crz * crz * -1.171e+00) + (dist * crz * crz * -1.219e-02) + (dist * dist * crz * crz * -2.879e-06) + (dist * dist * dist * crz * crz * 3.115e-10) + (dist * dist * dist * dist * crz * crz * -4.093e-15) + (crz * crz * crz * 9.160e-03) + (dist * crz * crz * crz * 4.311e-05) + (dist * dist * crz * crz * crz * 4.532e-09) + (dist * dist * dist * crz * crz * crz * -2.879e-13) + (crz * crz * crz * crz * -3.338e-05) + (dist * crz * crz * crz * crz * -7.340e-08) + (dist * dist * crz * crz * crz * crz * -2.494e-12) + (crz * crz * crz * crz * crz * 5.849e-08) + (dist * crz * crz * crz * crz * crz * 4.898e-11) + (crz * crz * crz * crz * crz * crz * -3.999e-11); if (trip_fuel < 400) { diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 78442676..2b5dfacc 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -22,6 +22,7 @@ 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); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index c3a8f1c7..647c7954 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -214,6 +214,7 @@ var initInputB = func(key, i) { 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"); @@ -256,6 +257,7 @@ 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); if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } @@ -266,6 +268,7 @@ var initInputB = func(key, i) { 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); if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } @@ -277,6 +280,7 @@ var initInputB = func(key, i) { 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); if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 1); } @@ -287,6 +291,7 @@ 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); 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 2cb5da38..5b2beb66 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -114,6 +114,7 @@ var MCDU_reset = func(i) { 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");