From 2b38f150c95c8c0df18437b469e9798852c4764b Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Thu, 2 Nov 2017 10:09:59 -0400 Subject: [PATCH] A3XX: FADEC Improvement --- Models/Instruments/PFD/PFD1.xml | 18 ++++++++++-------- Models/Instruments/PFD/PFD2.xml | 18 ++++++++++-------- Nasal/PFD_FMA.nas | 4 +++- Nasal/fadec-common.nas | 28 ++++++++++++++-------------- revision.txt | 2 +- 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Models/Instruments/PFD/PFD1.xml b/Models/Instruments/PFD/PFD1.xml index c44256ea..89d00d95 100644 --- a/Models/Instruments/PFD/PFD1.xml +++ b/Models/Instruments/PFD/PFD1.xml @@ -2198,14 +2198,16 @@ 1 - - modes/pfd/fma/pitch-mode-armed - - - - modes/pfd/fma/pitch-mode2-armed - - + + + modes/pfd/fma/pitch-mode-armed + + + + modes/pfd/fma/pitch-mode2-armed + + + diff --git a/Models/Instruments/PFD/PFD2.xml b/Models/Instruments/PFD/PFD2.xml index b097cb01..05f96296 100644 --- a/Models/Instruments/PFD/PFD2.xml +++ b/Models/Instruments/PFD/PFD2.xml @@ -2198,14 +2198,16 @@ 1 - - modes/pfd/fma/pitch-mode-armed - - - - modes/pfd/fma/pitch-mode2-armed - - + + + modes/pfd/fma/pitch-mode-armed + + + + modes/pfd/fma/pitch-mode2-armed + + + diff --git a/Nasal/PFD_FMA.nas b/Nasal/PFD_FMA.nas index c6a8425d..82a00171 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/PFD_FMA.nas @@ -107,7 +107,9 @@ var loopFMA = maketimer(0.05, func { var thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); var thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); var wow = getprop("/gear/gear[0]/wow"); - if ((state1 == "TOGA" or state2 == "TOGA") or (flx == 1 and (state1 == "MCT" or state2 == "MCT")) or (flx == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)))) { + var engstate1 = getprop("/engines/engine[0]/state"); + var engstate2 = getprop("/engines/engine[1]/state"); + if (((state1 == "TOGA" or state2 == "TOGA") or (flx == 1 and (state1 == "MCT" or state2 == "MCT")) or (flx == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)))) and (engstate1 == 3 or engstate2 == 3)) { # RWY Engagement would go here, but automatic ILS selection is not simulated yet. if (wow and getprop("/FMGC/internal/v2-set") == 1 and getprop("/it-autoflight/output/vert") != 7) { setprop("/it-autoflight/input/vert", 7); diff --git a/Nasal/fadec-common.nas b/Nasal/fadec-common.nas index 7d4fc185..777b6983 100644 --- a/Nasal/fadec-common.nas +++ b/Nasal/fadec-common.nas @@ -35,6 +35,8 @@ setlistener("/sim/signals/fdm-initialized", func { var thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); var state1 = getprop("/systems/thrust/state1"); var state2 = getprop("/systems/thrust/state2"); + var engstate1 = getprop("/engines/engine[0]/state"); + var engstate2 = getprop("/engines/engine[1]/state"); var eprtoga = getprop("/systems/thrust/epr/toga-lim"); var eprmct = getprop("/systems/thrust/epr/mct-lim"); var eprflx = getprop("/systems/thrust/epr/flx-lim"); @@ -50,6 +52,8 @@ setlistener("/sim/signals/fdm-initialized", func { }); setlistener("/controls/engines/engine[0]/throttle-pos", func { + engstate1 = getprop("/engines/engine[0]/state"); + engstate2 = getprop("/engines/engine[1]/state"); thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); if (getprop("/systems/thrust/alpha-floor") == 0 and getprop("/systems/thrust/toga-lk") == 0) { if (thr1 < 0.01) { @@ -66,23 +70,20 @@ setlistener("/controls/engines/engine[0]/throttle-pos", func { setprop("/systems/thrust/state1", "MAN THR"); unflex(); } else if (thr1 >= 0.78 and thr1 < 0.83) { - if (getprop("/gear/gear[0]/wow") == 1) { - setprop("/it-autoflight/input/athr", 1); - } if (getprop("/controls/engines/thrust-limit") == "FLX") { + if (getprop("/gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) { + setprop("/it-autoflight/input/athr", 1); + } setprop("/controls/engines/engine[0]/throttle-fdm", 0.99); } else { setprop("/controls/engines/engine[0]/throttle-fdm", 0.95); } setprop("/systems/thrust/state1", "MCT"); } else if (thr1 >= 0.83 and thr1 < 0.95) { - if (getprop("/gear/gear[0]/wow") == 1) { - setprop("/it-autoflight/input/athr", 1); - } setprop("/systems/thrust/state1", "MAN THR"); unflex(); } else if (thr1 >= 0.95) { - if (getprop("/gear/gear[0]/wow") == 1) { + if (getprop("/gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) { setprop("/it-autoflight/input/athr", 1); } setprop("/controls/engines/engine[0]/throttle-fdm", 0.99); @@ -110,6 +111,8 @@ setlistener("/controls/engines/engine[0]/throttle-pos", func { }); setlistener("/controls/engines/engine[1]/throttle-pos", func { + engstate1 = getprop("/engines/engine[0]/state"); + engstate2 = getprop("/engines/engine[1]/state"); thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); if (getprop("/systems/thrust/alpha-floor") == 0 and getprop("/systems/thrust/toga-lk") == 0) { if (thr2 < 0.01) { @@ -126,23 +129,20 @@ setlistener("/controls/engines/engine[1]/throttle-pos", func { setprop("/systems/thrust/state2", "MAN THR"); unflex(); } else if (thr2 >= 0.78 and thr2 < 0.83) { - if (getprop("/gear/gear[0]/wow") == 1) { - setprop("/it-autoflight/input/athr", 1); - } if (getprop("/controls/engines/thrust-limit") == "FLX") { + if (getprop("/gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) { + setprop("/it-autoflight/input/athr", 1); + } setprop("/controls/engines/engine[1]/throttle-fdm", 0.99); } else { setprop("/controls/engines/engine[1]/throttle-fdm", 0.95); } setprop("/systems/thrust/state2", "MCT"); } else if (thr2 >= 0.83 and thr2 < 0.95) { - if (getprop("/gear/gear[0]/wow") == 1) { - setprop("/it-autoflight/input/athr", 1); - } setprop("/systems/thrust/state2", "MAN THR"); unflex(); } else if (thr2 >= 0.95) { - if (getprop("/gear/gear[0]/wow") == 1) { + if (getprop("/gear/gear[0]/wow") == 1 and (engstate1 == 3 or engstate2 == 3)) { setprop("/it-autoflight/input/athr", 1); } setprop("/controls/engines/engine[1]/throttle-fdm", 0.99); diff --git a/revision.txt b/revision.txt index 927e0797..af63525c 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -3041 \ No newline at end of file +3042 \ No newline at end of file