Proportional resonant controller
Table of Contents
This article presents the basic theory of operation of a proportional resonant controller, as well as introduces its use for the control of single-phase voltage source inverters.
What is a proportional resonant controller?
A proportional resonant controller (abbreviated PR controller), is a particular type of transfer function that is often implemented for the closed-loop control of systems with a sinusoidal behavior. As their name indicates, they possess both a proportional and a resonant term, which can be tuned independently.
In power electronics, proportional resonant controllers (PR) have attracted significant interest for single-phase AC current/voltage control applications due to their performance and simple implementation.
Indeed, in DC applications, conventional PI controllers provide excellent performance, notably a minimal steady-state error, thanks to the (almost) infinite DC gain provided by the integral control action. However, in AC applications, PI controllers inevitably present a delayed tracking response, because finite gains cannot prevent steady-state error.
A well-known countermeasure to this shortcoming is the implementation of the control within a synchronous reference frame. This means that PI controller(s) are implemented inside a rotating reference frame (dq), which is synchronized with the AC frequency (e.g. of the grid or the electric motor, see TN106). This allows re-locating the (almost) infinite DC gain at the desired frequency, namely 50/60Hz (or the motor rotating speed).
Proportional resonant controllers offer an alternative to this conventional approach. As they operate directly in the stationary reference frame, no coordinate transformations are required. Furthermore, their resonant term offers a finite, but very high, gain at the targeted AC frequency, which achieves the same tracking and perturbation rejection capabilities as dq-control.
In single-phase systems, the fact that no Park transformation is needed is a significant benefit since the formulation of the direct and quadrature axes is not obvious (see TN124 on fictive axis emulation).
Operating principles of proportional resonant control
In essence, proportional resonant (PR) controllers are usually designed such that the controller transfer function is similar to:
$$ G_{C}(s)=K_{p}+\displaystyle\frac{2K_{i}s}{s^{2}+\omega_{0}^{2}} $$
where \(\omega_0\) designates the target reference current frequency. In this expression, the denominator term \(s^{2}+\omega_{0}^{2}\) creates infinite control gain at \(\omega_0\).
Practically, this expression may be difficult to implement into a digital controller, which is why a more practical alternative is to introduce some damping around the resonant frequency, resulting in:
$$ G_{C}(s)=G_{Cp}(s)+G_{Cr}(s)=K_{p}+\displaystyle\frac{2K_{i}\omega_{c}s}{s^{2}+2\omega_{c}s+\omega_{0}^{2}} $$
were \(\omega_c\) designates the resonant cut-off frequency (i.e. width of the resonant filter). In this second expression, the gain at \(\omega_0\) is now finite, but still high enough for enforcing a sufficiently small steady-state error. Interestingly, the widening of the bandwidth around \(\omega_0\) also offer increased tolerance towards slight frequency deviations, such as in most practical grid-tied applications.
Proportional resonant digital control implementation
A practical implementation can be easily derived using the bilinear (Tustin) transform. The resulting discrete transfer function for the resonant term, discretized with a period \(T_s\), yields:
$$ G_{Cr}(z) = \displaystyle \frac{Y(z)}{E(z)} = \displaystyle \frac{a_{1}(1-z^{-2})}{b_{0}+b_{1}z^{-1}+b_{2}z^{-2} } \quad\text{ with }\quad
\begin{array}{l}
a_1=4K_{i}T_{s} \omega_{c} \\
b_0=T_{s}^2\omega_{0}^2+4T_{s}\omega_{c}+4 \\
b_1=2T_{s}^2\omega_{0}^2-8 \\
b_2=T_{s}^2\omega_{0}^2-4T_{s}\omega_{c}+4
\end{array} $$
Once transformed into a difference equation, the resonant part yields:
$$y(k)=\displaystyle\frac{1}{b_0}[a_{1}\cdot e(k)-a_{1}\cdot e(k-2)-b_{1}\cdot y(k-1)-b_{2}\cdot y(k-2)]$$
This difference equation can be easily used for generating run-time code. Notably, a possible implementation on Simulink is given below. A similar implementation is given in [1].

Tuning and performance evaluation
Proportional resonant controllers can be relatively easily tuned using the controller gains as well as the width of the resonant filter \(\omega_c\). The side figure illustrates the tuning of the proposed resonant controller with various values of the resonant gain, with \(K_p=15\). Further details regarding the tuning can notably be found in [2].

Academic references
[1] R. Teodorescu, F. Blaabjerg, M. Liserre and P. C. Loh, “Proportional resonant controllers and filters for grid-connected voltage-source converters,” in IEE Proc. on Electr. Power Appl., Vol. 153, N°. 5, Sep. 2006.
[2] D. G. Holmes, T. A. Lipo, B. P. McGrath and W. Y. Kong, “Optimized Design of Stationary Frame Three Phase AC Current Regulators,” in IEEE Trans. on Pow. Elec., Nov. 2009.
B-Box / B-Board implementation
C/C++ code
The imperix IDE gives access to a library containing numerous pre-written and pre-optimized functions. Controllers such as P, PI, PID and PR are already available and can be found in the controllers.h/.cpp
files.
As for all controllers, proportional resonant controllers are based on:
- A pseudo-object
PRcontroller
, which contains pre-computed parameters as well as state variables. - A configuration function, meant to be called during
UserInit()
, namedConfigPrController()
. - A run-time function, meant to be called during the user-level ISR, such as
UserInterrupt()
, namedRunPrController()
.
The necessary parameters are documented within the controller.h header file. They are namely:
Kp
andKi
, proportional and integral gain, respectively.wres
, which is the nominal frequency (center of the resonant term, in rad/s.), as well aswdamp
, the “width” of the resonant term (limits the quality factor of the resonant term).tsample
, corresponding to the sampling (interrupt) period.

Implementation example
#include "../API/controllers.h"
PrController mycontroller; #resonant controller object
float Kp = 10.0;
float Kr = 500.0;
float w0 = TWO_PI*50.0;
float wc = 10.0;
tUserSafe UserInit(void)
{
ConfigPrController(&mycontroller, Kp, Kr, w0, wc, SAMPLING_PERIOD);
return SAFE;
}
Code language: C++ (cpp)
tUserSafe UserInterrupt(void)
{
//... some code
Evsi = Vgrid + RunPrController(&mycontroller, Igrid_ref - Igrid);
//... some code
return SAFE;
}
Code language: C++ (cpp)
Simulink
The Simulink model provided above contains a subsystem that uses the above-presented resonant controller implementation. This block can easily be integrated into any control algorithm. Besides, the provided dialog box offers simple configuration parameters.


Experimental results
In order to illustrate the performance of the proposed PR controller implementation, current control results are shown below.
The first graph row shows the grid voltage and the stabilized value of the grid pulsation. The significantly distorted waveform of the voltage available at imperix premises can be easily noticed. Also, the small remaining oscillations on the grid pulsation (<0.4% of the nominal value) are an expected consequence of the finite loop gain of the SOGI block at the fundamental frequency.

The next row shows the measured grid current. As it can be seen, the current perfectly matches the given reference.

A current reference step is then performed in both simulation (red) and experimental modes (blue). The following graphs show a comparison between both results:

In simulation, a small overshoot can be observed on the current. This can be explained by the fact that the isolation transformer is not taken into account (modeled) in simulation. Indeed, the transformer increases the total inductance between the converter and the grid, which in turn increases the inertia of the system.