1
0
Fork 0

Add simple alternate time calc (no automatic calc until SEC FPLN implemented)

This commit is contained in:
Matthew Maring 2020-05-13 18:26:08 -04:00
parent 681dca2b7f
commit a84ce9b4e9

View file

@ -223,6 +223,21 @@ var updateFuel = func {
# Calculate alternate fuel # Calculate alternate fuel
if (!getprop("/FMGC/internal/alt-fuel-set") and getprop("/FMGC/internal/alt-set")) { if (!getprop("/FMGC/internal/alt-fuel-set") and getprop("/FMGC/internal/alt-set")) {
#calc #calc
} else if (getprop("/FMGC/internal/alt-fuel-set") and getprop("/FMGC/internal/alt-set")) {
#dummy calc for now
alt_fuel = 1000 * num(getprop("/FMGC/internal/alt-fuel"));
zfw = 1000 * getprop("/FMGC/internal/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;
}
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));
} else {
setprop("/FMGC/internal/alt-time", sprintf("%04d", alt_time));
}
} else if (!getprop("/FMGC/internal/alt-fuel-set")) { } else if (!getprop("/FMGC/internal/alt-fuel-set")) {
setprop("/FMGC/internal/alt-fuel", 0.0); setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000"); setprop("/FMGC/internal/alt-time", "0000");