I have seen a number of threads on PID control and thought some may like this simple PI Control as this is the most common in use (not many need Derivative). This code was developed in GX works but could easily be ported to any plc even reasonably simple ones without floating point maths. Please note this is a simple control so I don't want any remarks about the more complex functions of PID. It works reasonably well and has been used in CIP flow & heating systems for a number of years and used in IN-Line heating systems using injection and shell & tube with pretty good results. Note there is only PI control and sample time (the PI Sample timer that calls the function.
Hope it helps.
Hope it helps.