How to Program a Basic PID Loop in ControlLogixIn this video and blog post, you will learn how to program a PID Loop in ControlLogix 5000 PLCs.
In automation programming, we are often required to program a control loop for a given process to control temperature, pressure, flow rate, etc. This requires a target set-point with a controlled feedback process variable.
1. Introduction to PID Control Loop
A PID process loop controller is designed to generate an output that causes some corrective effort to be applied to a process so as to drive a measurable process variable towards the desired set-point value.
The controller uses an “actuator” to affect the process and a “sensor” to measure the results.
Often automation technicians and programmers are required to become familiar with configuring and tuning a PID loop control instruction and it can be one of most overwhelming when it comes to PLC programming topics.
In this article, we will discuss how to program a Rockwell Automation ControlLogix 5000 PLC using the Enhanced PID controller function block instruction (PIDE).
The PIDE is an Allen Bradley Logix 5000 Process Automation Controller (PAC) family (ControlLogix and CompactLogix) function block that improves on the standard PID found in all their controllers.
Function block programming uses diagrams with symbols to represent function and input and output connections between functions.
While at first, this function block can be quite intimidating, it shares similarities of the standard PID instruction and you’ll only need to turn on parameters required by your control program.
In this example, we will basically get you off the ground using the PIDE instruction and the program options essential to get it working.
2. PID Control Loop Functional Refresher
In case you may have forgotten what PID stands for,
– “P” stands for “Proportional” gain.
– “I” for “Integral” time.
– “D” for “Derivative” gain.
PID and PIDE are used for “process control” which includes the automatic control of systems such as temperature, flow rate, pressure, and speed.
The cruise control on a car is a good example of this type of control.
Basically, you tell the controller how fast you want to go, the “Set-point”, and the controller samples the actual speed, the “Process Variable”, and then the controller calculates an output value, the “Control Variable”, and sends that signal to the gas pedal.
2.1. Proportional Control Loop
As a PID functional refresher, and using the car cruise control as an example, the “P” or proportional is described as in the farther you are from the desired speed, the more you press the gas pedal and on the other hand, the closer you are, the less you press on it.
This works well but when you get at the desired speed, based on this rule you would let off the gas completely. And the end result is your car slows down and stays a little below the desired speed.
Proportional control is the main ingredient of any control but maybe a little inaccurate.
2.2. PI Control Loop
For “I “or integral, you wait for a little, and if there is no improvement you push a little more on the pedal.
If you are stuck below the desired speed for a long time without progress, you push the gas pedal a little further. If you still do not make it to the desired speed for some time, you again push the pedal a little further down.
Once you get to the desired speed you leave the pedal where it is. Integral control gives you accuracy but you have to wait.
2.3. PID Control Loop
For “D” or derivative, you react to sudden changes. Let’s say a strong wind gust pushes your car. Suddenly your speed surges fast upward toward the desired speed. You become startled so you release the gas pedal.
As the speed surge ends and the speed stabilizes, you will then return the pedal to where it was.
Derivative control manages sudden surges and may prevent overshooting your target speed.
If you enjoy function block programming, as I do, you will benefit from using this enhanced version instruction over the standard PID instruction for a few reasons.
The PIDE instruction offers a built-in, auto-tune feature which works reasonably well, the PIDE is programmed used as a function block and not available for ladder logic programming, it uses the velocity form of the PID algorithm. This is especially useful for adaptive gains or multi-loop and cascade process control.
The PIDE instruction can be switched between “Program” and “Operator” modes and provides full bumpless transfer into and out of cascade mode, and this instruction has more fault handling selections.
3. Programming the PID Loop in “Studio 5000”
3.1. Creating a New Project
The following programming steps assume that you have Studio 5000 experience.
Okay, let’s get started and create a new “Studio 5000” project. Locate the desktop or
Create a new project, select a new controller type such as the “1756-L71” and give the program a name, in this case, “PIDE_EXAMPLE”.
Hit “Next” and in the next window keep everything as it is and then click “Finish”.
3.2. Creating a New Task
For the next
So first I’ll create a new scheduled task by right-clicking on the “Tasks” and then clicking on the “New Task”.
In the “New task” window I will consider “PIDE_CONTROL” as the name for the task.
The period of the task automatically becomes the sample rate of the PID loop.
It is best to set it up in its own periodic task. So, I’ll leave these settings without any changes and continue to create a “New Program”.
3.3. Creating a New Program
So, I’ll leave these settings without any changes and continue to create a “New Program” by right-clicking on the “PID_CONTROL” Task.
In the opened menu, I’ll open the “Add” menu and click on the “New Program”.
I will name the program as same as the “Task”, which is “PID_CONTROL”.
Finally, I’ll click OK to close the New Routine window.
3.4. Creating a New Routine
The next step in the process is to create a new “Routine”.
To do that I’ll right-click on “PID_CONTROL” Program, then “Add” and then I’ll select “New Routine”.
In the “New Routine” window, I will name the “New Routine” as “PIDE”.
Just make sure to select the Type as “Function Block Diagram” and then click OK.
As you can see, the “PIDE” icon is added in the “Controller Organizer” pane on the left side of the window and I can open it up by double-clicking on it.
3.5. Adding the PIDE Block to the Studio 5000 Programming Environment (Routine)
Now that I have opened the “PIDE” program, from the “Process tab” in the library, I will add the PIDE function and add it on to the sheet.
Now let’s suppose we have a mixing tank where the temperature is to be maintained at a certain set-point.
The control valve allows a catalyst to be added to the tank to increase the temperature and the temperature transmitter will send the feedback to the PID.
This will represent our process and control loop for programming purposes.
3.6. Setting up the PIDE Block Properties
Now to be able to configure this block I need to open up the properties. To do that I’ll simply double-click on the PIDE block.
In the “General Configuration” tab, we will use the default configuration. However, we just need to make sure that:
– For the “Timing” it is using “Periodic Mode”.
– The “Control Action” is set to “E”.
– For the “Calculate” it is using the “Proportional” parameter set to “E” and the “Derivative Term” is set to “PV”.
Next, in the “
The control variable limits will be using the same temperature engineering units.
In the “Parameters” tab, there are several parameters which PIDE function utilizes them that you may or may not use them. These parameters can be manually turned off or on here. When selected, the parameter will be exposed to allow program connections.
In this tab there is also a “Description” field for each parameter which gives you more information about them.
I’ll select the required parameters and deselect the rest.
3.7. Connecting the Input and Output Tags to PIDE Block
After the PIDE function block is configured we can begin to add program control Input and Output reference tags to adjust the PIDE block performance.
3.8. Main Input and Output Tags
Take a look at the required parameters I’ve selected in the PIDE block.
The main Input and output reference tags are:
– The Temperature “PV” or process variable which is
– The “SPProg” or Program Set-point which is defined by the operator on the HMI.
– The “CVEU” or “Control Value in Engineering Units” outputs to control the heat in the tank by opening or closing the control valve.
Other inputs added are:
– The “SPHLimit” and “SPLLimit” are for
– The “PVEUMax” and “PVEUMin” are the maximum and minimum Engineering Units.
– The “ProgAutoReq” and “ProgManualReq” input references or the “Auto_Manual” tag, control to allow for direct manual control of the catalyst control valve.
– The “CVProg” input reference or “CV_Manual” tag reference value will be used for the manual control when “Auto_Manual” is turned OFF.
– The PIDE will need to be tuned and we have set the tuning parameters “PGain” to 1, “IGain” to 0.5 and “DGain” to 0 to a recommended starting point.
PID tuning can be tricky so I recommend reviewing procedures for this technique. The standard reference for PID tuning seems to be the “Ziegler-Nichols” tuning rules.
This concludes this blog post, Programming Basic ControlLogix PID loop using the PIDE block instruction.
I hope you have enjoyed learning what will support you in your upcoming project. If you would like to get additional training on a similar subject, please let us know in the comment section and check back with us soon for more automation control topics.
Thank you so much for reading, watching and adding your voice to this automation conversation.
By Wally Gastreich
Posted on Feb 18, 2019
By Wally Gastreich
Posted on Feb 18, 2019
5 ACTIONABLE TIPS FOR GETTING A PLC PROGRAMMING JOB WITH NO EXPERIENCE The mindset that helped me find my ideal job as a PLC programmer with NO experience. Working as a PLC Programmer is one of the most attractive and highest paying jobs in the engineering industry....
In previous articles, we have talked about variable frequency drives (VFD) and soft starters. If you need a refresher on the detailed working of either a VFD or Soft Starter be sure to look back at those articles by clicking the links below. What is a VFD? What is a...
In this video and article, we are going to do a deep dive into the DCS and discuss some of the why’s and how’s associated with the DCS. Let’s first clarify for the purpose of this lesson, what we mean by DCS. Over the years, the term DCS has evolved from the original...
RealPars is the world's largest online learning platform for automation engineers.
+31 10 316 6400
Mon - Fri 8:30 am to 5:30 pm (CET)
Rotterdam Science Tower, Marconistraat 16,
3029 AK Rotterdam, The Netherlands
© 2019 RealPras B.V. All rights reserved.
This project is approved and supported by The Netherlands Enterprise Agency