1
0
Fork 0

Add timer to elec to wait a short time before tripping autopilot if there is a failure, to account for transient failures

This commit is contained in:
legoboyvdlp R 2020-01-01 21:49:44 +00:00
parent d44a794859
commit ba51c852f5
2 changed files with 25 additions and 10 deletions

View file

@ -349,6 +349,7 @@ var ECAM_controller = {
warning.active = 0; warning.active = 0;
warning.noRepeat = 0; warning.noRepeat = 0;
warning.noRepeat2 = 0; warning.noRepeat2 = 0;
# don't set .wasActive to 0, warnlight / sound funcs do that
}, },
}; };

View file

@ -13,6 +13,8 @@ var dc2 = 0;
# Main class # Main class
var ELEC = { var ELEC = {
_timer1On: 0,
_timer2On: 0,
Bus: { Bus: {
acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"), acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"),
acEssShed: props.globals.getNode("/systems/electrical/bus/ac-ess-shed"), acEssShed: props.globals.getNode("/systems/electrical/bus/ac-ess-shed"),
@ -227,20 +229,32 @@ var ELEC = {
# Autopilot Disconnection routines # Autopilot Disconnection routines
if (me.Bus.dcEssShed.getValue() < 25) { if (me.Bus.dcEssShed.getValue() < 25) {
if (getprop("/it-autoflight/output/ap1") == 1) { if (getprop("/it-autoflight/output/ap1") == 1 and !me._timer1On) {
fcu.apOff("hard", 1); me._timer1On = 1;
if (fcu.FCUController.activeFMGC.getValue() == 1) { settimer(func() {
fcu.athrOff("hard"); if (me.Bus.dcEssShed.getValue() < 25) {
} fcu.apOff("hard", 1);
if (fcu.FCUController.activeFMGC.getValue() == 1) {
fcu.athrOff("hard");
}
}
me._timer1On = 0;
}, 0.1);
} }
} }
if (me.Bus.dc2.getValue() < 25) { if (me.Bus.dc2.getValue() < 25) {
if (getprop("/it-autoflight/output/ap2") == 1) { if (getprop("/it-autoflight/output/ap2") == 1 and !me._timer2On) {
fcu.apOff("hard", 2); me._timer2On = 1;
if (fcu.FCUController.activeFMGC.getValue() == 2) { settimer(func() {
fcu.athrOff("hard"); if (me.Bus.dc2.getValue() < 25) {
} fcu.apOff("hard", 2);
if (fcu.FCUController.activeFMGC.getValue() == 2) {
fcu.athrOff("hard");
}
}
me._timer2On = 0;
}, 0.1);
} }
} }
}, },