From 56095591b3206a27b4573e3a9d7abb45606d21a2 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 11 Apr 2020 07:01:37 -0400 Subject: [PATCH] Fix bug in fuel systems --- Models/Instruments/MCDU/MCDU.nas | 6 +++--- Nasal/MCDU/FUELPRED.nas | 20 ++++++++++---------- Nasal/MCDU/MCDU.nas | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 7be680ab..85da64b2 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -1213,9 +1213,9 @@ var canvas_MCDU_base = { me["Simple_R6S"].setText("EXTRA/TIME"); if (blockSet.getValue() == 1 and zfwSet.getValue() == 1) { - setprop("FMGC/internal/rte-rsv", num((fob.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); - setprop("FMGC/internal/trip-fuel", num(fob.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); - setprop("FMGC/internal/tow", num(fob.getValue() + zfw.getValue() - taxi_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())); me["Simple_L3"].setText(sprintf("%4.1f/", rte_rsv.getValue()) ~ sprintf("%4.1f", rte_percent.getValue())); diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 27089971..6637a0d0 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -4,7 +4,7 @@ # From INIT-B var zfw = props.globals.getNode("FMGC/internal/zfw", 1); -var fob = props.globals.getNode("FMGC/internal/fob", 1); +var block = props.globals.getNode("FMGC/internal/block", 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); @@ -59,9 +59,9 @@ var fuelPredInput = func(key, i) { setprop("FMGC/internal/alt-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); - setprop("FMGC/internal/rte-rsv", num((fob.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); - setprop("FMGC/internal/trip-fuel", num(fob.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); - setprop("FMGC/internal/tow", num(fob.getValue() + zfw.getValue() - taxi_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 { @@ -81,9 +81,9 @@ var fuelPredInput = func(key, i) { setprop("FMGC/internal/final-fuel", scratchpad); setprop("MCDU[" ~ i ~ "]/scratchpad", ""); setprop("FMGC/internal/min-dest-fob", num(alt_fuel.getValue() + final_fuel.getValue())); - setprop("FMGC/internal/rte-rsv", num((fob.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue()) * (rte_percent.getValue() / 100) / (1 + rte_percent.getValue() / 100))); - setprop("FMGC/internal/trip-fuel", num(fob.getValue() - taxi_fuel.getValue() - min_dest_fob.getValue() - rte_rsv.getValue())); - setprop("FMGC/internal/tow", num(fob.getValue() + zfw.getValue() - taxi_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 { notAllowed(i); @@ -110,7 +110,7 @@ var fuelPredInput = func(key, i) { setprop("FMGC/internal/zfwcg", zfwcg); setprop("FMGC/internal/zfwcg-set", 1); if (getprop("FMGC/internal/block-set") != 1) { - setprop("FMGC/internal/block", 30); + setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/block-set", 1); } } @@ -118,7 +118,7 @@ var fuelPredInput = func(key, i) { setprop("FMGC/internal/zfw", zfw); setprop("FMGC/internal/zfw-set", 1); if (getprop("FMGC/internal/block-set") != 1) { - setprop("FMGC/internal/block", 30); + setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/block-set", 1); } } @@ -133,7 +133,7 @@ var fuelPredInput = func(key, i) { setprop("FMGC/internal/zfwcg", scratchpad); setprop("FMGC/internal/zfwcg-set", 1); if (getprop("FMGC/internal/block-set") != 1) { - setprop("FMGC/internal/block", 30); + setprop("FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("FMGC/internal/block-set", 1); } setprop("MCDU[" ~ i ~ "]/scratchpad", ""); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 6b6718d4..a6f976a4 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -78,7 +78,7 @@ var MCDU_reset = func(i) { setprop("FMGC/internal/zfw-set", 0); setprop("FMGC/internal/zfwcg", 55.1); setprop("FMGC/internal/zfwcg-set", 0); - setprop("FMGC/internal/block", 0); + setprop("FMGC/internal/block", 0.0); setprop("FMGC/internal/block-set", 0); setprop("FMGC/internal/taxi-fuel", 0.4); setprop("FMGC/internal/trip-fuel", 0);