<!-- This gauge is for Posky 777 (or other 2 engined aircraft) Autobrake action -->
<Gauge Name="Pky_AutoBrake" Version="1.3">
<copyright>(c)2008 Hiroshi Igami, updated 2009 Jakob Klein</copyright>

<Size X="20" Y="20"/>

<Element>
  <Select>
    <Value> 
(L:PkyAutoBrakeActive, bool) 0 == if{
  <!-- Before Autobrake is On -->
  (L:PkyAutoBrake, enum) 0 &gt; if{
    <!-- NORMAL MODE  -->
    (A:AIRSPEED TRUE,knot) 50 &lt;
    (A:SIM ON GROUND, bool) 1 == 
    &amp; if{
    
    }
    els{
      <!-- When Gear Compression is greater than 50 Will start Autobrake -->
      (A:GEAR ANIMATION POSITION:1,percent) 50 &gt; 
      (A:GEAR ANIMATION POSITION:2,percent) 50 &gt; 
      &amp; if{
        (L:PkyAutoBrake, bool) 1 == if{
          20 (&gt;L:PkyAutoMaxBrake,percent)
        }
        (L:PkyAutoBrake, bool) 2 == if{
          40 (&gt;L:PkyAutoMaxBrake,percent)
        }
        (L:PkyAutoBrake, bool) 3 == if{
          60 (&gt;L:PkyAutoMaxBrake,percent)
        }
        (L:PkyAutoBrake, bool) 4 == if{
          80 (&gt;L:PkyAutoMaxBrake,percent)
        }

        40 (&gt;L:PkyAutobrakeDiscSPD,knot)
        
        1 (&gt;L:PkyAutoBrakeActive, bool)
        (&gt;K:SPOILERS_ON)
        }
    }
  }
  
  (L:PkyAutoBrake, bool) -1 == if{
    <!-- RTO MODE  -->
    (L:PkyAutoBrakeRTOFLAG, bool) 0 == if{
      <!-- Set RTO FLAG to "armed" when faster than 40knots and both throttles are above 70% -->
      (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) 70 &gt; 
      (A:GENERAL ENG THROTTLE LEVER POSITION:2, percent) 70 &gt; ||
      (A:AIRSPEED TRUE,knot) 40 &gt; &amp;&amp;
      if{
        1 (&gt;L:PkyAutoBrakeRTOFLAG, bool)
      }
    }

    <!-- If RTO FLAG is "armed" and there is a throttle surge, trigger RTO autobrake and spoilers-->
    (L:PkyAutoBrakeRTOFLAG, bool) 1 == if{
      (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) 50 &lt; 
      (A:GENERAL ENG THROTTLE LEVER POSITION:2, percent) 50 &lt; || if{
        100 (&gt;L:PkyAutoMaxBrake,bool)
        20 (&gt;L:PkyAutobrakeDiscSPD,knot)
        0 (&gt;L:PkyAutoBrakeRTOFLAG, bool)
        1 (&gt;L:PkyAutoBrakeActive, bool)
        (&gt;K:SPOILERS_ON)
      }
      
      <!-- If aircraft gets airborne, reset RTO mode -->
      (A:SIM ON GROUND, bool) 0 == if{
        0 (&gt;L:PkyAutoBrake, bool)
      }
    }
  }
}

els{
  <!-- When Autobrake is On -->

  <!-- Do Braking -->
  <!-- Left -->
  32768 100 / (L:PkyAutoMaxBrake,percent) (A:BRAKE LEFT POSITION,percent) max * 16383 - (&gt;K:AXIS_LEFT_BRAKE_SET)
  <!-- Right -->
  32768 100 / (L:PkyAutoMaxBrake,percent) (A:BRAKE RIGHT POSITION,percent) max * 16383 - (&gt;K:AXIS_RIGHT_BRAKE_SET)

  <!-- Abort Conditions -->
  <!-- When Speed falls under disconnect speed, cancel Autobrake -->
  (A:AIRSPEED TRUE,knot) (L:PkyAutobrakeDiscSPD,knot) &lt; if{
    0 (&gt;L:PkyAutoBrake, bool)
    0 (&gt;L:PkyAutoBrakeActive, bool)
    -16383 d (&gt;K:AXIS_LEFT_BRAKE_SET) (&gt;K:AXIS_RIGHT_BRAKE_SET)
    (&gt;K:SPOILERS_OFF)
  }
  <!-- When Throttle up means Go Around .. cancel Autobrake -->
  (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) 70 &gt; 
  (A:GENERAL ENG THROTTLE LEVER POSITION:2, percent) 70 &gt; ||
	(L:PkyAutoBrake, bool) -1 != &amp;&amp; if{
    0 (&gt;L:PkyAutoBrake, enum)
    0 (&gt;L:PkyAutoBrakeActive, bool)
    -16383 d (&gt;K:AXIS_LEFT_BRAKE_SET) (&gt;K:AXIS_RIGHT_BRAKE_SET)
    (&gt;K:SPOILERS_OFF)
  } els{
    <!-- When Aircraft hops release Autobrake for antiskid -->
    (A:SIM ON GROUND, bool) 0 == if{
      -16383 d (&gt;K:AXIS_LEFT_BRAKE_SET) (&gt;K:AXIS_RIGHT_BRAKE_SET)
    }
  }
}
    </Value>
  </Select>
</Element>
 
</Gauge>
