A3XX: Update charging logic

This commit is contained in:
Joshua Davidson 2017-10-05 23:35:36 -04:00
parent 02dd1fde0d
commit 8e63cdd6ab
4 changed files with 22 additions and 23 deletions

View file

@ -583,6 +583,7 @@
</switches>
</pneumatic>
<switches>
<cart type="bool">0</cart>
<!-- Smoking is bad :P -->
<no-smoking-sign type="bool">1</no-smoking-sign>
<seatbelt-sign type="bool">0</seatbelt-sign>

View file

@ -409,37 +409,35 @@ var master_elec = func {
setprop("/systems/electrical/bus/dcbat", 0);
}
if (battery1_volts > 27.9 or (dcbat == 0)) {
charge1.stop();
} else if (batt1_fail) {
charge1.stop();
}
if (battery2_volts > 27.9 or (dcbat == 0)) {
charge2.stop();
} else if (batt2_fail) {
charge2.stop();
}
dc1 = getprop("/systems/electrical/bus/dc1");
dc2 = getprop("/systems/electrical/bus/dc2");
if ((dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) {
if (battery1_volts < 27.9 and (dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) {
decharge1.stop();
charge1.start();
} else if (battery1_volts == 27.9 and (dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) {
charge1.stop();
decharge1.stop();
} else if (battery1_sw and !batt1_fail) {
charge1.stop();
decharge1.start();
} else {
decharge1.stop();
charge1.stop();
}
if ((dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) {
if (battery2_volts < 27.9 and (dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) {
decharge2.stop();
charge2.start();
}
if ((dcbat == 0) and battery1_sw and !batt1_fail) {
decharge1.start();
}
if ((dcbat == 0) and battery2_sw and !batt2_fail) {
} else if (battery2_volts == 27.9 and (dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) {
charge2.stop();
decharge2.stop();
} else if (battery2_sw and !batt2_fail) {
charge2.stop();
decharge2.start();
} else {
decharge2.stop();
charge2.stop();
}
if (getprop("/systems/electrical/bus/ac-ess") < 110) {

View file

@ -225,7 +225,7 @@ setlistener("/sim/signals/fdm-initialized", func {
});
var librariesLoop = maketimer(0.1, func {
if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/switches/cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or getprop("controls/gear/brake-parking") == 0)) {
if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/switches/cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or getprop("/controls/gear/brake-parking") == 0)) {
setprop("/controls/switches/cart", 0);
setprop("/controls/pneumatic/switches/groundair", 0);
}

View file

@ -1 +1 @@
2106
2107