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

<!-- Douglas Dc 5       : Emmanuel BARANGER - 11/2023

  source                : https://www.wikiwand.com/en/Douglas_DC-5

  Wingspan              : 78 ft          (  24.00 m  )
  lenght                : 62 ft  2 in    (  18.95 m  )
  height                : 19 ft 10 in    (   6.05 m  )
  Empty mass            : 13674 lb       (   6202 kg )
  Max takeoff weight    : 20000 lb       (   9072 kg )
  Engine                :  2 Wright GR-1820-G102A Cyclone 9-cylinder air-cooled radial piston engine, 900 hp each at 2300 rpm and 6700 ft ( 2000 m )
  Cruise speed          : 314 km/h       (    169 kn ) 65% power at 10000 ft ( 3000 m )
  Maximum speed         : 370 km/h       (    200 kn )           at  7700 ft ( 2300 m )
  Fuel capacity         : ~550 US gal ( 2100 L ) in two nacelle tanks
-->
<airplane mass="13674" version="YASIM_VERSION_CURRENT" mtow-lbs="20000">

  <!-- Approach configuration -->
  <approach speed="60" aoa="4" 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/engines/engine[1]/throttle"        value="0.2"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="1.0"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.5"/>
    <control-setting axis="/controls/gear/gear-down"                    value="1"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="169" alt="6700" fuel="1">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.75"/>
    <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.75"/>
    <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/gear/gear-down"                    value="0"/>
  </cruise>

  <cockpit x="7.363" y="0.298" z="-0.348"/>

  <!--Fuselage -->
  <fuselage ax=" 9.463" ay=" 0.000" az="-1.428" bx=" 9.287" by=" 0.000" bz="-1.428" width="0.584" taper="0.10" midpoint="1"/>
  <fuselage ax=" 9.287" ay=" 0.000" az="-1.428" bx=" 8.901" by=" 0.000" bz="-1.428" width="1.158" taper="0.51" midpoint="1"/>
  <fuselage ax=" 8.901" ay=" 0.000" az="-1.428" bx=" 8.263" by=" 0.000" bz="-1.428" width="1.704" taper="0.68" midpoint="1"/>
  <fuselage ax=" 8.253" ay="-0.042" az="-1.428" bx=" 7.077" by=" 0.243" bz="-1.428" width="1.964" taper="0.87" midpoint="1"/>
  <fuselage ax=" 8.253" ay=" 0.042" az="-1.428" bx=" 7.077" by="-0.243" bz="-1.428" width="1.964" taper="0.87" midpoint="1"/>
  <fuselage ax=" 7.292" ay=" 0.000" az="-1.192" bx=" 6.217" by=" 0.000" bz="-1.192" width="2.580" taper="0.93" midpoint="1"/>
  <fuselage ax=" 6.217" ay=" 0.000" az="-1.192" bx=" 0.256" by=" 0.000" bz="-1.192" width="2.580" taper="1.00" midpoint="1"/>
  <fuselage ax=" 0.256" ay=" 0.000" az="-1.192" bx="-3.117" by=" 0.000" bz="-0.977" width="2.580" taper="0.84" midpoint="0"/>
  <fuselage ax="-3.117" ay=" 0.000" az="-0.977" bx="-8.117" by=" 0.000" bz="-0.445" width="2.167" taper="0.32" midpoint="0"/>
  <fuselage ax="-8.117" ay=" 0.000" az="-0.445" bx="-9.471" by=" 0.000" bz="-0.280" width="0.689" taper="0.10" midpoint="0"/>

  <!-- Cabine -->
  <fuselage ax=" 8.281" ay=" 0.253" az="-0.841" bx=" 7.917" by=" 0.253" bz="-0.841" width="1.363" taper="0.30" midpoint="1"/>
  <fuselage ax=" 8.281" ay="-0.253" az="-0.841" bx=" 7.917" by="-0.253" bz="-0.841" width="1.363" taper="0.30" midpoint="1"/>
  <fuselage ax=" 7.917" ay=" 0.253" az="-0.841" bx=" 7.292" by=" 0.253" bz="-0.841" width="1.704" taper="0.80" midpoint="1"/>
  <fuselage ax=" 7.917" ay="-0.253" az="-0.841" bx=" 7.292" by="-0.253" bz="-0.841" width="1.704" taper="0.80" midpoint="1"/>

  <!-- Left engine -->
  <fuselage ax=" 6.346" ay=" 3.523" az="-0.369" bx=" 6.232" by=" 3.523" bz="-0.369" width="1.437" taper="0.80" midpoint="1"/>
  <fuselage ax=" 6.232" ay=" 3.523" az="-0.369" bx=" 5.951" by=" 3.523" bz="-0.369" width="1.537" taper="0.93" midpoint="1"/>
  <fuselage ax=" 5.951" ay=" 3.523" az="-0.369" bx=" 4.259" by=" 3.523" bz="-0.369" width="1.537" taper="0.93" midpoint="0"/>
  <fuselage ax=" 4.259" ay=" 3.523" az="-0.369" bx=" 3.111" by=" 3.523" bz="-0.369" width="1.429" taper="0.80" midpoint="0"/>
  <fuselage ax=" 3.111" ay=" 3.523" az="-0.369" bx=" 1.970" by=" 3.523" bz="-0.369" width="1.143" taper="0.10" midpoint="0"/>

  <!-- Right engine -->
  <fuselage ax=" 6.346" ay="-3.523" az="-0.369" bx=" 6.232" by="-3.523" bz="-0.369" width="1.437" taper="0.80" midpoint="1"/>
  <fuselage ax=" 6.232" ay="-3.523" az="-0.369" bx=" 5.951" by="-3.523" bz="-0.369" width="1.537" taper="0.93" midpoint="1"/>
  <fuselage ax=" 5.951" ay="-3.523" az="-0.369" bx=" 4.259" by="-3.523" bz="-0.369" width="1.537" taper="0.93" midpoint="0"/>
  <fuselage ax=" 4.259" ay="-3.523" az="-0.369" bx=" 3.111" by="-3.523" bz="-0.369" width="1.429" taper="0.80" midpoint="0"/>
  <fuselage ax=" 3.111" ay="-3.523" az="-0.369" bx=" 1.970" by="-3.523" bz="-0.369" width="1.143" taper="0.10" midpoint="0"/>

  <wing x="2.560" y="0" z="-0.427"
        chord="4.203"
        length="4.374"
        taper="1"
        camber="0.005">
        <stall   aoa="20" width="1" peak="1.5"/>
        <flap0 start="0.32" end="1" lift="1.3" drag="1.4"/>

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

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

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

  <wing x="2.560" y="4.374" z="-0.427"
        append="1"
        chord="4.203"
        length="7.622"
        taper="0.44"
        sweep="-4.5"
        dihedral="5"
        camber="0.005">
        <stall   aoa="20" width="1"    peak="1.5"/>
        <flap0 start="0.00" end="0.23" lift="1.3" drag="1.4"/>
        <flap1 start="0.23" end="0.91" 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/flaps-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-output control="FLAP1" prop="/surface-positions/aileron-pos-norm"/>

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

  <hstab x="-8.015" y="0" z="-0.365"
         chord="2.851"
         length="4.580"
         sweep="2.5"
         dihedral="12"
         taper="0.48">
         <stall   aoa="18" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.2" 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="-7.702" y="0" z="-0.295"
         chord="3.158"
         length="3.651"
         taper="0.50"
         sweep="4">
         <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>

  <!-- Engines

              source  : http://en.wikipedia.org/wiki/Wright_R-1820

         type         : Nine-cylinder single-row supercharged air-cooled radial engine
         weight       :  537 kg (1184 lb)
         power        : 1000 hp at 2300 rpm for takeoff
         Displacement : 1823 in3 (29.88 l)
         Compression  : 6.45:1
  -->
  <!-- Engine left exterior-->
  <propeller x="6.052" y="3.523" z="-0.369"
             mass="1184"
             radius="1.82"
             moment="155"
             cruise-alt="6700"
             cruise-power="900"
             cruise-speed="158"
             cruise-rpm="1400"
             gear-ratio="0.479"
             takeoff-power="1000"
             takeoff-rpm="2300">
             <actionpt x="6.552" y="3.523" z="-0.369"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-power="1000"
                            eng-rpm="2300"
                            displacement="1823"
                            compression="6.45">
                            <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>

  <!-- Engine left interior-->
  <propeller x="6.052" y="-3.523" z="-0.369"
             mass="1184"
             radius="1.82"
             moment="155"
             cruise-alt="6700"
             cruise-power="900"
             cruise-speed="158"
             cruise-rpm="1400"
             gear-ratio="0.479"
             takeoff-power="1000"
             takeoff-rpm="2300">
             <actionpt x="6.552" y="-3.523" z="-0.369"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <piston-engine eng-power="1000"
                            eng-rpm="2300"
                            displacement="1823"
                            compression="6.45">
                            <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="8.267" y="0" z="-3.343"
        compression="0.15"
        spring="0.6"
        stiction="1">
        <control-input  control="STEER"  axis="/controls/flight/rudder" src0="-1.0" src1="1.0" 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>

  <gear x="2.692" y="3.692" z="-3.165"
        compression="0.20"
        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-input  control="STEER"  axis="/sim/gears/toe-left"/>

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

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

  <gear x="2.692" y="-3.692" z="-3.165"
        compression="0.20"
        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-input  control="STEER"  axis="/sim/gears/toe-right"/>

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

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

  <!-- Wing tank 2100 liter in 2 tank - 4630 lbs (2315 each)-->
  <tank x="3.4" y=" 2.22" z="-0.43" capacity="2315"/>
  <tank x="3.4" y="-2.22" z="-0.43" capacity="2315"/>

    <!-- Mass distribution
         Dilbert : The cg should be about 1/6 chord ahead of the chord center.
         4.203 / 6     = 0.700
         2.560 + 0.700 = 3.260
    -->
  <ballast x="8.24" y="0" z="-2.14" mass="2528"/>

</airplane>
