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

<!-- Heinkel He177 Greif  : 2013 BARANGER Emmanuel
               updated by : F-Sig
               updated by : 2020 BARANGER Emmanuel

     sources              : http://en.wikipedia.org/wiki/Heinkel_He_177

     Wingspan             : 31.44 m   (103 ft  1 3/4 in )
     Lenght               : 22.00 m   ( 72 ft  2     in )
     Height               :  6.67 m   ( 21 ft 10     in )
     Empty mass           : 16800 kg  ( 37038 lb        )
     Gross weight         : 32000 kg  ( 70548 lb        )
     Maximum speed        : 565 km/h  ( 305 kt ) at 6000 m ( 19685 ft )
     Stall speed          : 135 km/h  (  73 kt          )
     Engines              : 2 x Daimler-Benz DB 610 24-cylinder liquid-cooled inline piston engines ( 3100 hp each )
-->
<airplane mass="37038" version="YASIM_VERSION_CURRENT" mtow-lbs="70548">

    <approach speed="73" aoa="2" fuel="0.3">
      <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.3"/>
      <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.3"/>

      <control-setting axis="/controls/engines/engine[0]/boost"           value="0"/>
      <control-setting axis="/controls/engines/engine[1]/boost"           value="0"/>

      <control-setting axis="/controls/engines/engine[0]/mixture"         value="1"/>
      <control-setting axis="/controls/engines/engine[1]/mixture"         value="1"/>

      <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.77"/>
      <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.77"/>

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

    <cruise speed="280" alt="19685" fuel="0.7">
      <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.8"/>
      <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.8"/>

      <control-setting axis="/controls/engines/engine[0]/boost"           value="1"/>
      <control-setting axis="/controls/engines/engine[1]/boost"           value="1"/>

      <control-setting axis="/controls/engines/engine[0]/mixture"         value="0.6"/>
      <control-setting axis="/controls/engines/engine[1]/mixture"         value="0.6"/>

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

      <control-setting axis="/controls/flight/flaps"                      value="0"/>
      <control-setting axis="/controls/gear/gear-down"                    value="0"/>
    </cruise>

    <cockpit x="9.598" y="0.290" z="-0.238"/>

    <!-- Fuselage -->
    <fuselage ax=" 10.993" ay=" 0.000" az=" -0.677" bx=" 10.756" by=" 0.000" bz=" -0.677" width="1.125" taper="0.10" midpoint="1"/>
    <fuselage ax=" 10.756" ay=" 0.000" az=" -0.677" bx=" 10.421" by=" 0.000" bz=" -0.677" width="1.632" taper="0.70" midpoint="1"/>
    <fuselage ax=" 10.421" ay=" 0.000" az=" -0.677" bx="  9.997" by=" 0.000" bz=" -0.720" width="1.856" taper="0.90" midpoint="1"/>
    <fuselage ax="  9.997" ay=" 0.000" az=" -0.720" bx="  7.360" by=" 0.000" bz=" -0.720" width="2.041" taper="0.91" midpoint="1"/>
    <fuselage ax="  7.360" ay=" 0.000" az=" -0.720" bx=" -0.995" by=" 0.000" bz=" -0.720" width="2.041" taper="1.00" midpoint="1"/>
    <fuselage ax=" -0.995" ay=" 0.000" az=" -0.720" bx=" -4.023" by=" 0.000" bz=" -0.663" width="2.041" taper="0.90" midpoint="0"/>
    <fuselage ax=" -4.023" ay=" 0.000" az=" -0.663" bx=" -9.226" by=" 0.000" bz=" -0.426" width="1.837" taper="0.55" midpoint="0"/>
    <fuselage ax=" -9.226" ay=" 0.000" az=" -0.426" bx="-10.793" by=" 0.000" bz=" -0.237" width="1.010" taper="0.70" midpoint="0"/>

    <!-- Engine left -->
    <fuselage ax="  5.518" ay=" 3.608" az=" -0.496" bx="  5.378" by=" 3.608" bz=" -0.496" width="1.365" taper="0.80" midpoint="1"/>
    <fuselage ax="  5.378" ay=" 3.608" az=" -0.496" bx="  3.175" by=" 3.608" bz=" -0.496" width="1.365" taper="1.00" midpoint="1"/>
    <fuselage ax="  3.175" ay=" 3.608" az=" -0.496" bx="  1.459" by=" 3.608" bz=" -0.496" width="1.365" taper="0.30" midpoint="0"/>

    <!-- Engine right -->
    <fuselage ax="  5.518" ay="-3.608" az=" -0.496" bx="  5.378" by="-3.608" bz=" -0.496" width="1.365" taper="0.80" midpoint="1"/>
    <fuselage ax="  5.378" ay="-3.608" az=" -0.496" bx="  3.175" by="-3.608" bz=" -0.496" width="1.365" taper="1.00" midpoint="1"/>
    <fuselage ax="  3.175" ay="-3.608" az=" -0.496" bx="  1.459" by="-3.608" bz=" -0.496" width="1.365" taper="0.30" midpoint="0"/>

    <wing x="1.777" y="0" z="-0.503"
          chord  = "4.287"
          length = "4.696"
          taper  = "1"
          camber = "0.005">
          <stall   aoa="20" width="1" peak="1.5"/>
          <flap0 start="0.21" end="1" lift="1.8" drag="1.6"/>

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

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

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

    <!-- Wing -->
    <wing x="1.777" y="4.696" z="-0.503"
          append   = "1"
          chord    = "4.277"
          length   = "11"
          taper    = "0.4"
          sweep    = "-3"
          dihedral = "5">
          <stall   aoa="20" width="1"    peak="1.5"/>
          <flap0 start="0.00" end="0.45" lift="1.8" drag="1.6"/>
          <flap1 start="0.45" end="0.95" 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>

    <!-- Elevator -->
    <hstab x="-8.564" y="0" z="-0.515"
           chord  = "3.754"
           length = "4.581"
           taper  = "0.6"
           sweep  = "6">
           <stall   aoa="18" width="1" peak="1.5"/>
           <flap0 start="0"    end="1" lift="1.3" 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>

    <!-- Ruder -->
    <vstab x="-8.21741" y="0" z="-0.50958"
           chord  = "4.703"
           length = "3.929"
           taper  = "0.366"
           sweep  = "10">
           <stall   aoa="16" width="1" peak="1.5"/>
           <flap0 start="0"    end="1" lift="1.2" drag="1.1"/>

           <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"/>
    </vstab>

    <!-- Engines

         source  : http://www.luftfahrt-archiv-hafner.de/daimler-benz.htm

         name         : Daimler-Benz DB 610
         type         : 24-cylinder liquid-cooled inline piston engines
         weight       : 334 kg (1512 lb)
         power        : 3100 hp at 2800 rpm for takeoff
         Displacement : 4352 in3 (71.4 l) 35.7 *2 - 2176 * 2
         Compression  : 8.5
    -->
    <!-- Engine left -->
    <propeller x="4.750" y="3.608" z="-0.496"
               mass         = "1512"
               moment       = "40"
               radius       = "2.155"
               gear-ratio   = "0.594"
               min-rpm      = "560"
               max-rpm      = "1660"
               cruise-speed = "280"
               cruise-rpm   = "1500"
               cruise-power = "2800"
               cruise-alt   = "6000">
               <actionpt x="5.902" y="3.608" z="-0.496"/>
               <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
               <piston-engine eng-power    = "3100"
                              eng-rpm      = "2800"
                              displacement = "4352"
                              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"/>
                              <control-input control="BOOST"    axis="/controls/engines/engine[0]/boost"/>
               </piston-engine>
    </propeller>

    <!-- Engine right -->
    <propeller x="4.750" y="-3.608" z="-0.496"
               mass         = "1512"
               moment       = "40"
               radius       = "2.155"
               gear-ratio   = "0.594"
               min-rpm      = "560"
               max-rpm      = "1660"
               cruise-speed = "280"
               cruise-rpm   = "1500"
               cruise-power = "2800"
               cruise-alt   = "6000">
               <actionpt x="5.902" y="-3.608" z="-0.496"/>
               <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
               <piston-engine eng-power    = "3100"
                              eng-rpm      = "2800"
                              displacement = "4352"
                              compression  = "8.5">
                              <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>

    <!-- Left wheel -->
    <gear x="3.44465" y="3.65831" z="-3.32285"
          compression  = "0.2"
          spring       = "3.0"
          damp         = "1.5"
          stiction     = "1">
          <control-input  control="BRAKE"  axis="/controls/gear/brake-left"/>
          <control-input  control="BRAKE"  axis="/controls/gear/brake-parking"/>
          <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="5.1"/>
    </gear>

    <!-- Right wheel -->
    <gear x="3.44465" y="-3.65831" z="-3.32285"
          compression  = "0.2"
          spring       = "3.0"
          damp         = "1.5"
          stiction     = "1">
          <control-input  control="BRAKE"  axis="/controls/gear/brake-right"/>
          <control-input  control="BRAKE"  axis="/controls/gear/brake-parking"/>
          <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="5.2"/>
    </gear>

    <!-- Tail wheel -->
    <gear x="-7.53662" y="0" z="-1.70823"
          compression  = "0.2"
          spring       = "1.0"
          damp         = "1.50"
          stiction     = "1">
          <control-input  control="STEER"  axis="/controls/flight/rudder" square="true" src0="-1.0" src1="1.0" dst0="0.8" dst1="-0.8"/>
          <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>

    <tank x="3.3" y=" 6" z="-0.18" capacity="6000"/>
    <tank x="3.3" y="-6" z="-0.18" capacity="6000"/>

    <!-- Mass distribution
         Dilbert : The cg should be about 1/6 chord ahead of the chord center.
         4.287 / 6     = 0.714
         1.777 + 0.714 = 2.491
    -->
    <ballast x="10" y="0" z="-1.517" mass="8369"/>

</airplane>
