The PID learning process
PID control consists of proportional, integral, and derivative actions. The interrelationship between these three components often is misunderstood. This is further aggravated by different implementations of the basic PID algorithm, namely PI-D or I-PD (see Table "Helpful abbreviations").
To address these issues, a PID simulator was developed in Excel that shows how the different PID components interact. This idea was then converted to an online tool that will run parallel to the PID equations in the plant, showing the contributions of proportional, integral, and derivative actions separately. This is an excellent training tool for teaching new control engineers the interactions between the proportional, integral, and derivative components. It also is useful to assist practitioners with closed-loop PID troubleshooting and tuning.
While it is ideal to tune loops by first applying a manual step test, determining the process dynamics, and then calculating tuning constants using an appropriate rule, this is often not practical. An operator may not be comfortable with putting certain loops in manual (even if the tuning is not ideal) and even more so with step tests. Inevitably, many loops are still tuned closed-loop by trial and error. It may take a very long time to find good tuning by making small adjustments to the tuning constants. But making larger adjustments can be riskier and easily lead to oscillating loops and subsequent plant upsets.
While experienced practitioners are able to get good results with this method, it is usually a very time consuming process. For novices who do not fully understand how the proportional, integral, and derivative components of a PID loop interact with each other, it can be much more difficult to find optimal tuning constants.
To address this issue, an offline PID simulator was developed in Excel. This used the different PID algorithms (PID, P-ID, and I-PD) and showed changes in setpoint (SP), process variable (PV), and controller output (OP) on a chart. At the same time, a second chart showed the proportional, integral, and derivative components separately (see Figure 1).
This simulator was used as a training tool to enable novice engineers to better understand the complexities regarding PID control, including tuning different PID algorithms.
It was then decided to deploy a real-time version on a distributed control system (DCS) controlling a live plant. The idea was to create a tool that could, in real time, split the output of an actual PID controller into the proportional part, the integral part, and the derivative part in real time and provide trends of these. This was done by replicating the PID algorithms used on the DCS in Excel. The trends shown in Figure 2 clearly show the different contributions of the components of PID and aid the control engineer in determining which tuning parameters need adjustment as well has how much to adjust them. They also aid novice engineers in understanding the exact impact of changing tuning parameters.
Implementation of software
From the beginning of the software development, it was decided that the solution should not require purchasing any additional software, be easy to use, and be as general as possible. For these reasons, it was decided to implement the software in Excel using a Visual Basic for Applications (VBA) script and a free OPC library.
For initial setup, the OPC library should be installed and the Excel spreadsheet containing the code must be copied onto the machine. The user then should insert the name of the server where the tags are stored, the OPC server name, and the tag name of the loop being tuned into the spreadsheet and begin the data collection. All the other necessary information (process variable range, tuning constants, controller mode, etc.) is automatically acquired by the software (see Figure 3).
The calculation of the proportional, integral, and derivative parts is done using vendor-specific equations to ensure complete accuracy. Tuning changes are then made while monitoring the control loop with the software.
Note that six trends are provided to assist with the loop tuning. Setpoint and process variable are trended together, with controller output below. Proportional, integral, and derivative parts of the controller output are trended together with tuning constant values below. This means the engineer does not need to keep track of tuning changes as it is done automatically. Finally, controller output variance is shown below the controller output and integral of squared error (ISE) and integral over time of absolute error (ITAE) are trended together. The values for the last two trends are calculated over a configurable moving time window, and provide quantitative indications of the performance of the loop.
On a separate worksheet shown in Figure 4, several basic loop tuning rules are provided. The engineer simply enters values for the process dynamics (if they are known) and tuning constants are calculated automatically. The engineer also can include additional tuning rules if desired.
After tuning is completed, the engineer can save the Excel document with a new filename and then have a record of the tuning changes done along with the improvement of the loop’s performance.
Results of the offline tool
The offline tool was used mostly to teach new control engineers the complexities of PID control. In Figure 5, a typical view that is normally used to teach PID control can be seen.
The PI-D algorithm was used and the loop subjected to a SP change and a disturbance of equal magnitude. What can be seen here is that:
- The loop shows a reasonable response to SP changes and disturbances
- PV noise influences the OP response.
When the second chart in Figure 6 is considered, it also can be shown that:
- Even though the PID algorithm used filters with the derivative action, most of the PV noise reflected in the response of the loop is because of the derivative action. Some of the noisy OP signal is because of the proportional action, and noise has very little impact on the integral component.
- In Figure 6, the sharp OP response on the SP change would lead engineers to believe that the proportional action is dominant. When figure 6 is considered, it shows that integral action does most of the work.
- Because of the noise, the interaction of the derivative component is hidden.
If the first example is repeated without any noise on the PV signal, the effect of derivative interaction can be examined more clearly.
Not much more can be learned when comparing Figure 7 to Figure 5. But when Figure 8 is compared with Figure 6, the following can be highlighted to students:
- Note how the proportional component returns to 0 as PV error returns to 0. This can be used to explain why proportional action alone never can return a loop to setpoint.
- Also note the interaction between proportional and integral. Proportional quickly increases the OP and then decreases it again as error starts decreasing. During this time, integral action must smoothly take over and keep the OP higher than before.
- Note how the derivative action counteracts the proportional and integral action during the SP change, but assists during the disturbance rejection. Keep in mind that the PI-D algorithm was used.
The simulation also can be used to:
- Allow trainees to experiment with and see the impact of different tuning constants.
- Show the interactions between P, I, and D with different PID algorithms such as PID and I-PD.
- Demonstrate tuning changes required to stop a cycle on a control loop.
- Demonstrate the impact of valve stiction on loop tuning.
- Show how algorithms such as I only or P only work.
- Show the undesired derivative kick when making a SP change using the PID algorithm.
- How P only can eliminate offset when controlling an integrating variable.
Results of the online tool
Two examples where the software was used are shown. In Example 1, a cycling loop is shown. Expert control engineers will be able to discern that the cycle is caused by too aggressive integral action but a novice can use the trends shown in Figure 9. Here, it clearly shows that the major contributor to the control action is the integral action. After the integral time is increased, the cycle stops. Notice that even though only one tuning parameter was changed, all three components have changed.
This is due to the interactive nature of P, I, and D. By increasing integral time, we have decreased the OP movement, which in turn has decreased the PV movement (in this case). This then decreases the movement of all three components of the PID algorithm and the cycle stops. The effect on OP variance, ITAE, and ISE also is shown in Figure 10.
In Example 2, the output of the controller is excessively noisy. Figure 11 shows the cause of this is excessive derivative action. After decreasing the derivative time, the output is much less noisy.
Tuning in action
The interactions of P, I, and D can be complex to understand and the matter is made even more complicated by the various implementations of the PID algorithm by different vendors. Implementing software as described can be done by any control engineer with some programming experience, without any extra costs. The simulation provides a valuable training tool for new engineers learning about PID control that intuitively illustrates the effects and interactions of P, I, and D. The live tool can be used to aid an engineer in the tuning process as well as provide quantitative indications of control improvements. The use of vendor-specific equations further aids the control engineer to understand how their specific PID algorithms work.
Nic van der Mey is a control engineer working on ethylene separation and LAN units at Secunda Chemical Operations plant of Sasol, Secunda, South Africa. Gustaf Gous is a lead specialist in control engineering working at the Secunda Chemical Operations plant of Sasol, Secunda, South Africa. Edited by Jack Smith, content manager, CFE Media, Control Engineering, firstname.lastname@example.org.
- A proportional-integral-derivative (PID) training simulator was developed in Excel that shows how the different PID components interact then converted to an online tool that runs parallel to the PID equations in the plant, showing the contributions of proportional, integral, and derivative actions separately.
- The calculation of the proportional, integral, and derivative parts is done using vendor-specific equations to ensure complete accuracy. Tuning changes are then made while monitoring the control loop with the software.
- The use of vendor-specific equations further aids the control engineer to understand how their specific PID algorithms work.
How adept at tuning PID loops are the control engineers in your plant?
See related stories about PID linked below.