2016-12-05 20:20:56 +00:00
|
|
|
# A320 Throttle Control System by Joshua Davidson (it0uchpods/411)
|
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.
|
|
|
|
# V1.8
|
|
|
|
|
|
|
|
setlistener("/sim/signals/fdm-initialized", func {
|
|
|
|
setprop("/systems/thrust/state1", "IDLE");
|
|
|
|
setprop("/systems/thrust/state2", "IDLE");
|
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
|
|
|
setprop("/systems/thrust/clbreduc-ft", "2000");
|
|
|
|
lvrclb();
|
|
|
|
print("Thrust System ... Done!")
|
|
|
|
});
|
|
|
|
|
|
|
|
setlistener("/controls/engines/engine[0]/throttle", func {
|
|
|
|
var thrr = getprop("/controls/engines/engine[0]/throttle");
|
|
|
|
if (thrr < 0.05) {
|
|
|
|
setprop("/systems/thrust/state1", "IDLE");
|
|
|
|
atoff_request();
|
|
|
|
} else if (thrr >= 0.05 and thrr < 0.60) {
|
|
|
|
setprop("/systems/thrust/state1", "MAN");
|
|
|
|
} else if (thrr >= 0.60 and thrr < 0.80) {
|
|
|
|
setprop("/systems/thrust/state1", "CL");
|
|
|
|
} else if (thrr >= 0.80 and thrr < 0.95) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/controls/engines/engine[0]/throttle-fdm", 0.94);
|
|
|
|
setprop("/systems/thrust/state1", "MCT");
|
|
|
|
} else if (thrr >= 0.95) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/controls/engines/engine[0]/throttle-fdm", 0.98);
|
|
|
|
setprop("/systems/thrust/state1", "TOGA");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
setlistener("/controls/engines/engine[1]/throttle", func {
|
|
|
|
var thrr = getprop("/controls/engines/engine[1]/throttle");
|
|
|
|
if (thrr < 0.05) {
|
|
|
|
setprop("/systems/thrust/state2", "IDLE");
|
|
|
|
atoff_request();
|
|
|
|
} else if (thrr >= 0.05 and thrr < 0.60) {
|
|
|
|
setprop("/systems/thrust/state2", "MAN");
|
|
|
|
} else if (thrr >= 0.60 and thrr < 0.80) {
|
|
|
|
setprop("/systems/thrust/state2", "CL");
|
|
|
|
} else if (thrr >= 0.80 and thrr < 0.95) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/controls/engines/engine[1]/throttle-fdm", 0.94);
|
|
|
|
setprop("/systems/thrust/state2", "MCT");
|
|
|
|
} else if (thrr >= 0.95) {
|
2016-12-05 20:20:56 +00:00
|
|
|
setprop("/it-autoflight/input/athr", 1);
|
2016-11-05 03:39:28 +00:00
|
|
|
setprop("/controls/engines/engine[1]/throttle-fdm", 0.98);
|
|
|
|
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
|
|
|
setprop("/systems/thrust/at1", 0);
|
|
|
|
setprop("/systems/thrust/at2", 0);
|
|
|
|
setprop("/systems/thrust/at3", 0);
|
|
|
|
setprop("/systems/thrust/at4", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
if (getprop("/instrumentation/altimeter/indicated-altitude-ft") >= getprop("/systems/thrust/clbreduc-ft")) {
|
|
|
|
setprop("/systems/thrust/lvrclb", "1");
|
|
|
|
} else {
|
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
|
|
|
}
|
|
|
|
} else if (status == 1) {
|
|
|
|
setprop("/systems/thrust/lvrclb", "0");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
settimer(lvrclb, 0.5);
|
|
|
|
}
|