The PID learning process

While there are many excellent loop tuning methods available, many practitioners prefer tweaking proportional-integral-derivative (PID) tuning constants or using rules-of-thumb rather than doing the required step test and data analysis. But having knowledge about how the individual PID components interact can go a long way to learning proper tuning theory and methods.

Nic van der Mey, Gustaf Gous
Figure 1: Offline proportional-integral-derivative (PID) simulator. Courtesy: Sasol

Figure 1: Offline proportional-integral-derivative (PID) simulator. Courtesy: Sasol

Table of helpful PID abbreviations. Courtesy: SasolPID 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. 


Figure 1: Offline proportional-integral-derivative (PID) simulator. Courtesy: SasolWhile 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.

Figure 2: Real-time proportional-integral-derivative (PID) spreadsheet graphs. Courtesy: SasolTo 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.

Figure 3: proportional-integral-derivative (PID) parameters acquired from the distributed control system (DCS) via OPC. Courtesy: SasolIt 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.

Figure 4: Various tuning rules. Courtesy: Sasol

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.

Figure 5: Typical proportional-integral-derivative (PID) loop with a setpoint (SP) change and disturbance. Courtesy: Sasol

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:

Figure 6: P, I, and D components associated with Figure 5. Courtesy: Sasol

When the second chart in Figure 6 is considered, it also can be shown that:

Fig 7: Proportional-integral-derivative (PID) response without process variable (PV) noise. Courtesy: Sasol

If the first example is repeated without any noise on the PV signal, the effect of derivative interaction can be examined more clearly.

Figure 8: P, I, and D components without noise. Courtesy: Sasol

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:

The simulation also can be used to:

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.

Figure 9: Trends showing how changing the integral time affects the P, I, and D parts of controller output (OP) as well as controller performance. Courtesy: Sasol

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.

Figure 10: Effect of tuning change on controller output (OP) variance and error. Courtesy: Sasol

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. 

Figure 11: Effect of derivative on controller output (OP) noise. Courtesy: Sasol

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, jsmith(at)


Key concepts

Consider this

How adept at tuning PID loops are the control engineers in your plant?

ONLINE extra

See related stories about PID linked below.

Related News



Visit Our Sites

Contact Us


Close Home
click me