1
0
Fork 0

Remove setprop/getprop from fuel, min dest fob bug fix

This commit is contained in:
Matthew Maring 2020-08-01 09:57:19 -04:00
parent 34e15b1765
commit c75df53506
5 changed files with 467 additions and 495 deletions

View file

@ -111,49 +111,11 @@ var align_set = props.globals.getNode("/FMGC/internal/align-set", 1);
# ROUTE SELECTION
# INT-B
var zfwcg = props.globals.getNode("/FMGC/internal/zfwcg", 1);
var zfwcgSet = props.globals.getNode("/FMGC/internal/zfwcg-set", 1);
var zfw = props.globals.getNode("/FMGC/internal/zfw", 1);
var zfwSet = props.globals.getNode("/FMGC/internal/zfw-set", 1);
var block = props.globals.getNode("/FMGC/internal/block", 1);
var blockSet = props.globals.getNode("/FMGC/internal/block-set", 1);
var taxi_fuel = props.globals.getNode("/FMGC/internal/taxi-fuel", 1);
var trip_fuel = props.globals.getNode("/FMGC/internal/trip-fuel", 1);
var trip_time = props.globals.getNode("/FMGC/internal/trip-time", 1);
var rte_rsv = props.globals.getNode("/FMGC/internal/rte-rsv", 1);
var rte_rsv_set = props.globals.getNode("/FMGC/internal/rte-rsv-set", 1);
var rte_percent = props.globals.getNode("/FMGC/internal/rte-percent", 1);
var rte_percent_set = props.globals.getNode("/FMGC/internal/rte-percent-set", 1);
var alt_fuel = props.globals.getNode("/FMGC/internal/alt-fuel", 1);
var alt_time = props.globals.getNode("/FMGC/internal/alt-time", 1);
var final_fuel = props.globals.getNode("/FMGC/internal/final-fuel", 1);
var final_time = props.globals.getNode("/FMGC/internal/final-time", 1);
var min_dest_fob = props.globals.getNode("/FMGC/internal/min-dest-fob", 1);
var tow = props.globals.getNode("/FMGC/internal/tow", 1);
var lw = props.globals.getNode("/FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("/FMGC/internal/trip-wind", 1);
var trip_wind_value = props.globals.getNode("/FMGC/internal/trip-wind-value", 1);
var extra_fuel = props.globals.getNode("/FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("/FMGC/internal/extra-time", 1);
var taxi_fuel_set = props.globals.getNode("/FMGC/internal/taxi-fuel-set", 1);
var rte_set = props.globals.getNode("/FMGC/internal/rte-set", 1);
var alt_fuel_set = props.globals.getNode("/FMGC/internal/alt-fuel-set", 1);
var final_fuel_set = props.globals.getNode("/FMGC/internal/final-fuel-set", 1);
var final_time_set = props.globals.getNode("/FMGC/internal/final-time-set", 1);
var min_dest_fob_set = props.globals.getNode("/FMGC/internal/min-dest-fob-set", 1);
# FUELPRED
var state1 = props.globals.getNode("/engines/engine[0]/state", 1);
var state2 = props.globals.getNode("/engines/engine[1]/state", 1);
var engrdy = props.globals.getNode("/engines/ready", 1);
var pri_utc = props.globals.getNode("/FMGC/internal/pri-utc", 1);
var alt_utc = props.globals.getNode("/FMGC/internal/alt-utc", 1);
var pri_efob = props.globals.getNode("/FMGC/internal/pri-efob", 1);
var alt_efob = props.globals.getNode("/FMGC/internal/alt-efob", 1);
var fob = props.globals.getNode("/FMGC/internal/fob", 1);
var fffq_sensor = props.globals.getNode("/FMGC/internal/fffq-sensor", 1);
var gw = props.globals.getNode("/FMGC/internal/fuel-pred-gw", 1);
var cg = props.globals.getNode("/FMGC/internal/cg", 1);
# PERF
var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1);
@ -2283,7 +2245,7 @@ var canvas_MCDU_base = {
}
me["Simple_L1S"].setText("TAXI");
me["Simple_L1"].setText(sprintf("%2.1f", taxi_fuel.getValue()));
me["Simple_L1"].setText(sprintf("%2.1f", fmgc.FMGCInternal.taxiFuel));
me["Simple_L2S"].setText("TRIP/TIME");
me["Simple_L3S"].setText("RTE RSV/PCT");
me["Simple_L4S"].setText("ALTN/TIME");
@ -2292,7 +2254,7 @@ var canvas_MCDU_base = {
me["Simple_R2S"].setText("BLOCK");
me["Simple_R4S"].setText("TOW/ LW");
me["Simple_R5S"].setText("TRIP WIND");
me["Simple_R5"].setText(trip_wind.getValue());
me["Simple_R5"].setText(fmgc.FMGCInternal.tripWind);
me["Simple_R6S"].setText("EXTRA/TIME");
me["Simple_Title"].setColor(1, 1, 1);
@ -2300,21 +2262,21 @@ var canvas_MCDU_base = {
if (!getprop("/FMGC/internal/fuel-request-set")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText("---.-");
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
me["Simple_L4"].setText("---.-/----");
me["Simple_C4"].hide();
me["Simple_L5"].setText("---.-");
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
me["Simple_L6"].setText("---.-");
if (blockSet.getValue() == 1) {
if (fmgc.FMGCInternal.blockSet) {
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block));
} else {
me["Simple_R2"].hide();
me["INITB_Block"].show();
}
if (zfwSet.getValue() == 1) {
if (fmgc.FMGCInternal.zfwSet) {
me["Simple_R3S"].show();
me["Simple_R3"].show();
me["Simple_R3S"].setText("FUEL");
@ -2343,11 +2305,11 @@ var canvas_MCDU_base = {
if (getprop("/FMGC/internal/block-calculating")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText("---.-");
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
me["Simple_L4"].setText("---.-/----");
me["Simple_C4"].hide();
me["Simple_L5"].setText("---.-");
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
me["Simple_L6"].setText("---.-");
me["Simple_R2"].show();
me["Simple_R2"].setText("---.-");
@ -2369,15 +2331,15 @@ var canvas_MCDU_base = {
if (!getprop("/FMGC/internal/block-confirmed")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText("---.-");
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
me["Simple_L4"].setText("---.-/----");
me["Simple_C4"].hide();
me["Simple_L5"].setText("---.-");
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
me["Simple_L6"].setText("---.-");
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block));
me["Simple_R3S"].show();
me["Simple_R3"].show();
me["Simple_R3S"].setText("BLOCK");
@ -2385,10 +2347,10 @@ var canvas_MCDU_base = {
me["Simple_R3_Arrow"].show();
me["Simple_R3_Arrow"].setColor(AMBER);
me["Simple_C4B"].show();
if (num(tow.getValue()) >= 100.0) {
me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue()));
if (num(fmgc.FMGCInternal.tow) >= 100.0) {
me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow));
} else {
me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue()));
me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow));
}
me["Simple_R4"].setText("---.-");
me["Simple_R6"].setText("---.-/----");
@ -2400,37 +2362,37 @@ var canvas_MCDU_base = {
if (getprop("/FMGC/internal/fuel-calculating")) {
me["Simple_L2"].setText("---.-/----");
me["Simple_L3"].setText("---.-");
if (rte_rsv_set.getValue() == 1) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (rte_percent_set.getValue() == 1) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
if (fmgc.FMGCInternal.rteRsvSet) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (fmgc.FMGCInternal.rtePercentSet) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
me["Simple_L4"].setText("---.-/----");
me["Simple_C4"].hide();
me["Simple_L5"].setText("---.-");
if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
} else if (final_fuel_set.getValue() == 1) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
} else if (final_time_set.getValue() == 1) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else if (fmgc.FMGCInternal.finalFuelSet) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else if (fmgc.FMGCInternal.finalTimeSet) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
me["Simple_L6"].setText("---.-");
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block));
me["Simple_R3S"].hide();
me["Simple_R3"].hide();
me["Simple_R3_Arrow"].hide();
me["Simple_C4B"].show();
if (num(tow.getValue()) >= 100.0) {
me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue()));
if (num(fmgc.FMGCInternal.tow) >= 100.0) {
me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow));
} else {
me["Simple_C4B"].setText(sprintf(" %4.1f/", tow.getValue()));
me["Simple_C4B"].setText(sprintf(" %4.1f/", fmgc.FMGCInternal.tow));
}
me["Simple_R4"].setText("---.-");
me["Simple_R6"].setText("---.-/----");
@ -2438,54 +2400,54 @@ var canvas_MCDU_base = {
me.colorLeft("ack", "wht", "wht", "wht", "wht", "wht");
me.colorRight("ack", "blu", "ack", "wht", "ack", "wht");
} else {
me["Simple_L2"].setText(sprintf("%.1f/" ~ trip_time.getValue(), trip_fuel.getValue()));
me["Simple_L3"].setText(sprintf("%.1f", rte_rsv.getValue()));
if (rte_rsv_set.getValue() == 1) {
if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_rsv.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_percent.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_L2"].setText(sprintf("%.1f/" ~ fmgc.FMGCInternal.tripTime, fmgc.FMGCInternal.tripFuel));
me["Simple_L3"].setText(sprintf("%.1f", fmgc.FMGCInternal.rteRsv));
if (fmgc.FMGCInternal.rteRsvSet) {
if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
} else if (rte_percent_set.getValue() == 1) {
if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_rsv.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_percent.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (fmgc.FMGCInternal.rtePercentSet) {
if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
} else {
if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_rsv.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_percent.getValue()) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
}
if (fmgc.FMGCInternal.altAirportSet) {
me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue()));
me["Simple_L4"].setText(sprintf("%.1f", fmgc.FMGCInternal.altFuel));
me["Simple_L4"].setColor(BLUE);
me["Simple_C4"].show();
if (alt_fuel_set.getValue() == 1) {
if (num(alt_fuel.getValue()) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
if (fmgc.FMGCInternal.altFuelSet) {
if (num(fmgc.FMGCInternal.altFuel) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
} else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
}
} else {
if (num(alt_fuel.getValue()) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
if (num(fmgc.FMGCInternal.altFuel) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
} else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
}
}
} else {
@ -2493,42 +2455,42 @@ var canvas_MCDU_base = {
me["Simple_L4"].setColor(WHITE);
me["Simple_C4"].hide();
}
me["Simple_L5"].setText(sprintf("%.1f", final_fuel.getValue()));
if (final_time_set.getValue() == 1 and final_fuel_set.getValue() == 1) {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_L5"].setText(sprintf("%.1f", fmgc.FMGCInternal.finalFuel));
if (fmgc.FMGCInternal.finalTimeSet and fmgc.FMGCInternal.finalFuelSet) {
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
} else if (final_time_set.getValue() == 1) {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
} else if (fmgc.FMGCInternal.finalTimeSet) {
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
} else if (final_fuel_set.getValue() == 1) {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
} else if (fmgc.FMGCInternal.finalFuelSet) {
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
} else {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
}
me["Simple_L6"].setText(sprintf("%.1f", min_dest_fob.getValue()));
me["Simple_L6"].setText(sprintf("%.1f", fmgc.FMGCInternal.minDestFob));
me["Simple_R2"].show();
me["INITB_Block"].hide();
me["Simple_R2"].setText(sprintf("%3.1f", block.getValue()));
me["Simple_R2"].setText(sprintf("%3.1f", fmgc.FMGCInternal.block));
me["Simple_R3S"].hide();
me["Simple_R3"].hide();
me["Simple_R3_Arrow"].hide();
me["Simple_C4B"].hide();
me["Simple_R4"].setText(sprintf("%4.1f/", tow.getValue()) ~ sprintf("%4.1f", lw.getValue()));
me["Simple_R6"].setText(sprintf("%.1f/" ~ extra_time.getValue(), extra_fuel.getValue()));
me["Simple_R4"].setText(sprintf("%4.1f/", fmgc.FMGCInternal.tow) ~ sprintf("%4.1f", fmgc.FMGCInternal.lw));
me["Simple_R6"].setText(sprintf("%.1f/" ~ fmgc.FMGCInternal.extraTime, fmgc.FMGCInternal.extraFuel));
me.colorLeft("ack", "grn", "blu", "ack", "blu", "blu");
me.colorRight("ack", "blu", "ack", "grn", "ack", "grn");
@ -2538,21 +2500,21 @@ var canvas_MCDU_base = {
}
me["Simple_R1S"].setText("ZFW/ZFWCG");
me["Simple_R1"].setText(sprintf("%3.1f", zfwcg.getValue()));
me["Simple_R1"].setText(sprintf("%3.1f", fmgc.FMGCInternal.zfwcg));
me["INITB_ZFWCG"].hide();
me["INITB_ZFWCG_S"].show();
me["Simple_R1"].show();
if (zfwcgSet.getValue() == 1) {
if (fmgc.FMGCInternal.zfwcgSet) {
me["Simple_R1"].setFontSize(normal);
} else {
me["Simple_R1"].setFontSize(small);
}
if (zfwSet.getValue() == 1) {
if (zfw.getValue() < 100) {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
if (fmgc.FMGCInternal.zfwSet) {
if (fmgc.FMGCInternal.zfw < 100) {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw));
} else {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw));
}
me["Simple_C1"].show();
me["INITB_ZFW"].hide();
@ -2561,16 +2523,16 @@ var canvas_MCDU_base = {
me["INITB_ZFW"].show();
}
if (taxi_fuel_set.getValue() == 1) {
if (fmgc.FMGCInternal.taxiFuelSet) {
me["Simple_L1"].setFontSize(normal);
} else {
me["Simple_L1"].setFontSize(small);
}
if (rte_rsv_set.getValue() == 1) {
if (fmgc.FMGCInternal.rteRsvSet) {
me["Simple_L3"].setFontSize(normal);
me["Simple_C3"].setFontSize(small);
} else if (rte_percent_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.rtePercentSet) {
me["Simple_L3"].setFontSize(small);
me["Simple_C3"].setFontSize(normal);
} else {
@ -2578,19 +2540,19 @@ var canvas_MCDU_base = {
me["Simple_C3"].setFontSize(small);
}
if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) {
if (fmgc.FMGCInternal.altFuelSet and fmgc.FMGCInternal.crzSet) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) {
if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) {
me["Simple_L5"].setFontSize(normal);
me["Simple_C5"].setFontSize(normal);
} else if (final_fuel_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.finalFuelSet) {
me["Simple_L5"].setFontSize(normal);
me["Simple_C5"].setFontSize(small);
} else if (final_time_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.finalTimeSet) {
me["Simple_L5"].setFontSize(small);
me["Simple_C5"].setFontSize(normal);
} else {
@ -2598,7 +2560,7 @@ var canvas_MCDU_base = {
me["Simple_C5"].setFontSize(small);
}
if (min_dest_fob_set.getValue() == 1) {
if (fmgc.FMGCInternal.minDestFobSet) {
me["Simple_L6"].setFontSize(normal);
} else {
me["Simple_L6"].setFontSize(small);
@ -2694,20 +2656,20 @@ var canvas_MCDU_base = {
if (!getprop("/FMGC/internal/fuel-request-set") or !getprop("/FMGC/internal/block-confirmed") or getprop("/FMGC/internal/fuel-calculating")) {
me["Simple_L3"].setText("---.-");
if (rte_rsv_set.getValue() == 1) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (rte_percent_set.getValue() == 1) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
if (fmgc.FMGCInternal.rteRsvSet) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (fmgc.FMGCInternal.rtePercentSet) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
me["Simple_L4"].setText("---.-/----");
me["Simple_C4"].hide();
me["Simple_L5"].setText("---.-");
if (final_fuel_set.getValue() == 1 or final_time_set.getValue() == 1) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
if (fmgc.FMGCInternal.finalFuelSet or fmgc.FMGCInternal.finalTimeSet) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
me["Simple_L6"].setText("---.-");
@ -2718,53 +2680,53 @@ var canvas_MCDU_base = {
me.colorLeft("ack", "ack", "wht", "wht", "wht", "wht");
me.colorRight("ack", "ack", "ack", "wht", "wht", "wht");
} else {
me["Simple_L3"].setText(sprintf("%.1f", rte_rsv.getValue()));
if (rte_rsv_set.getValue() == 1) {
if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_rsv.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_percent.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_L3"].setText(sprintf("%.1f", fmgc.FMGCInternal.rteRsv));
if (fmgc.FMGCInternal.rteRsvSet) {
if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
} else if (rte_percent_set.getValue() == 1) {
if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_rsv.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_percent.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (fmgc.FMGCInternal.rtePercentSet) {
if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
} else {
if (num(rte_rsv.getValue()) > 9.9 and num(rte_percent.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_rsv.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
} else if (num(rte_percent.getValue()) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
if (num(fmgc.FMGCInternal.rteRsv) > 9.9 and num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rteRsv) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else if (num(fmgc.FMGCInternal.rtePercent) > 9.9) {
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
} else {
me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue()));
me["Simple_C3B"].setText(sprintf("/%.1f ", fmgc.FMGCInternal.rtePercent));
}
}
if (fmgc.FMGCInternal.altAirportSet) {
me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue()));
me["Simple_L4"].setText(sprintf("%.1f", fmgc.FMGCInternal.altFuel));
me["Simple_L4"].setColor(BLUE);
me["Simple_C4"].show();
if (alt_fuel_set.getValue() == 1) {
if (num(alt_fuel.getValue()) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
if (fmgc.FMGCInternal.altFuelSet) {
if (num(fmgc.FMGCInternal.altFuel) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
} else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
}
} else {
if (num(alt_fuel.getValue()) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
if (num(fmgc.FMGCInternal.altFuel) > 9.9) {
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
} else {
me["Simple_C4"].setText(sprintf("/%s ", alt_time.getValue()));
me["Simple_C4"].setText(sprintf("/%s ", fmgc.FMGCInternal.altTime));
}
}
} else {
@ -2772,61 +2734,61 @@ var canvas_MCDU_base = {
me["Simple_L4"].setColor(WHITE);
me["Simple_C4"].hide();
}
me["Simple_L5"].setText(sprintf("%.1f", final_fuel.getValue()));
if (final_time_set.getValue() == 1 and final_fuel_set.getValue() == 1) {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_L5"].setText(sprintf("%.1f", fmgc.FMGCInternal.finalFuel));
if (fmgc.FMGCInternal.finalTimeSet and fmgc.FMGCInternal.finalFuelSet) {
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
} else if (final_time_set.getValue() == 1) {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
} else if (fmgc.FMGCInternal.finalTimeSet) {
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
} else if (final_fuel_set.getValue() == 1) {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
} else if (fmgc.FMGCInternal.finalFuelSet) {
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
} else {
if (num(final_fuel.getValue()) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
if (num(fmgc.FMGCInternal.finalFuel) > 9.9) {
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
} else {
me["Simple_C5"].setText(sprintf("/%s ", final_time.getValue()));
me["Simple_C5"].setText(sprintf("/%s ", fmgc.FMGCInternal.finalTime));
}
}
me["Simple_L6"].setText(sprintf("%.1f", min_dest_fob.getValue()));
me["Simple_L6"].setText(sprintf("%.1f", fmgc.FMGCInternal.minDestFob));
setprop("/FMGC/internal/fob", num(getprop("/consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/fuel-pred-gw", num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000));
setprop("/FMGC/internal/cg", num(getprop("/FMGC/internal/zfwcg")));
me["Simple_R4"].setText(sprintf("%4.1f/" ~ fffq_sensor.getValue(), fob.getValue()));
me["Simple_R5"].setText(sprintf("%4.1f/", gw.getValue()) ~ sprintf("%4.1f", cg.getValue()));
me["Simple_R6"].setText(sprintf("%4.1f/" ~ extra_time.getValue(), extra_fuel.getValue()));
fmgc.FMGCInternal.fob = num(getprop("/consumables/fuel/total-fuel-lbs") / 1000);
fmgc.FMGCInternal.fuelPredGw = num(getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000);
fmgc.FMGCInternal.cg = num(getprop("/FMGC/internal/zfwcg"));
me["Simple_R4"].setText(sprintf("%4.1f/" ~ fmgc.FMGCInternal.fffqSensor, fmgc.FMGCInternal.fob));
me["Simple_R5"].setText(sprintf("%4.1f/", fmgc.FMGCInternal.fuelPredGw) ~ sprintf("%4.1f", fmgc.FMGCInternal.cg));
me["Simple_R6"].setText(sprintf("%4.1f/" ~ fmgc.FMGCInternal.extraTime, fmgc.FMGCInternal.extraFuel));
me.colorLeft("ack", "ack", "blu", "ack", "blu", "blu");
me.colorRight("ack", "ack", "blu", "grn", "grn", "grn");
}
me["Simple_R3S"].setText("ZFW/ZFWCG");
me["Simple_R3"].setText(sprintf("%3.1f", zfwcg.getValue()));
me["Simple_R3"].setText(sprintf("%3.1f", fmgc.FMGCInternal.zfwcg));
me["Simple_R3"].show();
me["FUELPRED_ZFWCG"].hide();
me["FUELPRED_ZFWCG_S"].show();
if (zfwcgSet.getValue() == 1) {
if (fmgc.FMGCInternal.zfwcgSet) {
me["Simple_R3"].setFontSize(normal);
} else {
me["Simple_R3"].setFontSize(small);
}
if (zfwSet.getValue() == 1) {
if (zfw.getValue() < 100) {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
if (fmgc.FMGCInternal.zfwSet) {
if (fmgc.FMGCInternal.zfw < 100) {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw));
} else {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", fmgc.FMGCInternal.zfw));
}
me["Simple_C3"].show();
me["FUELPRED_ZFW"].hide();
@ -2835,10 +2797,10 @@ var canvas_MCDU_base = {
me["FUELPRED_ZFW"].show();
}
if (rte_rsv_set.getValue() == 1) {
if (fmgc.FMGCInternal.rteRsvSet) {
me["Simple_L3"].setFontSize(normal);
me["Simple_C3B"].setFontSize(small);
} else if (rte_percent_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.rtePercentSet) {
me["Simple_L3"].setFontSize(small);
me["Simple_C3B"].setFontSize(normal);
} else {
@ -2846,19 +2808,19 @@ var canvas_MCDU_base = {
me["Simple_C3B"].setFontSize(small);
}
if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) {
if (fmgc.FMGCInternal.altFuelSet and fmgc.FMGCInternal.crzSet == 1) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) {
if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) {
me["Simple_L5"].setFontSize(normal);
me["Simple_C5"].setFontSize(normal);
} else if (final_fuel_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.finalFuelSet) {
me["Simple_L5"].setFontSize(normal);
me["Simple_C5"].setFontSize(small);
} else if (final_time_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.finalTimeSet) {
me["Simple_L5"].setFontSize(small);
me["Simple_C5"].setFontSize(normal);
} else {
@ -2866,7 +2828,7 @@ var canvas_MCDU_base = {
me["Simple_C5"].setFontSize(small);
}
if (min_dest_fob_set.getValue() == 1) {
if (fmgc.FMGCInternal.minDestFobSet) {
me["Simple_L6"].setFontSize(normal);
} else {
me["Simple_L6"].setFontSize(small);
@ -3179,7 +3141,7 @@ var canvas_MCDU_base = {
me["Simple_R5"].setFontSize(small);
}
if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) {
if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) {
me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_to")));
me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_to")));
me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_to")));
@ -3792,7 +3754,7 @@ var canvas_MCDU_base = {
me["Simple_R6"].setText("PHASE ");
me["Simple_L5S"].setText(" VAPP");
if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) {
if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) {
me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr")));
me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr")));
me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr")));
@ -3891,7 +3853,7 @@ var canvas_MCDU_base = {
me["Simple_R5"].setText(sprintf("%3.0f", engOutAcc.getValue()));
me["Simple_R5S"].setText("ENG OUT ACC");
if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) {
if ((fmgc.FMGCInternal.zfwSet and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) {
me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr")));
me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr")));
me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr")));

View file

@ -179,6 +179,47 @@ var FMGCInternal = {
tropo: 36090,
tropoSet: 0,
toFromSet: 0,
# INIT B
zfw: 0,
zfwSet: 0,
zfwcg: 25.0,
zfwcgSet: 0,
block: 0.0,
blockSet: 0,
taxiFuel: 0.4,
taxiFuelSet: 0,
tripFuel: 0,
tripTime: "0000",
rteRsv: 0,
rteRsvSet: 0,
rtePercent: 5.0,
rtePercentSet: 0,
altFuel: 0,
altFuelSet: 0,
altTime: "0000",
finalFuel: 0,
finalFuelSet: 0,
finalTime: "0030",
finalTimeSet: 0,
minDestFob: 0,
minDestFobSet: 0,
tow: 0,
lw: 0,
tripWind: "HD000",
tripWindValue: 0,
fffqSensor: "FF+FQ",
extraFuel: 0,
extraTime: "0000",
# FUELPRED
priUtc: "0000",
altUtc: "0000",
priEfob: 0,
altEfob: 0,
fob: 0,
fuelPredGw: 0,
cg: 0,
};
var postInit = func() {
@ -238,13 +279,13 @@ updateRouteManagerAlt = func() {
var updateFuel = func {
# Check engine status
if (num(getprop("/engines/engine[0]/n1-actual")) > 0 or num(getprop("/engines/engine[1]/n1-actual")) > 0) {
setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1));
}
# Calculate (final) holding fuel
if (getprop("/FMGC/internal/final-fuel-set")) {
final_fuel = 1000 * getprop("/FMGC/internal/final-fuel");
zfw = 1000 * getprop("/FMGC/internal/zfw");
if (FMGCInternal.finalFuelSet) {
final_fuel = 1000 * FMGCInternal.finalFuel;
zfw = 1000 * FMGCInternal.zfw;
final_time = final_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (final_time < 0) {
final_time = 0;
@ -254,35 +295,35 @@ var updateFuel = func {
if (num(final_time) >= 60) {
final_min = int(math.mod(final_time, 60));
final_hour = int((final_time - final_min) / 60);
setprop("/FMGC/internal/final-time", sprintf("%02d", final_hour) ~ sprintf("%02d", final_min));
FMGCInternal.finalTime = sprintf("%02d", final_hour) ~ sprintf("%02d", final_min);
} else {
setprop("/FMGC/internal/final-time", sprintf("%04d", final_time));
FMGCInternal.finalTime = sprintf("%04d", final_time);
}
} else {
if (!getprop("/FMGC/internal/final-time-set")) {
setprop("/FMGC/internal/final-time", "0030");
if (!FMGCInternal.finalTimeSet) {
FMGCInternal.finalTime = "0030";
}
final_time = int(getprop("/FMGC/internal/final-time"));
final_time = int(FMGCInternal.finalTime);
if (final_time >= 100) {
final_time = final_time - 100 + 60; # can't be set above 90 (0130)
}
zfw = 1000 * getprop("/FMGC/internal/zfw");
zfw = 1000 * FMGCInternal.zfw;
final_fuel = final_time * 2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903); # x2 for 2 engines
if (final_fuel < 0) {
final_fuel = 0;
} else if (final_fuel > 80000) {
final_fuel = 80000;
}
setprop("/FMGC/internal/final-fuel", final_fuel / 1000);
FMGCInternal.finalFuel = final_fuel / 1000;
}
# Calculate alternate fuel
if (!getprop("/FMGC/internal/alt-fuel-set") and fmgc.FMGCInternal.altAirportSet) {
if (!FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) {
#calc
} else if (getprop("/FMGC/internal/alt-fuel-set") and fmgc.FMGCInternal.altAirportSet) {
} else if (FMGCInternal.altFuelSet and FMGCInternal.altAirportSet) {
#dummy calc for now
alt_fuel = 1000 * num(getprop("/FMGC/internal/alt-fuel"));
zfw = 1000 * getprop("/FMGC/internal/zfw");
alt_fuel = 1000 * num(FMGCInternal.altFuel);
zfw = 1000 * FMGCInternal.zfw;
alt_time = alt_fuel / (2.0 * ((zfw*zfw*-2e-10) + (zfw*0.0003) + 2.8903)); # x2 for 2 engines
if (alt_time < 0) {
alt_time = 0;
@ -292,32 +333,32 @@ var updateFuel = func {
if (num(alt_time) >= 60) {
alt_min = int(math.mod(alt_time, 60));
alt_hour = int((alt_time - alt_min) / 60);
setprop("/FMGC/internal/alt-time", sprintf("%02d", alt_hour) ~ sprintf("%02d", alt_min));
FMGCInternal.altTime = sprintf("%02d", alt_hour) ~ sprintf("%02d", alt_min);
} else {
setprop("/FMGC/internal/alt-time", sprintf("%04d", alt_time));
FMGCInternal.altTime = sprintf("%04d", alt_time);
}
} else if (!getprop("/FMGC/internal/alt-fuel-set")) {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
} else if (!FMGCInternal.altFuelSet) {
FMGCInternal.altFuel = 0.0;
FMGCInternal.altTime = "0000";
}
# Calculate min dest fob (final + alternate)
if (!getprop("/FMGC/internal/min-dest-fob-set")) {
setprop("/FMGC/internal/min-dest-fob", num(getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel")));
if (!FMGCInternal.minDestFobSet) {
FMGCInternal.minDestFob = num(FMGCInternal.altFuel + FMGCInternal.finalFuel);
}
if (getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/lw", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel")));
if (FMGCInternal.zfwSet) {
FMGCInternal.lw = num(FMGCInternal.zfw + FMGCInternal.altFuel + FMGCInternal.finalFuel);
}
# Calculate trip fuel
if (FMGCInternal.toFromSet and FMGCInternal.crzSet and FMGCInternal.crzTempSet and getprop("/FMGC/internal/zfw-set")) {
if (FMGCInternal.toFromSet and FMGCInternal.crzSet and FMGCInternal.crzTempSet and FMGCInternal.zfwSet) {
crz = FMGCInternal.crzFl;
temp = FMGCInternal.crzTemp;
dist = flightPlanController.arrivalDist;
trpWind = getprop("/FMGC/internal/trip-wind");
wind_value = getprop("/FMGC/internal/trip-wind-value");
trpWind = FMGCInternal.tripWind;
wind_value = FMGCInternal.tripWindValue;
if (find("HD", trpWind) != -1 or find("-", trpWind) != -1 or find("H", trpWind) != -1) {
wind_value = wind_value * -1;
}
@ -349,54 +390,54 @@ var updateFuel = func {
# trip_fuel = trip_fuel * 1.02;
#}
zfw = getprop("/FMGC/internal/zfw");
zfw = FMGCInternal.zfw;
landing_weight_correction = 9.951e+00 + (dist*-2.064e+00) + (dist*dist*2.030e-03) + (dist*dist*dist*8.179e-08) + (dist*dist*dist*dist*-3.941e-11) + (dist*dist*dist*dist*dist*2.443e-15) + (crz*2.771e+00) + (dist*crz*3.067e-02) + (dist*dist*crz*-1.861e-05) + (dist*dist*dist*crz*2.516e-10) + (dist*dist*dist*dist*crz*5.452e-14) + (crz*crz*-4.483e-02) + (dist*crz*crz*-1.645e-04) + (dist*dist*crz*crz*5.212e-08) + (dist*dist*dist*crz*crz*-8.721e-13) + (crz*crz*crz*2.609e-04) + (dist*crz*crz*crz*3.898e-07) + (dist*dist*crz*crz*crz*-4.617e-11) + (crz*crz*crz*crz*-6.488e-07) + (dist*crz*crz*crz*crz*-3.390e-10) + (crz*crz*crz*crz*crz*5.835e-10);
trip_fuel = trip_fuel + (landing_weight_correction * (getprop("/FMGC/internal/lw") * 1000 - 121254.24421) / 2204.622622);
trip_fuel = trip_fuel + (landing_weight_correction * (FMGCInternal.lw * 1000 - 121254.24421) / 2204.622622);
if (trip_fuel < 400) {
trip_fuel = 400;
} else if (trip_fuel > 80000) {
trip_fuel = 80000;
}
setprop("/FMGC/internal/trip-fuel", trip_fuel / 1000);
FMGCInternal.tripFuel = trip_fuel / 1000;
if (num(trip_time) >= 60) {
trip_min = int(math.mod(trip_time, 60));
trip_hour = int((trip_time - trip_min) / 60);
setprop("/FMGC/internal/trip-time", sprintf("%02d", trip_hour) ~ sprintf("%02d", trip_min));
FMGCInternal.tripTime = sprintf("%02d", trip_hour) ~ sprintf("%02d", trip_min);
} else {
setprop("/FMGC/internal/trip-time", sprintf("%04d", trip_time));
FMGCInternal.tripTime = sprintf("%04d", trip_time);
}
} else {
setprop("/FMGC/internal/trip-fuel", 0.0);
setprop("/FMGC/internal/trip-time", "0000");
FMGCInternal.tripFuel = 0.0;
FMGCInternal.tripTime = "0000";
}
# Calculate reserve fuel
if (getprop("/FMGC/internal/rte-rsv-set")) {
if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) {
setprop("/FMGC/internal/rte-percent", 0.0);
if (FMGCInternal.rteRsvSet) {
if (num(FMGCInternal.tripFuel) == 0.0) {
FMGCInternal.rtePercent = 0.0;
} else {
if (num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0) <= 15.0) {
setprop("/FMGC/internal/rte-percent", num(getprop("/FMGC/internal/rte-rsv") / getprop("/FMGC/internal/trip-fuel") * 100.0));
if (num(FMGCInternal.rteRsv / FMGCInternal.tripFuel * 100.0) <= 15.0) {
FMGCInternal.rtePercent = num(FMGCInternal.rteRsv / FMGCInternal.tripFuel * 100.0);
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
FMGCInternal.rtePercent = 15.0; # need reasearch on this value
}
}
} else if (getprop("/FMGC/internal/rte-percent-set")) {
setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0));
} else if (FMGCInternal.rtePercentSet) {
FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0);
} else {
if (num(getprop("/FMGC/internal/trip-fuel")) == 0.0) {
setprop("/FMGC/internal/rte-percent", 5.0);
if (num(FMGCInternal.tripFuel) == 0.0) {
FMGCInternal.rtePercent = 5.0;
} else {
setprop("/FMGC/internal/rte-rsv", num(getprop("/FMGC/internal/trip-fuel") * getprop("/FMGC/internal/rte-percent") / 100.0));
FMGCInternal.rteRsv = num(FMGCInternal.tripFuel * FMGCInternal.rtePercent / 100.0);
}
}
# Calcualte extra fuel
if (getprop("/FMGC/internal/block-set")) {
extra_fuel = 1000 * num(getprop("/FMGC/internal/block") - getprop("/FMGC/internal/trip-fuel") - getprop("/FMGC/internal/min-dest-fob") - getprop("/FMGC/internal/taxi-fuel") - getprop("/FMGC/internal/rte-rsv"));
setprop("/FMGC/internal/extra-fuel", extra_fuel / 1000);
lw = 1000 * getprop("/FMGC/internal/lw");
if (FMGCInternal.blockSet) {
extra_fuel = 1000 * num(FMGCInternal.block - FMGCInternal.tripFuel - FMGCInternal.minDestFob - FMGCInternal.taxiFuel - FMGCInternal.rteRsv);
FMGCInternal.extraFuel = extra_fuel / 1000;
lw = 1000 * FMGCInternal.lw;
extra_time = extra_fuel / (2.0 * ((lw*lw*-2e-10) + (lw*0.0003) + 2.8903)); # x2 for 2 engines
if (extra_time < 0) {
extra_time = 0;
@ -406,19 +447,19 @@ var updateFuel = func {
if (num(extra_time) >= 60) {
extra_min = int(math.mod(extra_time, 60));
extra_hour = int((extra_time - extra_min) / 60);
setprop("/FMGC/internal/extra-time", sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min));
FMGCInternal.extraTime = sprintf("%02d", extra_hour) ~ sprintf("%02d", extra_min);
} else {
setprop("/FMGC/internal/extra-time", sprintf("%04d", extra_time));
FMGCInternal.extraTime = sprintf("%04d", extra_time);
}
if (getprop("/FMGC/internal/extra-fuel") > -0.1 and getprop("/FMGC/internal/extra-fuel") < 0.1) {
setprop("/FMGC/internal/extra-fuel", 0.0);
if (FMGCInternal.extraFuel > -0.1 and FMGCInternal.extraFuel < 0.1) {
FMGCInternal.extraFuel = 0.0;
}
} else {
setprop("/FMGC/internal/block", num(getprop("/FMGC/internal/alt-fuel") + getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/trip-fuel") + getprop("/FMGC/internal/rte-rsv") + getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/block-set", 1);
FMGCInternal.block = num(FMGCInternal.altFuel + FMGCInternal.finalFuel + FMGCInternal.tripFuel + FMGCInternal.rteRsv + FMGCInternal.taxiFuel);
FMGCInternal.blockSet = 1;
}
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
FMGCInternal.tow = num(FMGCInternal.zfw + FMGCInternal.block - FMGCInternal.taxiFuel);
}
############################

View file

@ -3,63 +3,38 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
# From INIT-B
var zfwcg = props.globals.getNode("FMGC/internal/zfwcg", 1);
var zfwcgSet = props.globals.getNode("FMGC/internal/zfwcg-set", 1);
var zfw = props.globals.getNode("FMGC/internal/zfw", 1);
var zfwSet = props.globals.getNode("FMGC/internal/zfw-set", 1);
var block = props.globals.getNode("FMGC/internal/block", 1);
var blockSet = props.globals.getNode("FMGC/internal/block-set", 1);
var taxi_fuel = props.globals.getNode("FMGC/internal/taxi-fuel", 1);
var trip_fuel = props.globals.getNode("FMGC/internal/trip-fuel", 1);
var trip_time = props.globals.getNode("FMGC/internal/trip-time", 1);
var rte_rsv = props.globals.getNode("FMGC/internal/rte-rsv", 1);
var rte_percent = props.globals.getNode("FMGC/internal/rte-percent", 1);
var alt_fuel = props.globals.getNode("FMGC/internal/alt-fuel", 1);
var alt_time = props.globals.getNode("FMGC/internal/alt-time", 1);
var final_fuel = props.globals.getNode("FMGC/internal/final-fuel", 1);
var final_time = props.globals.getNode("FMGC/internal/final-time", 1);
var min_dest_fob = props.globals.getNode("FMGC/internal/min-dest-fob", 1);
var tow = props.globals.getNode("FMGC/internal/tow", 1);
var lw = props.globals.getNode("FMGC/internal/lw", 1);
var trip_wind = props.globals.getNode("FMGC/internal/trip-wind", 1);
var trip_wind_value = props.globals.getNode("FMGC/internal/trip-wind", 1);
var fob = props.globals.getNode("FMGC/internal/fob", 1);
var fffq_sensor = props.globals.getNode("FMGC/internal/fffq-sensor", 1);
var extra_fuel = props.globals.getNode("FMGC/internal/extra-fuel", 1);
var extra_time = props.globals.getNode("FMGC/internal/extra-time", 1);
var fuelPredInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0);
fmgc.FMGCInternal.rteRsv = 0.05 * num(fmgc.FMGCInternal.tripFuel);
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = 5.0;
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (getprop("/FMGC/internal/trip-fuel") != 0) {
} else if (fmgc.FMGCInternal.tripFuel != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1);
fmgc.FMGCInternal.rteRsv = num(perc) / 100 * num(fmgc.FMGCInternal.tripFuel);
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = perc;
fmgc.FMGCInternal.rtePercentSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
fmgc.FMGCInternal.rteRsv = scratchpad;
fmgc.FMGCInternal.rteRsvSet = 1;
if (scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) {
fmgc.FMGCInternal.rtePercent = scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100;
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value
}
setprop("/FMGC/internal/rte-percent-set", 0);
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -70,18 +45,18 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0);
fmgc.FMGCInternal.altFuel = 0.0;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/alt-fuel", tf);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1);
fmgc.FMGCInternal.altFuel = tf;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -92,18 +67,18 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
fmgc.FMGCInternal.finalFuel = 0.0;
fmgc.FMGCInternal.finalTime = "0030";
fmgc.FMGCInternal.finalFuelSet = 0;
fmgc.FMGCInternal.finalTimeSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
fmgc.FMGCInternal.finalFuel = tf;
fmgc.FMGCInternal.finalFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -113,8 +88,8 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1);
fmgc.FMGCInternal.finalTime = scratchpad;
fmgc.FMGCInternal.finalTimeSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -123,20 +98,20 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
fmgc.FMGCInternal.minDestFob = 0;
fmgc.FMGCInternal.minDestFobSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) {
setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1);
fmgc.FMGCInternal.minDestFob = tf;
fmgc.FMGCInternal.minDestFobSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht");
if (num(fmgc.FMGCInternal.minDestFob) < num(fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel)) {
mcdu_message(i, "CHECK MIN DEST FOB");
}
} else {
mcdu_message(i, "NOT ALLOWED");
@ -152,11 +127,11 @@ var fuelPredInput = func(key, i) {
var zfw_max = 134.5; #61,000 kg, make based on performance
if (size(scratchpad) == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1));
fmgc.FMGCInternal.zfwSet = 1;
if (fmgc.FMGCInternal.blockSet != 1) {
fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000);
fmgc.FMGCInternal.blockSet = 1;
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -171,13 +146,13 @@ var fuelPredInput = func(key, i) {
var zfwcgs = size(zfwi[1]);
if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfw", zfw);
setprop("/FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
fmgc.FMGCInternal.zfw = zfw;
fmgc.FMGCInternal.zfwSet = 1;
fmgc.FMGCInternal.zfwcg = zfwcg;
fmgc.FMGCInternal.zfwcgSet = 1;
if (fmgc.FMGCInternal.blockSet != 1) {
fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000);
fmgc.FMGCInternal.blockSet = 1;
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -189,8 +164,8 @@ var fuelPredInput = func(key, i) {
}
} else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
fmgc.FMGCInternal.zfwcg = zfwcg;
fmgc.FMGCInternal.zfwcgSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
@ -200,11 +175,11 @@ var fuelPredInput = func(key, i) {
}
} else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) {
if (scratchpad >= zfw_min and scratchpad <= zfw_max) {
setprop("/FMGC/internal/zfw", scratchpad);
setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
fmgc.FMGCInternal.zfw = scratchpad;
fmgc.FMGCInternal.zfwSet = 1;
if (fmgc.FMGCInternal.blockSet != 1) {
fmgc.FMGCInternal.block = num(getprop("consumables/fuel/total-fuel-lbs") / 1000);
fmgc.FMGCInternal.blockSet = 1;
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -227,12 +202,12 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "R4") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
fmgc.FMGCInternal.fffqSensor = "FF+FQ";
mcdu_scratchpad.scratchpads[i].empty();
} else if (find("/", scratchpad) == 0) {
var sensor = substr(scratchpad, 1);
if (sensor == "FF+FQ" or sensor == "FQ+FF" or sensor == "FF" or sensor == "FQ") {
setprop("FMGC/internal/fffq-sensor", sensor);
fmgc.FMGCInternal.fffqSensor = sensor;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -6,8 +6,8 @@ var initInputB = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/taxi-fuel", 0.4);
setprop("/FMGC/internal/taxi-fuel-set", 0);
fmgc.FMGCInternal.taxiFuel = 0.4;
fmgc.FMGCInternal.taxiFuelSet = 0;
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
@ -18,8 +18,8 @@ var initInputB = func(key, i) {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 4) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) {
setprop("/FMGC/internal/taxi-fuel", scratchpad);
setprop("/FMGC/internal/taxi-fuel-set", 1);
fmgc.FMGCInternal.taxiFuel = scratchpad;
fmgc.FMGCInternal.taxiFuelSet = 1;
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
@ -31,38 +31,38 @@ var initInputB = func(key, i) {
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
}
}
} else if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0);
fmgc.FMGCInternal.rteRsv = 0.05 * num(fmgc.FMGCInternal.tripFuel);
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = 5.0;
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (getprop("/FMGC/internal/trip-fuel") != 0) {
} else if (fmgc.FMGCInternal.tripFuel != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1);
fmgc.FMGCInternal.rteRsv = num(perc) / 100 * num(fmgc.FMGCInternal.tripFuel);
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = perc;
fmgc.FMGCInternal.rtePercentSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
fmgc.FMGCInternal.rteRsv = scratchpad;
fmgc.FMGCInternal.rteRsvSet = 1;
if (scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100 <= 15.0) {
fmgc.FMGCInternal.rtePercent = scratchpad / num(fmgc.FMGCInternal.tripFuel) * 100;
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value
}
setprop("/FMGC/internal/rte-percent-set", 0);
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -73,18 +73,18 @@ var initInputB = func(key, i) {
}
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0);
fmgc.FMGCInternal.altFuel = 0.0;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/alt-fuel", tf);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1);
fmgc.FMGCInternal.altFuel = tf;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -95,18 +95,18 @@ var initInputB = func(key, i) {
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
fmgc.FMGCInternal.finalFuel = 0.0;
fmgc.FMGCInternal.finalTime = "0030";
fmgc.FMGCInternal.finalFuelSet = 0;
fmgc.FMGCInternal.finalTimeSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
fmgc.FMGCInternal.finalFuel = tf;
fmgc.FMGCInternal.finalFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -116,8 +116,8 @@ var initInputB = func(key, i) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1);
fmgc.FMGCInternal.finalTime = scratchpad;
fmgc.FMGCInternal.finalTimeSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -126,20 +126,20 @@ var initInputB = func(key, i) {
}
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
fmgc.FMGCInternal.minDestFob = 0;
fmgc.FMGCInternal.minDestFobSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) {
setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1);
fmgc.FMGCInternal.minDestFob = tf;
fmgc.FMGCInternal.minDestFobSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht");
if (num(fmgc.FMGCInternal.minDestFob) < num(fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel)) {
mcdu_message(i, "CHECK MIN DEST FOB");
}
} else {
mcdu_message(i, "NOT ALLOWED");
@ -155,11 +155,10 @@ var initInputB = func(key, i) {
var zfw_max = 134.5; #61,000 kg, make based on performance
if (size(scratchpad) == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1));
fmgc.FMGCInternal.zfwSet = 1;
if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) {
fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -178,13 +177,12 @@ var initInputB = func(key, i) {
var zfwcgs = size(zfwi[1]);
if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfw", zfw);
setprop("/FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
fmgc.FMGCInternal.zfw = zfw;
fmgc.FMGCInternal.zfwSet = 1;
fmgc.FMGCInternal.zfwcg = zfwcg;
fmgc.FMGCInternal.zfwcgSet = 1;
if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) {
fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -200,8 +198,8 @@ var initInputB = func(key, i) {
}
} else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
fmgc.FMGCInternal.zfwcg = zfwcg;
fmgc.FMGCInternal.zfwcgSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
@ -211,11 +209,10 @@ var initInputB = func(key, i) {
}
} else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) {
if (scratchpad >= zfw_min and scratchpad <= zfw_max) {
setprop("/FMGC/internal/zfw", scratchpad);
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
fmgc.FMGCInternal.zfw = scratchpad;
fmgc.FMGCInternal.zfwSet = 1;
if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) {
fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -242,32 +239,32 @@ var initInputB = func(key, i) {
}
} else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/block-set", 0);
setprop("/FMGC/internal/taxi-fuel", 0.4);
setprop("/FMGC/internal/taxi-fuel-set", 0);
setprop("/FMGC/internal/trip-fuel", 0);
setprop("/FMGC/internal/trip-time", "0000");
setprop("/FMGC/internal/rte-rsv", 0);
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/alt-fuel", 0);
setprop("/FMGC/internal/alt-fuel-set", 0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/final-fuel", 0);
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-time-set", 0);
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
setprop("/FMGC/internal/tow", 0);
setprop("/FMGC/internal/lw", 0);
setprop("/FMGC/internal/trip-wind", "HD000");
setprop("/FMGC/internal/trip-wind-value", 0);
setprop("/FMGC/internal/fffq-sensor", "FF+FQ");
setprop("/FMGC/internal/extra-fuel", 0);
setprop("/FMGC/internal/extra-time", "0000");
fmgc.FMGCInternal.block = 0.0;
fmgc.FMGCInternal.blockSet = 0;
fmgc.FMGCInternal.taxiFuel = 0.4;
fmgc.FMGCInternal.taxiFuelSet = 0;
fmgc.FMGCInternal.tripFuel = 0;
fmgc.FMGCInternal.tripTime = "0000";
fmgc.FMGCInternal.rteRsv = 0;
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = 5.0;
fmgc.FMGCInternal.rtePercentSet = 0;
fmgc.FMGCInternal.altFuel = 0;
fmgc.FMGCInternal.altFuelSet = 0;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.finalFuel = 0;
fmgc.FMGCInternal.finalFuelSet = 0;
fmgc.FMGCInternal.finalTime = "0030";
fmgc.FMGCInternal.finalTimeSet = 0;
fmgc.FMGCInternal.minDestFob = 0;
fmgc.FMGCInternal.minDestFobSet = 0;
fmgc.FMGCInternal.tow = 0;
fmgc.FMGCInternal.lw = 0;
fmgc.FMGCInternal.tripWind = "HD000";
fmgc.FMGCInternal.tripWindValue = 0;
fmgc.FMGCInternal.fffqSensor = "FF+FQ";
fmgc.FMGCInternal.extraFuel = 0;
fmgc.FMGCInternal.extraTime = "0000";
setprop("/FMGC/internal/fuel-request-set", 0);
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/block-calculating", 0);
@ -277,11 +274,10 @@ var initInputB = func(key, i) {
var tfs = size(scratchpad);
var maxblock = getprop("/options/maxblock");
if (tfs == 0) {
setprop("/FMGC/internal/block", sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1)));
setprop("/FMGC/internal/block-set", 1);
if (getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
fmgc.FMGCInternal.block = sprintf("%3.1f", math.round(getprop("/consumables/fuel/total-fuel-lbs") / 1000, 0.1));
fmgc.FMGCInternal.blockSet = 1;
if (fmgc.FMGCInternal.zfwSet) {
fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -289,11 +285,10 @@ var initInputB = func(key, i) {
}
} else if (tfs >= 1 and tfs <= 5) {
if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) {
setprop("/FMGC/internal/block", scratchpad);
setprop("/FMGC/internal/block-set", 1);
if (getprop("/FMGC/internal/zfw-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
fmgc.FMGCInternal.block = scratchpad;
fmgc.FMGCInternal.blockSet = 1;
if (fmgc.FMGCInternal.zfwSet) {
fmgc.FMGCInternal.tow = num(fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -308,10 +303,10 @@ var initInputB = func(key, i) {
}
}
} else if (key == "R3") {
if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and !getprop("/FMGC/internal/fuel-request-set")) {
if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and !getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/block-calculating", 1);
} else if (scratchpad == "" and getprop("/FMGC/internal/zfw-set") and getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) {
} else if (scratchpad == "" and fmgc.FMGCInternal.zfwSet and getprop("/FMGC/internal/fuel-request-set") and !getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/block-calculating")) {
setprop("/FMGC/internal/block-confirmed", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
} else {
@ -319,8 +314,8 @@ var initInputB = func(key, i) {
}
} else if (key == "R5" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/trip-wind", "HD000");
setprop("/FMGC/internal/trip-wind-value", 0);
fmgc.FMGCInternal.tripWind = "HD000";
fmgc.FMGCInternal.tripWindValue = 0;
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
@ -329,8 +324,8 @@ var initInputB = func(key, i) {
if (find("TL", scratchpad) != -1 or find("HD", scratchpad) != -1) {
var effwind = substr(scratchpad, 2);
if (int(effwind) != nil and effwind >= 0 and effwind <= 500) {
setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("/FMGC/internal/trip-wind-value", effwind);
fmgc.FMGCInternal.tripWind = scratchpad;
fmgc.FMGCInternal.tripWindValue = effwind;
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
@ -341,8 +336,8 @@ var initInputB = func(key, i) {
} else if (find("-", scratchpad) != -1 or find("+", scratchpad) != -1 or find("T", scratchpad) != -1 or find("H", scratchpad) != -1) {
var effwind = substr(scratchpad, 1);
if (int(effwind) != nil and effwind >= 0 and effwind <= 500) {
setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("/FMGC/internal/trip-wind-value", effwind);
fmgc.FMGCInternal.tripWind = scratchpad;
fmgc.FMGCInternal.tripWindValue = effwind;
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
@ -352,8 +347,8 @@ var initInputB = func(key, i) {
}
} else {
if (num(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 500) {
setprop("/FMGC/internal/trip-wind", scratchpad);
setprop("/FMGC/internal/trip-wind-value", scratchpad);
fmgc.FMGCInternal.tripWind = scratchpad;
fmgc.FMGCInternal.tripWindValue = scratchpad;
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}

View file

@ -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;