A method of controlling a power converter , connected to an electrical grid, to mimic a synchronous generator, the method being performed by a control system , wherein the method comprises: determining a frequency control error with respect to a setpoint frequency (f set ) and an actual frequency (f act ) of the power converter , determining an input power to an inertia model of a synchronous generator based on the frequency control error, which inertia model mimics the inertia of a synchronous generator, regulating by means of the input power a rotational frequency (f) of the inertia model, determining a voltage control error with respect to a setpoint voltage (U set ) and an actual voltage (U act ) output by the power converter , determining an exciter parameter of a synchronous generator model based on the voltage control error, regulating by means of the exciter parameter an output voltage (U) of the synchronous generator model, and controlling the power converter based on the rotational frequency (f) and on the output voltage (U), wherein the control system includes processing circuitry and a storage medium , wherein a plurality of functional blocks implemented by computer-executable components is included in the storage medium , wherein the functional blocks include a speed governor block , and an inertia model block including the inertia model, which is a mathematical model of the inertia of a synchronous generator, and wherein the method is characterised by comprising: changing the characteristics of the functional blocks adaptively in real time to make the control system-controlled power converter mimic the characteristics of conventional generators to enhance the ability to maintain synchronism during line faults. determining a frequency control error with respect to a setpoint frequency (f set ) and an actual frequency (f act ) of the power converter , determining an input power to an inertia model of a synchronous generator based on the frequency control error, which inertia model mimics the inertia of a synchronous generator, regulating by means of the input power a rotational frequency (f) of the inertia model, determining a voltage control error with respect to a setpoint voltage (U set ) and an actual voltage (U act ) output by the power converter , determining an exciter parameter of a synchronous generator model based on the voltage control error, regulating by means of the exciter parameter an output voltage (U) of the synchronous generator model, and controlling the power converter based on the rotational frequency (f) and on the output voltage (U), wherein the control system includes processing circuitry and a storage medium , wherein a plurality of functional blocks implemented by computer-executable components is included in the storage medium , wherein the functional blocks include a speed governor block , and an inertia model block including the inertia model, which is a mathematical model of the inertia of a synchronous generator, and wherein the method is characterised by comprising: changing the characteristics of the functional blocks adaptively in real time to make the control system-controlled power converter mimic the characteristics of conventional generators to enhance the ability to maintain synchronism during line faults. <EOS>