1
0
Fork 0

Big fuel bug fixes, minor ILS fix

This commit is contained in:
Matthew Maring 2020-04-16 17:00:49 -04:00 committed by Jonathan Redpath
parent 000da158b6
commit 8632050f40
3 changed files with 66 additions and 9 deletions

View file

@ -481,10 +481,10 @@ var masterFMGC = maketimer(0.2, func {
#print(r.stopway);
#print(r.threshold);
magnetic_hdg = geo.normdeg(r.heading - getprop("environment/magnetic-variation-deg"));
if (!getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (!getprop("FMGC/internal/ils1freq-set")) {
} else if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set")) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
} else if (!getprop("FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
@ -505,10 +505,10 @@ var masterFMGC = maketimer(0.2, func {
if (runways[rwy] != nil) {
var r = runways[rwy];
magnetic_hdg = geo.normdeg(r.heading - getprop("environment/magnetic-variation-deg"));
if (!getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
} else if (!getprop("FMGC/internal/ils1freq-set")) {
} else if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set")) {
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
} else if (!getprop("FMGC/internal/ils1crs-set")) {
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);

View file

@ -34,6 +34,12 @@ var fuelPredInput = func(key, i) {
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} else if (getprop("FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
@ -59,10 +65,16 @@ var fuelPredInput = func(key, i) {
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} 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 and scratchpad < trip_fuel.getValue()) {
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) {
setprop("FMGC/internal/alt-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -89,10 +101,16 @@ var fuelPredInput = func(key, i) {
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} 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 and scratchpad < trip_fuel.getValue()) {
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) {
setprop("FMGC/internal/final-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");

View file

@ -28,7 +28,8 @@ var initInputB = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
notAllowed(i);
setprop("FMGC/internal/taxi-fuel", 0.4);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs >= 1 and tfs <= 4) {
@ -78,6 +79,12 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} else if (getprop("FMGC/internal/trip-fuel") != 0) {
var tf = num(scratchpad);
var tfs = size(scratchpad);
@ -103,10 +110,16 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} 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 and scratchpad < trip_fuel.getValue()) {
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + alt_fuel.getValue()) {
setprop("FMGC/internal/alt-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -133,10 +146,16 @@ var initInputB = func(key, i) {
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue()));
setprop("FMGC/internal/rte-rsv", num((block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100)));
setprop("FMGC/internal/trip-fuel", num(block.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue()));
setprop("FMGC/internal/tow", num(block.getValue() + zfw.getValue() - taxi_fuel.getValue()));
setprop("FMGC/internal/lw", num(tow.getValue() - trip_fuel.getValue()));
} 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 and scratchpad < trip_fuel.getValue()) {
if (tfs >= 3 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 10.0 and tf < trip_fuel.getValue() + final_fuel.getValue()) {
setprop("FMGC/internal/final-fuel", tf);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
@ -202,6 +221,16 @@ var initInputB = func(key, i) {
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/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
@ -213,6 +242,16 @@ var initInputB = func(key, i) {
if (num(scratchpad) != nil and scratchpad >= 1.0 and scratchpad <= maxblock) {
setprop("FMGC/internal/block", scratchpad);
setprop("FMGC/internal/block-set", 1);
setprop("FMGC/internal/taxi-fuel", 0.4);
setprop("FMGC/internal/rte-rsv", 0.05 * num(trip_fuel.getValue()));
setprop("FMGC/internal/rte-percent", 5.0);
setprop("FMGC/internal/alt-fuel", 0.0);
setprop("FMGC/internal/alt-time", "0000");
setprop("FMGC/internal/final-fuel", 0.0);
setprop("FMGC/internal/final-time", "0030");
setprop("FMGC/internal/extra-fuel", 0.0);
setprop("FMGC/internal/extra-time", "0000");
setprop("FMGC/internal/min-dest-fob", 0.0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);