System: Fix Elec Battery logic, finish ELEC ECAM page

This commit is contained in:
Joshua Davidson 2018-08-24 12:23:59 -04:00
parent 3514d5f99a
commit 9ebdc9fa84
7 changed files with 685 additions and 710 deletions

View file

@ -58,7 +58,7 @@ var canvas_IESI_base = {
return []; return [];
}, },
update: func() { update: func() {
if (getprop("/systems/electrical/battery1-amps") >= 120 or getprop("/systems/electrical/battery2-amps") >= 120 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) { if (getprop("/systems/electrical/bus/dcbat") >= 25 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) {
if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/iesi/iesi-init") != 1) { if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/iesi/iesi-init") != 1) {
setprop("/instrumentation/iesi/iesi-init", 1); setprop("/instrumentation/iesi/iesi-init", 1);
setprop("/instrumentation/iesi/iesi-init-time", getprop("/sim/time/elapsed-sec")); setprop("/instrumentation/iesi/iesi-init-time", getprop("/sim/time/elapsed-sec"));
@ -70,7 +70,7 @@ var canvas_IESI_base = {
setprop("/instrumentation/iesi/iesi-init", 0); setprop("/instrumentation/iesi/iesi-init", 0);
} }
if (getprop("/systems/electrical/battery1-amps") >= 120 or getprop("/systems/electrical/battery2-amps") >= 120 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) { if (getprop("/systems/electrical/bus/dcbat") >= 25 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) {
IESI.page.show(); IESI.page.show();
IESI.update(); IESI.update();
} else { } else {

View file

@ -138,7 +138,7 @@ var canvas_lowerECAM_base = {
lowerECAM_apu.update(); lowerECAM_apu.update();
} else if (page == "bleed") { } else if (page == "bleed") {
lowerECAM_apu.page.hide(); lowerECAM_apu.page.hide();
lowerECAM_bleed.page.show(); # lowerECAM_bleed.page.show();
lowerECAM_cond.page.hide(); lowerECAM_cond.page.hide();
lowerECAM_door.page.hide(); lowerECAM_door.page.hide();
lowerECAM_elec.page.hide(); lowerECAM_elec.page.hide();
@ -153,7 +153,7 @@ var canvas_lowerECAM_base = {
} else if (page == "cond") { } else if (page == "cond") {
lowerECAM_apu.page.hide(); lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide(); lowerECAM_bleed.page.hide();
lowerECAM_cond.page.show(); # lowerECAM_cond.page.show();
lowerECAM_door.page.hide(); lowerECAM_door.page.hide();
lowerECAM_elec.page.hide(); lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide(); lowerECAM_eng.page.hide();
@ -228,7 +228,7 @@ var canvas_lowerECAM_base = {
lowerECAM_elec.page.hide(); lowerECAM_elec.page.hide();
lowerECAM_eng.page.hide(); lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide(); lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.show(); # lowerECAM_fuel.page.show();
lowerECAM_press.page.hide(); lowerECAM_press.page.hide();
lowerECAM_status.page.hide(); lowerECAM_status.page.hide();
lowerECAM_hyd.page.hide(); lowerECAM_hyd.page.hide();
@ -243,7 +243,7 @@ var canvas_lowerECAM_base = {
lowerECAM_eng.page.hide(); lowerECAM_eng.page.hide();
lowerECAM_fctl.page.hide(); lowerECAM_fctl.page.hide();
lowerECAM_fuel.page.hide(); lowerECAM_fuel.page.hide();
lowerECAM_press.page.show(); # lowerECAM_press.page.show();
lowerECAM_status.page.hide(); lowerECAM_status.page.hide();
lowerECAM_hyd.page.hide(); lowerECAM_hyd.page.hide();
lowerECAM_wheel.page.hide(); lowerECAM_wheel.page.hide();
@ -273,7 +273,7 @@ var canvas_lowerECAM_base = {
lowerECAM_fuel.page.hide(); lowerECAM_fuel.page.hide();
lowerECAM_press.page.hide(); lowerECAM_press.page.hide();
lowerECAM_status.page.hide(); lowerECAM_status.page.hide();
lowerECAM_hyd.page.show(); # lowerECAM_hyd.page.show();
lowerECAM_wheel.page.hide(); lowerECAM_wheel.page.hide();
lowerECAM_hyd.update(); lowerECAM_hyd.update();
} else if (page == "wheel") { } else if (page == "wheel") {
@ -894,12 +894,12 @@ var canvas_lowerECAM_elec = {
}, },
getKeys: func() { getKeys: func() {
return ["TAT","SAT","GW","UTCh","UTCm","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", return ["TAT","SAT","GW","UTCh","UTCm","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT",
"ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-Box-on","EmergenVolt","EmergenHz", "ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-group","EmergenVolt","EmergenHz",
"ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2", "ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2",
"ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz", "ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz",
"GEN2-label","Gen2Load","GEN2-off","Gen2Volt","Gen2Hz","ELEC-IDG-1-label","ELEC-IDG-1-Temp","IDG1-LOPR","IDG1-DISC","IDG1-RISE-Value","IDG1-RISE-label","GalleyShed","ELEC-IDG-2-Temp","ELEC-IDG-2-label","IDG2-RISE-label","IDG2-RISE-Value","IDG2-LOPR", "GEN2-label","Gen2Load","GEN2-off","Gen2Volt","Gen2Hz","ELEC-IDG-1-label","ELEC-IDG-1-Temp","IDG1-LOPR","IDG1-DISC","IDG1-RISE-Value","IDG1-RISE-label","GalleyShed","ELEC-IDG-2-Temp","ELEC-IDG-2-label","IDG2-RISE-label","IDG2-RISE-Value","IDG2-LOPR",
"IDG2-DISC","ESSTR-group","ESSTR-Volt","ESSTR-Ampere","BAT1-content","BAT2-content","BAT1-OFF","BAT2-OFF","GEN1-content","GEN2-content","GEN-1-num-label","GEN-2-num-label","GEN1-off","GEN2-off","GEN1-num-label","GEN2-num-label","EXTPWR-label", "IDG2-DISC","ESSTR-group","ESSTR-Volt","ESSTR-Ampere","BAT1-content","BAT2-content","BAT1-OFF","BAT2-OFF","GEN1-content","GEN2-content","GEN-1-num-label","GEN-2-num-label","GEN1-off","GEN2-off","GEN1-num-label","GEN2-num-label","EXTPWR-label",
"ELEC-ACESS-SHED-label","ELEC-DCBAT-label","ELEC-DCESS-label","ELEC-DC2-label","ELEC-DC1-label","ELEC-AC1-label","ELEC-AC2-label","ELEC-ACESS-label"]; "ELEC-ACESS-SHED-label","ELEC-DCBAT-label","ELEC-DCESS-label","ELEC-DC2-label","ELEC-DC1-label","ELEC-AC1-label","ELEC-AC2-label","ELEC-ACESS-label","ELEC-Line-ESSTR-DCESS-off","ELEC-Line-Emergen-ESSTR-off"];
}, },
update: func() { update: func() {
@ -1046,10 +1046,12 @@ var canvas_lowerECAM_elec = {
# TODO add values and amber on over/under load # TODO add values and amber on over/under load
# TODO changes the prop to the one which indicates the use of the emergen and not of the man depoly # TODO changes the prop to the one which indicates the use of the emergen and not of the man depoly
if (getprop("/controls/electrical/switches/emer-gen") == 0) { if (getprop("/controls/electrical/switches/emer-gen") == 0) {
me["EMERGEN-Box-on"].hide(); me["EMERGEN-group"].hide();
me["ELEC-Line-Emergen-ESSTR"].hide();
me["EMERGEN-Label-off"].show(); me["EMERGEN-Label-off"].show();
} else { } else {
me["EMERGEN-Box-on"].show(); me["EMERGEN-group"].show();
me["ELEC-Line-Emergen-ESSTR"].show();
me["EMERGEN-Label-off"].hide(); me["EMERGEN-Label-off"].hide();
} }
@ -1360,7 +1362,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-AC2-ACESS"].hide(); me["ELEC-Line-AC2-ACESS"].hide();
} }
if (getprop("/systems/electrical/tr1-fault") == 0) { if (getprop("/systems/electrical/tr1-fault") != 1) {
if (getprop("/systems/electrical/bus/ac1") < 110) { if (getprop("/systems/electrical/bus/ac1") < 110) {
me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0); me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0);
} else { } else {
@ -1373,7 +1375,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-TR1-DC1"].hide(); me["ELEC-Line-TR1-DC1"].hide();
} }
if (getprop("/systems/electrical/tr2-fault") == 0) { if (getprop("/systems/electrical/tr2-fault") != 1) {
if (getprop("/systems/electrical/bus/ac2") < 110) { if (getprop("/systems/electrical/bus/ac2") < 110) {
me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0); me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0);
} else { } else {
@ -1422,8 +1424,8 @@ var canvas_lowerECAM_elec = {
me["IDG1-DISC"].hide(); me["IDG1-DISC"].hide();
me["IDG2-DISC"].hide(); me["IDG2-DISC"].hide();
me["Shed-label"].hide(); me["Shed-label"].hide();
me["ELEC-Line-ESSTR-DCESS"].hide();
me["ELEC-Line-ACESS-TRESS"].hide(); me["ELEC-Line-ACESS-TRESS"].hide();
me["ELEC-Line-Emergen-ESSTR"].hide();
me["IDG2-RISE-label"].hide(); me["IDG2-RISE-label"].hide();
me["IDG2-RISE-Value"].hide(); me["IDG2-RISE-Value"].hide();
me["IDG1-RISE-label"].hide(); me["IDG1-RISE-label"].hide();

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -75,12 +75,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -1793,12 +1789,8 @@
</equals> </equals>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -2887,12 +2879,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -2963,12 +2951,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3034,12 +3018,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3107,12 +3087,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3189,12 +3165,8 @@
</equals> </equals>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3242,12 +3214,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3627,12 +3595,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3771,12 +3735,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -3981,12 +3941,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -4061,12 +4017,8 @@
</equals> </equals>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -4334,12 +4286,8 @@
</equals> </equals>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -5114,12 +5062,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>
@ -5185,12 +5129,8 @@
<condition> <condition>
<or> <or>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/battery1-amps</property> <property>systems/electrical/bus/dcbat</property>
<value>120</value> <value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/battery2-amps</property>
<value>120</value>
</greater-than-equals> </greater-than-equals>
<greater-than-equals> <greater-than-equals>
<property>systems/electrical/bus/dc-ess</property> <property>systems/electrical/bus/dc-ess</property>

View file

@ -14,8 +14,7 @@ setlistener("/sim/signals/fdm-initialized", func {
var gs = getprop("/velocities/groundspeed-kt"); var gs = getprop("/velocities/groundspeed-kt");
var ac1 = 0; var ac1 = 0;
var ac2 = 0; var ac2 = 0;
var batt1_amps = 0; var dcbat = 0;
var batt2_amps = 0;
var pwr_src = "XX"; var pwr_src = "XX";
}); });
@ -65,8 +64,7 @@ var ADIRS = {
gs = getprop("/velocities/groundspeed-kt"); gs = getprop("/velocities/groundspeed-kt");
ac1 = getprop("/systems/electrical/bus/ac1"); ac1 = getprop("/systems/electrical/bus/ac1");
ac2 = getprop("/systems/electrical/bus/ac2"); ac2 = getprop("/systems/electrical/bus/ac2");
batt1_amps = getprop("/systems/electrical/battery1-amps"); dcbat = getprop("/systems/electrical/bus/dcbat");
batt2_amps = getprop("/systems/electrical/battery2-amps");
if (getprop("/controls/adirs/skip") == 1) { if (getprop("/controls/adirs/skip") == 1) {
if (getprop("/controls/adirs/align-time") != 5) { if (getprop("/controls/adirs/align-time") != 5) {
@ -78,7 +76,7 @@ var ADIRS = {
} }
} }
if (gs > 5 or pitch > 5 or pitch < -5 or roll > 10 or roll < -10 or (ac1 < 110 and ac2 < 110 and batt1_amps < 120 and batt2_amps < 120)) { if (gs > 5 or pitch > 5 or pitch < -5 or roll > 10 or roll < -10 or (ac1 < 110 and ac2 < 110 and dcbat < 25)) {
if (getprop("/controls/adirs/ir[0]/align") == 1) { if (getprop("/controls/adirs/ir[0]/align") == 1) {
me.stopAlign(0,1); me.stopAlign(0,1);
} }
@ -92,7 +90,7 @@ var ADIRS = {
if (ac1 >= 110 or ac2 >= 110) { if (ac1 >= 110 or ac2 >= 110) {
pwr_src = "AC"; pwr_src = "AC";
} else if ((batt1_amps >= 120 or batt2_amps >= 120) and (getprop("/controls/adirs/ir[0]/knob") != 0 or getprop("/controls/adirs/ir[1]/knob") != 0 or getprop("/controls/adirs/ir[2]/knob") != 0)) { } else if (dcbat >= 25 and (getprop("/controls/adirs/ir[0]/knob") != 0 or getprop("/controls/adirs/ir[1]/knob") != 0 or getprop("/controls/adirs/ir[2]/knob") != 0)) {
pwr_src = "BATT"; pwr_src = "BATT";
} else { } else {
pwr_src = "XX"; pwr_src = "XX";
@ -119,10 +117,9 @@ var ADIRS = {
beginAlign: func(n) { beginAlign: func(n) {
ac1 = getprop("/systems/electrical/bus/ac1"); ac1 = getprop("/systems/electrical/bus/ac1");
ac2 = getprop("/systems/electrical/bus/ac2"); ac2 = getprop("/systems/electrical/bus/ac2");
batt1_amps = getprop("/systems/electrical/battery1-amps"); dcbat = getprop("/systems/electrical/bus/dcbat");
batt2_amps = getprop("/systems/electrical/battery2-amps");
setprop("/instrumentation/adirs/adr[" ~ n ~ "]/active", 1); setprop("/instrumentation/adirs/adr[" ~ n ~ "]/active", 1);
if (getprop("/controls/adirs/ir[" ~ n ~ "]/align") != 1 and getprop("/instrumentation/adirs/ir[" ~ n ~ "]/aligned") != 1 and (ac1 >= 110 or ac2 >= 110 or batt1_amps >= 120 or batt2_amps >= 120)) { if (getprop("/controls/adirs/ir[" ~ n ~ "]/align") != 1 and getprop("/instrumentation/adirs/ir[" ~ n ~ "]/aligned") != 1 and (ac1 >= 110 or ac2 >= 110 or dcbat >= 25)) {
setprop("/controls/adirs/ir[" ~ n ~ "]/time", getprop("/sim/time/elapsed-sec")); setprop("/controls/adirs/ir[" ~ n ~ "]/time", getprop("/sim/time/elapsed-sec"));
setprop("/controls/adirs/ir[" ~ n ~ "]/align", 1); setprop("/controls/adirs/ir[" ~ n ~ "]/align", 1);
setprop("/controls/adirs/ir[" ~ n ~ "]/fault", 0); setprop("/controls/adirs/ir[" ~ n ~ "]/fault", 0);

View file

@ -10,6 +10,7 @@ var ac_volt_min = 110;
var dc_volt_std = 28; var dc_volt_std = 28;
var dc_volt_min = 25; var dc_volt_min = 25;
var dc_amps_std = 150; var dc_amps_std = 150;
var batt_amps = 2;
var tr_amps_std = 55; var tr_amps_std = 55;
var ac_hz_std = 400; var ac_hz_std = 400;
var ac1_src = "XX"; var ac1_src = "XX";
@ -313,14 +314,16 @@ var ELEC = {
replay = getprop("/sim/replay/replay-state"); replay = getprop("/sim/replay/replay-state");
wow = getprop("/gear/gear[1]/wow"); wow = getprop("/gear/gear[1]/wow");
if (battery1_volts >= 20 and battery1_sw and !batt1_fail) { if (battery1_volts >= 20 and battery1_sw and !batt1_fail) {
setprop("/systems/electrical/battery1-amps", dc_amps_std); setprop("/systems/electrical/battery1-amps", batt_amps);
} else { } else {
setprop("/systems/electrical/battery1-amps", 0); setprop("/systems/electrical/battery1-amps", 0);
} }
if (battery2_volts >= 20 and battery2_sw and !batt2_fail) { if (battery2_volts >= 20 and battery2_sw and !batt2_fail) {
setprop("/systems/electrical/battery2-amps", dc_amps_std); setprop("/systems/electrical/battery2-amps", batt_amps);
} else { } else {
setprop("/systems/electrical/battery2-amps", 0); setprop("/systems/electrical/battery2-amps", 0);
} }
@ -328,7 +331,7 @@ var ELEC = {
battery1_amps = getprop("/systems/electrical/battery1-amps"); battery1_amps = getprop("/systems/electrical/battery1-amps");
battery2_amps = getprop("/systems/electrical/battery2-amps"); battery2_amps = getprop("/systems/electrical/battery2-amps");
if (battery1_amps > 120 or battery2_amps > 120) { if (battery1_amps > 0 or battery2_amps > 0) {
setprop("/systems/electrical/bus/dcbat", dc_volt_std); setprop("/systems/electrical/bus/dcbat", dc_volt_std);
} else { } else {
setprop("/systems/electrical/bus/dcbat", 0); setprop("/systems/electrical/bus/dcbat", 0);
@ -623,7 +626,7 @@ var ELEC = {
} }
} else if (battery1_percent == 100 and (dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) { } else if (battery1_percent == 100 and (dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) {
setprop("/systems/electrical/battery1-time", getprop("/sim/time/elapsed-sec")); setprop("/systems/electrical/battery1-time", getprop("/sim/time/elapsed-sec"));
} else if (battery1_amps >= 120 and battery1_sw and !batt1_fail) { } else if (battery1_amps > 0 and battery1_sw and !batt1_fail) {
if (getprop("/systems/electrical/battery1-time") + 5 < getprop("/sim/time/elapsed-sec")) { if (getprop("/systems/electrical/battery1-time") + 5 < getprop("/sim/time/elapsed-sec")) {
battery1_percent_calc = battery1_percent - 0.25; # Roughly 90 percent every 30 mins battery1_percent_calc = battery1_percent - 0.25; # Roughly 90 percent every 30 mins
if (battery1_percent_calc < 0) { if (battery1_percent_calc < 0) {
@ -647,7 +650,7 @@ var ELEC = {
} }
} else if (battery2_percent == 100 and (dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) { } else if (battery2_percent == 100 and (dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) {
setprop("/systems/electrical/battery2-time", getprop("/sim/time/elapsed-sec")); setprop("/systems/electrical/battery2-time", getprop("/sim/time/elapsed-sec"));
} else if (battery2_amps >= 120 and battery2_sw and !batt2_fail) { } else if (battery2_amps > 0 and battery2_sw and !batt2_fail) {
if (getprop("/systems/electrical/battery2-time") + 5 < getprop("/sim/time/elapsed-sec")) { if (getprop("/systems/electrical/battery2-time") + 5 < getprop("/sim/time/elapsed-sec")) {
battery2_percent_calc = battery2_percent - 0.25; # Roughly 90 percent every 30 mins battery2_percent_calc = battery2_percent - 0.25; # Roughly 90 percent every 30 mins
if (battery2_percent_calc < 0) { if (battery2_percent_calc < 0) {

View file

@ -1 +1 @@
4626 4630