2017-06-27 17:43:22 +00:00
|
|
|
# A3XX CFM FADEC by Joshua Davidson (it0uchpods)
|
|
|
|
|
2017-11-16 19:29:08 +00:00
|
|
|
##############################################
|
|
|
|
# Copyright (c) Joshua Davidson (it0uchpods) #
|
|
|
|
##############################################
|
2017-07-13 17:30:33 +00:00
|
|
|
|
2017-07-30 04:41:20 +00:00
|
|
|
setprop("/systems/fadec/n1mode1", 0); # Doesn't do anything, just here for other logic #
|
|
|
|
setprop("/systems/fadec/n1mode2", 0); # Doesn't do anything, just here for other logic #
|
|
|
|
setprop("/systems/fadec/eng1/egt", 1);
|
|
|
|
setprop("/systems/fadec/eng1/n1", 1);
|
|
|
|
setprop("/systems/fadec/eng1/n2", 1);
|
|
|
|
setprop("/systems/fadec/eng1/ff", 1);
|
|
|
|
setprop("/systems/fadec/eng2/egt", 1);
|
|
|
|
setprop("/systems/fadec/eng2/n1", 1);
|
|
|
|
setprop("/systems/fadec/eng2/n2", 1);
|
|
|
|
setprop("/systems/fadec/eng2/ff", 1);
|
|
|
|
setprop("/systems/fadec/power-avail", 0);
|
|
|
|
setprop("/systems/fadec/powered1", 0);
|
|
|
|
setprop("/systems/fadec/powered2", 0);
|
2017-12-30 05:25:11 +00:00
|
|
|
setprop("/systems/fadec/powered-time", 0);
|
|
|
|
setprop("/systems/fadec/powerup", 0);
|
2017-07-30 04:41:20 +00:00
|
|
|
|
2017-12-30 05:25:11 +00:00
|
|
|
var fadecLoop = func {
|
2017-06-27 17:43:22 +00:00
|
|
|
var ac1 = getprop("/systems/electrical/bus/ac1");
|
2017-08-27 02:38:55 +00:00
|
|
|
var ac2 = getprop("/systems/electrical/bus/ac2");
|
2017-06-27 17:43:22 +00:00
|
|
|
var acess = getprop("/systems/electrical/bus/ac-ess");
|
|
|
|
var state1 = getprop("/engines/engine[0]/state");
|
|
|
|
var state2 = getprop("/engines/engine[1]/state");
|
|
|
|
var master1 = getprop("/controls/engines/engine[0]/cutoff-switch");
|
|
|
|
var master2 = getprop("/controls/engines/engine[1]/cutoff-switch");
|
|
|
|
var modeSel = getprop("/controls/engines/engine-start-switch");
|
|
|
|
|
|
|
|
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
|
2017-12-30 05:25:11 +00:00
|
|
|
if (getprop("/systems/fadec/power-avail") != 1) {
|
|
|
|
setprop("/systems/fadec/powered-time", getprop("/sim/time/elapsed-sec"));
|
|
|
|
setprop("/systems/fadec/power-avail", 1);
|
|
|
|
}
|
2017-06-27 17:43:22 +00:00
|
|
|
} else {
|
2017-12-30 05:25:11 +00:00
|
|
|
if (getprop("/systems/fadec/power-avail") != 0) {
|
|
|
|
setprop("/systems/fadec/power-avail", 0);
|
|
|
|
}
|
2017-06-27 17:43:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var powerAvail = getprop("/systems/fadec/power-avail");
|
|
|
|
|
2017-12-30 05:25:11 +00:00
|
|
|
if (getprop("/systems/fadec/powered-time") + 300 >= getprop("/sim/time/elapsed-sec")) {
|
|
|
|
setprop("/systems/fadec/powerup", 1);
|
|
|
|
} else {
|
|
|
|
setprop("/systems/fadec/powerup", 0);
|
|
|
|
}
|
|
|
|
|
2017-06-27 17:43:22 +00:00
|
|
|
if (state1 == 3) {
|
|
|
|
setprop("/systems/fadec/powered1", 1);
|
|
|
|
} else if (powerAvail and modeSel == 2) {
|
|
|
|
setprop("/systems/fadec/powered1", 1);
|
|
|
|
} else {
|
|
|
|
setprop("/systems/fadec/powered1", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state2 == 3) {
|
|
|
|
setprop("/systems/fadec/powered2", 1);
|
|
|
|
} else if (powerAvail and modeSel == 2) {
|
|
|
|
setprop("/systems/fadec/powered2", 1);
|
|
|
|
} else {
|
|
|
|
setprop("/systems/fadec/powered2", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
var powered1 = getprop("/systems/fadec/powered1");
|
|
|
|
var powered2 = getprop("/systems/fadec/powered2");
|
|
|
|
|
2017-12-30 05:25:11 +00:00
|
|
|
if (powered1 or getprop("/systems/fadec/powerup")) {
|
2017-06-27 17:43:22 +00:00
|
|
|
setprop("/systems/fadec/eng1/n1", 1);
|
|
|
|
setprop("/systems/fadec/eng1/egt", 1);
|
2017-11-22 23:34:43 +00:00
|
|
|
setprop("/systems/fadec/eng1/n2", 1);
|
2017-06-27 17:43:22 +00:00
|
|
|
setprop("/systems/fadec/eng1/ff", 1);
|
|
|
|
} else {
|
|
|
|
setprop("/systems/fadec/eng1/n1", 0);
|
|
|
|
setprop("/systems/fadec/eng1/egt", 0);
|
2017-11-22 23:34:43 +00:00
|
|
|
setprop("/systems/fadec/eng1/n2", 0);
|
2017-06-27 17:43:22 +00:00
|
|
|
setprop("/systems/fadec/eng1/ff", 0);
|
|
|
|
}
|
|
|
|
|
2017-12-30 05:25:11 +00:00
|
|
|
if (powered2 or getprop("/systems/fadec/powerup")) {
|
2017-06-27 17:43:22 +00:00
|
|
|
setprop("/systems/fadec/eng2/n1", 1);
|
|
|
|
setprop("/systems/fadec/eng2/egt", 1);
|
2017-11-22 23:34:43 +00:00
|
|
|
setprop("/systems/fadec/eng2/n2", 1);
|
2017-06-27 17:43:22 +00:00
|
|
|
setprop("/systems/fadec/eng2/ff", 1);
|
|
|
|
} else {
|
|
|
|
setprop("/systems/fadec/eng2/n1", 0);
|
|
|
|
setprop("/systems/fadec/eng2/egt", 0);
|
|
|
|
setprop("/systems/fadec/eng2/n2", 0);
|
2017-11-22 23:34:43 +00:00
|
|
|
setprop("/systems/fadec/eng2/ff", 0);
|
2017-06-27 17:43:22 +00:00
|
|
|
}
|
2017-12-30 05:25:11 +00:00
|
|
|
}
|