1
0
Fork 0

Clean-up INITB/FUELPRED, fix formatting for entries

This commit is contained in:
Matthew Maring 2020-04-14 18:12:38 -04:00 committed by Jonathan Redpath
parent 19bd42adc3
commit 16622a4a55
5 changed files with 182 additions and 92 deletions

View file

@ -147,6 +147,7 @@ var alt_utc = props.globals.getNode("FMGC/internal/alt-utc", 1);
var pri_efob = props.globals.getNode("FMGC/internal/pri-efob", 1); var pri_efob = props.globals.getNode("FMGC/internal/pri-efob", 1);
var alt_efob = props.globals.getNode("FMGC/internal/alt-efob", 1); var alt_efob = props.globals.getNode("FMGC/internal/alt-efob", 1);
var fob = props.globals.getNode("FMGC/internal/fob", 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/gw", 1); var gw = props.globals.getNode("FMGC/internal/gw", 1);
var cg = props.globals.getNode("FMGC/internal/cg", 1); var cg = props.globals.getNode("FMGC/internal/cg", 1);
@ -1472,7 +1473,7 @@ var canvas_MCDU_base = {
me["Simple_L2"].setText("---.-/----"); me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText("---.-/---.-"); me["Simple_L3"].setText("---.-/---.-");
me["Simple_L4"].setText("---.-/----"); me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/----"); me["Simple_L5"].setText("---.-/0030");
me["Simple_L6"].setText("---.-"); me["Simple_L6"].setText("---.-");
me["Simple_R3S"].show(); me["Simple_R3S"].show();
me["Simple_R3"].show(); me["Simple_R3"].show();
@ -1610,7 +1611,7 @@ var canvas_MCDU_base = {
setprop("FMGC/internal/fob", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/fob", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/gw", num(getprop("fdm/jsbsim/inertia/weight-lbs") / 1000)); setprop("FMGC/internal/gw", num(getprop("fdm/jsbsim/inertia/weight-lbs") / 1000));
setprop("FMGC/internal/cg", num(getprop("FMGC/internal/zfwcg"))); setprop("FMGC/internal/cg", num(getprop("FMGC/internal/zfwcg")));
me["Simple_R4"].setText(sprintf("%4.1f/FF+FQ", fob.getValue())); 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_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_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue()));
@ -1619,7 +1620,7 @@ var canvas_MCDU_base = {
} else { } else {
me["Simple_L3"].setText("---.-/---.-"); me["Simple_L3"].setText("---.-/---.-");
me["Simple_L4"].setText("---.-/----"); me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/----"); me["Simple_L5"].setText("---.-/0030");
me["Simple_L6"].setText("---.-"); me["Simple_L6"].setText("---.-");
me["Simple_R4"].setText("---.-/FF+FQ"); me["Simple_R4"].setText("---.-/FF+FQ");
@ -2514,7 +2515,7 @@ var canvas_MCDU_base = {
me["Simple_L4"].setText(sprintf("%3.0f", transAlt.getValue())); me["Simple_L4"].setText(sprintf("%3.0f", transAlt.getValue()));
me["Simple_R1S"].setText("FINAL"); me["Simple_R1S"].setText("FINAL");
if (fmgc.flightPlanController.flightplans[2].approach.id != nil) { if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me["Simple_R1"].setText(sprintf("%s",fmgc.flightPlanController.flightplans[2].approach.id)); me["Simple_R1"].setText(sprintf("%s",fmgc.flightPlanController.flightplans[2].approach.id));
} else { } else {
me["Simple_R1"].setText("--- "); me["Simple_R1"].setText("--- ");

View file

@ -3,8 +3,12 @@
# Copyright (c) 2020 Matthew Maring (hayden2000) # Copyright (c) 2020 Matthew Maring (hayden2000)
# From INIT-B # 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 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 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 taxi_fuel = props.globals.getNode("FMGC/internal/taxi-fuel", 1);
var trip_fuel = props.globals.getNode("FMGC/internal/trip-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 trip_time = props.globals.getNode("FMGC/internal/trip-time", 1);
@ -18,76 +22,94 @@ var min_dest_fob = props.globals.getNode("FMGC/internal/min-dest-fob", 1);
var tow = props.globals.getNode("FMGC/internal/tow", 1); var tow = props.globals.getNode("FMGC/internal/tow", 1);
var lw = props.globals.getNode("FMGC/internal/lw", 1); var lw = props.globals.getNode("FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("FMGC/internal/trip-wind", 1); var trip_wind = 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_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1); var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1);
var fuelPredInput = func(key, i) { var fuelPredInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad"); var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L3") { if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (getprop("FMGC/internal/trip-fuel") != 0) { } else if (getprop("FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]); var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 100.0) { if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue())); setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", perc); setprop("FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (tfs >= 1 and tfs <= 4) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= trip_fuel.getValue()) {
setprop("FMGC/internal/rte-rsv", scratchpad); setprop("FMGC/internal/rte-rsv", scratchpad);
setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100); setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L4") { } else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); setprop("FMGC/internal/alt-fuel", 0.0);
} else { setprop("FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { setprop("FMGC/internal/alt-fuel", tf);
setprop("FMGC/internal/alt-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue())); setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue())); setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} else {
} else { notAllowed(i);
notAllowed(i); }
} } else {
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/alt-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} }
} else if (key == "L5") { } else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); setprop("FMGC/internal/final-fuel", 0.0);
} else { setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { setprop("FMGC/internal/final-fuel", tf);
setprop("FMGC/internal/final-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue())); setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue())); setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else {
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("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -144,5 +166,22 @@ var fuelPredInput = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} }
} else if (key == "R4") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/fffq-sensor", "FF+FQ");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} 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);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else {
notAllowed(i);
} }
} }

View file

@ -87,7 +87,6 @@ var initInputA = func(key, i) {
} }
var temp = int(crztemp[1]); var temp = int(crztemp[1]);
var temps = size(crztemp[1]); var temps = size(crztemp[1]);
print(crzs);
if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("FMGC/internal/cruise-lvl-set")) { if (crzs == 0 and temps >= 1 and temps <= 3 and temp != nil and getprop("FMGC/internal/cruise-lvl-set")) {
if (temp >= -99 and temp <= 99) { if (temp >= -99 and temp <= 99) {
setprop("FMGC/internal/cruise-temp", temp); setprop("FMGC/internal/cruise-temp", temp);

View file

@ -2,8 +2,12 @@
# Copyright (c) 2020 Matthew Maring (hayden2000) # Copyright (c) 2020 Matthew Maring (hayden2000)
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 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 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 taxi_fuel = props.globals.getNode("FMGC/internal/taxi-fuel", 1);
var trip_fuel = props.globals.getNode("FMGC/internal/trip-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 trip_time = props.globals.getNode("FMGC/internal/trip-time", 1);
@ -28,7 +32,7 @@ var initInputB = func(key, i) {
} else { } else {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 4) { if (tfs >= 1 and tfs <= 4) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 10.0) { if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) {
setprop("FMGC/internal/taxi-fuel", scratchpad); setprop("FMGC/internal/taxi-fuel", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -44,8 +48,8 @@ var initInputB = func(key, i) {
notAllowed(i); notAllowed(i);
} }
} }
} # }
# else if (key == "L2") { # else if (key == "L2") {
# if (scratchpad == "CLR") { # if (scratchpad == "CLR") {
# notAllowed(i); # notAllowed(i);
# } else if (getprop("FMGC/internal/trip-fuel") != 0) { # } else if (getprop("FMGC/internal/trip-fuel") != 0) {
@ -69,75 +73,87 @@ var initInputB = func(key, i) {
# notAllowed(i); # notAllowed(i);
# } # }
# #
# } } else if (key == "L3" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
else if (key == "L3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (getprop("FMGC/internal/trip-fuel") != 0) { } else if (getprop("FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) { if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]); var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 100.0) { if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue())); setprop("FMGC/internal/rte-rsv", num(perc) / 100 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", perc); setprop("FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} }
} else if (tfs >= 1 and tfs <= 4) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(trip_fuel.getValue()) <= 0.15) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= trip_fuel.getValue()) {
setprop("FMGC/internal/rte-rsv", scratchpad); setprop("FMGC/internal/rte-rsv", scratchpad);
setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100); setprop("FMGC/internal/rte-percent", scratchpad / num(trip_fuel.getValue()) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L4") { } else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); setprop("FMGC/internal/alt-fuel", 0.0);
} else { setprop("FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { setprop("FMGC/internal/alt-fuel", tf);
setprop("FMGC/internal/alt-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue())); setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue())); } else {
notAllowed(i);
} else { }
notAllowed(i); } else {
} 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/alt-time", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} }
} else if (key == "L5") { } else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); setprop("FMGC/internal/final-fuel", 0.0);
} else { setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 3) { if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and scratchpad < trip_fuel.getValue()) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 99.9) { setprop("FMGC/internal/final-fuel", tf);
setprop("FMGC/internal/final-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue())); setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue())); } else {
notAllowed(i);
} else { }
notAllowed(i); } else {
} 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("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -214,5 +230,37 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("FMGC/internal/block-set", 1); setprop("FMGC/internal/block-set", 1);
} }
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/trip-wind", "HD000");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
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("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(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("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else {
if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) {
setprop("FMGC/internal/trip-wind", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
}
}
} else {
notAllowed(i);
} }
} }

View file

@ -89,11 +89,12 @@ var MCDU_reset = func(i) {
setprop("FMGC/internal/alt-fuel", 0); setprop("FMGC/internal/alt-fuel", 0);
setprop("FMGC/internal/alt-time", "0000"); setprop("FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/final-fuel", 0); setprop("FMGC/internal/final-fuel", 0);
setprop("FMGC/internal/final-time", "0000"); setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/min-dest-fob", 0); setprop("FMGC/internal/min-dest-fob", 0);
setprop("FMGC/internal/tow", 0); setprop("FMGC/internal/tow", 0);
setprop("FMGC/internal/lw", 0); setprop("FMGC/internal/lw", 0);
setprop("FMGC/internal/trip-wind", "HD000"); setprop("FMGC/internal/trip-wind", "HD000");
setprop("FMGC/internal/fffq-sensor", "FF+FQ");
setprop("FMGC/internal/extra-fuel", 0); setprop("FMGC/internal/extra-fuel", 0);
setprop("FMGC/internal/extra-time", "0000"); setprop("FMGC/internal/extra-time", "0000");
@ -488,7 +489,9 @@ var rskbutton = func(btn, i) {
notAllowed(i); notAllowed(i);
} }
} else if (btn == "4") { } else if (btn == "4") {
if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { if (getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("R4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("R4",i); perfTOInput("R4",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFAPPR") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
perfAPPRInput("R4",i); perfAPPRInput("R4",i);