<?xml version="1.0"?>

<PropertyList>

    <name>Amphibious Takeoff</name>

    <description>
This tutorial starts from Daniel K. Inouye International Airport (PHNL), a seaplane airfield located in Oahu's Keehi Lagoon, Honolulu, Hawaii in clear, still, weather.

By now you should be proficient in the preflight checklist, startup proceedures, determining the appropriate taxiing route to the desired runway, takeoff, flying a pattern and landing.

You will taxi and takeoff from water runway 4W at PHNL on heading 043, climb at 600 feet per minute leveling off at 1000 ft., turn left 180 degree onto final heading 223 to land at PHNL and complete the tutorial.

Water runway 4W/22W is parallel and immediately adjacent to land based runway 4R/22L.

Pay attention to the heading bug on taxiing it will approximate the threshold position of runway 4W.
    </description>

    <audio-dir>Tutorials/amphibious</audio-dir>
    <timeofday>morning</timeofday>

    <presets>
        <airport-id>PHNL</airport-id>
        <on-ground>1</on-ground>
        <altitude-ft>-9999</altitude-ft>
        <latitude-deg type="double">21.317</latitude-deg>
        <longitude-deg type="double">-157.912</longitude-deg>
        <heading-deg type="double">70</heading-deg>
        <airspeed-kt>0</airspeed-kt>
        <glideslope-deg>0</glideslope-deg>
        <offset-azimuth-deg>0</offset-azimuth-deg>
        <offset-distance-nm>0</offset-distance-nm>
        <airport-requested>true</airport-requested>
        <runway-requested>true</runway-requested>
        <parking-requested>true</parking-requested>
    </presets>

    <targets>
        <runway>
            <!-- Threashold runway 4W -->
            <latitude-deg>21.31335723</latitude-deg>
            <longitude-deg>-157.9157261</longitude-deg>
        </runway>
    </targets>

    <step>
        <message>Damage has been turned off. You may turn it on now for more realism.</message>
        <set>
            <property>/fdm/jsbsim/settings/damage</property>
            <value>0</value>
        </set>
        <nasal>
            <script>
                var listeners = std.Vector.new();

                listeners.append(setlistener("/sim/signals/fdm-initialized", func (node) {
                    if (node.getBoolValue()) {
                        setprop("/controls/switches/starter", 0);
                        setprop("/controls/switches/master-bat", 1);
                        setprop("/controls/switches/master-alt", 1);
                        setprop("/controls/gear/gear-down", 0);
                        setprop("/fdm/jsbsim/gear/gear-pos-norm", 0);
                        setprop("/orientation/heading-deg", getprop("/environment/wind-from-heading-deg"));
                        setprop("/fdm/jsbsim/mooring/anchor-lon", getprop("/position/longitude-deg"));
                        setprop("/fdm/jsbsim/mooring/anchor-lat", getprop("/position/latitude-deg"));
                        setprop("sim/anchorbuoy/enable", 0);
                        setprop("/fdm/jsbsim/mooring/anchor-dist", 0);
                        setprop("/fdm/jsbsim/mooring/anchor-length", 0);
                        setprop("/fdm/jsbsim/mooring/mooring-connected", 0);
                        setprop("/controls/switches/master-bat", 0);
                        setprop("/controls/switches/master-alt", 0);
                        foreach (var listener; listeners.vector) {
                            removelistener(listener);
                        }
                        listeners.clear();
                    }
                }, 1, 0));
            </script>
        </nasal>
        <set>
            <property>/controls/flight/flaps</property>
            <value>0.0</value>
        </set>
        <set>
            <property>/controls/switches/magnetos</property>
            <value>0</value>
        </set>
        <set>
            <property>/controls/engines/current-engine/throttle</property>
            <value>0.0</value>
        </set>
        <set>
            <property>/engines/active-engine/running</property>
            <value>false</value>
        </set>
        <set>
            <property>/instrumentation/adf/frequencies/selected-khz</property>
            <value>242</value> <!-- EWABE NDB -->
        </set>
        <set>
            <property>/environment/weather-scenario</property>
            <value>Fair weather</value>
        </set>
        <set>
            <property>instrumentation/altimeter/setting-inhg</property>
            <value>29.92</value>
        </set>
        <set>
            <property>/controls/flight/elevator-trim</property>
            <value>0.17</value>
        </set>
        <set>
            <property>/consumables/fuel/tank[0]/selected</property>
            <value>true</value>
        </set>
        <set>
            <property>/consumables/fuel/tank[1]/selected</property>
            <value>true</value>
        </set>
        <set>
            <property>/controls/anti-ice/engine/carb-heat</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/switches/master-avionics</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/switches/master-bat</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/switches/master-alt</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/lighting/taxi-light</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/lighting/landing-lights</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/anti-ice/pitot-heat</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/lighting/nav-lights</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/lighting/beacon</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/lighting/strobe</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/lighting/instruments-norm</property>
            <value>0</value>
        </set>
        <set>
            <property>/controls/engines/engine/primer</property>
            <value>0</value>
        </set>
        <set>
            <property>/controls/engines/engine/primer-lever</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/door-positions/baggageDoor/position-norm</property>
            <value>0</value>
        </set>
        <set>
            <property>/sim/model/door-positions/leftDoor/position-norm</property>
            <value>0</value>
        </set>
        <set>
            <property>/sim/model/door-positions/rightDoor/position-norm</property>
            <value>0</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/chock</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/cowl-plugs-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/tiedownL-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/tiedownR-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/tiedownT-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/pitot-cover-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>sim/model/c172p/engine_flag_0</property>
            <value>0</value>
        </set>
        <set>
            <property>sim/model/c172p/engine_flag_1</property>
            <value>1</value>
        </set>
        <set>
            <property>/controls/engines/active-engine</property>
            <value>1</value>
        </set>
        <set>
            <property>sim/model/c172p/bushkit_flag_0</property>
            <value>0</value>
        </set>
        <set>
            <property>sim/model/c172p/bushkit_flag_1</property>
            <value>0</value>
        </set>
        <set>
            <property>sim/model/c172p/bushkit_flag_2</property>
            <value>0</value>
        </set>
        <set>
            <property>sim/model/c172p/bushkit_flag_3</property>
            <value>1</value>
        </set>
        <set>
            <property>sim/model/c172p/bushkit_flag_4</property>
            <value>0</value>
        </set>
        <set>
            <property>fdm/jsbsim/bushkit</property>
            <value>4</value>
        </set>
        <set>
            <property>/sim/model/c172p/cockpit/control-lock-placed</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/cockpit/control-lock-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/securing/cowl-plugs-visible</property>
            <value>false</value>
        </set>
        <set>
            <property>/sim/model/c172p/brake-parking</property>
            <value>0</value>
        </set>
        <set>
            <property>/controls/mooring/anchor</property>
            <value>1</value>
        </set>
        <set>
            <property>/controls/switches/master-gear</property>
            <value>false</value>
        </set>
        <set>
            <property>/controls/gear/water-rudder</property>
            <value>false</value>
        </set>

        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>-12</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <x-offset-m>-0.21</x-offset-m>
            <y-offset-m>0.23</y-offset-m>
            <field-of-view>73.6</field-of-view>
        </view>
    </step>

    <step>
        <message>Please go through your preflight, determine taxi route to runway 4W then release the mooring anchor.</message>
        <set>
            <property>/controls/switches/starter</property>
            <value>false</value>
        </set>

        <wait>10</wait>

        <error>
            <message>When ready release the mooring anchor under "Mooring Parameters".</message>
            <condition>
                <equals>
                    <property>/controls/mooring/anchor</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>

        <error>
            <message>Do not start engine until the mooring anchor has been released.
                    Turn it off or you will damage your aircraft.</message>
            <condition>
                <equals>
                    <property>/engines/active-engine/running</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <equals>
                        <property>/controls/mooring/anchor</property>
                        <value>0</value>
                    </equals>
                    <equals>
                        <property>/engines/active-engine/running</property>
                        <value>0</value>
                    </equals>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Click the battery master switch to turn it on.</message>

        <exit>
            <condition>
                <property>controls/switches/master-bat</property>
            </condition>
        </exit>
    </step>

    <step>
        <message>Start the engine.</message>

        <wait>5</wait>

        <error>
            <message>Click the alternator master switch to turn it on.</message>
            <condition>
                <not>
                    <property>/controls/switches/master-alt</property>
                </not>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <property>/controls/switches/master-alt</property>
                    <equals>
                        <property>/engines/active-engine/running</property>
                        <value>1</value>
                    </equals>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Lower water rudders for better control Shift+[r].</message>

        <error>
            <message>Lower water rudders now Shift+[r].</message>
            <condition>
                <equals>
                    <property>/controls/gear/water-rudder</property>
                    <value>0</value>
                </equals>
            </condition>
        </error>
        <error>
            <message>Turn avionics system power switch on.</message>
            <condition>
                <equals>
                    <property>/controls/switches/master-avionics</property>
                    <value>0</value>
                </equals>
            </condition>
        </error>
        <error>
            <message>Your gear must be up to take off [g].</message>
            <condition>
                <equals>
                    <property>/controls/gear/gear-down</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <equals>
                        <property>/controls/gear/water-rudder</property>
                        <value>1</value>
                    </equals>
                    <equals>
                        <property>/controls/switches/master-avionics</property>
                        <value>1</value>
                    </equals>
                    <equals>
                        <property>/controls/gear/gear-down</property>
                        <value>0</value>
                    </equals>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Taxi towards water runway 4W following your heading bug until you reach the runway threshhold.</message>

        <nasal>
            <script>
                setprop("/autopilot/settings/heading-bug-deg", getprop("/sim/tutorials/targets/runway/heading-deg"));
            </script>
        </nasal>

        <error>
            <message>You're off course. To reach the runway turn to the left following your heading bug.</message>
            <nasal>
                <script>
                    setprop("/autopilot/settings/heading-bug-deg", getprop("/sim/tutorials/targets/runway/heading-deg"));
                </script>
            </nasal>
            <condition>
                <less-than>
                    <property>/sim/tutorials/targets/runway/direction-deg</property>
                    <value>-20</value>
                </less-than>
            </condition>
        </error>
        <error>
            <message>You're off course. To reach the runway turn to the right following your heading bug.</message>
            <nasal>
                <script>
                    setprop("/autopilot/settings/heading-bug-deg", getprop("/sim/tutorials/targets/runway/heading-deg"));
                </script>
            </nasal>
            <condition>
                <greater-than>
                    <property>/sim/tutorials/targets/runway/direction-deg</property>
                    <value>20</value>
                </greater-than>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <less-than>
                        <property>/sim/tutorials/targets/runway/direction-deg</property>
                        <value>20</value>
                    </less-than>
                    <greater-than>
                        <property>/sim/tutorials/targets/runway/direction-deg</property>
                        <value>-20</value>
                    </greater-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Continue taxiing towards water runway 4W following your heading bug until you reach the runway threshhold.</message>

       <exit>
            <condition>
                <less-than>
                    <property>/sim/tutorials/targets/runway/distance-m</property>
                    <value>120.0</value>
                </less-than>
            </condition>
        </exit>
    </step>

    <step>
        <message>Turn left to line up on a takeoff course of 043.</message>

        <set>
            <property>/autopilot/settings/heading-bug-deg</property>
            <value>43.4</value>
        </set>

        <error>
            <message>Your gear must be up to take off [g].</message>
            <condition>
                <equals>
                    <property>/controls/gear/gear-down</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>
        <error>
            <message>You are heading too far left, turn right slightly to heading 043.</message>
            <condition>
                <less-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>028</value>
                </less-than>
            </condition>
        </error>
        <error>
            <message>You are heading too far right, turn left slightly to heading 043.</message>
            <condition>
                <greater-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>058</value>
                </greater-than>
            </condition>
        </error>
        <exit>
            <condition>
                <and>
                    <greater-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>028</value>
                    </greater-than>
                    <less-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>058</value>
                    </less-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Ready for takeoff smoothly apply full power, control direction using rudder.</message>

        <set>
            <property>/autopilot/settings/heading-bug-deg</property>
            <value>43.4</value>
        </set>

        <error>
            <message>Your gear must be up to take off [g].</message>
            <condition>
                <equals>
                    <property>/controls/gear/gear-down</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>
        <error>
            <message>Apply full throttle for takeoff.</message>
            <condition>
                <less-than>
                    <property>/controls/engines/current-engine/throttle</property>
                    <value>0.95</value>
                </less-than>
            </condition>
        </error>

        <exit>
            <condition>
                <greater-than>
                    <property>/velocities/airspeed-kt</property>
                    <value>0.90</value>
                </greater-than>
            </condition>
        </exit>
    </step>

    <step>
        <message>Slight forward pressure to get on step, if you begin to bounce use slight back pressure.</message>

        <error>
            <message>You are heading too far left, turn right slightly to heading 043.</message>
            <condition>
                <less-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>28</value>
                </less-than>
            </condition>
        </error>
        <error>
            <message>You are heading too far right, turn left slightly to heading 043.</message>
            <condition>
                <greater-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>58</value>
                </greater-than>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <greater-than>
                        <property>/velocities/airspeed-kt</property>
                        <value>45.0</value>
                    </greater-than>
                    <less-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>58</value>
                    </less-than>
                    <greater-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>28</value>
                    </greater-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Let the aircraft lift off at 65 knots, climb straight out on heading 043, 600 feet per minute.</message>

        <error>
            <message>Gently raise the nose.</message>
            <condition>
                <equals>
                    <property>/fdm/jsbsim/hydro/active-norm</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <greater-than>
                        <property>/instrumentation/vertical-speed-indicator/indicated-speed-fpm</property>
                        <value>300</value>
                    </greater-than>
                    <equals>
                        <property>/fdm/jsbsim/hydro/active-norm</property>
                        <value>0</value>
                    </equals>
                    <less-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>58</value>
                    </less-than>
                    <greater-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>28</value>
                    </greater-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Continue your climb on heading 043 at 600 feet per minute to 1000 feet.</message>

        <error>
            <message>You are heading too far left, turn right slightly to heading 043.</message>
            <condition>
                <less-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>28</value>
                </less-than>
            </condition>
        </error>
        <error>
            <message>You are heading too far right, turn left slightly to heading 043.</message>
            <condition>
                <greater-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>58</value>
                </greater-than>
            </condition>
        </error>
        <error>
            <message>Raise your pontoon rudders now [r].</message>
            <condition>
                <equals>
                    <property>/controls/gear/water-rudder</property>
                    <value>1</value>
                </equals>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <greater-than>
                        <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                        <value>900</value>
                    </greater-than>
                    <less-than>
                        <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                        <value>1100</value>
                    </less-than>
                    <less-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>58</value>
                    </less-than>
                    <greater-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>28</value>
                    </greater-than>
                    <equals>
                        <property>/controls/gear/water-rudder</property>
                        <value>0</value>
                    </equals>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Level off between 900 and 1100 feet.</message>

        <error>
            <message>You are too low</message>
            <condition>
                <less-than>
                    <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                    <value>900</value>
                </less-than>
            </condition>
        </error>
        <error>
            <message>You are too high</message>
            <condition>
                <greater-than>
                    <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                    <value>1100</value>
                </greater-than>
            </condition>
        </error>
        <error>
            <message>You are heading too far left, turn right slightly to heading 043.</message>
            <condition>
                <less-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>28</value>
                </less-than>
            </condition>
        </error>
        <error>
            <message>You are heading too far right, turn left slightly to heading 043.</message>
            <condition>
                <greater-than>
                    <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                    <value>58</value>
                </greater-than>
            </condition>
        </error>

        <exit>
            <condition>
                <or>
                    <and>
                        <greater-than>
                            <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                            <value>900</value>
                        </greater-than>
                        <less-than>
                            <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                            <value>1100</value>
                        </less-than>
                        <less-than>
                            <property>instrumentation/vertical-speed-indicator/indicated-speed-fpm</property>
                            <value>300</value>
                        </less-than>
                        <greater-than>
                            <property>instrumentation/vertical-speed-indicator/indicated-speed-fpm</property>
                            <value>-300</value>
                        </greater-than>
                        <greater-than>
                            <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                            <value>28</value>
                        </greater-than>
                        <less-than>
                            <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                            <value>58</value>
                        </less-than>
                    </and>
                    <greater-than>
                        <property>/sim/tutorials/targets/runway/distance-m</property>
                        <value>5690</value>
                    </greater-than>
                </or>
            </condition>
        </exit>
    </step>

    <step>
        <message>Continue outbound heading 043 at 1000 feet.</message>

        <exit>
            <condition>
                <or>
                    <less-than>
                        <property>/position/longitude-deg</property>
                        <value>-157.8756975</value>
                    </less-than>
                    <greater-than>
                        <property>/sim/tutorials/targets/runway/distance-m</property>
                        <value>5690</value>
                    </greater-than>
                </or>
            </condition>
        </exit>
    </step>

    <step>
        <message>Execute a 180 degree left turn onto final heading 223, line up with the runway 22R at PHNL.</message>

        <set>
            <property>/autopilot/settings/heading-bug-deg</property>
            <value>223</value>
        </set>

        <exit>
            <condition>
                <and>
                    <greater-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>208</value>
                    </greater-than>
                    <less-than>
                        <property>/instrumentation/heading-indicator/indicated-heading-deg</property>
                        <value>238</value>
                    </less-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Execute power and flap regime for landing.</message>

        <error>
            <message>Check throttle.</message>
            <condition>
                <greater-than>
                    <property>/controls/engines/current-engine/throttle</property>
                    <value>0.85</value>
                </greater-than>
            </condition>
        </error>
        <error>
            <message>Set some flaps at appropriate speed.</message>
            <condition>
                <and>
                    <less-than>
                        <property>/controls/flight/flaps</property>
                        <value>0.3</value>
                    </less-than>
                    <less-than>
                        <property>/velocities/airspeed-kt</property>
                        <value>110</value>
                    </less-than>
                </and>
            </condition>
        </error>

        <exit>
            <condition>
                <and>
                    <less-than>
                        <property>/controls/engines/current-engine/throttle</property>
                        <value>0.9</value>
                    </less-than>
                    <greater-than>
                        <property>/controls/flight/flaps</property>
                        <value>0</value>
                    </greater-than>
                    <less-than>
                       <property>/velocities/groundspeed-kt</property>
                       <value>70</value>
                    </less-than>
                </and>
            </condition>
        </exit>
    </step>

    <step>
        <message>Check gear advisory.</message>

        <error>
            <message>Lower pontoon landing gear Shift+[g].</message>
            <condition>
                <and>
                    <less-than>
                       <property>/velocities/groundspeed-kt</property>
                       <value>70</value>
                    </less-than>
                    <equals>
                        <property>/controls/gear/gear-down</property>
                        <value>0</value>
                    </equals>
                </and>
            </condition>
        </error>
        <exit>
            <condition>
                <equals>
                    <property>/controls/gear/gear-down</property>
                    <value>1</value>
                </equals>
            </condition>
        </exit>
    </step>

    <step>
        <message>Execute approach and landing.</message>

        <exit>
            <condition>
                <less-than>
                    <property>/velocities/groundspeed-kt</property>
                    <value>10.0</value>
                </less-than>
            </condition>
        </exit>
    </step>

    <step>
        <message>Congratulations on successfully executing a water taxi and take off, then following a pattern to a ground landing.</message>
    </step>

</PropertyList>