<?xml version="1.0"?>

<!--
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
-->

<!-- IT-AUTOFLIGHT -->

<PropertyList>

 <!-- =============================================================== -->
 <!-- Predictors                                                      -->
 <!-- =============================================================== -->
 
	<predict-simple>
		<name>HEADING 5 SECONDS AHEAD</name>
		<debug>false</debug>
		<input>
			<condition>
				<equals>
					<property>/it-autoflight/input/trk</property>
					<value>0</value>
				</equals>
			</condition>
			<property>/it-autoflight/internal/heading-deg</property>
		</input>
		<input>
			<condition>
				<equals>
					<property>/it-autoflight/input/trk</property>
					<value>1</value>
				</equals>
			</condition>
			<property>/it-autoflight/internal/track-deg</property>
		</input>
		<output>/it-autoflight/internal/heading-5-sec-ahead</output>
		<seconds>5.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>

	<predict-simple>
		<name>ALTITUDE 5 SECONDS AHEAD</name>
		<debug>false</debug>
		<input>/instrumentation/altimeter/indicated-altitude-ft</input>
		<output>/it-autoflight/internal/altitude-5-sec-ahead</output>
		<seconds>5.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>
	
	<predict-simple>
		<name>IAS 5 SECOND PREDICTOR</name>
		<debug>false</debug>
		<input>/instrumentation/airspeed-indicator/indicated-speed-kt</input>
		<output>/it-autoflight/internal/lookahead-5-sec-airspeed-kt</output>
		<seconds>5.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>

	<predict-simple>
		<name>IAS 10 SECOND PREDICTOR</name>
		<debug>false</debug>
		<input>/instrumentation/airspeed-indicator/indicated-speed-kt</input>
		<output>/it-autoflight/internal/lookahead-10-sec-airspeed-kt</output>
		<seconds>10.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>
	
	<predict-simple>
		<name>IAS 15 SECOND PREDICTOR</name>
		<debug>false</debug>
		<input>/instrumentation/airspeed-indicator/indicated-speed-kt</input>
		<output>/it-autoflight/internal/lookahead-15-sec-airspeed-kt</output>
		<seconds>15.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>
	
	<predict-simple>
		<name>MACH 5 SECOND PREDICTOR</name>
		<debug>false</debug>
		<input>/instrumentation/airspeed-indicator/indicated-mach</input>
		<output>/it-autoflight/internal/lookahead-5-sec-mach</output>
		<seconds>5.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>

	<predict-simple>
		<name>MACH 10 SECOND PREDICTOR</name>
		<debug>false</debug>
		<input>/instrumentation/airspeed-indicator/indicated-mach</input>
		<output>/it-autoflight/internal/lookahead-10-sec-mach</output>
		<seconds>10.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>
	
	<predict-simple>
		<name>MACH 15 SECOND PREDICTOR</name>
		<debug>false</debug>
		<input>/instrumentation/airspeed-indicator/indicated-mach</input>
		<output>/it-autoflight/internal/lookahead-15-sec-mach</output>
		<seconds>15.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>
  
 <!-- =============================================================== -->
 <!-- Autopilot Helpers/Calculators                                   -->
 <!-- =============================================================== -->

	<filter>
		<name>AUTOLAND FD FPM</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs type="double">0.05</update-interval-secs>
		<input> 
			<expression>
				<table>
					<property>/position/gear-agl-ft</property> 
					<entry><ind>100</ind><dep>-650</dep></entry>
					<entry><ind> 50</ind><dep>-500</dep></entry>
					<entry><ind> 45</ind><dep> -70</dep></entry>
				</table>
			</expression>
		</input>
		<output>/it-autoflight/internal/target-fpm-c2</output>
	</filter>
 
	<filter>
		<name>AUTOLAND FPM</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs type="double">0.05</update-interval-secs>
		<input> 
			<expression>
				<table>
					<property>/position/gear-agl-ft</property> 
					<entry><ind>100</ind><dep>-650</dep></entry>
					<entry><ind> 50</ind><dep>-500</dep></entry>
					<entry><ind> 40</ind><dep>-400</dep></entry>
					<entry><ind> 30</ind><dep>-300</dep></entry>
					<entry><ind> 20</ind><dep>-180</dep></entry>
					<entry><ind> 10</ind><dep>-100</dep></entry>
					<entry><ind>  5</ind><dep> -70</dep></entry>
				</table>
			</expression>
		</input>
		<output>/it-autoflight/internal/target-fpm-c</output>
	</filter>
 
	<filter>
		<name>FMGC MNG SPD</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs type="double">0.05</update-interval-secs>
		<input>
			<expression>
				<product>
					<value>266</value>
					<table>
						<property>/FMGC/internal/cost-index</property>
						<entry><ind>  0</ind><dep>1.00</dep></entry>
						<entry><ind>120</ind><dep>1.19</dep></entry>
					</table>
				</product>
			</expression>
		</input>
		<output>/FMGC/internal/mng-alt-spd</output>
	</filter>
	
	<filter>
		<name>FMGC MNG MACH</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs type="double">0.05</update-interval-secs>
		<input> 
			<expression>
				<product>
					<table>
						<property>/instrumentation/altimeter/indicated-altitude-ft</property>
						<entry><ind>20000</ind><dep>0.625</dep></entry>
						<entry><ind>42000</ind><dep>0.825</dep></entry>
					</table>
					<table>
						<property>/FMGC/internal/cost-index</property>
						<entry><ind>  0</ind><dep>0.97</dep></entry>
						<entry><ind>120</ind><dep>1.05</dep></entry>
					</table>
				</product>
			</expression>
		</input>
		<output>/FMGC/internal/mng-alt-mach</output>
	</filter>
	
	<filter>
		<name>FMGC Target IAS PFD</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs type="double">0.1</update-interval-secs>
		<input>
			<condition>
				<equals>
					<property>/it-autoflight/input/kts-mach</property>
					<value>0</value>
				</equals>
			</condition>
			<property>/it-autoflight/input/spd-kts</property>
		</input>
		<input>
			<condition>
				<equals>
					<property>/it-autoflight/input/kts-mach</property>
					<value>1</value>
				</equals>
			</condition>
			<expression>
				<product>
					<div>
						<property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
						<property>/instrumentation/airspeed-indicator/indicated-mach</property>
					</div>
					<property>/it-autoflight/input/spd-mach</property>
				</product>
			</expression>
		</input>
		<output>/FMGC/internal/target-ias-pfd</output>
	</filter>
 
	<filter>
		<name>KTS INPUT FILTER</name>
		<debug>false</debug>
		<feedback-if-disabled>true</feedback-if-disabled>
		<initialize-to>output</initialize-to>
		<input>
			<condition>
				<not-equals>
					<property>/it-autoflight/mode/vert</property>
					<value>T/O CLB</value>
				</not-equals>
			</condition>
			<property>/it-autoflight/input/spd-kts</property>
		</input>
		<input>
			<condition>
				<equals>
					<property>/it-autoflight/mode/vert</property>
					<value>T/O CLB</value>
				</equals>
			</condition>
			<property>/it-autoflight/settings/togaspd</property>
		</input>
		<output>/it-autoflight/internal/flch-kts</output>
		<type>noise-spike</type>
		<max-rate-of-change>
			<condition>
				<or>
					<and>
						<not-equals>
							<property>/it-autoflight/output/vert</property>
							<value>4</value>
						</not-equals>
						<not-equals>
							<property>/it-autoflight/output/vert</property>
							<value>7</value>
						</not-equals>
					</and>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>100</value>
		</max-rate-of-change>
		<max-rate-of-change>
			<condition>
				<and>
					<or>
						<equals>
							<property>/it-autoflight/output/vert</property>
							<value>4</value>
						</equals>
						<equals>
							<property>/it-autoflight/output/vert</property>
							<value>7</value>
						</equals>
					</or>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<value>5</value>
		</max-rate-of-change>
	</filter>
	
	<filter>
		<name>MACH INPUT FILTER</name>
		<debug>false</debug>
		<feedback-if-disabled>true</feedback-if-disabled>
		<initialize-to>output</initialize-to>
		<input>
			<property>/it-autoflight/input/spd-mach</property>
		</input>
		<output>/it-autoflight/internal/flch-mach</output>
		<type>noise-spike</type>
		<max-rate-of-change>
			<condition>
				<or>
					<not-equals>
						<property>/it-autoflight/output/vert</property>
						<value>4</value>
					</not-equals>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>1</value>
		</max-rate-of-change>
		<max-rate-of-change>
			<condition>
				<and>
					<equals>
						<property>/it-autoflight/output/vert</property>
						<value>4</value>
					</equals>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<value>0.05</value>
		</max-rate-of-change>
	</filter>
 
	<filter>
		<name>IAS SYNC</name>
		<type>gain</type>
		<gain>1.0</gain>
		<enable>
			<condition>
				<equals>
					<property>/it-autoflight/input/kts-mach</property>
					<value>1</value>
				</equals>
			</condition>
		</enable>
		<update-interval-secs type="double">0.5</update-interval-secs>
		<input>/instrumentation/airspeed-indicator/indicated-speed-kt</input>
		<output>/it-autoflight/input/spd-kts</output>
	</filter>
	
	<filter>
		<name>MACH SYNC</name>
		<type>gain</type>
		<gain>1.0</gain>
		<enable>
			<condition>
				<equals>
					<property>/it-autoflight/input/kts-mach</property>
					<value>0</value>
				</equals>
			</condition>
		</enable>
		<update-interval-secs type="double">0.5</update-interval-secs>
		<input>/instrumentation/airspeed-indicator/indicated-mach</input>
		<output>/it-autoflight/input/spd-mach</output>
	</filter>
	
	<filter>
		<name>HEADING DEG</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<property>/instrumentation/efis/mfd/true-north</property>
			</condition>
			<property>/orientation/heading-deg</property>
		</input>
		<input>
			<property>/orientation/heading-magnetic-deg</property>
		</input>
		<reference>0</reference>
		<output>/it-autoflight/internal/heading-deg</output>
		<output>/instrumentation/pfd/heading-deg</output>
	</filter>
	
	<filter>
		<name>TRACK DEG</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<property>/instrumentation/efis/mfd/true-north</property>
					<greater-than>
						<property>/velocities/groundspeed-kt</property>
						<value>1</value>
					</greater-than>
				</and>
			</condition>
			<property>/orientation/track-deg</property>
		</input>
		<input>
			<condition>
				<and>
					<not><property>/instrumentation/efis/mfd/true-north</property></not>
					<greater-than>
						<property>/velocities/groundspeed-kt</property>
						<value>1</value>
					</greater-than>
				</and>
			</condition>
			<property>/orientation/track-magnetic-deg</property>
		</input>
		<input>/instrumentation/pfd/heading-deg</input>
		<reference>0</reference>
		<output>/it-autoflight/internal/track-deg</output>
		<output>/instrumentation/pfd/track-deg</output>
	</filter>
	
	<filter>
		<name>LNAV ADVANCE</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<expression>
				<sum>
					<table>
						<property>/velocities/groundspeed-kt</property>
						<entry><ind>120</ind><dep>1.0</dep></entry>
						<entry><ind>400</ind><dep>1.2</dep></entry>
					</table>
					<table>
						<abs>
							<dif>
								<property>/autopilot/route-manager/wp[1]/true-bearing-deg</property>
								<property>/autopilot/route-manager/wp[0]/true-bearing-deg</property>
							</dif>
						</abs>
						<entry><ind>30</ind><dep>0.0</dep></entry>
						<entry><ind>70</ind><dep>1.0</dep></entry>
					</table>
				</sum>
			</expression>
		</input>
		<output>/it-autoflight/internal/lnav-advance-nm</output>
		<min>1.0</min>
		<max>5.0</max>
	</filter>
	
	<filter>
		<name>HEADING ERROR DEG</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<equals>
						<property>/it-autoflight/output/lat</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/it-autoflight/input/trk</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<property>/it-autoflight/input/hdg</property>
			<offset>
				<property>/it-autoflight/internal/heading-deg</property>
				<scale>-1.0</scale>
			</offset>
		</input>
		<input>
			<condition>
				<and>
					<equals>
						<property>/it-autoflight/output/lat</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/it-autoflight/input/trk</property>
						<value>1</value>
					</equals>
				</and>
			</condition>
			<property>/it-autoflight/input/hdg</property>
			<offset>
				<property>/it-autoflight/internal/track-deg</property>
				<scale>-1.0</scale>
			</offset>
		</input>
		<input>
			<condition>
				<equals>
					<property>/it-autoflight/output/lat</property>
					<value>1</value>
				</equals>
			</condition>
			<expression>
				<sum>
					<property>/autopilot/route-manager/wp[0]/true-bearing-deg</property>
					<product>
						<property>/autopilot/internal/drift-angle-deg</property>
						<value>-1</value>
					</product>
					<product>
						<property>/orientation/heading-deg</property>
						<value>-1</value>
					</product>
				</sum>
			</expression>
		</input>
		<input>
			<condition>
				<and>
					<not-equals>
						<property>/it-autoflight/output/lat</property>
						<value>0</value>
					</not-equals>
					<not-equals>
						<property>/it-autoflight/output/lat</property>
						<value>1</value>
					</not-equals>
				</and>
			</condition>
			<value>0</value>
		</input>
		<output>/it-autoflight/internal/heading-error-deg</output>
		<period>
			<min>-180</min>
			<max>180</max>
		</period>
	</filter>
	
	<filter>
		<name>VERT SPEED SYNC</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<enable>
			<condition>
				<not-equals>
					<property>/it-autoflight/output/vert</property>
					<value>1</value>
				</not-equals>
			</condition>
		</enable>
		<input>
			<expression>
				<floor>
					<property>/it-autoflight/internal/vert-speed-fpm</property>
				</floor>
			</expression>
		</input>
		<output>/it-autoflight/input/vs</output>
	</filter>
	
	<filter>
		<name>VERT SPEED FILTER</name>
		<debug>false</debug>
		<feedback-if-disabled>true</feedback-if-disabled>
		<initialize-to>output</initialize-to>
		<input>
			<property>/it-autoflight/input/vs</property>
		</input>
		<output>/it-autoflight/internal/vs</output>
		<type>noise-spike</type>
		<max-rate-of-change>
			<condition>
				<or>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>2000</value>
		</max-rate-of-change>
		<max-rate-of-change>
			<condition>
				<and>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<value>300</value>
		</max-rate-of-change>
	</filter>

	<filter>
		<name>NAV ERROR DEG</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<property>/instrumentation/nav[0]/radials/target-auto-hdg-deg</property>
			<offset>
				<property>/orientation/heading-deg</property>
				<scale>-1.0</scale>
			</offset>
		</input>
		<output>/it-autoflight/internal/nav-heading-error-deg</output>
		<period>
			<min>-180</min>
			<max>180</max>
		</period>
	</filter>

	<filter>
		<name>INTERNAL VERTICAL SPEED COMPUTER</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>55.5</gain>
		<input>/velocities/vertical-speed-fps</input>
		<output>/it-autoflight/internal/vert-speed-fpm</output>
	</filter>
	
	<filter>
		<name>INTERNAL VERTICAL SPEED COMPUTER SYNC 4</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>55.5</gain>
		<enable>
			<condition>
				<and>
					<not-equals>
						<property>/it-autoflight/output/vert</property>
						<value>4</value>
					</not-equals>
					<not-equals>
						<property>/it-autoflight/output/vert</property>
						<value>7</value>
					</not-equals>
				</and>
			</condition>
		</enable>
		<input>/velocities/vertical-speed-fps</input>
		<output>/it-autoflight/internal/target-fpm-b</output>
	</filter>
	
	<filter>
		<name>INTERNAL VERTICAL SPEED COMPUTER SYNC 5</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>55.5</gain>
		<enable>
			<condition>
				<not-equals>
					<property>/it-autoflight/output/vert</property>
					<value>5</value>
				</not-equals>
			</condition>
		</enable>
		<input>/velocities/vertical-speed-fps</input>
		<output>/it-autoflight/internal/target-fpm-d</output>
	</filter>
	
	<filter>
		<name>NAV1 G/S FPM Calc</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/instrumentation/nav[0]/gs-rate-of-climb-fpm</input>
		<output>/it-autoflight/internal/nav1-rate-of-climb-fpm</output>
		<min>
			<condition>
				<not-equals>
					<property>/options/steep-ils</property>
					<value>1</value>
				</not-equals>
			</condition>
			<value>-1200</value>
		</min>
		<min>
			<condition>
				<equals>
					<property>/options/steep-ils</property>
					<value>1</value>
				</equals>
			</condition>
			<value>-2200</value>
		</min>
		<max>0</max>
	</filter>
	
 <!-- =============================================================== -->
 <!-- Flight Director                                                 -->
 <!-- =============================================================== -->
 
	<filter>
		<name>IT-CONTROLLER: TARGET ROLL CMD</name>
		<debug>false</debug>
		<feedback-if-disabled>true</feedback-if-disabled>
		<initialize-to>output</initialize-to>
		<input>
			<property>/it-autoflight/internal/target-roll-deg</property>
		</input>
		<output>/it-autoflight/internal/target-roll-fd</output>
		<type>noise-spike</type>
		<max-rate-of-change>15</max-rate-of-change>
	</filter>
	
	<filter>
		<name>FD: ROLL</name>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<not-equals>
						<property>/it-autoflight/output/lat</property>
						<value>4</value>
					</not-equals>
					<not-equals>
						<property>/it-autoflight/output/lat</property>
						<value>5</value>
					</not-equals>
				</and>
			</condition>
			<expression>
				<dif>
					<property>/it-autoflight/internal/target-roll-fd</property>
					<property>/orientation/roll-deg</property>
				</dif>
			</expression>
		</input>
		<input>
			<condition>
				<or>
					<equals>
						<property>/it-autoflight/output/lat</property>
						<value>4</value>
					</equals>
					<equals>
						<property>/it-autoflight/output/lat</property>
						<value>5</value>
					</equals>
				</or>
			</condition>
			<expression>
				<dif>
					<value>0</value>
					<property>/orientation/roll-deg</property>
				</dif>
			</expression>
		</input>
		<output>/it-autoflight/fd/roll-bar</output>
		<min>-30</min>
		<max>30</max>
	</filter>

	<filter>
		<name>FD: PITCH</name>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>
			<expression>
				<product>
					<dif>
						<property>/it-autoflight/internal/target-common-fpm</property>
						<property>/it-autoflight/internal/vert-speed-fpm</property>
					</dif>
					<table>
						<property>/instrumentation/airspeed-indicator/indicated-mach</property> 
						<entry><ind>0.20</ind><dep>0.004</dep></entry>
						<entry><ind>0.95</ind><dep>0.002</dep></entry>
					</table>
				</product>
			</expression>
		</input>
		<output>/it-autoflight/fd/pitch-bar</output>
		<min>-15</min>
		<max>30</max>
		<max-rate-of-change>10</max-rate-of-change>
	</filter>

</PropertyList>