<?xml version="1.0"?>
<flight_control name="BN-2: FCS">
	<channel name="Pitch">
		<summer name="Pitch Trim Sum">
			<input>fcs/elevator-cmd-norm</input>
			<input>fcs/pitch-trim-cmd-norm</input>
			<clipto>
				<min> -1 </min>
				<max>  1 </max>
			</clipto>
		</summer>
		
		<aerosurface_scale name="Elevator Control">
			<input>fcs/pitch-trim-sum</input>
			<range>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</range>
			<output>fcs/elevator-pos-rad</output>
		</aerosurface_scale>
		
		<aerosurface_scale name="Elevator Normalization">
			<input>fcs/elevator-pos-rad</input>
			<domain>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</domain>
			<range>
				<min> -1 </min>
				<max>  1 </max>
			</range>
			<output>fcs/elevator-pos-norm</output>
		</aerosurface_scale>
	</channel>
	
	<channel name="Roll">
		<summer name="Roll Trim Sum">
			<input>fcs/aileron-cmd-norm</input>
			<input>fcs/roll-trim-cmd-norm</input>
			<clipto>
				<min> -1 </min>
				<max>  1 </max>
			</clipto>
		</summer>
		
		<aerosurface_scale name="Left Aileron Control">
			<input>fcs/roll-trim-sum</input>
			<range>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</range>
			<output>fcs/left-aileron-pos-rad</output>
		</aerosurface_scale>
		
		<aerosurface_scale name="Right Aileron Control">
			<input>-fcs/roll-trim-sum</input>
			<range>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</range>
			<output>fcs/right-aileron-pos-rad</output>
		</aerosurface_scale>
		
		<aerosurface_scale name="Left Aileron Normalization">
			<input>fcs/left-aileron-pos-rad</input>
			<domain>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</domain>
			<range>
				<min> -1 </min>
				<max>  1 </max>
			</range>
			<output>fcs/left-aileron-pos-norm</output>
		</aerosurface_scale>
		
		<aerosurface_scale name="Right Aileron Normalization">
			<input>fcs/right-aileron-pos-rad</input>
			<domain>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</domain>
			<range>
				<min> -1 </min>
				<max>  1 </max>
			</range>
			<output>fcs/right-aileron-pos-norm</output>
		</aerosurface_scale>
	</channel>
	
	<channel name="Yaw">
		<summer name="Rudder Command Sum">
			<input>fcs/rudder-cmd-norm</input>
			<input>fcs/yaw-trim-cmd-norm</input>
			<clipto>
				<min> -1 </min>
				<max>  1 </max>
			</clipto>
		</summer>
		
		<aerosurface_scale name="Rudder Control">
			<input>fcs/rudder-command-sum</input>
			<range>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</range>
			<output>fcs/rudder-pos-rad</output>
		</aerosurface_scale>
		
		<aerosurface_scale name="Rudder Normalization">
			<input>fcs/rudder-pos-rad</input>
			<domain>
				<min> -0.35 </min>
				<max>  0.35 </max>
			</domain>
			<range>
				<min> -1 </min>
				<max>  1 </max>
			</range>
			<output>fcs/rudder-pos-norm</output>
		</aerosurface_scale>
	</channel>
	
	<channel name="Flaps">
		<!--	ref. FM, Section 3 Page 9: Flap Settings: T/O (25 deg) and DOWN (56 deg)	-->
		<pure_gain> <!-- traverse times already modelled in nasal (controls_override.nas) -->
			<input>fcs/flap-cmd-norm</input>
			<gain>56.0</gain>
			<output>fcs/flap-pos-deg</output>
		</pure_gain>
		<aerosurface_scale name="Flap Normalization">
			<input>fcs/flap-pos-deg</input>
			<domain>
				<min>  0 </min>
				<max> 56 </max>
			</domain>
			<range>
				<min> 0 </min>
				<max> 1 </max>
			</range>
			<output>fcs/flap-pos-norm</output>
		</aerosurface_scale>
	</channel>
	
	<channel name="Landing Gear">
	</channel>
	
	<channel name="Engines">
		<switch>
			<default value="0"/>
			<test value="3" logic="AND">
				/controls/engines/engine[0]/magneto[0] eq 1
				/controls/engines/engine[0]/magneto[1] eq 1
			</test>
			<test value="2" logic="AND">
				/controls/engines/engine[0]/magneto[0] eq 0
				/controls/engines/engine[0]/magneto[1] eq 1
			</test>
			<test value="1" logic="AND">
				/controls/engines/engine[0]/magneto[0] eq 1
				/controls/engines/engine[0]/magneto[1] eq 0
			</test>
			<output>/controls/engines/engine[0]/magnetos</output>
		</switch>
		<switch>
			<default value="0"/>
			<test value="3" logic="AND">
				/controls/engines/engine[1]/magneto[0] eq 1
				/controls/engines/engine[1]/magneto[1] eq 1
			</test>
			<test value="2" logic="AND">
				/controls/engines/engine[1]/magneto[0] eq 0
				/controls/engines/engine[1]/magneto[1] eq 1
			</test>
			<test value="1" logic="AND">
				/controls/engines/engine[1]/magneto[0] eq 1
				/controls/engines/engine[1]/magneto[1] eq 0
			</test>
			<output>/controls/engines/engine[1]/magnetos</output>
		</switch>
	</channel>
	
	<channel name="Thruster">
		<summer name="Thrust Coefficient Left">
			<input>propulsion/engine[0]/thrust-coefficient</input>
			<output>systems/propulsion/thrust-coefficient-left</output>
		</summer>
		<summer name="Thrust Coefficient Right">
			<input>propulsion/engine[1]/thrust-coefficient</input>
			<output>systems/propulsion/thrust-coefficient-right</output>
		</summer>
		<summer name="Thrust Coefficient Left-Right">
			<input>systems/propulsion/thrust-coefficient-left</input>
			<input>-systems/propulsion/thrust-coefficient-right</input>
			<output>systems/propulsion/thrust-coefficient-left-right</output>
		</summer>
		<summer name="Thrust Coefficient">
			<input>systems/propulsion/thrust-coefficient-left</input>
			<input>systems/propulsion/thrust-coefficient-right</input>
			<output>systems/propulsion/thrust-coefficient</output>
		</summer>
	</channel>
	
	<channel name="Doors">
		<kinematic>
			<input>/sim/model/doors/front-left/cmd</input>
			<traverse>
				<setting>
					<position> 0 </position>
					<time>     0 </time>
				</setting>
				<setting>
					<position> 1 </position>
					<time>     1 </time>
				</setting>
			</traverse>
			<output>/sim/model/doors/front-left/position-norm</output>
		</kinematic>
		<kinematic>
			<input>/sim/model/doors/rear-left/cmd</input>
			<traverse>
				<setting>
					<position> 0 </position>
					<time>     0 </time>
				</setting>
				<setting>
					<position> 1 </position>
					<time>     1 </time>
				</setting>
			</traverse>
			<output>/sim/model/doors/rear-left/position-norm</output>
		</kinematic>
		<kinematic>
			<input>/sim/model/doors/right/cmd</input>
			<traverse>
				<setting>
					<position> 0 </position>
					<time>     0 </time>
				</setting>
				<setting>
					<position> 1 </position>
					<time>     1 </time>
				</setting>
			</traverse>
			<output>/sim/model/doors/right/position-norm</output>
		</kinematic>
	</channel>
	
</flight_control>
