A control device for controlling a power converter that is configured to be a part of an AC microgrid, the control device comprising a data processing system configured to: - form a frequency droop value (Δf droop) based on data (U DC, I DC) indicative of electric power (p act) of the power converter, the frequency droop value (Δf droop) being a product (αp act) of a value of electric power (p act) of the power converter and a drooping coefficient (α), - change a frequency control value (f c) by the frequency droop value, the frequency droop value decreasing the frequency control value when a power flow direction is outwards from alternating voltage terminals of the power converter, - form a power control value (Δf pc) based on data indicative of a target value (p ref) of the electric power, the power control value (Δf pc) being a product (αp ref) of the target value (p ref) of the electric power and the drooping coefficient (α), - change the frequency control value by the power control value, the power control value increasing the frequency control value when the target value of the electric power corresponds to the power flow direction outwards from the alternating voltage terminals of the power converter, - deliver the frequency control value to the power converter so as to control alternating voltage frequency of the power converter, and - compute a time integral of an error value proportional to a difference (p ref - p act) between the target value of the electric power and the electric power, and to correct the frequency control value with a correction value (Δf corr) dependent on the time integral of the error value, wherein the data processing system is configured to constitute a proportional and integrative controller, and the error value is an input value of the proportional and integrative controller and the correction value is an output value of the proportional and integrative controller, wherein the data processing system is configured to limit a rate of change of the power control value (Δf pc) to be at most a predetermined upper limit of the rate of change. - form a frequency droop value (Δf droop) based on data (U DC, I DC) indicative of electric power (p act) of the power converter, the frequency droop value (Δf droop) being a product (αp act) of a value of electric power (p act) of the power converter and a drooping coefficient (α), - change a frequency control value (f c) by the frequency droop value, the frequency droop value decreasing the frequency control value when a power flow direction is outwards from alternating voltage terminals of the power converter, - form a power control value (Δf pc) based on data indicative of a target value (p ref) of the electric power, the power control value (Δf pc) being a product (αp ref) of the target value (p ref) of the electric power and the drooping coefficient (α), - change the frequency control value by the power control value, the power control value increasing the frequency control value when the target value of the electric power corresponds to the power flow direction outwards from the alternating voltage terminals of the power converter, - deliver the frequency control value to the power converter so as to control alternating voltage frequency of the power converter, and - compute a time integral of an error value proportional to a difference (p ref - p act) between the target value of the electric power and the electric power, and to correct the frequency control value with a correction value (Δf corr) dependent on the time integral of the error value,