<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://jsbsim.sourceforge.net/JSBSim.xsl"?>
<fdm_config name="c152" version="2.0" release="ALPHA"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">

 <fileheader>
  <author> Aeromatic v 0.95 </author>
  <filecreationdate>2015-10-04</filecreationdate>
  <version>$Revision: 1.15 $</version>
  <description> Models a c152.</description>
 </fileheader>

<!--
  File:     c152.xml
  Inputs:
    name:          c152
    type:          light single
    max weight:    1670.0 lb
    wing span:     33.4 ft
    length:        24.1 ft
    wing area:     unspecified
    gear type:     tricycle
    retractable?:  no
    # engines:     1
    engine type:   piston
    engine layout: forward fuselage
    yaw damper?    no

  Outputs:
    wing loading:  14.00 lb/sq-ft
    payload:       289.8 lbs
    CL-alpha:      5 per radian
    CL-0:          0.25
    CL-max:        1.4
    CD-0:          0.028
    K:             0.04

-->

 <metrics>
   <wingarea  unit="FT2">  159.29 </wingarea>
   <wingspan  unit="FT" >   33.40 </wingspan>
   <wing_incidence>          2.00 </wing_incidence>
   <chord     unit="FT" >    4.77 </chord>
   <htailarea unit="FT2">   19.09 </htailarea>
   <htailarm  unit="FT" >   10.53 </htailarm>
   <vtailarea unit="FT2">   11.93 </vtailarea>
   <vtailarm  unit="FT" >   16.05 </vtailarm>
   <location name="AERORP" unit="IN">
     <x> 85.82 </x>
     <y>   0.00 </y>
     <z>   0.00 </z>
   </location>
   <location name="EYEPOINT" unit="IN">
     <x>  37.60 </x>
     <y> -18.00 </y>
     <z>  40.00 </z>
   </location>
   <location name="VRP" unit="IN">
     <x>0</x>
     <y>0</y>
     <z>0</z>
   </location>
 </metrics>

 <mass_balance>
   <ixx unit="SLUG*FT2"> 955</ixx>
   <iyy unit="SLUG*FT2">1162</iyy>
   <izz unit="SLUG*FT2">2183</izz>
   <ixy unit="SLUG*FT2">   0</ixy>
   <ixz unit="SLUG*FT2">   0</ixz>
   <iyz unit="SLUG*FT2">   0</iyz>   
   <emptywt unit="LBS" > 1081</emptywt>
   <location name="CG" unit="IN">
     <x> 85.82 </x>
     <y>   0.00 </y>
     <z> -9.23 </z>
   </location>
        
    <pointmass name="Pilot">
        <weight unit="LBS"> 176.37 </weight>
        <location name="POINTMASS" unit="IN">
            <x> 90.66 </x>
            <y> -9.10 </y>
            <z> -1.69 </z>
        </location>
    </pointmass>

    <pointmass name="Co-Pilot">
        <weight unit="LBS"> 176.37 </weight>
        <location name="POINTMASS" unit="IN">
            <x> 90.66 </x>
            <y>  9.10 </y>
            <z> -1.69 </z>
        </location>
    </pointmass>
    
    <pointmass name="Baggage">
        <description> Baggage </description>
        <weight unit="LBS"> 120 </weight>
        <location name="POINTMASS" unit="IN">
            <x> 118.60 </x>
            <y>   0.00 </y>
            <z>  -6.81 </z>
        </location>
  </pointmass>
  
 </mass_balance>

 <ground_reactions>

<!-- Landing Gear -->
  <contact type="BOGEY" name="NOSE">
   <location unit="IN">
     <x>  30.60 </x>
     <y>   0.00 </y>
     <z> -46.45 </z>
   </location>
   <static_friction>  0.72 </static_friction>
   <dynamic_friction> 0.58 </dynamic_friction>
   <rolling_friction> 0.02 </rolling_friction>
   <spring_coeff unit="LBS/FT"> 1800.00 </spring_coeff>
   <damping_coeff unit="LBS/FT/SEC"> 994.00 </damping_coeff>
   <damping_coeff_rebound unit="LBS/FT/SEC">10</damping_coeff_rebound>
   <max_steer unit="DEG"> 30.00 </max_steer>
   <brake_group>NONE</brake_group>
   <retractable>0</retractable>
  </contact>

  <contact type="BOGEY" name="LEFT_MAIN">
   <location unit="IN">
     <x>  95.85 </x>
     <y> -45.62 </y>
     <z> -48.43 </z>
   </location>
   <static_friction>  0.52 </static_friction>
   <dynamic_friction> 0.62 </dynamic_friction>
   <rolling_friction> 0.02 </rolling_friction>
   <spring_coeff unit="LBS/FT"> 2900.00 </spring_coeff>
   <damping_coeff unit="LBS/FT/SEC"> 1500.00 </damping_coeff>
   <damping_coeff_rebound unit="LBS/FT/SEC">10</damping_coeff_rebound>
   <max_steer unit="DEG">0</max_steer>
   <brake_group>LEFT</brake_group>
   <retractable>0</retractable>
  </contact>

  <contact type="BOGEY" name="RIGHT_MAIN">
   <location unit="IN">
<!--     <x> 154.37 </x> -->
	 <x>  95.85 </x>
     <y>  45.62 </y>
     <z> -48.43 </z>
   </location>
   <static_friction>  0.52 </static_friction>
   <dynamic_friction> 0.62 </dynamic_friction>
   <rolling_friction> 0.02 </rolling_friction>
   <spring_coeff unit="LBS/FT"> 2900.00 </spring_coeff>
   <damping_coeff unit="LBS/FT/SEC"> 1500.00 </damping_coeff>
   <damping_coeff_rebound unit="LBS/FT/SEC">10</damping_coeff_rebound>
   <max_steer unit="DEG">0</max_steer>
   <brake_group>RIGHT</brake_group>
   <retractable>0</retractable>
  </contact>

  <contact type="STRUCTURE" name="LEFT_WING">
    <location unit="IN">
     <x> 138.82 </x>
     <y> -16.70 </y>
     <z>  -7.23 </z>
    </location>
    <static_friction>  0.85 </static_friction>
    <dynamic_friction> 0.50 </dynamic_friction>
    <spring_coeff unit="LBS/FT">       1670.00 </spring_coeff>
    <damping_coeff unit="LBS/FT/SEC">  1670.00 </damping_coeff>
  </contact>

  <contact type="STRUCTURE" name="RIGHT_WING">
    <location unit="IN">
     <x> 138.82 </x>
     <y>  16.70 </y>
     <z>  -7.23 </z>
    </location>
    <static_friction>  0.85 </static_friction>
    <dynamic_friction> 0.50 </dynamic_friction>
    <spring_coeff unit="LBS/FT">       1670.00 </spring_coeff>
    <damping_coeff unit="LBS/FT/SEC">  1670.00 </damping_coeff>
  </contact>

  <contact type="BOGEY" name="TAIL_SKID">
      <location unit="IN">
          <x> 370.33 </x>
          <y> 0 </y>
          <z> -7.15 </z>
      </location>
      <static_friction> 1.0 </static_friction>
      <dynamic_friction> 1.0 </dynamic_friction>
      <rolling_friction> 1.0 </rolling_friction>
      <spring_coeff unit="LBS/FT"> 1900 </spring_coeff>
      <damping_coeff unit="LBS/FT/SEC"> 540 </damping_coeff>
      <max_steer unit="DEG"> 0.0 </max_steer>
      <brake_group> NONE </brake_group>
      <retractable>0</retractable>
    </contact>

 </ground_reactions>

  <propulsion>
    <engine file="lyc_O-235">
      <feed>0</feed>
      <thruster file="tcm6958">
        <location unit="IN">
          <x>   5.00 </x>
          <y>   0.00 </y>
          <z>   0.00 </z>
        </location>
        <orient unit="DEG">
          <pitch> 0.00 </pitch>
          <roll>  0.00 </roll>
          <yaw>   0.00 </yaw>
        </orient>
        <sense> 1 </sense>
        <p_factor> 15 </p_factor> 
     </thruster>
    </engine>

    <tank type="FUEL" number="0">
      <location unit="IN">
        <x>  34.25 </x>
        <y>    0.0 </y>
        <z>    0.0 </z>
      </location>
      <capacity unit="LBS">  0.10 </capacity>
      <contents unit="LBS">  0.00 </contents>
      <type>AVGAS</type>  
    </tank>

    <tank type="FUEL" number="1">
      <location unit="IN">
        <x> 86.29 </x>
        <y>-106.89 </y>
        <z> 26.33 </z>
      </location>
      <capacity unit="LBS"> 78.0 </capacity>
      <contents unit="LBS">  61.79 </contents>
      <type>AVGAS</type>  
    </tank>

    <tank type="FUEL" number="2">
      <location unit="IN">
        <x> 86.29 </x>
        <y>106.89 </y>
        <z> 26.33 </z>
      </location>      
      <capacity unit="LBS"> 78.0 </capacity>
      <contents unit="LBS">  61.79 </contents>
      <type>AVGAS</type>
    </tank>

  </propulsion>

  <system file="fuel"/>
  <system file="towbar"/> <!-- integrate towbar -->

  <flight_control name="FCS: c152">

        <channel name="Mixture">
            <!-- If the engine was primed enough times and throttle
                 is in starter position, then mixture is 1.
				 (Taked from J3Cub logic)
            -->
            <fcs_function name="fcs/mixture-primer-cmd">
                <function>
                    <table>
                        <independentVar lookup="row">/controls/engines/engine/primer</independentVar>
                        <independentVar lookup="column">/controls/engines/engine/throttle</independentVar>
                        <tableData>
                                 0.09    0.1    0.5    0.51
                            2    0       0      0      0
                            3    0       1      1      0
                            4    0       1      1      0
                            5    0       1      1      0
                            6    0       1      1      0
                            7    0       0      0      0
                        </tableData>
                    </table>
                </function>
            </fcs_function>

            <pure_gain name="fcs/mixture-primer">
                <input>fcs/mixture-cmd-norm</input>
                <gain>fcs/mixture-primer-cmd</gain>
            </pure_gain>

            <!-- Primer logic -->
            <switch name="Mixture Position">
                <default value="fcs/mixture-cmd-norm"/>
                <output>fcs/mixture-pos-norm</output>
                <!-- Use primer if used and engine is cold. If engine
                     is warm, then the mixture lever is used.
                -->
                <test logic="AND" value="fcs/mixture-primer">
                    /controls/engines/engine/use-primer eq 1
                    /engines/engine/oil-temperature-degf le 75
                </test>
            </switch>

        </channel>

    <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">
            <!-- Disable flap movement if electrical voltage is too low -->
            <switch name="Flaps Command">
                <default value="fcs/flap-cmd-norm"/>
                <output>fcs/flap-input-norm1</output>

                <!-- Route back the (normalized) output of the <kinematic>
                     to its input in order to disable it.
                -->
                <test logic="AND" value="fcs/flap-pos-norm">
                    /systems/electrical/outputs/flaps le 16
                </test>
            </switch> 

            <kinematic name="Flaps Control">
                <input>fcs/flap-input-norm1</input>
                <traverse>
                    <setting>
                        <position>0</position>
                        <time>0</time>
                    </setting>
                    <setting>
                        <position>10</position>
                        <time>2</time>
                    </setting>
                    <setting>
                        <position>20</position>
                        <time>1</time>
                    </setting>
                    <setting>
                        <position>30</position>
                        <time>1</time>
                    </setting>
                </traverse>
                <output>fcs/flap-pos-deg</output>
            </kinematic>

            <aerosurface_scale name="Flap Position Normalizer">
                <input>fcs/flap-pos-deg</input>
                <domain>
                    <min>0</min> <!-- Flaps actual minimum position -->
                    <max>30</max> <!-- Flaps actual maximum position -->
                </domain>
                <range>
                    <min>0</min> <!-- Flaps normalized minimum position -->
                    <max>1</max> <!-- Flaps normalized maximum position -->
                </range>
                <output>fcs/flap-pos-norm</output>
            </aerosurface_scale>

            <kinematic name="Flaps Lever">
                <input>/controls/flight/flaps</input>
                <traverse>
                    <setting>
                        <position>0</position>
                        <time>0</time>
                    </setting>
                    <setting>
                        <position>1</position>
                        <time>1</time>
                    </setting>
                </traverse>
                <output>/sim/model/c152/cockpit/flaps-lever</output>
            </kinematic>
        </channel>

	<!-- following code by Jonathan Redpath aka legoboyvdlp-->
	<channel name="NWS">
            <switch name="fcs/nws-enabled">
                <default value="0"/>
                <test logic="OR" value="1"> <!-- NWS mechanically centered if gear is fully extended -->
                    /gear/gear[0]/compression-norm gt 0.001
                </test>
            </switch>

            <fcs_function name="left brake nose-gear">
                <function name="fcs/nose-gear-left-brake-steer-factor">
                    <product>
                        <property>fcs/left-brake-cmd-norm</property>
                        <value>-1</value>
                    </product>
                </function>
            </fcs_function>

            <fcs_function name="right brake nose-gear">
                <function name="fcs/nose-gear-right-brake-steer-factor">
                    <product>
                        <property>fcs/right-brake-cmd-norm</property>
                        <value>1</value>
                    </product>
                </function>
            </fcs_function>

            <summer name="fcs/brake-sum">
                <input>fcs/nose-gear-right-brake-steer-factor</input>
                <input>fcs/nose-gear-left-brake-steer-factor</input>
                <clipto>
                    <min>-1</min>
                    <max>1</max>
                </clipto>
            </summer>

            <switch name="fcs/brake-influence-enabled"> <!-- brake should not influence nws if the aircraft is not moving -->
                <default value="0"/>
                <test logic="OR" value="1">
                    /gear/gear[0]/rollspeed-ms gt 0.25
                </test>
            </switch>

            <fcs_function name="fcs/brake-sum-adjusted">
                <function>
                    <product>
                        <property>fcs/brake-influence-enabled</property>
                        <property>fcs/brake-sum</property>
                    </product>
                </function>
            </fcs_function>

            <fcs_function name="fcs/nws-cmd-deg"> <!-- Drive the nose wheel with the rudder and brakes -->
                <function>
                    <table>
                        <independentVar lookup="row">fcs/brake-sum-adjusted</independentVar>
                        <independentVar lookup="column">/controls/flight/rudder</independentVar>
                        <tableData>
                                -1  0   1
                          -1    -29 0   11
                           0    -11 0   11
                           1    -11 0   29
                        </tableData>
                    </table>
                </function>
            </fcs_function>

            <fcs_function name="fcs/nws-cmd-deg-adjusted">
                <function>
                    <product>
                        <property>fcs/nws-cmd-deg</property>
                        <property>fcs/nws-enabled</property>
                    </product>
                </function>
            </fcs_function>

            <actuator name="fcs/steer-deg-actuator">
                <input>fcs/nws-cmd-deg-adjusted</input>
                <rate_limit>80</rate_limit> <!-- 80 deg / s , or 1/8 second to full deflection with NWS -->
                <output>fcs/steer-pos-deg-actuator</output>
            </actuator>
            <switch name="fcs/steer-pos-deg">
                <default value="fcs/steer-pos-deg-actuator"/>
                <test value="external_reactions/towbar/steer-deg">
                    external_reactions/towbar/attached eq 1
                    gear/unit[0]/WOW eq 1
                </test>
            </switch>
	</channel>


  </flight_control>


    <aerodynamics>
      <alphalimits unit="DEG">
         <min>-5.0</min>
         <max>14.0</max>
      </alphalimits>

      <hysteresis_limits unit="DEG">
         <min> 5.0</min>
         <max>20.0</max>
      </hysteresis_limits>

      <function name="aero/function/ground-effect-factor-lift">
         <description>Change in lift due to ground effect factor</description>
            <table>
               <independentVar>aero/h_b-mac-ft</independentVar>
               <tableData>
                  0.0  1.203
                  0.1  1.127
                  0.15 1.090
                  0.2  1.073
                  0.3  1.046
                  0.4  1.055
                  0.5  1.019
                  0.6  1.013
                  0.7  1.008
                  0.8  1.006
                  0.9  1.003
                  1.0  1.002
                  1.1  1.0
               </tableData>
            </table>
      </function>

      <function name="aero/function/ground-effect-factor-drag">
         <description>Change in drag due to ground effect</description>
            <table>
               <independentVar>aero/h_b-mac-ft</independentVar>
               <tableData>
                  0.0  0.480
                  0.1  0.515
                  0.15 0.629
                  0.2  0.709
                  0.3  0.815
                  0.4  0.882
                  0.5  0.928
                  0.6  0.962
                  0.7  0.988
                  0.8  1.0
                  0.9  1.0
                  1.0  1.0
                  1.1  1.0
               </tableData>
            </table>
      </function>

        <function name="aero/function/vel-propwash-fps">
            <description> propeller induced velocity </description>
            <sum>
                <property>propulsion/engine/prop-induced-velocity_fps</property>
				<value>0.0</value>
            </sum>
        </function>

        <function name="aero/function/qbar-propwash-psf">
            <description> q bar due to the propeller induced velocity </description>
            <product>
                <property>aero/function/vel-propwash-fps</property>
                <property>aero/function/vel-propwash-fps</property>
                <property>atmosphere/rho-slugs_ft3</property>
                <value>0.5</value>
            </product>
        </function>

        <function name="aero/function/velocity-induced-fps">
            <description> velocity including the propulsion induced velocity.</description>
            <sum>
                <property>velocities/u-aero-fps</property>
                <property>propulsion/engine/prop-induced-velocity_fps</property>
                <property>propulsion/engine/prop-induced-velocity_fps</property>
            </sum>
        </function>
       

        <function name="aero/function/qbar-induced-psf">
            <description> q bar including the propulsion induced velocity.</description>
            <product>
                <property>aero/function/velocity-induced-fps</property>
                <property>aero/function/velocity-induced-fps</property>
                <property>atmosphere/rho-slugs_ft3</property>
                <value>0.5</value>
            </product>
        </function>
        

        <axis name="DRAG">
            <function name="aero/coefficient/CD0">
                <description>Drag_at_zero_lift</description>
                <product>
                    <property>aero/function/ground-effect-factor-drag</property>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -1.5700	     1.5000	
                               -.2793         .1014    
                               -.1396         .2981E-01
                               -.1047         .2156E-01
                               -.6981E-01     .1687E-01
                               -.3491E-01     .1535E-01
                                .000          .1702E-01
                                .3491E-01     .2225E-01
                                .6981E-01     .3142E-01
                                .1396         .6338E-01
                                .1571         .7447E-01
                                .1745         .8682E-01
                                .2094         .1123    
                                .2443         .1366    
                                .2793         .1595    
                                .3142         .1797    
                                .3316         .1885    
                                .3491         .1886    
                                .3665         .1852    
                                .3840         .1610    
                                .4189         .1039    
                               1.5700        1.5000	
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDi">
                <description>Induced_drag</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>aero/cl-squared</property>
                    <value>0.0020</value>
                </product>
            </function>
            <function name="aero/coefficient/CDflap">
                <description>Drag_due_to_flaps</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/flap-pos-deg</property>
                    <value>0.0010</value>
                </product>
            </function>
<!--            <function name="aero/coefficient/CDsb">
                <description>Drag_due_to_speedbrakes</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/speedbrake-pos-norm</property>
                    <value>0.0280</value>
                </product>
            </function> -->
            <function name="aero/coefficient/CDbeta">
                <description>Drag_due_to_sideslip</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                      <table>
                          <independentVar>aero/beta-rad</independentVar>
                          <tableData>
                             -1.5700	1.2300	
                             -0.2600	0.0500	
                              0.0000	0.0000	
                              0.2600	0.0500	
                              1.5700	1.2300	
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDde">
                <description>Drag_due_to_Elevator_Deflection</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sh-sqft</property>
                    <abs><property>fcs/elevator-pos-norm</property></abs>
                    <value>0.0300</value>
                </product>
            </function>
        </axis>

        <axis name="SIDE">
            <function name="aero/coefficient/CYb">
                <description>Side_force_due_to_beta</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>aero/beta-rad</property>
                    <value>.1027</value>
                </product>
            </function>
        </axis>

        <axis name="LIFT">
            <function name="aero/coefficient/CLalpha">
                <description>Lift_due_to_alpha</description>
                <product>
                    <property>aero/function/ground-effect-factor-lift</property>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -.2793        -1.298    
                              -.1396        -.5118    
                              -.1047        -.3244    
                              -.6981E-01    -.1446    
                              -.3491E-01     .2816E-01
                               .000          .2070    
                               .3491E-01     .3944    
                               .6981E-01     .5894    
                               .1396         1.002    
                               .1571         1.108    
                               .1745         1.216    
                               .2094         1.409    
                               .2443         1.565    
                               .2793         1.691    
                               .3142         1.783    
                               .3316         1.814    
                               .3491         1.791    
                               .3665         1.737    
                               .3840         1.531    
                               .4189         .6785    
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/dCLflap">
                <description>Delta_Lift_due_to_flaps</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/flap-pos-deg</property>
<!--                    <value>0.01333</value> -->
                    <value>0.00933</value>

                </product>
            </function>
<!--            <function name="aero/coefficient/dCLsb">
                <description>Delta_Lift_due_to_speedbrake</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/speedbrake-pos-norm</property>
                    <value>0.0000</value>
                </product>
            </function> -->
            <function name="aero/coefficient/CLde">
                <description>Lift_due_to_Elevator_Deflection</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
               <table>
                  <independentVar>fcs/elevator-pos-deg</independentVar>
                  <tableData>
                      -26.00	   .1787    
                      -17.00	   .1664    
                      -10.00	   .1138    
                       -5.00	   .5690E-01
                        .00	  -.1138E-03
                       5.00	  -.5690E-01
                       9.00	  -.1024    
                      13.00	  -.1434    
                      17.00	  -.1664    
                  </tableData>
               </table>
                </product>
            </function>
            
        </axis>

        <axis name="ROLL">
            <function name="aero/coefficient/Clb">
                <description>Roll_moment_due_to_beta</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>aero/beta-rad</property>
                    <value>-0.0790</value>
                </product>
            </function>
            <function name="aero/coefficient/Clp">
                <description>Roll_moment_due_to_roll_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>aero/bi2vel</property>
                    <property>velocities/p-aero-rad_sec</property>
                    <value>-0.4700</value>
                </product>
            </function>
            <function name="aero/coefficient/Clr">
                <description>Roll_moment_due_to_yaw_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>aero/bi2vel</property>
                    <property>velocities/r-aero-rad_sec</property>
                    <value>0.0960</value>
                </product>
            </function>
            <function name="aero/coefficient/Clda">
                <description>Roll_moment_due_to_aileron</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>fcs/left-aileron-pos-rad</property>
                      <table>
                          <independentVar>velocities/mach</independentVar>
                          <tableData>
                              0.0000	0.1700	
                              2.0000	0.0570	
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/Cldr">
                <description>Roll_moment_due_to_rudder</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>fcs/rudder-pos-rad</property>
                    <value>0.0140</value>
                </product>
            </function>
        </axis>

        <axis name="PITCH">
            <function name="aero/coefficient/Cmalpha">
                <description>Pitch_moment_due_to_alpha</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/cbarw-ft</property>
                    <property>aero/alpha-rad</property>
                    <value>-1.2000</value>
                </product>
            </function>

<!--            <function name="aero/coefficient/Cmde">
                <description>Pitch_moment_due_to_elevator</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/cbarw-ft</property>
                    <property>fcs/elevator-pos-rad</property>
                      <table>
                          <independentVar>velocities/mach</independentVar>
                          <tableData>
                              0.0000	-1.1000	
                              2.0000	-0.2750	
                          </tableData>
                      </table>
                </product>
            </function> -->
            
            <function name="aero/coefficient/Cmde">
                <description>Pitch_moment_due_to_elevator_deflection</description>
                <product>
                    <property>aero/function/qbar-induced-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/cbarw-ft</property>
                    <property>fcs/elevator-pos-rad</property>
                    <value>-0.28</value>
                    <!--
                        stall and spin (6):
                        elevator loss of efficiency when stalled
                    -->
                    <table>
                        <independentVar lookup="row">fcs/elevator-pos-rad</independentVar>
                        <independentVar lookup="column">aero/alpha-deg</independentVar>
                        <tableData>
                                    18  25   35     45     55      65      90
                            -0.49   1   0.5  0.2    0.1    0.1     0.1     0.1
                            0       1   0.6  0.3    0.15   0.1     0.1     0.1
                            0.40    1   0.9  0.8    0.7    0.6     0.5     0.4
                        </tableData>
                    </table>
                </product>
            </function>
                        
            
            <function name="aero/coefficient/Cmq">
                <description>Pitch_moment_due_to_pitch_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/cbarw-ft</property>
                    <property>aero/ci2vel</property>
                    <property>velocities/q-aero-rad_sec</property>
                    <value>-12.4000</value>
                </product>
            </function>
            <function name="aero/coefficient/Cmadot">
                <description>Pitch_moment_due_to_alpha_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/cbarw-ft</property>
                    <property>aero/ci2vel</property>
                    <property>aero/alphadot-rad_sec</property>
                    <value>-0.8900</value>
                </product>
            </function>
        </axis>

        <axis name="YAW">
            <function name="aero/coefficient/Cnb">
                <description>Yaw_moment_due_to_beta</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>aero/beta-rad</property>
                    <value>0.0650</value>
                </product>
            </function>
            <function name="aero/coefficient/Cnr">
                <description>Yaw_moment_due_to_yaw_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>aero/bi2vel</property>
                    <property>velocities/r-aero-rad_sec</property>
                    <value>-0.15</value>
                </product>
            </function>
            <function name="aero/coefficient/Cndr">
                <description>Yaw_moment_due_to_rudder</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>metrics/bw-ft</property>
                    <property>fcs/rudder-pos-rad</property>
                    <value>-0.1</value>
                </product>
            </function>
			<function name="aero/moment/Yaw_aileron">
				<description>Adverse yaw</description>
				<product>
				   <property>aero/qbar-psf</property>
				   <property>metrics/Sw-sqft</property>
				   <property>metrics/bw-ft</property>
				   <property>fcs/left-aileron-pos-rad</property>
				   <value>-0.01</value>
				</product>
			</function>
        </axis>
    </aerodynamics>

 <external_reactions>

        <!-- Towbar -->
        <force name="towbar" frame="BODY">
             <location unit="IN">
                <x>-10.31</x>
                <y>0</y>
                <z>-47.17</z>
            </location>
            <direction>
                <x>1</x>
                <y>0</y>
                <z>0</z>
            </direction>
        </force>

 </external_reactions>
 
</fdm_config>

