A method for controlling an energy conversion system, the system comprising a rotating electrical machine, a machine-side converter, a DC-link, and a grid-side converter, the method comprising:
- modulating the machine-side converter to convert an AC voltage of the rotating electrical machine into a DC voltage supplied to the DC-link;
- and
- modulating the grid-side converter to convert a DC-link voltage at the DC-link into an AC output voltage to be supplied to an electrical grid;
- wherein the machine-side converter is modulated with first optimized pulse patterns, which have been optimized such that a peak value of the DC-link voltage or of a DC-link voltage component of the DC-link voltage is constrained to a predetermined value.