<?xml version="1.0"?>

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

<system name="DC-10: Fuel">
	
	<property value="0">/systems/apu/dc-fuel-pump</property>
	
	<channel name="Main Fuel Logic" execrate="8">
		
		<!-- Tank Pumps -->
		<switch name="/systems/fuel/aft-pump-1">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-1 ge 112
				/controls/fuel/pump-1-aft eq 1
				/systems/failures/fuel/pumps-1 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/aft-pump-1-psi-cmd">
			<input>/systems/fuel/aft-pump-1</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/aft-pump-1-psi">
			<input>/systems/fuel/aft-pump-1-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/fwd-pump-1">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-2 ge 112
				/controls/fuel/pump-1-fwd eq 1
				/systems/failures/fuel/pumps-1 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/fwd-pump-1-psi-cmd">
			<input>/systems/fuel/fwd-pump-1</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/fwd-pump-1-psi">
			<input>/systems/fuel/fwd-pump-1-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/aft-pump-2l">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-2 ge 112
				/controls/fuel/pump-2l-aft eq 1
				/systems/failures/fuel/pumps-2 ne 1
			</test>
			<test logic="AND" value="1">
				/systems/electrical/sources/adg/output-volt ge 112
				/controls/fuel/pump-2l-aft eq 1
				/systems/failures/fuel/pumps-2 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/aft-pump-2l-psi-cmd">
			<input>/systems/fuel/aft-pump-2l</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/aft-pump-2l-psi">
			<input>/systems/fuel/aft-pump-2l-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/aft-pump-2r">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-1 ge 112
				/controls/fuel/pump-2r-aft eq 1
				/systems/failures/fuel/pumps-2 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/aft-pump-2r-psi-cmd">
			<input>/systems/fuel/aft-pump-2r</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/aft-pump-2r-psi">
			<input>/systems/fuel/aft-pump-2r-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/fwd-pump-2">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-3 ge 112
				/controls/fuel/pump-2-fwd eq 1
				/systems/failures/fuel/pumps-2 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/fwd-pump-2-psi-cmd">
			<input>/systems/fuel/fwd-pump-2</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/fwd-pump-2-psi">
			<input>/systems/fuel/fwd-pump-2-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/apu-start-pump">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/electrical/bus/dc-bat ge 24
				/systems/apu/dc-fuel-pump eq 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/apu-start-pump-psi-cmd">
			<input>/systems/fuel/apu-start-pump</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/apu-start-pump-psi">
			<input>/systems/fuel/apu-start-pump-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/aft-pump-3">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-3 ge 112
				/controls/fuel/pump-3-aft eq 1
				/systems/failures/fuel/pumps-3 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/aft-pump-3-psi-cmd">
			<input>/systems/fuel/aft-pump-3</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/aft-pump-3-psi">
			<input>/systems/fuel/aft-pump-3-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/fwd-pump-3">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-2 ge 112
				/controls/fuel/pump-3-fwd eq 1
				/systems/failures/fuel/pumps-3 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/fwd-pump-3-psi-cmd">
			<input>/systems/fuel/fwd-pump-3</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/fwd-pump-3-psi">
			<input>/systems/fuel/fwd-pump-3-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<!-- Crossfeed Valves -->
		<actuator name="/systems/fuel/x-feed-1-valve">
			<input>/controls/fuel/x-feed-1</input>
			<rate_limit>0.333</rate_limit> <!-- 3 seconds -->
		</actuator>
		
		<actuator name="/systems/fuel/x-feed-2-valve">
			<input>/controls/fuel/x-feed-2</input>
			<rate_limit>0.333</rate_limit> <!-- 3 seconds -->
		</actuator>
		
		<actuator name="/systems/fuel/x-feed-3-valve">
			<input>/controls/fuel/x-feed-3</input>
			<rate_limit>0.333</rate_limit> <!-- 3 seconds -->
		</actuator>
		
		<!-- Transfer Pumps -->
		<switch name="/systems/fuel/trans-pump-1">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-1 ge 112
				/controls/fuel/trans-1 eq 1
				/systems/failures/fuel/pumps-1 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-pump-1-psi-cmd">
			<input>/systems/fuel/trans-pump-1</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-pump-1-psi">
			<input>/systems/fuel/trans-pump-1-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/trans-pump-2">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-2 ge 112
				/controls/fuel/trans-2 eq 1
				/systems/failures/fuel/pumps-2 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-pump-2-psi-cmd">
			<input>/systems/fuel/trans-pump-2</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-pump-2-psi">
			<input>/systems/fuel/trans-pump-2-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/trans-pump-3">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-3 ge 112
				/controls/fuel/trans-3 eq 1
				/systems/failures/fuel/pumps-3 ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-pump-3-psi-cmd">
			<input>/systems/fuel/trans-pump-3</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-pump-3-psi">
			<input>/systems/fuel/trans-pump-3-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/trans-aux-upper-l">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-1 ge 112
				/controls/fuel/trans-aux-l ge 1
				/systems/failures/fuel/pumps-aux-l ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-aux-upper-l-psi-cmd">
			<input>/systems/fuel/trans-aux-upper-l</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-aux-upper-l-psi">
			<input>/systems/fuel/trans-aux-upper-l-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/trans-aux-upper-r">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-2 ge 112
				/controls/fuel/trans-aux-r ge 1
				/systems/failures/fuel/pumps-aux-r ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-aux-upper-r-psi-cmd">
			<input>/systems/fuel/trans-aux-upper-r</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-aux-upper-r-psi">
			<input>/systems/fuel/trans-aux-upper-r-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/trans-aux-lower-l">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-2 ge 112
				/controls/fuel/trans-aux-l eq 1
				/systems/failures/fuel/pumps-aux-l ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-aux-lower-l-psi-cmd">
			<input>/systems/fuel/trans-aux-lower-l</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-aux-lower-l-psi">
			<input>/systems/fuel/trans-aux-lower-l-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<switch name="/systems/fuel/trans-aux-lower-r">
			<default value="0"/>
			<test logic="AND" value="1"> <!-- Power source is guess, unknown -->
				/systems/electrical/bus/ac-3 ge 112
				/controls/fuel/trans-aux-r eq 1
				/systems/failures/fuel/pumps-aux-r ne 1
			</test>
		</switch>
		
		<pure_gain name="/systems/fuel/trans-aux-lower-r-psi-cmd">
			<input>/systems/fuel/trans-aux-lower-r</input>
			<gain>20</gain>
		</pure_gain>
		
		<actuator name="/systems/fuel/trans-aux-lower-r-psi">
			<input>/systems/fuel/trans-aux-lower-r-psi-cmd</input>
			<rate_limit sense="incr">5</rate_limit>
			<rate_limit sense="decr">10</rate_limit>
		</actuator>
		
		<!-- Tank Feed Demand -->
		<switch name="/systems/fuel/feed-1-inner">
			<default value="0"/>
			<test logic="OR" value="1">
				/systems/fuel/aft-pump-1 eq 1
				/systems/fuel/fwd-pump-1 eq 1
			</test>
			<test logic="AND" value="1"> <!-- Suction/Gravity feed if G is not to far below 1 -->
				/accelerations/pilot-gdamped ge 0.5
			</test>
		</switch>
		
		<switch name="/systems/fuel/feed-2">
			<default value="0"/>
			<test logic="OR" value="1">
				/systems/fuel/aft-pump-2l eq 1
				/systems/fuel/aft-pump-2r eq 1
				/systems/fuel/fwd-pump-2 eq 1
			</test>
			<test logic="AND" value="1"> <!-- Suction/Gravity feed if G is not to far below 1 -->
				/accelerations/pilot-gdamped ge 0.5
			</test>
		</switch>
		
		<switch name="/systems/fuel/feed-3-inner">
			<default value="0"/>
			<test logic="OR" value="1">
				/systems/fuel/aft-pump-3 eq 1
				/systems/fuel/fwd-pump-3 eq 1
			</test>
			<test logic="AND" value="1"> <!-- Suction/Gravity feed if G is not to far below 1 -->
				/accelerations/pilot-gdamped ge 0.5
			</test>
		</switch>
		
		<switch name="/systems/fuel/feed-apu">
			<default value="0"/>
			<test logic="OR" value="1">
				/systems/fuel/apu-start-pump eq 1
				/systems/fuel/aft-pump-2l eq 1
				/systems/fuel/aft-pump-2r eq 1
				/systems/fuel/fwd-pump-2 eq 1
			</test>
		</switch>
	
	</channel>
	
	<!--
		0 - Tank 1 Outboard
		1 - Tank 1 Inboard
		2 - Tank 2
		3 - Tank 3 Inboard
		4 - Tank 3 Outboard
		5 - Upper Aux Tank
		6 - Lower Aux Tank
		7 - Engine 1 Pipe
		8 - Engine 2 Pipe
		9 - Engine 3 Pipe
		10 - APU Pipe
	-->
	
	<channel name="JSB Fuel System">
		
		<!-- Main Tanks to Engine 1 Pipe -->
		<switch name="/systems/fuel/internal/tank-1-inner-eng-1">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-1-inner eq 1
				propulsion/tank[1]/contents-lbs gt 10
				propulsion/tank[7]/contents-lbs lt 9
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-2-eng-1">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-2 eq 1
				/systems/fuel/x-feed-1-valve eq 1
				/systems/fuel/trans-pump-2 eq 1
				propulsion/tank[2]/contents-lbs gt 10
				propulsion/tank[7]/contents-lbs lt 9
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-eng-1">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-3-inner eq 1
				/systems/fuel/x-feed-1-valve eq 1
				/systems/fuel/trans-pump-3 eq 1
				propulsion/tank[3]/contents-lbs gt 10
				propulsion/tank[7]/contents-lbs lt 9
			</test>
		</switch>
		
		<!-- Main Tanks to Engine 2 Pipe -->
		<switch name="/systems/fuel/internal/tank-1-inner-eng-2">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-1-inner eq 1
				/systems/fuel/x-feed-2-valve eq 1
				/systems/fuel/trans-pump-1 eq 1
				propulsion/tank[1]/contents-lbs gt 10
				propulsion/tank[8]/contents-lbs lt 9
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-2-eng-2">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-2 eq 1
				propulsion/tank[2]/contents-lbs gt 10
				propulsion/tank[8]/contents-lbs lt 9
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-eng-2">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-3-inner eq 1
				/systems/fuel/x-feed-2-valve eq 1
				/systems/fuel/trans-pump-3 eq 1
				propulsion/tank[3]/contents-lbs gt 10
				propulsion/tank[8]/contents-lbs lt 9
			</test>
		</switch>
		
		<!-- Main Tanks to Engine 3 Pipe -->
		<switch name="/systems/fuel/internal/tank-1-inner-eng-3">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-1-inner eq 1
				/systems/fuel/x-feed-3-valve eq 1
				/systems/fuel/trans-pump-1 eq 1
				propulsion/tank[1]/contents-lbs gt 10
				propulsion/tank[9]/contents-lbs lt 9
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-2-eng-3">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-2 eq 1
				/systems/fuel/x-feed-3-valve eq 1
				/systems/fuel/trans-pump-2 eq 1
				propulsion/tank[2]/contents-lbs gt 10
				propulsion/tank[9]/contents-lbs lt 9
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-eng-3">
			<default value="0"/>
			<test logic="AND" value="9">
				/systems/fuel/feed-3-inner eq 1
				propulsion/tank[3]/contents-lbs gt 10
				propulsion/tank[9]/contents-lbs lt 9
			</test>
		</switch>
		
		<!-- Tank 2 to APU Pipe -->
		<switch name="/systems/fuel/internal/tank-2-apu">
			<default value="0"/>
			<test logic="AND" value="4">
				/systems/fuel/feed-apu eq 1
				propulsion/tank[2]/contents-lbs gt 10
				propulsion/tank[10]/contents-lbs lt 4
			</test>
			<output>propulsion/tank[10]/external-flow-rate-pps</output>
		</switch>
		
		<!-- Outer Tanks flow to Inner Tanks -->
		<switch name="/systems/fuel/internal/tank-1-outer-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				propulsion/tank[0]/contents-lbs gt 10
				propulsion/tank[1]/contents-lbs lt 5000
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-outer-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				propulsion/tank[4]/contents-lbs gt 10
				propulsion/tank[3]/contents-lbs lt 5000
			</test>
		</switch>
		
		<!-- Inner Tanks flow to Outer Tanks --> <!-- Unconfirmed behavior, but happens as far as I know -->
		<switch name="/systems/fuel/internal/tank-1-inner-outer">
			<default value="0"/>
			<test logic="AND" value="18">
				propulsion/tank[0]/contents-lbs lt 6490
				propulsion/tank[1]/contents-lbs gt 6500
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-outer">
			<default value="0"/>
			<test logic="AND" value="18">
				propulsion/tank[4]/contents-lbs lt 6490
				propulsion/tank[3]/contents-lbs gt 6500
			</test>
		</switch>
		
		<!-- Lower Aux Tank to Upper Aux Tank -->
		<switch name="/systems/fuel/internal/aux-tank-lower-upper">
			<default value="0"/>
			<test logic="AND" value="63">
				/systems/fuel/trans-aux-lower-l eq 1
				propulsion/tank[6]/contents-lbs gt 10
				propulsion/tank[5]/contents-lbs lt 87101
			</test>
			<test logic="AND" value="63">
				/systems/fuel/trans-aux-lower-r eq 1
				propulsion/tank[6]/contents-lbs gt 10
				propulsion/tank[5]/contents-lbs lt 87101
			</test>
		</switch>
		
		<!-- Upper Aux Tank to Main Tanks -->
		<switch name="/systems/fuel/internal/aux-tank-upper-tank-1-inner-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-aux-upper-l eq 1
				/controls/fuel/fill-1 eq 1
				propulsion/tank[5]/contents-lbs gt 10
			</test>
			<test logic="AND" value="1">
				/systems/fuel/trans-aux-upper-r eq 1
				/controls/fuel/fill-1 eq 1
				propulsion/tank[5]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/aux-tank-upper-tank-1-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/aux-tank-upper-tank-1-inner-cmd eq 1
				propulsion/tank[1]/contents-lbs lt 33693
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/aux-tank-upper-tank-2-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-aux-upper-l eq 1
				/controls/fuel/fill-2 eq 1
				propulsion/tank[5]/contents-lbs gt 10
			</test>
			<test logic="AND" value="1">
				/systems/fuel/trans-aux-upper-r eq 1
				/controls/fuel/fill-2 eq 1
				propulsion/tank[5]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/aux-tank-upper-tank-2">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/aux-tank-upper-tank-2-cmd eq 1
				propulsion/tank[2]/contents-lbs lt 64959
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/aux-tank-upper-tank-3-inner-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-aux-upper-l eq 1
				/controls/fuel/fill-3 eq 1
				propulsion/tank[5]/contents-lbs gt 10
			</test>
			<test logic="AND" value="1">
				/systems/fuel/trans-aux-upper-r eq 1
				/controls/fuel/fill-3 eq 1
				propulsion/tank[5]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/aux-tank-upper-tank-3-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/aux-tank-upper-tank-3-inner-cmd eq 1
				propulsion/tank[3]/contents-lbs lt 33693
			</test>
		</switch>
		
		<!-- Tank 1 to Tanks 2 and 3 Inner -->
		<switch name="/systems/fuel/internal/tank-1-inner-tank-2-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-pump-1 eq 1
				/controls/fuel/fill-2 eq 1
				propulsion/tank[1]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-1-inner-tank-2">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/tank-1-inner-tank-2-cmd eq 1
				propulsion/tank[2]/contents-lbs lt 64959
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-1-inner-tank-3-inner-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-pump-1 eq 1
				/controls/fuel/fill-3 eq 1
				propulsion/tank[1]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-1-inner-tank-3-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/tank-1-inner-tank-3-inner-cmd eq 1
				propulsion/tank[3]/contents-lbs lt 33693
			</test>
		</switch>
		
		<!-- Tank 2 to Tanks 1 Inner and 3 Inner -->
		<switch name="/systems/fuel/internal/tank-2-tank-1-inner-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-pump-2 eq 1
				/controls/fuel/fill-1 eq 1
				propulsion/tank[2]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-2-tank-1-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/tank-2-tank-1-inner-cmd eq 1
				propulsion/tank[1]/contents-lbs lt 33693
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-2-tank-3-inner-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-pump-2 eq 1
				/controls/fuel/fill-3 eq 1
				propulsion/tank[2]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-2-tank-3-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/tank-2-tank-3-inner-cmd eq 1
				propulsion/tank[3]/contents-lbs lt 33693
			</test>
		</switch>
		
		<!-- Tank 3 to 1 Inner and Tanks 2 -->
		<switch name="/systems/fuel/internal/tank-3-inner-tank-1-inner-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-pump-3 eq 1
				/controls/fuel/fill-1 eq 1
				propulsion/tank[3]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-tank-1-inner">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/tank-3-inner-tank-1-inner-cmd eq 1
				propulsion/tank[1]/contents-lbs lt 33693
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-tank-2-cmd">
			<default value="0"/>
			<test logic="AND" value="1">
				/systems/fuel/trans-pump-3 eq 1
				/controls/fuel/fill-2 eq 1
				propulsion/tank[3]/contents-lbs gt 10
			</test>
		</switch>
		
		<switch name="/systems/fuel/internal/tank-3-inner-tank-2">
			<default value="0"/>
			<test logic="AND" value="18">
				/systems/fuel/internal/tank-3-inner-tank-2-cmd eq 1
				propulsion/tank[2]/contents-lbs lt 64959
			</test>
		</switch>
		
		<!-- Tank Final Flow Rates -->
		<summer name="/systems/fuel/internal/tank-1-outer-flow-rate">
			<input>-/systems/fuel/internal/tank-1-outer-inner</input>
			<input>/systems/fuel/internal/tank-1-inner-outer</input>
			<output>propulsion/tank[0]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/tank-1-inner-flow-rate">
			<input>-/systems/fuel/internal/tank-1-inner-eng-1</input>
			<input>-/systems/fuel/internal/tank-1-inner-eng-2</input>
			<input>-/systems/fuel/internal/tank-1-inner-eng-3</input>
			<input>-/systems/fuel/internal/tank-1-inner-outer</input>
			<input>-/systems/fuel/internal/tank-1-inner-tank-2</input>
			<input>-/systems/fuel/internal/tank-1-inner-tank-3-inner</input>
			<input>/systems/fuel/internal/tank-1-outer-inner</input>
			<input>/systems/fuel/internal/tank-2-tank-1-inner</input>
			<input>/systems/fuel/internal/tank-3-inner-tank-1-inner</input>
			<input>/systems/fuel/internal/aux-tank-upper-tank-1-inner</input>
			<output>propulsion/tank[1]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/tank-2-fill-rate">
			<input>/systems/fuel/internal/aux-tank-upper-tank-2</input>
			<input>/systems/fuel/internal/tank-1-inner-tank-2</input>
			<input>/systems/fuel/internal/tank-3-inner-tank-2</input>
		</summer>
		
		<summer name="/systems/fuel/internal/tank-2-flow-rate">
			<input>-/systems/fuel/internal/tank-2-eng-1</input>
			<input>-/systems/fuel/internal/tank-2-eng-2</input>
			<input>-/systems/fuel/internal/tank-2-eng-3</input>
			<input>-/systems/fuel/internal/tank-2-apu</input>
			<input>-/systems/fuel/internal/tank-2-tank-1-inner</input>
			<input>-/systems/fuel/internal/tank-2-tank-3-inner</input>
			<input>/systems/fuel/internal/tank-2-fill-rate</input>
			<output>propulsion/tank[2]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/tank-3-inner-flow-rate">
			<input>-/systems/fuel/internal/tank-3-inner-eng-1</input>
			<input>-/systems/fuel/internal/tank-3-inner-eng-2</input>
			<input>-/systems/fuel/internal/tank-3-inner-eng-3</input>
			<input>-/systems/fuel/internal/tank-3-inner-outer</input>
			<input>-/systems/fuel/internal/tank-3-inner-tank-1-inner</input>
			<input>-/systems/fuel/internal/tank-3-inner-tank-2</input>
			<input>/systems/fuel/internal/tank-3-outer-inner</input>
			<input>/systems/fuel/internal/tank-1-inner-tank-3-inner</input>
			<input>/systems/fuel/internal/tank-2-tank-3-inner</input>
			<input>/systems/fuel/internal/aux-tank-upper-tank-3-inner</input>
			<output>propulsion/tank[3]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/tank-3-outer-flow-rate">
			<input>-/systems/fuel/internal/tank-3-outer-inner</input>
			<input>/systems/fuel/internal/tank-3-inner-outer</input>
			<output>propulsion/tank[4]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/aux-tank-upper-flow-rate">
			<input>-/systems/fuel/internal/aux-tank-upper-tank-1-inner</input>
			<input>-/systems/fuel/internal/aux-tank-upper-tank-2</input>
			<input>-/systems/fuel/internal/aux-tank-upper-tank-3-inner</input>
			<input>/systems/fuel/internal/aux-tank-lower-upper</input>
			<output>propulsion/tank[5]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/aux-tank-lower-flow-rate">
			<input>-/systems/fuel/internal/aux-tank-lower-upper</input>
			<output>propulsion/tank[6]/external-flow-rate-pps</output>
		</summer>
		
		<!-- Pipe Final Flow Rates -->
		<summer name="/systems/fuel/internal/eng-1-flow-rate">
			<input>/systems/fuel/internal/tank-1-inner-eng-1</input>
			<input>/systems/fuel/internal/tank-2-eng-1</input>
			<input>/systems/fuel/internal/tank-3-inner-eng-1</input>
			<output>propulsion/tank[7]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/eng-2-flow-rate">
			<input>/systems/fuel/internal/tank-1-inner-eng-2</input>
			<input>/systems/fuel/internal/tank-2-eng-2</input>
			<input>/systems/fuel/internal/tank-3-inner-eng-2</input>
			<output>propulsion/tank[8]/external-flow-rate-pps</output>
		</summer>
		
		<summer name="/systems/fuel/internal/eng-3-flow-rate">
			<input>/systems/fuel/internal/tank-1-inner-eng-3</input>
			<input>/systems/fuel/internal/tank-2-eng-3</input>
			<input>/systems/fuel/internal/tank-3-inner-eng-3</input>
			<output>propulsion/tank[9]/external-flow-rate-pps</output>
		</summer>
	
	</channel>

</system>
