<!-- This guage is for TDS 787 Other action   -->
<Gauge Name="TdsFlaps" Version="1.0">
<copyright>(c)2007 Hiroshi Igami</copyright>

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

<!-- HUD -->
100  (A:EXIT OPEN:0, percent) - 
(>L:Tds_HUD_PCT, number)


<!-- APU DOOR  -->

(L:TdsGPULINEShow, bool) 1 == 
(L:TdsEGShow,bool)       1 ==  || if{
   0
}
els{
   (A:GEAR ANIMATION POSITION:0,percent) 2 *
}
(>L:TdsAPUDoor, percent)

<!--787 Air-con Deflector door Action-->
(A:GEAR ANIMATION POSITION:0,percent) 2 *
(>L:TdsB8DEFLECTOR_DOOR, percent)

<!--787 Heat Exchanger Exhaust door Action-->
(A:GEAR ANIMATION POSITION:0,percent) 2 *
(>L:TdsB8HEAT_EXH, percent)

<!--Outflowdoor Action-->
(A:GEAR ANIMATION POSITION:0,percent) 2 *
(>L:TdsOUTFLOWDOOR, percent)

<!-- Wing Inspection Light Assign -->
(A:LIGHT WING, bool) 1 == if{
       1  (>L:TdsWING_INSP_LIGHT_BULB, number)
}
els{
       0  (>L:TdsWING_INSP_LIGHT_BULB, number)
}

<!--787 GND N2GEN door Action-->
(A:GENERAL ENG RPM:1,rpm) 1000 &lt; 
(A:GENERAL ENG RPM:2,rpm) 1000 &lt; 
(A:ELECTRICAL MAIN BUS VOLTAGE, volts) 0 &gt; &amp; &amp; if{
   100
}
els{
   0
}
(>L:TdsB8N2GEN_INTAKE, percent)


<!--Towhead Action-->

(A:TURN COORDINATOR BALL, percent)  (L:Tds_PB_Towtarget, percent) &lt; if{
         (L:Tds_PB_Towtarget, percent) 1 - 
         (>L:Tds_PB_Towtarget, percent)
}
(A:TURN COORDINATOR BALL, percent)   (L:Tds_PB_Towtarget, percent) &gt; if{
         (L:Tds_PB_Towtarget, percent) 1 + 
         (>L:Tds_PB_Towtarget, percent)
}
(L:Tds_PB_Towtarget, percent)

(A:PUSHBACK STATE, Enum) -1 &gt;
   (A:PUSHBACK STATE, Enum) 3  &lt;   &amp;  if{
}
els{
      -0.5 * 
}
(>L:Tds_PB_Towhead, degree)



<!--787 TEVC Animation -->

<!--ON CRUISE ? -->
<!-- At CRUISE MODE    -->
(A:VELOCITY WORLD Y, number) 1 &lt;
(A:VELOCITY WORLD Y, number) -1 &gt;  &amp;    if{
    <!-- Altitude Higher then 25000    -->
    <!-- Speed Higher then 0.54   -->
    <!-- Speed Lower  then 0.87    -->
   (A:PLANE ALTITUDE, feet) 24950 &gt;
   (A:AIRSPEED MACH, number)  0.539 &gt;
   (A:AIRSPEED MACH, number)  0.871 &lt;  &amp;  &amp; if{
        1
   }
   els{
        0
   }
}
els{
        0
}
(>L:TdsB8TEVC_ON, number)





<!--INCASE User changed time  -->
   (P:ZULU TIME, minute)  (L:Tds_TEVCUpdate, number) 60 +   &gt; if{
      0  (>L:Tds_TEVCUpdate, number)
   }
   els{
        (P:ZULU TIME, minute)  (L:Tds_TEVCUpdate, number) 60 -   &lt; if{
            0  (>L:Tds_TEVCUpdate, number)
        }  
   }


(L:TdsB8TEVC_ON, number) 1 == if{
   <!-- Check if it's time to move TEVC  -->
   (L:Tds_TEVCUpdate, number)  (P:ZULU TIME, minute)  &lt; if{
        <!--SET TEVC Action  -->
    
        <!-- Inboard is plus minus 1.5 degrees -->
        (A:ELEVATOR TRIM PCT,percent) -1 *  (>L:Tds_TEVCELEVTARGET, number)
        (A:ELEVATOR TRIM PCT,percent) -16.666 /  -3 MAX 3 min
         (>L:Tds_TEVCFLAP_INB_TARGET, number)

        <!-- Flaperon plus minus 1.0 degrees plus 1.5 degrees -->
        (A:ELEVATOR TRIM PCT,percent) -16.666 /  -2 MAX 3 min
         (>L:Tds_TEVCFLAPERON_TARGET, number)
         
        <!-- Outboard FlapFlaperon minus 0.5 degrees plus 1.5 degrees -->
        (A:ELEVATOR TRIM PCT,percent) -16.666 /  -1 MAX 3 min
         (>L:Tds_TEVCFLAP_OUTB_TARGET, number)

         (P:ZULU TIME, minute) 60 + (>L:Tds_TEVCUpdate, number)  

   }
}
els{
   0 (>L:Tds_TEVCELEVTARGET, number)
   0 (>L:Tds_TEVCFLAP_INB, number)
   0 (>L:Tds_TEVCFLAPERON, number)
   0 (>L:Tds_TEVCFLAP_OUTB, number)
   0  (>L:Tds_TEVCUpdate, number)
}


<!--787 TEVC Animation Driver -->

<!-- ELEVATOR -->
(L:Tds_TEVCELEV, number)  (L:Tds_TEVCELEVTARGET, number) &gt; if{
           (L:Tds_TEVCELEV, number) 1 - (>L:Tds_TEVCELEV, number)
}
(L:Tds_TEVCELEV, number)  (L:Tds_TEVCELEVTARGET, number) &lt; if{
           (L:Tds_TEVCELEV, number) 1 + (>L:Tds_TEVCELEV, number)
}
<!-- Inboard Flap -->
(L:Tds_TEVCFLAP_INB, number)  (L:Tds_TEVCFLAP_INB_TARGET, number) &gt; if{
           (L:Tds_TEVCFLAP_INB, number) 0.1 - (>L:Tds_TEVCFLAP_INB, number)
}
(L:Tds_TEVCFLAP_INB, number)  (L:Tds_TEVCFLAP_INB_TARGET, number) &lt; if{
           (L:Tds_TEVCFLAP_INB, number) 0.1 + (>L:Tds_TEVCFLAP_INB, number)
}
<!-- Flaperon -->
(L:Tds_TEVCFLAPERON, number)  (L:Tds_TEVCFLAPERON_TARGET, number) &gt; if{
           (L:Tds_TEVCFLAPERON, number) 0.1 - (>L:Tds_TEVCFLAPERON, number)
}
(L:Tds_TEVCFLAPERON, number)  (L:Tds_TEVCFLAPERON_TARGET, number) &lt; if{
           (L:Tds_TEVCFLAPERON, number) 0.1 + (>L:Tds_TEVCFLAPERON, number)
}

<!-- Outboard Flap -->
(L:Tds_TEVCFLAP_OUTB, number)  (L:Tds_TEVCFLAP_OUTB_TARGET, number) &gt; if{
           (L:Tds_TEVCFLAP_OUTB, number) 0.1 - (>L:Tds_TEVCFLAP_OUTB, number)
}
(L:Tds_TEVCFLAP_OUTB, number)  (L:Tds_TEVCFLAP_OUTB_TARGET, number) &lt; if{
           (L:Tds_TEVCFLAP_OUTB, number) 0.1 + (>L:Tds_TEVCFLAP_OUTB, number)
}



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