A3XX: FADEC awake for 5 mins then go to sleep

This commit is contained in:
Joshua Davidson 2017-12-30 00:25:11 -05:00
parent ac459bc9fb
commit 220828980b
12 changed files with 101 additions and 92 deletions

View file

@ -196,8 +196,6 @@
<specific>
<file>Aircraft/IDG-A32X/Nasal/a320livery-cfm-100.nas</file>
</specific>
<fadec>
<file>Aircraft/IDG-A32X/Nasal/fadec-cfm.nas</file>
</fadec>
</nasal>
</PropertyList>

View file

@ -195,8 +195,6 @@
<specific>
<file>Aircraft/IDG-A32X/Nasal/a320livery-cfm.nas</file>
</specific>
<fadec>
<file>Aircraft/IDG-A32X/Nasal/fadec-cfm.nas</file>
</fadec>
</nasal>
</PropertyList>

View file

@ -195,9 +195,6 @@
<specific>
<file>Aircraft/IDG-A32X/Nasal/a320livery-iae.nas</file>
</specific>
<fadec>
<file>Aircraft/IDG-A32X/Nasal/fadec-iae.nas</file>
</fadec>
</nasal>
</PropertyList>

View file

@ -1395,9 +1395,9 @@
<file>Aircraft/IDG-A32X/Nasal/ground_services.nas</file>
<file>Aircraft/IDG-A32X/Nasal/effects.nas</file>
</systems>
<thrust>
<fadec>
<file>Aircraft/IDG-A32X/Nasal/fadec-common.nas</file>
</thrust>
</fadec>
<fbw>
<file>Aircraft/IDG-A32X/Nasal/it-fbw.nas</file>
</fbw>

View file

@ -195,9 +195,6 @@
<specific>
<file>Aircraft/IDG-A32X/Nasal/a320livery-neocfm.nas</file>
</specific>
<fadec>
<file>Aircraft/IDG-A32X/Nasal/fadec-cfm.nas</file>
</fadec>
</nasal>
</PropertyList>

View file

@ -195,9 +195,6 @@
<specific>
<file>Aircraft/IDG-A32X/Nasal/a320livery-neopw.nas</file>
</specific>
<fadec> <!-- Apparently PW PurePower uses N1, not EPR.... sooo I use CFM FADEC -->
<file>Aircraft/IDG-A32X/Nasal/fadec-cfm.nas</file>
</fadec>
</nasal>
</PropertyList>

View file

@ -492,7 +492,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["N1Lim"].setText(sprintf("%s", math.floor(getprop("/controls/engines/n1-limit") + 0.05)));
me["N1Lim-decimal"].setText(sprintf("%s", int(10*math.mod(getprop("/controls/engines/n1-limit") + 0.05,1))));
if (getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1) {
if (getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) {
me["N1Lim-mode"].show();
me["N1Lim-XX"].hide();
me["N1Lim-XX2"].hide();
@ -502,7 +502,7 @@ var canvas_upperECAM_cfm_eis2 = {
me["N1Lim-XX2"].show();
}
if ((getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1) and getprop("/controls/engines/thrust-limit") != "MREV") {
if ((getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) and getprop("/controls/engines/thrust-limit") != "MREV") {
me["N1Lim"].show();
me["N1Lim-decpnt"].show();
me["N1Lim-decimal"].show();
@ -783,7 +783,7 @@ var canvas_upperECAM_iae_eis2 = {
me["EPRLim"].setText(sprintf("%1.0f", math.floor(getprop("/controls/engines/epr-limit"))));
me["EPRLim-decimal"].setText(sprintf("%03d", (getprop("/controls/engines/epr-limit") - int(getprop("/controls/engines/epr-limit"))) * 1000));
if (getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1) {
if (getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) {
me["EPRLim-mode"].show();
me["EPRLim-XX"].hide();
me["EPRLim-XX2"].hide();
@ -793,7 +793,7 @@ var canvas_upperECAM_iae_eis2 = {
me["EPRLim-XX2"].show();
}
if ((getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1) and getprop("/controls/engines/thrust-limit") != "MREV") {
if ((getprop("/systems/fadec/powered1") == 1 or getprop("/systems/fadec/powered2") == 1 or getprop("/systems/fadec/powerup")) and getprop("/controls/engines/thrust-limit") != "MREV") {
me["EPRLim"].show();
me["EPRLim-decpnt"].show();
me["EPRLim-decimal"].show();

View file

@ -17,12 +17,10 @@ setprop("/systems/fadec/eng2/ff", 1);
setprop("/systems/fadec/power-avail", 0);
setprop("/systems/fadec/powered1", 0);
setprop("/systems/fadec/powered2", 0);
setprop("/systems/fadec/powered-time", 0);
setprop("/systems/fadec/powerup", 0);
setlistener("/sim/signals/fdm-initialized", func {
fadecLoop.start();
});
var fadecLoop = maketimer(0.7, func {
var fadecLoop = func {
var ac1 = getprop("/systems/electrical/bus/ac1");
var ac2 = getprop("/systems/electrical/bus/ac2");
var acess = getprop("/systems/electrical/bus/ac-ess");
@ -33,13 +31,24 @@ var fadecLoop = maketimer(0.7, func {
var modeSel = getprop("/controls/engines/engine-start-switch");
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
setprop("/systems/fadec/power-avail", 1);
if (getprop("/systems/fadec/power-avail") != 1) {
setprop("/systems/fadec/powered-time", getprop("/sim/time/elapsed-sec"));
setprop("/systems/fadec/power-avail", 1);
}
} else {
setprop("/systems/fadec/power-avail", 0);
if (getprop("/systems/fadec/power-avail") != 0) {
setprop("/systems/fadec/power-avail", 0);
}
}
var powerAvail = getprop("/systems/fadec/power-avail");
if (getprop("/systems/fadec/powered-time") + 300 >= getprop("/sim/time/elapsed-sec")) {
setprop("/systems/fadec/powerup", 1);
} else {
setprop("/systems/fadec/powerup", 0);
}
if (state1 == 3) {
setprop("/systems/fadec/powered1", 1);
} else if (powerAvail and modeSel == 2) {
@ -59,7 +68,7 @@ var fadecLoop = maketimer(0.7, func {
var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("/systems/fadec/powered2");
if (powered1) {
if (powered1 or getprop("/systems/fadec/powerup")) {
setprop("/systems/fadec/eng1/n1", 1);
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/n2", 1);
@ -71,7 +80,7 @@ var fadecLoop = maketimer(0.7, func {
setprop("/systems/fadec/eng1/ff", 0);
}
if (powered2) {
if (powered2 or getprop("/systems/fadec/powerup")) {
setprop("/systems/fadec/eng2/n1", 1);
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/n2", 1);
@ -82,4 +91,4 @@ var fadecLoop = maketimer(0.7, func {
setprop("/systems/fadec/eng2/n2", 0);
setprop("/systems/fadec/eng2/ff", 0);
}
});
}

View file

@ -5,6 +5,12 @@
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
if (getprop("/options/eng") == "IAE") {
io.include("fadec-iae.nas");
} else {
io.include("fadec-cfm.nas");
}
setprop("/systems/thrust/alpha-floor", 0);
setprop("/systems/thrust/toga-lk", 0);
setprop("/systems/thrust/epr/toga-lim", 0.0);
@ -50,8 +56,8 @@ setlistener("/sim/signals/fdm-initialized", func {
var alphaProt = 0;
var togaLock = 0;
var gs = getprop("/velocities/groundspeed-kt");
thrust_lim.start();
thrustt.start();
thrust_loop.start();
thrust_flash.start();
});
setlistener("/controls/engines/engine[0]/throttle-pos", func {
@ -194,7 +200,7 @@ var atoff_request = func {
}
}
var thrust_lim = maketimer(0.04, func {
var thrust_loop = maketimer(0.04, func {
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
engstate1 = getprop("/engines/engine[0]/state");
@ -252,6 +258,34 @@ var thrust_lim = maketimer(0.04, func {
setprop("/controls/engines/epr-limit", eprtoga);
setprop("/controls/engines/n1-limit", n1toga);
}
alpha = getprop("/fdm/jsbsim/aero/alpha-deg");
flaps = getprop("/controls/flight/flap-pos");
if (flaps == 0) {
alphaProt = 9.5;
} else if (flaps == 1 or flaps == 2 or flaps == 3) {
alphaProt = 15.0;
} else if (flaps == 4) {
alphaProt = 14.0;
} else if (flaps == 5) {
alphaProt = 13.0;
}
togaLock = alphaProt - 1;
if (getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0 and getprop("/it-fbw/law") == 0 and (getprop("/systems/thrust/eng-out") == 0 or (getprop("/systems/thrust/eng-out") == 1 and flaps == 0)) and getprop("/systems/fadec/n1mode1") == 0
and getprop("/systems/fadec/n1mode2") == 0) {
if (alpha > alphaProt and getprop("/position/gear-agl-ft") >= 100) {
setprop("/systems/thrust/alpha-floor", 1);
setprop("/systems/thrust/toga-lk", 0);
setprop("/it-autoflight/input/athr", 1);
} else if (getprop("/systems/thrust/alpha-floor") == 1 and alpha < togaLock) {
setprop("/systems/thrust/alpha-floor", 0);
setprop("/it-autoflight/input/athr", 1);
setprop("/systems/thrust/toga-lk", 1);
}
} else {
setprop("/systems/thrust/alpha-floor", 0);
setprop("/systems/thrust/toga-lk", 0);
}
});
var unflex = func {
@ -262,7 +296,7 @@ var unflex = func {
}
}
var thrust_loop = func {
var thrust_flash = maketimer(0.5, func {
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
@ -296,35 +330,4 @@ var thrust_loop = func {
setprop("/systems/thrust/lvrclb", 0);
}
}
alpha = getprop("/fdm/jsbsim/aero/alpha-deg");
flaps = getprop("/controls/flight/flap-pos");
if (flaps == 0) {
alphaProt = 9.5;
} else if (flaps == 1 or flaps == 2 or flaps == 3) {
alphaProt = 15.0;
} else if (flaps == 4) {
alphaProt = 14.0;
} else if (flaps == 5) {
alphaProt = 13.0;
}
togaLock = alphaProt - 1;
if (getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0 and getprop("/it-fbw/law") == 0 and (getprop("/systems/thrust/eng-out") == 0 or (getprop("/systems/thrust/eng-out") == 1 and flaps == 0)) and getprop("/systems/fadec/n1mode1") == 0
and getprop("/systems/fadec/n1mode2") == 0) {
if (alpha > alphaProt and getprop("/position/gear-agl-ft") >= 100) {
setprop("/systems/thrust/alpha-floor", 1);
setprop("/systems/thrust/toga-lk", 0);
setprop("/it-autoflight/input/athr", 1);
} else if (getprop("/systems/thrust/alpha-floor") == 1 and alpha < togaLock) {
setprop("/systems/thrust/alpha-floor", 0);
setprop("/it-autoflight/input/athr", 1);
setprop("/systems/thrust/toga-lk", 1);
}
} else {
setprop("/systems/thrust/alpha-floor", 0);
setprop("/systems/thrust/toga-lk", 0);
}
}
# Timers
var thrustt = maketimer(0.5, thrust_loop);
});

View file

@ -21,12 +21,10 @@ setprop("/systems/fadec/eng2/ff", 1);
setprop("/systems/fadec/power-avail", 0);
setprop("/systems/fadec/powered1", 0);
setprop("/systems/fadec/powered2", 0);
setprop("/systems/fadec/powered-time", 0);
setprop("/systems/fadec/powerup", 0);
setlistener("/sim/signals/fdm-initialized", func {
fadecLoop.start();
});
var fadecLoop = maketimer(0.7, func {
var fadecLoop = func {
var ac1 = getprop("/systems/electrical/bus/ac1");
var ac2 = getprop("/systems/electrical/bus/ac2");
var acess = getprop("/systems/electrical/bus/ac-ess");
@ -39,13 +37,24 @@ var fadecLoop = maketimer(0.7, func {
var N1Mode2_sw = getprop("/controls/fadec/n1mode2");
if (ac1 >= 110 or ac2 >= 110 or acess >= 110) {
setprop("/systems/fadec/power-avail", 1);
if (getprop("/systems/fadec/power-avail") != 1) {
setprop("/systems/fadec/powered-time", getprop("/sim/time/elapsed-sec"));
setprop("/systems/fadec/power-avail", 1);
}
} else {
setprop("/systems/fadec/power-avail", 0);
if (getprop("/systems/fadec/power-avail") != 0) {
setprop("/systems/fadec/power-avail", 0);
}
}
var powerAvail = getprop("/systems/fadec/power-avail");
if (getprop("/systems/fadec/powered-time") + 300 >= getprop("/sim/time/elapsed-sec")) {
setprop("/systems/fadec/powerup", 1);
} else {
setprop("/systems/fadec/powerup", 0);
}
if (state1 == 3) {
setprop("/systems/fadec/powered1", 1);
} else if (powerAvail and modeSel == 2) {
@ -62,6 +71,18 @@ var fadecLoop = maketimer(0.7, func {
setprop("/systems/fadec/powered2", 0);
}
if (N1Mode1_sw == 1) {
setprop("/systems/fadec/n1mode1", 1);
} else {
setprop("/systems/fadec/n1mode1", 0);
}
if (N1Mode2_sw == 1) {
setprop("/systems/fadec/n1mode2", 1);
} else {
setprop("/systems/fadec/n1mode2", 0);
}
var powered1 = getprop("/systems/fadec/powered1");
var powered2 = getprop("/systems/fadec/powered2");
var N1Mode1 = getprop("/systems/fadec/n1mode1");
@ -71,19 +92,19 @@ var fadecLoop = maketimer(0.7, func {
var N21 = getprop("/engines/engine[0]/n2-actual");
var N22 = getprop("/engines/engine[1]/n2-actual");
if (powered1 and N1Mode1 == 0) {
if ((powered1 or getprop("/systems/fadec/powerup")) and N1Mode1 == 0) {
setprop("/systems/fadec/eng1/epr", 1);
} else {
setprop("/systems/fadec/eng1/epr", 0);
}
if (powered2 and N1Mode2 == 0) {
if ((powered2 or getprop("/systems/fadec/powerup")) and N1Mode2 == 0) {
setprop("/systems/fadec/eng2/epr", 1);
} else {
setprop("/systems/fadec/eng2/epr", 0);
}
if (powered1) {
if (powered1 or getprop("/systems/fadec/powerup")) {
setprop("/systems/fadec/eng1/egt", 1);
setprop("/systems/fadec/eng1/ff", 1);
} else {
@ -91,7 +112,7 @@ var fadecLoop = maketimer(0.7, func {
setprop("/systems/fadec/eng1/ff", 0);
}
if (powered2) {
if (powered2 or getprop("/systems/fadec/powerup")) {
setprop("/systems/fadec/eng2/egt", 1);
setprop("/systems/fadec/eng2/ff", 1);
} else {
@ -122,16 +143,4 @@ var fadecLoop = maketimer(0.7, func {
} else {
setprop("/systems/fadec/eng2/n2", 0);
}
if (N1Mode1_sw == 1) {
setprop("/systems/fadec/n1mode1", 1);
} else {
setprop("/systems/fadec/n1mode1", 0);
}
if (N1Mode2_sw == 1) {
setprop("/systems/fadec/n1mode2", 1);
} else {
setprop("/systems/fadec/n1mode2", 0);
}
});
}

View file

@ -204,6 +204,7 @@ var systemsLoop = maketimer(0.1, func {
systems.FUEL.loop();
systems.ADIRS.loop();
libraries.ECAM.loop();
fadec.fadecLoop();
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);

View file

@ -1 +1 @@
4205
4206