Algorithms used for the digital implementation of pid control


Thread Starter

kufre bassey


i'm new in process control.

i'm working on a project which involves comparing algorithms used for the digital implementation of pid control. i guess i have to discretize the continuous time pid algorithm using the main algorithms. my research churned up euler, trapezoial and backward difference. are these the main algorithm upon which softwares for auto tuning pid controllers are made?

if they are please i need their various discretized version and their pseudo codes-based on the various discretized algorithms. please i'm still trying to understand the pid algorithm for digital implementation. feel free to offer all help if i'm going in the wrong direction. recommend precise materials on subject for me.

many thanks!
So, you probably already found this - but just in case you didn't ...

Implementing the basics of a PID loop in a PLC is remarkably simple - there are only a few lines of pseudo code. The PLC handles scan times, execution intervals etc for you. Of course, the hard part is allowing for all the corner cases - eg limiting setpoints and outputs correctly, anti-reset windup, calculating gains in the correct ranges etc. If you are using a non real-time OS then you have the added challenge of controlling the execution interval i.e. the "wait (dt)"

There is also a library of PID related stuff here ...

You mention Autotuning ... be warned, many commercial attempts at writing an auto-tuning algorithm in PLC's and DCS's are less than satisfactory and in some cases flat out don't work in the real world. If you are intending to write one yourself, it will not be an easy task.

Good luck
Each of the DCS (Distributed/Digital Control Systems) shows their PID algorithm in the details of their products. Very few PID function blocks for PLCs are as complete as the PID function blocks for the DCSs. The difference is that the PLC programmer must add these features in PLC logic if needed. However, when the basic PID algorithm lacks features such as open-loop windup protection, bumpless transfer, and derivative suppression on setpoint change, the programmer may not think of them. When the option appears as a DCS function block option as you configure your control strategy, you are forced to consider it.

Dick Caro
Richard H. Caro, CEO, CMC Associates
Certified Automation Professional (ISA)
Buy my books at the ISA Bookstore:
Wireless Networks for Industrial Automation
Automation Network Selection
Consumers Guide to Fieldbus Network Equipment for Process Control