A controller for an electrosurgical generator includes an RF inverter, a signal processor, a software compensator, a hardware compensator, and an RF inverter controller. The RF inverter generates an electrosurgical waveform and the signal processor outputs a measured value of at least one of a voltage, a current, or power of the electrosurgical waveform. The software compensator generates a desired value for at least one of the voltage, the current, or the power of the electrosurgical waveform, and the hardware compensator generates a phase shift based on the measured value and the desired value. The RF inverter controller generates a pulse-width modulation (PWM) signal based on the phase shift to control the RF inverter.