<!--
<?xml version="1.0"?>
-->
<!--  Kawasaki T-4 -->

<!-- references
http://www.militaryaviation.eu/trainer/Dornier/Alpha_Jet.htm
http://www.globalaircraft.org/planes/alpha_jet.pl
http://www.aviationnow.com/media/pdf/spec_04_gas_turbines.pdf
-->
<airplane mass="8536">

  <!-- Approach configuration -->
  <approach speed="110" aoa="7" fuel="0.2">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.2"/>
    <control-setting axis="/controls/engines/engine[1]/throttle" value="0.2"/>
    <control-setting axis="/controls/flight/flaps" value="1.0"/>
    <control-setting axis="/controls/flight/spoilers" value="1.0"/>
    <control-setting axis="/controls/flight/speed-brake" value="1.0"/>
    <control-setting axis="/controls/gear/gear-down" value="1"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="560" alt="49212" fuel="0.3">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="1.0"/>
    <control-setting axis="/controls/engines/engine[1]/throttle" value="1.0"/>
    <control-setting axis="/controls/flight/flaps" value="0.0"/>
    <control-setting axis="/controls/flight/spoilers" value="0.0"/>
    <control-setting axis="/controls/flight/speed-brake" value="0.0"/>
    <control-setting axis="/controls/gear/gear-down" value="0"/>
  </cruise>

  <cockpit x="2.80" y="0.0" z="0.66"/>

  <fuselage ax="5.91" ay="0" az="-0.08" bx="-6.11" by="0" bz="0.27" width="1.97" taper="0.2" midpoint="0.13" idrag="1.0"/>

<!--
   properties in wing tag
   length: length from the mid-chord point of base (not root, I guess) to mid-chord point of tip
   chord: isn't this a root chord?; I doubt the README.yasim is accurate on this...
   sweep: sweep angle of the mid-chord line. I measured using your 3D model
   taper: tip chord / root chord
   camber: lift at zero aoa / maximum lift at stall aoa;
           0.02 means the wing generates 50 times grater lift compared to the lift at zero angle
-->
  <wing x="-0.22" y="0" z="0.75"
        length="4.99"
        taper="0.347"
        incidence="2.0"
        chord="3.17"
        sweep="33"
        dihedral="-7.0"
        camber="0.05"
        idrag="1.0">
    <stall aoa="20" width="4" peak="1.2"/>
    <flap0 start="0" end="0.8" lift="1.5" drag="1.3"/>
    <flap1 start="0.54" end="0.86" lift="1.3" drag="1.2"/>

    <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" side="left" prop="/surface-positions/left-flap-pos-norm"/>
    <control-output control="FLAP0" side="right" prop="/surface-positions/right-flap-pos-norm"/>
    <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="FLAP1" prop="/surface-positions/aileron-pos-norm"/>

    <control-speed control="FLAP0" transition-time="10"/>
    <control-speed control="FLAP1" transition-time="0.2"/>
  </wing>

  <hstab x="-5.10" y="0" z="0.32"
        length="2.44"
        taper="0.494" 
        incidence="0.0"
        chord="1.59"
        sweep="25.0"
        dihedral="-7.0"
        effectiveness="2.5">
    <stall aoa="25" width="3" peak="1.2"/>
    <flap0 start="0" end="1" lift="1.5" drag="1.7"/>
    
    <control-input axis="/controls/flight/elevator" control="FLAP0" square="false" src0="-0.5" src1="0.5" dst0="-1.0" dst1="1.0"/>
    <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"/>

    <control-speed control="FLAP0" transition-time="2"/>
  </hstab>

  <vstab x="-4.10" y="0" z="0.28"
         taper="0.30"
         length="2.95"
         chord="2.33"
         sweep="22">
    <stall aoa="16" width="5" peak="1.5"/>
    <flap0 start="0.3" end="0.64" lift="1.25" drag="1.2"/>

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

    <control-speed control="FLAP0" transition-time="1"/>
  </vstab>
 
  <!-- 2 x J52 P8-A/B -->
  <!-- actual CG of engine should be -2.19, but adjusted to get acceptable CG of entire aircraft -->
  <jet x="-2.19" y="-0.69" z="-0.23"
       mass="740"
       thrust="3682"
       tsfc="0.7"
       egt="950">
       <actionpt x="-3.89" y="-0.46" z="-0.25"/>
       <control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
  </jet>

  <jet x="-2.19" y="0.69" z="-0.23"
       mass="740"
       thrust="3682"
       tsfc="0.7"
       egt="950">
       <actionpt x="-3.89" y="0.46" z="-0.25"/>
       <control-input axis="/controls/engines/engine[1]/throttle" control="THROTTLE"/>
  </jet>

  <!-- nose -->
  <gear x="4.318" y="0.0" z="-1.579" 
        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.85" y="-1.59" z="-1.68"
        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.85" y="1.59" z="-1.68"  
        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>

  <hook x="-4.00" y="0.0" z="-0.400" length="1.5" down-angle="70" up-angle="-5">
    <control-input axis="/controls/gear/tailhook" control="HEXTEND"/>
    <control-speed control="HEXTEND" transition-time="3"/>
  </hook>

  <!-- Fuselage -->
  <!-- fuel capacity in pounds; 1520kg=3351lb -->
  <tank x="2.2" y="0.0" z="-0.63" jet="true" capacity="1820"/>

  <!-- Wing -->
  <tank x="1.46" y= "0.27" z="-0.3" jet="true" capacity="910"/>
  <tank x="1.46" y="-0.27" z="-0.3" jet="true" capacity="910"/>

  <!-- pilots -->
  <ballast x="3.05" y="0" z="0.50" mass="180"/>
  <ballast x="1.57" y="0" z="0.64" mass="180"/>

<!-- armament -->
  <ballast x="2.33" y="0" z="-1.03" mass="490"/>
</airplane>
