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

<!-- Boeing 247      : BARANGER Emmanuel (2011)
             updated : Emmanuel BARANGER (2015)
             updated : Emmanuel BARANGER (10/2020)
             updated : Emmanuel BARANGER (01/2023)

     sources         : http://en.wikipedia.org/wiki/Boeing_247
                       http://www.aviation.technomuses.ca/les_collections/artefacts/aeronefs/Boeing247D/

     Wingspan           : 74 ft 1 in ( 22.6 m    )
     Lenght             : 51 ft 5 in ( 15.7 m    )
     Height             : 12 ft 5 in (  3.8 m    )
     Empty mass         :    8940 lb ( 4055 kg   )
     Max takeoff weight :   13650 lb ( 6192 kg   )
     Engines            : 2 Pratt & Whitney S1H1-G Wasp radial engine, 550 hp each
     Cruise speed       : 165.7 kts  (  304 km/h )
     Maximim speed      : 174.4 kts  (  320 km/h )
-->
<airplane mass="8940" version="YASIM_VERSION_CURRENT" mtow-lbs="13650">

  <approach speed="70" aoa="4" fuel="0.2">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.4"/>
    <control-setting axis="/controls/engines/engine[0]/mixture"         value="1"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.57"/>
    <control-setting axis="/controls/engines/engine[0]/boost"           value="0"/>
    <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.4"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="1"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.57"/>
    <control-setting axis="/controls/engines/engine[1]/boost"           value="0"/>
    <control-setting axis="/controls/gear/gear-down"                    value="1"/>
  </approach>

  <cruise speed="165.7" alt="15000" fuel="0.5">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="1"/>
    <control-setting axis="/controls/engines/engine[0]/mixture"         value="0.3"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.9"/>
    <control-setting axis="/controls/engines/engine[0]/boost"           value="1"/>
    <control-setting axis="/controls/engines/engine[1]/throttle"        value="1"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="0.3"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.9"/>
    <control-setting axis="/controls/engines/engine[1]/boost"           value="1"/>
    <control-setting axis="/controls/gear/gear-down"                    value="0"/>
  </cruise>

  <cockpit x="4.874" y="0.263" z="0.843"/>

  <!-- Fuselage up -->
  <fuselage ax=" 7.848" ay=" 0.000" az="-0.218" bx=" 7.651" by=" 0.000" bz="-0.218" width="0.609" taper="0.20" midpoint="1"/>
  <fuselage ax=" 7.651" ay=" 0.000" az="-0.218" bx=" 7.104" by=" 0.000" bz="-0.177" width="1.016" taper="0.58" midpoint="1"/>
  <fuselage ax=" 7.104" ay=" 0.000" az="-0.177" bx=" 6.294" by=" 0.000" bz="-0.143" width="1.329" taper="0.77" midpoint="1"/>
  <fuselage ax=" 6.294" ay=" 0.000" az="-0.143" bx=" 5.393" by=" 0.000" bz="-0.140" width="1.541" taper="0.86" midpoint="1"/>
  <fuselage ax=" 5.393" ay=" 0.000" az="-0.140" bx=" 0.009" by=" 0.000" bz="-0.140" width="1.541" taper="1.00" midpoint="1"/>
  <fuselage ax=" 5.576" ay=" 0.000" az=" 0.290" bx=" 5.268" by=" 0.000" bz=" 0.290" width="1.387" taper="0.45" midpoint="1"/>
  <fuselage ax=" 5.268" ay=" 0.000" az=" 0.290" bx=" 4.465" by=" 0.000" bz=" 0.290" width="1.541" taper="0.90" midpoint="1"/>
  <fuselage ax=" 4.465" ay=" 0.000" az=" 0.290" bx=" 0.009" by=" 0.000" bz=" 0.367" width="1.541" taper="1.00" midpoint="1"/>
  <fuselage ax=" 0.009" ay=" 0.000" az=" 0.367" bx="-2.000" by=" 0.000" bz=" 0.443" width="1.541" taper="0.90" midpoint="0"/>
  <fuselage ax="-2.000" ay=" 0.000" az=" 0.443" bx="-4.108" by=" 0.000" bz=" 0.591" width="1.387" taper="0.78" midpoint="0"/>
  <fuselage ax="-4.108" ay=" 0.000" az=" 0.591" bx="-6.442" by=" 0.000" bz=" 0.876" width="1.082" taper="0.45" midpoint="0"/>
  <fuselage ax="-6.442" ay=" 0.000" az=" 0.876" bx="-7.669" by=" 0.000" bz=" 1.006" width="0.487" taper="0.15" midpoint="0"/>

  <!-- Fuselage down-->
  <fuselage ax=" 7.848" ay=" 0.000" az="-0.364" bx=" 7.651" by=" 0.000" bz="-0.364" width="0.609" taper="0.20" midpoint="1"/>
  <fuselage ax=" 7.651" ay=" 0.000" az="-0.364" bx=" 7.104" by=" 0.000" bz="-0.382" width="1.016" taper="0.58" midpoint="1"/>
  <fuselage ax=" 7.104" ay=" 0.000" az="-0.382" bx=" 6.294" by=" 0.000" bz="-0.348" width="1.329" taper="0.77" midpoint="1"/>
  <fuselage ax=" 6.294" ay=" 0.000" az="-0.348" bx=" 5.394" by=" 0.000" bz="-0.300" width="1.541" taper="0.86" midpoint="1"/>
  <fuselage ax=" 5.394" ay=" 0.000" az="-0.300" bx=" 0.009" by=" 0.000" bz="-0.140" width="1.541" taper="1.00" midpoint="1"/>
  <fuselage ax=" 0.009" ay=" 0.000" az="-0.140" bx="-2.000" by=" 0.000" bz="-0.064" width="1.541" taper="0.90" midpoint="0"/>
  <fuselage ax="-2.000" ay=" 0.000" az="-0.064" bx="-4.108" by=" 0.000" bz=" 0.021" width="1.387" taper="0.78" midpoint="0"/>
  <fuselage ax="-4.108" ay=" 0.000" az=" 0.021" bx="-6.457" by=" 0.000" bz=" 0.191" width="1.082" taper="0.45" midpoint="0"/>
  <fuselage ax="-6.457" ay=" 0.000" az=" 0.191" bx="-7.505" by=" 0.000" bz=" 0.856" width="0.487" taper="0.15" midpoint="0"/>

  <!-- Moteur gauche -->
  <fuselage ax=" 5.905" ay=" 2.359" az="-0.313" bx=" 5.771" by=" 2.359" bz="-0.313" width="1.320" taper="0.80" midpoint="1"/>
  <fuselage ax=" 5.771" ay=" 2.359" az="-0.313" bx=" 4.150" by=" 2.359" bz="-0.313" width="1.320" taper="1.00" midpoint="1"/>
  <fuselage ax=" 4.150" ay=" 2.359" az="-0.313" bx=" 3.227" by=" 2.359" bz="-0.313" width="1.320" taper="0.50" midpoint="0"/>

  <!-- Moteur droit -->
  <fuselage ax=" 5.905" ay="-2.359" az="-0.313" bx=" 5.771" by="-2.359" bz="-0.313" width="1.320" taper="0.80" midpoint="1"/>
  <fuselage ax=" 5.771" ay="-2.359" az="-0.313" bx=" 4.150" by="-2.359" bz="-0.313" width="1.320" taper="1.00" midpoint="1"/>
  <fuselage ax=" 4.150" ay="-2.359" az="-0.313" bx=" 3.227" by="-2.359" bz="-0.313" width="1.320" taper="0.50" midpoint="0"/>

  <!-- Wing -->
  <wing x="1.925" y="0" z="-0.464"
        chord="4.573"
        length="11.312"
        taper="0.50"
        sweep="-3.5"
        dihedral="2"
        camber="0.05">
        <stall   aoa="16" width="1.00" peak="1.5"/>
        <flap0 start="0.45" end="0.89" lift="1.2" drag="1.2"/>

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

        <control-output control="FLAP0" side="left"  prop="/surface-positions/left-aileron-pos-norm"/>
        <control-output control="FLAP0" side="right" prop="/surface-positions/right-aileron-pos-norm"/>
  </wing>

  <!-- Elevator -->
  <hstab x="-5.886" y="0" z="0.477"
         chord="2.720"
         length="4.0"
         taper="0.4"
         sweep="8">
         <stall   aoa="14" width="1" peak="1.5"/>
         <flap0 start="0.1"  end="1" lift="1.3" 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="-6.267" y="0" z="1.136"
         chord="3.050"
         length="2.40"
         sweep="16"
         taper="0.5">
         <stall   aoa="12" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.4" 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/Pratt_%26_Whitney_R-1340

                 name         : Pratt & Whitney R-1340
                 Power        : 542 hp at 2200 rpm at 5,000
                 type         : 9 cylinder single-row supercharged air-cooled radial engine
                 weight       : 805 lb (365 kg)
                 Displacement : 1343.8 in3 (22.02 l)
                 Compression  : 6.0:1

  -->
  <!-- Engine left -->
  <propeller x="5.705" y="2.320" z="-0.313"
             mass="805"
             moment="2.5"
             radius="1.64"
             min-rpm="250"
             max-rpm="2300"
             cruise-speed="165.7"
             cruise-rpm="2200"
             cruise-power="520"
             cruise-alt="13120">
             <actionpt x="6.101" y="2.320" z="-0.313"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-power="542"
                            eng-rpm="2300"
                            compression="6.0"
                            turbo-mul="1.5"
                            displacement="1343.8">
                            <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="5.705" y="-2.320" z="-0.313"
             mass="805"
             moment="2.5"
             radius="1.64"
             min-rpm="250"
             max-rpm="2300"
             cruise-speed="165.7"
             cruise-rpm="2200"
             cruise-power="520"
             cruise-alt="13120">
             <actionpt x="6.101" y="-2.320" z="-0.313"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <piston-engine eng-power="542"
                            eng-rpm="2300"
                            compression="6.0"
                            turbo-mul="1.5"
                            displacement="1343.8">
                            <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.571" y="2.588" z="-2.648"
        compression="0.2"
        spring="1"
        damp="2"
        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.571" y="-2.588" z="-2.648"
        compression="0.2"
        spring="1"
        damp="2"
        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="-6.976" y="0" z="-0.674"
        compression="0.1"
        spring="1"
        damp="2"
        stiction="1">
        <control-input  control="STEER"  axis="/controls/flight/rudder" 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.756" y=" 6" z="-0.280" capacity="2466"/>
  <tank x="1.756" y="-6" z="-0.280" capacity="2466"/>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 4.573 / 6     = 0.762
                 1.925 + 0.762 = 2.687
  -->
  <ballast x="7" y="0" z="-0.7" mass="1184"/>

</airplane>
