Ron Beaufort
Lifetime Supporting Member
One of the most commonly asked questions when setting up PID control is: “How often do I need to update the loop?” The purpose of this post is to offer some basic answers to that question. The controller being used in the following experiments is an Allen-Bradley PLC-5/20 - but the topic may be applied to most (if not all) controllers where the PID’s update time is selectable. The system being controlled is a lab simulator - modeled on a small simple air flow system. The simulator computes a new value every 0.50 seconds. The X-axis of the graphs below is 66 seconds.
Graph #1 in the figure below illustrates a simple field test which technicians commonly perform in order to determine the “natural period” of the system. The Integral and Derivative actions are disabled - a reasonable setpoint is entered (in our case the setpoint is 40% of full flow) - and the system is then placed in automatic mode. Next the Proportional Gain setting (Kc) is increased in steps a little at a time until the system begins to oscillate in a continuous and relatively uniform manner. (I wanted to discuss “bumping” the system here but ran out of posting room. Please post questions if you’re interested.)
Caution: Some systems will NOT tolerate this type of field test. Depending upon the characteristics and the design of the system, any oscillations may damage the system itself - or cause unsafe conditions for people nearby.
As shown in graph #1 below, our test system went into a condition of uniform oscillation at the indicated setting of Kc = 6.25.
Careful measurements indicate that this particular system oscillates at a natural period of 15.18 seconds.
[attachment]
For the purposes of this post, I next set the PID for a loop update time of 0.50 seconds and then manually tuned the system for “acceptable” PID control. The values which I arrived at are: Kc = 3.75; Ti = 0.13; and Td = 0.03. You may see the results of this tuning procedure by skipping ahead to graph #5 - which we will regard as a properly tuned “benchmark” for the purposes of this discussion.
Once I had determined the “acceptable” tuning values for Kc, Ti, and Td which I have just quoted - I entered these into the controller AND DID NOT ALTER THEM in any way as the rest of the tests proceeded. Specifically, after the “find the period experiment” had been accomplished in graph #1 - the values for Kc, Ti, and Td were set and then subsequently left unchanged. Thus the only parameters which were changed throughout the rest of this series of tests were:
(1) the value of the controller’s “Loop Update Time” - and
(2) the value of the “trigger” timer’s Preset.
In each test, these two values were kept equal to each other - a highly recommended practice.
Question: Will we be able to obtain adequate control of the system if we update the PID only 5 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 5 updates per period equals 3.04 seconds per update. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 3.04 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #2.
Answer: Stated as politely as possible, the control for this particular system was judged to be “inadequate” when the PID was updated only 5 times within each period of oscillation.
Question: Will we be able to obtain adequate control if we update the PID 10 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 10 updates per period equals 1.52 seconds per update. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 1.52 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #3.
Answer: The control for this particular system was judged to be “inadequate” when the PID was updated 10 times within each period of oscillation. But it’s getting noticeably better.
Question: Will we be able to obtain adequate control if we update the PID 20 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 20 updates per period equals 0.76 seconds per update. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 0.76 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #4.
Answer: The control for this particular system was judged to be “adequate” when the PID was updated 20 times within each period of oscillation.
Question: Consider the “adequate” control resulting from 20 updates per period. Will we obtain “improved” control if we update the PID 30 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 30 updates per period equals 0.51 seconds per update. (This is very close to being a “nice round number” so I went ahead with 0.50 seconds for the next test.) I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 0.50 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #5.
Answer: The control for this particular system was judged to remain “adequate” when the PID was updated 30 times within each period of oscillation. Further, the control was judged to be “not substantially improved” over the quality of control which was available with 20 updates per period.
Question: What if we radically increased the number of updates to be performed during each period? Will we obtain “improved” control if we update the PID at a significantly increased rate? (In other words, if “fast” is good - is “faster” better?) Calculating: 15.18 seconds per period divided by 0.10 seconds per update equals 152 updates per period. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 0.10 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #6.
Answer: The control for this particular system was judged to be “unimproved” when the PID was updated 152 times within each period of oscillation.
Summing up: This series of tests proves (at least to my personal satisfaction - and for this particular system) that adequate PID control may be obtained when the control loop is updated a minimum of twenty times within each period of oscillation. Further, the quality of control will not be substantially increased even if the number of updates is increased dramatically over the value required for “adequate” control.
Now - in plain simple terms. Once you know how fast the system oscillates, you should crank in a number for your loop update time which will give you at least 20 to 30 PID updates during each one of those oscillation cycles. The objective is to have the PID “look at the incoming signal” OFTEN ENOUGH - and then have the PID “calculate a new output signal” OFTEN ENOUGH - so as to nudge the process back toward the target - OFTEN ENOUGH to give good control. Common sense would tell us that if the PID allows the signal to “drift around” too long without even looking at it - that it’s going to be extremely difficult (if not impossible) to get good control.
Going further. The system in these tests was an air flow process which oscillated at a natural period of about 15 seconds per cycle. Suppose that we had a much slower system instead - for example: a heating process with a natural period of 132 seconds per period. Calculating: 132 seconds per period divided by 20 updates per period equals 6.60 seconds per update. So could we get adequate PID control using a Loop Update Time setting of approximately 6.60 seconds? Answer: Yes, we certainly can. But still - personally - unless there were some compelling reason for running the loop that slowly, I’d still go ahead and set my PID to update at something like every half second. The reason? The human factor. Regardless of how well the system controls the process, operators tend to think that it’s “hung up” or “sluggish” if it doesn’t move often enough.
On another tack. Why not just execute the PID very often? After all, who cares if it executes a lot more often than it “really needs to” anyway? Take a quick look at the “Instruction Timing and Memory Requirements” charts in the back of:
the Instruction Set Reference Manual.
http://www.ab.com/manuals/cp/1785-6_1.pdf
Adobe Reader page 312 of 372 is a good one to start with.
Notice that the PID is a real “HOG” when it comes to scan time - and depending upon your specific type of PLC-5 processor, 895 microseconds is a typical value for required execution time. Compare that to something like a simple MUL (Multiply) instruction at 9.9 microseconds. So the issue is - do we really want to fire this hog off a lot more often than we need to? And remember what we saw in the last graph above. When we executed the PID many times more often than was “required” - we didn’t really gain any noticeable improvement in the quality of control.
Stone left unturned department: How often are the input and output signals being transferred between the field devices and the PID? In some systems the bottleneck in the control strategy is this issue - which unfortunately we don’t have room to discuss here.
Graph #1 in the figure below illustrates a simple field test which technicians commonly perform in order to determine the “natural period” of the system. The Integral and Derivative actions are disabled - a reasonable setpoint is entered (in our case the setpoint is 40% of full flow) - and the system is then placed in automatic mode. Next the Proportional Gain setting (Kc) is increased in steps a little at a time until the system begins to oscillate in a continuous and relatively uniform manner. (I wanted to discuss “bumping” the system here but ran out of posting room. Please post questions if you’re interested.)
Caution: Some systems will NOT tolerate this type of field test. Depending upon the characteristics and the design of the system, any oscillations may damage the system itself - or cause unsafe conditions for people nearby.
As shown in graph #1 below, our test system went into a condition of uniform oscillation at the indicated setting of Kc = 6.25.
Careful measurements indicate that this particular system oscillates at a natural period of 15.18 seconds.
[attachment]
For the purposes of this post, I next set the PID for a loop update time of 0.50 seconds and then manually tuned the system for “acceptable” PID control. The values which I arrived at are: Kc = 3.75; Ti = 0.13; and Td = 0.03. You may see the results of this tuning procedure by skipping ahead to graph #5 - which we will regard as a properly tuned “benchmark” for the purposes of this discussion.
Once I had determined the “acceptable” tuning values for Kc, Ti, and Td which I have just quoted - I entered these into the controller AND DID NOT ALTER THEM in any way as the rest of the tests proceeded. Specifically, after the “find the period experiment” had been accomplished in graph #1 - the values for Kc, Ti, and Td were set and then subsequently left unchanged. Thus the only parameters which were changed throughout the rest of this series of tests were:
(1) the value of the controller’s “Loop Update Time” - and
(2) the value of the “trigger” timer’s Preset.
In each test, these two values were kept equal to each other - a highly recommended practice.
Question: Will we be able to obtain adequate control of the system if we update the PID only 5 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 5 updates per period equals 3.04 seconds per update. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 3.04 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #2.
Answer: Stated as politely as possible, the control for this particular system was judged to be “inadequate” when the PID was updated only 5 times within each period of oscillation.
Question: Will we be able to obtain adequate control if we update the PID 10 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 10 updates per period equals 1.52 seconds per update. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 1.52 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #3.
Answer: The control for this particular system was judged to be “inadequate” when the PID was updated 10 times within each period of oscillation. But it’s getting noticeably better.
Question: Will we be able to obtain adequate control if we update the PID 20 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 20 updates per period equals 0.76 seconds per update. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 0.76 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #4.
Answer: The control for this particular system was judged to be “adequate” when the PID was updated 20 times within each period of oscillation.
Question: Consider the “adequate” control resulting from 20 updates per period. Will we obtain “improved” control if we update the PID 30 times within each period of oscillation? Calculating: 15.18 seconds per period divided by 30 updates per period equals 0.51 seconds per update. (This is very close to being a “nice round number” so I went ahead with 0.50 seconds for the next test.) I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 0.50 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #5.
Answer: The control for this particular system was judged to remain “adequate” when the PID was updated 30 times within each period of oscillation. Further, the control was judged to be “not substantially improved” over the quality of control which was available with 20 updates per period.
Question: What if we radically increased the number of updates to be performed during each period? Will we obtain “improved” control if we update the PID at a significantly increased rate? (In other words, if “fast” is good - is “faster” better?) Calculating: 15.18 seconds per period divided by 0.10 seconds per update equals 152 updates per period. I set both the PID’s Loop Update Time - and the preset of the trigger timer - to obtain an update period of 0.10 seconds. I started with a setpoint of 20% - and then made a step change to 40% - and graphed the results as shown in graph #6.
Answer: The control for this particular system was judged to be “unimproved” when the PID was updated 152 times within each period of oscillation.
Summing up: This series of tests proves (at least to my personal satisfaction - and for this particular system) that adequate PID control may be obtained when the control loop is updated a minimum of twenty times within each period of oscillation. Further, the quality of control will not be substantially increased even if the number of updates is increased dramatically over the value required for “adequate” control.
Now - in plain simple terms. Once you know how fast the system oscillates, you should crank in a number for your loop update time which will give you at least 20 to 30 PID updates during each one of those oscillation cycles. The objective is to have the PID “look at the incoming signal” OFTEN ENOUGH - and then have the PID “calculate a new output signal” OFTEN ENOUGH - so as to nudge the process back toward the target - OFTEN ENOUGH to give good control. Common sense would tell us that if the PID allows the signal to “drift around” too long without even looking at it - that it’s going to be extremely difficult (if not impossible) to get good control.
Going further. The system in these tests was an air flow process which oscillated at a natural period of about 15 seconds per cycle. Suppose that we had a much slower system instead - for example: a heating process with a natural period of 132 seconds per period. Calculating: 132 seconds per period divided by 20 updates per period equals 6.60 seconds per update. So could we get adequate PID control using a Loop Update Time setting of approximately 6.60 seconds? Answer: Yes, we certainly can. But still - personally - unless there were some compelling reason for running the loop that slowly, I’d still go ahead and set my PID to update at something like every half second. The reason? The human factor. Regardless of how well the system controls the process, operators tend to think that it’s “hung up” or “sluggish” if it doesn’t move often enough.
On another tack. Why not just execute the PID very often? After all, who cares if it executes a lot more often than it “really needs to” anyway? Take a quick look at the “Instruction Timing and Memory Requirements” charts in the back of:
the Instruction Set Reference Manual.
http://www.ab.com/manuals/cp/1785-6_1.pdf
Adobe Reader page 312 of 372 is a good one to start with.
Notice that the PID is a real “HOG” when it comes to scan time - and depending upon your specific type of PLC-5 processor, 895 microseconds is a typical value for required execution time. Compare that to something like a simple MUL (Multiply) instruction at 9.9 microseconds. So the issue is - do we really want to fire this hog off a lot more often than we need to? And remember what we saw in the last graph above. When we executed the PID many times more often than was “required” - we didn’t really gain any noticeable improvement in the quality of control.
Stone left unturned department: How often are the input and output signals being transferred between the field devices and the PID? In some systems the bottleneck in the control strategy is this issue - which unfortunately we don’t have room to discuss here.
Last edited: