<system  name="FCS Beagle Pup">
    <!-- Beagle Pup Flight controls 
   |  Richard Harrison: 2014-11-23 : rjh@zaretto.com - based on F-14 
   Longitudinal travel: -10 to 15cm
-->
    <property value="1">gear/serviceable</property>
    <property value="0">gear/emergency-handle</property>
    <property value="0">malfunctions/fcs/pitch-trim-inop</property>
    <property value="0">malfunctions/fcs/roll-trim-actuator-inop</property>
    <property value="0">malfunctions/fcs/rudder-actuator-inop</property>
    <property value="0">malfunctions/fcs/pitch-trim-inop</property>

    <!-- 1 is full left missing, 0 normal, -1 is full right wing missing -->
    <property value="0">malfunctions/aero/wing-asymmetry</property>
    <property value="0">malfunctions/aero/htail-asymmetry</property>
    <!-- 1 is reduction of area to half normal -->
    <property value="0">malfunctions/aero/vtail-damage</property>

    <channel name="Pitch">
        <summer name="Pitch Trim Sum">
            <input>fcs/elevator-cmd-norm</input>
            <input>fcs/pitch-trim-cmd-norm</input>
            <!--<input>fcs/pitch-damper-rate</input>-->
            <!--<input>systems/afcs/elevator-cmd-delta</input>-->
            <!--<input>systems/cadc/pitch-trim-compensation</input>-->
            <clipto>
                <min> -1 </min>
                <max>  1 </max>
            </clipto>
        </summer>

        <switch name="fcs/pitch-trim-actuator">
            <default value="fcs/pitch-trim-sum"/>
            <!--<test value="fcs/pitch-trim-actuator">
                systems/hydraulics/system-pressure eq 0
            </test>-->
            <test value="fcs/pitch-trim-actuator">
                malfunctions/fcs/pitch-trim-inop ne 0
            </test>
        </switch>

        <aerosurface_scale name="Elevator Control">
            <input>fcs/pitch-trim-actuator</input>
            <range>
                <min> -0.52631578947368421052631578947368 </min>
                <max>  0.35087719298245614035087719298246 </max>
            </range>
            <output>fcs/elevator-pos-raw-demand</output>
        </aerosurface_scale>

        <pure_gain name="Elevator Control">
            <input>fcs/elevator-pos-raw-demand</input>
            <gain>1</gain>
            <output>fcs/elevator-pos-demand</output>
        </pure_gain >

        <kinematic name="elevator position">
            <input>fcs/elevator-pos-demand</input>
            <traverse>
                <setting>
                    <position>-1</position>
                    <time>1</time>
                </setting>
                <setting>
                    <position>1</position>
                    <time>1</time>
                    <!-- based on 30 deg/sec -->
                </setting>
            </traverse>
            <output>fcs/elevator-pos-rad</output>
        </kinematic>

        <aerosurface_scale name="elevator normalization">
            <input>fcs/elevator-pos-rad</input>
            <domain>
                <min> -0.52631578947368421052631578947368 </min>
                <max>  0.35087719298245614035087719298246 </max>
            </domain>
            <range>
                <min> -1 </min>
                <max>  1 </max>
            </range>
            <output>fcs/elevator-pos-norm</output>
        </aerosurface_scale>
    </channel>


    <!-- aileron: +/- 12.5deg : +/- 33 deg/sec -->
    <channel name="Roll">
        <summer name="fcs/roll-trim-sum-raw">
            <input>fcs/aileron-cmd-norm</input>
            <input>fcs/roll-trim-cmd-norm</input>
            <!--<input>fcs/roll-trim-sas-cmd-norm</input>
            <input>fcs/roll-rate-limiter</input>-->
            <clipto>
                <min> -1 </min>
                <max>  1 </max>
            </clipto>
        </summer>

        <pure_gain name="fcs/roll-trim-sum-norm">
            <input>fcs/roll-trim-sum-raw</input>
            <gain>1</gain>
        </pure_gain >

        <switch name="fcs/roll-trim-actuator-norm">
            <default value="fcs/roll-trim-sum-norm"/>
            <!--<test value="fcs/roll-trim-actuator-norm">
                systems/hydraulics/system-pressure eq 0
            </test>-->
            <test value="fcs/roll-trim-actuator-norm">
                malfunctions/fcs/roll-trim-actuator-inop ne 0
            </test>
        </switch>

        <kinematic name="aileron position">
            <input>fcs/roll-trim-actuator-norm</input>
            <traverse>
                <setting>
                    <position>-1</position>
                    <time>1</time>
                </setting>
                <setting>
                    <position>1</position>
                    <time>1</time>
                </setting>
            </traverse>
            <output>fcs/aileron-pos-norm</output>
        </kinematic>

        <aerosurface_scale name="Aileron Control">
            <input>fcs/aileron-pos-norm</input>
            <range>
                <min> -0.2192982456140351</min>
                <max>  0.2192982456140351</max>
            </range>
            <output>fcs/aileron-pos-rad</output>
        </aerosurface_scale>

        <pure_gain name="fcs/aileron-left-pos-rad">
            <input>fcs/aileron-pos-rad</input>
            <gain>1</gain>
            <output>fcs/aileron-left-pos-rad</output>
        </pure_gain >

        <pure_gain name="fcs/aileron-right-pos-rad">
            <input>fcs/aileron-pos-rad</input>
            <gain>1</gain>
        </pure_gain >

        <pure_gain name="fcs/aileron-left-pos-norm">
            <input>fcs/aileron-pos-norm</input>
            <gain>1</gain>
        </pure_gain >
        <pure_gain name="fcs/aileron-right-pos-norm">
            <input>fcs/aileron-pos-norm</input>
            <gain>1</gain>
        </pure_gain >

        <pure_gain name="fcs/aileron-right-pos-deg">
            <input>fcs/aileron-right-pos-rad</input>
            <gain>30</gain>
        </pure_gain >
        <pure_gain name="fcs/aileron-left-pos-deg">
            <input>fcs/aileron-left-pos-rad</input>
            <gain>30</gain>
        </pure_gain >
        <pure_gain name="fcs/aileron-pos-deg">
            <input>fcs/aileron-right-pos-rad</input>
            <gain>30</gain>
        </pure_gain >

        <aerosurface_scale name="left aileron normalization">
            <input>fcs/left-aileron-pos-rad</input>
            <domain>
                <min> -0.22807 </min>
                <max>  0.22807 </max>
            </domain>
            <range>
                <min> -1 </min>
                <max>  1 </max>
            </range>
            <output>fcs/left-aileron-pos-norm</output>
        </aerosurface_scale>

        <aerosurface_scale name="Aileron Control">
            <input>fcs/right-aileron-pos-norm</input>
            <range>
                <min> -20 </min>
                <max>  20 </max>
            </range>
            <output>fcs/aileron-pos-deg</output>
        </aerosurface_scale>

        <aerosurface_scale name="Left Aileron Control">
            <input>fcs/aileron-pos-norm</input>
            <range>
                <min> -0.22807 </min>
                <max>  0.22807 </max>
            </range>
            <output>fcs/left-aileron-pos-rad</output>
        </aerosurface_scale>

        <aerosurface_scale name="Right Aileron Control">
            <input>fcs/aileron-pos-norm</input>
            <range>
                <min> -0.22807 </min>
                <max>  0.22807 </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.22807 </min>
                <max>  0.22807 </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.22807 </min>
                <max>  0.22807 </max>
            </domain>
            <range>
                <min> -1 </min>
                <max>  1 </max>
            </range>
            <output>fcs/right-aileron-pos-norm</output>
        </aerosurface_scale>

        <aerosurface_scale name="Aileron Control">
            <input>fcs/right-aileron-pos-norm</input>
            <range>
                <min> -20 </min>
                <max>  20 </max>
            </range>
            <output>fcs/aileron-pos-deg</output>
        </aerosurface_scale>

    </channel>

    <channel name="Yaw">


        <summer name="fcs/rudder-command-raw-sum">
            <input>fcs/rudder-cmd-norm</input>
            <input>fcs/yaw-trim-cmd-norm</input>
            <!--<input>fcs/ari-lateral-rudder-pos-norm</input>-->
            <clipto>
                <min> -1 </min>
                <max>  1 </max>
            </clipto>
        </summer>
        <pure_gain name="fcs/rudder-command-sum">
            <input>fcs/rudder-command-raw-sum</input>
            <gain>1</gain>
        </pure_gain >

        <summer name="Rudder Sum">
            <input>fcs/rudder-command-sum</input>
            <!--<input>fcs/yaw-damper-dmd</input>-->
            <clipto>
                <min> -1.1 </min>
                <max>  1.1 </max>
            </clipto>
        </summer>

        <switch name="fcs/rudder-actuator-pos">
            <default value="fcs/rudder-sum"/>
            <!--<test value="fcs/rudder-actuator-pos">
                systems/hydraulics/system-pressure eq 0
            </test>-->
            <test value="fcs/rudder-actuator-pos">
                malfunctions/fcs/rudder-actuator-inop ne 0
            </test>
        </switch>
        <kinematic name="Rudder Control">
            <input>fcs/rudder-actuator-pos</input>
            <traverse>
                <setting>
                    <position>-0.35</position>
                    <time>1</time>
                </setting>
                <setting>
                    <position>0.35</position>
                    <time>1</time>
                </setting>
            </traverse>
            <output>fcs/rudder-pos-rad</output>
        </kinematic>

        <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="Landing Gear">
        <switch name="gear/gear-dmd-norm">
            <default value="1"/>
            <test value="1">
                <!-- always force gear down when on ground - to prevent inadvertant retraction -->
                position/aircraft-on-ground ne 0
            </test>
            <output>gear/gear-dmd-norm</output>
        </switch>
        <kinematic name="Gear Control">
            <input>gear/gear-dmd-norm</input>
            <traverse>
                <setting>
                    <position> 0 </position>
                    <time>     0 </time>
                </setting>
                <setting>
                    <position> 1 </position>
                    <time>     1.8 </time>
                </setting>
            </traverse>
            <output>gear/gear-pos-norm</output>
        </kinematic>
    </channel>

    <channel name="Flaps">
        <switch name="fcs/flap-total-dmd">
            <default value="0"/>
            <test value="fcs/flap-cmd-norm">
                fcs/flap-cmd-norm ne 0
            </test>
            <clipto>
                <min> 0 </min>
                <max>  1 </max>
            </clipto>
            <output>fcs/flap-total-dmd</output>
        </switch>

        <kinematic name="Flaps Control">
            <input>fcs/flap-total-dmd</input>
            <traverse>
                <setting>
                    <position>  0 </position>
                    <time>      0 </time>
                </setting>
                <setting>
                    <position> 38 </position>
                    <time>    1.9 </time>
                </setting>
            </traverse>
            <output>fcs/flap-pos-deg</output>
        </kinematic>

        <aerosurface_scale name="flap normalization">
            <input>fcs/flap-pos-deg</input>
            <domain>
                <min>  0 </min>
                <max> 50 </max>
            </domain>
            <range>
                <min> 0 </min>
                <max> 1 </max>
            </range>
            <output>fcs/flap-pos-norm</output>
        </aerosurface_scale>


    </channel>

</system>
