From 5463545e313d350745f15eb0c47f451f2086f5fe Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Mon, 5 Jun 2017 21:45:41 -0400 Subject: [PATCH] A3XX: FMA and FMGC Logic Update FMA: Fix Boxes not appearing when AP/FD engages from all off FMA: Fix a few minor bugs/issues FMGC: Add smarter AP state logic FMGC: Add box control logic --- A320-main.xml | 2 +- Models/Instruments/PFD/PFD1.xml | 72 ++++++++- Models/Instruments/PFD/PFD2.xml | 72 ++++++++- Models/Liveries/A320/IAE/N531JL.xml | 2 +- Nasal/FMGC.nas | 27 ++++ Nasal/PFD_FMA.nas | 59 ++++++++ Nasal/{thrust.nas => fadec.nas} | 0 Systems/it-fbw-b.xml | 174 +++++++++++++++++++++- Systems/it-fbw.xml | 7 +- Systems/libraries.xml | 218 ++++++++++++++-------------- 10 files changed, 509 insertions(+), 124 deletions(-) rename Nasal/{thrust.nas => fadec.nas} (100%) diff --git a/A320-main.xml b/A320-main.xml index 5ab54473..5d0a042c 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -735,7 +735,7 @@ Aircraft/A320Family/Nasal/ADIRS.nas - Aircraft/A320Family/Nasal/thrust.nas + Aircraft/A320Family/Nasal/fadec.nas Aircraft/A320Family/Nasal/it-fbw.nas diff --git a/Models/Instruments/PFD/PFD1.xml b/Models/Instruments/PFD/PFD1.xml index af922ecc..8b0802dc 100644 --- a/Models/Instruments/PFD/PFD1.xml +++ b/Models/Instruments/PFD/PFD1.xml @@ -207,6 +207,34 @@ + + select + pitch-mode-box + pitch-mode-armed-box + roll-mode-box + roll-mode-armed-box + + + + /it-autoflight/output/fd1 + 1 + + + /it-autoflight/output/fd2 + 1 + + + /it-autoflight/output/ap1 + 1 + + + /it-autoflight/output/ap2 + 1 + + + + + select rudder_bar @@ -1594,10 +1622,46 @@ select throttle-mode-box - - /modes/pfd/fma/throttle-mode-box - 1 - + + + /modes/pfd/fma/throttle-mode-box + 1 + + + /systems/thrust/state1 + MAN THR + + + /systems/thrust/state2 + MAN THR + + + /systems/thrust/state1 + MCT + + + /systems/thrust/state2 + MCT + + + /systems/thrust/state1 + TOGA + + + /systems/thrust/state2 + TOGA + + + + /systems/thrust/state1 + IDLE + + + /systems/thrust/state2 + IDLE + + + diff --git a/Models/Instruments/PFD/PFD2.xml b/Models/Instruments/PFD/PFD2.xml index 8a420242..35ef74ea 100644 --- a/Models/Instruments/PFD/PFD2.xml +++ b/Models/Instruments/PFD/PFD2.xml @@ -207,6 +207,34 @@ + + select + pitch-mode-box + pitch-mode-armed-box + roll-mode-box + roll-mode-armed-box + + + + /it-autoflight/output/fd1 + 1 + + + /it-autoflight/output/fd2 + 1 + + + /it-autoflight/output/ap1 + 1 + + + /it-autoflight/output/ap2 + 1 + + + + + select rudder_bar @@ -1594,10 +1622,46 @@ select throttle-mode-box - - /modes/pfd/fma/throttle-mode-box - 1 - + + + /modes/pfd/fma/throttle-mode-box + 1 + + + /systems/thrust/state1 + MAN THR + + + /systems/thrust/state2 + MAN THR + + + /systems/thrust/state1 + MCT + + + /systems/thrust/state2 + MCT + + + /systems/thrust/state1 + TOGA + + + /systems/thrust/state2 + TOGA + + + + /systems/thrust/state1 + IDLE + + + /systems/thrust/state2 + IDLE + + + diff --git a/Models/Liveries/A320/IAE/N531JL.xml b/Models/Liveries/A320/IAE/N531JL.xml index 5b5a48bf..4beb96e1 100644 --- a/Models/Liveries/A320/IAE/N531JL.xml +++ b/Models/Liveries/A320/IAE/N531JL.xml @@ -4,7 +4,7 @@ - jetBlue (Blue Finest) + JetBlue (Blue Finest) Liveries/A320/IAE/N531JL.png diff --git a/Nasal/FMGC.nas b/Nasal/FMGC.nas index f6768efc..1cf0b528 100644 --- a/Nasal/FMGC.nas +++ b/Nasal/FMGC.nas @@ -14,6 +14,7 @@ setprop("/FMGC/internal/mng-kts-mach", 0); setprop("/FMGC/internal/mach-switchover", 0); setprop("/it-autoflight/settings/reduc-agl-ft", 3000); setprop("/it-autoflight/internal/vert-speed-fpm", 0); +setprop("/it-autoflight/output/fma-pwr", 0); var FMGCinit = func { setprop("/FMGC/status/to-state", 0); @@ -340,6 +341,7 @@ var APinit = func { setprop("/it-autoflight/output/thr-mode", 2); setprop("/it-autoflight/output/lat", 5); setprop("/it-autoflight/output/vert", 7); + setprop("/it-autoflight/output/fma-pwr", 0); setprop("/it-autoflight/settings/use-nav2-radio", 0); setprop("/it-autoflight/settings/use-backcourse", 0); setprop("/it-autoflight/internal/min-vs", -500); @@ -363,6 +365,7 @@ setlistener("/it-autoflight/input/ap1", func { var apmas = getprop("/it-autoflight/input/ap1"); var ac_ess = getprop("/systems/electrical/bus/ac-ess"); if (apmas == 0) { + fmabox(); setprop("/it-autoflight/output/ap1", 0); if (getprop("/it-autoflight/sound/enableapoffsound") == 1) { setprop("/it-autoflight/sound/apoffsound", 1); @@ -370,6 +373,7 @@ setlistener("/it-autoflight/input/ap1", func { } } else if (apmas == 1 and ac_ess >= 110) { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { + fmabox(); setprop("/it-autoflight/output/ap1", 1); setprop("/it-autoflight/sound/enableapoffsound", 1); setprop("/it-autoflight/sound/apoffsound", 0); @@ -382,6 +386,7 @@ setlistener("/it-autoflight/input/ap2", func { var apmas = getprop("/it-autoflight/input/ap2"); var ac_ess = getprop("/systems/electrical/bus/ac-ess"); if (apmas == 0) { + fmabox(); setprop("/it-autoflight/output/ap2", 0); if (getprop("/it-autoflight/sound/enableapoffsound2") == 1) { setprop("/it-autoflight/sound/apoffsound2", 1); @@ -389,6 +394,7 @@ setlistener("/it-autoflight/input/ap2", func { } } else if (apmas == 1 and ac_ess >= 110) { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { + fmabox(); setprop("/it-autoflight/output/ap2", 1); setprop("/it-autoflight/sound/enableapoffsound2", 1); setprop("/it-autoflight/sound/apoffsound2", 0); @@ -411,8 +417,10 @@ setlistener("/it-autoflight/input/athr", func { setlistener("/it-autoflight/input/fd1", func { var fdmas = getprop("/it-autoflight/input/fd1"); if (fdmas == 0) { + fmabox(); setprop("/it-autoflight/output/fd1", 0); } else if (fdmas == 1) { + fmabox(); setprop("/it-autoflight/output/fd1", 1); } }); @@ -421,12 +429,31 @@ setlistener("/it-autoflight/input/fd1", func { setlistener("/it-autoflight/input/fd2", func { var fdmas = getprop("/it-autoflight/input/fd2"); if (fdmas == 0) { + fmabox(); setprop("/it-autoflight/output/fd2", 0); } else if (fdmas == 1) { + fmabox(); setprop("/it-autoflight/output/fd2", 1); } }); +# FMA Boxes and Mode +var fmabox = func { + var ap1 = getprop("/it-autoflight/output/ap1"); + var ap2 = getprop("/it-autoflight/output/ap2"); + var fd1 = getprop("/it-autoflight/output/fd1"); + var fd2 = getprop("/it-autoflight/output/fd2"); + if (!ap1 and !ap2 and !fd1 and !fd2) { + setprop("/it-autoflight/input/lat", 3); + setprop("/it-autoflight/input/vert", 1); + setprop("/it-autoflight/input/vs", 0); + setprop("/it-autoflight/output/fma-pwr", 0); + } else { + setprop("/it-autoflight/input/vs", 0); + setprop("/it-autoflight/output/fma-pwr", 1); + } +} + # Master Lateral setlistener("/it-autoflight/input/lat", func { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { diff --git a/Nasal/PFD_FMA.nas b/Nasal/PFD_FMA.nas index 023c0953..fe944f96 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/PFD_FMA.nas @@ -244,20 +244,79 @@ var at = func { } } +var boxchk = func { + var ap1 = getprop("/it-autoflight/output/ap1"); + var ap2 = getprop("/it-autoflight/output/ap2"); + var fd1 = getprop("/it-autoflight/output/fd1"); + var fd2 = getprop("/it-autoflight/output/fd2"); + var fma_pwr = getprop("/it-autoflight/output/fma-pwr"); + if (ap1 and !ap2 and !fd1 and !fd2 and !fma_pwr) { + setprop("/it-autoflight/input/lat", 3); + boxchk_b(); + } else if (!ap1 and ap2 and !fd1 and !fd2 and !fma_pwr) { + setprop("/it-autoflight/input/lat", 3); + boxchk_b(); + } else if (!ap1 and !ap2 and fd1 and !fd2 and !fma_pwr) { + setprop("/it-autoflight/input/lat", 3); + boxchk_b(); + } else if (!ap1 and !ap2 and !fd1 and fd2 and !fma_pwr) { + setprop("/it-autoflight/input/lat", 3); + boxchk_b(); + } +} + +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 newarmr = getprop("/modes/pfd/fma/roll-mode-armed"); + if (newarmr != " ") { + setprop("/modes/pfd/fma/roll-mode-armed-box", 1); + settimer(func { + setprop("/modes/pfd/fma/roll-mode-armed-box", 0); + }, 5); + } + var newarmp = getprop("/modes/pfd/fma/pitch-mode-armed"); + if (newarmp != " ") { + setprop("/modes/pfd/fma/pitch-mode-armed-box", 1); + settimer(func { + setprop("/modes/pfd/fma/pitch-mode-armed-box", 0); + }, 5); + } + var newarmp2 = getprop("/modes/pfd/fma/pitch-mode2-armed"); + if (newarmp2 != " ") { + setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1); + settimer(func { + setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0); + }, 5); + } +} + # Update AP FD ATHR setlistener("/it-autoflight/output/ap1", func { + speedmach(); ap(); + boxchk(); }); setlistener("/it-autoflight/output/ap2", func { + speedmach(); ap(); + boxchk(); }); setlistener("/it-autoflight/output/fd1", func { speedmach(); fd(); + boxchk(); }); setlistener("/it-autoflight/output/fd2", func { speedmach(); fd(); + boxchk(); }); setlistener("/it-autoflight/output/athr", func { at(); diff --git a/Nasal/thrust.nas b/Nasal/fadec.nas similarity index 100% rename from Nasal/thrust.nas rename to Nasal/fadec.nas diff --git a/Systems/it-fbw-b.xml b/Systems/it-fbw-b.xml index 70a8c9d5..0878ee34 100644 --- a/Systems/it-fbw-b.xml +++ b/Systems/it-fbw-b.xml @@ -261,7 +261,7 @@ 0 - /it-fbw/alpha-hld + /it-fbw/spd-hold 0 @@ -298,6 +298,178 @@ + + IT-FBW: SPD PITCH TARGET CMD + noise-spike + + + + + /it-autoflight/output/ap1 + 0 + + + /it-autoflight/output/ap2 + 0 + + + /gear/gear[1]/wow + 0 + + + /gear/gear[2]/wow + 0 + + + /it-fbw/spd-hold + 1 + + + + /it-fbw/law + 0 + + + /it-fbw/law + 1 + + + + + + + + + /controls/flight/elevator-input + 0129 + -1106 +
+
+ + /it-fbw/spd-pitch-target + 10 +
+ + + IT-FBW: SPD PITCH TARGET + false + + + + + /it-autoflight/output/ap1 + 0 + + + /it-autoflight/output/ap2 + 0 + + + /gear/gear[1]/wow + 0 + + + /gear/gear[2]/wow + 0 + + + /it-fbw/spd-hold + 1 + + + + /it-fbw/law + 0 + + + /it-fbw/law + 1 + + + + + + + /it-autoflight/internal/lookahead-10-sec-airspeed-kt + + + /it-fbw/spd-pitch-target + + + /it-fbw/spd-pitch-deg + + + -0.50 + 1.0 + 0.1 + 0.0 + 5.0 + 0.0001 + -10 + 20 + + + + + IT-FBW: SPD PITCH + false + + + + + /it-autoflight/output/ap1 + 0 + + + /it-autoflight/output/ap2 + 0 + + + /gear/gear[1]/wow + 0 + + + /gear/gear[2]/wow + 0 + + + /it-fbw/spd-hold + 1 + + + + /it-fbw/law + 0 + + + /it-fbw/law + 1 + + + + + + + /orientation/pitch-deg + + + /it-fbw/spd-pitch-deg + + + /controls/flight/elevator-fbw-cmd + + + -0.08 + 1 + 0.1 + 0 + 5 + 0.001 + -1 + 1 + + + IT-FBW: PITCH OPTION false diff --git a/Systems/it-fbw.xml b/Systems/it-fbw.xml index 162aeb83..01080a78 100644 --- a/Systems/it-fbw.xml +++ b/Systems/it-fbw.xml @@ -8,8 +8,7 @@ /it-fbw/roll-lim-min /it-fbw/pitch-lim-max /it-fbw/pitch-lim-min - /it-fbw/alpha-max - /it-fbw/alpha-min + /it-fbw/spd-hold @@ -81,6 +80,10 @@ /gear/gear[0]/wow 0 + + /it-fbw/spd-hold + 0 + /it-fbw/law diff --git a/Systems/libraries.xml b/Systems/libraries.xml index 7f6fa2fd..b59dd216 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -2,112 +2,111 @@ - - Flex Derate - gain - 1 - 0.05 - - - + + Flex Derate + gain + 1 + 0.05 + + +
/FMGC/internal/flex-cmd - 00.00 - 700.12 -
-
- + 00.00 + 700.12 + + + /engines/flex-derate -
- - - FF 1 - gain - 1 - 0.05 - - - - /engines/engine[0]/fuel-flow_pph - 0 0 - 2000 2387 - 900013847 -
-
- +
+ + + FF 1 + gain + 1 + 0.05 + + + + /engines/engine[0]/fuel-flow_pph + 0 0 + 2000 2387 + 900013847 +
+
+ /engines/engine[0]/fuel-flow_actual -
- - - FF 2 - gain - 1 - 0.05 - - - - /engines/engine[1]/fuel-flow_pph - 0 0 - 2000 2359 - 900013831 -
-
- +
+ + + FF 2 + gain + 1 + 0.05 + + + + /engines/engine[1]/fuel-flow_pph + 0 0 + 2000 2359 + 900013831 +
+
+ /engines/engine[1]/fuel-flow_actual -
- - - Altitude PFD - gain - 1 - 0.05 - - + + + + Altitude PFD + gain + 1 + 0.05 + +
/instrumentation/altimeter/indicated-altitude-ft 100
-
- + + /instrumentation/altimeter/indicated-altitude-ft-pfd -
- +
+ - V/S PFD - noise-spike - 0.05 - - + V/S PFD + noise-spike + 0.05 + +
/it-autoflight/internal/vert-speed-fpm 100
-
- +
+ /it-autoflight/internal/vert-speed-fpm-pfd 50 -
- + + - V/S 2 PFD - noise-spike - 0.05 - + V/S 2 PFD + noise-spike + 0.05 + /it-autoflight/internal/vert-speed-fpm - + /it-autoflight/internal/vert-speed-fpm-filtered 5000 - - - - Throttle L - gain - 1 - 0.05 - + + + + Throttle L + gain + 1 + /controls/engines/engine[0]/reverser @@ -116,7 +115,7 @@ /controls/engines/engine[0]/throttle - + /controls/engines/engine[0]/reverser @@ -126,14 +125,13 @@ 0 /controls/engines/engine[0]/throttle-lever - - - - Throttle R - gain - 1 - 0.05 - + + + + Throttle R + gain + 1 + /controls/engines/engine[1]/reverser @@ -142,7 +140,7 @@ /controls/engines/engine[1]/throttle - + /controls/engines/engine[1]/reverser @@ -152,14 +150,13 @@ 0 /controls/engines/engine[1]/throttle-lever - - - - Throttle L - gain - 1 - 0.05 - + + + + Throttle L + gain + 1 + /controls/engines/engine[0]/reverser @@ -168,7 +165,7 @@ /controls/engines/engine[0]/throttle - + /controls/engines/engine[0]/reverser @@ -178,14 +175,13 @@ /controls/engines/engine[0]/throttle-rev /controls/engines/engine[0]/throttle-pos - - - - Throttle R - gain - 1 - 0.05 - + + + + Throttle R + gain + 1 + /controls/engines/engine[1]/reverser @@ -194,7 +190,7 @@ /controls/engines/engine[1]/throttle - + /controls/engines/engine[1]/reverser @@ -204,6 +200,6 @@ /controls/engines/engine[1]/throttle-rev /controls/engines/engine[1]/throttle-pos - +