Go to start of banner

# Introduction

This technical note presents a possible current control implementation for power converters.

First, the note introduces the general operating principles of a simple Proportional-Integral controller. Then, an example of current control for a boost converter is provided.

Finally, a practical control implementation is introduced, targeting the B-Box RCP or B-Board PRO with both C/C++ and automated code generation approaches.

# General principles

PI controllers are widely used in power electronics, thanks to their simple structure and implementation. They are very frequently used to control constant or slowly-varying quantities, e.g. in direct current (DC) applications, as well as in AC applications together with coordinate transformations.

When implemented in a parallel form, a PI controller can be represented as shown below: In practice, Pi controllers constitute rather a family that can be extended to alternative configurations, e.g. :

# DC current control example

The simplest and most obvious example of PI-base control is certainly given by the control of the inductor current within a boost-type converter. In this system, basic circuit equations show that the inductor current is given by:

In the Laplace domain, this translates into:

## System-level modeling

A widely-accepted model for the proposed system is shown below. Four distinct parts can be clearly identified. ### Plant

The inductor is modeled as:

### Measurements

The measurements of the current $//$and the voltages $//$and $//$are generally modeled using a low-pass filter approximation, or they are neglected. The sampling corresponds to a zero-order hold (ZOH) which introduces a lag, which is the sampling delay.

### Control

The control algorithm consists of a digital PI controller followed by some basic mathematic operations to compute the duty cycle. The whole algorithm requires a certain amount of computation time, which is represented as a delay.

### Modulation

The Pulse-Width Modulation (PWM) is also generally modeled as a simple delay.

## Digital implementation

The three most common implementations  of the PI controller are the following:

The parameter $//$ correspond to the period of the interruption. The advantages/disadvantages of these different discretizations are well discussed in . The Forward Euler will be used in this note, and the corresponding difference equation is given below.

These equations can be easily used for generating run-time code.

## Tuning and performance evaluation

Different methods are used in the literature to determine the parameters of a PI controller. Those methods are well detailed and explained in . In this note, the Magnitude Optimum (MO) will be used.

The goal of the MO is to make the frequency response from reference to the plant output as close to one as possible for low frequencies. The controller parameters are defined as:

The parameter $//$ represents the sum of all the small delays in the system, such as the sampling delay or the modulation delay mentioned above. The product note PN142: Time delay determination for closed-loop control explains how to determine the total delay of the system.

 Karl J. Åström and Tore Hägglund; “Advanced PID Control”; 1995
 Dew Toochinda; "Discrete-time PID Controller Implementation"; SciLab.org; 2015

# 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, PI controllers are based on:

• A pseudo-object PIDcontroller, which contains pre-computed parameters as well as state variables.

• A configuration function, meant to be called during UserInit(), named ConfigPIDController().

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

#include "../API/controllers.h"
PIDController mycontroller;

float Kp = 13.64;
float Ki = 120.00;
float limup = 500;
float limlow = -500;

tUserSafe UserInit(void)
{
//... some code
ConfigPIDController(&mycontroller, Kp, Ki, 0, limup, limlow, SAMPLING_PERIOD, 0);
//... some code
return SAFE;
}
tUserSafe UserInterrupt(void)
{
//... some code
UL_ref = RunPIController(&mycontroller, Ib_ref - Ib);
//... some code
return SAFE;
}

The enclosed file provides an implementation example of the whole control loop, including a PI controller. Of course, the standard "Discrete PID Controller" block can also be used.  ## PLECS implementation

The included file for PLECS also provides a PI block. The default PI block of the PLECS library can also be used.  ## Results

The PI current control was tested in the case of a boost converter connected to a resistive load.

A current reference step was performed in both simulation (with Simulink) and experimental modes. The following graph shows a comparison between both results: 