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
This commit is contained in:
Joshua Davidson 2017-06-05 21:45:41 -04:00
parent af02081491
commit 5463545e31
10 changed files with 509 additions and 124 deletions

View file

@ -735,7 +735,7 @@
<file>Aircraft/A320Family/Nasal/ADIRS.nas</file>
</systems>
<thrust>
<file>Aircraft/A320Family/Nasal/thrust.nas</file>
<file>Aircraft/A320Family/Nasal/fadec.nas</file>
</thrust>
<fbw>
<file>Aircraft/A320Family/Nasal/it-fbw.nas</file>

View file

@ -207,6 +207,34 @@
</condition>
</animation>
<animation>
<type>select</type>
<object-name>pitch-mode-box</object-name>
<object-name>pitch-mode-armed-box</object-name>
<object-name>roll-mode-box</object-name>
<object-name>roll-mode-armed-box</object-name>
<condition>
<or>
<equals>
<property>/it-autoflight/output/fd1</property>
<value>1</value>
</equals>
<equals>
<property>/it-autoflight/output/fd2</property>
<value>1</value>
</equals>
<equals>
<property>/it-autoflight/output/ap1</property>
<value>1</value>
</equals>
<equals>
<property>/it-autoflight/output/ap2</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>rudder_bar</object-name>
@ -1594,10 +1622,46 @@
<type>select</type>
<object-name>throttle-mode-box</object-name>
<condition>
<equals>
<property>/modes/pfd/fma/throttle-mode-box</property>
<value>1</value>
</equals>
<and>
<equals>
<property>/modes/pfd/fma/throttle-mode-box</property>
<value>1</value>
</equals>
<not-equals>
<property>/systems/thrust/state1</property>
<value>MAN THR</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>MAN THR</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state1</property>
<value>MCT</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>MCT</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state1</property>
<value>TOGA</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>TOGA</value>
</not-equals>
<or>
<not-equals>
<property>/systems/thrust/state1</property>
<value>IDLE</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>IDLE</value>
</not-equals>
</or>
</and>
</condition>
</animation>

View file

@ -207,6 +207,34 @@
</condition>
</animation>
<animation>
<type>select</type>
<object-name>pitch-mode-box</object-name>
<object-name>pitch-mode-armed-box</object-name>
<object-name>roll-mode-box</object-name>
<object-name>roll-mode-armed-box</object-name>
<condition>
<or>
<equals>
<property>/it-autoflight/output/fd1</property>
<value>1</value>
</equals>
<equals>
<property>/it-autoflight/output/fd2</property>
<value>1</value>
</equals>
<equals>
<property>/it-autoflight/output/ap1</property>
<value>1</value>
</equals>
<equals>
<property>/it-autoflight/output/ap2</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>rudder_bar</object-name>
@ -1594,10 +1622,46 @@
<type>select</type>
<object-name>throttle-mode-box</object-name>
<condition>
<equals>
<property>/modes/pfd/fma/throttle-mode-box</property>
<value>1</value>
</equals>
<and>
<equals>
<property>/modes/pfd/fma/throttle-mode-box</property>
<value>1</value>
</equals>
<not-equals>
<property>/systems/thrust/state1</property>
<value>MAN THR</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>MAN THR</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state1</property>
<value>MCT</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>MCT</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state1</property>
<value>TOGA</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>TOGA</value>
</not-equals>
<or>
<not-equals>
<property>/systems/thrust/state1</property>
<value>IDLE</value>
</not-equals>
<not-equals>
<property>/systems/thrust/state2</property>
<value>IDLE</value>
</not-equals>
</or>
</and>
</condition>
</animation>

View file

@ -4,7 +4,7 @@
<sim>
<model>
<livery>
<name>jetBlue (Blue Finest)</name>
<name>JetBlue (Blue Finest)</name>
<texture>Liveries/A320/IAE/N531JL.png</texture>
</livery>
</model>

View file

@ -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)) {

View file

@ -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();

View file

@ -261,7 +261,7 @@
<value>0</value>
</equals>
<equals>
<property>/it-fbw/alpha-hld</property>
<property>/it-fbw/spd-hold</property>
<value>0</value>
</equals>
<or>
@ -298,6 +298,178 @@
</config>
</pid-controller>
<filter>
<name>IT-FBW: SPD PITCH TARGET CMD</name>
<type>noise-spike</type>
<enable>
<condition>
<and>
<equals>
<property>/it-autoflight/output/ap1</property>
<value>0</value>
</equals>
<equals>
<property>/it-autoflight/output/ap2</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[1]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[2]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/it-fbw/spd-hold</property>
<value>1</value>
</equals>
<or>
<equals>
<property>/it-fbw/law</property>
<value>0</value>
</equals>
<equals>
<property>/it-fbw/law</property>
<value>1</value>
</equals>
</or>
</and>
</condition>
</enable>
<input>
<expression>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind> 0</ind><dep>129</dep></entry>
<entry><ind>-1</ind><dep>106</dep></entry>
</table>
</expression>
</input>
<output>/it-fbw/spd-pitch-target</output>
<max-rate-of-change>10</max-rate-of-change>
</filter>
<pid-controller>
<name>IT-FBW: SPD PITCH TARGET</name>
<debug>false</debug>
<enable>
<condition>
<and>
<equals>
<property>/it-autoflight/output/ap1</property>
<value>0</value>
</equals>
<equals>
<property>/it-autoflight/output/ap2</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[1]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[2]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/it-fbw/spd-hold</property>
<value>1</value>
</equals>
<or>
<equals>
<property>/it-fbw/law</property>
<value>0</value>
</equals>
<equals>
<property>/it-fbw/law</property>
<value>1</value>
</equals>
</or>
</and>
</condition>
</enable>
<input>
<property>/it-autoflight/internal/lookahead-10-sec-airspeed-kt</property>
</input>
<reference>
<property>/it-fbw/spd-pitch-target</property>
</reference>
<output>
<property>/it-fbw/spd-pitch-deg</property>
</output>
<config>
<Kp>-0.50</Kp>
<beta>1.0</beta>
<alpha>0.1</alpha>
<gamma>0.0</gamma>
<Ti>5.0</Ti>
<Td>0.0001</Td>
<u_min>-10</u_min>
<u_max>20</u_max>
</config>
</pid-controller>
<pid-controller>
<name>IT-FBW: SPD PITCH</name>
<debug>false</debug>
<enable>
<condition>
<and>
<equals>
<property>/it-autoflight/output/ap1</property>
<value>0</value>
</equals>
<equals>
<property>/it-autoflight/output/ap2</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[1]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[2]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/it-fbw/spd-hold</property>
<value>1</value>
</equals>
<or>
<equals>
<property>/it-fbw/law</property>
<value>0</value>
</equals>
<equals>
<property>/it-fbw/law</property>
<value>1</value>
</equals>
</or>
</and>
</condition>
</enable>
<input>
<property>/orientation/pitch-deg</property>
</input>
<reference>
<property>/it-fbw/spd-pitch-deg</property>
</reference>
<output>
<property>/controls/flight/elevator-fbw-cmd</property>
</output>
<config>
<Kp>-0.08</Kp>
<beta>1</beta>
<alpha>0.1</alpha>
<gamma>0</gamma>
<Ti>5</Ti>
<Td>0.001</Td>
<u_min>-1</u_min>
<u_max>1</u_max>
</config>
</pid-controller>
<filter>
<name>IT-FBW: PITCH OPTION</name>
<debug>false</debug>

View file

@ -8,8 +8,7 @@
<property value="-33">/it-fbw/roll-lim-min</property>
<property value="30">/it-fbw/pitch-lim-max</property>
<property value="-15">/it-fbw/pitch-lim-min</property>
<property value="14">/it-fbw/alpha-max</property>
<property value="0">/it-fbw/alpha-min</property>
<property value="0">/it-fbw/spd-hold</property>
<channel name="FBW Aileron">
<fcs_function name="/it-fbw/roll-deg">
@ -81,6 +80,10 @@
<property>/gear/gear[0]/wow</property>
<value>0</value>
</eq>
<eq>
<property>/it-fbw/spd-hold</property>
<value>0</value>
</eq>
<or>
<eq>
<property>/it-fbw/law</property>

View file

@ -2,112 +2,111 @@
<PropertyList>
<filter>
<name>Flex Derate</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<filter>
<name>Flex Derate</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/FMGC/internal/flex-cmd</property>
<entry><ind> 0</ind><dep>0.00</dep></entry>
<entry><ind>70</ind><dep>0.12</dep></entry>
</table>
</expression>
</input>
<entry><ind> 0</ind><dep>0.00</dep></entry>
<entry><ind>70</ind><dep>0.12</dep></entry>
</table>
</expression>
</input>
<output>/engines/flex-derate</output>
</filter>
</filter>
<filter>
<name>FF 1</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/engines/engine[0]/fuel-flow_pph</property>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind>2000</ind><dep> 2387</dep></entry>
<entry><ind>9000</ind><dep>13847</dep></entry>
</table>
</expression>
</input>
<filter>
<name>FF 1</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/engines/engine[0]/fuel-flow_pph</property>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind>2000</ind><dep> 2387</dep></entry>
<entry><ind>9000</ind><dep>13847</dep></entry>
</table>
</expression>
</input>
<output>/engines/engine[0]/fuel-flow_actual</output>
</filter>
</filter>
<filter>
<name>FF 2</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/engines/engine[1]/fuel-flow_pph</property>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind>2000</ind><dep> 2359</dep></entry>
<entry><ind>9000</ind><dep>13831</dep></entry>
</table>
</expression>
</input>
<filter>
<name>FF 2</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/engines/engine[1]/fuel-flow_pph</property>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind>2000</ind><dep> 2359</dep></entry>
<entry><ind>9000</ind><dep>13831</dep></entry>
</table>
</expression>
</input>
<output>/engines/engine[1]/fuel-flow_actual</output>
</filter>
</filter>
<filter>
<name>Altitude PFD</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<filter>
<name>Altitude PFD</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<floor>
<div>
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
<value>100</value>
</div>
</floor>
</expression>
</input>
</expression>
</input>
<output>/instrumentation/altimeter/indicated-altitude-ft-pfd</output>
</filter>
</filter>
<filter>
<name>V/S PFD</name>
<type>noise-spike</type>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<name>V/S PFD</name>
<type>noise-spike</type>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<floor>
<div>
<property>/it-autoflight/internal/vert-speed-fpm</property>
<value>100</value>
</div>
</floor>
</expression>
</input>
</expression>
</input>
<output>/it-autoflight/internal/vert-speed-fpm-pfd</output>
<max-rate-of-change>50</max-rate-of-change>
</filter>
</filter>
<filter>
<name>V/S 2 PFD</name>
<type>noise-spike</type>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<name>V/S 2 PFD</name>
<type>noise-spike</type>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<property>/it-autoflight/internal/vert-speed-fpm</property>
</input>
</input>
<output>/it-autoflight/internal/vert-speed-fpm-filtered</output>
<max-rate-of-change>5000</max-rate-of-change>
</filter>
</filter>
<filter>
<name>Throttle L</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<filter>
<name>Throttle L</name>
<type>gain</type>
<gain>1</gain>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
@ -116,7 +115,7 @@
</condition>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
@ -126,14 +125,13 @@
<value>0</value>
</input>
<output>/controls/engines/engine[0]/throttle-lever</output>
</filter>
</filter>
<filter>
<name>Throttle R</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<filter>
<name>Throttle R</name>
<type>gain</type>
<gain>1</gain>
<input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
@ -142,7 +140,7 @@
</condition>
<property>/controls/engines/engine[1]/throttle</property>
</input>
<input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
@ -152,14 +150,13 @@
<value>0</value>
</input>
<output>/controls/engines/engine[1]/throttle-lever</output>
</filter>
</filter>
<filter>
<name>Throttle L</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<filter>
<name>Throttle L</name>
<type>gain</type>
<gain>1</gain>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
@ -168,7 +165,7 @@
</condition>
<property>/controls/engines/engine[0]/throttle</property>
</input>
<input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[0]/reverser</property>
@ -178,14 +175,13 @@
<property>/controls/engines/engine[0]/throttle-rev</property>
</input>
<output>/controls/engines/engine[0]/throttle-pos</output>
</filter>
</filter>
<filter>
<name>Throttle R</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<filter>
<name>Throttle R</name>
<type>gain</type>
<gain>1</gain>
<input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
@ -194,7 +190,7 @@
</condition>
<property>/controls/engines/engine[1]/throttle</property>
</input>
<input>
<input>
<condition>
<equals>
<property>/controls/engines/engine[1]/reverser</property>
@ -204,6 +200,6 @@
<property>/controls/engines/engine[1]/throttle-rev</property>
</input>
<output>/controls/engines/engine[1]/throttle-pos</output>
</filter>
</filter>
</PropertyList>