Decentralized energy generators that feed electrical energy in the grid can enhance its power quality if a grid-connected inverter is used. If the actual current does not fully use the inverter's current capability, the inverter may be given the additional task of power quality improvement. A control strategy for sinusoidal mains voltages is introduced that can easily be added to the active power control of the inverter.