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

<!-- Avro Lancaster BARANGER Emmanuel (   2009)
            Updated BARANGER Emmanuel (   2012) with Melchior's script
            Updated BARANGER Emmanuel (   2019)
            Updated BARANGER Emmanuel (06/2025)

     Sources      http://fr.wikipedia.org/wiki/Avro_Lancaster

     Envergure          : 31.09 m  (   102 ft      )
     Longueur           : 21.18 m  (    69 ft 5 in )
     Hauteur            :  5.97 m  (    19 ft 7 in )
     Masse a vide       : 16705 kg ( 36828 lb      )
     Max. takeoff weight: 30844 kg ( 68000 lb      )
     Moteur             : 4 Rolls-Royce Merlin XX V12 engines, 1280 hp each
     Vitesse max        : 450 km/h (240 kt) at 15000 ft (5600 m)
-->
<airplane mass="36828" version="YASIM_VERSION_CURRENT" mtow-lbs="68000">

  <approach speed="90" aoa="6" 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]/boost"            value="0"/>
    <control-setting axis="/controls/engines/engine[1]/boost"            value="0"/>
    <control-setting axis="/controls/engines/engine[2]/boost"            value="0"/>
    <control-setting axis="/controls/engines/engine[3]/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[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="240" alt="15000" 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]/boost"            value="1"/>
    <control-setting axis="/controls/engines/engine[1]/boost"            value="1"/>
    <control-setting axis="/controls/engines/engine[2]/boost"            value="1"/>
    <control-setting axis="/controls/engines/engine[3]/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[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="7.536" y="0.231" z="1.417"/>

  <!-- Fuselage -->
  <fuselage ax="10.533" ay=" 0.000" az="-0.151" bx="  9.926" by=" 0.000" bz="-0.151" width="1.075" taper="0.90" midpoint="1"/>
  <fuselage ax=" 9.926" ay=" 0.000" az="-0.151" bx="  8.505" by=" 0.000" bz="-0.024" width="1.776" taper="0.60" midpoint="1"/>
  <fuselage ax=" 8.548" ay=" 0.000" az="-0.024" bx=" -3.859" by=" 0.000" bz="-0.024" width="1.776" taper="1.00" midpoint="1"/>
  <fuselage ax="-3.859" ay=" 0.000" az="-0.024" bx=" -9.629" by=" 0.000" bz=" 0.399" width="1.776" taper="0.70" midpoint="0"/>
  <fuselage ax="-9.629" ay=" 0.000" az=" 0.399" bx="-10.508" by=" 0.000" bz=" 0.399" width="1.243" taper="0.70" midpoint="0"/>

  <fuselage ax=" 9.976" ay=" 0.000" az=" 0.432" bx="  8.973" by=" 0.000" bz=" 0.432" width="1.325" taper="0.80" midpoint="1"/>
  <fuselage ax=" 8.973" ay=" 0.000" az=" 0.432" bx="  4.517" by=" 0.000" bz=" 0.471" width="1.780" taper="0.76" midpoint="1"/>
  <fuselage ax=" 4.517" ay=" 0.000" az=" 0.471" bx=" -3.859" by=" 0.000" bz=" 0.471" width="1.780" taper="1.00" midpoint="1"/>
  <fuselage ax="-3.859" ay=" 0.000" az=" 0.471" bx=" -9.662" by=" 0.000" bz=" 0.666" width="1.780" taper="0.70" midpoint="0"/>
  <fuselage ax="-9.629" ay=" 0.000" az=" 0.666" bx="-10.508" by=" 0.000" bz=" 0.666" width="1.243" taper="0.70" midpoint="0"/>

  <!-- Cockpit -->
  <fuselage ax=" 8.397" ay=" 0.000" az=" 0.915" bx="  7.489" by=" 0.000" bz=" 1.001" width="1.278" taper="0.3" midpoint="1"/>
  <fuselage ax=" 7.542" ay=" 0.000" az=" 1.001" bx="  6.102" by=" 0.000" bz=" 1.001" width="1.278" taper="1.0" midpoint="1"/>
  <fuselage ax=" 6.102" ay=" 0.000" az=" 1.001" bx="  5.014" by=" 0.000" bz=" 1.001" width="1.278" taper="0.8" midpoint="0"/>

  <!-- Engines Left exterior -->
  <fuselage ax=" 6.258" ay=" 7.787" az="-0.003" bx="  5.651" by=" 7.787" bz="-0.003" width="1.075" taper="0.9" midpoint="1"/>
  <fuselage ax=" 5.651" ay=" 7.787" az="-0.003" bx="  3.302" by=" 7.787" bz="-0.003" width="1.075" taper="1.0" midpoint="1"/>
  <fuselage ax=" 3.302" ay=" 7.787" az="-0.003" bx="  1.822" by=" 7.787" bz=" 0.245" width="1.075" taper="0.3" midpoint="0"/>

  <!-- Engines Left interior -->
  <fuselage ax=" 6.847" ay=" 3.506" az="-0.003" bx="  6.240" by=" 3.506" bz="-0.003" width="1.075" taper="0.9" midpoint="1"/>
  <fuselage ax=" 6.240" ay=" 3.506" az="-0.003" bx="  1.641" by=" 3.506" bz="-0.003" width="1.075" taper="1.0" midpoint="1"/>
  <fuselage ax=" 1.641" ay=" 3.506" az="-0.003" bx="  0.148" by=" 3.506" bz=" 0.245" width="1.075" taper="0.3" midpoint="0"/>

  <!-- Engines Right interior -->
  <fuselage ax=" 6.847" ay="-3.506" az="-0.003" bx="  6.240" by="-3.506" bz="-0.003" width="1.075" taper="0.9" midpoint="1"/>
  <fuselage ax=" 6.240" ay="-3.506" az="-0.003" bx="  1.641" by="-3.506" bz="-0.003" width="1.075" taper="1.0" midpoint="1"/>
  <fuselage ax=" 1.641" ay="-3.506" az="-0.003" bx="  0.148" by="-3.506" bz=" 0.245" width="1.075" taper="0.3" midpoint="0"/>

  <!-- Engines Right exterior -->
  <fuselage ax=" 6.258" ay="-7.787" az="-0.003" bx="  5.651" by="-7.787" bz="-0.003" width="1.075" taper="0.9" midpoint="1"/>
  <fuselage ax=" 5.651" ay="-7.787" az="-0.003" bx="  3.302" by="-7.787" bz="-0.003" width="1.075" taper="1.0" midpoint="1"/>
  <fuselage ax=" 3.302" ay="-7.787" az="-0.003" bx="  1.822" by="-7.787" bz=" 0.245" width="1.075" taper="0.3" midpoint="0"/>

  <!-- Wing -->
  <mstab x="2.379" y="0" z="0.423"
         chord    = "4.717"
         length   = "4.346"
         taper    = "1"
         sweep    = "0"
         dihedral = "0"
         camber   = "0.11">
         <stall   aoa="10" width="1" peak="1.5"/>
         <flap0 start="0.22" 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"/>
  </mstab>

  <wing x="2.379" y="4.346" z="0.423"
        chord    = "4.717"
        length   = "11.205"
        taper    = "0.45"
        sweep    = "1"
        dihedral = "4"
        camber   = "0.11">
        <stall   aoa="10" width="1"    peak="1.5"/>
        <flap0 start="0.00" end="0.33" lift="1.8" drag="1.6"/>
        <flap1 start="0.33" end="0.78" lift="1.6" drag="1.1"/>

        <control-input  control="FLAP0" axis="/controls/flight/flaps"        invert="true"/>
        <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>

  <!-- Elevator -->
  <hstab x="-8.382" y="0" z="0.321"
         chord  = "2.6"
         length = "4.9"
         taper  = "0.70"
         sweep  = "-2">
         <stall   aoa="10" width="1"    peak="1.5"/>
         <flap0 start="0.12" end="0.92" lift="1.5" drag="2.3"/>

         <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="-7.967" y="4.869" z="-0.653"
         chord  = "1.861"
         length = "3.435"
         taper  = "1">
         <stall   aoa="6" width="1" peak="1.5"/>
         <flap0 start="0"   end="1" lift="1.7" drag="1.5"/>

         <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>

  <vstab x="-7.967" y="-4.869" z="-0.653"
         chord  = "1.861"
         length = "3.435"
         taper  = "1">
         <stall   aoa="6" width="1" peak="1.5"/>
         <flap0 start="0"   end="1" lift="1.7" drag="1.5"/>

         <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/Rolls-Royce_Merlin

                 name              : Rolls-Royce Merlin
                 type              : 12-cylinder, supercharged, liquid-cooled, 60 degre "Vee", piston aircraft engine
                 power cruise      : 2000 hp at 3000 rpm at 5250 ft.1860 hp at 3000 rpm at 11000 ft
                 Compression ratio : 6:1
                 weight            : 746.5 kg (645 lb )
                 Displacement      : 1649 in3 (27.02 L)
                 Propeller diameter: 3.861 m
  -->
  <!-- Engine left exterior-->
  <propeller x="5.196" y="7.787" z="0.144"
             mass         = "645"
             moment       = "40"
             radius       = "1.83"
             min-rpm      = "250"
             max-rpm      = "3000"
             cruise-speed = "200"
             cruise-rpm   = "2800"
             cruise-power = "1860"
             cruise-alt   = "15000">
             <actionpt x="6.440" y="7.787" z="0.347"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-power    = "2000"
                            eng-rpm      = "3000"
                            displacement = "1649">
                            <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="5.824" y="3.506" z="-0.166"
             mass         = "645"
             moment       = "40"
             radius       = "1.83"
             min-rpm      = "250"
             max-rpm      = "3000"
             cruise-speed = "200"
             cruise-rpm   = "2800"
             cruise-power = "1860"
             cruise-alt   = "15000">
             <actionpt x="7.057" y="3.506" z="0.096"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <piston-engine eng-power    = "2000"
                            eng-rpm      = "3000"
                            displacement = "1649">
                            <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>

  <!-- Engine right interior-->
  <propeller x="5.824" y="-3.506" z="-0.166"
             mass         = "645"
             moment       = "40"
             radius       = "1.83"
             min-rpm      = "250"
             max-rpm      = "3000"
             cruise-speed = "200"
             cruise-rpm   = "2800"
             cruise-power = "1860"
             cruise-alt   = "15000">
             <actionpt x="7.057" y="-3.506" z="0.096"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[2]/propeller-pitch"/>
             <piston-engine eng-power    = "2000"
                            eng-rpm      = "3000"
                            displacement = "1649">
                            <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"/>
                            <control-input control="BOOST"    axis="/controls/engines/engine[2]/boost"/>
             </piston-engine>
  </propeller>

  <!-- Engine right exterior-->
  <propeller x="5.196" y="-7.787" z="0.144"
             mass         = "645"
             moment       = "40"
             radius       = "1.83"
             min-rpm      = "250"
             max-rpm      = "3000"
             cruise-speed = "200"
             cruise-rpm   = "2800"
             cruise-power = "1860"
             cruise-alt   = "15000">
             <actionpt x="6.440" y="-7.787" z="0.347"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[3]/propeller-pitch"/>
             <piston-engine eng-power    = "2000"
                            eng-rpm      = "3000"
                            displacement = "1649">
                            <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"/>
                            <control-input control="BOOST"    axis="/controls/engines/engine[3]/boost"/>
             </piston-engine>
  </propeller>

  <!-- Left wheel -->
  <gear x="4.35609" y="3.51767" z="-2.911380"
        compression = "0.2"
        spring      = "3.0"
        damp        = "1.5"
        sfric       = "0.9"
        dfric       = "0.7"
        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="4.35609" y="-3.51767" z="-2.911380"
        compression = "0.2"
        spring      = "3.0"
        damp        = "1.5"
        sfric       = "0.9"
        dfric       = "0.7"
        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.69418" y="0" z="-1.16363"
        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"/>
  </gear>

  <tank x="2.466" y=" 4.817" z="0.436" capacity="2000"/>
  <tank x="2.466" y="-4.817" z="0.436" capacity="2000"/>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 4.717 / 6     = 0.786
                 2.379 + 0.786 = 3.165
  -->
  <ballast x="10" y="0" z="-0.4" mass="8210"/>

</airplane>
