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

<!-- Antonov An 12        : BARANGER Emmanuel (   2013)
                  Updated : HerbyW            (   2015)
                  Updated : BARANGER Emmanuel (   2015)
                  Updated : BARANGER Emmanuel (09/2022)

     Sources              : https://www.wikiwand.com/en/Antonov_An-12

     Wingspan             : 38.00 m    (    124 ft 8 in )
     Lenght               : 33.10 m    (    108 ft 7 in )
     Height               : 10.53 m    (     34 ft 7 in )
     Empty weight         : 28000 kg   (  61729 lb      )
     Max takeoff weight   : 61000 kg   ( 134482 lb      )
     Engines              : 4 Ivchenko AI-20L or AI-20M turboprop engines ( 4000 hp each )
     Max speed            :   660 km/h (    360 kt      )
     Cruise speed         :   570 km/h (    310 kt      )
     Service ceiling      : 10200 m    (  33500 ft      )
-->
<airplane mass="61729" version="YASIM_VERSION_CURRENT" mtow-lbs="134482">

  <approach speed="98" aoa="8" fuel="0.3">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.3"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="1"/>
    <control-setting axis="/controls/engines/engine[0]/condition"       value="1"/>

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

    <control-setting axis="/controls/engines/engine[2]/throttle"        value="0.3"/>
    <control-setting axis="/controls/engines/engine[2]/propeller-pitch" value="1"/>
    <control-setting axis="/controls/engines/engine[2]/condition"       value="1"/>

    <control-setting axis="/controls/engines/engine[3]/throttle"        value="0.3"/>
    <control-setting axis="/controls/engines/engine[3]/propeller-pitch" value="1"/>
    <control-setting axis="/controls/engines/engine[3]/condition"       value="1"/>

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

  <cruise speed="310" alt="33500" fuel="0.7">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.7"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.8"/>
    <control-setting axis="/controls/engines/engine[0]/condition"       value="1"/>

    <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.7"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.8"/>
    <control-setting axis="/controls/engines/engine[1]/condition"       value="1"/>

    <control-setting axis="/controls/engines/engine[2]/throttle"        value="0.7"/>
    <control-setting axis="/controls/engines/engine[2]/propeller-pitch" value="0.8"/>
    <control-setting axis="/controls/engines/engine[2]/condition"       value="1"/>

    <control-setting axis="/controls/engines/engine[3]/throttle"        value="0.7"/>
    <control-setting axis="/controls/engines/engine[3]/propeller-pitch" value="0.8"/>
    <control-setting axis="/controls/engines/engine[3]/condition"       value="1"/>

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

  <cockpit x="13.09109" y="0.74962" z="-1.58629"/>

  <!-- Fuselage -->
  <fuselage ax=" 16.533" ay=" 0.000" az="-2.778" bx=" 15.933" by=" 0.000" bz="-2.778" width="1.075" taper="0.10" midpoint="1"/>
  <fuselage ax=" 15.933" ay=" 0.000" az="-2.778" bx=" 14.367" by=" 0.000" bz="-2.778" width="2.173" taper="0.50" midpoint="1"/>
  <fuselage ax=" 14.486" ay=" 0.000" az="-2.817" bx=" 12.213" by=" 0.000" bz="-2.529" width="3.249" taper="0.66" midpoint="1"/>
  <fuselage ax=" 12.346" ay=" 0.000" az="-2.529" bx="  8.660" by=" 0.000" bz="-2.418" width="3.800" taper="0.85" midpoint="1"/>
  <fuselage ax="  8.660" ay=" 0.000" az="-2.418" bx=" -2.364" by=" 0.000" bz="-2.418" width="3.800" taper="1.00" midpoint="1"/>
  <fuselage ax=" -2.364" ay=" 0.000" az="-2.418" bx="-16.369" by=" 0.000" bz="-0.288" width="3.800" taper="0.30" midpoint="0"/>

  <!-- Engine exterior left -->
  <fuselage ax="  5.627" ay=" 9.568" az="-0.938" bx="  5.120" by=" 9.568" bz="-0.938" width="1.200" taper="0.80" midpoint="1"/>
  <fuselage ax="  5.120" ay=" 9.568" az="-0.938" bx="  0.551" by=" 9.568" bz="-0.938" width="1.200" taper="0.80" midpoint="0"/>
  <!-- Engine interior left -->
  <fuselage ax="  6.501" ay=" 4.634" az="-0.938" bx="  5.982" by=" 4.634" bz="-0.938" width="1.200" taper="0.80" midpoint="1"/>
  <fuselage ax="  5.982" ay=" 4.634" az="-0.936" bx="  1.308" by=" 4.634" bz="-0.938" width="1.200" taper="0.80" midpoint="0"/>
  <!-- Engine interior right -->
  <fuselage ax="  6.501" ay="-4.634" az="-0.938" bx="  5.982" by="-4.634" bz="-0.938" width="1.200" taper="0.80" midpoint="1"/>
  <fuselage ax="  5.982" ay="-4.634" az="-0.936" bx="  1.308" by="-4.634" bz="-0.938" width="1.200" taper="0.80" midpoint="0"/>
  <!-- Engine exterior right -->
  <fuselage ax="  5.627" ay="-9.568" az="-0.938" bx="  5.120" by="-9.568" bz="-0.938" width="1.200" taper="0.80" midpoint="1"/>
  <fuselage ax="  5.120" ay="-9.568" az="-0.938" bx="  0.551" by="-9.568" bz="-0.938" width="1.200" taper="0.80" midpoint="0"/>

  <!-- Wing -->
  <wing x="2.240" y="0" z="-0.433"
        chord="4.924"
        length="13.392"
        taper="0.54"
        sweep="4.2"
        camber="0.001">
        <stall   aoa="24" width="1" peak="3.5"/>
        <flap0 start="0.15" end="1" lift="1.8" drag="1.6"/>

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

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

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

  <wing x="1.259" y="13.356" z="-0.433"
        append="1"
        chord="2.661"
        length="5.545"
        taper="0.6"
        sweep="4"
        dihedral="-3">
        <stall   aoa="24" width="1" peak="1.4"/>
        <flap1 start="0"    end="1" lift="1.2" drag="1.1"/>

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

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

   <!-- Elevator -->
  <hstab x="-13.930" y="0" z="-0.392"
         chord="2.928"
         length="5.976"
         sweep="3.5"
         taper="0.45">
         <stall   aoa="22" width="1" peak="1.4"/>
         <flap0 start="0"    end="1" lift="1.4" drag="1.5"/>

         <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="-13.301" y="0" z="0.086"
         chord="5.023"
         length="5.120"
         sweep="5"
         taper="0.3">
         <stall   aoa="20" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.5" 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            : http://en.wikipedia.org/wiki/Progress_AI-20

                 name              : Ivchenko AI-20
                 type              : Single-shaft turboprop
                 power cruise      : 4250 hp (take-off), 2600 hp (max cruise)
                 weight            : 1140 kg    ( 2293 lb )
  -->
  <!-- Engine left exterior-->
  <propeller x="4.400" y="9.568" z="-0.938"
             mass="2293"
             moment="1050"
             radius="2.189"
             cruise-speed="310"
             cruise-rpm="2200"
             cruise-power="3500"
             cruise-alt="33500"
             min-rpm="600"
             max-rpm="2500"
             fine-stop="0.5"
             coarse-stop="4.0">
             <actionpt x="5.89102" y="9.568" z="-0.93836"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <turbine-engine eng-power="4400"
                             eng-rpm="2500"
                             alt="33500"
                             flat-rating="4400"
                             n2-low-idle="32"
                             n2-high-idle="65"
                             n2-max="100"
                             bsfc="0.65">
                             <control-input control="CONDLEVER" axis="/controls/engines/engine[0]/condition"/>
                             <control-input control="THROTTLE"  axis="/controls/engines/engine[0]/throttle"/>
             </turbine-engine>
  </propeller>

  <!-- Engine left interior-->
  <propeller x="5.200" y="4.634" z="-0.938"
             mass="2293"
             moment="1050"
             radius="2.189"
             cruise-speed="310"
             cruise-rpm="2200"
             cruise-power="3500"
             cruise-alt="33500"
             min-rpm="600"
             max-rpm="2500"
             fine-stop="0.5"
             coarse-stop="4.0">
             <actionpt x="6.76873" y="4.63488" z="-0.93836"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <turbine-engine eng-power="4400"
                             eng-rpm="2500"
                             alt="33500"
                             flat-rating="4400"
                             n2-low-idle="32"
                             n2-high-idle="65"
                             n2-max="100"
                             bsfc="0.65">
                             <control-input control="CONDLEVER" axis="/controls/engines/engine[1]/condition"/>
                             <control-input control="THROTTLE"  axis="/controls/engines/engine[1]/throttle"/>
             </turbine-engine>
  </propeller>

  <!-- Engine right interior-->
  <propeller x="5.200" y="-4.634" z="-0.938"
             mass="2293"
             moment="1050"
             radius="2.189"
             cruise-speed="310"
             cruise-rpm="2200"
             cruise-power="3500"
             cruise-alt="33500"
             min-rpm="600"
             max-rpm="2500"
             fine-stop="0.5"
             coarse-stop="4.0">
             <actionpt x="6.76873" y="-4.63488" z="-0.93836"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[2]/propeller-pitch"/>
             <turbine-engine eng-power="4400"
                             eng-rpm="2500"
                             alt="33500"
                             flat-rating="4400"
                             n2-low-idle="32"
                             n2-high-idle="65"
                             n2-max="100"
                             bsfc="0.65">
                             <control-input control="CONDLEVER" axis="/controls/engines/engine[2]/condition"/>
                             <control-input control="THROTTLE"  axis="/controls/engines/engine[2]/throttle"/>
             </turbine-engine>
  </propeller>

  <!-- Engine right exterior-->
  <propeller x="4.400" y="-9.568" z="-0.938"
             mass="2293"
             moment="1050"
             radius="2.189"
             cruise-speed="310"
             cruise-rpm="2200"
             cruise-power="3500"
             cruise-alt="33500"
             min-rpm="600"
             max-rpm="2500"
             fine-stop="0.5"
             coarse-stop="4.0">
             <actionpt x="5.89102" y="-9.568" z="-0.93836"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[3]/propeller-pitch"/>
             <turbine-engine eng-power="4400"
                             eng-rpm="2500"
                             alt="33500"
                             flat-rating="4400"
                             n2-low-idle="32"
                             n2-high-idle="65"
                             n2-max="100"
                             bsfc="0.65">
                             <control-input control="CONDLEVER" axis="/controls/engines/engine[3]/condition"/>
                             <control-input control="THROTTLE"  axis="/controls/engines/engine[3]/throttle"/>
             </turbine-engine>
  </propeller>

  <!-- Noze wheel -->
  <gear x="11.511" y="0" z="-5.261"
        compression="0.25"
        spring="0.78"
        damp="1.35"
        sfric="1.6"
        dfric="0.4">
        <control-input  control="STEER"  axis="/controls/flight/rudder" square="true"/>
        <control-input  control="EXTEND" axis="/controls/gear/gear-down"/>
        <control-input  control="BRAKE"  axis="/controls/gear/brake-parking"/>

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

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

  <!-- Left wheel 1 -->
  <gear x="2.565" y=" 2.484" z="-5.149"
        compression="0.45"
        spring="0.80"
        damp="1.10">
        <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[1]/position-norm"/>

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

  <!-- Left wheel 2 -->
  <gear x="1.305" y=" 2.484" z="-5.129"
        compression="0.45"
        spring="0.80"
        damp="1.10">
        <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[2]/position-norm"/>

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

  <!-- Right wheel 1 -->
  <gear x="2.565" y="-2.484" z="-5.149"
        compression="0.45"
        spring="0.80"
        damp="1.10">
        <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[3]/position-norm"/>

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

  <!-- Right wheel 2 -->
  <gear x="1.305" y="-2.484" z="-5.129"
        compression="0.45"
        spring="0.80"
        damp="1.10">
        <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[4]/position-norm"/>

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

  <tank x="3" y=" 4.817" z="-0.4" capacity="7170"/>
  <tank x="3" y="-4.817" z="-0.4" capacity="7170"/>
  <tank x="3" y=" 6.817" z="-0.4" capacity="7170"/>
  <tank x="3" y="-6.817" z="-0.4" capacity="7170"/>

  <weight x="13" y="0.8" z="-2.03" mass-prop="/sim/weight[0]/weight-lb"/>
  <weight x=" 7" y="0.0" z="-3.40" mass-prop="/sim/weight[1]/weight-lb"/>
  <weight x=" 7" y="0.0" z="-3.40" mass-prop="/sim/weight[2]/weight-lb"/>
  <weight x=" 7" y="0.0" z="-3.40" mass-prop="/sim/weight[3]/weight-lb"/>

  <!-- Thruster for Pushback action -->
  <thruster x="-11.511" y="0" z="-5.261"
            vx="-1" vy="0" vz="0" thrust="18000">
            <control-input axis="/controls/engines/engine[0]/throttle-r" control="THROTTLE"/>
            <control-input axis="/controls/engines/engine[1]/throttle-r" control="THROTTLE"/>
            <control-input axis="/controls/engines/engine[2]/throttle-r" control="THROTTLE"/>
            <control-input axis="/controls/engines/engine[3]/throttle-r" control="THROTTLE"/>
  </thruster>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 4.924 / 6     = 0.820
                 2.240 + 0.820 = 3.060
  -->
  <ballast x="11.8" y="0" z="-2.05" mass="14264"/>
  <ballast x="-1.0" y="0" z="-2.05" mass="16000"/>

</airplane>
