<!--  A-6E yasim config.-->


<airplane mass="22400">
<!-- Real Dry Mass: 27400 lbs.
We have also an in flight movable ballast weighting 5000 lbs, that's because
it's really hard to get a CG suitable for high AoA and speeds below 130 Kts and
having a smooth pitch above 250 Kts. So I added two "weights" at different positions
and filled by a nasal script depending of the speed of the A/C. --> 

<!-- Approach configuration -->
  <approach speed="120" aoa="8" fuel="0.2">
    <control-setting axis="/controls/engines/engine[0]/throttle" value="0.5"/>
    <control-setting axis="/controls/engines/engine[1]/throttle" value="0.5"/>
    <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"/>
    <solve-weight idx="0" weight="4000"/>
  </approach>

<!-- Cruise configuration -->
  <cruise speed="480" 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"/>
    <solve-weight idx="0" weight="4000"/>
  </cruise>

  <cockpit x="1.75" y="0.0" z="1.2"/>

  <fuselage ax="5" ay="0" az="0" bx="-11.68" by="0" bz="0"
            width="3" taper="1" midpoint="0.5"/>

  <wing x="-1.1" y="0.88" z="0.26" taper="0.75" incidence="3.3"
        length="7.62" chord="4.77" sweep="18" dihedral="-4.0"
        camber="0.0">
    <stall aoa="20" width="3" peak="1.3"/>
    <flap0 start="0" end="0.8" lift="1.5" drag="1.3"/>
    <slat start="0" end="0.8" aoa="30" drag="1.2"/>
    <flap1 start="0.54" end="0.86" lift="1.3" drag="1.3"/>
    <spoiler start="0.54" end="0.86" lift="0.0" drag="10.0"/>

    <control-input axis="/controls/flight/flaps" control="FLAP0"/>
    <control-input axis="/controls/flight/flaps" control="SLAT"/>
    <control-input axis="/controls/flight/aileron" control="FLAP1" split="true" square="true"/>
    <control-input axis="/controls/flight/aileron-trim" control="FLAP1" split="true"/>
    <control-input axis="/controls/flight/speedbrake" control="SPOILER"/>

    <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-output control="SPOILER" side="left" prop="/surface-positions/speedbrake-pos-norm"/>
    <control-output control="SPOILER" side="right" prop="/surface-positions/speedbrake-pos-norm"/>
    <control-output control="SPOILER" prop="/surface-positions/speedbrake-pos-norm"/>

    <control-speed control="FLAP0" transition-time="10"/>
    <control-speed control="SLAT" transition-time="10"/>
    <control-speed control="FLAP1" transition-time="0.5"/>
    <control-speed control="SPOILER" transition-time="0.5"/>

  </wing>

  <hstab x="-9.10" y="0.32" z="0.14" taper="0.5" effectiveness="3"
         length="3.17" chord="2.15" sweep="24" dihedral="0.0"
         camber="0">
    <stall aoa="25" width="5" peak="1.3"/>
    <flap0 start="0" end="1" lift="1.25" drag="1.3"/>
    <control-input axis="/controls/flight/elevator" control="FLAP0"
                   square="true"/>
    <control-input axis="/controls/flight/elevator-trim" control="FLAP0"/>

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

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

  <vstab x="-9.88" y="0" z="-0.2" taper="0.5" effectiveness="2"
         length="2.77" chord="3.59" sweep="16">
    <stall aoa="16" width="5" peak="1.5"/>
    <flap0 start="0" end="0.64" lift="1.25" drag="1.2"/>
    <control-input axis="/controls/flight/rudder" control="FLAP0" invert="false"/>
    <control-input axis="/controls/flight/rudder-trim" control="FLAP0" invert="false"/>
    <control-output control="FLAP0" prop="/surface-positions/rudder-pos-norm"/>
    <control-speed control="FLAP0" transition-time="1"/>
  </vstab>

  

<!-- 2 x J52 P8-A/B -->
  <jet x="-0.20" y="-0.70" z="-0.33" mass="2118" thrust="8660" tsfc="0.371" egt="950">
    <actionpt x="-9.3" y="-1.03" z="-0.37"/>
    <control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
  </jet>

  <jet x="-0.20" y="0.70" z="-0.33" mass="2118" thrust="8660" tsfc="0.371" egt="950">
    <actionpt x="-9.3" y="1.03" z="-0.37"/>
    <control-input axis="/controls/engines/engine[1]/throttle" control="THROTTLE"/>
  </jet>

<!-- Internal tanks -->
    <tank x="-1.2" y="0.0" z="0.63" jet="true" capacity="9016"/>	<!-- #0 - Fuselage -->
    <tank x="-1.2" y="0.0" z="0.0" jet="true" capacity="6922"/>		<!-- #1 - Wing -->

<!-- Ferry Tanks -->
    <tank x="-1.2" y="3.64" z="-0.48" jet="true" capacity="2040"/>	<!-- #2 - S1 -->
    <tank x="-1.2" y="2.40" z="-0.48" jet="true" capacity="2040"/>	<!-- #3 - S2 -->
    <tank x="-1.2" y="0" z="-1.26" jet="true" capacity="2040"/>		<!-- #4 - S3 center -->
    <tank x="-1.2" y="-2.40" z="-0.48" jet="true" capacity="2040"/>	<!-- #5 - S4 -->
    <tank x="-1.2" y="-3.64" z="-0.48" jet="true" capacity="2040"/>	<!-- #6 - S5 -->




<!-- Undercarriage -->
    <!-- nose -->
    <gear x="2.83" y="0" z="-2.40" retract-time="7" compression="0.44" 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-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="/gear/gear[0]/position-norm"/>
    </gear>
    <!-- left main -->
    <gear x="-2.69" y="2.5" z="-2.55" retract-time="7" compression="0.72" 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-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="gear/gear[1]/position-norm"/>
    </gear>
    <!-- right main -->
    <gear x="-2.69" y="-2.5" z="-2.55" retract-time="7" compression="0.72" 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-speed control="EXTEND" transition-time="7"/>
        <control-output control="EXTEND" prop="gear/gear[2]/position-norm"/>
    </gear>

    <ballast x="-0.6" y="0" z="0" mass="5000"/> <!-- fixed trim -->
    <weight x="0" y="0" z="0" size="0.9" mass-prop="sim/model/A-6E/controls/flight/CG-trim-fwd"/> <!-- speed based moving trim -->
    <weight x="-0.5" y="0" z="0" size="0.9" mass-prop="sim/model/A-6E/controls/flight/CG-trim-aft"/> <!-- speed based moving trim -->
    <weight x="-1.2" y="3.64" z="-0.48" size="0.18" mass-prop="sim/weight[0]/weight-lb"/>
    <weight x="-1.2" y="2.40" z="-0.48" size="0.18" mass-prop="sim/weight[1]/weight-lb"/>
    <weight x="-1.2" y="0" z="-1.26" size="0.18" mass-prop="sim/weight[2]/weight-lb"/>
    <weight x="-1.2" y="-2.40" z="-0.48" size="0.18" mass-prop="sim/weight[3]/weight-lb"/>
    <weight x="-1.2" y="-3.64" z="-0.48" size="0.18" mass-prop="sim/weight[4]/weight-lb"/>

    <!-- Hook -->
    <hook x="-6.59" y="0.0" z="-0.41" length="2.28" down-angle="70" up-angle="-3">
        <control-input axis="/controls/gear/tailhook" control="HEXTEND"/>
        <control-speed control="HEXTEND" transition-time="4"/>
    </hook>
    
    <!-- Launch-bar --> 
    <launchbar x="3.0673" y="0.0" z="-2.1168" length="0.6">
        <control-input axis="/controls/gear/launchbar" control="LEXTEND"/>
        <control-speed control="LEXTEND" transition-time="1"/>
    </launchbar>
    
</airplane>
