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

<!--
  Diamond Da 42 -    2010 - Emmanuel BARANGER
         Update -    2011 - Philippe BROCORENS
         Update -    2014 - Emmanuel BARANGER
         Update -    2016 - MrZac (VI)
         Update -    2019 - Emmanuel BARANGER
         Update - 04-2019 - Emmanuel BARANGER
         Update - 12-2022 - Emmanuel BARANGER

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

  Wingspan      : 13.42 m    (   44 ft 0 in )
  lenght        :  8.56 m    (   28 ft 1 in )
  height        :  2.49 m    (    8 ft 2 in )
  Empty mass    :  1251 kg   ( 2761 lb      )
  Gross weight  :  1700 kg   ( 3748 lb      )
  Engine        : 2 Austro Engine AE 300 (170 hp each)
  Maximum speed :   356 km/h ( 200 kts      )
-->
<airplane mass="2761" version="YASIM_VERSION_CURRENT" mtow-lbs="3748">

  <!-- Approach configuration -->
  <approach speed="60" 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"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="1"/>

    <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.2"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="1"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="1"/>

    <control-setting axis="/controls/flight/flaps"                      value="1"/>
    <control-setting axis="/controls/gear/gear-down"                    value="1"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="190" alt="16000" fuel="1">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.92"/>
    <control-setting axis="/controls/engines/engine[0]/mixture"         value="1"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.7"/>

    <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.92"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="1"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.7"/>
    <control-setting axis="/controls/flight/flaps"                      value="0"/>
    <control-setting axis="/controls/gear/gear-down"                    value="0"/>
  </cruise>

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

  <!-- Fuselage -->
  <fuselage ax=" 4.275" ay=" 0.000" az="-0.181" bx=" 3.979" by="-0.070" bz="-0.155" width="0.280" taper="0.30" midpoint="1"/>
  <fuselage ax=" 3.979" ay="-0.070" az="-0.155" bx=" 3.057" by="-0.150" bz="-0.078" width="0.560" taper="0.50" midpoint="1"/>
  <fuselage ax=" 3.057" ay="-0.150" az="-0.078" bx=" 2.311" by="-0.170" bz="-0.041" width="0.750" taper="0.75" midpoint="1"/>
  <fuselage ax=" 2.398" ay="-0.190" az="-0.041" bx=" 1.483" by=" 0.000" bz=" 0.113" width="1.200" taper="0.60" midpoint="1"/>

  <fuselage ax=" 4.275" ay=" 0.000" az="-0.181" bx=" 3.979" by=" 0.070" bz="-0.155" width="0.280" taper="0.30" midpoint="1"/>
  <fuselage ax=" 3.979" ay=" 0.070" az="-0.155" bx=" 3.057" by=" 0.150" bz="-0.078" width="0.560" taper="0.50" midpoint="1"/>
  <fuselage ax=" 3.057" ay=" 0.150" az="-0.078" bx=" 2.311" by=" 0.170" bz="-0.041" width="0.750" taper="0.75" midpoint="1"/>
  <fuselage ax=" 2.398" ay=" 0.190" az="-0.041" bx=" 1.483" by=" 0.000" bz=" 0.113" width="1.200" taper="0.60" midpoint="1"/>

  <fuselage ax=" 1.496" ay=" 0.000" az=" 0.120" bx=" 0.417" by=" 0.000" bz=" 0.120" width="1.180" taper="1.00" midpoint="0"/>
  <fuselage ax=" 0.417" ay=" 0.000" az=" 0.120" bx="-0.808" by=" 0.000" bz="-0.019" width="1.180" taper="0.58" midpoint="0"/>
  <fuselage ax="-0.808" ay=" 0.000" az="-0.019" bx="-1.359" by=" 0.000" bz="-0.057" width="0.696" taper="0.62" midpoint="0"/>
  <fuselage ax="-1.359" ay=" 0.000" az="-0.057" bx="-3.502" by=" 0.000" bz="-0.100" width="0.427" taper="0.10" midpoint="0"/>

  <!-- Left Engine -->
  <!-- Bowl -->
  <fuselage ax=" 2.929" ay=" 1.739" az=" 0.021" bx=" 2.873" by=" 1.739" bz=" 0.021" width="0.141" taper="0.05" midpoint="1"/>
  <fuselage ax=" 2.873" ay=" 1.739" az=" 0.021" bx=" 2.733" by=" 1.739" bz=" 0.021" width="0.247" taper="0.58" midpoint="1"/>
  <fuselage ax=" 2.733" ay=" 1.739" az=" 0.021" bx=" 2.570" by=" 1.739" bz=" 0.021" width="0.295" taper="0.84" midpoint="1"/>
  <!-- Engine -->
  <fuselage ax=" 2.570" ay=" 1.739" az="-0.037" bx=" 2.458" by=" 1.739" bz="-0.037" width="0.512" taper="0.58" midpoint="1"/>
  <fuselage ax=" 2.491" ay=" 1.739" az="-0.030" bx=" 2.053" by=" 1.739" bz="-0.134" width="0.805" taper="0.65" midpoint="1"/>
  <fuselage ax=" 2.053" ay=" 1.739" az="-0.134" bx=" 1.496" by=" 1.739" bz="-0.134" width="0.805" taper="0.98" midpoint="1"/>
  <fuselage ax=" 1.496" ay=" 1.739" az="-0.134" bx=" 0.939" by=" 1.739" bz="-0.134" width="0.805" taper="0.65" midpoint="0"/>
  <fuselage ax=" 0.939" ay=" 1.739" az="-0.134" bx="-0.145" by=" 1.739" bz="-0.164" width="0.523" taper="0.10" midpoint="0"/>

  <!-- Right Engine -->
  <!-- Bowl -->
  <fuselage ax=" 2.929" ay="-1.739" az=" 0.021" bx=" 2.873" by="-1.739" bz=" 0.021" width="0.141" taper="0.05" midpoint="1"/>
  <fuselage ax=" 2.873" ay="-1.739" az=" 0.021" bx=" 2.733" by="-1.739" bz=" 0.021" width="0.247" taper="0.58" midpoint="1"/>
  <fuselage ax=" 2.733" ay="-1.739" az=" 0.021" bx=" 2.570" by="-1.739" bz=" 0.021" width="0.295" taper="0.84" midpoint="1"/>
  <!-- Engine -->
  <fuselage ax=" 2.570" ay="-1.739" az="-0.037" bx=" 2.458" by="-1.739" bz="-0.037" width="0.512" taper="0.58" midpoint="1"/>
  <fuselage ax=" 2.491" ay="-1.739" az="-0.030" bx=" 2.053" by="-1.739" bz="-0.134" width="0.805" taper="0.65" midpoint="1"/>
  <fuselage ax=" 2.053" ay="-1.739" az="-0.134" bx=" 1.496" by="-1.739" bz="-0.134" width="0.805" taper="0.98" midpoint="1"/>
  <fuselage ax=" 1.496" ay="-1.739" az="-0.134" bx=" 0.939" by="-1.739" bz="-0.134" width="0.805" taper="0.65" midpoint="0"/>
  <fuselage ax=" 0.939" ay="-1.739" az="-0.134" bx="-0.145" by="-1.739" bz="-0.164" width="0.523" taper="0.10" midpoint="0"/>

  <wing x="1" y="0" z="-0.426"
        chord    = "1.848"
        length   = "2.210"
        taper    = "0.70"
        dihedral = "5"
        sweep    = "3.5"
        camber   = "0.002">
        <stall   aoa="18" width="1" peak="1.5"/>
        <flap0 start="0.32" end="1" lift="1.4" drag="2.2"/>

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

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

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

  <wing x="0.862" y="2.210" z="-0.234"
        append   = "1"
        chord    = "1.294"
        length   = "4.363"
        taper    = "0.70"
        dihedral = "5">
        <stall   aoa="18" width="1"    peak="1.5"/>
        <flap0 start="0.00" end="0.61" lift="1.4" drag="2.2"/>
        <flap1 start="0.61" end="0.98" 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="5"/>
  </wing>

  <vstab x="0.755" y="6.590" z="0.162"
         chord    = "0.5"
         length   = "0.9"
         taper    = "0.40"
         dihedral = "86"
         sweep    = "30">
  </vstab>

  <vstab x="-2.597" y="0" z="-0.037"
         chord    = "2"
         length   = "0.5"
         sweep    = "60"
         taper    = "0.5"
         dihedral = "90">
  </vstab>

  <vstab x="-2.597" y="0" z="-0.037"
         chord    = "2"
         length   = "0.5"
         sweep    = "60"
         taper    = "0.5"
         dihedral = "-90">
  </vstab>

  <vstab x="0.755" y="-6.590" z="0.162"
         chord    = "0.5"
         length   = "0.9"
         taper    = "0.40"
         dihedral = "94"
         sweep    = "30">
  </vstab>

  <hstab x="-3.762" y="0" z="1.170"
         chord     = "0.892"
         length    = "1.458"
         taper     = "0.50"
         incidence = "-0.8"
         sweep     = "5">
         <stall   aoa="18" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.4" drag="1.2"/>

         <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="-3.440" y="0" z="-0.106"
         chord  = "1.385"
         length = "1.189"
         taper  = "0.65"
         sweep  = "18">
         <stall   aoa="20" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.4" drag="1.3"/>

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

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

  <vstab x="-3.885" y="1.456" z="1.170"
         chord    = "0.45"
         length   = "0.35"
         taper    = "0.25"
         dihedral = "-41"
         sweep    = "45">
  </vstab>

  <vstab x="-3.885" y="-1.456" z="1.170"
         chord    = "0.45"
         length   = "0.35"
         taper    = "0.25"
         dihedral = "221"
         sweep    = "45">
  </vstab>

  <!--  Austro Engine E4
                 source       : http://en.wikipedia.org/wiki/Austro_Engine_AE_300

                 type         : Four-cylinder, four-stroke diesel aircraft engine
                 power        : 170 hp
                 weight       : 185 kg  ( 408 lb )
                 Displacement : 1991 cm3 (121 cu in)
                 Compression  : 8.5:1
  -->
  <propeller x="1.844" y="1.740" z="0.021"
             mass          = "408"
             radius        = "0.85"
             moment        = "10"
             cruise-speed  = "190"
             cruise-rpm    = "2600"
             cruise-alt    = "16000"
             cruise-power  = "160"
             takeoff-power = "160"
             takeoff-rpm   = "2800">
             <actionpt x="2.627" y="1.740" z="0.021"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-rpm      = "2800"
                            eng-power    = "170"
                            displacement = "121"
                            compression  = "8.7"
                            gear-ratio   = "1.7"
                            supercharger = "1"
                            wastegate-mp = "26"
                            turbo-mul    = "1.57">
                            <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"/>
                            <control-input control="BOOST"    axis="/controls/engines/engine[0]/boost"/>
             </piston-engine>
  </propeller>

  <propeller x="1.844" y="-1.740" z="0.021"
             mass          = "408"
             radius        = "0.85"
             moment        = "10"
             cruise-speed  = "190"
             cruise-rpm    = "2600"
             cruise-alt    = "16000"
             cruise-power  = "160"
             takeoff-power = "160"
             takeoff-rpm   = "2800">
             <actionpt x="2.627" y="-1.740" z="0.021"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <piston-engine eng-rpm      = "2800"
                            eng-power    = "170"
                            displacement = "121"
                            compression  = "8.7"
                            gear-ratio   = "1.7"
                            supercharger = "1"
                            wastegate-mp = "26"
                            turbo-mul    = "1.57">
                            <control-input control="THROTTLE" axis="/controls/engines/engine[1]/throttle"/>
                            <control-input control="STARTER"  axis="/controls/engines/engine[1]/starter"/>
                            <control-input control="MAGNETOS" axis="/controls/engines/engine[1]/magnetos"/>
                            <control-input control="MIXTURE"  axis="/controls/engines/engine[1]/mixture"/>
                            <control-input control="BOOST"    axis="/controls/engines/engine[1]/boost"/>
             </piston-engine>
  </propeller>

  <gear x="2.578" y="0" z="-1.223"
        compression = "0.11"
        spring      = "0.6"
        stiction    = "1">
        <control-input  control="CASTERING" axis="/controls/gear/tailwheel-lock" src0=" 0" src1="1" dst0=" 1.0" dst1="0.0"/>
        <control-input  control="STEER"     axis="/controls/flight/rudder"       src0="-1" src1="1" dst0="-0.2" dst1="0.2"/>
        <control-input  control="EXTEND"    axis="/controls/gear/gear-down"/>

        <control-output control="EXTEND"    prop="/gear/gear[0]/position-norm"/>

        <control-speed  control="EXTEND"    transition-time="7"/>
   </gear>

  <!-- 0.820 -->
  <gear x="1.147" y="1.358" z="-1.231"
        compression = "0.12"
        spring      = "0.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="EXTEND" axis="/controls/gear/gear-down"/>

        <control-output control="EXTEND" prop="gear/gear[1]/position-norm"/>

        <control-speed  control="EXTEND" transition-time="6"/>
  </gear>

  <gear x="1.147" y="-1.358" z="-1.231"
        compression = "0.12"
        spring      = "0.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="EXTEND" axis="/controls/gear/gear-down"/>

        <control-output control="EXTEND" prop="gear/gear[2]/position-norm"/>

        <control-speed control="EXTEND" transition-time="5"/>
  </gear>

  <weight x="1.68" y=" 0.18" z="-0.1750" mass-prop="/sim/weight[0]/weight-lb"/>
  <weight x="1.68" y="-0.18" z="-0.1750" mass-prop="/sim/weight[1]/weight-lb"/>

  <weight x="1.00" y=" 0.18" z="-0.1750" mass-prop="/sim/weight[2]/weight-lb"/>
  <weight x="1.00" y="-0.18" z="-0.1750" mass-prop="/sim/weight[3]/weight-lb"/>
  <weight x="2.62" y=" 0.00" z="-0.1750" mass-prop="/sim/weight[4]/weight-lb"/>
  <weight x="0.55" y=" 0.00" z="-0.1750" mass-prop="/sim/weight[5]/weight-lb"/>

  <!-- Fuel  -->
  <tank x="1.42" y=" 1.323" z="-0.272" capacity="270"/>
  <tank x="1.42" y="-1.323" z="-0.272" capacity="270"/>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 1.848 / 6     = 0.308
                 1.000 + 0.308 = 1.308
  -->
  <ballast x=" 3.5" y="0" z="-0.13" mass="376"/>

</airplane>
