<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- Aeroprakt A22 Foxbat : Emmanuel BARANGER 12-2024

     Sources            : https://www.wikiwand.com/en/articles/Aeroprakt_A-22_Foxbat

     Wingspan           : 10.1 m   (  33 ft  2 in )
     Length             :  6.3 m   (  20 ft  8 in )
     Height             :  2.4 m   (   7 ft 10 in )
     Empty weight       :  260 kg  ( 573 lb       )
     Max takeoff weight :  450 kg  ( 992 lb       )
     Powerplant         : 1 Rotax 912ULS 4-cylinder air-cooled horizontally-opposed piston engine ( 98.6 hp )
     Stall speed        :  55 km/h (  30 kn       )
     Cruise speed       : 160 km/h (  86 kn       )
     Maximum speed      : 170 km/h (  92 kn       )
     Fuel               : 2 x 45 l (  2 x 11.9 US gal  - 2 x 73.2 lbs )
-->
<airplane mass="573" version="YASIM_VERSION_CURRENT" mtow-kg="992">

  <!-- Approach configuration -->
  <approach speed="30" aoa="2" fuel="0.2">
    <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/flight/flaps"               value="0.5"/>
  </approach>

  <!-- Cruise configuration -->
  <cruise speed="86" alt="6000" fuel="0.8">
    <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/flight/flaps"               value="0"/>
  </cruise>

  <cockpit x="1.119" y="0.326" z="0.110"/>

  <!-- Casserole -->
  <fuselage ax=" 3.148" ay=" 0.000" az="-0.098" bx=" 3.105" by=" 0.000" bz="-0.098" width="0.077" taper="0.00" midpoint="1"/>
  <fuselage ax=" 3.105" ay=" 0.000" az="-0.098" bx=" 3.011" by=" 0.000" bz="-0.098" width="0.183" taper="0.42" midpoint="1"/>
  <fuselage ax=" 3.011" ay=" 0.000" az="-0.098" bx=" 2.927" by=" 0.000" bz="-0.098" width="0.230" taper="0.80" midpoint="1"/>

  <!-- Fuselage -->
  <fuselage ax=" 2.927" ay=" 0.200" az="-0.136" bx=" 2.883" by=" 0.200" bz="-0.136" width="0.320" taper="0.72" midpoint="1"/>
  <fuselage ax=" 2.481" ay=" 0.200" az="-0.136" bx=" 2.373" by=" 0.200" bz="-0.136" width="0.463" taper="0.70" midpoint="1"/>
  <fuselage ax=" 2.883" ay=" 0.200" az="-0.136" bx=" 2.418" by=" 0.406" bz="-0.176" width="0.463" taper="0.70" midpoint="1"/>

  <fuselage ax=" 2.927" ay=" 0.000" az="-0.098" bx=" 2.373" by=" 0.000" bz="-0.098" width="0.320" taper="0.72" midpoint="1"/>
  <fuselage ax=" 2.883" ay=" 0.000" az="-0.368" bx=" 2.373" by=" 0.000" bz="-0.368" width="0.385" taper="0.84" midpoint="1"/>

  <fuselage ax=" 2.927" ay="-0.200" az="-0.136" bx=" 2.883" by="-0.200" bz="-0.136" width="0.320" taper="0.72" midpoint="1"/>
  <fuselage ax=" 2.481" ay="-0.200" az="-0.136" bx=" 2.373" by="-0.200" bz="-0.136" width="0.463" taper="0.70" midpoint="1"/>
  <fuselage ax=" 2.883" ay="-0.200" az="-0.136" bx=" 2.418" by="-0.406" bz="-0.176" width="0.463" taper="0.70" midpoint="1"/>

  <fuselage ax=" 2.883" ay=" 0.200" az="-0.296" bx=" 2.373" by=" 0.200" bz="-0.336" width="0.463" taper="0.70" midpoint="1"/>
  <fuselage ax=" 2.883" ay=" 0.000" az="-0.368" bx=" 2.373" by=" 0.000" bz="-0.368" width="0.385" taper="0.84" midpoint="1"/>
  <fuselage ax=" 2.883" ay="-0.200" az="-0.296" bx=" 2.373" by="-0.200" bz="-0.336" width="0.463" taper="0.70" midpoint="1"/>

  <fuselage ax=" 2.373" ay=" 0.295" az="-0.233" bx=" 0.827" by=" 0.295" bz="-0.233" width="0.655" taper="1.00" midpoint="1"/>
  <fuselage ax=" 0.827" ay=" 0.295" az="-0.233" bx="-2.237" by=" 0.000" bz="-0.084" width="0.655" taper="0.20" midpoint="0"/>
  <fuselage ax=" 2.364" ay=" 0.295" az="-0.018" bx=" 1.628" by=" 0.295" bz=" 0.196" width="0.655" taper="0.30" midpoint="1"/>
  <fuselage ax=" 1.718" ay=" 0.295" az=" 0.196" bx=" 0.827" by=" 0.295" bz=" 0.196" width="0.655" taper="1.00" midpoint="0"/>
  <fuselage ax=" 0.827" ay=" 0.295" az=" 0.196" bx="-2.237" by=" 0.000" bz="-0.084" width="0.655" taper="0.20" midpoint="0"/>

  <fuselage ax=" 2.364" ay=" 0.000" az="-0.018" bx=" 1.628" by=" 0.000" bz=" 0.196" width="0.655" taper="0.30" midpoint="1"/>

  <fuselage ax=" 2.373" ay="-0.295" az="-0.233" bx=" 0.827" by="-0.295" bz="-0.233" width="0.655" taper="1.00" midpoint="1"/>
  <fuselage ax=" 0.827" ay="-0.295" az="-0.233" bx="-2.237" by=" 0.000" bz="-0.084" width="0.655" taper="0.20" midpoint="0"/>
  <fuselage ax=" 2.364" ay="-0.295" az="-0.018" bx=" 1.628" by="-0.295" bz=" 0.196" width="0.655" taper="0.30" midpoint="1"/>
  <fuselage ax=" 1.718" ay="-0.295" az=" 0.196" bx=" 0.827" by="-0.295" bz=" 0.196" width="0.655" taper="1.00" midpoint="0"/>
  <fuselage ax=" 0.827" ay="-0.295" az=" 0.196" bx="-2.237" by=" 0.000" bz="-0.084" width="0.655" taper="0.20" midpoint="0"/>

  <wing x="0.884" y="0" z="0.397"
        chord="1.418"
        length="5.039"
        taper="1"
        sweep="-1.5"
        camber="0.005">
        <stall   aoa="12" width="1" peak="1.5"/>
        <flap0 start="0.13" end="1" lift="9.4" drag="5.5"/>
        <flap1 start="0.13" end="1" lift="1.2" drag="1.2"/>

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

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

        <control-speed  control="FLAP0" transition-time="5"/>
  </wing>

  <hstab x="-2.663" y="0" z="-0.109"
         chord="0.829"
         length="1.269"
         taper="1">
         <stall   aoa="18" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.2" drag="1.2"/>

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

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

  <vstab x="-2.108" y="0" z="-0.109"
         chord="1.170"
         length="1.420"
         taper="0.51"
         sweep="25">
         <stall   aoa="16" width="1" peak="1.5"/>
         <flap0 start="0"    end="1" lift="1.6" drag="1.2"/>

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

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

  <vstab x="-1.870" y="0" z="-0.109"
         chord="1.644"
         length="0.650"
         taper="0.18"
         sweep="68"
         dihedral="-90">
         <stall   aoa="16" width="1" peak="1.5"/>
  </vstab>

  <!-- Engines   source            : https://www.wikiwand.com/en/articles/Rotax_912ULS
                                     http://www.piecesrotax.com/moteurs_rotax/rotax_912.htm

                 name              : ROTAX 912 ULS
                 type              : four-cylinder, four-stroke liquid / air-cooled engine with opposed cylinders
                 power cruise      : 98.6 hp at 5800 rpm
                 weight            :   60 kg    ( 132.30 lb    )
                 displacement      : 1211.2 cc  (  73.91 cu in )
                 compression       : 9:1

                 propeller         : 3 bladed Aeroprakt ground-adjustable propeller, 1.68 m ( 5 ft 6 in ) diameter
  -->
  <propeller x="2.669" y="0" z="-0.209"
             mass="132.3"
             moment="4.40"
             radius="0.85"
             cruise-speed="86"
             cruise-rpm="5400"
             cruise-alt="6000"
             cruise-power="90"
             takeoff-power="98.6"
             takeoff-rpm="5800"
             gear-ratio="0.950">
             <actionpt x="2.935" y="0.000" z="-0.102"/>
             <piston-engine eng-power="98.6"
                            eng-rpm="5800"
                            displacement="73.91"
                            compression="9">
                            <control-input control="THROTTLE" axis="/controls/engines/engine[0]/throttle"/>
                            <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"/>
             </piston-engine>
  </propeller>

  <!-- Nose wheel 0 -->
  <gear x="2.348" y=" 0.000" z="-1.183"
        compression="0.15"
        spring="4"
        stiction="1">
        <control-input control="STEER" axis="/controls/flight/rudder" src0="-0.5" src1="0.5" dst0="-0.25" dst1="0.25"/>
  </gear>

  <!-- Left wheel 1 -->
  <gear x="1.110" y=" 0.900" z="-1.180"
        compression="0.1"
        spring="4"
        stiction="1">
        <control-input control="BRAKE" axis="/controls/gear/brake-left"    split="true"/>
        <control-input control="BRAKE" axis="/controls/gear/brake-parking" split="true"/>
  </gear>

  <!-- Right wheel 2 -->
  <gear x="1.110" y="-0.900" z="-1.180"
        compression="0.1"
        spring="4"
        stiction="1">
        <control-input control="BRAKE" axis="/controls/gear/brake-right"   split="true"/>
        <control-input control="BRAKE" axis="/controls/gear/brake-parking" split="true"/>
  </gear>

  <!-- Tail wheel 3 -->
  <gear x="-2.457" y=" 0.000" z="-0.416"
        compression="0.1"
        spring="4"
        stiction="1">
  </gear>

  <!-- 2 x 73.2 lbs - 2 x 11.9 GAL us - 2 x 45 L -->
  <tank x="1.024" y=" 1.357" z=" 0.388" capacity="73.2"/>
  <tank x="1.024" y="-1.357" z=" 0.388" capacity="73.2"/>

  <!-- Pilot -->
  <weight x="1.305" y="0.2" z="-0.2"  mass-prop="/sim/weight[0]/weight-lb"/>

  <!-- Passenger -->
  <weight x="1.305" y="-0.2" z="-0.2" mass-prop="/sim/weight[1]/weight-lb"/>

  <!-- Baggage -->
  <weight x="-0.095" y="0"    z="0"   mass-prop="/sim/weight[2]/weight-lb"/>

  <!-- Mass distribution
       Dilbert : The cg should be about 1/6 chord ahead of the chord center.
                 1.418 / 6     = 0.236
                 0.884 + 0.236 = 1.120 - 1.528 by test
  -->
  <ballast x="2.600" y="0.000" z="-0.371" mass="150"/>

</airplane>
