Software resources

  File Modified
File PR_controller.slx This file contains the PR control block only May 06, 2020 by Nicolas Cherix
ZIP Archive This file contains a complete control example using Simulink Aug 06, 2020 by Benoît Steinmann

Operating principles

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 their gains cannot be set high enough to avoid a steady-state error.

A well-known countermeasure to this shortcoming is the implementation of the PI controller(s) within a rotating reference frame (dq), which allows to re-locate the (almost) infinite DC gain at the desired frequency. More information is given in:

Alternatively, proportional resonant controllers (PR) have attracted significant interest for AC current/voltage control applications due to the simplicity of their implementation, notably for single-phase systems.

In essence, proportional resonant (PR) controllers are usually designed such that the controller transfer function is similar to:

\begin{array}{l}\displaystyle G_{C}(s)=K_{p}+\displaystyle\frac{2K_{i}s}{s^{2}+\omega_{0}^{2}}\end{array}

where \begin{array}{l}\omega_0\end{array} designates the target reference current frequency. In this expression, the denominator term \begin{array}{l}s^{2}+\omega_{0}^{2}\end{array} creates infinite control gain at \begin{array}{l}\omega_{0}\end{array}.

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:

\begin{array}{l}\displaystyle 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}}\end{array}

were \begin{array}{l}\omega_{c}\end{array} designates the resonant cut-off frequency (i.e. width of the resonant filter). In this second expression, the gain at \begin{array}{l}\omega_{0}\end{array} is now finite, but still high enough for enforcing a sufficiently small steady-state error. Interestingly, the widening of the bandwidth around \begin{array}{l}\omega_{0}\end{array} also offer increased tolerance towards slight frequency deviations, such as in most practical grid-tied applications.

Digital 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 \begin{array}{l}T_s\end{array}, yields:

\begin{array}{l}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}}} \text{ with } \begin{cases} a_1=4K_{i}T_{s}\omega_{c}\\ b_0=T_{s}^2(\omega_{0}^2+2\omega_{c})+4\\ b_1=2T_{s}^2(\omega_{0}^2+2\omega_{c})-8\\ b_2=b_0 \end{cases}\right.\end{array}

Once transformed into a difference equation, the resonant part yields:

\begin{array}{l}\displaystyle 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)]\end{array}

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 \begin{array}{l}\omega_{c}\end{array}. The side figure illustrates the tuning of the proposed PR controller with various values of the resonant gain, with Kp=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 provides 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, PR 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(), named ConfigPrController().

  • A run-time function, meant to be called during the user-level ISR, such as UserInterrupt(), named RunPrController().

The necessary parameters are documented within the controller.h header file. They are namely:

  • Kp and Ki, proportional and integral gain, respectively.

  • wres, which is the nominal frequency (center of the resonant term, in rad/s.), as well as wdamp, 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;

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;
tUserSafe UserInterrupt(void)
	//... some code
	Evsi = Vgrid + RunPrController(&mycontroller, Igrid_ref - Igrid);
	//... some code
	return SAFE;

The included file provides a Simulink block that uses the above-presented implementation. This block can then easily be integrated with run-time configurable parameters:

The configuration mask is shown below. Typical parameters are also indicated:


The first graphs show the grid voltage and the stabilized value of the grid pulsation:

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 measured grid current matches perfectly the given reference:

A jump of current reference has been performed in both simulation and experimental modes. 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.

  • No labels