<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.jsbsim.org/JSBSimScript.xsl"?>
<runscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="http://jsbsim.sf.net/JSBSimScript.xsd"
           name="Short S.23 take-off test">
 <description>This is a take off run for the Short S.23.</description>

 <use aircraft="Short_S23" initialize="reset00"/>
 <run start="0.0" end="200" dt="0.00833333">

  <!--
      Take-off data from [Cassidy:2004:FE], page 156/149:

      "Take off runs and times aircraft with Pegasus XC engines at sea
      level in temperate climatic conditions were quoted as follows:"

      Weight in lb.  Take off           Take off
                     in still air       into 9 knot wind
                     yards  seconds     yards  seconds
        40 500       520    25          400    22
        41 500       555    27.5        485    24
        42 500       625    29          520    26
        43 500       690    31.5        550    28

      "Lake Victoria was the highest port on the South African route
      at an altitude of 3 720 ft. Take-off times at this height could
      be as much as 100% longer than the standard sea level
      condition. At sea level in tropical conditions, the take-off
      runs were often extended by between 50% to 100% and the take-off
      times by 50% or more. Typical times at Bathurst, for example,
      were 92 and 107 seconds." ([Cassidy:2004:FE], page 156/149)

      "The normal trim angle for a standard displacement Empire 'boat
      hull at rest in the water, was 4 deg. 15min.- nose-up. Flying-boat
      hulls change their attitude as speed builds up during take-off.
      The tank tests at Rochester showed that as a standard displacement
      Empire 'boat began to move, the angle increased to 7 deg. at 15 knots,
      to 10 deg. at 25 knots, with a peak of 13 deg. at 30 knots, and then
      decreased to about 12 deg. until the 'boat left the water at about
      78 knots." ([Cassidy:2004:FE], page 28)

      "Arthur Gouge quoted a minimum 9 deg. positive angle from datum
      as the trim angle of an Empire 'boat as it was about to leave
      the water rather than the 12 deg. angle of the tank tests,
      putting the mainplanes at an angle of attack of 12 deg."
      ([Cassidy:2004:FE], page 29)

      "The variable pitch airscrews of the Empire 'boats - in FINE
      pitch for take-off - developed a thrust of 13 280 lb. (59 kN) at
      20 knots." ([Cassidy:2004:FE], page 28)
  -->

  <property value="0"> simulation/notify-time-trigger </property>
  <property value="1000">simulation/rpm-check-time-trigger</property>

  <event name="Initialize 1">
   <description>Configure for flight at 40500 lbs</description>
   <condition>
    simulation/sim-time-sec GE 0.0
   </condition>
   <notify>
    <property>inertia/cg-x-in</property>
    <property>inertia/weight-lbs</property>
    <property>inertia/empty-weight-lbs</property>
   </notify>
   <set name="fcs/fuel-system/mark" value="1.0"/> <!-- Mark I fuel system. -->
   <set name="inertia/pointmass-weight-lbs[5]" value="1800.0"/>
   <set name="inertia/pointmass-weight-lbs[6]" value="1945.0"/>
   <set name="inertia/pointmass-weight-lbs[7]" value="1500.0"/>
   <set name="inertia/pointmass-weight-lbs[8]" value="0.0"/>
   <set name="inertia/pointmass-weight-lbs[9]" value="1300.0"/>
   <!-- Set sea level to the terrain elevation. -->
   <set name="hydro/water-level-ft">
    <function>
     <property>ic/terrain-elevation-ft</property>
    </function>
   </set>
  </event>

  <event name="Initialize 2">
   <description>Report initial condition</description>
   <condition>
    simulation/sim-time-sec GT 1.0
   </condition>
   <notify>
    <property>inertia/cg-x-in</property>
    <property>inertia/weight-lbs</property>
    <property>inertia/empty-weight-lbs</property>
    <property>position/h-sl-ft</property>
    <property>atmosphere/density-altitude</property>
    <property>atmosphere/pressure-altitude</property>
    <property>atmosphere/T-R</property>
    <property>atmosphere/T-sl-R</property>
   </notify>
  </event>

  <event name="Initialization 3">
   <description>Set the up the electrical system</description>
   <condition>
    simulation/sim-time-sec GE 1.0
   </condition>
   <notify/>
   <set name="electrical/main-switchbox/switch-cmd-norm[0]"   value="1.0"/>
   <set name="electrical/main-switchbox/switch-cmd-norm[1]"   value="1.0"/>
   <set name="electrical/main-switchbox/switch-cmd-norm[2]"   value="1.0"/>
   <set name="electrical/main-switchbox/switch-cmd-norm[3]"   value="1.0"/>
   <set name="electrical/main-switchbox/switch-cmd-norm[4]"   value="1.0"/>
   <set name="electrical/main-switchbox/switch-cmd-norm[5]"   value="1.0"/>
  </event>

  <event name="Flaps out 1">
   <description>Start extending flaps</description>
   <condition>
    simulation/sim-time-sec GE 10.0
   </condition>
   <notify>
    <property>inertia/cg-x-in</property>
    <property>fcs/flap-pos-norm</property>
    <property>fcs/flap-pos-deg</property>
   </notify>
   <set name="fcs/flap-power-cmd-norm" value="1.0"/>
   <set name="fcs/flap-motor-cmd-norm" value="1.0"/>
  </event>

  <event name="Flaps out 2">
   <description>Stop flaps at 1/3</description>
   <condition>
    simulation/sim-time-sec GE 10.0
    fcs/flap-pos-norm GE 0.33
   </condition>
   <notify>
    <property>inertia/cg-x-in</property>
    <property>fcs/flap-pos-norm</property>
    <property>fcs/flap-pos-deg</property>
   </notify>
   <set name="fcs/flap-power-cmd-norm" value="0.0"/>
   <set name="fcs/flap-motor-cmd-norm" value="0.0"/>
  </event>

  <event name="Setup fuel supply">
   <description>Set the fuel and test cocks</description>
   <condition>
    simulation/sim-time-sec GE 10.0
   </condition>
   <notify/>
   <set name="fcs/fuel-system/left-tank-cock-cmd-norm"   value="1.0"/>
   <set name="fcs/fuel-system/right-tank-cock-cmd-norm"  value="1.0"/>
   <set name="fcs/fuel-system/balance-cock-cmd-norm"     value="1.0"/>
   <set name="fcs/fuel-system/left-test-cock-cmd-norm"   value="1.0"/>
   <set name="fcs/fuel-system/center-test-cock-cmd-norm" value="1.0"/>
   <set name="fcs/fuel-system/right-test-cock-cmd-norm"  value="1.0"/>
  </event>

  <event name="Engine start 1">
   <description>Start the engines</description>
   <condition>
    simulation/sim-time-sec GE 10.0
   </condition>
   <notify/>
   <set name="fcs/advance-cmd-norm[0]" value="0.0"/>
   <set name="fcs/advance-cmd-norm[1]" value="0.0"/>
   <set name="fcs/advance-cmd-norm[2]" value="0.0"/>
   <set name="fcs/advance-cmd-norm[3]" value="0.0"/>
   <set name="fcs/throttle-cmd-norm[0]" value="1.0"/>
   <set name="fcs/throttle-cmd-norm[1]" value="1.0"/>
   <set name="fcs/throttle-cmd-norm[2]" value="1.0"/>
   <set name="fcs/throttle-cmd-norm[3]" value="1.0"/>
   <set name="fcs/mixture-cmd-norm[0]" value="1.0"/>
   <set name="fcs/mixture-cmd-norm[1]" value="1.0"/>
   <set name="fcs/mixture-cmd-norm[2]" value="1.0"/>
   <set name="fcs/mixture-cmd-norm[3]" value="1.0"/>
   <set name="propulsion/magneto_cmd"  value="3"/>
   <set name="propulsion/starter_cmd"  value="1"/>
   <set name="fcs/starter-cmd-norm[0]" value="1"/>
   <set name="fcs/starter-cmd-norm[1]" value="1"/>
   <set name="fcs/starter-cmd-norm[2]" value="1"/>
   <set name="fcs/starter-cmd-norm[3]" value="1"/>
  </event>
  <event name="Engine start 2">
   <description>The engines have started</description>
   <!-- condition>
    simulation/sim-time-sec GE 10.017
   </condition -->
   <condition>
    propulsion/engine[0]/engine-rpm GE 370
    propulsion/engine[1]/engine-rpm GE 370
    propulsion/engine[2]/engine-rpm GE 370
    propulsion/engine[3]/engine-rpm GE 370
   </condition>
   <notify>
    <property>hydro/v-kt</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[0]/starter-norm</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[1]/starter-norm</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[2]/starter-norm</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
    <property>propulsion/engine[3]/starter-norm</property>
   </notify>
   <set name="propulsion/starter_cmd"  value="0"/>
   <set name="fcs/starter-cmd-norm[0]" value="0"/>
   <set name="fcs/starter-cmd-norm[1]" value="0"/>
   <set name="fcs/starter-cmd-norm[2]" value="0"/>
   <set name="fcs/starter-cmd-norm[3]" value="0"/>
   <set name="fcs/throttle-cmd-norm[0]" value="0.00"/>
   <set name="fcs/throttle-cmd-norm[1]" value="0.00"/>
   <set name="fcs/throttle-cmd-norm[2]" value="0.00"/>
   <set name="fcs/throttle-cmd-norm[3]" value="0.05"/>
  </event>

  <event name="Take-off AP">
   <description>Enable take-off AP</description>
   <condition>
    simulation/sim-time-sec GE 70.0
   </condition>
   <notify/>
   <set name="propulsion/starter_cmd"  value="0"/>
   <set name="fcs/starter-cmd-norm[0]" value="0"/>
   <set name="fcs/starter-cmd-norm[1]" value="0"/>
   <set name="fcs/starter-cmd-norm[2]" value="0"/>
   <set name="fcs/starter-cmd-norm[3]" value="0"/>
   <set name="take-off-ap/enabled" value="1.0"/>
  </event>

  <event name="Open throttles 1">
   <description>Open up the throttles to take-off power</description>
   <condition>
    simulation/sim-time-sec GE 100.0
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>attitude/heading-true-rad</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
   </notify>
   <set name="fcs/throttle-cmd-norm[0]"
        value="0.85" action="FG_RAMP" tc ="5.0"/>
   <set name="fcs/throttle-cmd-norm[1]"
        value="1.00" action="FG_RAMP" tc ="5.0"/>
   <set name="fcs/throttle-cmd-norm[2]"
        value="1.00" action="FG_RAMP" tc ="5.0"/>
   <set name="fcs/throttle-cmd-norm[3]"
        value="1.00" action="FG_RAMP" tc ="4.0"/>
  </event>

  <event name="Open throttles 2">
   <description>Fully open up the port outer throttle</description>
   <condition>
    simulation/sim-time-sec GE 100.0
    hydro/beta-deg GE 0.0
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>velocities/vc-kts</property>
    <property>attitude/heading-true-rad</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
   </notify>
   <set name="fcs/throttle-cmd-norm[0]"
        value="1.00" action="FG_RAMP" tc ="1.0"/>
  </event>

  <event name="Report 20kt">
   <description>Report when reaching 20kt.</description>
   <condition>
    simulation/sim-time-sec GE 100.0
    hydro/v-kt GT 20.0
   </condition>
   <notify>
    <property>velocities/vc-kts</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[0]/thrust-lbs</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[1]/thrust-lbs</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[2]/thrust-lbs</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
    <property>propulsion/engine[3]/thrust-lbs</property>
    <property>attitude/phi-rad</property>
    <property>attitude/theta-rad</property>
    <property>attitude/psi-rad</property>
    <property>hydro/height-agl-ft</property>
    <property>hydro/v-kt</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
    <property>hydro/s40-pitch-deg</property>
    <property>hydro/coefficients/C_Delta</property>
    <property>hydro/coefficients/C_V</property>
    <property>hydro/coefficients/C_M</property>
   </notify>
  </event>

  <event name="Lift-off">
   <description>Report lift-off as the hull leaves the water.</description>
   <condition>
    simulation/sim-time-sec GE 100.0
    hydro/coefficients/C_Delta EQ 0.0
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>velocities/vc-kts</property>
    <property>attitude/heading-true-rad</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
    <property>hydro/s40-pitch-deg</property>
    <property>hydro/coefficients/C_Delta</property>
    <property>hydro/coefficients/C_V</property>
    <property>hydro/coefficients/C_M</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
   </notify>
  </event>


  <event name="Climb power">
   <description>Set climb power</description>
   <condition>
    position/h-agl-ft GE 25.0
    propulsion/engine[1]/engine-rpm GT 2500
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>velocities/vc-kts</property>
    <property>attitude/heading-true-rad</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
   </notify>
   <set name="fcs/throttle-cmd-norm[0]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/throttle-cmd-norm[1]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/throttle-cmd-norm[2]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/throttle-cmd-norm[3]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="simulation/rpm-check-time-trigger" value="135"/>
  </event>

  <event name="Reduce throttle" type="FG_DELTA" persistent="true">
   <description>Check engine RPM at 1 seconds intervals</description>
   <condition>
    simulation/sim-time-sec GE simulation/rpm-check-time-trigger
    propulsion/engine[1]/engine-rpm GT 2600
   </condition>
   <notify>
    <property>fcs/throttle-cmd-norm[0]</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[3]/engine-rpm</property>
   </notify>
   <set name="fcs/throttle-cmd-norm[0]"  value="-0.01" type="FG_DELTA"/>
   <set name="fcs/throttle-cmd-norm[1]"  value="-0.01" type="FG_DELTA"/>
   <set name="fcs/throttle-cmd-norm[2]"  value="-0.01" type="FG_DELTA"/>
   <set name="fcs/throttle-cmd-norm[3]"  value="-0.01" type="FG_DELTA"/>
   <set name="simulation/rpm-check-time-trigger" value="1" type="FG_DELTA"/>
  </event>

  <event name="Coarse pitch">
   <description>Set the propellers to coarse pitch</description>
   <condition>
    position/h-agl-ft GE 400.0
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>velocities/vc-kts</property>
    <property>attitude/heading-true-rad</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
   </notify>
   <set name="fcs/advance-cmd-norm[0]" value="1.0"/>
   <set name="fcs/advance-cmd-norm[1]" value="1.0"/>
   <set name="fcs/advance-cmd-norm[2]" value="1.0"/>
   <set name="fcs/advance-cmd-norm[3]" value="1.0"/>
   <set name="fcs/throttle-cmd-norm[0]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/throttle-cmd-norm[1]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/throttle-cmd-norm[2]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/throttle-cmd-norm[3]"
        value="0.95" action="FG_RAMP" tc ="1.0"/>
   <set name="fcs/flap-cmd-norm" value="0.00"/>
  </event>

  <event name="Override out">
   <description>Disengage the boost override.</description>
   <condition>
    position/h-agl-ft GE 500.0
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>velocities/vc-kts</property>
    <property>attitude/heading-true-rad</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
   </notify>
   <set name="fcs/mixture-cmd-norm[0]" value="0.5"/>
   <set name="fcs/mixture-cmd-norm[1]" value="0.5"/>
   <set name="fcs/mixture-cmd-norm[2]" value="0.5"/>
   <set name="fcs/mixture-cmd-norm[3]" value="0.5"/>
  </event>

  <event name="Time Notify" type="FG_DELTA" persistent="true">
   <description>Output message at 5 seconds intervals</description>
   <condition>
    simulation/sim-time-sec GE simulation/notify-time-trigger
   </condition>
   <notify>
    <property>position/distance-from-start-mag-mt</property>
    <property>velocities/vc-kts</property>
    <property>position/h-agl-ft</property>
    <property>hydro/height-agl-ft</property>
    <property>hydro/v-kt</property>
    <property>hydro/pitch-deg</property>
    <property>hydro/roll-deg</property>
    <property>hydro/beta-deg</property>
    <property>hydro/s40-pitch-deg</property>
    <property>hydro/coefficients/C_Delta</property>
    <property>hydro/coefficients/C_V</property>
    <property>hydro/coefficients/C_M</property>
    <property>take-off-ap/enabled</property>
    <property>propulsion/engine[0]/engine-rpm</property>
    <property>propulsion/engine[0]/boost-psi</property>
    <property>propulsion/engine[0]/power-hp</property>
    <property>propulsion/engine[1]/engine-rpm</property>
    <property>propulsion/engine[1]/boost-psi</property>
    <property>propulsion/engine[1]/power-hp</property>
    <property>propulsion/engine[2]/engine-rpm</property>
    <property>propulsion/engine[2]/boost-psi</property>
    <property>propulsion/engine[2]/power-hp</property>
    <property>propulsion/engine[3]/engine-rpm</property>
    <property>propulsion/engine[3]/boost-psi</property>
    <property>propulsion/engine[3]/power-hp</property>
    <property>propulsion/engine[3]/egt-degF</property>
    <property>fcs/mixture-pos-norm[3]</property>
    <property>propulsion/engine[3]/fuel-flow-rate-pps</property>
    <property>fcs/copilot/elevator-cmd-norm</property>
    <property>fcs/flap-pos-norm</property>
    <property>fcs/flap-pos-deg</property>
   </notify>
   <set name="simulation/notify-time-trigger" value="5" type="FG_DELTA"/>
  </event>

 </run>

</runscript>
