From 4a062364e0dc55d3fbecd2894b959bce5f04af45 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 17 Sep 2017 15:22:36 -0400 Subject: [PATCH] A3XX: Simulate proper SRS RWY engagement --- Models/Instruments/PFD/PFD1.xml | 128 +++++++++++++++++++++++++++++++- Models/Instruments/PFD/PFD2.xml | 126 ++++++++++++++++++++++++++++++- Nasal/PFD_FMA.nas | 98 ++++++++++++++++-------- revision.txt | 2 +- 4 files changed, 321 insertions(+), 33 deletions(-) diff --git a/Models/Instruments/PFD/PFD1.xml b/Models/Instruments/PFD/PFD1.xml index 33233c3b..9eda1a17 100644 --- a/Models/Instruments/PFD/PFD1.xml +++ b/Models/Instruments/PFD/PFD1.xml @@ -270,15 +270,53 @@ select fd_roll - fd_pitch - it-autoflight/output/fd1 + it-autoflight/output/fd2 1 gear/gear[1]/wow gear/gear[2]/wow + gear/gear[3]/wowa + gear/gear[4]/wowa + + it-autoflight/custom/trk-fpa + 0 + + + orientation/roll-deg + 45 + + + orientation/roll-deg + -45 + + + + + + + select + fd_pitch + + + + it-autoflight/output/fd2 + 1 + + + + gear/gear[1]/wow + gear/gear[2]/wow + gear/gear[3]/wowa + gear/gear[4]/wowa + + + modes/pfd/fma/pitch-mode + SRS + + it-autoflight/custom/trk-fpa 0 @@ -323,6 +361,92 @@ + + select + pitch-mode-box + + + + + it-autoflight/output/fd1 + 1 + + + it-autoflight/output/fd2 + 1 + + + it-autoflight/output/ap1 + 1 + + + it-autoflight/output/ap2 + 1 + + + + modes/pfd/fma/pitch-mode + LAND + + + modes/pfd/fma/pitch-mode + FLARE + + + modes/pfd/fma/pitch-mode + ROLLOUT + + + modes/pfd/fma/pitch-mode + + + + + + + + select + roll-mode-box + + + + + it-autoflight/output/fd1 + 1 + + + it-autoflight/output/fd2 + 1 + + + it-autoflight/output/ap1 + 1 + + + it-autoflight/output/ap2 + 1 + + + + modes/pfd/fma/pitch-mode + LAND + + + modes/pfd/fma/pitch-mode + FLARE + + + modes/pfd/fma/pitch-mode + ROLLOUT + + + modes/pfd/fma/roll-mode + + + + + + select pitch-mode-box diff --git a/Models/Instruments/PFD/PFD2.xml b/Models/Instruments/PFD/PFD2.xml index d856d53c..fe6d5ccb 100644 --- a/Models/Instruments/PFD/PFD2.xml +++ b/Models/Instruments/PFD/PFD2.xml @@ -270,7 +270,6 @@ select fd_roll - fd_pitch @@ -279,6 +278,45 @@ gear/gear[1]/wow gear/gear[2]/wow + gear/gear[3]/wowa + gear/gear[4]/wowa + + it-autoflight/custom/trk-fpa + 0 + + + orientation/roll-deg + 45 + + + orientation/roll-deg + -45 + + + + + + + select + fd_pitch + + + + it-autoflight/output/fd2 + 1 + + + + gear/gear[1]/wow + gear/gear[2]/wow + gear/gear[3]/wowa + gear/gear[4]/wowa + + + modes/pfd/fma/pitch-mode + SRS + + it-autoflight/custom/trk-fpa 0 @@ -323,6 +361,92 @@ + + select + pitch-mode-box + + + + + it-autoflight/output/fd1 + 1 + + + it-autoflight/output/fd2 + 1 + + + it-autoflight/output/ap1 + 1 + + + it-autoflight/output/ap2 + 1 + + + + modes/pfd/fma/pitch-mode + LAND + + + modes/pfd/fma/pitch-mode + FLARE + + + modes/pfd/fma/pitch-mode + ROLLOUT + + + modes/pfd/fma/pitch-mode + + + + + + + + select + roll-mode-box + + + + + it-autoflight/output/fd1 + 1 + + + it-autoflight/output/fd2 + 1 + + + it-autoflight/output/ap1 + 1 + + + it-autoflight/output/ap2 + 1 + + + + modes/pfd/fma/pitch-mode + LAND + + + modes/pfd/fma/pitch-mode + FLARE + + + modes/pfd/fma/pitch-mode + ROLLOUT + + + modes/pfd/fma/roll-mode + + + + + + select pitch-mode-box diff --git a/Nasal/PFD_FMA.nas b/Nasal/PFD_FMA.nas index d0059aef..9d1490b2 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/PFD_FMA.nas @@ -9,11 +9,11 @@ setprop("/FMGC/internal/cruise-ft", 10000); setprop("/it-autoflight/internal/alt", 10000); setlistener("sim/signals/fdm-initialized", func { - speedmach.start(); + loopFMA.start(); }); # Master Thrust -var speedmach = maketimer(0.05, func { +var loopFMA = maketimer(0.05, func { var state1 = getprop("/systems/thrust/state1"); var state2 = getprop("/systems/thrust/state2"); var newthr = getprop("/modes/pfd/fma/throttle-mode"); @@ -32,11 +32,11 @@ var speedmach = maketimer(0.05, func { } else { if ((getprop("/it-autoflight/output/vert") == 4) or (getprop("/it-autoflight/output/vert") == 6) or (getprop("/it-autoflight/output/vert") == 7) or (getprop("/it-autoflight/output/vert") == 8)) { if (getprop("/it-autoflight/output/fd1") == 0 and getprop("/it-autoflight/output/fd2") == 0 and getprop("/it-autoflight/output/ap1") == 0 and getprop("/it-autoflight/output/ap2") == 0) { - speedmach_b(); + loopFMA_b(); } else { var thr = getprop("/it-autoflight/output/thr-mode"); if (thr == 0) { - speedmach_b(); + loopFMA_b(); } else if (thr == 1) { if (newthr != "THR IDLE") { setprop("/modes/pfd/fma/throttle-mode", "THR IDLE"); @@ -54,12 +54,47 @@ var speedmach = maketimer(0.05, func { } } } else { - speedmach_b(); + loopFMA_b(); + } + } + + # SRS RWY Engagement + var flx = getprop("/systems/thrust/lim-flex"); + var lat = getprop("/it-autoflight/mode/lat"); + var newlat = getprop("/modes/pfd/fma/roll-mode"); + var vert = getprop("/it-autoflight/mode/vert"); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + var newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed"); + var thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); + var thr2 = getprop("/controls/engines/engine[0]/throttle-pos"); + 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)))) { + if (lat == "T/O") { + if (newlat != "RWY") { + setprop("/modes/pfd/fma/roll-mode", "RWY"); + } + } + if (vert == "T/O CLB") { + if (newvert != "SRS") { + setprop("/modes/pfd/fma/pitch-mode", "SRS"); + } + } + } else { + var gear1 = getprop("/gear/gear[1]/wow"); + var gear2 = getprop("/gear/gear[2]/wow"); + if (lat == "T/O" and (gear1 or gear2)) { + if (newlat != " ") { + setprop("/modes/pfd/fma/roll-mode", " "); + } + } + if (vert == "T/O CLB" and (gear1 or gear2)) { + if (newvert != " ") { + setprop("/modes/pfd/fma/pitch-mode", " "); + } } } }); -var speedmach_b = func { +var loopFMA_b = func { var newthr = getprop("/modes/pfd/fma/throttle-mode"); if (getprop("/it-autoflight/input/kts-mach") == 0) { if (newthr != "SPEED") { @@ -111,10 +146,6 @@ setlistener("/it-autoflight/mode/lat", func { if (newlat != "LAND") { setprop("/modes/pfd/fma/roll-mode", "LAND"); } - } else if (lat == "T/O") { - if (newlat != "RWY") { - setprop("/modes/pfd/fma/roll-mode", "RWY"); - } } }); @@ -198,9 +229,6 @@ setlistener("/it-autoflight/mode/vert", func { setprop("/modes/pfd/fma/pitch-mode", "FLARE"); } } else if (vert == "T/O CLB") { - if (newvert != "SRS") { - setprop("/modes/pfd/fma/pitch-mode", "SRS"); - } if (newvertarm != "CLB") { setprop("/modes/pfd/fma/pitch-mode2-armed", "CLB"); } @@ -406,14 +434,20 @@ var boxchk = func { } var boxchk_b = func { - setprop("/modes/pfd/fma/roll-mode-box", 1); - setprop("/modes/pfd/fma/pitch-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/roll-mode-box", 0); - }, 5); - settimer(func { - setprop("/modes/pfd/fma/pitch-mode-box", 0); - }, 5); + var newlat = getprop("/modes/pfd/fma/roll-mode"); + if (newlat != " ") { + setprop("/modes/pfd/fma/roll-mode-box", 1); + settimer(func { + setprop("/modes/pfd/fma/roll-mode-box", 0); + }, 5); + } + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + if (newvert != " ") { + setprop("/modes/pfd/fma/pitch-mode-box", 1); + settimer(func { + setprop("/modes/pfd/fma/pitch-mode-box", 0); + }, 5); + } var newarmr = getprop("/modes/pfd/fma/roll-mode-armed"); if (newarmr != " ") { setprop("/modes/pfd/fma/roll-mode-armed-box", 1); @@ -502,17 +536,23 @@ setlistener("/modes/pfd/fma/throttle-mode", func { }); setlistener("/modes/pfd/fma/roll-mode", func { - setprop("/modes/pfd/fma/roll-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/roll-mode-box", 0); - }, 5); + var newlat = getprop("/modes/pfd/fma/roll-mode"); + if (newlat != " ") { + setprop("/modes/pfd/fma/roll-mode-box", 1); + settimer(func { + setprop("/modes/pfd/fma/roll-mode-box", 0); + }, 5); + } }); setlistener("/modes/pfd/fma/pitch-mode", func { - setprop("/modes/pfd/fma/pitch-mode-box", 1); - settimer(func { - setprop("/modes/pfd/fma/pitch-mode-box", 0); - }, 5); + var newvert = getprop("/modes/pfd/fma/pitch-mode"); + if (newvert != " ") { + setprop("/modes/pfd/fma/pitch-mode-box", 1); + settimer(func { + setprop("/modes/pfd/fma/pitch-mode-box", 0); + }, 5); + } }); setlistener("/modes/pfd/fma/roll-mode-armed", func { diff --git a/revision.txt b/revision.txt index 24ec8a0c..ae6f1163 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -1506 \ No newline at end of file +1507 \ No newline at end of file