*Click here for the enhanced PDF version of this article including diagrams and/or equations.*

Compensation of switching power supplies is an essential element of proper and robust power design. The recent introduction of digital pulse-width modulation (PWM) controllers has introduced the concept of using a digital proportional-integral-derivative (PID) filter for the voltage-loop compensation rather than a traditional Type III analog implementation.

Digital PID filters have programmable coefficients to control the relative contributions of the error signal, the integral of the error signal and the derivative of the feedback error signal. Designers who typically move poles and zeros to achieve compensation may struggle with relating these nonintuitive digital PID parameters to what they observe on Bode plots.

The nonintuitive nature of digital compensation can be overcome by working with a new set of PID filter coefficients that are expressed as gain, Q and frequency terms. These new, more-intuitive coefficients were developed by analyzing a digital compensator in the analog domain. Designers can use the new coefficients to compensate a digitally controlled power converter visually using a network analyzer.

In so doing, designers can take advantage of the digital PID filter’s unique ability to compensate output filters that have high Q. The process of optimizing compensation can be sped up further by using a simulation tool that automatically calculates optimum PID filter coefficients.

**Analog Compensation**

A simplified power converter is illustrated in Fig. 1. The converter consists of a PWM controller with a fixed modulation gain (GFIX), high-side and low-side switches, an output stage consisting of an inductor and one or more capacitors, a load, and a feedback or control loop. In this case, the feedback control is shown as a Type III amplifier, but could be any feedback controller. The purpose of the control loop is to compare the output to a known reference (VREF) and adjust the PWM signal to correct for differences between the output and the reference.

A robust, practical power system maintains stability in the presence of disturbances such as input-voltage changes, load changes and even temperature changes. The stability of a system can be characterized in terms of how closely the gain through the feedback path approaches a gain of -1, under the conditions of interest. Because the feedback has both a magnitude component and a phase component relative to the output, stability can be expressed in terms of gain margin and phase margin. The gain margin is a measure of how close the gain magnitude is relative to unity when the phase is 180 degrees. The phase margin is how close the phase is relative to 180 degrees when the gain is unity.

Both the phase and gain margins can be determined from either a Nyquist diagram or a Bode plot. Because the Bode plot has an easily read frequency scale, it is a convenient tool and will be used here.

Without feedback, the simplified transfer function of the system in Fig. 1 is given by:

where vESR is the location of the zero due to the ESR of the output capacitor, vN is the natural frequency of the output stage and Q is the quality factor of the output stage.

For the purpose of this discussion, the contribution of the zero determined by the ESR of the capacitor will be ignored, and the focus will be on poles of the remainder of the transfer function (GS):

This equation has two poles. For Q < 0.5 (damped case), both poles are real; for Q > 0.5 (underdamped case), the poles are complex conjugates.

As the sum of the last two terms in the denominator approach -1, the denominator approaches zero and the transfer function (and, thus, the entire system) becomes unstable. Compensation is the process of adding feedback to the system to adjust the response so that the transfer function remains stable. In this case, feedback is added, which provides zeros to compensate for the poles of the power converter’s transfer function.

In the Type III analog approach using discrete resistors and capacitors, only real zeros are available for compensating the power converter’s transfer function. The challenge for compensation using the typical analog Type III approach is that, for high-Q applications, the power-converter poles are complex. Trying to match real zeros to complex power-converter poles can be nearly impossible, and may ultimately result in a less-than-ideal performance.

**Digital Compensation**

While digital control offers the ability to introduce sophisticated compensation schemes, the focus here will be on a simple digital PID filter (Fig. 2). This digital filter takes the error signal, sums the scaled signal with scaled delayed samples of the error signal, plus the integrated output to implement the compensator. Three gain coefficients are used to tune this compensator.

In the s domain, this filter has a transfer function given by:

where A, B and C are the gain coefficients for the various taps. The first term in the denominator is the delay in the signal path, the second term in the denominator is the accumulator at the output of the summing stage and T is the period of the (inverse of the switching frequency) PWM.

This compensator is seen to have two zeros, a pole at zero and a pole at infinity. The two zeros are available to compensate for the two poles in the output stage of the power converter. These zeros arise as solutions to the quadratic equation in the numerator.

As such, depending on the values of A, B and C, there can be two real zeros or a pair of complex-conjugate zeros. Therefore, the digital PID compensator gives not only the same real zeros as a Type III analog compensator, but also complex zeros, which are more suitable for compensating complex poles.

Using pole-zero matching, the A, B and C coefficients can be combined into a gain term, GC , a Q term, QC , and a frequency term, fC , to facilitate matching the corresponding characteristics of the output stage. Once the transfer function of the digital compensator is realized in terms of GC , QC and fC , a visual method can be used to compensate the power converter.

**Power Converter Characteristics**

In Fig. 3, the Bode plot of this equation, with GFIX equal to 5 and vN equal to 16 kHz, is shown for the Q values of 10, 1 and 0.4. In this plot, the phase is shown relative to 180 degrees, so that phase margin can be read directly by observing the phase curve’s value at the frequency where the gain is unity. A typical minimum acceptable phase margin is 45 degrees. This level is indicated by the dotted line on the phase graph.

The unity-gain (0 dB) crossover frequency for all three cases ranges from 30 kHz to 40 kHz. As can be readily seen, the phase margin for the high-Q (> 0.5, underdamped) cases are below the 45-degree limit. Because of the marginal or even unacceptable phase margins for this power converter, compensation is needed to adjust the system response to a more stable condition.

The power converter can be observed and characterized using a network analyzer to generate the Bode plot. In high-Q systems, the resonant peak in the power converter can be readily identified. The characteristic frequency is determined by observing where the peak of the resonance occurs along the frequency axis.

The value for Q can be determined from the height (or depression) of the resonant (or anti-resonant) point (Fig. 4). The low-frequency asymptote defines a reference value for gain. The intersection of the low-frequency asymptote and the high-frequency asymptote occurs at the reference frequency. The Q value (in decibels) that produces each curve is found by taking the difference between the value of the curve at the reference frequency and the reference value for gain. In the cases illustrated in Fig. 4, a Q of 10 appears as a 20-dB peak and a Q of 0.4 appears as a depression of -8 dB.

**Figuring the Results**

As an example, take the situation where the power converter’s output filter Q value is 8 and the resonant frequency is 23.17 kHz. The left graph in Fig. 5 shows what would be seen on a network analyzer if the compensator were not matched to the power converter. In this case, the compensator has been set to a Q value of 3 and a resonant frequency of 1 kHz.

The first step in the process is to identify the power-converter characteristic frequency and Q. The peak can be seen to be at 23 kHz (agreeing with the established value). The peak looks to be roughly 20 dB in height. A resonant peak of 20 dB is equivalent to a Q of 10.

The next step is to reposition the compensator frequency and Q value to align with the power converter. Using the new values for the compensator frequency and Q, new values of A, B and C are computed and the filter response is updated to reflect the influence of the new values for these gain coefficients. The updated response is shown in the middle graph in Fig. 5. Although the phase margin (77 degrees) and gain margin (19 dB) are more than adequate in terms of compensation, it does appear from the dip in the magnitude line of the Bode plot at 23 kHz that the new compensator has too much Q (leading to anti-resonance).

A methodical reduction in the compensator’s Q value will reveal that a Q of 8 provides a nearly ideal response. These results are shown in the Bode plot in the right frame of Fig. 5. Therefore, the new values represent a nearly perfect solution for the compensation.

As an aside, it is interesting to take a look at the original coefficients A, B and C and compare them to the final coefficients. Originally, A, B and C were 166606, -332300 and 165736, respectively. The final values are 325, -594 and 310, respectively. Without the visual information provided by the Bode plots and the translation of the PID coefficients into gain, Q and frequency, it would have been difficult to intuitively perceive that the changes in the coefficients would produce the desired results.

**Model-Based Solutions**

If the power-converter model is adequately characterized in terms of discrete components, then the optimal compensation terms can be rapidly generated using optimization software. Fig. 6 shows a software tool, CompZL, that performs this function.

In this tool, once the model is entered, the target values for gain margin, phase margin and crossover frequency are entered. When the “optimize” button is activated, the software computes the values for GC , QC and fC , and provides the closest fit to the target margin values defined by the design goals.

The advantage of a model-based compensation tool is that parameters can be varied to simulate real-world variations in order to explore the sensitivity of the compensation network. In addition, such a software tool allows easy conversion from GC, QC and fC into A, B and C for the purpose of quickly reconfiguring the digital filter.

Transformation of the PID coefficients from their intrinsic values representing proportions of error, integral, and differential contributions to values representing gain, Q and frequency make visual compensation adjustment both useful and edifying.