Using MATLAB to Design the PID Controller for Buck Converter

In this tutorial, I will show you how to design a PID controller on Buck converter. MATLAB and PLECS blockset will be used for this tutorial.

The PLECS blockset is used to extract the small-signal control-to-output response of our Buck converter. The output of this step is not the final transfer function that we need for PID tuning instead it is a bode plot of our Buck converter circuit.

To get the transfer function of control-to-output, we will use MATLAB to fit the bode plot data into a transfer function. After that, we can use that transfer function on PID tuning. Below are the steps.

  1. Open MATLAB Simulink then create the Buck converter schematic.

2. Start the Impulse Response Analysis block. Some parameters must be changed based on our Buck converter circuit.

  • System period length: 1/(PWM frequency) = 1/100e3
  • Frequency sweep range: [10 25000], can be set as you want
  • Number of points: 100, a higher number will make the graphs more smoother but will consume more computation
  • Output variable: converter, can be set as you want. It is just the name of the computational results

3. To estimate a transfer function for the obtained data we need to use the System Identification Toolbox. We use the H=frd(converter.G,2*pi*converter.F) command on our converter output result.

4. Now, we can estimate a transfer function for the frd object H by using the vo_d=tfest(H,2) command.

5. The vo_d variable contains the small signal control-to-output transfer function of our Buck converter. The pidTuner(vo_d) command is used to design a PID controller for our Buck converter.

6. At this point we know the Ki=35,79. The PID controller block can be added to our Buck converter circuit.

7. We can check the command tracking of the PID controller by using a step input from 5V to 8V as the reference voltage. The controller will force the converter to follow this change at the output voltage.

It is also good to check the dynamic stiffness of the converter by varying the load and the input voltage.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *