<?xml version="1.0"?>
<system name="Banner">

	<channel name="banner">
	<!-- <channel name="banner" execute="/sim/model/banner-on-hook"> -->
	
		<fcs_function name="external_reactions/banner/magnitude"> <!-- lbs -->
			<function>
				<description>Drag_due_to_banner</description>
				<product>
					<property>aero/qbar-psf</property>
					<property>/sim/model/banner/CDxA-banner-sqft</property>
					<property>fcs/speedbrake-pos-norm</property>
				</product>
			</function>
		</fcs_function>
		
		<fcs_function name="systems/banner/deflection_aero">
			<function>
				<description>weighting factor for banner deflection due to aero and gravity
				             0:= only deflection due to gravity
				             1:= only deflection due to aero
				             super rough assumption / should be improved
				</description>
				<min>
					<quotient>
						<property>velocities/vt-fps</property>
						<value>10</value>
					</quotient>
					<value>1</value>
				</min>
			</function>
		</fcs_function>
		
		<fcs_function name="systems/banner/dir-x">
			<function>
				<description>x-direction (not yet normalized)</description>
				<sum>
					<!-- <property>accelerations/Nx</property> -->
					<property>accelerations/a-pilot-x-ft_sec2</property>
					<product>
						<sum>
							<property>velocities/u-aero-fps</property>
							<!-- <property>-accelerations/Nx</property> -->
							<property>-accelerations/a-pilot-x-ft_sec2</property>
						</sum>
						<property>systems/banner/deflection_aero</property>
					</product>
				</sum>
			</function>
		</fcs_function>
		
		<fcs_function name="systems/banner/dir-y">
			<function>
				<description>y-direction (not yet normalized)</description>
				<sum>
					<!-- <property>accelerations/Ny</property> -->
					<property>accelerations/a-pilot-y-ft_sec2</property>
					<product>
						<sum>
							<property>velocities/v-aero-fps</property>
							<!-- <property>-accelerations/Ny</property> -->
							<property>-accelerations/a-pilot-y-ft_sec2</property>
						</sum>
						<property>systems/banner/deflection_aero</property>
					</product>
				</sum>
			</function>
		</fcs_function>
		
		<fcs_function name="systems/banner/dir-z">
			<function>
				<description>z-direction (not yet normalized)</description>
				<sum>
					<!-- <<property>accelerations/Nz</property> -->
					<property>accelerations/a-pilot-z-ft_sec2</property>
					<product>
						<sum>
							<property>velocities/w-aero-fps</property>
							<!-- <<property>-accelerations/Nz</property> -->
							<property>-accelerations/a-pilot-z-ft_sec2</property>
						</sum>
						<property>systems/banner/deflection_aero</property>
					</product>
				</sum>
			</function>
		</fcs_function>
		
		<fcs_function name="systems/banner/dir-xy">
			<function>
				<description>abs xy-direction</description>
				<sqrt>
					<sum>
						<product>
							<property>systems/banner/dir-x</property>
							<property>systems/banner/dir-x</property>
						</product>
						<product>
							<property>systems/banner/dir-y</property>
							<property>systems/banner/dir-y</property>
						</product>
					</sum>
				</sqrt>
			</function>
		</fcs_function>
		
		<fcs_function name="systems/banner/alpha-deg">
			<function>
				<description>alpha for banner animation</description>
				<todegrees>
					<atan2>
						<property>systems/banner/dir-z</property>
						<property>systems/banner/dir-xy</property>
					</atan2>
				</todegrees>
			</function>
			<output>/sim/model/banner/alpha-deg</output>
		</fcs_function>
		
		<fcs_function name="systems/banner/beta-deg">
			<function>
				<description>beta for banner animation</description>
				<todegrees>
					<atan2>
						<property>systems/banner/dir-y</property>
						<property>systems/banner/dir-x</property>
					</atan2>
				</todegrees>
			</function>
			<output>/sim/model/banner/beta-deg</output>
		</fcs_function>
		
		<switch name="velocities/vt-fps_is_never_zero">
			<default value="velocities/vt-fps"/>
			<test value="0.00000001">
				velocities/vt-fps eq 0.
			</test>
		</switch>
		
		<!--
		<switch name="velocities/vt-fps_is_never_zero">
			<default value="0.000001"/>
			<test value="velocities/vt-fps">
				velocities/vt-fps ge 0.001
			</test>
		</switch>
		-->
		
		<fcs_function name="external_reactions/banner/x">
			<function>
				<description>Normalized force x-direction</description>
				<quotient>
					<property>-velocities/u-aero-fps</property>
					<property>velocities/vt-fps_is_never_zero</property>
				</quotient>
			</function>
		</fcs_function>
		
		<fcs_function name="external_reactions/banner/y">
			<function>
				<description>Normalized force y-direction</description>
				<quotient>
					<property>-velocities/v-aero-fps</property>
					<property>velocities/vt-fps_is_never_zero</property>
				</quotient>
			</function>
		</fcs_function>
		
		<fcs_function name="external_reactions/banner/z">
			<function>
				<description>Normalized force z-direction</description>
				<quotient>
					<property>-velocities/w-aero-fps</property>
					<property>velocities/vt-fps_is_never_zero</property>
				</quotient>
			</function>
		</fcs_function>
		
	</channel>

</system>
