<Gauge Name="GPWS" Version="3.3">
<Comment>
This GPWS gauge is for FS2004 only ! See README for operation details.

Added in 2.1:
- Mode 1 - 7 is disabled when aircraft is below 20 feet corrected RadioAltitude instead of OnGround.
- Mode 1 now has two sets of threshold values: one for above and one for below 10000 ft RadioAltitude

Added in 3.0:
- When the sound in Mode 1 - 6 is disabled, is it automatically enabled again when the warning condition
  is removed; hence, sound can only be temporarily disabled for the duration of a warning period.
  Effectively, this means that modestate 2 is not possible anymore.
- Added a clicksound to all clickspots.

Added in 3.1:
- Each mode (1 - 6) has it's own repetition timer; this means that if the sound of an Active mode
  is disabled, the aural warning of a lower-priority Active mode is immediately started.
- The standard FS2004 variable for DH can now be made visible/changed.
- Night lighting added, dependant on Panel Light switch: seperate colored bitmaps for Background, SwitchOff
  and ModeS4 (off)

Added in 3.2:
- Removed nightlight bitmap (too complicated)
- Solved: no more Windshear callouts above Upper_RALT. 

Added in V3.3: editorials only; functionally the same as V3.2.

The values of the main GPWS parameters can be adapted to your own preference (c.q.
to your aircraft) by editing their values in the ******-marked box below.
USE NOTEPAD IN MAXIMISED WINDOW FOR GOOD OVERVIEW !

COPYRIGHT STATEMENT: 
This gauge is freeware, NOT public domain.
Other then editing for your personal use, it may NOT be renamed, copied, modified, 
or bundled in another archive without my prior consent.
Rob Barendregt, 3 June 2005
Email: rc.barendregt@planet.nl
</Comment>

<Update Frequency="6"/>

<Image Name="GPWS3_Background.bmp" ImageSizes="82,31"/>

<!-- State INITIAL and State-Independant -->
<Element>
  <Select>
    <Value>
      (G:Var1) 0 ==
      if{
        (G:Var2) 0 == 
        if{

(******************************** GPWS parameters **************************************)
(***************************************************************************************)
(***************************************************************************************)
10     (&gt;L:GPWS_BasicRALT,number)     (* Basic R-Alt when aircraft on ground (feet) *)
35     (&gt;L:GPWS_BankAngle,number)     (* Max. bankangle for "BankAngle" (degrees)   *)
64     (&gt;L:GPWS_LandingFlaps,number)  (* Min. landing position flaps (%)            *)
                                         (* For Fokker70100: flaps 25 or 42            *)
15     (&gt;L:GPWS_WindChange,number)    (* Max. wind change for "Windshear" (knots)   *)
4      (&gt;L:GPWS_SoundRepTime,number)  (* Sound repetition time (sec.)               *)
900    (&gt;L:GPWS_UpperAlt,number)      (* Upper R-ALT threshold (feet)               *)
250    (&gt;L:GPWS_LowerAlt,number)      (* Lower R-ALT threshold (feet)               *)
-1500  (&gt;L:GPWS_UpperVS_L,number)     (* Upper V/S threshold (ft/min) below UpperAlt*)
-2000  (&gt;L:GPWS_LowerVS_L,number)     (* Lower V/S threshold (ft/min) below UpperAlt*)
-2500  (&gt;L:GPWS_UpperVS_H,number)     (* Upper V/S threshold (ft/min) over UpperAlt *)
-4000  (&gt;L:GPWS_LowerVS_H,number)     (* Lower V/S threshold (ft/min) over UpperAlt *)
-70    (&gt;L:GPWS_GSDev,number)         (* Max. deviation for "Glideslope" (0 - -119) *)
1      (&gt;L:GPWS_DS,number)            (* Master startup state (0: Off  1: On        *)
4      (&gt;L:GPWS_DM1,number)           (* Startup state for Mode-1 warnings:         *)
                                         (*   0: Permanently disabled and invisible    *)
                                         (*   1: Off                                   *)
                                         (*   4: On                                    *)
4      (&gt;L:GPWS_DM2,number)           (* Idem, for Mode-2                           *)
4      (&gt;L:GPWS_DM3,number)           (* Idem, for Mode-3                           *)
4      (&gt;L:GPWS_DM4,number)           (* Idem, for Mode-4                           *)
4      (&gt;L:GPWS_DM5,number)           (* Idem, for Mode-5                           *)
4      (&gt;L:GPWS_DM6,number)           (* Idem, for Mode-6                           *)
4      (&gt;L:GPWS_DM7,number)           (* Idem, for Mode-7                           *)
4      (&gt;L:GPWS_DM8,number)           (* Idem, for Mode-8                           *)
(***************************************************************************************)
(***************************************************************************************)
(***************************************************************************************)

          (P:ABSOLUTE TIME,seconds) 1.0 + (&gt;G:Var2)
        }
        els{
          (P:ABSOLUTE TIME,seconds) (G:Var2) &gt;
          if{
            (L:GPWS_DS,number) 0 ==
            if{ 1 (&gt;G:Var1) }
            els{
              3 (&gt;G:Var1) 
              1 (&gt;G:Var3)
              (G:Var9) (&gt;G:Var4)
              (A:RADIO HEIGHT,feet) (L:GPWS_BasicRALT,number) - (&gt;G:Var5)
              (A:AIRCRAFT WIND Z,knots) (&gt;G:Var6)
              (GEAR HANDLE POSITION,percent) (&gt;G:Var7)
              (L:GPWS_DM1,number) (&gt;L:GPWS_AM1,number)
              (L:GPWS_DM2,number) (&gt;L:GPWS_AM2,number)
              (L:GPWS_DM3,number) (&gt;L:GPWS_AM3,number)
              (L:GPWS_DM4,number) (&gt;L:GPWS_AM4,number)
              (L:GPWS_DM5,number) (&gt;L:GPWS_AM5,number)
              (L:GPWS_DM6,number) (&gt;L:GPWS_AM6,number)
              (L:GPWS_DM7,number) (&gt;L:GPWS_AM7,number) 
              (L:GPWS_DM8,number) (&gt;L:GPWS_AM8,number)
            }
            (P:ABSOLUTE TIME,seconds) (&gt;L:GPWS_STM1,number)
            (P:ABSOLUTE TIME,seconds) (&gt;L:GPWS_STM2,number)
            (P:ABSOLUTE TIME,seconds) (&gt;L:GPWS_STM3,number)
            (P:ABSOLUTE TIME,seconds) (&gt;L:GPWS_STM4,number)
            (P:ABSOLUTE TIME,seconds) (&gt;L:GPWS_STM5,number)
            (P:ABSOLUTE TIME,seconds) (&gt;L:GPWS_STM6,number)
          }
        }
      }
      (A:RADIO HEIGHT,feet) (L:GPWS_BasicRALT,number) - sp0
      l0 20 &gt;
      if{ 0 } els{ 1 } (&gt;G:Var9)
      l0 (L:GPWS_UpperAlt,number) &gt; 
      if{ (L:GPWS_UpperVS_H,number) (&gt;L:GPWS_UpperVS,number) (L:GPWS_LowerVS_H,number) (&gt;L:GPWS_LowerVS,number) }
      els{ (L:GPWS_UpperVS_L,number) (&gt;L:GPWS_UpperVS,number) (L:GPWS_LowerVS_L,number) (&gt;L:GPWS_LowerVS,number) }
    </Value>
  </Select>
</Element>

<!-- State TEST, finished ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_Sound_WWG,number) 0 == &amp;&amp;
      if{ 
        3 (&gt;G:Var1) 
        1 (&gt;G:Var3)
        (G:Var9) (&gt;G:Var4)
        (A:RADIO HEIGHT,feet) (L:GPWS_BasicRALT,number) - (&gt;G:Var5)
        (A:AIRCRAFT WIND Z,knots) (&gt;G:Var6)
        (GEAR HANDLE POSITION,percent) (&gt;G:Var7)
        (L:GPWS_DM1,number) (&gt;L:GPWS_AM1,number)
        (L:GPWS_DM2,number) (&gt;L:GPWS_AM2,number)
        (L:GPWS_DM3,number) (&gt;L:GPWS_AM3,number)
        (L:GPWS_DM4,number) (&gt;L:GPWS_AM4,number)
        (L:GPWS_DM5,number) (&gt;L:GPWS_AM5,number)
        (L:GPWS_DM6,number) (&gt;L:GPWS_AM6,number)
        (L:GPWS_DM7,number) (&gt;L:GPWS_AM7,number) 
        (L:GPWS_DM8,number) (&gt;L:GPWS_AM8,number)
      }
    </Value>
  </Select>
</Element>

<!-- State ON, mode-independant calculations -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 ==
      if{
        l0 (L:GPWS_UpperAlt,number) &gt;
        if{ 1 (&gt;G:Var3) }
        els{
          (G:Var9) ! (G:Var4) &amp;&amp;
          (A:GEAR HANDLE POSITION,percent) 50 &lt; (G:Var7) 50 &gt; &amp;&amp; ||
          if{ 2 (&gt;G:Var3) }
        }
      }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 1 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp; (G:Var3) 1 == &amp;&amp; (L:GPWS_AM1,number) 2 &gt;= &amp;&amp;
      if{
        (A:VERTICAL SPEED, feet per minute) (L:GPWS_LowerVS,number) &lt;
        if{
          (L:GPWS_AM1,number) 4 == if{ 5 (&gt;L:GPWS_AM1,number) }
          (P:ABSOLUTE TIME,seconds) (L:GPWS_STM1,number) &gt; (L:GPWS_AM1,number) 4 &gt;= &amp;&amp;
          if{ 
            1 (&gt;L:GPWS_SOUND_WWP,number)
            (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM1,number)
          }
        }
        els{
          (A:VERTICAL SPEED, feet per minute) (L:GPWS_UpperVS,number) &lt;
          if{
            (L:GPWS_AM1,number) 4 == if{ 5 (&gt;L:GPWS_AM1,number) }
            (P:ABSOLUTE TIME,seconds) (L:GPWS_STM1,number) &gt; (L:GPWS_AM1,number) 4 &gt;= &amp;&amp;
            if{ 
              1 (&gt;L:GPWS_SOUND_S,number)
              (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM1,number)
            }
          }
          els{ 4 (&gt;L:GPWS_AM1,number) }
        }
      }
      els{ (L:GPWS_AM1,number) 3 == (L:GPWS_AM1,number) 5 == || if{ 4 (&gt;L:GPWS_AM1,number) } }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 2 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp; (G:Var3) 1 == &amp;&amp;  (L:GPWS_AM2,number) 2 &gt;= &amp;&amp;
      (A:GEAR HANDLE POSITION,percent) 50 &lt; &amp;&amp;
      (A:FLAPS HANDLE PERCENT,percent) (L:GPWS_LandingFlaps,number) &lt; &amp;&amp;
      if{
        l0 (L:GPWS_LowerAlt,number) &lt;
        l0 (G:Var5) &lt; &amp;&amp;
        if{
          (L:GPWS_AM2,number) 4 == if{ 5 (&gt;L:GPWS_AM2,number) }
          (P:ABSOLUTE TIME,seconds) (L:GPWS_STM2,number) &gt; (L:GPWS_AM2,number) 4 &gt;= &amp;&amp;
          (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
          if{ 
            1 (&gt;L:GPWS_SOUND_WWP,number)
            (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM2,number)
          }
        }
        els{
          l0 (L:GPWS_UpperAlt,number) &lt;
          l0 (G:Var5) &lt; &amp;&amp;
          if{
            (L:GPWS_AM2,number) 4 == if{ 5 (&gt;L:GPWS_AM2,number) }
            (P:ABSOLUTE TIME,seconds) (L:GPWS_STM2,number) &gt; (L:GPWS_AM2,number) 4 &gt;= &amp;&amp;
            (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
            if{ 
              1 (&gt;L:GPWS_SOUND_TT,number)
              (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM2,number)
            }
          }
          els{ 4 (&gt;L:GPWS_AM2,number) }
        }
      }
      els{ (L:GPWS_AM2,number) 3 == (L:GPWS_AM2,number) 5 == || if{ 4 (&gt;L:GPWS_AM2,number) } }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 3 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp; (G:Var3) 2 == &amp;&amp; (L:GPWS_AM3,number) 2 &gt;= &amp;&amp;
      l0 (L:GPWS_UpperAlt,number) &lt;  &amp;&amp;
      if{
        (A:VERTICAL SPEED, feet per minute) 0 &lt;
        if{
          (L:GPWS_AM3,number) 4 == if{ 5 (&gt;L:GPWS_AM3,number) }
          (P:ABSOLUTE TIME,seconds) (L:GPWS_STM3,number) &gt; (L:GPWS_AM3,number) 4 &gt;= &amp;&amp;
          (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
          (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
          if{ 
            1 (&gt;L:GPWS_SOUND_DS,number)
            (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM3,number)
          }
        }
        els{
          l0 (G:Var5) &lt;
          if{
            (L:GPWS_AM3,number) 4 == if{ 5 (&gt;L:GPWS_AM3,number) }
            (P:ABSOLUTE TIME,seconds) (L:GPWS_STM3,number) &gt; (L:GPWS_AM3,number) 4 &gt;= &amp;&amp;
            (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
            if{ 
              1 (&gt;L:GPWS_SOUND_TT,number)
              (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM3,number)
            }
          }
          els{ 4 (&gt;L:GPWS_AM3,number) }
        }
      }
      els{ (L:GPWS_AM3,number) 3 == (L:GPWS_AM3,number) 5 == || if{ 4 (&gt;L:GPWS_AM3,number) } }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 4 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp; (G:Var3) 1 == &amp;&amp; (L:GPWS_AM4,number) 2 &gt;= &amp;&amp;
      l0 (L:GPWS_UpperAlt,number) &lt; &amp;&amp;
      if{
        (A:GEAR HANDLE POSITION,percent) 50 &lt;
        if{
          (L:GPWS_AM4,number) 4 == if{ 5 (&gt;L:GPWS_AM4,number) }
          (A:FLAPS HANDLE PERCENT,percent) (L:GPWS_LandingFlaps,number) &lt;
          if{
            (P:ABSOLUTE TIME,seconds) (L:GPWS_STM4,number) &gt; (L:GPWS_AM4,number) 4 &gt;= &amp;&amp;
            (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM3,number) 5 &lt; &amp;&amp;
            if{ 
              1 (&gt;L:GPWS_SOUND_TLT,number)
              (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM4,number)
            }
          }
          els{
            (P:ABSOLUTE TIME,seconds) (L:GPWS_STM4,number) &gt; (L:GPWS_AM4,number) 4 &gt;= &amp;&amp;
            (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM3,number) 5 &lt; &amp;&amp;
            if{ 
              1 (&gt;L:GPWS_SOUND_TLG,number)
              (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM4,number)
            }
          }
        }
        els{
          (A:FLAPS HANDLE PERCENT,percent) (L:GPWS_LandingFlaps,number) &lt;
          if{
            (L:GPWS_AM4,number) 4 == if{ 5 (&gt;L:GPWS_AM4,number) }
            (P:ABSOLUTE TIME,seconds) (L:GPWS_STM4,number) &gt; (L:GPWS_AM4,number) 4 &gt;= &amp;&amp;
            (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
            (L:GPWS_AM3,number) 5 &lt; &amp;&amp;
            if{ 
              1 (&gt;L:GPWS_SOUND_TLF,number)
              (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM4,number)
            }
          }
          els{ 4 (&gt;L:GPWS_AM4,number) }
        }
      }
      els{ (L:GPWS_AM4,number) 3 == (L:GPWS_AM4,number) 5 == || if{ 4 (&gt;L:GPWS_AM4,number) } }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 5 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp; (G:Var3) 1 == &amp;&amp; (L:GPWS_AM5,number) 2 &gt;= &amp;&amp;
      l0 (L:GPWS_UpperAlt,number) &lt; &amp;&amp;
      (A:NAV1 GSI,number) (L:GPWS_GSDev,number) &lt; &amp;&amp;
      (A:NAV1 GS FLAG, bool) &amp;&amp;
      (A:GEAR HANDLE POSITION,percent) 50 &gt; &amp;&amp;
      (A:FLAPS HANDLE PERCENT,percent) (L:GPWS_LandingFlaps,number) &gt; &amp;&amp;
      if{
        (L:GPWS_AM5,number) 4 == if{ 5 (&gt;L:GPWS_AM5,number) }
        (P:ABSOLUTE TIME,seconds) (L:GPWS_STM5,number) &gt; (L:GPWS_AM5,number) 4 &gt;= &amp;&amp;
        (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM3,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM4,number) 5 &lt; &amp;&amp;
        if{ 
          1 (&gt;L:GPWS_SOUND_G,number)
          (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM5,number)
        }
      }
      els{ (L:GPWS_AM5,number) 3 == (L:GPWS_AM5,number) 5 == || if{ 4 (&gt;L:GPWS_AM5,number) } }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 6 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp;  (L:GPWS_AM6,number) 2 &gt;= &amp;&amp;
      (A:ATTITUDE INDICATOR BANK DEGREES,degrees) abs (L:GPWS_BankAngle,number) &gt; &amp;&amp;
      if{
        (L:GPWS_AM6,number) 4 == if{ 5 (&gt;L:GPWS_AM6,number) }
        (P:ABSOLUTE TIME,seconds) (L:GPWS_STM6,number) &gt; (L:GPWS_AM6,number) 4 &gt;= &amp;&amp;
        (L:GPWS_AM1,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM2,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM3,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM4,number) 5 &lt; &amp;&amp;
        (L:GPWS_AM5,number) 5 &lt; &amp;&amp;
        if{ 
          1 (&gt;L:GPWS_SOUND_BA,number)
          (P:ABSOLUTE TIME,seconds) (L:GPWS_SoundRepTime,number) + (&gt;L:GPWS_STM6,number)
        }
      }
      els{ (L:GPWS_AM6,number) 3 == (L:GPWS_AM6,number) 5 == || if{ 4 (&gt;L:GPWS_AM6,number) } }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 7 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (G:Var9) ! &amp;&amp; (L:GPWS_AM7,number) 4 == &amp;&amp;
      l0 (L:GPWS_UpperAlt,number) &lt; &amp;&amp;
      (A:AIRCRAFT WIND Z,knots) (G:Var6) - abs (L:GPWS_WindChange,number) &gt; &amp;&amp;
      if{ 1 (&gt;L:GPWS_Sound_W,number) }
    </Value>
  </Select>
</Element>

<!-- State ON, mode 8 ? -->
<Element>
  <Select>
    <Value>
      (G:Var1) 3 == (L:GPWS_AM8,number) 2 &gt;= &amp;&amp;
      if{
        (A:GEAR HANDLE POSITION,percent) 50 &gt;
        (A:FLAPS HANDLE PERCENT,percent) (L:GPWS_LandingFlaps,number) &gt; &amp;&amp;
        if{ (A:DECISION HEIGHT,number) 10 / int 10 * } els{ 0 } sp3
        (G:Var5) l0 - 20 &gt; (G:Var5) l0 &lt;= ||  (L:GPWS_AM8,number) 3 &lt;=  ||
        if{ }
        els{ l0   l3 &lt; (G:Var5)   l3 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_M,number) }
        els{ l0   10 &lt; (G:Var5)   10 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_10,number) }
        els{ l0   20 &lt; (G:Var5)   20 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_20,number) }
        els{ l0   30 &lt; (G:Var5)   30 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_30,number) }
        els{ l0   40 &lt; (G:Var5)   40 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_40,number) }
        els{ l0   50 &lt; (G:Var5)   50 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_50,number) }
        els{ l0  100 &lt; (G:Var5)  100 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_100,number) }
        els{ l0  200 &lt; (G:Var5)  200 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_200,number) }
        els{ l0  300 &lt; (G:Var5)  300 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_300,number) }
        els{ l0  400 &lt; (G:Var5)  400 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_400,number) }
        els{ l0  500 &lt; (G:Var5)  500 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_500,number) }
        els{ l0 1000 &lt; (G:Var5) 1000 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_1000,number) }
        els{ l0 2500 &lt; (G:Var5) 2500 &gt; &amp;&amp; if{ 1 (&gt;L:GPWS_Sound_2500,number) }
        } } } } } } } } } } } } }
      }
    </Value>
  </Select>
</Element>

<!-- State ON, mode-independant saving of current values -->
<Element>
  <Select>
    <Value>
      (G:Var9) (&gt;G:Var4)
      l0 (&gt;G:Var5)
      (A:AIRCRAFT WIND Z,knots) (&gt;G:Var6)
      (A:GEAR HANDLE POSITION,percent) (&gt;G:Var7)
    </Value>
  </Select>
</Element>


<!-- Handle mouseclick -->
<Mouse>
  <Area Left="27" Top="2" Right="37" Bottom="12">
    <Cursor Type="DownArrow"/>
    <Tooltip ID="">Decrease DecisionHeight (%((A:DECISION HEIGHT,number) 10 / int 10 *)%!d! Ft)</Tooltip>
    <Click Repeat="Yes">10 (&gt;K:DECREASE_DECISION_HEIGHT) 1 (&gt;L:GPWS_SOUND_CLICK,number)</Click>
  </Area>
  <Area Left="37" Top="2" Right="45" Bottom="12">
    <Tooltip ID="">GPWS3.3</Tooltip>
  </Area>
  <Area Left="45" Top="2" Right="55" Bottom="12">
    <Cursor Type="UpArrow"/>
    <Tooltip ID="">Increase DecisionHeight (%((A:DECISION HEIGHT,number) 10 / int 10 *)%!d! Ft)</Tooltip>
    <Click Repeat="Yes">10 (&gt;K:INCREASE_DECISION_HEIGHT) 1 (&gt;L:GPWS_SOUND_CLICK,number)</Click>
  </Area>
  <Area Left="2" Top="2" Right="22" Bottom="9">
    <Cursor Type="Hand"/>
    <Tooltip ID="">TOGA Mode (%('On' 'Off' 'Disabled' 3 (G:Var3) case )%!s!)</Tooltip>
    <Click>
      (G:Var3) 1 ==
      if{ 2 (&gt;G:Var3) 1 (&gt;L:GPWS_SOUND_CLICK,number) }
      els{
        (G:Var3) 2 ==
        if{ 1 (&gt;G:Var3) 1 (&gt;L:GPWS_SOUND_CLICK,number) }
      }
    </Click>
  </Area>
  <Area Left="60" Top="3" Right="78" Bottom="9">
    <Cursor Type="Hand"/>
    <Tooltip ID="">GPWS Master (%('On' 'Test' 'Off' ' ' 4 (G:Var1) case )%!s!)</Tooltip>
    <Click>
      1 (&gt;L:GPWS_SOUND_CLICK,number)
      (G:Var1) 1 == 
      if{
        2 (&gt;G:Var1)
        1 (&gt;L:GPWS_Sound_WWG,number)
      }
      els{
        (G:Var1) 3 == 
        if{
          1 (&gt;G:Var1)
          0 (&gt;G:Var3)
          0 (&gt;L:GPWS_AM1,number)
          0 (&gt;L:GPWS_AM2,number)
          0 (&gt;L:GPWS_AM3,number)
          0 (&gt;L:GPWS_AM4,number)
          0 (&gt;L:GPWS_AM5,number)
          0 (&gt;L:GPWS_AM6,number)
          0 (&gt;L:GPWS_AM7,number)
          0 (&gt;L:GPWS_AM8,number)
        }
      }
    </Click>
  </Area>
  <Area Left="2" Top="15" Right="9" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-1: Excessive descent rate %('(On)' '(On)' '(On|AuralOff)' '(On|AuralOff)' '(Off)' '(Disabled)' 6 (L:GPWS_AM1,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM1,number) sp3
        (L:GPWS_AM1,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM1,number) 3 == if{ 5 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM1,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM1,number) 5 == if{ 3 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM1,number)
      }
    </Click>
  </Area>
  <Area Left="12" Top="15" Right="19" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-2: Excessive terrain closure rate %('(On)' '(On)' '(On|AuralOff)' '(On|AuralOff)' '(Off)' '(Disabled)' 6 (L:GPWS_AM2,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM2,number) sp3
        (L:GPWS_AM2,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM2,number) 3 == if{ 5 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM2,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM2,number) 5 == if{ 3 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM2,number)
      }
    </Click>
  </Area>
  <Area Left="22" Top="15" Right="29" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-3: Loss of altitude after takeoff %('(On)' '(On)' '(On|AuralOff)' '(On|AuralOff)' '(Off)' '(Disabled)' 6 (L:GPWS_AM3,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM3,number) sp3
        (L:GPWS_AM3,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM3,number) 3 == if{ 5 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM3,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM3,number) 5 == if{ 3 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM3,number)
      }
    </Click>
  </Area>
  <Area Left="32" Top="15" Right="39" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-4: Insufficient terrain clearance %('(On)' '(On)' '(On|AuralOff)' '(On|AuralOff)' '(Off)' '(Disabled)' 6 (L:GPWS_AM4,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM4,number) sp3
        (L:GPWS_AM4,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM4,number) 3 == if{ 5 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM4,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM4,number) 5 == if{ 3 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM4,number)
      }
    </Click>
  </Area>
  <Area Left="42" Top="15" Right="49" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-5: Excessive glideslope deviation %('(On)' '(On)' '(On|AuralOff)' '(On|AuralOff)' '(Off)' '(Disabled)' 6 (L:GPWS_AM5,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM5,number) sp3
        (L:GPWS_AM5,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM5,number) 3 == if{ 5 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM5,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM5,number) 5 == if{ 3 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM5,number)
      }
    </Click>
  </Area>
  <Area Left="52" Top="15" Right="59" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-6: Excessive banking %('(On)' '(On)' '(On|AuralOff)' '(On|AuralOff)' '(Off)' '(Disabled)' 6 (L:GPWS_AM6,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM6,number) sp3
        (L:GPWS_AM6,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM6,number) 3 == if{ 5 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM6,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM6,number) 5 == if{ 3 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM6,number)
      }
    </Click>
  </Area>
  <Area Left="62" Top="15" Right="69" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-7: Windshear %('(On)' '(On)' '(On)' '(On)' '(Off)' '(Disabled)' 6 (L:GPWS_AM7,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM7,number) sp3
        (L:GPWS_AM7,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM7,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM7,number)
      }
    </Click>
  </Area>
  <Area Left="72" Top="15" Right="79" Bottom="28">
    <Cursor Type="Hand"/>
    <Tooltip ID="">MODE-8: Altitude warning %('(On)' '(On)' '(On)' '(On)' '(Off)' '(Disabled)' 6 (L:GPWS_AM8,number) case )%!s!</Tooltip>
    <Click>
      (G:Var1) 3 ==
      if{ 
        (L:GPWS_AM8,number) sp3
        (L:GPWS_AM8,number) 1 == if{ 4 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        (L:GPWS_AM8,number) 4 == if{ 1 sp3 1 (&gt;L:GPWS_SOUND_CLICK,number) }
        l3 (&gt;L:GPWS_AM8,number)
      }
    </Click>
  </Area>

</Mouse>

<!-- Display status bitmaps -->
<Element>
<Position X="59" Y="2"/>
  <Select>
    <Value>(G:Var1)</Value>
    <Case Value="1"> <Image Name="GPWS3_SwitchRed.bmp" ImageSizes="21,8"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_SwitchGreen.bmp" ImageSizes="21,8"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_SwitchOff.bmp" ImageSizes="21,8"/> </Case>
  </Select>
</Element>
<Element>
<Position X="2" Y="2"/>
  <Select>
    <Value>
      (G:Var1) 2 ==
      if{ 2 }
      els{ (G:Var3) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_SwitchOff.bmp" ImageSizes="21,8"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_SwitchAmber.bmp" ImageSizes="21,8"/> </Case>
  </Select>
</Element>
<Element>
<Position X="2" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM1,number) 0 == ! &amp;&amp;
      if{ 5 }
      els{ (L:GPWS_AM1,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="12" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM2,number) 0 == ! &amp;&amp;
      if{ 5 }
      els{ (L:GPWS_AM2,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="22" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM3,number) 0 == ! &amp;&amp;
      if{ 5 }
      els{ (L:GPWS_AM3,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="32" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM4,number) 0 == ! &amp;&amp;
      if{ 5 }
      els{ (L:GPWS_AM4,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="42" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM5,number) 0 == ! &amp;&amp;
      if{ 5 }
      els{ (L:GPWS_AM5,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="52" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM6,number) 0 == ! &amp;&amp;
      if{ 5 }
      els{ (L:GPWS_AM6,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="62" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM7,number) 0 == ! &amp;&amp;
      (L:GPWS_Sound_W,number) ||
      if{ 5 }
      els{ (L:GPWS_AM7,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>
<Element>
<Position X="72" Y="15"/>
  <Select>
    <Value>
      (G:Var1) 2 == (L:GPWS_DM8,number) 0 == ! &amp;&amp;
      (L:GPWS_Sound_M,number) ||
      (L:GPWS_Sound_10,number) ||
      (L:GPWS_Sound_20,number) ||
      (L:GPWS_Sound_30,number) ||
      (L:GPWS_Sound_40,number) ||
      (L:GPWS_Sound_50,number) ||
      (L:GPWS_Sound_100,number) ||
      (L:GPWS_Sound_200,number) ||
      (L:GPWS_Sound_300,number) ||
      (L:GPWS_Sound_400,number) ||
      (L:GPWS_Sound_500,number) ||
      (L:GPWS_Sound_1000,number) ||
      (L:GPWS_Sound_2500,number) ||
      if{ 5 }
      els{ (L:GPWS_AM8,number) }
    </Value>
    <Case Value="1"> <Image Name="GPWS3_ModeS1.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="2"> <Image Name="GPWS3_ModeS2.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="3"> <Image Name="GPWS3_ModeS3.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="4"> <Image Name="GPWS3_ModeS4.bmp" ImageSizes="8,14"/> </Case>
    <Case Value="5"> <Image Name="GPWS3_ModeS5.bmp" ImageSizes="8,14"/> </Case>
  </Select>
</Element>

<Comment>
Design Info: Used local vars
============================
- Var1: Master State (0:Initial 1:Off 2:Test 3:On)
- Var2: Initial timer
- Var3: TOGA mode (0: Disabled  1: Off  2:On)
- Var4: Previous Var9 state
- Var5: Previous corrected RadioAltitude
- Var6: Previous longitudinal windspeed.
- Var7: Previous gear state.
- Var9: Own SIM ON GROUND variable (1: when corrected RadioAltitude less then 20 ft)
- s0:   Current corrected RadioAltitude.
- s1:   Current Absolute time
- s3:   TEMP
- L:GPWS_STM*: Sound repetition timer for Mode*
- L:GPWS_DM*:  Initial state for Mode*
- L:GPWS_AM*:  Actual state for Mode*  (0: Disabled  1:Off  2:On/NotActive/SoundOff 3:On/Active/SoundOff
                                         4:On/NotAvtive/SoundOn  5:On/Active/SoundOn )  
</Comment>

</Gauge>
