PID Basics

## PID Introduction

Proportional, Integral and Derivative (PID) values can be used to control power conversion systems using the feedback control loop. Before discussing the details of PID control, the figure below shows a functional block diagram of a home heating temperature control system using a feedback control loop.

The plant is the physical heating and cooling part of the system. The setpoint measures variables within the plant, the error is the difference between the response of the plant and the desired response, i.e. setpoint. For example, the current temperature is 65 degrees, the thermostat is set to 70 degrees. The resulting error = setpoint - current = 70 - 65 = 5 degrees. The controller is the most significant element of the control system. The controller is responsible for several tasks and is the link that connects together all of the physical and non-physical elements. It measures the output signal of the Plant’s Sensors, processes the signal and then derives an error based on the signal measurement and the set point. Once the sensor data has been collected and processed, the result must be used to find PID values, which then must be sent out to the Plant for error correction. The rate at which all of this happens is dependent upon the Controller’s processing power. This may or may not be an issue depending on the response characteristic of the Plant. A temperature control system is much more forgiving on a Controller’s processing capabilities than a motor control system.

#### PID as a Power Converter Controller

The figure below shows the high level block diagram of the power converter system using PID. The first diagram can be found on System Transfer Functions page. The second diagram collapses the two blocks, PWM generator and power stage, into one only, called Process (or Plant, from the previous example).

#### PID in dsPIC® DSC

In dsPIC® DSC, the PID controller is made up of three basic blocks, see figure below:

• Proportional: the output is proportional to the input
• Integral: the output is the integral of the input
• Derivative: the output is the derivative of the input.

Although there are a number of ways these blocks can be interconnected, we will investigate the most traditional technique where the three blocks are connected in parallel as in the figure above.

The PID is inserted in the block diagram representing a system. The goal of the PID block is to generate an output u(t) that drives the system we have at hand (the Process or Plant) so that its output y(t) matches a reference signal x(t). The input to the PID is the error between the reference signal (ideal or desired behavior of the Plant) and the real output. The target is to operate in such a way as to get an error that is as close to zero as possible, using the feedback control loop.

#### PID Equation

PID Equations are shown in the figure below. The new PID output value, e.g., the new active PWM period value, is computed as the sum of the previous time value plus the correction term that takes into consideration of the three values of error, i.e., the current value; the value of the previous sampling period and the error value two sampling periods prior. The PID control loop weights them with the coefficient that have been previously computed, and eventually calculates the future value of the duty cycle.