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

<!--  Fouga Magister Potez CM170 yasim config. 2009 BARANGER Emmanuel

      sources      : http://www.aviation-fr.info/guide/fouga.php
                     http://en.wikipedia.org/wiki/Fouga_Magister

      Wingspan     : 12.15 m (39 ft 10 in)
      Lenght       : 10.06 m (33 ft  0 in)
      Height       :  2.80 m ( 2 ft  2 in)
      Empty weight : 2150 kg (4740 lb)
      Engines      : 2 x TurboMeca Marbore IIA turbojets 880 lbf each

-->

<airplane mass="4740">

  <!-- Approach configuration -->
  <approach speed="94" aoa="4" fuel="0.3">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.4"/>
    <control-setting axis="/controls/engines/engine[1]/throttle" value="0.4"/>
    <control-setting axis="/controls/flight/flaps" value="1.0"/>
    <control-setting axis="/controls/flight/spoilers" value="0.5"/>
    <control-setting axis="/controls/gear/gear-down" value="1"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="370" alt="30000" fuel="0.8">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.7"/>
    <control-setting axis="/controls/engines/engine[1]/throttle" value="0.7"/>
    <control-setting axis="/controls/flight/flaps" value="0.0"/>
    <control-setting axis="/controls/gear/gear-down" value="0"/>
  </cruise>

  <cockpit x="2.734" y="0.0" z="0.482"/>

  <fuselage ax="5.011" ay="0" az="-0.249" bx="-4.970" by="0" bz="-0.309" width="0.9" taper="0.2" midpoint="0.3"/>

  <!-- Left engine -->
  <fuselage ax="1.194" ay="0.628" az="-0.342" bx="-2.735" by="0.483" bz="-0.455" width="0.5" taper="0.5" midpoint="0.05"/>

  <!-- Right engine -->
  <fuselage ax="1.194" ay="-0.628" az="-0.342" bx="-2.735" by="-0.483" bz="-0.455" width="0.5" taper="0.5" midpoint="0.05"/>

  <!-- Left tank -->
  <fuselage ax="0.614" ay="5.884" az="-0.396" bx="-1.435" by="5.884" bz="-0.396" width="0.3" taper="0.5" midpoint="0.3"/>

  <!-- Right tank -->
  <fuselage ax="0.614" ay="-5.884" az="-0.396" bx="-1.435" by="-5.884" bz="-0.396" width="0.3" taper="0.5" midpoint="0.3"/>

  <wing x="-0.066" y="0.824" z="-0.352"
        chord="1.897"
        length="5"
        taper="0.42"
        sweep="6"
        dihedral="-1"
        camber="0.09">
        <stall aoa="16" width="3" peak="1.3"/>
        <flap0 start="0.02" end="0.52" lift="1.5" drag="1.3"/>
        <flap1 start="0.54" end="0.96" lift="1.3" drag="1.2"/>
        <spoiler start="0.2" end="0.8"  lift="6" drag="4"/>

        <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-input axis="/controls/flight/spoilers" control="SPOILER"/>

        <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-output control="SPOILER" prop="/surface-positions/spoiler-pos-norm" invert="true" />

        <control-speed control="FLAP0" transition-time="1"/>
        <control-speed control="SPOILER" transition-time="0.5"/>
  </wing>

  <hstab x="-3.907" y="0" z="-0.142"
         chord="1.344"
         length="2.63"
         taper="0.33"
         sweep="9"
         dihedral="34">
         <stall aoa="16" width="6" peak="1.4"/>
         <flap0 start="0" end="1" lift="1.5" drag="1.7"/>

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

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

  <vstab x="-3.907" y="0" z="-0.142"
         chord="1.344"
         length="2.63"
         taper="0.33"
         sweep="9"
         dihedral="34">
         <stall aoa="16" width="6" peak="1.4"/>
         <flap0 start="0" end="1" lift="1.5" drag="1.7"/>

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

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

  <vstab x="-3.907" y="0" z="-0.142"
         chord="1.344"
         length="2.63"
         taper="0.33"
         sweep="9"
         dihedral="146">
         <stall aoa="16" width="6" peak="1.4"/>
         <flap0 start="0" end="1" lift="1.5" drag="1.7"/>

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

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

         <control-speed control="FLAP0" transition-time="1"/>
  </vstab>

  <!-- Engines   source            : http://celag.free.fr/museum/moteur/marbo.htm#Historique
                                     https://www.amazines.com/Turbomeca_Marbor%C3%A9_related.html
                                     http://en.wikipedia.org/wiki/Turbomeca_Marbor%C3%A9

                 name              : TurboMeca Marbore IIA turbojets 8755 lbf
                 type              : Turbojet
                 Maximum thrust    :  880 lbf at 22600 rpm
                 weight            :  358 lb   ( 162.4 kg)
  -->
  <!-- thrust="880" -->
  <jet x="-0.764" y="0.576" z="-0.382"
       mass="308"
       thrust="3000"
       tsfc="0.8"
       egt="650">
       <actionpt x="-2.718" y="0.483" z="-0.382"/>
       <control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
  </jet>

  <jet x="-0.764" y="-0.576" z="-0.382"
       mass="308"
       thrust="3000"
       tsfc="0.8"
       egt="650">
       <actionpt x="-2.718" y="-0.483" z="-0.382"/>
       <control-input axis="/controls/engines/engine[1]/throttle" control="THROTTLE"/>
  </jet>

  <!-- nose -->
  <gear x="4.584" y="0.0" z="-1.218"
        retract-time="7"
        compression="0.2"
        spring="1.1"
        damp="1.4">
        <control-input axis="/controls/flight/rudder" control="STEER" square="false"/>
        <control-input axis="/controls/gear/gear-down" control="EXTEND"/>

        <control-output control="EXTEND" prop="/gear/gear[0]/position-norm"/>

        <control-speed control="EXTEND" transition-time="7"/>
  </gear>

    <!-- left main -->
  <gear x="-0.181" y="1.955" z="-1.396"
        retract-time="7"
        compression="0.2"
        spring="0.85"
        damp="2">
        <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-output control="EXTEND" prop="gear/gear[1]/position-norm"/>

        <control-speed control="EXTEND" transition-time="7"/>
  </gear>

  <!-- right main -->
  <gear x="-0.181" y="-1.955" z="-1.396"
        retract-time="7"
        compression="0.2"
        spring="0.85"
        damp="2">
        <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-output control="EXTEND" prop="gear/gear[2]/position-norm"/>

        <control-speed control="EXTEND" transition-time="7"/>
  </gear>

  <!-- tail -->
  <gear x="-4.091" y="0.0" z="-0.835"
        compression="0.2">
  </gear>

  <!-- Fuselage -->
  <tank x="2.2" y="0.0" z="-0.3" jet="true" capacity="1000"/>
  <!-- fuel capacity in pounds; 1520 kg=3351 lb -->
  <!-- Left -->
  <tank x="-0.100" y="5.884" z="-0.396" jet="true" capacity="2351"/>
  <!-- Right -->
  <tank x="-0.100" y="-5.884" z="-0.396" jet="true" capacity="2351"/>

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

</airplane>
