A3XX: Fix electrical doesn't recover from power loss in air #73

This commit is contained in:
Joshua Davidson 2017-11-12 10:59:09 -05:00
parent 3354c40a93
commit a04fd36db0
5 changed files with 34 additions and 7 deletions

View file

@ -345,8 +345,12 @@
<value>2</value>
</not-equals>
<not-equals>
<property>controls/electrical/switches/emer-gen</property>
<value>1</value>
<property>systems/electrical/ac1-src</property>
<value>RAT</value>
</not-equals>
<not-equals>
<property>systems/electrical/ac2-src</property>
<value>RAT</value>
</not-equals>
<greater-than>
<property>controls/lighting/DU/du2</property>
@ -392,8 +396,12 @@
<value>2</value>
</not-equals>
<not-equals>
<property>controls/electrical/switches/emer-gen</property>
<value>1</value>
<property>systems/electrical/ac1-src</property>
<value>RAT</value>
</not-equals>
<not-equals>
<property>systems/electrical/ac2-src</property>
<value>RAT</value>
</not-equals>
<greater-than>
<property>controls/lighting/DU/du5</property>

View file

@ -83,7 +83,7 @@ var canvas_lowerECAM_base = {
return [];
},
update: func() {
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/controls/electrical/switches/emer-gen") != 1 and getprop("/controls/lighting/DU/du4") > 0) {
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/controls/lighting/DU/du4") > 0) {
page = getprop("/ECAM/Lower/page");
if (page == "apu") {
lowerECAM_apu.page.show();

View file

@ -97,7 +97,7 @@ var canvas_PFD_base = {
return [];
},
update: func() {
if ((getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) and getprop("/controls/electrical/switches/emer-gen") != 1 and getprop("/options/test-canvas") == 1 and getprop("/controls/lighting/DU/du1") > 0) {
if ((getprop("/systems/electrical/bus/ac1") >= 110 or getprop("/systems/electrical/bus/ac2") >= 110) and getprop("/options/test-canvas") == 1 and getprop("/controls/lighting/DU/du1") > 0) {
PFD_1.page.show();
PFD_1.update();
} else {

View file

@ -15,6 +15,8 @@ var dc_volt_std = 28;
var dc_volt_min = 25;
var dc_amps_std = 150;
var ac_hz_std = 400;
var ac1_src = "XX";
var ac2_src = "XX";
setlistener("/sim/signals/fdm-initialized", func {
var galley_sw = getprop("/controls/electrical/switches/galley");
@ -101,6 +103,8 @@ var elec_init = func {
setprop("/systems/electrical/gen-apu", 0);
setprop("/systems/electrical/gen-ext", 0);
setprop("/systems/electrical/on", 0);
setprop("/systems/electrical/ac1-src", "XX");
setprop("/systems/electrical/ac2-src", "XX");
setprop("/systems/electrical/galley-fault", 0);
setprop("/systems/electrical/idg1-fault", 0);
setprop("/systems/electrical/gen1-fault", 0);
@ -293,31 +297,43 @@ var master_elec = func {
# Left AC bus yes?
if (stateL == 3 and gen1_sw and !gen1_fail) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
ac1_src = "GEN";
} else if (extpwr_on and gen_ext_sw and apu_ext_crosstie_sw) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
ac1_src = "EXT";
} else if (gen_apu and !genapu_fail and apu_ext_crosstie_sw) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
ac1_src = "APU";
} else if (apu_ext_crosstie_sw == 1 and xtieL) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
ac1_src = "XTIE";
} else if (emergen) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
ac1_src = "RAT";
} else {
setprop("/systems/electrical/bus/ac1", 0);
ac1_src = "XX";
}
# Right AC bus yes?
if (stateR == 3 and gen2_sw and !gen2_fail) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
ac2_src = "GEN";
} else if (extpwr_on and gen_ext_sw and apu_ext_crosstie_sw) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
ac2_src = "EXT";
} else if (gen_apu and !genapu_fail and apu_ext_crosstie_sw) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
ac2_src = "APU";
} else if (apu_ext_crosstie_sw == 1 and xtieR) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
ac2_src = "XTIE";
} else if (emergen) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
ac2_src = "RAT";
} else {
setprop("/systems/electrical/bus/ac2", 0);
ac2_src = "XX";
}
# HZ/Volts yes?
@ -523,6 +539,9 @@ var master_elec = func {
setprop("/controls/lighting/overhead-panel-norm", getprop("/controls/lighting/overhead-panel-knb"));
}
setprop("/systems/electrical/ac1-src", ac1_src);
setprop("/systems/electrical/ac2-src", ac2_src);
# Fault lights
if (gallery_fail and galley_sw) {
setprop("/systems/electrical/galley-fault", 1);

View file

@ -1 +1 @@
3061
3062