Optimum control of PWM rectifiers for magnet supply