<!-- This guage is for Tds 787  for calculating day/Night -->
<Gauge Name="PkyAileronL" Version="1.0">
<copyright>(c)2009 Jakob Klein</copyright>

<Size X="20" Y="20"/>
<Element>
<Select>
<Value> 

(P:ZULU TIME, seconds)  (L:Tds_SEAUpdate, number) 61 +   &gt; if{
 0  (>L:Tds_SEAUpdate, number)
}
els{
(P:ZULU TIME, seconds)  (L:Tds_SEAUpdate, number) 61 -   &lt; if{
 0  (>L:Tds_SEAUpdate, number)
    }
}
(L:Tds_SEAUpdate, number)  (P:ZULU TIME, seconds)  &lt; if{
(P:ZULU TIME, seconds) 60 + (>L:Tds_SEAUpdate, number)

      (P:ZULU TIME, hours) 12 / 3.14159265 * (A:PLANE LONGITUDE, radians) + 3.14159265 - (>G:Var1)
      -0.40927971 360 365 / (P:ZULU DAY OF YEAR, number) 10 + * 180 / 3.14159265 * cos * (>G:Var2)
      (A:PLANE LATITUDE, radians) (>G:Var3)
      (G:Var1) cos (G:Var2) cos * (G:Var3) cos * (G:Var2) sin (G:Var3) sin * + asin 
      3.14159265 / 180 *
      (>L:PkySEA, number)

      (L:PkySEA, number) 6 &lt; if{
        1  (>L:TdsDUSKVISIBLE, number)
      }
      els{
        0  (>L:TdsDUSKVISIBLE, number)
      }
      
      (L:PkySEA, number) 7.5 &lt; if{
        1  (>L:TdsLandingSplash, number)
        1  (>L:TdsTaxiSplash, number)
        1  (>L:TdsLogoSplash, number)
      }
      els{
        0  (>L:TdsLandingSplash, number)
        0  (>L:TdsTaxiSplash, number)
        0  (>L:TdsLogoSplash, number)
      }
}




(L:Tds_CabinLightAUTO,bool) 1 == if{
   (A:PLANE ALT ABOVE GROUND, feet) 2000 &gt; if{
      (L:PkySEA, number) 7.5 &lt; if{
        1
      }
      els{
        0
      }
   }
   els{
      (A:SIM ON GROUND, bool) 1 == if{

         (A:AIRSPEED INDICATED,knot) 25 &lt;
         (A:TRAILING EDGE FLAPS LEFT PERCENT,percent) 0 == &amp;  if{
            (L:PkySEA, number) 7.5 &lt; if{
              1
            }
            els{
              0
            }
         }
         els{
            0
         }
      }
      els{
         0
      }
   }
   (>L:Tds_CabinLight, number)
}


</Value>
</Select>
</Element>  
</Gauge>
