<?xml version="1.0" encoding="UTF-8" ?>

<!-- Airbus A320 speedbrake/ground spoiler configuration -->

<PropertyList>

    <flipflop>
        <name>Auto Speedbrake Engage logic</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>