<?xml version="1.0"?>

<!-- Airbus A3XX Hydraulics System -->

<PropertyList>

 <!-- =============================================================== -->
 <!-- Surface Droop                                                   -->
 <!-- =============================================================== -->
 
    <filter>
        <name>Aileron Droop</name>
        <type>gain</type>
        <gain>1</gain>
        <update-interval-secs type="double">0.05</update-interval-secs>
        <input> 
            <expression>
                <table>
                    <property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
                    <entry><ind> 72</ind><dep>0.5</dep></entry>
                    <entry><ind>116</ind><dep>0.0</dep></entry>
                </table>
            </expression>
        </input>
		<output>/systems/hydraulic/aileron-droop</output>
    </filter>
	
    <filter>
        <name>Elevator Droop</name>
        <type>gain</type>
        <gain>1</gain>
        <update-interval-secs type="double">0.05</update-interval-secs>
        <input> 
            <expression>
                <table>
                    <property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
                    <entry><ind> 87</ind><dep>0.5</dep></entry>
                    <entry><ind>121</ind><dep>0.0</dep></entry>
                </table>
            </expression>
        </input>
		<output>/systems/hydraulic/elevator-droop</output>
    </filter>

 <!-- =============================================================== -->
 <!-- Aileron Control                                                 -->
 <!-- =============================================================== -->

	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/surface-positions/speedbrake-pos-norm</property>
						<value>1.0</value>
					</equals>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/surface-positions/speedbrake-pos-norm</property>
					<table>
						<property>/controls/flight/roll-fbw</property> 
						<entry><ind>0.2</ind><dep>   0</dep></entry>
						<entry><ind>1.0</ind><dep>-1.0</dep></entry>
					</table>
				</sum>
			</expression>
			<scale>-0.5</scale>
		</input>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<property>/systems/hydraulic/aileron-droop</property>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
				<sum>
					<table>
						<property>/controls/flight/aileron-fbw</property> 
						<entry><ind>-1</ind><dep>-0.5</dep></entry>
						<entry><ind> 0</ind><dep> 0.0</dep></entry>
						<entry><ind> 1</ind><dep> 0.5</dep></entry>
					</table>
					<table>
						<property>/fdm/jsbsim/fcs/flap-pos-deg</property> 
						<entry><ind>1</ind><dep>0.0</dep></entry>
						<entry><ind>5</ind><dep>0.2</dep></entry>
					</table>
				</sum>
            </expression>
		</input>
		<output>/controls/flight/aileron-left-cmd</output>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/aileron-left-cmd</input>
		<output>/controls/flight/aileron-left</output>
		<max-rate-of-change>2.5</max-rate-of-change>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/surface-positions/speedbrake-pos-norm</property>
						<value>1.0</value>
					</equals>
					<equals>
						<property>/gear/gear[1]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/gear/gear[2]/wow</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/surface-positions/speedbrake-pos-norm</property>
					<table>
						<property>/controls/flight/roll-fbw</property> 
						<entry><ind>-0.2</ind><dep>   0</dep></entry>
						<entry><ind>-1.0</ind><dep>-1.0</dep></entry>
					</table>
				</sum>
			</expression>
			<scale>0.5</scale>
		</input>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<property>/systems/hydraulic/aileron-droop</property>
			<scale>-1.0</scale>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
				<sum>
					<table>
						<property>/controls/flight/aileron-fbw</property> 
						<entry><ind>-1</ind><dep>-0.5</dep></entry>
						<entry><ind> 0</ind><dep> 0.0</dep></entry>
						<entry><ind> 1</ind><dep> 0.5</dep></entry>
					</table>
					<table>
						<property>/fdm/jsbsim/fcs/flap-pos-deg</property> 
						<entry><ind>1</ind><dep> 0.0</dep></entry>
						<entry><ind>5</ind><dep>-0.2</dep></entry>
					</table>
				</sum>
            </expression>
		</input>
		<output>/controls/flight/aileron-right-cmd</output>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/aileron-right-cmd</input>
		<output>/controls/flight/aileron-right</output>
		<max-rate-of-change>2.5</max-rate-of-change>
	</filter>
	
 <!-- =============================================================== -->
 <!-- Spoiler Control                                                 -->
 <!-- =============================================================== -->
	
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<not-equals>
						<property>/controls/flight/speedbrake-lever</property>
						<value>0.0</value>
					</not-equals>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/surface-positions/speedbrake-pos-norm</property>
					<table>
						<property>/controls/flight/roll-fbw</property> 
						<entry><ind>0.2</ind><dep>   0</dep></entry>
						<entry><ind>1.0</ind><dep>-0.5</dep></entry>
					</table>
				</sum>
			</expression>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<not-equals>
						<property>/controls/flight/speedbrake-lever</property>
						<value>0.0</value>
					</not-equals>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/surface-positions/speedbrake-pos-norm</property>
					<table>
						<property>/controls/flight/roll-fbw</property> 
						<entry><ind>0.0</ind><dep>   0</dep></entry>
						<entry><ind>1.0</ind><dep>-0.8</dep></entry>
					</table>
				</sum>
			</expression>
		</input>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>0.0</value>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
                <table>
                    <property>/controls/flight/spoiler-left-fbw-cmd</property> 
                    <entry><ind>-0.2</ind><dep>  0</dep></entry>
                    <entry><ind>-1.0</ind><dep>0.5</dep></entry>
                </table>
            </expression>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<equals>
						<property>/systems/failures/aileron-left</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
                <table>
                    <property>/controls/flight/spoiler-left-fbw-cmd</property> 
                    <entry><ind> 0.0</ind><dep>  0</dep></entry>
                    <entry><ind>-1.0</ind><dep>0.8</dep></entry>
                </table>
            </expression>
		</input>
		<output>/controls/flight/spoiler-left-cmd</output>
		<min>0.0</min>
		<max>1.0</max>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/spoiler-left-cmd</input>
		<output>/controls/flight/spoiler-left</output>
		<max-rate-of-change>0.5</max-rate-of-change>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<not-equals>
						<property>/controls/flight/speedbrake-lever</property>
						<value>0.0</value>
					</not-equals>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/surface-positions/speedbrake-pos-norm</property>
					<table>
						<property>/controls/flight/roll-fbw</property> 
						<entry><ind>-0.2</ind><dep>   0</dep></entry>
						<entry><ind>-1.0</ind><dep>-0.5</dep></entry>
					</table>
				</sum>
			</expression>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<not-equals>
						<property>/controls/flight/speedbrake-lever</property>
						<value>0.0</value>
					</not-equals>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/surface-positions/speedbrake-pos-norm</property>
					<table>
						<property>/controls/flight/roll-fbw</property> 
						<entry><ind> 0.0</ind><dep>   0</dep></entry>
						<entry><ind>-1.0</ind><dep>-0.8</dep></entry>
					</table>
				</sum>
			</expression>
		</input>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>0.0</value>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
                <table>
                    <property>/controls/flight/spoiler-right-fbw-cmd</property> 
                    <entry><ind>0.2</ind><dep>  0</dep></entry>
                    <entry><ind>1.0</ind><dep>0.5</dep></entry>
                </table>
            </expression>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<equals>
						<property>/systems/failures/aileron-right</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
                <table>
                    <property>/controls/flight/spoiler-right-fbw-cmd</property> 
                    <entry><ind>0.0</ind><dep>  0</dep></entry>
                    <entry><ind>1.0</ind><dep>0.8</dep></entry>
                </table>
            </expression>
		</input>
		<output>/controls/flight/spoiler-right-cmd</output>
		<min>0.0</min>
		<max>1.0</max>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/spoiler-right-cmd</input>
		<output>/controls/flight/spoiler-right</output>
		<max-rate-of-change>0.5</max-rate-of-change>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>
			<condition>
				<and>
					<or>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/green-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
						<and>
							<greater-than-equals>
								<property>/systems/hydraulic/blue-psi</property>
								<value>1500</value>
							</greater-than-equals>
							<greater-than-equals>
								<property>/systems/hydraulic/yellow-psi</property>
								<value>1500</value>
							</greater-than-equals>
						</and>
					</or>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>0</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<property>/fdm/jsbsim/fcs/speedbrake-cmd-norm</property>
		</input>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/spoiler-left</property>
						<value>1</value>
					</equals>
					<equals>
						<property>/systems/failures/spoiler-right</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>0.0</value>
		</input>
		<output>/controls/flight/spoiler-output</output>
		<max-rate-of-change>0.5</max-rate-of-change>
	</filter>
	
 <!-- =============================================================== -->
 <!-- Roll Control                                                    -->
 <!-- =============================================================== -->
	
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
            <expression>
				<product>
					<sum>
						<sum>
							<property>/controls/flight/aileron-left</property>
							<property>/controls/flight/aileron-right</property>
						</sum>
						<sum>
							<product>
								<property>/controls/flight/spoiler-left</property>
								<value>-1.0</value>
							</product>
							<property>/controls/flight/spoiler-right</property>
						</sum>
					</sum>
					<value>0.666</value>
				</product>
            </expression>
		</input>
		<output>/controls/flight/aileron-sum</output>
	</filter>

 <!-- =============================================================== -->
 <!-- Elevator Control                                                -->
 <!-- =============================================================== -->
 
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/elevator-left</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<property>/systems/hydraulic/elevator-droop</property>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/systems/failures/elevator-left</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
                <table>
                    <property>/controls/flight/elevator-fbw</property> 
                    <entry><ind>-1</ind><dep>-0.5</dep></entry>
                    <entry><ind> 0</ind><dep> 0.0</dep></entry>
                    <entry><ind> 1</ind><dep> 0.5</dep></entry>
                </table>
            </expression>
		</input>
		<output>/controls/flight/elevator-left-cmd</output>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/elevator-left-cmd</input>
		<output>/controls/flight/elevator-left</output>
		<max-rate-of-change>2.5</max-rate-of-change>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/elevator-right</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<property>/systems/hydraulic/elevator-droop</property>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/systems/failures/elevator-right</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
            <expression>
                <table>
                    <property>/controls/flight/elevator-fbw</property> 
                    <entry><ind>-1</ind><dep>-0.5</dep></entry>
                    <entry><ind> 0</ind><dep> 0.0</dep></entry>
                    <entry><ind> 1</ind><dep> 0.5</dep></entry>
                </table>
            </expression>
		</input>
		<output>/controls/flight/elevator-right-cmd</output>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/elevator-right-cmd</input>
		<output>/controls/flight/elevator-right</output>
		<max-rate-of-change>2.5</max-rate-of-change>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
            <expression>
				<sum>
					<property>/controls/flight/elevator-left</property>
					<property>/controls/flight/elevator-right</property>
				</sum>
            </expression>
		</input>
		<output>/controls/flight/elevator-sum</output>
	</filter>
	
 <!-- =============================================================== -->
 <!-- Rudder Control                                                  -->
 <!-- =============================================================== -->
 
	<filter>
		<debug>false</debug>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<condition>
				<or>
					<and>
						<less-than>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</less-than>
						<less-than>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</less-than>
					</and>
					<equals>
						<property>/systems/failures/rudder</property>
						<value>1</value>
					</equals>
				</or>
			</condition>
			<value>0</value>
		</input>
		<input>
			<condition>
				<and>
					<or>
						<greater-than-equals>
							<property>/systems/hydraulic/green-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/blue-psi</property>
							<value>1500</value>
						</greater-than-equals>
						<greater-than-equals>
							<property>/systems/hydraulic/yellow-psi</property>
							<value>1500</value>
						</greater-than-equals>
					</or>
					<equals>
						<property>/systems/failures/rudder</property>
						<value>0</value>
					</equals>
				</and>
			</condition>
			<expression>
				<sum>
					<property>/controls/flight/rudder-fbw</property>
					<property>/controls/flight/rudder-trim</property> 
				</sum>
			</expression>
		</input>
		<output>/controls/flight/rudder-fdm-cmd</output>
		<min>-1.0</min>
		<max>1.0</max>
	</filter>
	
	<filter>
		<debug>false</debug>
		<type>noise-spike</type>
		<input>/controls/flight/rudder-fdm-cmd</input>
		<output>/controls/flight/rudder-fdm</output>
		<max-rate-of-change>2.5</max-rate-of-change>
	</filter>
	
 <!-- =============================================================== -->
 <!-- Speedbrake Logic                                                -->
 <!-- =============================================================== -->
	
	<flipflop>
		<name>Auto Speedbrake</name>
		<debug>false</debug>
		<type>RS</type>
		<enable>
			<condition>
				<and>
					<equals>
						<property>/controls/flight/speedbrake-arm</property>
						<value>1</value>
					</equals>
					<less-than>
						<property>/engines/engine[0]/reverser-pos-norm</property>
						<value>0.01</value>
					</less-than>
					<less-than>
						<property>/engines/engine[1]/reverser-pos-norm</property>
						<value>0.01</value>
					</less-than>
				</and>
			</condition>
		</enable>
		<S>
			<and>
				<less-than>
					<property>/controls/engines/engine/throttle</property>
					<value>0.15</value>
				</less-than>
				<less-than>
					<property>/controls/engines/engine[1]/throttle</property>
					<value>0.15</value>
				</less-than>
				<property>/gear/gear[1]/wow</property>
				<property>/gear/gear[2]/wow</property>
				<greater-than>
					<property>/velocities/groundspeed-kt</property>
					<value>60</value>
				</greater-than>
			</and>
		</S>
		<R>
			<or>
				<greater-than>
					<property>/controls/engines/engine/throttle</property>
					<value>0.16</value>
				</greater-than>
				<greater-than>
					<property>/controls/engines/engine[1]/throttle</property>
					<value>0.16</value>
				</greater-than>
			</or>
		</R>
		<output>/controls/flight/speedbrake-lever</output>	
	</flipflop>

	<filter>
		<name>Main speedbrake controller</name>
		<type>gain</type>
		<gain>1.0</gain>
		<input>
			<expression>
				<max>
					<property>/controls/flight/ground-spoilers</property>
					<property>/controls/flight/speedbrake-lever</property>
				</max>
			</expression>
		</input>
		<output>/controls/flight/speedbrake</output>
	</filter>

</PropertyList>