A method of controlling an inverter for converting a DC input to an AC output, the method including: measuring a voltage of an AC output produced by the inverter; determining a drive voltage for controlling the inverter; and if a difference in amplitude and/or phase between the drive voltage and the measured voltage exceeds a predetermined threshold, modifying the drive voltage to reduce the difference in amplitude and/or phase between the drive voltage and the measured voltage, wherein: the measured voltage is converted into a measured voltage vector representative of the measured voltage in a reference frame; the drive voltage is provided as a drive voltage vector representative of the drive voltage in the reference frame; and the method includes, if a difference between the drive voltage vector and the measured voltage vector in the reference frame exceeds a pre-determined threshold, modifying the drive voltage vector to reduce the difference between the drive voltage vector and the measured voltage vector in the reference frame and characterised in that the predetermined threshold is not a fixed value and is selected from one of a plurality of predetermined thresholds, wherein the measured voltage is a multi-phase voltage and the measured current is a multi-phase current and wherein there is a respective threshold for each phase of the multi-phase measured current, and the multi-phase drive voltage is modified according to which phase of the multi-phase measured current has exceeded its respective threshold. measuring a voltage of an AC output produced by the inverter; determining a drive voltage for controlling the inverter; and if a difference in amplitude and/or phase between the drive voltage and the measured voltage exceeds a predetermined threshold, modifying the drive voltage to reduce the difference in amplitude and/or phase between the drive voltage and the measured voltage, wherein: the measured voltage is converted into a measured voltage vector representative of the measured voltage in a reference frame; the drive voltage is provided as a drive voltage vector representative of the drive voltage in the reference frame; and the method includes, if a difference between the drive voltage vector and the measured voltage vector in the reference frame exceeds a pre-determined threshold, modifying the drive voltage vector to reduce the difference between the drive voltage vector and the measured voltage vector in the reference frame and characterised in that the predetermined threshold is not a fixed value and is selected from one of a plurality of predetermined thresholds, wherein the measured voltage is a multi-phase voltage and the measured current is a multi-phase current and wherein there is a respective threshold for each phase of the multi-phase measured current, and the multi-phase drive voltage is modified according to which phase of the multi-phase measured current has exceeded its respective threshold. the measured voltage is converted into a measured voltage vector representative of the measured voltage in a reference frame; the drive voltage is provided as a drive voltage vector representative of the drive voltage in the reference frame; and the method includes, if a difference between the drive voltage vector and the measured voltage vector in the reference frame exceeds a pre-determined threshold, modifying the drive voltage vector to reduce the difference between the drive voltage vector and the measured voltage vector in the reference frame and characterised in that the predetermined threshold is not a fixed value and is selected from one of a plurality of predetermined thresholds, wherein the measured voltage is a multi-phase voltage and the measured current is a multi-phase current and wherein there is a respective threshold for each phase of the multi-phase measured current, and the multi-phase drive voltage is modified according to which phase of the multi-phase measured current has exceeded its respective threshold.