1
0
Fork 0

Update FUELPRED implementation

This commit is contained in:
Matthew Maring 2020-05-01 21:21:57 -04:00
parent e9109a2cfc
commit 80c677bee3
3 changed files with 115 additions and 49 deletions

View file

@ -1752,7 +1752,7 @@ var canvas_MCDU_base = {
me.fontRightS(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default);
me.fontSizeLeft(normal, normal, small, small, small, small); me.fontSizeLeft(normal, normal, small, small, small, small);
me.fontSizeRight(normal, normal, small, small, small, small); me.fontSizeRight(normal, normal, normal, small, small, small);
me.colorLeft("grn", "grn", "wht", "wht", "wht", "wht"); me.colorLeft("grn", "grn", "wht", "wht", "wht", "wht");
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
@ -1796,12 +1796,19 @@ var canvas_MCDU_base = {
me["Simple_R5S"].setText(" GW/ CG"); me["Simple_R5S"].setText(" GW/ CG");
me["Simple_R6S"].setText("EXTRA/TIME"); me["Simple_R6S"].setText("EXTRA/TIME");
if (blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (!getprop("/FMGC/internal/fuel-request-set") or !getprop("/FMGC/internal/block-confirmed") or getprop("/FMGC/internal/fuel-calculating")) {
setprop("/FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); me["Simple_L3"].setText(sprintf("---.-/%4.1f", rte_percent.getValue()));
setprop("/FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); me["Simple_L4"].setText("---.-/----");
setprop("/FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue())); me["Simple_L5"].setText("---.-/" ~ final_time.getValue());
setprop("/FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue())); me["Simple_L6"].setText("---.-");
me["Simple_R4"].setText("---.-/FF+FQ");
me["Simple_R5"].setText("---.-/---.-");
me["Simple_R6"].setText("---.-/----");
me.colorLeft("ack", "ack", "wht", "wht", "wht", "wht");
me.colorRight("ack", "ack", "ack", "wht", "wht", "wht");
} else {
me["Simple_L3"].setText(sprintf("%4.1f/", rte_rsv.getValue()) ~ sprintf("%4.1f", rte_percent.getValue())); me["Simple_L3"].setText(sprintf("%4.1f/", rte_rsv.getValue()) ~ sprintf("%4.1f", rte_percent.getValue()));
me["Simple_L4"].setText(sprintf("%4.1f/" ~ alt_time.getValue(), alt_fuel.getValue())); me["Simple_L4"].setText(sprintf("%4.1f/" ~ alt_time.getValue(), alt_fuel.getValue()));
me["Simple_L5"].setText(sprintf("%4.1f/" ~ final_time.getValue(), final_fuel.getValue())); me["Simple_L5"].setText(sprintf("%4.1f/" ~ final_time.getValue(), final_fuel.getValue()));
@ -1816,15 +1823,6 @@ var canvas_MCDU_base = {
me.colorLeft("ack", "ack", "blu", "blu", "blu", "blu"); me.colorLeft("ack", "ack", "blu", "blu", "blu", "blu");
me.colorRight("ack", "ack", "blu", "grn", "grn", "grn"); me.colorRight("ack", "ack", "blu", "grn", "grn", "grn");
} else {
me["Simple_L3"].setText("---.-/---.-");
me["Simple_L4"].setText("---.-/----");
me["Simple_L5"].setText("---.-/0030");
me["Simple_L6"].setText("---.-");
me["Simple_R4"].setText("---.-/FF+FQ");
me["Simple_R5"].setText("---.-/---.-");
me["Simple_R6"].setText("---.-/----");
} }
me["Simple_R3S"].setText("ZFWCG/ZFW"); me["Simple_R3S"].setText("ZFWCG/ZFW");
@ -1849,6 +1847,30 @@ var canvas_MCDU_base = {
me["Simple_R3"].hide(); me["Simple_R3"].hide();
} }
if (rte_set.getValue() == 1) {
me["Simple_L3"].setFontSize(normal);
} else {
me["Simple_L3"].setFontSize(small);
}
if (alt_fuel_set.getValue() == 1) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
if (final_fuel_set.getValue() == 1 or final_time_set.getValue() == 1) {
me["Simple_L5"].setFontSize(normal);
} else {
me["Simple_L5"].setFontSize(small);
}
if (min_dest_fob_set.getValue() == 1) {
me["Simple_L6"].setFontSize(normal);
} else {
me["Simple_L6"].setFontSize(small);
}
} else if (page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { } else if (page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") {
if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) { if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) {
setprop("/MCDU[" ~ i ~ "]/page", "PROGTO"); setprop("/MCDU[" ~ i ~ "]/page", "PROGTO");

View file

@ -29,74 +29,75 @@ 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" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue())); setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
fmgc.updateFuel(); 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 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 <= 15.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(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-percent", perc); setprop("/FMGC/internal/rte-percent", perc);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} }
} 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) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7 and tf / num(getprop("/FMGC/internal/trip-fuel")) <= 0.15) {
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(getprop("/FMGC/internal/trip-fuel")) * 100);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else if (key == "L4" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { } else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-fuel", 0.0); setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/fuel-calculating", 1);
fmgc.updateFuel(); setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) { 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-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/alt-time", "0000");
fmgc.updateFuel(); setprop("/FMGC/internal/alt-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} else { } else {
var tf = num(scratchpad); notAllowed(i);
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 {
notAllowed(i);
}
} }
} else if (key == "L5" and blockSet.getValue() == 1 and zfwSet.getValue() == 1) { } else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0); setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030"); setprop("/FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0); setprop("/FMGC/internal/final-fuel-set", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/final-time-set", 0);
fmgc.updateFuel(); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else if (find(".", scratchpad) != -1) { } else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad); var tf = num(scratchpad);
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) { 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", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/final-fuel-set", 1);
fmgc.updateFuel(); setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
@ -105,12 +106,38 @@ var fuelPredInput = func(key, i) {
var tfs = size(scratchpad); var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) { 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", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("/FMGC/internal/final-time-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {
notAllowed(i); notAllowed(i);
} }
} }
} else if (key == "R3") { } 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);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} 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);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
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");
}
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
} else if (key == "R3" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
notAllowed(i); notAllowed(i);
} else { } else {
@ -130,6 +157,10 @@ var fuelPredInput = func(key, i) {
if (getprop("/FMGC/internal/block-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", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
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);
} }
} }
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) {
@ -138,6 +169,13 @@ var fuelPredInput = func(key, i) {
if (getprop("/FMGC/internal/block-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", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
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);
}
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} }
} }
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
@ -153,6 +191,10 @@ var fuelPredInput = func(key, i) {
if (getprop("/FMGC/internal/block-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", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1); setprop("/FMGC/internal/block-set", 1);
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);
} }
setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else { } else {

View file

@ -399,6 +399,8 @@ var lskbutton = func(btn, i) {
initInputA("L6",i); initInputA("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("L6",i); initInputB("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("L6",i); initInputIRS("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") {