2017-04-17 19:44:59 +00:00
|
|
|
# A3XX Throttle Control System by Joshua Davidson (it0uchpods)
|
2016-11-05 03:39:28 +00:00
|
|
|
# Set A/THR modes to Custom IT-AUTOTHRUST, and other thrust modes like MCT, TOGA and eventually TO FLEX.
|
2017-04-07 18:09:40 +00:00
|
|
|
# Also handles FADEC
|
2017-04-17 19:44:59 +00:00
|
|
|
# V1.9.1
|
2016-11-05 03:39:28 +00:00
|
|
|
|
|
|
|
setlistener("/sim/signals/fdm-initialized", func {
|
2017-04-25 17:13:15 +00:00
|
|
|
setprop("/controls/engines/thrust-limit", "TOGA");
|
|
|
|
setprop("/controls/engines/epr-limit", 1.301);
|
|
|
|
setprop("/controls/engines/n1-limit", 97.8);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state1", "IDLE");
|
|
|
|
setprop("/systems/thrust/state2", "IDLE");
|
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
2016-12-10 16:26:57 +00:00
|
|
|
setprop("/systems/thrust/clbreduc-ft", "1500");
|
2017-04-17 19:44:59 +00:00
|
|
|
lvrclbt.start();
|
2017-04-07 18:09:40 +00:00
|
|
|
print("FADEC ... Done!")
|
2016-11-05 03:39:28 +00:00
|
|
|
});
|
|
|
|
|
2017-04-07 18:09:40 +00:00
|
|
|
setlistener("/controls/engines/engine[0]/throttle-pos", func {
|
|
|
|
var thrr = getprop("/controls/engines/engine[0]/throttle-pos");
|
2017-04-09 15:30:46 +00:00
|
|
|
if (thrr < 0.02) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state1", "IDLE");
|
|
|
|
atoff_request();
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.01 and thrr < 0.60) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state1", "MAN");
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.60 and thrr < 0.65) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state1", "CL");
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.65 and thrr < 0.78) {
|
|
|
|
setprop("/systems/thrust/state1", "MAN THR");
|
|
|
|
} else if (thrr >= 0.78 and thrr < 0.83) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-12-10 16:26:57 +00:00
|
|
|
setprop("/controls/engines/engine[0]/throttle-fdm", 0.90);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state1", "MCT");
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.83 and thrr < 0.95) {
|
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
|
|
|
setprop("/systems/thrust/state1", "MAN THR");
|
2016-11-05 03:39:28 +00:00
|
|
|
} else if (thrr >= 0.95) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-12-10 16:26:57 +00:00
|
|
|
setprop("/controls/engines/engine[0]/throttle-fdm", 0.95);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state1", "TOGA");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-04-07 18:09:40 +00:00
|
|
|
setlistener("/controls/engines/engine[1]/throttle-pos", func {
|
|
|
|
var thrr = getprop("/controls/engines/engine[1]/throttle-pos");
|
2017-04-09 15:30:46 +00:00
|
|
|
if (thrr < 0.02) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state2", "IDLE");
|
|
|
|
atoff_request();
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.01 and thrr < 0.60) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state2", "MAN");
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.60 and thrr < 0.65) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state2", "CL");
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.65 and thrr < 0.78) {
|
|
|
|
setprop("/systems/thrust/state2", "MAN THR");
|
|
|
|
} else if (thrr >= 0.78 and thrr < 0.83) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-12-10 16:26:57 +00:00
|
|
|
setprop("/controls/engines/engine[1]/throttle-fdm", 0.90);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state2", "MCT");
|
2016-12-10 16:26:57 +00:00
|
|
|
} else if (thrr >= 0.83 and thrr < 0.95) {
|
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
|
|
|
setprop("/systems/thrust/state2", "MAN THR");
|
2016-11-05 03:39:28 +00:00
|
|
|
} else if (thrr >= 0.95) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-12-10 16:26:57 +00:00
|
|
|
setprop("/controls/engines/engine[1]/throttle-fdm", 0.95);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/state2", "TOGA");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
# Checks if all throttles are in the IDLE position, before tuning off the A/THR.
|
|
|
|
var atoff_request = func {
|
|
|
|
var state1 = getprop("/systems/thrust/state1");
|
|
|
|
var state2 = getprop("/systems/thrust/state2");
|
2016-12-05 20:20:56 +00:00
|
|
|
if ((state1 == "IDLE") and (state2 == "IDLE")) {
|
|
|
|
setprop("/it-autoflight/input/athr", 0);
|
2016-11-05 03:39:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var lvrclb = func {
|
|
|
|
var state1 = getprop("/systems/thrust/state1");
|
|
|
|
var state2 = getprop("/systems/thrust/state2");
|
2016-12-05 20:20:56 +00:00
|
|
|
if ((state1 == "CL") and (state2 == "CL")) {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
|
|
|
} else {
|
|
|
|
var status = getprop("/systems/thrust/lvrclb");
|
|
|
|
if (status == 0) {
|
2017-04-17 19:44:59 +00:00
|
|
|
if (getprop("/systems/thrust/state1") == "MAN" or getprop("/systems/thrust/state2") == "MAN") {
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/systems/thrust/lvrclb", "1");
|
|
|
|
} else {
|
2017-04-17 19:44:59 +00:00
|
|
|
if (getprop("/instrumentation/altimeter/indicated-altitude-ft") >= getprop("/systems/thrust/clbreduc-ft")) {
|
|
|
|
setprop("/systems/thrust/lvrclb", "1");
|
|
|
|
} else {
|
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
|
|
|
}
|
2016-11-05 03:39:28 +00:00
|
|
|
}
|
|
|
|
} else if (status == 1) {
|
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
|
|
|
}
|
|
|
|
}
|
2017-04-07 18:09:40 +00:00
|
|
|
}
|
2017-04-17 19:44:59 +00:00
|
|
|
|
|
|
|
# Timers
|
|
|
|
var lvrclbt = maketimer(0.5, lvrclb);
|