<?xml version="1.0" encoding="UTF-8" ?>

<PropertyList>

    <name>Pre flight</name>
    <description>Learn about the pre-flight preparations.</description>
    <presets>
        <on-ground type="bool">true</on-ground>
    </presets>
    <step-time>4</step-time>
    <exit-time>2</exit-time>
    <init>
        <set>
            <property>/controls/gear/gear-down</property>
            <value type="bool">true</value>
        </set>
        <set>
            <property>controls/gear/brake-parking</property>
            <value type="bool">true</value>
        </set>
        <set>
            <property>/controls/flight/flaps</property>
            <value type="int">0</value>
        </set>
        <set>
            <property>controls/APU/off-on</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>controls/APU/electronic-control-unit</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>controls/engines/engine[0]/cutoff</property>
            <value type="bool">true</value>
        </set>
        <set>
            <property>controls/engines/engine[0]/throttle</property>
            <value>0</value>
        </set>
        <set>
            <property>controls/engines/engine[0]/thrust-mode</property>
            <value>0</value>
        </set>
        <set>
            <property>controls/engines/engine[0]/generator</property>
            <value>0</value>
        </set>
        <set>
            <property>controls/engines/engine[1]/cutoff</property>
            <value type="bool">true</value>
        </set>
        <set>
            <property>controls/engines/engine[1]/throttle</property>
            <value>0</value>
        </set>
        <set>
            <property>controls/engines/engine[1]/thrust-mode</property>
            <value>0</value>
        </set>
        <set>
            <property>controls/engines/engine[1]/generator</property>
            <value>0</value>
        </set>
        <set>
            <property>controls/electric/battery-switch</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>/controls/electric/ac-service-selected</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>systems/fuel/boost-pump[0]/selected</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>systems/fuel/boost-pump[1]/selected</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>/sim/current-view/view-number</property>
            <value>0</value>
        </set>
        <set>
            <property>instrumentation/eicas/page</property>
            <value>1</value>
        </set>
        <set>
            <property>controls/efis/sidepanel[0]/use-QNH</property>
            <value type="bool">false</value>
        </set>
        <set>
            <property>sim/current-view/x-offset-m</property>
            <property>sim/view[0]/config/x-offset-m</property>
        </set>
        <set>
            <property>sim/current-view/y-offset-m</property>
            <property>sim/view[0]/config/y-offset-m</property>
        </set>
        <set>
            <property>sim/current-view/z-offset-m</property>
            <property>sim/view[0]/config/z-offset-m</property>
        </set>        
        <nasal>
            <script><![CDATA[
                # engine cutoff settings seem to get overridden
                settimer(func
                {
                    setprop("controls/engines/engine[0]/cutoff", 1);
                    setprop("controls/engines/engine[1]/cutoff", 1);
                    setprop("consumables/fuel/tank[0]/level-lbs", 180);
                    setprop("consumables/fuel/tank[1]/level-lbs", 180);
                    setprop("consumables/fuel/tank[2]/level-lbs", 140);
                }, 0);
            ]]></script>
        </nasal>
    </init>

    <step>
        <message>Welcome aboard the Bombardier CRJ700.</message>
        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>-14.5</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>80</field-of-view>
        </view>
    </step>
    <step>
        <message>
        In this tutorial you will learn about pre-flight preparations before you
        start the engines.
        This tutorial is based on the pre-flight checklist.
        It's always a good idea to see the checklists... 
        </message>
        <wait>10</wait>
    </step>
    <step>
        <message>
        Before we power up our aircraft, we have to check some basics to avoid
        accidents, so we check that certain controls are set to the correct position,
        makeing sure that brakes are set etc.
        </message>
        <wait>14</wait>
    </step>
    <!-- Check controls -->
    <step>
        <message>Parking Brake: CHECK SET</message>
        <exit>
            <condition>
                <property>/controls/gear/brake-parking</property>
            </condition>
        </exit>
        <view>
            <heading-offset-deg>326.1</heading-offset-deg>
            <pitch-offset-deg>-40.3</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>58.0</field-of-view>
        </view>
    </step>
    <step>
        <message>Landing gear lever: CHECK DOWN</message>
        <marker>
            <x-m>-14.00</x-m>
            <y-m>0.0363</y-m>
            <z-m>-1.096</z-m>
            <scale>5.496</scale>
        </marker>
        <exit>
            <condition>
                <property>/controls/gear/gear-down</property>
            </condition>
        </exit>
    </step>
    <step>
        <message>Throttle: CUT OFF</message>
        <marker>
            <x-m>-13.635</x-m>
            <y-m>-0.000</y-m>
            <z-m>-1.1609</z-m>
            <scale>5.70</scale>
        </marker>
        <exit>
            <condition>
                <and>
                    <property>/controls/engines/engine[0]/cutoff</property>
                    <property>/controls/engines/engine[1]/cutoff</property>
                </and>
            </condition>
        </exit>
    </step>
    <step>
        <message>Flaps: UP </message>
        <marker>
            <x-m>-13.7386</x-m>
            <y-m>0.1760</y-m>
            <z-m>-1.1909</z-m>
            <scale>3.8760</scale>
        </marker>
        <exit>
            <condition>
                <equals>
                    <property>/surface-positions/flap-pos-norm</property>
                    <value>0</value>
                </equals>
            </condition>
        </exit>
    </step>
    <step>
        <message>All hydraulic pumps: OFF</message>
        <view>
            <heading-offset-deg>318.4</heading-offset-deg>
            <pitch-offset-deg>17.6</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>60.7</field-of-view>
        </view>
        <marker>
            <x-m>-13.6430</x-m>
            <y-m>0.0000</y-m>
            <z-m>-0.2455</z-m>
            <scale>3.3</scale>
        </marker>
        <exit>
            <condition>
                <not><or>
                    <property>controls/hydraulic/system/pump-b</property>
                    <property>controls/hydraulic/system[1]/pump-b</property>
                    <property>controls/hydraulic/system[2]/pump-a</property>
                    <property>controls/hydraulic/system[2]/pump-b</property>
                </or></not>
            </condition>
        </exit>
    </step>

    <!-- Power up -->
    <step>
        <message>
        Now reach up to the overhead panel and turn on the battery.
        The battery shall be on all the time until you are parked again at you destination.
        It is the first thing to turn on and the very last thing to turn off.
        </message>
        <view>
            <heading-offset-deg>306.9</heading-offset-deg>
            <pitch-offset-deg>38.8</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>63</field-of-view>
        </view>
        <marker>
            <x-m>-13.41</x-m>
            <y-m>-0.1825</y-m>
            <z-m>-0.1318</z-m>
            <scale>1.9667</scale>
        </marker>
        <wait>14</wait>
        <exit>
            <condition>
                <property>controls/electric/battery-switch</property>
            </condition>
        </exit>
    </step>
    <step>
        <message>
            With battery power on, the computers will start and displays light up.
            You will see many warnings and cautions on the EICAS and the 
            master caution and master warning switch lights on the glare shield
            will light up. For now, just push them to acknowledge the messages.
            They will light up again, when new messages come up.
        </message>
        <view>
            <heading-offset-deg>337.2</heading-offset-deg>
            <pitch-offset-deg>-21.3</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>62</field-of-view>
        </view>
        <marker>
            <x-m>-13.8686</x-m>
            <y-m>-0.5281</y-m>
            <z-m>-0.6578</z-m>
            <scale>3.5</scale>
        </marker>
        <exit>
            <condition>
                <not>
                <property>instrumentation/eicas/master-warning</property>
                </not>
                <not>
                <property>instrumentation/eicas/master-caution</property>
                </not>
            </condition>
        </exit>    
    </step>
    <step>
        <message>
        While your aircraft is on its parking position, you can usually request ground power.
        If it is available, select it.
        </message>
        <view>
            <heading-offset-deg>311.9</heading-offset-deg>
            <pitch-offset-deg>36.1</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>            
            <field-of-view>58</field-of-view>
        </view>
        <marker>
            <x-m>-13.4000</x-m>
            <y-m>-0.1140</y-m>
            <z-m>-0.1150</z-m>
            <scale>1.1488</scale>
        </marker>
        <exit>
            <condition>
                <property>/controls/electric/ac-service-selected</property>
            </condition>
        </exit>
    </step>
    <!-- Lights -->
    <step>
        <message>
        As we have electrical power now, we may want to switch on some lights inside and outside the aircraft.
        </message>
    </step>
    <step>
        <message>Switch the nav lights on so we are better noticed on our parking position.</message>
        <view>
            <heading-offset-deg>320</heading-offset-deg>
            <pitch-offset-deg>20.0</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>55.0</field-of-view>
        </view>
        <marker>
            <x-m>-13.6608</x-m>
            <y-m>-0.2290</y-m>
            <z-m>-0.2355</z-m>
            <scale>1.0000</scale>
        </marker>
        <exit>
            <condition>
                <property>/controls/lighting/nav-lights</property>
            </condition>
        </exit>
    </step>
    <step>
        <message>
        As start boarding starts, we also should switch on the passengers signs (seatbelt, no-smoking).
        They can be set to on, off or automatic.
        </message>
        <marker>
            <x-m>-13.7121</x-m>
            <y-m>0.0992</y-m>
            <z-m>-0.3107</z-m>
            <scale>2.0909</scale>
        </marker>
        <exit>
            <condition>
                <and>
                    <not-equals>
                        <property>/controls/switches/no-smoking-sign</property>
                        <value>1</value>
                    </not-equals>
                    <not-equals>
                        <property>/controls/switches/seatbelt-sign</property>
                        <value>1</value>
                    </not-equals>
                </and>
            </condition>
        </exit>
        <wait>8</wait>
    </step>
    <!-- Fuel -->
    <step>
        <view>
            <heading-offset-deg>355</heading-offset-deg>
            <pitch-offset-deg>-27.0</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <field-of-view>58.0</field-of-view>
        </view>
        <message>
        Before we start our engines, we need to fuel our aircraft.
        Two things to consider:
        </message>
        <wait>6</wait>
    </step>
    <step>
        <message>
        1) More fuel is more weight that causes higher fuel consumption at take off and longer take off run.
        You can find fuel planners on the internet to help.
        </message>
        <wait>10</wait>
    </step>
    <step>
        <message>
        2) always add a fuel reserve for at least 30 minutes in case you have to go around or divert to another airport.
        </message>
        <wait>10</wait>
    </step>
    <step>
        <view>
            <heading-offset-deg>354.8</heading-offset-deg>
            <pitch-offset-deg>-25.1</pitch-offset-deg>
            <field-of-view>58.0</field-of-view>
        </view>
        <marker>
            <x-m>-14.0955</x-m>
            <y-m>-0.1000</y-m>
            <z-m>-0.9571</z-m>
            <scale>4.0</scale>
        </marker>
        <message>
        You can see the level of all fuel tanks on the primary EICAS page.
        WARNING: EICAS display shows kilograms while the fuel dialog is in pounds.
        Fuel at least 5000 pounds. Distribute them equally to left and right tank. Center tank only for long range.
        </message>
        <nasal>
            <script>gui.showWeightDialog()</script>
            <module></module>
        </nasal>
        <exit>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>consumables/fuel/total-fuel-lbs</property>
                        <value>5000</value>
                    </greater-than-equals>
                    <not>
                        <property>systems/fuel/imbalance</property>
                    </not>
                </and>
            </condition>
            <nasal>
                <script>fgcommand("dialog-close", props.Node.new({"dialog-name": "WeightAndFuel"}));</script>
            </nasal>
        </exit>
        <wait>20</wait>
    </step>

    <!-- Weather -->
    <step>
        <message>
        ---
        One of the most important things for a pilot it the weather.
        For our flight preparation we need to set the altimeter to the current air pressure (QNH).
        </message>
    </step>
    <step>
        <message>
        In Flightgear, we can get the current weather from the weather dialog.
        It is encoded as METAR string.
        </message>
        <wait>8</wait>
    </step>
    <step>
        <message>
        QNH is given in hecto pascal ranging from approx 990 to 1035 hPa.
        In the US the unit commonly used is inches Hg.
        </message>
        <wait>6</wait>
    </step>
    <step>
        <message>
        First we make sure our altimeter uses hPa, as we will enter the value in hPa later.
        Have a look to the PFD. On the right side below the altimeter tape you
        find the reference value in blue color.
        </message>
        <view>
            <heading-offset-deg>0</heading-offset-deg>
            <pitch-offset-deg>-24.3</pitch-offset-deg>
            <field-of-view>65.0</field-of-view>
        </view>
        <marker>
            <x-m>-14.0978</x-m>
            <y-m>-0.4871</y-m>
            <z-m>-0.9655</z-m>
            <scale>2.0</scale>
        </marker>
        <wait>7</wait>
    </step>
    <step>
        <message>
        Use the HPA/IN button on the sidepanel to change the units of the readout to hPa.
        </message>
        <marker>
            <x-m>-13.9921</x-m>
            <y-m>-0.7290</y-m>
            <z-m>-1.0372</z-m>
            <scale>1.0661</scale>
        </marker>
        <exit>
            <condition>
                <property>controls/efis/sidepanel[0]/use-QNH</property>
            </condition>
        </exit>
    </step>
    <step>
        <message>
        Find the Q in the METAR string and note the number right after it (range approx 990-1035 hPa).
        Enter this number by turning the baro knob on the sidepanel while watching the readout on PFD.
        </message>
        <nasal>
            <script>fgcommand("dialog-show", props.Node.new({"dialog-name": "weather"}));</script>
        </nasal>
        <marker>
            <x-m>-13.983</x-m>
            <y-m>-0.7265</y-m>
            <z-m>-1.0571</z-m>
            <scale>1.8760</scale>
        </marker>
        <exit>
            <condition>
                <less-than>
                    <property>instrumentation/altimeter/ref-deviation</property>
                    <value>0.01</value>
                </less-than>
            </condition>
            <nasal>
                <script>fgcommand("dialog-close", props.Node.new({"dialog-name": "weather"}));</script>
            </nasal>
        </exit>
        <wait>20</wait>
    </step>
    <step>
        <message>
        -- Hint --
        To reset altimeter reference to default (1013hPa/29.92inHg), push the baro knob (click on face).

        </message>
        <wait>7</wait>
    </step>
    <step>
        <message>
        Later for taxi we will need nose wheel steering, so enable it (middle click to toggle without opening dialog).
        </message>
        <view>
            <heading-offset-deg>10</heading-offset-deg>
        </view>
        <marker>
            <x-m>-13.8823</x-m>
            <y-m>-0.9190</y-m>
            <z-m>-0.8975</z-m>
            <scale>1.6281</scale>
        </marker>
        <exit>
            <condition>
                <property>controls/gear/enable-tiller</property>
            </condition>
        </exit>
    </step>
    <!-- doors -->
    <step>
        <message>
        We are almost done with our preparations. It is time to check the doors and close them.
        Find and click the doors button on the EICAS control panel on the pedestal panel.
        </message>
        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>-60.0</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <x-offset-m>0</x-offset-m>
            <y-offset-m>-0.5</y-offset-m>
            <z-offset-m>-13.1</z-offset-m>
            <field-of-view>50.0</field-of-view>
        </view>
        <marker>
            <x-m>-13.5377</x-m>
            <y-m>-0.0074</y-m>
            <z-m>-1.2669</z-m>
            <scale>1.0000</scale>
        </marker>
        <exit>
            <condition>
                <equals>
                    <property>instrumentation/eicas/page</property>
                    <value>9</value>
                </equals>
            </condition>
        </exit>
    </step>
    <step>
        <message>
        The EICAS now shows the door status. Green means closed and secure.
        All doors shall be closed before engine startup.
        Open the doors control dialog via the menu.
        Close all doors (be patient, it takes some seconds).
        </message>
        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>-26.0</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <x-offset-m>0</x-offset-m>
            <y-offset-m>-0.5</y-offset-m>
            <z-offset-m>-13.1</z-offset-m>
            <field-of-view>55.0</field-of-view>
        </view>
        <exit>
            <condition>
                <and>
                    <not><property>/sim/model/door-positions/aft-cargo/position-norm</property></not>
                    <not><property>/sim/model/door-positions/av-bay/position-norm</property></not>
                    <not><property>/sim/model/door-positions/ctr-cargo/position-norm</property></not>
                    <not><property>/sim/model/door-positions/emer-l1/position-norm</property></not>
                    <not><property>/sim/model/door-positions/emer-l2/position-norm</property></not>
                    <not><property>/sim/model/door-positions/emer-r1/position-norm</property></not>
                    <not><property>/sim/model/door-positions/emer-r2/position-norm</property></not>
                    <not><property>/sim/model/door-positions/fwd-cargo/position-norm</property></not>
                    <not><property>/sim/model/door-positions/pax-left/position-norm</property></not>
                    <not><property>/sim/model/door-positions/pax-right/position-norm</property></not>
                </and>
            </condition>
        </exit>
        <wait>25</wait>
    </step>

    <step>
        <message>
        Congratulations, pre flight tutorial is completed :)
        You may want to continue with startup tutorial or the checklists.
        </message>
        <view>
            <heading-offset-deg>0.0</heading-offset-deg>
            <pitch-offset-deg>0.0</pitch-offset-deg>
            <roll-offset-deg>0.0</roll-offset-deg>
            <x-offset-m>-0.5</x-offset-m>
            <y-offset-m>-0.5</y-offset-m>
            <z-offset-m>-13.1</z-offset-m>
            <field-of-view>71.7</field-of-view>
        </view>
        <nasal>
            <script><![CDATA[
                var i = getprop("sim/current-view/view-number-raw");
                var x = getprop("sim/view["~i~"]/config/x-offset-m");
                var y = getprop("sim/view["~i~"]/config/y-offset-m");
                var z = getprop("sim/view["~i~"]/config/z-offset-m");
                setprop("sim/current-view/x-offset-m", x);
                setprop("sim/current-view/y-offset-m", y);
                setprop("sim/current-view/z-offset-m", z);
            ]]></script>
        </nasal>
    </step>
    <end>
        <message>Congratulations! You have successfully started your CRJ700.
        Please make sure to look at the checklists for more information.</message>
    </end>

</PropertyList>

