<?xml version="1.0" encoding="UTF-8"?>

<!--
  Diamond DA 20 Katana - 2009 - Emmanuel BARANGER 

  source       : http://en.wikipedia.org/wiki/Diamond_DA20

  Wingspan     : 10.87 m  (35 ft 8 in)
  lenght       :  7.16 m  (23 ft 6 in)
  height       :  2.18 m  ( 7 ft 2 in)
  Empty mass   :   529 kg ( 1166 lb)
  Engine       : 1 × Continental IO-240-B Fixed pitch Hoffman, Sensenich, 125 hp
  Cruise speed :   138 kt (256 km/h)
-->

<airplane mass="1166">

  <!-- Approach configuration -->
  <approach speed="50" aoa="6" fuel="0.3">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.2"/>
    <control-setting axis="/controls/engines/engine[0]/mixture" value="1.0"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.5"/>
    <control-setting axis="/controls/flight/flaps" value="1.0"/>
    <control-setting axis="/controls/gear/gear-down" value="1.0"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="138" alt="0" fuel="1.0">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.75"/>
    <control-setting axis="/controls/engines/engine[0]/mixture" value="1.0"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="1.0"/>
    <control-setting axis="/controls/flight/flaps" value="0.0"/>
    <control-setting axis="/controls/gear/gear-down" value="0.0"/>
  </cruise>

  <cockpit x="1.541" y="0.222" z="0.462"/>

  <fuselage ax="3.617" ay="0" az="0.028" bx="-3.618" by="0" bz="0.028" width="1.051" taper="0.4" midpoint="1"/>

  <wing x="1.367" y="0.513" z="-0.234"
        chord="1.195"
        length="4.877"
        taper="0.70"
        dihedral="5"
        camber="0.018"
        incidence="1"
        sweep="-3">
        <stall aoa="18" width="1.0" peak="1.5"/>
        <flap0 start="0.05" end="0.68" lift="1.4" drag="1.5"/>
        <flap1 start="0.68" end="0.96" lift="1.2" drag="1.1"/>

        <control-input axis="/controls/flight/flaps" control="FLAP0"/>
        <control-input axis="/controls/flight/aileron" control="FLAP1" split="true"/>
        <control-input axis="/controls/flight/aileron-trim" control="FLAP1" split="true"/> 

        <control-output control="FLAP0" prop="/surface-positions/flap-pos-norm"/>
        <control-output control="FLAP1" side="left" prop="/surface-positions/left-aileron-pos-norm"/>
        <control-output control="FLAP1" side="right" prop="/surface-positions/right-aileron-pos-norm"/>

        <control-speed control="FLAP1" transition-time="0.01"/>
        <control-speed control="FLAP0" transition-time="5"/>
  </wing>

  <hstab x="-3.176" y="0" z="1.087"
         chord="0.892"
         length="1.308"
         taper="0.50"
         incidence="0"
         sweep="0">
         <stall aoa="20" width="4" peak="1.5"/>
         <flap0 start="0" end="1.636" lift="2.0" drag="1.1"/>

         <control-input axis="/controls/flight/elevator" control="FLAP0"/>
         <control-input axis="/controls/flight/elevator-trim" control="FLAP0"/>

         <control-output control="FLAP0" prop="/surface-positions/elevator-pos-norm"/>
  </hstab>

  <vstab x="-2.765" y="0" z="-0.106"
       chord="1.385"
       length="1.143" 
       taper="0.60"
       sweep="35">
       <stall aoa="18" width="3" peak="1.5"/>
       <flap0 start="0" end="0.935" lift="1.6" drag="1.3"/>

       <control-input axis="/controls/flight/rudder" control="FLAP0" invert="true"/>

       <control-output control="FLAP0" prop="/surface-positions/rudder-pos-norm" min="1" max="-1"/>
  </vstab>

  <!--  Lycoming IO-320-L2A
                 source       : http://en.wikipedia.org/wiki/Continental_O-240

                 power        : 125 hp at 2,800 rpm
                 weight       : 255 lb  (116 kg)
                 Displacement : 240 in3 (3.93 L)
                 Compression  : 8.5:1
  -->
  <propeller x="3.000" y="0" z="0.046" 
             mass="255" 
             radius="0.83"
             moment="10"
             cruise-speed="138" 
             cruise-rpm="2600"
             cruise-alt="0" 
             cruise-power="110"
             takeoff-power="125" 
             takeoff-rpm="2800" >
             <piston-engine eng-rpm="2800" 
                            alt="0000" 
                            eng-power="125" 
                            displacement="240" 
                            compression="8.5"/>
             <actionpt x="3.447" y="0" z="0.046"  />
             <control-input axis="/controls/engines/engine[0]/propeller-pitch" control="ADVANCE"/>
             <control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
             <control-input axis="/controls/engines/engine[0]/starter" control="STARTER"/>
             <control-input axis="/controls/engines/engine[0]/magnetos" control="MAGNETOS"/>
             <control-input axis="/controls/engines/engine[0]/mixture" control="MIXTURE"/>
  </propeller>

  <gear x="2.919" y="0" z="-1.109" 
        compression="0.15" 
        spring="0.6">
        <control-input axis="/controls/flight/rudder" control="STEER" src0="-1.0" src1="1.0" dst0="-0.2" dst1="0.2"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>
        <control-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="/gear/gear[0]/position-norm"/>
   </gear>

  <!-- 0.820 -->
  <gear x="1.222" y="0.962" z="-1.109" 
        compression="0.10" 
        spring="0.6">
        <control-input axis="/controls/gear/brake-left" control="BRAKE" split="true"/>
        <control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>
        <control-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="gear/gear[1]/position-norm"/>
  </gear>

  <gear x="1.222" y="-0.962" z="-1.109" 
        compression="0.10" 
        spring="0.6">
        <control-input axis="/controls/gear/brake-right" control="BRAKE" split="true"/>
        <control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>
        <control-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="gear/gear[2]/position-norm"/>
  </gear>

  <!-- Fuel  -->
  <tank x="0.72" y="1.323" z="-0.272" capacity="169" />

  <ballast x="2.2" y="0" z="-1" mass="250"/>

</airplane>
