Non linear optimal control of braking resistors for power stability improvement