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

<!--
  DHC1 - 2009 - Emmanuel BARANGER
  updated 2010  Emmanuel BARANGER with Melchior's script

  sources       : http://en.wikipedia.org/wiki/De_Havilland_Canada_DHC-1_Chipmunk

  Wingspan      :   34 ft 4 in ( 10.47 m  )
  lenght        :   25 ft 5 in (  7.75 m  )
  height        :    7 ft 0 in (  2.10 m  )
  Empty mass    : 1517 lb      (   646 kg )
  Engine        : 1 de Havilland Gipsy Major 1C, 145 hp
  Cruise speed  :   90 kt
  Maximum speed :  120 kt at sea level ( 222 km/h )
-->

<airplane mass="1517">

  <!-- Approach configuration -->
  <approach speed="41" aoa="6" fuel="0.3">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.2"/>
    <control-setting axis="/controls/engines/engine[0]/mixture" value="1"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="0.5"/>
    <control-setting axis="/controls/flight/flaps" value="1"/>
    <control-setting axis="/controls/gear/gear-down" value="1"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="90" alt="5000" fuel="1.0">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.75"/>
    <control-setting axis="/controls/engines/engine[0]/mixture" value="1"/>
    <control-setting axis="/controls/engines/engine[0]/propeller-pitch" value="1"/>
    <control-setting axis="/controls/flight/flaps" value="0"/>
    <control-setting axis="/controls/gear/gear-down" value="0"/>
  </cruise>

  <cockpit x="1.345" y="0" z="0.710"/>

  <fuselage ax="3.572" ay="0" az="0.252" bx="-3.833" by="0" bz="-0.027" width="0.818" taper="0.4" midpoint="0.3"/>

  <wing x="1.073" y="0.200" z="-0.301"
        chord="2.000"
        length="5.012"
        taper="0.55"
        dihedral="4"
        sweep="-2"
        camber="0.09">
        <stall aoa="18" width="1.0" peak="1.5"/>
        <flap0 start="0.058" end="0.535" lift="1.4" drag="1.5"/>
        <flap1 start="0.535" end="0.946" 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="FLAP1" transition-time="0.01"/>
        <control-speed control="FLAP0" transition-time="5"/>
  </wing>

  <hstab x="-3.183" y="0" z="0.077"
         chord="1.185"
         length="1.802"
         taper="0.39"
         sweep="6">
         <stall aoa="20" width="4" peak="1.5"/>
         <flap0 start="0.085" end="0.91" lift="2.0" 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="-2.758" y="0" z="0.100"
       chord="1.350"
       length="1.306"
       taper="0.34"
       sweep="10">
       <stall aoa="18" width="3" peak="1.5"/>
       <flap0 start="0" end="0.935" lift="1.6" drag="1.3"/>

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

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

  <!-- de Havilland Gipsy Major

                 sources      : http://en.wikipedia.org/wiki/De_Havilland_Gipsy_Major

                 type         : 4-cylinder air-cooled inverted inline piston aircraft engine
                 power        : 122 hp at 2100 rpm, 145 hp at 2550 rpm
                 weight       : 300 lb (136 kg)
                 Displacement : 373.7 in3 (6.124 L)
                 Compression  : 5.25:1
  -->
  <propeller x="2.935" y="0" z="0.254"
             mass="300"
             radius="1"
             moment="2.5"
             cruise-speed="90"
             cruise-rpm="2600"
             cruise-alt="5000"
             cruise-power="150"
             takeoff-power="112"
             takeoff-rpm="2575" >
             <piston-engine eng-rpm="2700"
                            alt="5000"
                            eng-power="145"
                            displacement="373.7"
                            compression="5.25"/>
             <actionpt x="3.690" y="0" z="0.254" />
             <control-input axis="/controls/engines/engine[0]/propeller-pitch" control="ADVANCE"/>
             <control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
             <control-input axis="/controls/engines/engine[0]/starter" control="STARTER"/>
             <control-input axis="/controls/engines/engine[0]/magnetos" control="MAGNETOS"/>
             <control-input axis="/controls/engines/engine[0]/mixture" control="MIXTURE"/>
  </propeller>

  <gear x="2.057" y="1.331" z="-1.413"
        compression="0.20"
        spring="0.6">
        <control-input axis="/controls/gear/brake-left" control="BRAKE" split="true"/>
        <control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
        <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>

  <gear x="2.057" y="-1.331" z="-1.413"
        compression="0.20"
        spring="0.6">
        <control-input axis="/controls/gear/brake-right" control="BRAKE" split="true"/>
        <control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
        <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>

  <gear x="-3.266" y="0" z="-0.617"
        compression="0.15"
        spring="0.6">
        <control-input axis="/controls/flight/rudder" control="STEER" square="true" src0="-1.0" src1="1.0" dst0="0.8" dst1="-0.8"/>
        <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>

  <!-- Fuel  -->
  <tank x="0.72" y="0" z="-0.272" capacity="169" />

  <!-- Mass displacment -->
  <ballast x="3" y="0" z="-0.8" mass="250"/>

</airplane>
