A method and apparatus for controlling a power supply. The system includes a power supply and a controller for outputting a command signal to regulate the operation of the power supply. The controller determines the command signal based on at least one error signal which is selected from a plurality of error signals based on a selection criterion.