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

<!-- Petliakov Pe-8     : BARANGER Emmanuel (04/2020)

     Sources            : https://en.wikipedia.org/wiki/Petlyakov_Pe-8

     Wingspan           : 39.13 m    ( 128 ft 5 in )
     Length             : 23.20 m    (  76 ft 1 in )
     Height             :  6.20 m    (  20 ft 4 in )
     Empty weight       : 18571 kg   (  40942 lb   )
     Max takeoff weight : 35000 kg   (  77162 lb   )
     Powerplant         : 4 Mikulin AM-35A V-12 liquid-cooled piston engines ( 1340 hp each )
     Max. speed         :   443 km/h (    239 kn   )
-->
<airplane mass="40942" version="YASIM_VERSION_CURRENT" mtow-lbs="77162">

  <approach speed="100" aoa="8" 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[2]/throttle" value="0.3"/>
    <control-setting axis="/controls/engines/engine[3]/throttle" value="0.3"/>

    <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[2]/mixture" value="1"/>
    <control-setting axis="/controls/engines/engine[3]/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/engines/engine[2]/propeller-pitch" value="0.77"/>
    <control-setting axis="/controls/engines/engine[3]/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="200" alt="6000" fuel="0.8">
    <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[2]/throttle" value="0.8"/>
    <control-setting axis="/controls/engines/engine[3]/throttle" value="0.8"/>

    <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[2]/mixture" value="0.6"/>
    <control-setting axis="/controls/engines/engine[3]/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/engines/engine[2]/propeller-pitch" value="1"/>
    <control-setting axis="/controls/engines/engine[3]/propeller-pitch" value="1"/>

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

  <cockpit x="6.786" y="0" z="1.357"/>

  <!-- Fuselage -->
  <!-- Haut -->
  <fuselage ax=" 11.439" ay=" 0.000" az=" 0.098" bx=" 11.057" by=" 0.000" bz=" 0.098" width="1.131" taper="0.50" midpoint="1"/>
  <fuselage ax=" 11.057" ay=" 0.000" az=" 0.098" bx="  7.633" by=" 0.000" bz=" 0.224" width="1.539" taper="0.73" midpoint="1"/>
  <fuselage ax="  7.834" ay=" 0.000" az="-0.036" bx="  6.432" by=" 0.000" bz=" 0.225" width="1.675" taper="0.92" midpoint="1"/>
  <fuselage ax="  6.432" ay=" 0.000" az=" 0.225" bx="  0.852" by=" 0.000" bz="-0.203" width="1.675" taper="1.00" midpoint="1"/>
  <fuselage ax="  0.852" ay=" 0.000" az="-0.203" bx="-10.710" by=" 0.000" bz="-0.184" width="1.675" taper="0.70" midpoint="0"/>
  <fuselage ax="-10.710" ay=" 0.000" az="-0.184" bx="-11.525" by=" 0.000" bz="-0.177" width="1.155" taper="0.50" midpoint="0"/>
  <!-- Bas -->
  <fuselage ax=" 10.765" ay=" 0.000" az="-0.953" bx=" 10.383" by=" 0.000" bz="-0.953" width="1.131" taper="0.50" midpoint="1"/>
  <fuselage ax=" 10.383" ay=" 0.000" az="-0.953" bx="  7.856" by=" 0.000" bz="-0.953" width="1.539" taper="0.73" midpoint="1"/>
  <fuselage ax="  7.856" ay=" 0.000" az="-0.953" bx="  6.270" by=" 0.000" bz="-0.869" width="1.675" taper="0.92" midpoint="1"/>
  <fuselage ax="  6.270" ay=" 0.000" az="-0.869" bx="  0.852" by=" 0.000" bz="-0.869" width="1.675" taper="1.00" midpoint="1"/>
  <fuselage ax="  0.852" ay=" 0.000" az="-0.869" bx="-10.782" by=" 0.000" bz="-0.400" width="1.675" taper="0.70" midpoint="0"/>
  <fuselage ax="-10.782" ay=" 0.000" az="-0.400" bx="-11.525" by=" 0.000" bz="-0.313" width="1.155" taper="0.50" midpoint="0"/>
  <!-- Cockpit -->
  <fuselage ax="  7.711" ay=" 0.000" az=" 0.884" bx="  7.160" by=" 0.000" bz=" 0.882" width="1.321" taper="0.40" midpoint="1"/>
  <fuselage ax="  7.160" ay=" 0.000" az=" 0.882" bx="  2.741" by=" 0.000" bz=" 0.727" width="1.321" taper="1.00" midpoint="1"/>
  <fuselage ax="  2.741" ay=" 0.000" az=" 0.727" bx=" -0.168" by=" 0.000" bz=" 0.405" width="1.321" taper="0.20" midpoint="0"/>

  <!-- Left exterior engine -->
  <fuselage ax="  8.247" ay=" 7.526" az=" 0.199" bx="  7.661" by=" 7.526" bz=" 0.199" width="0.714" taper="0.20" midpoint="1"/>
  <fuselage ax="  7.661" ay=" 7.526" az=" 0.199" bx="  6.668" by=" 7.526" bz=" 0.199" width="1.079" taper="0.68" midpoint="1"/>
  <fuselage ax="  6.668" ay=" 7.526" az=" 0.199" bx="  3.115" by=" 7.526" bz=" 0.199" width="1.079" taper="1.00" midpoint="1"/>
  <fuselage ax="  3.115" ay=" 7.526" az=" 0.199" bx="  1.751" by=" 7.526" bz=" 0.199" width="1.079" taper="0.30" midpoint="0"/>

  <!-- Left interior engine -->
  <fuselage ax="  9.192" ay=" 3.321" az="-0.090" bx="  8.606" by=" 3.321" bz="-0.090" width="0.714" taper="0.20" midpoint="1"/>
  <fuselage ax="  8.606" ay=" 3.321" az="-0.090" bx="  7.613" by=" 3.321" bz="-0.090" width="1.079" taper="0.68" midpoint="1"/>
  <fuselage ax="  7.613" ay=" 3.321" az="-0.090" bx="  6.297" by=" 3.321" bz="-0.090" width="1.079" taper="1.00" midpoint="1"/>
  <fuselage ax="  6.297" ay=" 3.321" az="-0.090" bx="  4.933" by=" 3.321" bz="-0.090" width="1.079" taper="0.30" midpoint="0"/>

  <fuselage ax="  8.786" ay=" 3.321" az="-0.620" bx="  7.793" by=" 3.321" bz="-0.620" width="1.079" taper="0.68" midpoint="1"/>
  <fuselage ax="  7.793" ay=" 3.321" az="-0.620" bx="  2.590" by=" 3.321" bz="-0.620" width="1.079" taper="1.00" midpoint="1"/>
  <fuselage ax="  2.590" ay=" 3.321" az="-0.620" bx="  1.239" by=" 3.321" bz="-0.620" width="1.079" taper="0.30" midpoint="0"/>

  <!-- Left interior engine -->
  <fuselage ax="  9.192" ay="-3.321" az="-0.090" bx="  8.606" by="-3.321" bz="-0.090" width="0.714" taper="0.20" midpoint="1"/>
  <fuselage ax="  8.606" ay="-3.321" az="-0.090" bx="  7.613" by="-3.321" bz="-0.090" width="1.079" taper="0.68" midpoint="1"/>
  <fuselage ax="  7.613" ay="-3.321" az="-0.090" bx="  6.297" by="-3.321" bz="-0.090" width="1.079" taper="1.00" midpoint="1"/>
  <fuselage ax="  6.297" ay="-3.321" az="-0.090" bx="  4.933" by="-3.321" bz="-0.090" width="1.079" taper="0.30" midpoint="0"/>

  <fuselage ax="  8.786" ay="-3.321" az="-0.620" bx="  7.793" by="-3.321" bz="-0.620" width="1.079" taper="0.68" midpoint="1"/>
  <fuselage ax="  7.793" ay="-3.321" az="-0.620" bx="  2.590" by="-3.321" bz="-0.620" width="1.079" taper="1.00" midpoint="1"/>
  <fuselage ax="  2.590" ay="-3.321" az="-0.620" bx="  1.239" by="-3.321" bz="-0.620" width="1.079" taper="0.30" midpoint="0"/>

  <!-- Right exterior engine -->
  <fuselage ax="  8.247" ay="-7.526" az=" 0.199" bx="  7.661" by="-7.526" bz=" 0.199" width="0.714" taper="0.20" midpoint="1"/>
  <fuselage ax="  7.661" ay="-7.526" az=" 0.199" bx="  6.668" by="-7.526" bz=" 0.199" width="1.079" taper="0.68" midpoint="1"/>
  <fuselage ax="  6.668" ay="-7.526" az=" 0.199" bx="  3.115" by="-7.526" bz=" 0.199" width="1.079" taper="1.00" midpoint="1"/>
  <fuselage ax="  3.115" ay="-7.526" az=" 0.199" bx="  1.751" by="-7.526" bz=" 0.199" width="1.079" taper="0.30" midpoint="0"/>

  <!-- Wing -->
  <wing x="3.089" y="0" z="-0.231"
        chord="7.764"
        length="19.55"
        taper="0.30"
        dihedral="3.52"
        sweep="0.5"
        camber="0.005">
        <stall aoa="24"   width="1"    peak="1.5"/>
        <flap0 start="0.09" end="0.45" lift="1.5" drag="1.2"/>
        <flap1 start="0.45" end="0.95" lift="1.2" drag="1.2"/>

        <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" 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="FLAP0" transition-time="5"/>
  </wing>

   <!-- Elevator -->
  <hstab x="-8.960" y="0" z="0.175"
         chord="4.099"
         length="5.615"
         taper="0.40"
         sweep="8">
         <stall aoa="22" width="1" peak="1.5"/>
         <flap0 start="0"  end="1" lift="1.6" 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>

  <!-- Ruder -->
  <vstab x="-9.222" y="0" z="0.086"
         chord="4.236"
         length="3.894"
         taper="0.45"
         sweep="15">
         <stall aoa="20" width="1" peak="1.5"/>
         <flap0 start="0" end="1" lift="1.6" drag="1.2"/>

         <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            : https://en.wikipedia.org/wiki/Mikulin_AM-35

                 name              : Mikulin AM-35
                 type              : Piston V12 engine with 60 deg angle
                 power cruise      : 1350 hp at 2050 rpm
                 Compression ratio : 7.0:1
                 weight            :   830 kg   ( 1830 lb  )
                 Displacement      : 46.66 L    ( 2847 in3 )
  -->
  <!-- Engine left exterior-->
  <propeller x="6.800" y="7.526" z="0.199"
             mass="1830"
             moment="40"
             radius="2"
             min-rpm="150"
             max-rpm="2700"
             cruise-speed="200"
             cruise-rpm="2050"
             cruise-power="1100"
             cruise-alt="6000"
             contra="1">
             <actionpt x="7.977" y="7.526" z="0.199"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-power="1350"
                            eng-rpm="2700"
                            displacement="2847"
                            compression="7">
                            <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>

  <!-- Engine left interior-->
  <propeller x="7.400" y="3.321" z="0.091"
             mass="1830"
             moment="40"
             radius="2"
             min-rpm="150"
             max-rpm="2700"
             cruise-speed="200"
             cruise-rpm="2050"
             cruise-power="1100"
             cruise-alt="6000"
             contra="1">
             <actionpt x="8.938" y="3.321" z="-0.090"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <piston-engine eng-power="1350"
                            eng-rpm="2700"
                            displacement="2847"
                            compression="7">
                            <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"/>
             </piston-engine>
  </propeller>

  <!-- Engine right interior-->
  <propeller x="7.400" y="-3.321" z="0.091"
             mass="1830"
             moment="40"
             radius="2"
             min-rpm="150"
             max-rpm="2700"
             cruise-speed="200"
             cruise-rpm="2050"
             cruise-power="1100"
             cruise-alt="6000"
             contra="1">
             <actionpt x="8.938" y="-3.321" z="-0.090"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[2]/propeller-pitch"/>
             <piston-engine eng-power="1350"
                            eng-rpm="2700"
                            displacement="2847"
                            compression="7">
                            <control-input control="THROTTLE" axis="/controls/engines/engine[2]/throttle"/>
                            <control-input control="STARTER"  axis="/controls/engines/engine[2]/starter"/>
                            <control-input control="MAGNETOS" axis="/controls/engines/engine[2]/magnetos"/>
                            <control-input control="MIXTURE"  axis="/controls/engines/engine[2]/mixture"/>
             </piston-engine>
  </propeller>

  <!-- Engine right exterior-->
  <propeller x="6.800" y="-7.526" z="0.199"
             mass="1830"
             moment="40"
             radius="2"
             min-rpm="150"
             max-rpm="2700"
             cruise-speed="200"
             cruise-rpm="2050"
             cruise-power="1100"
             cruise-alt="6000"
             contra="1">
             <actionpt x="7.977" y="-7.526" z="0.199"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[3]/propeller-pitch"/>
             <piston-engine eng-power="1350"
                            eng-rpm="2700"
                            displacement="2847"
                            compression="7">
                            <control-input control="THROTTLE" axis="/controls/engines/engine[3]/throttle"/>
                            <control-input control="STARTER"  axis="/controls/engines/engine[3]/starter"/>
                            <control-input control="MAGNETOS" axis="/controls/engines/engine[3]/magnetos"/>
                            <control-input control="MIXTURE"  axis="/controls/engines/engine[3]/mixture"/>
             </piston-engine>
  </propeller>

  <!-- Left wheel -->
  <gear x="5.499" y="3.320" z="-3.882"
        compression="0.2"
        retract-time="5"
        spring="3.0"
        damp="1.5"
        sfric="0.9"
        dfric="0.7">
        <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="5.499" y="-3.320" z="-3.882"
        compression="0.2"
        retract-time="5"
        spring="3.0"
        damp="1.5"
        sfric="0.9"
        dfric="0.7">
        <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="-10.213" y="0" z="-1.667"
        compression="0.2"
        retract-time="5"
        spring="1.0"
        damp="1.50">
        <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="1.766" y=" 4.617" z="0.236" capacity="2000"/>
  <tank x="1.766" y="-4.617" z="0.236" capacity="2000"/>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 7.764 / 6     = 1.294
                 3.089 + 1.294 = 4.383
  -->
  <ballast x="10" y="0" z="0" mass="9435"/>

</airplane>
