a combined power supply and charging method includes controlling switching from a motor power supply mode to an energy storage charging mode on an electrical network and vice versa , and compensating for magnetic fields during the energy storage charging mode in order to limit or eliminate movements of a rotor of the motor .