<?xml version="1.0"?>

<!-- McDonnell Douglas DC-10 Hydraulics -->
<!-- Copyright (c) 2026 Josh Davidson (Octal450) -->

<system name="DC-10: Hydraulics">
	
	<property value="0">/systems/hydraulics/brakes/center-actuator-feedback</property>
	<property value="0">/systems/hydraulics/brakes/center-input-feedback</property>
	<property value="0">/systems/hydraulics/brakes/left-actuator-feedback</property>
	<property value="0">/systems/hydraulics/brakes/left-input-feedback</property>
	<property value="0">/systems/hydraulics/brakes/right-actuator-feedback</property>
	<property value="0">/systems/hydraulics/brakes/right-input-feedback</property>
	<property value="2990">/systems/hydraulics/brakes/sys-1-psi</property>
	<property value="2980">/systems/hydraulics/brakes/sys-2-psi</property>
	<property value="0">/systems/hydraulics/l-eng-1-pump-psi</property>
	<property value="0">/systems/hydraulics/l-eng-2-pump-psi</property>
	<property value="0">/systems/hydraulics/l-eng-3-pump-psi</property>
	<property value="0">/systems/hydraulics/r-eng-1-pump-psi</property>
	<property value="0">/systems/hydraulics/r-eng-2-pump-psi</property>
	<property value="0">/systems/hydraulics/r-eng-3-pump-psi</property>
	<property value="0">/systems/hydraulics/rmp/sys-1-thru-sys-3-to-sys-2</property>
	<property value="0">/systems/hydraulics/rmp/sys-1-to-sys-3</property>
	<property value="0">/systems/hydraulics/rmp/sys-2-thru-sys-3-to-sys-1</property>
	<property value="0">/systems/hydraulics/rmp/sys-2-to-sys-3</property>
	<property value="0">/systems/hydraulics/rmp/sys-3-to-sys-1</property>
	<property value="0">/systems/hydraulics/rmp/sys-3-to-sys-2</property>
	<property value="0">/systems/hydraulics/sys-3-qty</property>
	
	<channel name="SYS Leak Logic" execrate="8">
		
		<!-- SYS 1 -->
		<switch name="/systems/hydraulics/sys-1-qty-cmd">
			<default value="/systems/hydraulics/sys-1-qty-input"/>
			<test logic="OR" value="0">
				/systems/failures/hydraulics/sys-1-leak eq 1
				/systems/failures/hydraulics/catastrophic-aft eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/sys-1-qty-decr-rate">
			<default value="100"/> <!-- Instant -->
			<test logic="OR" value="0.25">
				/systems/failures/hydraulics/sys-1-leak eq 1
				/systems/failures/hydraulics/catastrophic-aft eq 1
			</test>
		</switch>
		
		<actuator name="/systems/hydraulics/sys-1-qty">
			<input>/systems/hydraulics/sys-1-qty-cmd</input>
			<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
			<rate_limit sense="decr">/systems/hydraulics/sys-1-qty-decr-rate</rate_limit>
		</actuator>
		
		<!-- SYS 2 -->
		<switch name="/systems/hydraulics/sys-2-qty-cmd">
			<default value="/systems/hydraulics/sys-2-qty-input"/>
			<test logic="OR" value="0">
				/systems/failures/hydraulics/sys-2-leak eq 1
				/systems/failures/hydraulics/catastrophic-aft eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/sys-2-qty-decr-rate">
			<default value="100"/> <!-- Instant -->
			<test logic="OR" value="0.25">
				/systems/failures/hydraulics/sys-2-leak eq 1
				/systems/failures/hydraulics/catastrophic-aft eq 1
			</test>
		</switch>
		
		<actuator name="/systems/hydraulics/sys-2-qty">
			<input>/systems/hydraulics/sys-2-qty-cmd</input>
			<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
			<rate_limit sense="decr">/systems/hydraulics/sys-2-qty-decr-rate</rate_limit>
		</actuator>
		
		<!-- SYS 3 -->
		<switch name="/systems/hydraulics/sys-3-isol-valve">
			<default value="0"/>
			<test value="1">
				/systems/hydraulics/sys-3-qty le 4.75
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/sys-3-qty-cmd">
			<default value="/systems/hydraulics/sys-3-qty-input"/>
			<test value="0">
				/systems/failures/hydraulics/sys-3-leak eq 1
			</test>
			<test logic="AND" value="0">
				/systems/failures/hydraulics/catastrophic-aft eq 1
				/systems/hydraulics/sys-3-isol-valve ne 1
			</test>
			<test logic="AND" value="/systems/hydraulics/sys-3-qty">
				/systems/failures/hydraulics/catastrophic-aft eq 1
				/systems/hydraulics/sys-3-isol-valve eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/sys-3-qty-decr-rate">
			<default value="100"/> <!-- Instant -->
			<test value="0.25">
				/systems/failures/hydraulics/sys-3-leak eq 1
			</test>
			<test logic="AND" value="0.25">
				/systems/failures/hydraulics/catastrophic-aft eq 1
				/systems/hydraulics/sys-3-isol-valve ne 1
			</test>
			<test logic="AND" value="100"> <!-- Instant -->
				/systems/failures/hydraulics/catastrophic-aft eq 1
				/systems/hydraulics/sys-3-isol-valve eq 1
			</test>
		</switch>
		
		<actuator name="/systems/hydraulics/sys-3-qty">
			<input>/systems/hydraulics/sys-3-qty-cmd</input>
			<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
			<rate_limit sense="decr">/systems/hydraulics/sys-3-qty-decr-rate</rate_limit>
		</actuator>
		
		<!-- SYS 3 Aft --> <!-- If SYS 3 is lost, SYS 3 Aft is lost also, but not the other way around -->
		<switch name="/systems/hydraulics/sys-3-aft-qty-cmd">
			<default value="/systems/hydraulics/sys-3-qty"/>
			<test logic="AND" value="0">
				/systems/failures/hydraulics/sys-3-leak ne 1
				/systems/failures/hydraulics/catastrophic-aft eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/sys-3-aft-qty-decr-rate">
			<default value="100"/> <!-- Instant -->
			<test logic="AND" value="0.25">
				/systems/failures/hydraulics/sys-3-leak ne 1
				/systems/failures/hydraulics/catastrophic-aft eq 1
			</test>
		</switch>
		
		<actuator name="/systems/hydraulics/sys-3-aft-qty">
			<input>/systems/hydraulics/sys-3-aft-qty-cmd</input>
			<rate_limit sense="incr">100</rate_limit> <!-- Instant -->
			<rate_limit sense="decr">/systems/hydraulics/sys-3-aft-qty-decr-rate</rate_limit>
		</actuator>
	
	</channel>
	
	<channel name="Main Hydraulics" execrate="8">
		
		<!-- Common -->
		<switch name="/systems/hydraulics/sys-incr-rate">
			<default value="500"/> <!-- 2 seconds per 1000 psi -->
			<test value="100000"> <!-- Instant -->
				/systems/acconfig/autoconfig-running eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/sys-decr-rate">
			<default value="45.45455"/> <!-- 22 seconds per 1000 psi -->
			<test value="100000"> <!-- Instant -->
				/systems/acconfig/autoconfig-running eq 1
			</test>
		</switch>
		
		<!-- SYS 1 -->
		<fcs_function name="/systems/hydraulics/l-eng-1-pump-psi-input">
			<function>
				<ifthen>
					<and>
						<nq>
							<property>/systems/failures/hydraulics/l-pump-1</property>
							<value>1</value>
						</nq>
						<ge>
							<property>/systems/hydraulics/sys-1-qty</property>
							<value>1</value>
						</ge>
					</and>
					<table>
						<independentVar lookup="row">/engines/engine[0]/n2-actual</independentVar>
						<tableData>
							40    40
							45  2990
						</tableData>
					</table>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/l-eng-1-pump-cmd">
			<default value="0"/>
			<test value="1">
				/controls/hydraulics/l-pump-1 eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/l-eng-1-pump-psi">
			<default value="40"/>
			<test value="/systems/hydraulics/l-eng-1-pump-psi-input">
				/systems/hydraulics/l-eng-1-pump-cmd eq 1
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/r-eng-1-pump-psi-input">
			<function>
				<ifthen>
					<and>
						<nq>
							<property>/systems/failures/hydraulics/r-pump-1</property>
							<value>1</value>
						</nq>
						<ge>
							<property>/systems/hydraulics/sys-1-qty</property>
							<value>1</value>
						</ge>
					</and>
					<table>
						<independentVar lookup="row">/engines/engine[0]/n2-actual</independentVar>
						<tableData>
							40    40
							45  2990
						</tableData>
					</table>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/r-eng-1-pump-cmd">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- AUTO -->
				/controls/hydraulics/r-pump-1 eq 1
				/systems/hydraulics/l-eng-1-pump-psi lt 2400
				/systems/hydraulics/r-eng-1-pump-psi-input ge 2400
			</test>
			<test value="1"> <!-- ON -->
				/controls/hydraulics/r-pump-1 eq 2
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/r-eng-1-pump-psi">
			<default value="40"/>
			<test value="/systems/hydraulics/r-eng-1-pump-psi-input">
				/systems/hydraulics/r-eng-1-pump-cmd eq 1
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/sys-1-pre-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-1-qty</property>
						<value>1</value>
					</ge>
					<max>
						<property>/systems/hydraulics/l-eng-1-pump-psi</property>
						<property>/systems/hydraulics/r-eng-1-pump-psi</property>
					</max>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/sys-1-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-1-qty</property>
						<value>1</value>
					</ge>
					<max>
						<property>/systems/hydraulics/sys-1-pre-psi-cmd</property>
						<property>/systems/hydraulics/rmp/sys-3-to-sys-1</property>
						<property>/systems/hydraulics/rmp/sys-2-thru-sys-3-to-sys-1</property>
					</max>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<actuator name="/systems/hydraulics/sys-1-psi">
			<input>/systems/hydraulics/sys-1-psi-cmd</input>
			<rate_limit sense="incr">/systems/hydraulics/sys-incr-rate</rate_limit>
			<rate_limit sense="decr">/systems/hydraulics/sys-decr-rate</rate_limit>
		</actuator>
		
		<!-- SYS 2 -->
		<fcs_function name="/systems/hydraulics/l-eng-2-pump-psi-input">
			<function>
				<ifthen>
					<and>
						<nq>
							<property>/systems/failures/hydraulics/l-pump-2</property>
							<value>1</value>
						</nq>
						<ge>
							<property>/systems/hydraulics/sys-2-qty</property>
							<value>1</value>
						</ge>
					</and>
					<table>
						<independentVar lookup="row">/engines/engine[1]/n2-actual</independentVar>
						<tableData>
							40    40
							45  3010
						</tableData>
					</table>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/l-eng-2-pump-cmd">
			<default value="0"/>
			<test value="1">
				/controls/hydraulics/l-pump-2 eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/l-eng-2-pump-psi">
			<default value="40"/>
			<test value="/systems/hydraulics/l-eng-2-pump-psi-input">
				/systems/hydraulics/l-eng-2-pump-cmd eq 1
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/r-eng-2-pump-psi-input">
			<function>
				<ifthen>
					<and>
						<nq>
							<property>/systems/failures/hydraulics/r-pump-2</property>
							<value>1</value>
						</nq>
						<ge>
							<property>/systems/hydraulics/sys-2-qty</property>
							<value>1</value>
						</ge>
					</and>
					<table>
						<independentVar lookup="row">/engines/engine[1]/n2-actual</independentVar>
						<tableData>
							40    40
							45  3010
						</tableData>
					</table>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/r-eng-2-pump-cmd">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- AUTO -->
				/controls/hydraulics/r-pump-2 eq 1
				/systems/hydraulics/l-eng-2-pump-psi lt 2400
				/systems/hydraulics/r-eng-2-pump-psi-input ge 2400
			</test>
			<test value="1"> <!-- ON -->
				/controls/hydraulics/r-pump-2 eq 2
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/r-eng-2-pump-psi">
			<default value="40"/>
			<test value="/systems/hydraulics/r-eng-2-pump-psi-input">
				/systems/hydraulics/r-eng-2-pump-cmd eq 1
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/sys-2-pre-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-2-qty</property>
						<value>1</value>
					</ge>
					<max>
						<property>/systems/hydraulics/l-eng-2-pump-psi</property>
						<property>/systems/hydraulics/r-eng-2-pump-psi</property>
					</max>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/sys-2-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-2-qty</property>
						<value>1</value>
					</ge>
					<max>
						<property>/systems/hydraulics/sys-2-pre-psi-cmd</property>
						<property>/systems/hydraulics/rmp/sys-3-to-sys-2</property>
						<property>/systems/hydraulics/rmp/sys-1-thru-sys-3-to-sys-2</property>
					</max>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<actuator name="/systems/hydraulics/sys-2-psi">
			<input>/systems/hydraulics/sys-2-psi-cmd</input>
			<rate_limit sense="incr">/systems/hydraulics/sys-incr-rate</rate_limit>
			<rate_limit sense="decr">/systems/hydraulics/sys-decr-rate</rate_limit>
		</actuator>
		
		<!-- SYS 3 -->
		<fcs_function name="/systems/hydraulics/l-eng-3-pump-psi-input">
			<function>
				<ifthen>
					<and>
						<nq>
							<property>/systems/failures/hydraulics/l-pump-3</property>
							<value>1</value>
						</nq>
						<ge>
							<property>/systems/hydraulics/sys-3-qty</property>
							<value>1</value>
						</ge>
					</and>
					<table>
						<independentVar lookup="row">/engines/engine[2]/n2-actual</independentVar>
						<tableData>
							40    40
							45  2980
						</tableData>
					</table>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/l-eng-3-pump-cmd">
			<default value="0"/>
			<test value="1">
				/controls/hydraulics/l-pump-3 eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/l-eng-3-pump-psi">
			<default value="40"/>
			<test value="/systems/hydraulics/l-eng-3-pump-psi-input">
				/systems/hydraulics/l-eng-3-pump-cmd eq 1
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/r-eng-3-pump-psi-input">
			<function>
				<ifthen>
					<and>
						<nq>
							<property>/systems/failures/hydraulics/r-pump-3</property>
							<value>1</value>
						</nq>
						<ge>
							<property>/systems/hydraulics/sys-3-qty</property>
							<value>1</value>
						</ge>
					</and>
					<table>
						<independentVar lookup="row">/engines/engine[2]/n2-actual</independentVar>
						<tableData>
							40    40
							45  2980
						</tableData>
					</table>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/r-eng-3-pump-cmd">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- AUTO -->
				/controls/hydraulics/r-pump-3 eq 1
				/systems/hydraulics/l-eng-3-pump-psi lt 2400
				/systems/hydraulics/r-eng-3-pump-psi-input ge 2400
			</test>
			<test value="1"> <!-- ON -->
				/controls/hydraulics/r-pump-3 eq 2
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/r-eng-3-pump-psi">
			<default value="40"/>
			<test value="/systems/hydraulics/r-eng-3-pump-psi-input">
				/systems/hydraulics/r-eng-3-pump-cmd eq 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/aux-pump-1-psi">
			<default value="0"/>
			<test logic="OR" value="0">
				/controls/hydraulics/aux-pump-1 ne 1
				/systems/failures/hydraulics/aux-pump-1 eq 1
				/systems/hydraulics/sys-3-qty lt 1
			</test>
			<test logic="AND" value="0"> <!-- ADG can't do both ELEC and HYD -->
				/controls/electrical/adg-elec eq 1
				/systems/electrical/sources/adg/output-volt ge 112
			</test>
			<test logic="OR" value="2960"> <!-- I know it is powered by an AC bus, but I don't know which one, so these are educated guesses -->
				/systems/electrical/bus/ac-1 ge 112
				/systems/electrical/bus/ac-2 ge 112
				/systems/electrical/bus/ac-3 ge 112
				/systems/electrical/bus/l-emer-ac ge 112
				/systems/electrical/bus/r-emer-ac ge 112
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/aux-pump-2-psi">
			<default value="0"/>
			<test logic="OR" value="0">
				/controls/hydraulics/aux-pump-2 ne 1
				/systems/failures/hydraulics/aux-pump-2 eq 1
				/systems/hydraulics/sys-3-qty lt 1
			</test>
			<test logic="OR" value="2950"> <!-- I know it is powered by an AC bus, but I don't know which one, so guesses -->
				/systems/electrical/bus/ac-1 ge 112
				/systems/electrical/bus/ac-2 ge 112
				/systems/electrical/bus/ac-3 ge 112
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/sys-3-pre-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-3-qty</property>
						<value>1</value>
					</ge>
					<max>
						<property>/systems/hydraulics/l-eng-3-pump-psi</property>
						<property>/systems/hydraulics/r-eng-3-pump-psi</property>
						<property>/systems/hydraulics/aux-pump-1-psi</property>
						<property>/systems/hydraulics/aux-pump-2-psi</property>
					</max>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/sys-3-rmp-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-3-qty</property>
						<value>1</value>
					</ge>
					<max>
						<property>/systems/hydraulics/rmp/sys-1-to-sys-3</property>
						<property>/systems/hydraulics/rmp/sys-2-to-sys-3</property>
					</max>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/sys-3-psi-cmd">
			<function>
				<max>
					<property>/systems/hydraulics/sys-3-pre-psi-cmd</property>
					<property>/systems/hydraulics/sys-3-rmp-psi-cmd</property>
				</max>
			</function>
		</fcs_function>
		
		<actuator name="/systems/hydraulics/sys-3-psi">
			<input>/systems/hydraulics/sys-3-psi-cmd</input>
			<rate_limit sense="incr">/systems/hydraulics/sys-incr-rate</rate_limit>
			<rate_limit sense="decr">/systems/hydraulics/sys-decr-rate</rate_limit>
		</actuator>
		
		<fcs_function name="/systems/hydraulics/sys-3-aft-psi-cmd">
			<function>
				<ifthen>
					<ge>
						<property>/systems/hydraulics/sys-3-aft-qty</property>
						<value>1</value>
					</ge>
					<property>/systems/hydraulics/sys-3-psi-cmd</property>
					<value>40</value>
				</ifthen>
			</function>
		</fcs_function>
		
		<actuator name="/systems/hydraulics/sys-3-aft-psi">
			<input>/systems/hydraulics/sys-3-aft-psi-cmd</input>
			<rate_limit sense="incr">/systems/hydraulics/sys-incr-rate</rate_limit>
			<rate_limit sense="decr">/systems/hydraulics/sys-decr-rate</rate_limit>
		</actuator>
		
		<!-- Reversible Motor Pump 1-3 -->
		<switch name="/systems/hydraulics/rmp/rmp-1-3-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/controls/hydraulics/rmp-1-3 eq 1
			</test>
		</switch>
		
		<actuator name="/systems/hydraulics/rmp/rmp-1-3-valve">
			<input>/systems/hydraulics/rmp/rmp-1-3-cmd</input>
			<rate_limit>0.25</rate_limit> <!-- 4 seconds -->
		</actuator>
		
		<switch name="/systems/hydraulics/rmp/sys-1-to-sys-3">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-1-pre-psi-cmd">
				/systems/hydraulics/rmp/rmp-1-3-valve eq 1
				/systems/failures/hydraulics/rmp-1-3 ne 1
				/systems/hydraulics/sys-3-qty ge 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/rmp/sys-3-to-sys-1">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-3-pre-psi-cmd">
				/systems/hydraulics/rmp/rmp-1-3-valve eq 1
				/systems/failures/hydraulics/rmp-1-3 ne 1
				/systems/hydraulics/sys-1-qty ge 1
			</test>
		</switch>
		
		<!-- Reversible Motor Pump 2-3 -->
		<switch name="/systems/hydraulics/rmp/rmp-2-3-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/controls/hydraulics/rmp-2-3 eq 1
			</test>
		</switch>
		
		<actuator name="/systems/hydraulics/rmp/rmp-2-3-valve">
			<input>/systems/hydraulics/rmp/rmp-2-3-cmd</input>
			<rate_limit>0.25</rate_limit> <!-- 4 seconds -->
		</actuator>
		
		<switch name="/systems/hydraulics/rmp/sys-2-to-sys-3">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-2-pre-psi-cmd">
				/systems/hydraulics/rmp/rmp-2-3-valve eq 1
				/systems/failures/hydraulics/rmp-2-3 ne 1
				/systems/hydraulics/sys-3-qty ge 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/rmp/sys-3-to-sys-2">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-3-pre-psi-cmd">
				/systems/hydraulics/rmp/rmp-2-3-valve eq 1
				/systems/failures/hydraulics/rmp-2-3 ne 1
				/systems/hydraulics/sys-2-qty ge 1
			</test>
		</switch>
		
		<!-- Reversible Motor Pump Multi -->
		<switch name="/systems/hydraulics/rmp/sys-2-thru-sys-3-to-sys-1">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-3-rmp-psi-cmd">
				/systems/hydraulics/rmp/rmp-1-3-valve eq 1
				/systems/failures/hydraulics/rmp-1-3 ne 1
				/systems/hydraulics/rmp/rmp-2-3-valve eq 1
				/systems/failures/hydraulics/rmp-2-3 ne 1
				/systems/hydraulics/sys-1-qty ge 1
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/rmp/sys-1-thru-sys-3-to-sys-2">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-3-rmp-psi-cmd">
				/systems/hydraulics/rmp/rmp-1-3-valve eq 1
				/systems/failures/hydraulics/rmp-1-3 ne 1
				/systems/hydraulics/rmp/rmp-2-3-valve eq 1
				/systems/failures/hydraulics/rmp-2-3 ne 1
				/systems/hydraulics/sys-2-qty ge 1
			</test>
		</switch>
		
		<!-- Non Reversible Motor Pump 2-1 -->
		<switch name="/systems/hydraulics/nrmp/sys-2-to-sys-1-cmd">
			<default value="/systems/hydraulics/nrmp/sys-2-to-sys-1-cmd"/>
			<test value="1">
				/systems/hydraulics/sys-1-psi lt 2200
			</test>
			<test value="0">
				/systems/hydraulics/sys-1-psi ge 2400
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/nrmp/sys-2-to-sys-1">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-2-psi-cmd">
				/systems/hydraulics/nrmp/sys-2-to-sys-1-cmd eq 1
				/systems/failures/hydraulics/nrmp-2-1 ne 1
				/systems/hydraulics/sys-2-qty ge 1
			</test>
		</switch>
		
		<!-- Non Reversible Motor Pump 3-2 -->
		<switch name="/systems/hydraulics/nrmp/sys-3-to-sys-2-cmd">
			<default value="/systems/hydraulics/nrmp/sys-3-to-sys-2-cmd"/>
			<test value="1">
				/systems/hydraulics/sys-2-psi lt 2200
			</test>
			<test value="0">
				/systems/hydraulics/sys-2-psi ge 2400
			</test>
		</switch>
		
		<switch name="/systems/hydraulics/nrmp/sys-3-to-sys-2">
			<default value="0"/>
			<test logic="AND" value="/systems/hydraulics/sys-3-aft-psi-cmd">
				/systems/hydraulics/nrmp/sys-3-to-sys-2-cmd eq 1
				/systems/failures/hydraulics/nrmp-3-2 ne 1
				/systems/hydraulics/sys-3-qty ge 1
			</test>
		</switch>
		
		<!-- Brake System -->
		<fcs_function name="/systems/hydraulics/brakes/left-error">
			<function>
				<abs>
					<difference>
						<property>/systems/hydraulics/brakes/left-actuator-feedback</property>
						<property>/systems/hydraulics/brakes/left-input-feedback</property>
					</difference>
				</abs>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/brakes/center-error">
			<function>
				<abs>
					<difference>
						<property>/systems/hydraulics/brakes/center-actuator-feedback</property>
						<property>/systems/hydraulics/brakes/center-input-feedback</property>
					</difference>
				</abs>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/brakes/right-error">
			<function>
				<abs>
					<difference>
						<property>/systems/hydraulics/brakes/right-actuator-feedback</property>
						<property>/systems/hydraulics/brakes/right-input-feedback</property>
					</difference>
				</abs>
			</function>
		</fcs_function>
		
		<fcs_function name="/systems/hydraulics/brakes/sys-decr-rate-cmd">
			<function> <!-- About 10 full depresses and releases from nominal PSI -->
				<sum> <!-- V = 2x + 0.5x, if V = 145 then x = 58 -->
					<product>
						<property>/systems/hydraulics/brakes/left-error</property>
						<value>58</value> <!-- x -->
					</product>
					<product>
						<property>/systems/hydraulics/brakes/center-error</property>
						<value>29</value> <!-- 0.5x -->
					</product>
					<product>
						<property>/systems/hydraulics/brakes/right-error</property>
						<value>58</value> <!-- x -->
					</product>
				</sum>
			</function>
		</fcs_function>
		
		<switch name="/systems/hydraulics/brakes/sys-decr-rate">
			<default value="/systems/hydraulics/brakes/sys-decr-rate-cmd"/>
			<test logic="AND" value="0">
				/systems/hydraulics/brakes/left-error le 0.01
				/systems/hydraulics/brakes/center-error le 0.01
				/systems/hydraulics/brakes/right-error le 0.01
			</test>
		</switch>
		
		<fcs_function name="/systems/hydraulics/brakes/sys-1-psi-cmd">
			<function>
				<difference>
					<property>/systems/hydraulics/sys-1-psi</property>
					<product>
						<property>/systems/hydraulics/brakes/left-actuator-feedback</property>
						<value>35</value>
					</product>
					<product>
						<property>/systems/hydraulics/brakes/center-actuator-feedback</property>
						<value>20</value>
					</product>
					<product>
						<property>/systems/hydraulics/brakes/right-actuator-feedback</property>
						<value>40</value>
					</product>
				</difference>
			</function>
			<clipto>
				<min>0</min>
				<max>4000</max>
			</clipto>
		</fcs_function>
		
		<actuator name="/systems/hydraulics/brakes/sys-1-psi">
			<input>/systems/hydraulics/brakes/sys-1-psi-cmd</input>
			<rate_limit sense="incr">/systems/hydraulics/sys-incr-rate</rate_limit>
			<rate_limit sense="decr">/systems/hydraulics/brakes/sys-decr-rate</rate_limit>
		</actuator>
		
		<lag_filter name="/systems/hydraulics/brakes/sys-1-psi-needle">
			<input>/systems/hydraulics/brakes/sys-1-psi</input>
			<c1>10</c1>
		</lag_filter>
		
		<fcs_function name="/systems/hydraulics/brakes/sys-2-psi-cmd">
			<function>
				<difference>
					<property>/systems/hydraulics/sys-3-psi</property> <!-- Not a typo Brake System 2 is powered by Hydraulic System 3 -->
					<product>
						<property>/systems/hydraulics/brakes/left-actuator-feedback</property>
						<value>40</value>
					</product>
					<product>
						<property>/systems/hydraulics/brakes/center-actuator-feedback</property>
						<value>20</value>
					</product>
					<product>
						<property>/systems/hydraulics/brakes/right-actuator-feedback</property>
						<value>45</value>
					</product>
				</difference>
			</function>
			<clipto>
				<min>0</min>
				<max>4000</max>
			</clipto>
		</fcs_function>
		
		<actuator name="/systems/hydraulics/brakes/sys-2-psi">
			<input>/systems/hydraulics/brakes/sys-2-psi-cmd</input>
			<rate_limit sense="incr">/systems/hydraulics/sys-incr-rate</rate_limit>
			<rate_limit sense="decr">/systems/hydraulics/brakes/sys-decr-rate</rate_limit>
		</actuator>
		
		<lag_filter name="/systems/hydraulics/brakes/sys-2-psi-needle">
			<input>/systems/hydraulics/brakes/sys-2-psi</input>
			<c1>10</c1>
		</lag_filter>
	
	</channel>

</system>
