for those who would like a better understanding of how the PID can still be tuned to work reliably -
even when programmed in an improperly timed situation - the following link about Bubba's paycheck might be helpful ...
http://www.plctalk.net/qanda/showthread.php?p=73610&postcount=10
.
but the first paragraph in the linked post seems to contradict what you suggest ...
"it is possible to “compensate” for a PID which is being executed on an inaccurately controlled schedule ... we can do this by altering the Ti setting to counteract either a “too fast” or a “too slow” execution rate ... we can do this (and this is the most important part) AS LONG AS the execution rate remains CONSISTENT"
Let it just be said that...
1. PID instructions executing in the normal scan
without a triggering timer is "worst-case". Adding or deleting large amounts of code will severely affect the tuning, because the PID execution rate will change dramatically. You will even affect the PID tuning by going online with Studio/RSLogix5000 depending on the settings of the System Overhead Time Slice.
2. PID instructions executing in the normal scan
with a triggering timer is acceptable
in most cases. Adding or deleting large amounts of code will
not "severely" affect the tuning, except on very fast loops. Larger scan times inevitably reduce the accuracy of timers.
3. PID instructions executing in a Periodic Task will give you the best chance of tuning a difficult loop, and making that tuning "future-proof". Adding or deleting large amounts of code will
not affect the tuning at all. Going online to the controller, even with multiple users, will not affect the tuning.
amberman believes that putting PIDs where they ought to be "makes the code messy". I have to disagree, it's no more "messy" than segregating your code into routines. I think I need to add that only the PID instructions themselves need to be in a periodic task, the rest of the "glue logic" can be programmed in the continuous task.
PID is an instruction that definitely needs to be scanned at a CONSISTENT rate, and that rate needs to be set into the .UPD element of the PID tag. I would also advocate that the .UPD is updated automatically, by GSVing the Periodic Task rate, and writing it to the .UPD of all the PIDs in the Periodic Task. If anyone changes the task rate, the PIDs will be notified, and do their calculations accordingly.
I've worked on systems with many PIDs in one controller, and those systems have been modified many times over the years, new control routines added, some deleted, etc., and no PID retuning has been needed, because nothing changes the rate at which the PID instructions are scanned.