<?xml version="1.0"?>


<!--
    Usable with FlightGear
    Copyright Gerard Robin  31-03-2009
    Under License:  GPL v2
-->


<system name="Brake-system">

  <channel name="Brake-channel">

      <pure_gain name="systems/brakes/l-coeff-eff">
          <input>fcs/gear-l-dynamic_friction_coeff</input>
          <gain>-0.40</gain>
     </pure_gain>

     <pure_gain name="systems/brakes/r-coeff-eff">
         <input>fcs/gear-r-dynamic_friction_coeff</input>
         <gain>-0.40</gain>
     </pure_gain>

      <switch name="systems/brakes/brake-eff">
          <default value="1"/>
          <test logic="OR" value="0">
              accelerations/n-pilot-x-norm lt systems/brakes/l-coeff-eff
              accelerations/n-pilot-x-norm lt systems/brakes/r-coeff-eff
          </test>
     </switch>

     <pure_gain name="systems/brakes/left-brake-value">
	 <input>systems/gear/left-brake-cmd-norm</input>
         <gain>systems/brakes/brake-eff</gain>
     </pure_gain>

     <switch name="systems/brakes/left-brake-cmd-norm">
         <default value="0"/>
         <test value="1">
	     fcs/brake-parking-cmd-norm  == 1
         </test>
         <test value="systems/brakes/left-brake-value">
             fcs/brake-parking-cmd-norm  != 1
         </test>
	 <output>fcs/left-brake-cmd-norm</output>
     </switch>

     <pure_gain name="systems/brakes/right-brake-value">
         <input>systems/gear/right-brake-cmd-norm</input>
         <gain>systems/brakes/brake-eff</gain>
     </pure_gain>

     <switch name="systems/brakes/right-brake-cmd-norm">
         <default value="0"/>
         <test value="1">
             fcs/brake-parking-cmd-norm  == 1
         </test>
         <test value="systems/brakes/right-brake-value">
            fcs/brake-parking-cmd-norm   != 1
         </test>
         <output>fcs/right-brake-cmd-norm</output>
     </switch>


  </channel>

</system>
