fix galley fix

This commit is contained in:
Jonathan Redpath 2017-05-09 13:27:28 +01:00
parent d55243f688
commit 750a76a193

View file

@ -45,6 +45,7 @@ var elec_init = func {
setprop("/systems/electrical/extra/ext-hz", 0); setprop("/systems/electrical/extra/ext-hz", 0);
setprop("/systems/electrical/extra/apu-hz", 0); setprop("/systems/electrical/extra/apu-hz", 0);
setprop("/systems/electrical/extra/galleyshed", 0); setprop("/systems/electrical/extra/galleyshed", 0);
setprop("/systems/electrical/gen-apu", 0);
setprop("systems/electrical/on", 0); setprop("systems/electrical/on", 0);
setprop("/controls/electrical/xtie/xtieL", 0); setprop("/controls/electrical/xtie/xtieL", 0);
setprop("/controls/electrical/xtie/xtieR", 0); setprop("/controls/electrical/xtie/xtieR", 0);
@ -93,6 +94,7 @@ var master_elec = func {
var gen2_sw = getprop("/controls/electrical/switches/gen2"); var gen2_sw = getprop("/controls/electrical/switches/gen2");
var gen_apu_sw = getprop("/controls/electrical/switches/gen-apu"); var gen_apu_sw = getprop("/controls/electrical/switches/gen-apu");
var gen_ext_sw = getprop("/controls/electrical/switches/gen-ext"); var gen_ext_sw = getprop("/controls/electrical/switches/gen-ext");
var gen_apu = getprop("/systems/electrical/gen-apu");
var apu_ext_crosstie_sw = getprop("/controls/electrical/switches/apu-ext-crosstie"); var apu_ext_crosstie_sw = getprop("/controls/electrical/switches/apu-ext-crosstie");
var ac_ess_feed_sw = getprop("/controls/electrical/switches/ac-ess-feed"); var ac_ess_feed_sw = getprop("/controls/electrical/switches/ac-ess-feed");
var battery1_sw = getprop("/controls/electrical/switches/battery1"); var battery1_sw = getprop("/controls/electrical/switches/battery1");
@ -146,7 +148,7 @@ var master_elec = func {
setprop("/systems/electrical/bus/dc1", dc_volt_std); setprop("/systems/electrical/bus/dc1", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std); setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc1-amps", dc_amps_std); setprop("/systems/electrical/bus/dc1-amps", dc_amps_std);
} else if (rpmapu >= 94.9 and gen_apu_sw) { } else if (gen_apu) {
setprop("/systems/electrical/bus/ac1", ac_volt_std); setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std); setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/apu-volts", ac_volt_std); setprop("/systems/electrical/extra/apu-volts", ac_volt_std);
@ -195,7 +197,7 @@ var master_elec = func {
setprop("/systems/electrical/bus/dc2", dc_volt_std); setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std); setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std); setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (rpmapu >= 94.9 and gen_apu_sw) { } else if (gen_apu) {
setprop("/systems/electrical/bus/ac2", ac_volt_std); setprop("/systems/electrical/bus/ac2", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std); setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/apu-volts", ac_volt_std); setprop("/systems/electrical/extra/apu-volts", ac_volt_std);
@ -246,12 +248,19 @@ var master_elec = func {
} }
# Galley Shedding Logic # Galley Shedding Logic
if (!gen_apu_sw and !gen_ext_sw and (!gen1_sw or !gen2_sw)) { # this is when one of the generators is not working or turned off as it reads 0 V if (!gen_apu and !gen_ext_sw and (!gen1_sw or !gen2_sw)) { # this is when one of the generators is not working or turned off as it reads 0 V
setprop("/systems/electrical/extra/galleyshed", 1); setprop("/systems/electrical/extra/galleyshed", 1);
} else { } else {
setprop("/systems/electrical/extra/galleyshed", 0); setprop("/systems/electrical/extra/galleyshed", 0);
} }
# APU Generator: Make it only come online when the apu is running. This is needed to make galley shed work properly.
if (rpmapu >= 94.9 and gen_apu_sw) {
setprop("/systems/electrical/gen-apu", 1);
} else {
setprop("/systems/electrical/gen-apu", 0);
}
# Battery Amps # Battery Amps
if (battery1_sw) { if (battery1_sw) {
setprop("/systems/electrical/battery1-amps", dc_amps_std); setprop("/systems/electrical/battery1-amps", dc_amps_std);