<Gauge Name="L188 ADI" Version="1.0">
  <Image Name="ADI_Background.bmp" Luminous="Yes" ImageSizes="260,260"/>

   <Element>
	<Select>
	<Value>(A:AUTOPILOT MASTER, bool) 0 == (A:AUTOPILOT HEADING LOCK, bool) &amp;&amp; if{ 1 (&gt;A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) (A:Plane heading degrees gyro,degrees) (A:Autopilot heading lock dir,degrees) - s3 l3 180 &gt; if{ l3 360 - -1 * (&gt;L:FD GDI Needle, percent) } els{ l3 -180 &lt; if{ l3 360 + -1 * (&gt;L:FD GDI Needle, percent) } els{ l3 -1 * (&gt;L:FD GDI Needle, percent) } } }</Value>
	</Select>
   </Element>
   <Element>
	<Select>
	<Value>(A:AUTOPILOT MASTER, bool) 0 == (A:AUTOPILOT HEADING LOCK, bool) 0 == &amp;&amp; if{ (A:AUTOPILOT APPROACH HOLD, bool) (A:AUTOPILOT NAV1 LOCK, bool) (A:AUTOPILOT BACKCOURSE HOLD, bool) || || if{ (L:NAV Selector, enum) 2 != if{ 1 (&gt;A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) (A:NAV1 CDI, number) 6.35 / (&gt;L:FD GDI Needle, percent) } els{ 1 (&gt;A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) (A:NAV2 CDI, number) 6.35 / (&gt;L:FD GDI Needle, percent) } } els{ 0 (&gt;A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) } }</Value>
	</Select>
   </Element>

   <Element>
	<Select>
	<Value>(A:AUTOPILOT MASTER, bool) 0 == if{ (A:AUTOPILOT APPROACH HOLD, bool) (A:AUTOPILOT BACKCOURSE HOLD, bool) (AUTOPILOT ALTITUDE LOCK, bool) (L:AP VS Switch, bool) (L:AP IAS Switch, bool) (L:AP Mach Switch, bool) || || || || || if{ 1 (&gt;L:FD GSI on, bool) (AUTOPILOT ALTITUDE LOCK, bool) if{ (A:Autopilot altitude lock var, feet) (A:Indicated Altitude,feet) - s0 l0 200 / (&gt;L:FD GSI Needle, percent) } (A:AUTOPILOT APPROACH HOLD, bool) (A:AUTOPILOT BACKCOURSE HOLD, bool) || if{ (L:NAV Selector, enum) 2 != if{ (A:NAV1 GSI, number) 8 / (&gt;L:FD GSI Needle, percent) } els{ (A:NAV2 GSI, number) 8 / (&gt;L:FD GSI Needle, percent) } } (L:AP VS Switch, bool) if{ (L:Current Vertspeed, percent) (A:Vertical speed,feet per minute) - s1 l1 100 / (&gt;L:FD GSI Needle, percent) } (L:AP IAS Switch, bool) if{ (L:Current Speedhold, percent) (A:Airspeed select indicated or true,knots) - (&gt;L:FD GSI Needle, percent) } (L:AP Mach Switch, bool) if{ (L:Current Machhold, percent) (A:Airspeed mach, machs) - s2 l2 50 * (&gt;L:FD GSI Needle, percent) } } els{ 0 (&gt;L:FD GSI on, bool) } }</Value>
	</Select>
   </Element>
   <Element>
	<Select>
	<Value>(A:AUTOPILOT MASTER, bool) if{ 1 (&gt;A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) 1 (&gt;L:FD GSI on, bool) (A:Autopilot flight director pitch, degrees) (A:Attitude indicator pitch degrees, degrees) - (&gt;L:FD GSI Needle, percent) (A:Autopilot flight director bank, degrees) (A:Attitude indicator bank degrees, degrees) - /-/ (&gt;L:FD GDI Needle, percent) }</Value>
	</Select>
   </Element>


   <Element>
	<Position X="0" Y="0"/>
	<MaskImage Name="ADI_Mask.bmp" ImageSizes="260,260">
	<Axis X="130" Y="124"/>
	</MaskImage>
	<Image Name="ADI_Ladder.bmp" Luminous="Yes" ImageSizes="280,668">
	<Axis X="140" Y="334"/>
	</Image>
	<Shift>
	<Value Minimum="-90" Maximum="90">(A:CIRCUIT AVIONICS ON, bool) (L:ADI Test Mode,bool) || if{ (A:Attitude indicator pitch degrees,degrees) /-/ } els{ 15 }</Value>
	<Scale Y="2.8"/>
	</Shift>
	<Failures>
	<GAUGE_GYRO_HEADING Action="Freeze"/>
	</Failures>
	<Rotate>
	<Value>(A:CIRCUIT AVIONICS ON, bool) (L:ADI Test Mode,bool) || if{ (A:Attitude indicator bank degrees,radians) } els{ 45 }</Value>
	</Rotate>
   </Element>

   <Element>
	<Image Name="ADI_GS_Needle.bmp" Luminous="Yes" ImageSizes="10,15">
	<Axis X="0" Y="0"/>
	</Image>
	<Shift>
	<Value Minimum="-1" Maximum="1">(A:CIRCUIT AVIONICS ON, bool) (L:ADI Test Mode,bool) || if{ (L:NAV Selector, enum) 2 != if{ (A:NAV1 GSI, number) 120 / } els{ (A:NAV2 GSI, number) 120 / } } els{ 0 }</Value>
	<Nonlinearity>
	<Item Value="-1" X="227" Y="78"/>
	<Item Value="0" X="227" Y="117"/>
	<Item Value="1" X="227" Y="157"/>
	</Nonlinearity>
	<Delay PixelsPerSecond="20"/>
	</Shift>
   </Element>

   <Element>
	<Position X="215" Y="94"/>
	<Visible>(L:NAV Selector, enum) 2 != (A:Nav1 HAS GLIDE SLOPE, bool) 0 == &amp;&amp; (L:NAV Selector, enum) 2 == (A:Nav2 HAS GLIDE SLOPE, bool) 0 == &amp;&amp; || (A:CIRCUIT AVIONICS ON, bool) 0 == (A:CIRCUIT GENERAL PANEL ON, bool) 0 == || ||</Visible>
	<Image Name="ADI_GS_Off-Flag.bmp" Luminous="Yes" ImageSizes="22,48">
	</Image>
   </Element>

   <Element>
	<Image Name="ADI_FS_Needle.bmp" Luminous="Yes" ImageSizes="17,17">
	<Axis X="0" Y="0"/>
	</Image>
	<Shift>
	<Value Minimum="-50" Maximum="50">(A:CIRCUIT AVIONICS ON, bool) (L:ADI Test Mode,bool) || if{ (A:Airspeed select indicated or true, knots) (L:IAS Set Value, percent)  - } els{ 0 }</Value>
	<Nonlinearity>
	<Item Value="-50" X="21" Y="71"/>
	<Item Value="0" X="23" Y="117"/>
	<Item Value="50" X="23" Y="165"/>
	</Nonlinearity>
	<Delay PixelsPerSecond="20"/>
	</Shift>
   </Element>

   <Element>
	<Position X="22" Y="136"/>
	<Visible>(A:CIRCUIT AVIONICS ON, bool) 0 == (L:ADI Test Mode,bool) 0 == &amp;&amp;</Visible>
	<Image Name="ADI_FS_Off-Flag.bmp" Luminous="Yes" ImageSizes="23,46">
	</Image>
   </Element>

   <Element>
	<Position X="44" Y="121"/>
	<Image Name="ADI_ownship.bmp" Luminous="Yes" ImageSizes="172,31"/>
   </Element>

   <Element>
	<Position X="130" Y="124"/>
	<Image Name="ADI_Skypointer.bmp" Luminous="Yes" ImageSizes="8,13">
	<Axis X="4" Y="80"/>
	</Image>
	<Rotate>
	<Value Minimum="-0.78" Maximum="0.78">(A:Attitude indicator bank degrees,radians)</Value>
	</Rotate>
	<Delay DegreesPerSecond="90"/>
   </Element>

   <Element>
	<Position X="0" Y="0"/>
	<MaskImage Name="ADI_FD_Barsmask.bmp" ImageSizes="260,260">
	<Axis X="37" Y="124"/>
	</MaskImage>
	<Image Name="ADI_FD_Barshor.bmp" Luminous="Yes" ImageSizes="140,21">
	<Axis X="0" Y="0"/>
	</Image>
	<Shift>
	<Value>(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) if{ (L:FD GSI Needle, percent) 15 min -15 max } els{ -20 }</Value>
	<Nonlinearity>
	<Item Value="-20" X="0" Y="-113"/>
	<Item Value="-15" X="0" Y="-90"/>
	<Item Value="0" X="0" Y="-2"/>
	<Item Value="15" X="0" Y="68"/>
  	</Nonlinearity>
	<Delay PixelsPerSecond="80"/>
	</Shift>
   </Element>

   <Element>
	<Position X="0" Y="0"/>
	<MaskImage Name="ADI_FD_Barsmask.bmp" ImageSizes="260,260">
	<Axis X="130" Y="17"/>
	</MaskImage>
	<Image Name="ADI_FD_Barsvert.bmp" Luminous="Yes" ImageSizes="28,155">
	<Axis X="0" Y="0"/>
	</Image>
	<Shift>
	<Value>(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) 1 == if{ (L:FD GDI Needle, percent) 20 min -20 max } els{ 25 }</Value>
	<Nonlinearity>
	<Item Value="-20" X="-80" Y="0"/>
	<Item Value="0" X="-2" Y="0"/>
	<Item Value="20" X="82" Y="0"/>
	<Item Value="25" X="95" Y="0"/>
	</Nonlinearity>
	<Delay PixelsPerSecond="80"/>
	</Shift>
    </Element>

    <Element>
	<Position X="171" Y="34"/>
	<Visible>(A:CIRCUIT AVIONICS ON, bool) 0 == (L:ADI Test Mode,bool) 0 == &amp;&amp;</Visible>
	<Image Name="ADI_FD_Off-Flag.bmp" Luminous="Yes" ImageSizes="37,43">
	</Image>
    </Element>

    <Element>
	<Position X="53" Y="30"/>
	<Visible>(A:CIRCUIT AVIONICS ON, bool) 0 == (A:CIRCUIT GENERAL PANEL ON, bool) 0 == || (L:ADI Test Mode,bool) 0 == &amp;&amp;</Visible>
	<Image Name="ADI_Att_Off-Flag.bmp" Luminous="Yes" ImageSizes="43,46">
	</Image>
    </Element>

    <Element>
	<Image Name="ADI_Loc_Needle.bmp" Luminous="Yes" ImageSizes="16,9">
	<Axis X="0" Y="0"/>
	</Image>
	<Shift>
	<Value Minimum="-0.2" Maximum="0.2">(A:CIRCUIT AVIONICS ON, bool) (L:ADI Test Mode,bool) || if{ (L:NAV Selector, enum) 2 != if{ (A:NAV1 CDI, number) 127 / } els{ (A:NAV2 CDI, number) 127 / } } els{ 0 }</Value>
	<Nonlinearity>
	<Item Value="-0.2" X="92" Y="196"/>
	<Item Value="0" X="122" Y="196"/>
	<Item Value="0.2" X="153" Y="196"/>
	</Nonlinearity>
	<Delay PixelsPerSecond="20"/>
	</Shift>
    </Element>

    <Element>
	<Position X="138" Y="200"/>
	<Visible>(L:NAV Selector, enum) 2 != (A:NAV1 HAS LOCALIZER, bool) 0 == &amp;&amp; (L:NAV Selector, enum) 2 == (A:NAV2 HAS LOCALIZER, bool) 0 == &amp;&amp; || (A:CIRCUIT AVIONICS ON, bool) 0 == || (L:ADI Test Mode,bool) 0 == &amp;&amp;</Visible>
	<Image Name="ADI_Loc_Off-Flag.bmp" Luminous="Yes" ImageSizes="72,17">
	</Image>
    </Element>

    <Element>
	<Image Name="ADI_Ball.bmp" Luminous="Yes" ImageSizes="10,10">
	<Axis X="0" Y="0"/>
	</Image>
	<Shift>
	<Value Minimum="-1" Maximum="1">(A:Turn coordinator ball,position)</Value>
	<Nonlinearity>
	<Item Value="-1" X="100" Y="235"/>
	<Item Value="0" X="125" Y="238"/>
	<Item Value="1" X="151" Y="235"/>
	</Nonlinearity>
	<Delay PixelsPerSecond="20"/>
	<Failures>
	<GAUGE_TURN_COORDINATOR Action="Freeze"/>
	</Failures>
	</Shift>
    </Element>

    <Element>
	<Position X="119" Y="232"/>
	<Image Name="ADI_Ball_Cover.bmp" ImageSizes="23,18">
	</Image>
    </Element>

    <Element>
	<Select>
	<Value>(L:Test_Var,number) (P:Local Time, seconds) &lt; (L:ADI Test Mode,bool) 1 == &amp;&amp; if{ 0 (&gt;L:ADI Test Mode,bool) 0 (&gt;L:Test_Var,number) }</Value>
	</Select>
    </Element>

    <Element>
     <Position X="220" Y="220"/>
      <Select>
         <Value>(L:NAV Selector, enum)</Value>
         <Case Value="0">
            <Image Name="Nav_Split.bmp" Luminous="YES" ImageSizes="39,37"/>
         </Case>
         <Case Value="1">
            <Image Name="Nav_Nav1.bmp" Luminous="YES" ImageSizes="39,37"/>
         </Case>
         <Case Value="2">
            <Image Name="Nav_Nav2.bmp" Luminous="YES" ImageSizes="39,37"/>
        </Case>
      </Select>
    </Element>

    <Mouse>
	<Area Left="8" Right="258" Top="8" Bottom="215">
	  <Help ID="HELPID_GAUGE_ATTITUDE_INDICATOR"/>
	  <Tooltip ID="TOOLTIPTEXT_ATTITUDE_INDICATOR_BANK_PITCH"/>
	</Area>

	<Area Left="8" Right="48" Top="216" Bottom="250">
	  <Tooltip>Push to Test</Tooltip>
	  <Cursor Type="Hand"/>
	  <Click>(P:Local Time, seconds) 0.99 + (&gt;L:Test_Var,number) + 1 (&gt;L:ADI Test Mode,bool)</Click>
	</Area>

	<Area Left="218" Right="258" Top="216" Bottom="257">      
	  <Tooltip>Autopilot HSI NAV Selector</Tooltip>
        <Cursor Type="Hand"/>
        <Click>(L:NAV Selector, enum) ++ d 2 > if{ 0 } (>L:NAV Selector, enum)</Click>
	</Area>

    </Mouse>
</Gauge>
