<?xml version="1.0" encoding="UTF-8"?>

<!-- Piper PA 32 - 2010 Emmanuel BARANGER
                   updated 2011

     sources          : http://en.wikipedia.org/wiki/Piper_PA-32

     wingspan         :  10.0 m    ( 32.8 ft )
     length           :   8.4 m    ( 27.7 ft )
     height           :   2.4 m    (  7.9 ft )
     empty weight     :   811 kg   ( 1788 lb )
     engine           : Lycoming IO-540-K1A5 (300 hp)
     Maximum speed    :   280 km/h ( 152 kts )
     Cruise speed     :   272 km/h ( 147 kts - 75% power)
-->

<airplane mass="930">

  <!-- Approach configuration -->
  <approach speed="40" aoa="7" fuel="0.2">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.2"/>
    <control-setting axis="/controls/engines/engine[0]/mixture" value="1.0"/>
    <control-setting axis="/controls/flight/flaps" value="1.0"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="147" alt="6000" fuel="0.5">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.7"/>
    <control-setting axis="/controls/engines/engine[0]/mixture" value="0.6"/>
    <control-setting axis="/controls/flight/flaps" value="0.0"/>
  </cruise>

  <cockpit x="1.355" y="0.323" z="0.080"/>

  <fuselage ax="3.785" ay="0" az="-0.463" bx="-3.962" by="0" bz="-0.152" width="1.287" taper="0.4" midpoint="0.3"/>

  <wing x="0.870" y="0.339" z="-0.771" 
        chord="1.530" 
        length="4.649" 
        taper="0.7"
        dihedral="8"
        camber="0.01">
        <stall aoa="24" width="6.0" peak="1.5"/>
        <flap0 start="0.00" end="0.47" lift="1.2" drag="1.25"/>
        <flap1 start="0.47" end="0.86" lift="1.2" drag="1.1"/>

        <control-input axis="/controls/flight/flaps" control="FLAP0"/>
        <control-input axis="/controls/flight/aileron" control="FLAP1" split="true"/>
        <control-input axis="/controls/flight/aileron-trim" control="FLAP1" 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="2"/>
  </wing>

  <hstab x="-3.790" y="0" z="-0.035" 
         chord="0.790" 
         length="1.7" 
         taper="1">
         <stall aoa="25" width="4" peak="1.5"/>
         <flap0 start="0" end="1" lift="2" drag="1.1"/>

         <control-input axis="/controls/flight/elevator" control="FLAP0"/>
         <control-input axis="/controls/flight/elevator-trim" control="FLAP0"/>

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

  <vstab x="-3.26" y="0" z="0.106" 
         chord="1.4"
         length="1.5"
         taper="0.32"
         sweep="28">
         <stall aoa="14" width="3" peak="1.5"/>
         <flap0 start="0.02" end="0.9" lift="1.75" drag="1.35"/>

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

         <control-output control="FLAP0" prop="/surface-positions/rudder-pos-norm" min="1" max="-1"/>
  </vstab>

  <!-- Engines   source            : http://en.wikipedia.org/wiki/Lycoming_IO-540

                 name              : Lycoming O-540
                 type              : Six-cylinder air-cooled horizontally opposed engine
                 power cruise      : 300 hp at 2700 rpm at sea level
                 weight            : 199 kg    ( 438 lb )
                 displacement      : 541.5 in3 ( 8.9 L  )
                 compression       : 8.7:1
  -->
  <propeller x="3.333" y="0" z="-0.427" 
             radius="1.0665"
	     mass="438" 
	     moment="6"  
	     cruise-speed="147" 
	     cruise-rpm="2500"
	     cruise-alt="6000" 
	     cruise-power="250"
	     takeoff-power="280" 
	     takeoff-rpm="2100">
             <actionpt x="3.895" y="0" z="-0.427"/>
             <piston-engine eng-rpm="2700" 
                            eng-power="300"
                            displacement="541.5" 
                            compression="8.7"/>
             <control-input control="THROTTLE" axis="/controls/engines/engine[0]/throttle" src0="0.0" src1="1.0" dst0="0.0" dst1="1.0"/>
             <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" src0="0.0" src1="1.0" dst0="0.8" dst1="0.8"/>
  </propeller>
  
  <!-- Noze wheel -->
  <gear x="3.149" y="0" z="-1.61" 
        compression="0.15" 
        spring="0.8"
        on-solid="1"
        sfric="1"
        dfric="1">
        <control-input axis="/controls/flight/rudder" control="STEER" square="false"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>
        <control-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="/gear/gear[0]/position-norm"/>
  </gear>

  <!-- Left wheel -->
  <gear x="0.765" y="-1.566" z="-1.509"
        compression="0.2" 
        spring="1.8" 
        damp="0.03" 
        on-solid="1" >
        <control-input axis="/controls/gear/brake-left" control="BRAKE"/>
        <control-input axis="/controls/gear/brake-parking" control="BRAKE"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>
        <control-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="gear/gear[1]/position-norm"/>
  </gear>

  <!-- Right wheel -->
  <gear x="0.765" y="1.566" z="-1.509"
        compression="0.2" 
        spring="1.8"
        damp="0.03" 
        on-solid="1" >
        <control-input axis="/controls/gear/brake-right" control="BRAKE"/>
        <control-input axis="/controls/gear/brake-parking" control="BRAKE"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>
        <control-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="gear/gear[2]/position-norm"/>
  </gear>

  <tank x="0.456" y="0" z="-0.310" capacity="56" />

  <!-- Mass distribution -->
  <ballast x="2" y="0" z="-2" mass="250"/>

</airplane>

