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

<!-- Sikorsky S 38B : BARANGER Emmanuel 2009
            Updated : BARANGER Emmanuel 02/2021

     source         : http://en.wikipedia.org/wiki/Sikorsky_S-38

     wingspan       : 21.85 m   ( 71 ft 8 in  )
     length         : 12.27 m   ( 40 ft 3 in  )
     height         :  4.22 m   ( 13 ft 10 in )
     Moteurs        : 2 Pratt & Whitney R-1340 Wasp 9-cylinder air-cooled radial engines, 400 hp each
     Empty weight   :  2970 kg  (     6548 lb )
     Gross weight   :  4753 kg  (    10479 lb )
     Maximum speed  :  200 km/h (      108 kn )
     Cruise speed   :  175 km/h (       95 kn )
     Stall speed    :   92 km/h (       50 kn )
-->
<airplane mass="6548" version="YASIM_VERSION_CURRENT" mtow-lbs="10479">

  <approach speed="50" 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.0"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.5"/>
    <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.4"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="1.0"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="0.5"/>
  </approach>

  <cruise speed="95" alt="5000" fuel="0.5">
    <control-setting axis="/controls/engines/engine[0]/throttle"        value="0.7"/>
    <control-setting axis="/controls/engines/engine[0]/mixture"         value="0.7"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="1.0"/>
    <control-setting axis="/controls/engines/engine[1]/throttle"        value="0.7"/>
    <control-setting axis="/controls/engines/engine[1]/mixture"         value="0.7"/>
    <control-setting axis="/controls/engines/engine[1]/propeller-pitch" value="1.0"/>
  </cruise>

  <cockpit x="2.260" y="0.369" z="-0.650"/>

  <!-- Fuselage -->
  <!-- Noze -->
  <fuselage ax=" 6.104" ay=" 0.000" az="-1.174" bx=" 5.587" by=" 0.000" bz="-1.311" width="0.867" taper="0.30" midpoint="1"/>
  <!-- Left section -->
  <fuselage ax=" 5.587" ay=" 0.000" az="-1.311" bx=" 4.547" by=" 0.189" bz="-1.415" width="1.232" taper="0.65" midpoint="1"/>
  <fuselage ax=" 4.547" ay=" 0.189" az="-1.415" bx=" 2.981" by=" 0.312" bz="-1.456" width="1.325" taper="0.92" midpoint="1"/>
  <fuselage ax=" 2.981" ay=" 0.312" az="-1.456" bx=" 0.390" by=" 0.318" bz="-1.510" width="1.290" taper="0.80" midpoint="0"/>
  <fuselage ax=" 0.390" ay=" 0.318" az="-1.510" bx="-2.193" by=" 0.134" bz="-1.423" width="1.032" taper="0.50" midpoint="0"/>
  <fuselage ax="-2.193" ay=" 0.134" az="-1.423" bx="-2.923" by=" 0.000" bz="-1.500" width="0.515" taper="0.20" midpoint="0"/>
  <!-- Right section -->
  <fuselage ax=" 5.587" ay=" 0.000" az="-1.311" bx=" 4.547" by="-0.189" bz="-1.415" width="1.232" taper="0.65" midpoint="1"/>
  <fuselage ax=" 4.547" ay="-0.189" az="-1.415" bx=" 2.981" by="-0.312" bz="-1.456" width="1.325" taper="0.92" midpoint="1"/>
  <fuselage ax=" 2.981" ay="-0.312" az="-1.456" bx=" 0.390" by="-0.318" bz="-1.510" width="1.290" taper="0.80" midpoint="0"/>
  <fuselage ax=" 0.390" ay="-0.318" az="-1.510" bx="-2.193" by="-0.134" bz="-1.423" width="1.032" taper="0.50" midpoint="0"/>
  <fuselage ax="-2.193" ay="-0.134" az="-1.423" bx="-2.923" by=" 0.000" bz="-1.500" width="0.515" taper="0.20" midpoint="0"/>
  <!-- Cabine -->
  <!-- Left section -->
  <fuselage ax=" 2.958" ay=" 0.400" az="-0.926" bx=" 2.339" by=" 0.400" bz="-0.838" width="0.838" taper="0.40" midpoint="1"/>
  <fuselage ax=" 2.339" ay=" 0.400" az="-0.838" bx="-1.342" by=" 0.211" bz="-0.891" width="0.838" taper="0.90" midpoint="0"/>
  <fuselage ax="-1.342" ay=" 0.211" az="-0.891" bx="-2.411" by=" 0.027" bz="-0.999" width="0.754" taper="0.70" midpoint="0"/>
  <fuselage ax="-2.411" ay=" 0.027" az="-0.999" bx="-2.935" by=" 0.000" bz="-1.241" width="0.525" taper="0.30" midpoint="0"/>
  <!-- Right section -->
  <fuselage ax=" 2.958" ay="-0.400" az="-0.926" bx=" 2.339" by="-0.400" bz="-0.838" width="0.838" taper="0.40" midpoint="1"/>
  <fuselage ax=" 2.339" ay="-0.400" az="-0.838" bx="-1.342" by="-0.211" bz="-0.891" width="0.838" taper="0.90" midpoint="0"/>
  <fuselage ax="-1.342" ay="-0.211" az="-0.891" bx="-2.411" by="-0.027" bz="-0.999" width="0.754" taper="0.70" midpoint="0"/>
  <fuselage ax="-2.411" ay="-0.027" az="-0.999" bx="-2.935" by=" 0.000" bz="-1.241" width="0.525" taper="0.30" midpoint="0"/>
  <!-- Left engine -->
  <fuselage ax=" 3.094" ay=" 1.588" az=" 0.545" bx=" 2.898" by=" 1.588" bz=" 0.545" width="0.893" taper="0.70" midpoint="1"/>
  <fuselage ax=" 2.898" ay=" 1.588" az=" 0.545" bx=" 2.519" by=" 1.588" bz=" 0.545" width="0.893" taper="0.90" midpoint="0"/>
  <fuselage ax=" 2.519" ay=" 1.588" az=" 0.545" bx=" 1.358" by=" 1.588" bz=" 0.545" width="0.804" taper="0.40" midpoint="0"/>
  <!-- Right engine -->
  <fuselage ax=" 3.094" ay="-1.588" az=" 0.545" bx=" 2.898" by="-1.588" bz=" 0.545" width="0.893" taper="0.70" midpoint="1"/>
  <fuselage ax=" 2.898" ay="-1.588" az=" 0.545" bx=" 2.519" by="-1.588" bz=" 0.545" width="0.893" taper="0.90" midpoint="0"/>
  <fuselage ax=" 2.519" ay="-1.588" az=" 0.545" bx=" 1.358" by="-1.588" bz=" 0.545" width="0.804" taper="0.40" midpoint="0"/>
  <!-- Tail -->
  <fuselage ax=" 0.658" ay=" 1.627" az=" 1.401" bx="-5.208" by=" 1.627" bz=" 1.208" width="0.212" taper="1.00" midpoint="1"/>
  <fuselage ax=" 0.658" ay="-1.627" az=" 1.401" bx="-5.208" by="-1.627" bz=" 1.208" width="0.212" taper="1.00" midpoint="1"/>

  <wing x="1.238" y="0" z="1.458"
        chord  = "2.817"
        length = "10.797"
        taper  = "1"
        camber = "0.001">
        <stall   aoa="14" width="1"    peak="1.5"/>
        <flap0 start="0.51" end="0.86" lift="1.2" drag="1.1"/>

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

  <mstab x="1.099" y="0.804" z="-1.064"
         chord    = "1.444"
         length   = "4.573"
         taper    = "1"
         dihedral = "2"
         camber   = "0.001">
         <stall aoa="14" width="1" peak="1.5"/>
  </mstab>

  <hstab x="-5.434" y="0" z="1.169"
         chord  = "1.364"
         length = "2.733"
         taper  = "1">
         <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/elevator"/>
         <control-input  control="FLAP0" axis="/controls/flight/elevator-trim"/>

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

  <vstab x="-5.491" y="1.588" z="0.052"
         chord  = "1.011"
         length = "2.448"
         taper  = "1">
         <stall   aoa="14" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.4" 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>

  <vstab x="-5.491" y="-1.588" z="0.052"
         chord  = "1.011"
         length = "2.448"
         taper  = "1">
         <stall   aoa="14" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.4" 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://en.wikipedia.org/wiki/Pratt_%26_Whitney_R-1340

                 name         : Pratt & Whitney R-1340
                 Power        : 542 hp at 2200 rpm at 5000
                 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
  -->
  <propeller x="2.977" y="1.588" z="0.546"
             mass          = "805"
             moment        = "15"
             radius        = "1.5"
             cruise-speed  = "95"
             cruise-rpm    = "2200"
             cruise-power  = "520"
             cruise-alt    = "5000"
             takeoff-power = "542"
             takeoff-rpm   = "2200">
             <actionpt x="3.343" y="1.588" z="0.546"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[0]/propeller-pitch"/>
             <piston-engine eng-power    = "542"
                            eng-rpm      = "2300"
                            displacement = "1343.8"
                            compression  = "6">
                            <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>

  <propeller x="2.977" y="-1.588" z="0.546"
             mass          = "805"
             moment        = "15"
             radius        = "1.5"
             cruise-speed  = "95"
             cruise-rpm    = "2200"
             cruise-power  = "520"
             cruise-alt    = "5000"
             takeoff-power = "542"
             takeoff-rpm   = "2200">
             <actionpt x="3.343" y="-1.588" z="0.546"/>
             <control-input control="ADVANCE" axis="/controls/engines/engine[1]/propeller-pitch"/>
             <piston-engine eng-power    = "542"
                            eng-rpm      = "2300"
                            displacement = "1343.8"
                            compression  = "6">
                            <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>

  <!-- Roue gauche 0 -->
  <gear x="1.874" y="1.455" z="-2.582"
        compression = "0.07"
        on-water    = "0"
        on-solid    = "1">
        <control-input  control="BRAKE"  axis="/controls/gear/brake-parking"/>
        <control-input  control="BRAKE"  axis="/controls/gear/brake-left"/>
        <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"/>
  </gear>

  <!-- Roue droite 1 -->
  <gear x="1.874" y="-1.455" z="-2.582"
        compression = "0.07"
        on-water    = "0"
        on-solid    = "1">
        <control-input  control="BRAKE"  axis="/controls/gear/brake-parking"/>
        <control-input  control="BRAKE"  axis="/controls/gear/brake-right"/>
        <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"/>
  </gear>

  <!-- Patte de queue 2 -->
  <gear x="-2.790" y="0.0" z="-1.820"
        compression ="0.03"
        on-water    ="0"
        on-solid    ="1">
  </gear>

  <!-- Fuselage -->
  <!-- Avant 3 -->
  <gear x="5.482" y="0" z="-2.296"
        compression                  = "0.2"
        spring                       = "12"
        damp                         = "8"
        on-water                     = "1"
        on-solid                     = "0"
        ignored-by-solver            = "0"
        reduce-friction-by-extension = "1.0"
        speed-planing                = "25"
        spring-factor-not-planing    = "0.2">
  </gear>

  <!-- Centre 4 -->
  <gear x="1.173" y="0" z="-1.764"
        compression                  = "0.25"
        spring                       = "10"
        damp                         = "8"
        on-water                     = "1"
        on-solid                     = "0"
        ignored-by-solver            = "0"
        reduce-friction-by-extension = "1.1"
        speed-planing                = "35"
        spring-factor-not-planing    = "0.3">
  </gear>

  <!-- Arriere 5 -->
  <gear x="-2.875" y="0" z="-1.684"
        compression                  = "0.21"
        spring                       = "8"
        damp                         = "8"
        on-water                     = "1"
        on-solid                     = "0"
        ignored-by-solver            = "1"
        reduce-friction-by-extension = "1.6"
        speed-planing                = "25"
        spring-factor-not-planing    = "0.9">
  </gear>

  <!-- Flotteur gauche 6 -->
  <gear x="0.195" y="3.790" z="-1.664"
        compression                  = "0.1"
        spring                       = "2"
        damp                         = "10"
        on-water                     = "1"
        on-solid                     = "0"
        ignored-by-solver            = "1"
        reduce-friction-by-extension = "1.25"
        speed-planing                = "15"
        spring-factor-not-planing    = "0.7">
  </gear>

  <!-- Flotteur droit 7 -->
  <gear x="0.195" y="-3.790" z="-1.664"
        compression                  = "0.1"
        spring                       = "2"
        damp                         = "10"
        on-water                     = "1"
        on-solid                     = "0"
        ignored-by-solver            = "1"
        reduce-friction-by-extension = "1.25"
        speed-planing                = "15"
        spring-factor-not-planing    = "0.7">
  </gear>

  <tank x="1.03" y=" 2.5" z="1.4" capacity="1472"/>
  <tank x="1.03" y="-2.5" z="1.4" capacity="1472"/>

  <!-- CG placement -->
  <ballast x="2" y="0" z="-2" mass="1000"/>

</airplane>
