1
0
Fork 0

Merge branch 'dev' into simbrief-integration

This commit is contained in:
legoboyvdlp R 2020-08-03 17:59:48 +01:00
commit 5d73f217e1
9 changed files with 748 additions and 668 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);
@ -2287,7 +2249,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");
@ -2296,7 +2258,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);
@ -2304,21 +2266,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");
@ -2347,11 +2309,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("---.-");
@ -2373,15 +2335,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");
@ -2389,10 +2351,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("---.-/----");
@ -2404,37 +2366,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("---.-/----");
@ -2442,54 +2404,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 {
@ -2497,42 +2459,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");
@ -2542,21 +2504,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();
@ -2565,16 +2527,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 {
@ -2582,19 +2544,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 {
@ -2602,7 +2564,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);
@ -2698,20 +2660,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("---.-");
@ -2722,53 +2684,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 {
@ -2776,61 +2738,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();
@ -2839,10 +2801,10 @@ var canvas_MCDU_base = {
me["FUELPRED_ZFW"].show();
}
if (rte_rsv_set.getValue() == 1) {
if (fmgc.FMGCInternal.rteRsvSet) {
me["Simple_L3"].setFontSize(normal);
me["Simple_C3B"].setFontSize(small);
} else if (rte_percent_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.rtePercentSet) {
me["Simple_L3"].setFontSize(small);
me["Simple_C3B"].setFontSize(normal);
} else {
@ -2850,19 +2812,19 @@ var canvas_MCDU_base = {
me["Simple_C3B"].setFontSize(small);
}
if (alt_fuel_set.getValue() == 1 and fmgc.FMGCInternal.crzSet == 1) {
if (fmgc.FMGCInternal.altFuelSet and fmgc.FMGCInternal.crzSet == 1) {
me["Simple_L4"].setFontSize(normal);
} else {
me["Simple_L4"].setFontSize(small);
}
if (final_fuel_set.getValue() == 1 and final_time_set.getValue() == 1) {
if (fmgc.FMGCInternal.finalFuelSet and fmgc.FMGCInternal.finalTimeSet) {
me["Simple_L5"].setFontSize(normal);
me["Simple_C5"].setFontSize(normal);
} else if (final_fuel_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.finalFuelSet) {
me["Simple_L5"].setFontSize(normal);
me["Simple_C5"].setFontSize(small);
} else if (final_time_set.getValue() == 1) {
} else if (fmgc.FMGCInternal.finalTimeSet) {
me["Simple_L5"].setFontSize(small);
me["Simple_C5"].setFontSize(normal);
} else {
@ -2870,7 +2832,7 @@ var canvas_MCDU_base = {
me["Simple_C5"].setFontSize(small);
}
if (min_dest_fob_set.getValue() == 1) {
if (fmgc.FMGCInternal.minDestFobSet) {
me["Simple_L6"].setFontSize(normal);
} else {
me["Simple_L6"].setFontSize(small);
@ -3183,10 +3145,10 @@ var canvas_MCDU_base = {
me["Simple_R5"].setFontSize(small);
}
if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 1) {
me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_to")));
me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_to")));
me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_to")));
if ((fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet) or fmgc.FMGCInternal.phase == 1) {
me["Simple_C1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.flap2_to));
me["Simple_C2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.slat_to));
me["Simple_C3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.clean_to));
} else {
me["Simple_C1"].setText(" ---");
me["Simple_C2"].setText(" ---");
@ -3796,12 +3758,12 @@ var canvas_MCDU_base = {
me["Simple_R6"].setText("PHASE ");
me["Simple_L5S"].setText(" VAPP");
if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 5) {
me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr")));
me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr")));
me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr")));
me["Simple_C5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vls_appr")));
me["Simple_L5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vapp_appr")));
if ((fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet) or fmgc.FMGCInternal.phase == 5) {
me["Simple_C1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.flap2_appr));
me["Simple_C2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.slat_appr));
me["Simple_C3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.clean_appr));
me["Simple_C5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vls_appr));
me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr));
me.fontLeft(0, 0, 0, 0, default, 0);
if (vapp_speed_set.getValue()) {
me.fontSizeLeft(0, 0, 0, 0, normal, 0);
@ -3814,7 +3776,7 @@ var canvas_MCDU_base = {
me["Simple_C3"].setText(" ---");
me["Simple_C5"].setText(" ---");
if (vapp_speed_set.getValue()) {
me["Simple_L5"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/vapp_appr")));
me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr));
me.fontLeft(0, 0, 0, 0, default, 0);
me.fontSizeLeft(0, 0, 0, 0, normal, 0);
} else {
@ -3895,10 +3857,10 @@ var canvas_MCDU_base = {
me["Simple_R5"].setText(sprintf("%3.0f", engOutAcc.getValue()));
me["Simple_R5S"].setText("ENG OUT ACC");
if ((zfwSet.getValue() == 1 and blockSet.getValue() == 1) or fmgc.FMGCInternal.phase == 6) {
me["Simple_C1"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/flap2_appr")));
me["Simple_C2"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/slat_appr")));
me["Simple_C3"].setText(sprintf("%3.0f", getprop("/FMGC/internal/computed-speeds/clean_appr")));
if ((fmgc.FMGCInternal.zfwSet and fmgc.FMGCInternal.blockSet) or fmgc.FMGCInternal.phase == 6) {
me["Simple_C1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.flap2_appr));
me["Simple_C2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.slat_appr));
me["Simple_C3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.clean_appr));
} else {
me["Simple_C1"].setText(" ---");
me["Simple_C2"].setText(" ---");

View file

@ -73,7 +73,6 @@ var alt_diff = props.globals.getNode("/instrumentation/pfd/alt-diff", 1);
var ground_diff = props.globals.getNode("/instrumentation/pfd/ground-diff", 1);
var landing_diff = props.globals.getNode("/instrumentation/pfd/landing-diff", 1);
var ap_alt = props.globals.getNode("/it-autoflight/internal/alt", 1);
var alt_agl = props.globals.getNode("/position/altitude-agl-ft", 1);
var vs_needle = props.globals.getNode("/instrumentation/pfd/vs-needle", 1);
var vs_digit = props.globals.getNode("/instrumentation/pfd/vs-digit-trans", 1);
var ap_vs_pfd = props.globals.getNode("/it-autoflight/internal/vert-speed-fpm-pfd", 1);
@ -131,8 +130,6 @@ var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1
var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1);
# Create Nodes:
var vs_needle = props.globals.initNode("/instrumentation/pfd/vs-needle", 0.0, "DOUBLE");
var vs_needle_trans = props.globals.initNode("/instrumentation/pfd/vs-digit-trans", 0.0, "DOUBLE");
var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE");
var ground_diff = props.globals.initNode("/instrumentation/pfd/ground-diff", 0.0, "DOUBLE");
var landing_diff = props.globals.initNode("/instrumentation/pfd/landing-diff", 0.0, "DOUBLE");
@ -889,6 +886,19 @@ var canvas_PFD_base = {
me["VS_digit"].setText(sprintf("%02d", vs_pfd_cur));
}
var vs_itaf = fmgc.Internal.vs.getValue();
var gearAgl = gear_agl.getValue();
if (abs(vs_itaf) >= 6000 or (vs_itaf <= -2000 and gearAgl <= 2500) or (vs_itaf <= -1200 and gearAgl <= 1000)) {
me["VS_digit"].setColor(0.7333,0.3803,0);
me["VS_pointer"].setColor(0.7333,0.3803,0);
me["VS_pointer"].setColorFill(0.7333,0.3803,0);
} else {
me["VS_digit"].setColor(0.0509,0.7529,0.2941);
me["VS_pointer"].setColor(0.0509,0.7529,0.2941);
me["VS_pointer"].setColorFill(0.0509,0.7529,0.2941);
}
# ILS
me["LOC_pointer"].setTranslation(loc.getValue() * 197, 0);
me["GS_pointer"].setTranslation(0, gs.getValue() * -197);
@ -1197,7 +1207,7 @@ var canvas_PFD_1 = {
me["ASI_max"].setTranslation(0, me.ASImax * -6.6);
if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) {
me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min");
me.FMGC_vls = fmgc.FMGCInternal.vls_min;
if (me.FMGC_vls <= 30) {
me.VLSmin = 0 - me.ASI;
} else if (me.FMGC_vls >= 420) {
@ -1221,7 +1231,7 @@ var canvas_PFD_1 = {
} else {
me.ALPHAmax = me.FMGC_max - 30 - me.ASI;
}
me.FMGC_vsw = getprop("/FMGC/internal/computed-speeds/vsw");
me.FMGC_vsw = fmgc.FMGCInternal.vsw;
if (me.FMGC_vsw <= 30) {
me.ALPHAvsw = 0 - me.ASI;
} else if (me.FMGC_vsw >= 420) {
@ -1252,14 +1262,14 @@ var canvas_PFD_1 = {
if (managed_spd.getValue() == 1) {
if (getprop("/FMGC/internal/decel") == 1) {
if (getprop("/FMGC/internal/vapp-speed-set")) {
vapp = getprop("/FMGC/internal/computed-speeds/vapp_appr");
vapp = fmgc.FMGCInternal.vapp_appr;
} else {
vapp = getprop("/FMGC/internal/computed-speeds/vapp");
vapp = fmgc.FMGCInternal.vapp;
}
tgt_ias = vapp;
tgt_kts = vapp;
} else if (fmgc.FMGCInternal.phase == 6) {
clean = getprop("/FMGC/internal/computed-speeds/clean");
clean = fmgc.FMGCInternal.clean;
tgt_ias = clean;
tgt_kts = clean;
}
@ -1399,7 +1409,7 @@ var canvas_PFD_1 = {
me["F_target"].hide();
me["clean_speed"].hide();
tgt_S = getprop("/FMGC/internal/computed-speeds/slat");
tgt_S = fmgc.FMGCInternal.slat;
if (tgt_S <= 30) {
me.Strgt = 0 - me.ASI;
@ -1433,7 +1443,7 @@ var canvas_PFD_1 = {
me["S_target"].hide();
me["clean_speed"].hide();
tgt_F = getprop("/FMGC/internal/computed-speeds/flap2");
tgt_F = fmgc.FMGCInternal.flap2;
if (tgt_F <= 30) {
me.Ftrgt = 0 - me.ASI;
@ -1467,7 +1477,7 @@ var canvas_PFD_1 = {
me["S_target"].hide();
me["clean_speed"].hide();
tgt_F = getprop("/FMGC/internal/computed-speeds/flap3");
tgt_F = fmgc.FMGCInternal.flap3;
if (tgt_F <= 30) {
me.Ftrgt = 0 - me.ASI;
@ -1506,7 +1516,7 @@ var canvas_PFD_1 = {
me["S_target"].hide();
me["F_target"].hide();
tgt_clean = getprop("/FMGC/internal/computed-speeds/clean");
tgt_clean = fmgc.FMGCInternal.clean;
me.cleantrgt = tgt_clean - 30 - me.ASI;
me.SPDcleantrgtdiff = tgt_clean - ind_spd;
@ -1531,7 +1541,7 @@ var canvas_PFD_1 = {
}
}
if (alt_agl.getValue() < 400) {
if (gear_agl.getValue() < 400) {
me["S_target"].hide();
me["F_target"].hide();
}
@ -1935,7 +1945,7 @@ var canvas_PFD_2 = {
me["ASI_max"].setTranslation(0, me.ASImax * -6.6);
if (!fmgc.FMGCInternal.takeoffState and fmgc.FMGCInternal.phase >= 1 and !wow1.getValue() and !wow2.getValue()) {
me.FMGC_vls = getprop("/FMGC/internal/computed-speeds/vls_min");
me.FMGC_vls = fmgc.FMGCInternal.vls_min;
if (me.FMGC_vls <= 30) {
me.VLSmin = 0 - me.ASI;
} else if (me.FMGC_vls >= 420) {
@ -1959,7 +1969,7 @@ var canvas_PFD_2 = {
} else {
me.ALPHAmax = me.FMGC_max - 30 - me.ASI;
}
me.FMGC_vsw = getprop("/FMGC/internal/computed-speeds/vsw");
me.FMGC_vsw = fmgc.FMGCInternal.vsw;
if (me.FMGC_vsw <= 30) {
me.ALPHAvsw = 0 - me.ASI;
} else if (me.FMGC_vsw >= 420) {
@ -1990,14 +2000,14 @@ var canvas_PFD_2 = {
if (managed_spd.getValue() == 1) {
if (getprop("/FMGC/internal/decel") == 1) {
if (getprop("/FMGC/internal/vapp-speed-set")) {
vapp = getprop("/FMGC/internal/computed-speeds/vapp_appr");
vapp = fmgc.FMGCInternal.vapp_appr;
} else {
vapp = getprop("/FMGC/internal/computed-speeds/vapp");
vapp = fmgc.FMGCInternal.vapp;
}
tgt_ias = vapp;
tgt_kts = vapp;
} else if (fmgc.FMGCInternal.phase == 6) {
clean = getprop("/FMGC/internal/computed-speeds/clean");
clean = fmgc.FMGCInternal.clean;
tgt_ias = clean;
tgt_kts = clean;
}
@ -2138,7 +2148,7 @@ var canvas_PFD_2 = {
me["F_target"].hide();
me["clean_speed"].hide();
tgt_S = tgt_S = getprop("/FMGC/internal/computed-speeds/slat");
tgt_S = tgt_S = fmgc.FMGCInternal.slat;
if (tgt_S <= 30) {
me.Strgt = 0 - me.ASI;
@ -2172,7 +2182,7 @@ var canvas_PFD_2 = {
me["S_target"].hide();
me["clean_speed"].hide();
tgt_F = tgt_S = getprop("/FMGC/internal/computed-speeds/flap2");
tgt_F = tgt_S = fmgc.FMGCInternal.flap2;
if (tgt_F <= 30) {
me.Ftrgt = 0 - me.ASI;
@ -2206,7 +2216,7 @@ var canvas_PFD_2 = {
me["S_target"].hide();
me["clean_speed"].hide();
tgt_F = tgt_S = getprop("/FMGC/internal/computed-speeds/flap3");
tgt_F = tgt_S = fmgc.FMGCInternal.flap3;
if (tgt_F <= 30) {
me.Ftrgt = 0 - me.ASI;
@ -2245,7 +2255,7 @@ var canvas_PFD_2 = {
me["S_target"].hide();
me["F_target"].hide();
tgt_clean = tgt_S = getprop("/FMGC/internal/computed-speeds/clean");
tgt_clean = tgt_S = fmgc.FMGCInternal.clean;
me.cleantrgt = tgt_clean - 30 - me.ASI;
me.SPDcleantrgtdiff = tgt_clean - ind_spd;
@ -2270,7 +2280,7 @@ var canvas_PFD_2 = {
}
}
if (alt_agl.getValue() < 400) {
if (gear_agl.getValue() < 400) {
me["S_target"].hide();
me["F_target"].hide();
}

View file

@ -109,10 +109,10 @@ setprop("/FMGC/internal/adf1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/adf2-mcdu", "999.99/XXX");
var FMGCinit = func {
fmgc.FMGCInternal.takeoffState = 0;
fmgc.FMGCInternal.minspeed = 0;
fmgc.FMGCInternal.maxspeed = 338;
fmgc.FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
FMGCInternal.takeoffState = 0;
FMGCInternal.minspeed = 0;
FMGCInternal.maxspeed = 338;
FMGCInternal.phase = 0; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
setprop("/FMGC/internal/mng-spd", 157);
setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("/FMGC/internal/mng-kts-mach", 0);
@ -140,6 +140,36 @@ var FMGCInternal = {
alpha_prot: 0,
alpha_max: 0,
vmo_mmo: 0,
vsw: 0,
vls_min: 0,
clean: 0,
vs1g_clean: 0,
vs1g_conf_1: 0,
vs1g_conf_1f: 0,
vs1g_conf_2: 0,
vs1g_conf_3: 0,
vs1g_conf_full: 0,
slat: 0,
flap2: 0,
flap3: 0,
vls: 0,
vapp: 0,
clean_to: 0,
vs1g_clean_to: 0,
vs1g_conf_2_to: 0,
vs1g_conf_3_to: 0,
vs1g_conf_full_to: 0,
slat_to: 0,
flap2_to: 0,
clean_appr: 0,
vs1g_clean_appr: 0,
vs1g_conf_2_appr: 0,
vs1g_conf_3_appr: 0,
vs1g_conf_full_appr: 0,
slat_appr: 0,
flap2_appr: 0,
vls_appr: 0,
vapp_appr: 0,
# PERF
transAlt: 18000,
@ -179,6 +209,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() {
@ -206,7 +277,7 @@ setlistener("/gear/gear[0]/wow", func {
var trimReset = func {
flaps = getprop("/controls/flight/flaps-pos");
if (pts.Gear.wow[0].getBoolValue() and !fmgc.FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) {
if (pts.Gear.wow[0].getBoolValue() and !FMGCInternal.takeoffState and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) {
interpolate("/controls/flight/elevator-trim", 0.0, 1.5);
}
}
@ -216,9 +287,9 @@ var trimReset = func {
###############
var updateARPT = func {
setprop("autopilot/route-manager/departure/airport", fmgc.FMGCInternal.depApt);
setprop("autopilot/route-manager/destination/airport", fmgc.FMGCInternal.arrApt);
setprop("autopilot/route-manager/alternate/airport", fmgc.FMGCInternal.altAirport);
setprop("autopilot/route-manager/departure/airport", FMGCInternal.depApt);
setprop("autopilot/route-manager/destination/airport", FMGCInternal.arrApt);
setprop("autopilot/route-manager/alternate/airport", FMGCInternal.altAirport);
if (getprop("/autopilot/route-manager/active") != 1) {
fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
}
@ -260,13 +331,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;
@ -276,35 +347,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;
@ -314,32 +385,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;
}
@ -371,54 +442,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;
@ -428,19 +499,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);
}
############################
@ -547,7 +618,7 @@ var masterFMGC = maketimer(0.2, func {
# cruiseft = FMGCInternal.crzFt;
# cruiseft_b = FMGCInternal.crzFt - 200;
newcruise = getprop("/it-autoflight/internal/alt");
phase = fmgc.FMGCInternal.phase;
phase = FMGCInternal.phase;
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
wowl = getprop("/gear/gear[1]/wow");
@ -624,11 +695,11 @@ var masterFMGC = maketimer(0.2, func {
}
if (getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") != 1024) {
fmgc.FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4;
FMGCInternal.maxspeed = getprop("/systems/navigation/adr/computation/overspeed-vfe-spd") - 4;
} elsif (pts.Gear.position[0].getValue() != 0 or pts.Gear.position[1].getValue() != 0 or pts.Gear.position[2].getValue() != 0) {
fmgc.FMGCInternal.maxspeed = 284;
FMGCInternal.maxspeed = 284;
} else {
fmgc.FMGCInternal.maxspeed = getprop("/it-fbw/speeds/vmo-mmo");
FMGCInternal.maxspeed = getprop("/it-fbw/speeds/vmo-mmo");
}
############################
@ -636,111 +707,102 @@ var masterFMGC = maketimer(0.2, func {
############################
flap = getprop("/controls/flight/flaps-pos");
weight_lbs = getprop("/fdm/jsbsim/inertia/weight-lbs") / 1000;
tow = getprop("/FMGC/internal/tow") or 0;
lw = getprop("/FMGC/internal/lw") or 0;
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
# current speeds
clean = 2 * weight_lbs * 0.45359237 + 85;
FMGCInternal.clean = 2 * weight_lbs * 0.45359237 + 85;
if (altitude > 20000) {
clean += (altitude - 20000) / 1000;
FMGCInternal.clean += (altitude - 20000) / 1000;
}
setprop("/FMGC/internal/computed-speeds/clean", clean);
setprop("/FMGC/internal/computed-speeds/vs1g_clean", 0.0024 * weight_lbs * weight_lbs + 0.124 * weight_lbs + 88.942);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_1", -0.0007 * weight_lbs * weight_lbs + 0.6795 * weight_lbs + 44.673);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_1f", -0.0001 * weight_lbs * weight_lbs + 0.5211 * weight_lbs + 49.027);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2", -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 44.279);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3", -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 43.279);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full", -0.0007 * weight_lbs * weight_lbs + 0.6002 * weight_lbs + 38.479);
setprop("/FMGC/internal/computed-speeds/slat", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.23);
setprop("/FMGC/internal/computed-speeds/flap2", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")) * 1.47);
setprop("/FMGC/internal/computed-speeds/flap3", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.36);
FMGCInternal.vs1g_clean = 0.0024 * weight_lbs * weight_lbs + 0.124 * weight_lbs + 88.942;
FMGCInternal.vs1g_conf_1 = -0.0007 * weight_lbs * weight_lbs + 0.6795 * weight_lbs + 44.673;
FMGCInternal.vs1g_conf_1f = -0.0001 * weight_lbs * weight_lbs + 0.5211 * weight_lbs + 49.027;
FMGCInternal.vs1g_conf_2 = -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 44.279;
FMGCInternal.vs1g_conf_3 = -0.0005 * weight_lbs * weight_lbs + 0.5488 * weight_lbs + 43.279;
FMGCInternal.vs1g_conf_full = -0.0007 * weight_lbs * weight_lbs + 0.6002 * weight_lbs + 38.479;
FMGCInternal.slat = FMGCInternal.vs1g_clean * 1.23;
FMGCInternal.flap2 = FMGCInternal.vs1g_conf_2 * 1.47;
FMGCInternal.flap3 = FMGCInternal.vs1g_conf_3 * 1.36;
if (getprop("/FMGC/internal/ldg-config-3-set")) {
vls = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.23;
FMGCInternal.vls = FMGCInternal.vs1g_conf_3 * 1.23;
} else {
vls = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")) * 1.23
FMGCInternal.vls = FMGCInternal.vs1g_conf_full * 1.23
}
if (vls < 113) {
vls = 113;
if (FMGCInternal.vls < 113) {
FMGCInternal.vls = 113;
}
setprop("/FMGC/internal/computed-speeds/vls", vls);
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (fmgc.FMGCInternal.destWind < 5) {
vapp = vls + 5;
} else if (fmgc.FMGCInternal.destWind > 15) {
vapp = vls + 15;
if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp = FMGCInternal.vls + 5;
} else if (FMGCInternal.destWind > 15) {
FMGCInternal.vapp = FMGCInternal.vls + 15;
} else {
vapp = vls + fmgc.FMGCInternal.destWind;
FMGCInternal.vapp = FMGCInternal.vls + FMGCInternal.destWind;
}
setprop("/FMGC/internal/computed-speeds/vapp", vapp);
}
# predicted takeoff speeds
if (FMGCInternal.phase == 1) {
setprop("/FMGC/internal/computed-speeds/clean_to", getprop("/FMGC/internal/computed-speeds/clean"));
setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", getprop("/FMGC/internal/computed-speeds/vs1g_clean"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_to", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full"));
setprop("/FMGC/internal/computed-speeds/slat_to", getprop("/FMGC/internal/computed-speeds/slat"));
setprop("/FMGC/internal/computed-speeds/flap2_to", getprop("/FMGC/internal/computed-speeds/flap2"));
FMGCInternal.clean_to = FMGCInternal.clean;
FMGCInternal.vs1g_clean_to = FMGCInternal.vs1g_clean;
FMGCInternal.vs1g_conf_2_to = FMGCInternal.vs1g_conf_2;
FMGCInternal.vs1g_conf_3_to = FMGCInternal.vs1g_conf_3;
FMGCInternal.vs1g_conf_full_to = FMGCInternal.vs1g_conf_full;
FMGCInternal.slat_to = FMGCInternal.slat;
FMGCInternal.flap2_to = FMGCInternal.flap2;
} else {
clean_to = 2 * tow * 0.45359237 + 85;
FMGCInternal.clean_to = 2 * FMGCInternal.tow * 0.45359237 + 85;
if (altitude > 20000) {
clean_to += (altitude - 20000) / 1000;
FMGCInternal.clean_to += (altitude - 20000) / 1000;
}
setprop("/FMGC/internal/computed-speeds/clean_to", clean_to);
setprop("/FMGC/internal/computed-speeds/vs1g_clean_to", 0.0024 * tow * tow + 0.124 * tow + 88.942);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to", -0.0005 * tow * tow + 0.5488 * tow + 44.279);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_to", -0.0005 * tow * tow + 0.5488 * tow + 43.279);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_to", -0.0007 * tow * tow + 0.6002 * tow + 38.479);
setprop("/FMGC/internal/computed-speeds/slat_to", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean_to")) * 1.23);
setprop("/FMGC/internal/computed-speeds/flap2_to", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2_to")) * 1.47);
FMGCInternal.vs1g_clean_to = 0.0024 * FMGCInternal.tow * FMGCInternal.tow + 0.124 * FMGCInternal.tow + 88.942;
FMGCInternal.vs1g_conf_2_to = -0.0005 * FMGCInternal.tow * FMGCInternal.tow + 0.5488 * FMGCInternal.tow + 44.279;
FMGCInternal.vs1g_conf_3_to = -0.0005 * FMGCInternal.tow * FMGCInternal.tow + 0.5488 * FMGCInternal.tow + 43.279;
FMGCInternal.vs1g_conf_full_to = -0.0007 * FMGCInternal.tow * FMGCInternal.tow + 0.6002 * FMGCInternal.tow + 38.479;
FMGCInternal.slat_to = FMGCInternal.vs1g_clean_to * 1.23;
FMGCInternal.flap2_to = FMGCInternal.vs1g_conf_2_to * 1.47;
}
# predicted approach (temp go-around) speeds
if (FMGCInternal.phase == 5 or FMGCInternal.phase == 6) {
setprop("/FMGC/internal/computed-speeds/clean_appr", getprop("/FMGC/internal/computed-speeds/clean"));
setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", getprop("/FMGC/internal/computed-speeds/vs1g_clean"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full"));
setprop("/FMGC/internal/computed-speeds/slat_appr", getprop("/FMGC/internal/computed-speeds/slat"));
setprop("/FMGC/internal/computed-speeds/flap2_appr", getprop("/FMGC/internal/computed-speeds/flap2"));
setprop("/FMGC/internal/computed-speeds/vls_appr", getprop("/FMGC/internal/computed-speeds/vls"));
FMGCInternal.clean_appr = FMGCInternal.clean;
FMGCInternal.vs1g_clean_appr = FMGCInternal.vs1g_clean;
FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2;
FMGCInternal.vs1g_conf_3_appr = FMGCInternal.vs1g_conf_3;
FMGCInternal.vs1g_conf_full_appr = FMGCInternal.vs1g_conf_full;
FMGCInternal.slat_appr = FMGCInternal.slat;
FMGCInternal.flap2_appr = FMGCInternal.flap2;
FMGCInternal.vls_appr = FMGCInternal.vls;
if (!getprop("/FMGC/internal/vapp-speed-set")) {
setprop("/FMGC/internal/computed-speeds/vapp_appr", getprop("/FMGC/internal/computed-speeds/vapp"));
FMGCInternal.vapp_appr = FMGCInternal.vapp;
}
} else {
clean_appr = 2 * lw * 0.45359237 + 85;
FMGCInternal.clean_appr = 2 * FMGCInternal.lw * 0.45359237 + 85;
if (altitude > 20000) {
clean_appr += (altitude - 20000) / 1000;
FMGCInternal.clean_appr += (altitude - 20000) / 1000;
}
setprop("/FMGC/internal/computed-speeds/clean_appr", clean_appr);
setprop("/FMGC/internal/computed-speeds/vs1g_clean_appr", 0.0024 * lw * lw + 0.124 * lw + 88.942);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", -0.0005 * lw * lw + 0.5488 * lw + 44.279);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", -0.0005 * lw * lw + 0.5488 * lw + 43.279);
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", -0.0007 * lw * lw + 0.6002 * lw + 38.479);
setprop("/FMGC/internal/computed-speeds/slat_appr", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean_appr")) * 1.23);
setprop("/FMGC/internal/computed-speeds/flap2_appr", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr")) * 1.47);
FMGCInternal.vs1g_clean_appr = 0.0024 * FMGCInternal.lw * FMGCInternal.lw + 0.124 * FMGCInternal.lw + 88.942;
FMGCInternal.vs1g_conf_2_appr = -0.0005 * FMGCInternal.lw * FMGCInternal.lw + 0.5488 * FMGCInternal.lw + 44.279;
FMGCInternal.vs1g_conf_3_appr = -0.0005 * FMGCInternal.lw * FMGCInternal.lw + 0.5488 * FMGCInternal.lw + 43.279;
FMGCInternal.vs1g_conf_full_appr = -0.0007 * FMGCInternal.lw * FMGCInternal.lw + 0.6002 * FMGCInternal.lw + 38.479;
FMGCInternal.slat_appr = FMGCInternal.vs1g_clean_appr * 1.23;
FMGCInternal.flap2_appr = FMGCInternal.vs1g_conf_2_appr * 1.47;
if (getprop("/FMGC/internal/ldg-config-3-set")) {
vls_appr = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr")) * 1.23;
FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_3_appr * 1.23;
} else {
vls_appr = num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr")) * 1.23
FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_full_appr * 1.23
}
if (vls_appr < 113) {
vls_appr = 113;
if (FMGCInternal.vls_appr < 113) {
FMGCInternal.vls_appr = 113;
}
setprop("/FMGC/internal/computed-speeds/vls_appr", vls_appr);
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (fmgc.FMGCInternal.destWind < 5) {
vapp_appr = vls_appr + 5;
} else if (fmgc.FMGCInternal.destWind > 15) {
vapp_appr = vls_appr + 15;
if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5;
} else if (FMGCInternal.destWind > 15) {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 15;
} else {
vapp_appr = vls_appr + fmgc.FMGCInternal.destWind;
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + FMGCInternal.destWind;
}
setprop("/FMGC/internal/computed-speeds/vapp_appr", vapp_appr);
}
}
@ -752,83 +814,83 @@ var masterFMGC = maketimer(0.2, func {
aoa = getprop("/systems/navigation/adr/output/aoa-1");
cas = getprop("/systems/navigation/adr/output/cas-1");
if (aoa > -5) {
fmgc.FMGCInternal.alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0));
fmgc.FMGCInternal.alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0));
FMGCInternal.alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0));
FMGCInternal.alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0));
} else {
fmgc.FMGCInternal.alpha_prot = 0;
fmgc.FMGCInternal.alpha_max = 0;
FMGCInternal.alpha_prot = 0;
FMGCInternal.alpha_max = 0;
}
setprop("/FMGC/internal/computed-speeds/vs1g_conf_2_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_3_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3"));
setprop("/FMGC/internal/computed-speeds/vs1g_conf_full_appr", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full"));
#FMGCInternal.vs1g_conf_2_appr = FMGCInternal.vs1g_conf_2;
#FMGCInternal.vs1g_conf_3_appr = FMGCInternal.vs1g_conf_3;
#FMGCInternal.vs1g_conf_full_appr = FMGCInternal.vs1g_conf_full;
if (flap == 0) { # 0
setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_clean"));
fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/clean");
FMGCInternal.vsw = FMGCInternal.vs1g_clean;
FMGCInternal.minspeed = FMGCInternal.clean;
if (fmgc.FMGCInternal.takeoffState) {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.28);
if (FMGCInternal.takeoffState) {
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.28;
} else {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.23);
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.23;
}
} else if (flap == 1) { # 1
setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2"));
fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/slat");
FMGCInternal.vsw = FMGCInternal.vs1g_conf_2;
FMGCInternal.minspeed = FMGCInternal.slat;
if (fmgc.FMGCInternal.takeoffState) {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.28);
if (FMGCInternal.takeoffState) {
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1 * 1.28;
} else {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1")) * 1.23);
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1 * 1.23;
}
} else if (flap == 2) { # 1+F
setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f"));
fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/slat");
FMGCInternal.vsw = FMGCInternal.vs1g_conf_1f;
FMGCInternal.minspeed = FMGCInternal.slat;
if (fmgc.FMGCInternal.takeoffState) {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13);
if (FMGCInternal.takeoffState) {
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13;
} else {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_1f")) * 1.23);
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_1f * 1.23;
}
} else if (flap == 3) { # 2
setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_2"));
fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/flap2");
FMGCInternal.vsw = FMGCInternal.vs1g_conf_2;
FMGCInternal.minspeed = FMGCInternal.flap2;
if (fmgc.FMGCInternal.takeoffState) {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13);
if (FMGCInternal.takeoffState) {
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13;
} else {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_2")) * 1.23);
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_2 * 1.23;
}
} else if (flap == 4) { # 3
setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_3"));
fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/flap3");
FMGCInternal.vsw = FMGCInternal.vs1g_conf_3;
FMGCInternal.minspeed = FMGCInternal.flap3;
if (fmgc.FMGCInternal.takeoffState) {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13);
if (FMGCInternal.takeoffState) {
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13;
} else {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_3")) * 1.23);
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_3 * 1.23;
}
} else if (flap == 5) { # FULL
setprop("/FMGC/internal/computed-speeds/vsw", getprop("/FMGC/internal/computed-speeds/vs1g_conf_full"));
fmgc.FMGCInternal.minspeed = getprop("/FMGC/internal/computed-speeds/vapp");
FMGCInternal.vsw = FMGCInternal.vs1g_conf_full;
FMGCInternal.minspeed = FMGCInternal.vapp;
if (fmgc.FMGCInternal.takeoffState) {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_clean")) * 1.13);
if (FMGCInternal.takeoffState) {
FMGCInternal.vls_min = FMGCInternal.vs1g_clean * 1.13;
} else {
setprop("/FMGC/internal/computed-speeds/vls_min", num(getprop("/FMGC/internal/computed-speeds/vs1g_conf_full")) * 1.23);
FMGCInternal.vls_min = FMGCInternal.vs1g_conf_full * 1.23;
}
}
if (gear0 and flaps < 5 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA")) {
if (!fmgc.FMGCInternal.takeoffState) {
if (!FMGCInternal.takeoffState) {
fmgc.FMGCNodes.toState.setValue(1);
}
fmgc.FMGCInternal.takeoffState = 1;
FMGCInternal.takeoffState = 1;
} elsif (pts.Position.gearAglFt.getValue() >= 55) {
if (fmgc.FMGCInternal.takeoffState) {
if (FMGCInternal.takeoffState) {
fmgc.FMGCNodes.toState.setValue(0);
}
fmgc.FMGCInternal.takeoffState = 0;
FMGCInternal.takeoffState = 0;
}
############################
@ -838,7 +900,7 @@ var masterFMGC = maketimer(0.2, func {
departure_rwy = fmgc.flightPlanController.flightplans[2].departure_runway;
destination_rwy = fmgc.flightPlanController.flightplans[2].destination_runway;
if (destination_rwy != nil and phase >= 2) {
var airport = airportinfo(fmgc.FMGCInternal.arrApt);
var airport = airportinfo(FMGCInternal.arrApt);
setprop("/FMGC/internal/ldg-elev", airport.elevation * M2FT); # eventually should be runway elevation
magnetic_hdg = geo.normdeg(destination_rwy.heading - getprop("/environment/magnetic-variation-deg"));
runway_ils = destination_rwy.ils_frequency_mhz;
@ -869,7 +931,7 @@ var masterFMGC = maketimer(0.2, func {
});
var reset_FMGC = func {
fmgc.FMGCInternal.phase = 0;
FMGCInternal.phase = 0;
fd1 = getprop("/it-autoflight/input/fd1");
fd2 = getprop("/it-autoflight/input/fd2");
spd = getprop("/it-autoflight/input/kts");
@ -920,7 +982,7 @@ var reset_FMGC = func {
#################
var ManagedSPD = maketimer(0.25, func {
if (FMGCInternal.crzSet and FMGCInternal.costIndex) {
if (FMGCInternal.crzSet and FMGCInternal.costIndexSet) {
if (getprop("/it-autoflight/input/spd-managed") == 1) {
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
mode = getprop("/modes/pfd/fma/pitch-mode");
@ -933,7 +995,7 @@ var ManagedSPD = maketimer(0.25, func {
kts_sel = getprop("/it-autoflight/input/kts");
mach_sel = getprop("/it-autoflight/input/mach");
srsSPD = getprop("/it-autoflight/settings/togaspd");
phase = fmgc.FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
phase = FMGCInternal.phase; # 0 is Preflight 1 is Takeoff 2 is Climb 3 is Cruise 4 is Descent 5 is Decel/Approach 6 is Go Around 7 is Done
flap = getprop("/controls/flight/flaps-pos");
mach_switchover = getprop("/FMGC/internal/mach-switchover");
decel = getprop("/FMGC/internal/decel");
@ -965,8 +1027,8 @@ var ManagedSPD = maketimer(0.25, func {
}
if (mng_spd_cmd != 250 and !decel) {
setprop("/FMGC/internal/mng-spd-cmd", 250);
} else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) {
setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed);
} else if (mng_spd_cmd != FMGCInternal.minspeed and decel) {
setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed);
}
} else if ((FMGCInternal.phase == 2 or FMGCInternal.phase == 3) and altitude > 10070 and !mach_switchover) {
if (mngktsmach) {
@ -1002,8 +1064,8 @@ var ManagedSPD = maketimer(0.25, func {
}
if (mng_spd_cmd != mng_alt_spd and !decel) {
setprop("/FMGC/internal/mng-spd-cmd", mng_alt_spd);
} else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) {
setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed);
} else if (mng_spd_cmd != FMGCInternal.minspeed and decel) {
setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed);
}
} else if ((FMGCInternal.phase == 4 or FMGCInternal.phase == 5 or FMGCInternal.phase == 6) and altitude <= 10980) {
if (mngktsmach) {
@ -1011,15 +1073,15 @@ var ManagedSPD = maketimer(0.25, func {
}
if (mng_spd_cmd != 250 and !decel) {
setprop("/FMGC/internal/mng-spd-cmd", 250);
} else if (mng_spd_cmd != fmgc.FMGCInternal.minspeed and decel) {
setprop("/FMGC/internal/mng-spd-cmd", fmgc.FMGCInternal.minspeed);
} else if (mng_spd_cmd != FMGCInternal.minspeed and decel) {
setprop("/FMGC/internal/mng-spd-cmd", FMGCInternal.minspeed);
}
}
mng_spd_cmd = getprop("/FMGC/internal/mng-spd-cmd");
if (mng_spd_cmd > fmgc.FMGCInternal.maxspeed - 5) {
setprop("/FMGC/internal/mng-spd", fmgc.FMGCInternal.maxspeed - 5);
if (mng_spd_cmd > FMGCInternal.maxspeed - 5) {
setprop("/FMGC/internal/mng-spd", FMGCInternal.maxspeed - 5);
} else {
setprop("/FMGC/internal/mng-spd", mng_spd_cmd);
}
@ -1137,7 +1199,7 @@ setlistener("/FMGC/internal/fuel-calculating", func() {
# Maketimers
var timer30secLanding = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) {
fmgc.FMGCInternal.phase = 7;
FMGCInternal.phase = 7;
if (FMGCInternal.costIndexSet) {
setprop("/FMGC/internal/last-cost-index", FMGCInternal.costIndex);
} else {

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 * fmgc.FMGCInternal.tripFuel;
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = 5.0;
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (getprop("/FMGC/internal/trip-fuel") != 0) {
} else if (fmgc.FMGCInternal.tripFuel != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1);
fmgc.FMGCInternal.rteRsv = perc / 100 * fmgc.FMGCInternal.tripFuel;
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = perc;
fmgc.FMGCInternal.rtePercentSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
fmgc.FMGCInternal.rteRsv = scratchpad;
fmgc.FMGCInternal.rteRsvSet = 1;
if (scratchpad / fmgc.FMGCInternal.tripFuel * 100 <= 15.0) {
fmgc.FMGCInternal.rtePercent = scratchpad / fmgc.FMGCInternal.tripFuel * 100;
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value
}
setprop("/FMGC/internal/rte-percent-set", 0);
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -70,18 +45,18 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0);
fmgc.FMGCInternal.altFuel = 0.0;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/alt-fuel", tf);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1);
fmgc.FMGCInternal.altFuel = tf;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -92,18 +67,18 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
fmgc.FMGCInternal.finalFuel = 0.0;
fmgc.FMGCInternal.finalTime = "0030";
fmgc.FMGCInternal.finalFuelSet = 0;
fmgc.FMGCInternal.finalTimeSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
fmgc.FMGCInternal.finalFuel = tf;
fmgc.FMGCInternal.finalFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -113,8 +88,8 @@ var fuelPredInput = func(key, i) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1);
fmgc.FMGCInternal.finalTime = scratchpad;
fmgc.FMGCInternal.finalTimeSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -123,20 +98,20 @@ var fuelPredInput = func(key, i) {
}
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
fmgc.FMGCInternal.minDestFob = 0;
fmgc.FMGCInternal.minDestFobSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) {
setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1);
fmgc.FMGCInternal.minDestFob = tf;
fmgc.FMGCInternal.minDestFobSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht");
if (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) {
mcdu_message(i, "CHECK MIN DEST FOB");
}
} else {
mcdu_message(i, "NOT ALLOWED");
@ -152,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 = 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 = 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 = 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 * fmgc.FMGCInternal.tripFuel;
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = 5.0;
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (getprop("/FMGC/internal/trip-fuel") != 0) {
} else if (fmgc.FMGCInternal.tripFuel != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 2 and tfs <= 5 and find("/", scratchpad) == 0) {
var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1);
fmgc.FMGCInternal.rteRsv = perc / 100 * fmgc.FMGCInternal.tripFuel;
fmgc.FMGCInternal.rteRsvSet = 0;
fmgc.FMGCInternal.rtePercent = perc;
fmgc.FMGCInternal.rtePercentSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
}
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
fmgc.FMGCInternal.rteRsv = scratchpad;
fmgc.FMGCInternal.rteRsvSet = 1;
if (scratchpad / fmgc.FMGCInternal.tripFuel * 100 <= 15.0) {
fmgc.FMGCInternal.rtePercent = scratchpad / fmgc.FMGCInternal.tripFuel * 100;
} else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
fmgc.FMGCInternal.rtePercent = 15.0; # need reasearch on this value
}
setprop("/FMGC/internal/rte-percent-set", 0);
fmgc.FMGCInternal.rtePercentSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -73,18 +73,18 @@ var initInputB = func(key, i) {
}
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 0);
fmgc.FMGCInternal.altFuel = 0.0;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/alt-fuel", tf);
setprop("/FMGC/internal/alt-time", "0000");
setprop("/FMGC/internal/alt-fuel-set", 1);
fmgc.FMGCInternal.altFuel = tf;
fmgc.FMGCInternal.altTime = "0000";
fmgc.FMGCInternal.altFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -95,18 +95,18 @@ var initInputB = func(key, i) {
}
} else if (key == "L5" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/final-fuel", 0.0);
setprop("/FMGC/internal/final-time", "0030");
setprop("/FMGC/internal/final-fuel-set", 0);
setprop("/FMGC/internal/final-time-set", 0);
fmgc.FMGCInternal.finalFuel = 0.0;
fmgc.FMGCInternal.finalTime = "0030";
fmgc.FMGCInternal.finalFuelSet = 0;
fmgc.FMGCInternal.finalTimeSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0) {
setprop("/FMGC/internal/final-fuel", tf);
setprop("/FMGC/internal/final-fuel-set", 1);
fmgc.FMGCInternal.finalFuel = tf;
fmgc.FMGCInternal.finalFuelSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -116,8 +116,8 @@ var initInputB = func(key, i) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs == 4 and tf != nil and ((tf >= 0 and tf <= 59) or (tf >= 100 and tf <= 130))) {
setprop("/FMGC/internal/final-time", scratchpad);
setprop("/FMGC/internal/final-time-set", 1);
fmgc.FMGCInternal.finalTime = scratchpad;
fmgc.FMGCInternal.finalTimeSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
@ -126,20 +126,20 @@ var initInputB = func(key, i) {
}
} else if (key == "L6" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/min-dest-fob", 0);
setprop("/FMGC/internal/min-dest-fob-set", 0);
fmgc.FMGCInternal.minDestFob = 0;
fmgc.FMGCInternal.minDestFobSet = 0;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else if (find(".", scratchpad) != -1) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 5 and tf != nil and tf >= 0 and tf <= 80.0) {
setprop("/FMGC/internal/min-dest-fob", tf);
setprop("/FMGC/internal/min-dest-fob-set", 1);
fmgc.FMGCInternal.minDestFob = tf;
fmgc.FMGCInternal.minDestFobSet = 1;
setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/min-dest-fob")) < num(getprop("/FMGC/internal/final-fuel") + getprop("/FMGC/internal/alt-fuel"))) {
genericMessage(i, "CHECK MIN DEST FOB", "wht");
if (fmgc.FMGCInternal.minDestFob < fmgc.FMGCInternal.finalFuel + fmgc.FMGCInternal.altFuel) {
mcdu_message(i, "CHECK MIN DEST FOB");
}
} else {
mcdu_message(i, "NOT ALLOWED");
@ -155,11 +155,10 @@ var initInputB = func(key, i) {
var zfw_max = 134.5; #61,000 kg, make based on performance
if (size(scratchpad) == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
fmgc.FMGCInternal.zfw = sprintf("%3.1f", math.round(zfw / 1000, 0.1));
fmgc.FMGCInternal.zfwSet = 1;
if (!getprop("/FMGC/internal/block-confirmed") and fmgc.FMGCInternal.blockSet) {
fmgc.FMGCInternal.tow = fmgc.FMGCInternal.zfw + fmgc.FMGCInternal.block - fmgc.FMGCInternal.taxiFuel;
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
@ -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 = 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 = 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;
@ -1070,7 +1069,7 @@ var pagebutton = func(btn, i) {
setprop("/MCDU[" ~ i ~ "]/page", "DATA");
} else if (btn == "mcdu") {
var page = getprop("/MCDU[" ~ i ~ "]/page");
if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") {
if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") {
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page"));
} else {
setprop("/MCDU[" ~ i ~ "]/last-atsu-page", getprop("/MCDU[" ~ i ~ "]/page"));

View file

@ -0,0 +1,48 @@
# A3XX CPDLC
# Jonathan Redpath
# Copyright (c) 2020 Josh Davidson (Octal450)
var DictionaryItem = {
new: func(item, string) {
var DI = {parents: [DictionaryItem]};
DI.item = item;
DI.string = string;
return DI;
},
};
var Dictionary = {
database: std.Vector.new(),
addToDatabase: func(dictItem) {
me.database.append(dictItem);
},
fetchString: func(string) {
foreach (var item; me.database.vector) {
if (me.item.string == string) {
return item;
}
}
},
fetchItem: func(itemObj) {
foreach (var item; me.database.vector) {
if (item.item == itemObj) {
return item;
}
}
},
};
makeNewDictionaryItem = func(item, string) {
var dictItem = DictionaryItem.new(item, string);
Dictionary.addToDatabase(dictItem);
};
var CPDLCmessage = {
new: func(text) {
var cpdlcMessage = {parents: [CPDLCmessage] };
cpdlcMessage.text = text;
return cpdlcMessage;
},
};
makeNewDictionaryItem(CPDLCmessage.new("CONNECT"), "CONNECT");

View file

@ -21,6 +21,9 @@ It is highly reccomended to purchase a NAVIGRAPH subscription and download their
To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml.
## Installation
If you have issues installing, please check INSTALL.MD!
## External tools
Some external tools you might want to checkout and use with this Model.
NOTE: These are external tools so make sure to check their terms of use

View file

@ -542,6 +542,32 @@
</test>
</switch>
<switch name="rubbish/pipes-unusable-volume-1">
<default value="0"/>
<test logic="AND" value="1.5">
/systems/acconfig/autoconfig-running eq 0
/systems/fuel/valves/engine-1-lp-valve eq 0
</test>
<output>propulsion/tank[5]/unusable-volume-gal</output>
</switch>
<switch name="rubbish/pipes-unusable-volume-2">
<default value="0"/>
<test logic="AND" value="1.5">
/systems/acconfig/autoconfig-running eq 0
/systems/fuel/valves/engine-2-lp-valve eq 0
</test>
<output>propulsion/tank[6]/unusable-volume-gal</output>
</switch>
<switch name="rubbish/pipes-unusable-volume-apu">
<default value="0"/>
<test logic="AND" value="1.5">
/systems/acconfig/autoconfig-running eq 0
/systems/fuel/valves/apu-lp-valve eq 0
</test>
<output>propulsion/tank[7]/unusable-volume-gal</output>
</switch>
<!-- Feed system -->
<switch name="/systems/fuel/internal/apu-source"> <!-- this only when all pumps off -->
@ -773,7 +799,7 @@
<summer name="/systems/fuel/internal/eng-1-flow-rate">
<input>/systems/fuel/internal/left-wing-tank-eng-1</input>
<input>/systems/fuel/internal/right-wing-tank-eng-1</input>
<input>/systems/fuel/internal/center-tank-eng-2</input>
<input>/systems/fuel/internal/center-tank-eng-1</input>
<output>propulsion/tank[5]/external-flow-rate-pps</output>
</summer>