A control device for an inverter, the control device implementing a model of a synchronous generator, wherein said inverter is controlled based on parameters calculated using said model so as to behave like a conventional synchronous generator, wherein said model comprising: variables representing the angular position and rotational speed of a virtual generator rotor, logic for calculating a virtual electromagnetic torque acting on the virtual generator rotor from measured inverter output current and from a variable representing a virtual excitation current, logic for calculating the rotational speed of the virtual rotor from the virtual electromagnetic torque and from at least one variable representing a virtual drive torque applied to the virtual generator rotor, and from a parameter J representing the rotor's virtual inertia wherein the moment of inertia J is chosen as the product of the time constant τ g of a frequencey drooping loop and a damping factor D p that behaves as a frequency drooping coefficient, and logic for calculating, from the variables representing angular position and rotational speed of the virtual generator rotor and from the variable representing the excitation current, a control signal for controlling the inverter to produce an AC output which corresponds to that of the virtual synchronous generator, the control device further comprising logic which implements a first feedback loop in which deviation of the rotational speed of the virtual generator rotor from a reference rotational speed is detected and used to adjust the virtual drive torque, thereby to regulate the angular speed of the virtual generator rotor, and hence to regulate frequency of the AC output from the inverter and the real power supplied by the inverter. variables representing the angular position and rotational speed of a virtual generator rotor, logic for calculating a virtual electromagnetic torque acting on the virtual generator rotor from measured inverter output current and from a variable representing a virtual excitation current, logic for calculating the rotational speed of the virtual rotor from the virtual electromagnetic torque and from at least one variable representing a virtual drive torque applied to the virtual generator rotor, and from a parameter J representing the rotor's virtual inertia wherein the moment of inertia J is chosen as the product of the time constant τ g of a frequencey drooping loop and a damping factor D p that behaves as a frequency drooping coefficient, and logic for calculating, from the variables representing angular position and rotational speed of the virtual generator rotor and from the variable representing the excitation current, a control signal for controlling the inverter to produce an AC output which corresponds to that of the virtual synchronous generator, the control device further comprising logic which implements a first feedback loop in which deviation of the rotational speed of the virtual generator rotor from a reference rotational speed is detected and used to adjust the virtual drive torque, thereby to regulate the angular speed of the virtual generator rotor, and hence to regulate frequency of the AC output from the inverter and the real power supplied by the inverter.