<?xml version="1.0"?>

<!-- Copyright (c) 2026 Josh Davidson (Octal450) -->

<PropertyList>
	
	<!-- Not in JSBSim, cause then it takes too long to tune -->
	<filter>
		<name>EPR C1</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<expression>
				<table>
					<product>
						<property>/position/altitude-ft</property>
						<table>
							<property>/fdm/jsbsim/velocities/mach</property>
							<entry><ind>0.09</ind><dep>0.1</dep></entry>
							<entry><ind>0.15</ind><dep>1.0</dep></entry>
						</table>
					</product>
					<entry><ind>    0</ind><dep>0.6139</dep></entry>
					<entry><ind>45000</ind><dep>0.8814</dep></entry>
				</table>
			</expression>
		</input>
		<output>/systems/engines/epr/c1</output>
	</filter>
	
	<filter>
		<name>EPR C2</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<expression>
				<difference>
					<table>
						<product>
							<property>/position/altitude-ft</property>
							<table>
								<property>/fdm/jsbsim/velocities/mach</property>
								<entry><ind>0.09</ind><dep>0.1</dep></entry>
								<entry><ind>0.15</ind><dep>1.0</dep></entry>
							</table>
						</product>
						<entry><ind>    0</ind><dep>0.9878</dep></entry>
						<entry><ind>45000</ind><dep>0.7439</dep></entry>
					</table>
					<table>
						<property>/fdm/jsbsim/velocities/mach</property>
						<entry><ind>0.09</ind><dep>0.000</dep></entry>
						<entry><ind>0.15</ind><dep>0.017</dep></entry>
						<entry><ind>0.22</ind><dep>0.023</dep></entry>
					</table>
				</difference>
			</expression>
		</input>
		<output>/systems/engines/epr/c2-raw</output>
	</filter>
	
	<filter>
		<name>EPR C2 Lag</name>
		<type>exponential</type>
		<input>/systems/engines/epr/c2-raw</input>
		<output>/systems/engines/epr/c2</output>
		<filter-time>0.32</filter-time>
	</filter>
	
	<predict-simple>
		<name>Gear AGL Altitude Predictor</name>
		<debug>false</debug>
		<input>/position/gear-agl-ft</input>
		<output>/position/gear-agl-ft-2-sec</output>
		<seconds>2.0</seconds>
		<filter-gain>0.0</filter-gain>
	</predict-simple>

	<filter>
		<name>Wingflex</name>
		<type>exponential</type>
		<enable>
			<condition>
				<equals>
					<property>/sim/model/wingflex-enable</property>
					<value>1</value>
				</equals>
			</condition>
		</enable>
		<input>/fdm/jsbsim/aero/coefficient/CLalpha</input>
		<output>/sim/model/wingflex</output>
		<filter-time>0.04</filter-time>
	</filter>
	
	<filter> <!-- Don't put in JSBSim! Its here for a reason! -->
		<name>ELEV FEEL Slew Knob</name>
		<update-interval-secs>0.075</update-interval-secs>
		<type>gain</type>
		<gain>1.0</gain>
		<feedback-if-disabled>true</feedback-if-disabled>
		<initialize-to>output</initialize-to>
		<enable>
			<condition>
				<and>
					<equals>
						<property>/systems/fcc/elevator-feel/power</property>
						<value>1</value>
					</equals>
					<not-equals>
						<property>/systems/fcc/elevator-feel/auto</property>
						<value>1</value>
					</not-equals>
				</and>
			</condition>
		</enable>
		<input>
			<expression>
				<floor>
					<sum>
						<property>/systems/fcc/elevator-feel/speed</property>
						<property>/controls/fcc/elevator-feel</property>
					</sum>
				</floor>
			</expression>
		</input>
		<output>/systems/fcc/elevator-feel/speed</output>
		<min>120</min>
		<max>300</max>
	</filter>
	
	<!-- Because overwriting from JSBSim doesn't work -->
	<filter>
		<name>Engine 1 Cutoff</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/ignition/cutoff-1</input>
		<output>/controls/engines/engine[0]/cutoff</output>
	</filter>
	
	<filter>
		<name>Engine 2 Cutoff</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<property>/systems/failures/hydraulics/catastrophic-aft</property>
			</condition>
			<value>1</value>
		</input>
		<input>/systems/ignition/cutoff-2</input>
		<output>/controls/engines/engine[1]/cutoff</output>
	</filter>
	
	<filter>
		<name>Engine 3 Cutoff</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/ignition/cutoff-3</input>
		<output>/controls/engines/engine[2]/cutoff</output>
	</filter>
	
	<filter>
		<name>APU Cutoff</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/apu/cutoff</input>
		<output>/controls/engines/engine[3]/cutoff</output>
	</filter>
	
	<filter>
		<name>Engine 1 Starter</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/ignition/starter-jsb-1</input>
		<output>/controls/engines/engine[0]/starter</output>
	</filter>
	
	<filter>
		<name>Engine 2 Starter</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/ignition/starter-jsb-2</input>
		<output>/controls/engines/engine[1]/starter</output>
	</filter>
	
	<filter>
		<name>Engine 3 Starter</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/ignition/starter-jsb-3</input>
		<output>/controls/engines/engine[2]/starter</output>
	</filter>
	
	<filter>
		<name>APU Starter</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>/systems/apu/starter</input>
		<output>/controls/engines/engine[3]/starter</output>
	</filter>
	
	<filter>
		<name>System Command: Throttle Comparator</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<expression>
				<max>
					<property>/controls/cockpit/throttle-lever[0]</property>
					<property>/controls/cockpit/throttle-lever[1]</property>
					<property>/controls/cockpit/throttle-lever[2]</property>
				</max>
			</expression>
		</input>
		<output>/systems/engines/throttle-compare-max</output>
	</filter>
	
	<!-- GPWS Controller -->
	<logic>
		<!-- True when flaps are NOT in landing config -->
		<input>
			<less-than>
				<property>/systems/fcs/flaps/input</property>
				<value>4</value>
			</less-than>
		</input>
		<output>/instrumentation/mk-viii/inputs/discretes/landing-flaps</output>
	</logic>
	
	<!-- Temporary thing for systems dialog -->
	<filter>
		<name>APU N1 thing</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs>0.1</update-interval-secs>
		<input> 
			<expression>
				<floor>
					<sum>
						<property>/systems/apu/n1-actual</property>
						<value>0.5</value>
					</sum>
				</floor>
			</expression>
		</input>
		<output>/systems/apu/n1-actual-round</output>
	</filter>
	
	<filter>
		<name>Eng 1 N2 thing</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs>0.1</update-interval-secs>
		<input> 
			<expression>
				<floor>
					<sum>
						<property>/systems/engines/n2-actual-1</property>
						<value>0.5</value>
					</sum>
				</floor>
			</expression>
		</input>
		<output>/systems/engines/n2-actual-1-round</output>
	</filter>
	
	<filter>
		<name>Eng 2 N2 thing</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs>0.1</update-interval-secs>
		<input> 
			<expression>
				<floor>
					<sum>
						<property>/systems/engines/n2-actual-2</property>
						<value>0.5</value>
					</sum>
				</floor>
			</expression>
		</input>
		<output>/systems/engines/n2-actual-2-round</output>
	</filter>
	
	<filter>
		<name>Eng 3 N2 thing</name>
		<type>gain</type>
		<gain>1.0</gain>
		<update-interval-secs>0.1</update-interval-secs>
		<input> 
			<expression>
				<floor>
					<sum>
						<property>/systems/engines/n2-actual-3</property>
						<value>0.5</value>
					</sum>
				</floor>
			</expression>
		</input>
		<output>/systems/engines/n2-actual-3-round</output>
	</filter>

</PropertyList>
