A method for controlling an electrical power converter comprising: providing a switch in the electrical power converter, connected in line with the input voltage of the electrical power converter to control current through the electrical power converter; providing a controller implementing an inverted peak-valley control algorithm to regulate current through the electrical power converter; determining an instantaneous input voltage of the electrical power converter using an input voltage sensor; determining an instantaneous output voltage of the electrical power converter using an output voltage sensor; dynamically adjusting a duty cycle limit of the electrical power converter to be equal to one minus a numerator divided by a denominator, where the numerator is the instantaneous input voltage minus a compensation factor and where the denominator is the instantaneous output voltage, the duty cycle limit corresponding to the maximum percentage of "on time" that the controller can command the electrical power converter to be on in a given cycle; applying the duty cycle limit to a pulse width modulation -PWM- to control switching of the switch and to reduce the ripple on the output voltage of the electrical power converter; wherein the compensation factor is a derivative with respect to time of an instantaneous commanded current multiplied by a compensation constant, the instantaneous commanded current corresponding to the current desired through an inductor of the electrical power converter in order to achieve a desired output voltage from the electrical power converter; and wherein the compensation constant is determined by an inductance value of the inductor of the electrical power converter; wherein in the inverted peak-valley control algorithm, the switch is turned ON once the actual current through the electrical power converter is less than the commanded current and the remaining time in the PWM cycle is below the duty cycle limit of the converter. providing a switch in the electrical power converter, connected in line with the input voltage of the electrical power converter to control current through the electrical power converter; providing a controller implementing an inverted peak-valley control algorithm to regulate current through the electrical power converter; determining an instantaneous input voltage of the electrical power converter using an input voltage sensor; determining an instantaneous output voltage of the electrical power converter using an output voltage sensor; dynamically adjusting a duty cycle limit of the electrical power converter to be equal to one minus a numerator divided by a denominator, where the numerator is the instantaneous input voltage minus a compensation factor and where the denominator is the instantaneous output voltage, the duty cycle limit corresponding to the maximum percentage of "on time" that the controller can command the electrical power converter to be on in a given cycle; applying the duty cycle limit to a pulse width modulation -PWM- to control switching of the switch and to reduce the ripple on the output voltage of the electrical power converter; wherein the compensation factor is a derivative with respect to time of an instantaneous commanded current multiplied by a compensation constant, the instantaneous commanded current corresponding to the current desired through an inductor of the electrical power converter in order to achieve a desired output voltage from the electrical power converter; and wherein the compensation constant is determined by an inductance value of the inductor of the electrical power converter; wherein in the inverted peak-valley control algorithm, the switch is turned ON once the actual current through the electrical power converter is less than the commanded current and the remaining time in the PWM cycle is below the duty cycle limit of the converter.