<?xml version="1.0" encoding="ISO-8859-1"?>

<!--
  Diamond DA 20 Katana - 2009         - Create  Emmanuel BARANGER
                       - 2013         - Updated Emmanuel BARANGER
                       - April   2014 - Updated Emmanuel BARANGER with Melchior's script
                       - October 2019 - Updated Emmanuel BARANGER
                       - August  2024 - Updated Emmanuel BARANGER

  source        : https://www.wikiwand.com/en/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   )
  Gross weight  :    800 kg (  1764 lb   )
  Engine        :  1 Continental IO-240-B Fixed pitch Hoffman, Sensenich, 125 hp
  Cruise speed  :    138 kt ( 256 km/h   )
  Fuel capacity : 24 US gal (  91 L      )
-->
<airplane mass="1166" version="YASIM_VERSION_CURRENT" mtow-lbs="1764">

  <!-- Approach configuration -->
  <approach speed="50" aoa="3" 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"/>
  </approach>

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

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

  <fuselage ax=" 3.613" ay=" 0.000" az=" 0.047" bx=" 3.522" by=" 0.000" bz=" 0.047" width="0.185" taper="0.25" midpoint="1"/>
  <fuselage ax=" 3.522" ay=" 0.000" az=" 0.047" bx=" 3.394" by=" 0.000" bz=" 0.047" width="0.243" taper="0.76" midpoint="1"/>

  <fuselage ax=" 3.378" ay="-0.134" az=" 0.062" bx=" 2.401" by="-0.134" bz="-0.028" width="0.731" taper="0.50" midpoint="1"/>
  <fuselage ax=" 2.438" ay="-0.134" az="-0.028" bx=" 1.088" by="-0.134" bz="-0.028" width="0.731" taper="1.00" midpoint="1"/>
  <fuselage ax=" 1.088" ay="-0.134" az="-0.028" bx="-3.471" by=" 0.000" bz="-0.022" width="0.731" taper="0.20" midpoint="0"/>

  <fuselage ax=" 3.378" ay=" 0.134" az=" 0.062" bx=" 2.401" by=" 0.134" bz="-0.028" width="0.731" taper="0.50" midpoint="1"/>
  <fuselage ax=" 2.438" ay=" 0.134" az="-0.028" bx=" 1.088" by=" 0.134" bz="-0.028" width="0.731" taper="1.00" midpoint="1"/>
  <fuselage ax=" 1.088" ay=" 0.134" az="-0.028" bx="-3.471" by=" 0.000" bz="-0.022" width="0.731" taper="0.20" midpoint="0"/>

  <fuselage ax=" 2.486" ay=" 0.000" az=" 0.009" bx=" 1.518" by=" 0.000" bz=" 0.166" width="1.030" taper="0.60" midpoint="1"/>
  <fuselage ax=" 1.610" ay=" 0.000" az=" 0.165" bx=" 0.787" by=" 0.000" bz=" 0.165" width="1.030" taper="0.80" midpoint="0"/>
  <fuselage ax=" 0.841" ay=" 0.000" az=" 0.165" bx="-0.300" by=" 0.000" bz=" 0.035" width="0.824" taper="0.50" midpoint="0"/>

  <wing x="1.367" y="0" z="-0.234"
        chord     = "1.195"
        length    = "5.053"
        taper     = "0.70"
        dihedral  = "3.6"
        incidence = "1"
        sweep     = "-2"
        camber    = "0.05">
        <stall   aoa="20" width="1"    peak="1.5"/>
        <flap0 start="0.15" end="0.65" lift="1.4" drag="1.5"/>
        <flap1 start="0.65" end="0.97" lift="1.2" drag="1.1"/>

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

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

        <control-speed  control="FLAP0" transition-time="3"/>
  </wing>

  <mstab x="1.5199" y="5.0392" z="0.0852"
         chord     = "0.85"
         length    = "0.46"
         taper     = "0.40"
         dihedral  = "25"
         incidence = "1"
         sweep     = "30"
         camber    = "0.01">
         <stall aoa="20" width="1" peak="1.5"/>
  </mstab>

  <hstab x="-3.17514" y="0" z="1.08417"
         chord  = "0.892"
         length = "1.308"
         taper  = "0.50"
         sweep  = "5">
         <stall   aoa="18" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.4" drag="1.1"/>

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

         <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.25"
       taper  = "0.60"
       sweep  = "20">
       <stall   aoa="16" width="1" peak="1.5"/>
       <flap0 start="0"    end="1" lift="1.4" drag="1.1"/>

       <control-input  control="FLAP0" axis="/controls/flight/rudder" 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        = "1.5"
             cruise-speed  = "138"
             cruise-rpm    = "2600"
             cruise-alt    = "0"
             cruise-power  = "110"
             takeoff-power = "125"
             takeoff-rpm   = "2800" >
             <actionpt x="3.447" y="0" z="0.046"  />
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-rpm      = "2800"
                            alt          = "0"
                            eng-power    = "125"
                            displacement = "240"
                            compression  = "8.5">
                            <control-input control="THROTTLE" axis="/controls/engines/engine[0]/throttle"/>
                            <control-input control="STARTER"  axis="/controls/engines/engine[0]/starter"/>
                            <control-input control="MAGNETOS" axis="/controls/engines/engine[0]/magnetos"/>
                            <control-input control="MIXTURE"  axis="/controls/engines/engine[0]/mixture"/>
             </piston-engine>
  </propeller>

  <gear x="2.919" y="0" z="-1.109"
        compression = "0.1"
        spring      = "6"
        stiction    = "1">
        <control-input control="STEER"     axis="/controls/flight/rudder"       src0="-1" src1="1" dst0="-0.7" dst1="0.7"/>
        <control-input control="CASTERING" axis="/controls/gear/tailwheel-lock" src0="0"  src1="1" dst0="1"    dst1="0"/>
   </gear>

  <!-- 0.820 -->
  <gear x="1.222" y="0.962" z="-1.109"
        compression = "0.12"
        spring      = "6"
        stiction    = "1">
        <control-input control="BRAKE" axis="/controls/gear/brake-left"    split="true"/>
        <control-input control="BRAKE" axis="/controls/gear/brake-parking" split="true"/>
        <control-input control="STEER" axis="/sim/gears/toe-left"/>
  </gear>

  <gear x="1.222" y="-0.962" z="-1.109"
        compression ="0.12"
        spring      ="6"
        stiction    ="1">
        <control-input control="BRAKE" axis="/controls/gear/brake-right"   split="true"/>
        <control-input control="BRAKE" axis="/controls/gear/brake-parking" split="true"/>
        <control-input control="STEER" axis="/sim/gears/toe-right"/>
  </gear>

  <!-- Fuel 200.6 lbs / 91 l / 24 US gal -->
  <tank x="1.35" y=" 0.96" z="-0.2" capacity="100.3"/>
  <tank x="1.35" y="-0.96" z="-0.2" capacity="100.3"/>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 1.195 / 6     = 0.199
                 1.367 + 0.199 = 1.566
  -->
  <ballast x="3" y="0" z="-0.02" mass="200"/>

</airplane>
