Understanding PID Commands for Beginners
In this beginner-level tutorial, we will cover the basic purpose and terminology associated with PID (Proportional, Integral, Derivative) control.
The entire world of industrial control is filled with changes and variations in both environments and process materials. Control systems must have a way to handle these changes with something better than hoping in the luck that a machine will be resistant to these changes. One of the most common ways of adjusting signal outputs based on actual conditions is an equation built into a function that we call a PID controller.
Introduction: What is the Purpose of PID Control?
If you drive a car, you are already using PID control, whether you realize it or not.
Let's say you have just started your car and wish to drive at 40 mph. If you immediately slam down on the gas pedal and keep holding it down, you will easily get up to speed, but then quickly exceed the target 40 mph. You instinctively know that you must gradually increase your speed and stop pressing the gas pedal at some point before reaching 40 mph.
To maintain a constant 40 mph as you drive down the road, you will sometimes give the car a little gas, sometimes a bit more, sometimes not at all, and sometimes you will brake, all in accordance with curves, hills, and obstacles.
This scenario illustrates the principle behind PID control. In general, PID control is used in situations where you want a process to achieve and maintain a certain value in a smooth and controlled manner, even when the environment is changing.

Figure 1. Driving a car illustrates the principle behind PID control. Image used courtesy of Pixabay
PIDs in the Automation Industry
Industry Example: Heating and/or Cooling Processes
Let's move on to a controls scenario commonly found in the automation industry: using PID control for heating and/or cooling. Figure 2 shows a picture of quartz heaters inside an industrial vacuum chamber. A typical process requirement may be to keep the temperature inside the chamber at exactly 200 deg C with a minimal amount of deviation.

Figure 2. Heaters inside an industrial vacuum chamber. Image used courtesy of the author
First, imagine that you are NOT using PID control. You could turn on the heaters full blast until you reach 200°C, then suddenly turn them off. However, the temperature would keep rising for a bit after the heaters turn off, and may reach well over 200°C.
Most people intuitively realize that the best method is to heat it up more rapidly at first, then back off gradually so that the 200°C point is reached, but hopefully not exceeded by much (if at all). This kind of gradual, smooth control is exactly what PID control is used for.
PID Definitions
Let's review some definitions. Table 1 summarizes fundamental PID terminology.
| P | Proportional control term |
| I | Integral control term |
| D | Derivative control term |
| SP | Set Point (target) |
| CV | Control Variable (PLC output) |
| PV | Process Variable (feedback) |
Table 1. Basic PID terminology
In the industrial heater example discussed above, your PV is the actual temperature, as measured by a sensor inside the heater. Your CV is the analog signal output from the PLC that controls the heaters. Your target SP is 200°C. Your P, I, and D terms are selected during PID tuning (more on that later). To put it all together, when using PID control, you choose appropriate values of P, I, and D in order to change your CV and make your PV equal your SP.

Figure 3. Each of the PID elements represented in a mathematical flowchart.
Getting Ready to Program a PID Loop in the PLC
Modern PLCs have built-in PID instructions; Figure 4 shows an example of a PID instruction in AutomationDirect’s Productivity Suite software.

Figure 4. Inserting a PID instruction in Productivity Suite.
Programming involves the selection of values (or mapping of other variables) to supply the P, I, D, SP, PV, etc.
Some beginners get overwhelmed by the number of parameters that have to be configured for PID controls, but don't forget that every PLC instruction has a help file associated with it. The meaning of each parameter, and whether programming it is required or optional, is explained in the help file. In Productivity Suite, simply click on the ‘Help’ button in the bottom right corner to view a detailed help file for the PID instruction (shown in Figure 5).

Figure 5. PID instruction help file in Productivity Suite.
Every PLC brand is a little different as to how to access the instruction help, but they are bound to have it.
Tuning the PID Instruction
When programming your PID instruction, you will need to select appropriate P, I, and D gain values. This is called PID tuning. PID tuning is a complex topic, and it will only be covered briefly in this tutorial. As a rule of thumb, the P and the I terms are more critical than the D term for many processes. In fact, sometimes engineers refer to PI control rather than PID control, if the D term is not used at all. A larger P term generally means your CV will increase or decrease with greater amplitude. A larger I term generally means your CV will respond more quickly to changes (faster increase or decrease).
The important thing to remember is that every process is different, and PID values that work great for one process may not work very well for another. If programming from scratch, it may help to choose some small initial values for P, I, and D (such as values ranging from 0.01 to 2.0). Then run your process, observe how the system behaves, and make small adjustments to your P, I, and D terms. Remember, the goal of PID control is to reach a desired setpoint in a smooth and controlled manner and avoid extreme oscillations or overshoot. Thorough testing is the best way to ensure that your PID loop is properly tuned.
Getting Started with PID?
In this tutorial, we discussed the concept and purpose of PID control and covered an example of an industrial heating process. Getting ready to program a PID loop in your own PLC? Some PLC manufacturers, like Allen-Bradley and Automation Direct, have sample PLC code projects that contain examples of programmed PIDs. For example, if you navigate to Rockwell Automation’s Sample Code Library and search for “PID” you will find several sample code downloads for various applications.
Just remember that every process is different and careful testing is the best way to make sure your PID loop is properly tuned.
Training