pid update rate effect

michaeli

Member
Join Date
Jun 2016
Location
new york
Posts
43
Using the parallel or independent PID equation with e=sp-pv for temperature control of a electrically heated furnace. Ki is 1/sec and Kd is secs. Dead time for process is about 2 minutes. Using Allen Bradley hardware (plc5/40e) and software and now have PID block with update at 1 second. The STI is not configured and the plc scan time is about 34 ms. Have question on the changing the update time for the PID block – if the time was changed from 1 second to 2 second would the output related to the integral part of the equation change given the slow changing temperature loop? Or if it was changed to 10 seconds would the integral related output change much? In the Allen Bradley PID equation I don’t see the scan time so I am thinking would not change if scan time was to change and don’t see this changing much the area under the error/time curve.
 
Update rate has no effect on gains. In general, a faster update rate is always better except that it can make "noise" sometimes more dramatic, especially if using derivative gains
 
rupej - thank you for quick reply. the pid update rate is 1 sec but plc scan time is about 34 secs. thinking that the Ki value entered into HMI will actual be a little different that is ultimately used in calculating the output related to the integral function. would this be true?
 
In the AB PLC5, you need to Trigger your PID with a Timer set the same as your PID Update Time in continuously Scanned PLC Code. If you are not doing this, the Time Based Calculations(Ki+Kd)will be affected by the PLC Scan Time, and will be incorrect. This is because you are telling the PID it is updating every 1 Second, but actually Scanning and updating it every 34 ms.

The other option is putting it in an STI Subroutine, and setting the PID Update Time to the same as the STI.

Search for Posts by Ron Beaufort, there a wealth of information in them about PIDs.

Stu....
 
Thanks Stu - then maybe the updating time will have an effect on output values related to both integral and derivative parts of PID equation? although not shown in the independent PID equation the update time factors in.
 
That is correct. The problem with having it update at the Scan Time Rate, is you tune the PID, and it is working well enough. Then you modify the PLC Program, the PLC Scan Time changes, and all of a sudden all your PIDs aren't working correctly.

As a side note, the SLC500 Series PIDs are different, and execute at the time entered into the PID Instruction. So, normally they have no conditions in front of them in the Rung.

Stu....
 
Originally posted by michaeli:

n the Allen Bradley PID equation I don’t see the scan time so I am thinking would not change if scan time was to change and don’t see this changing much the area under the error/time curve.

While the equation shown in the manual and in the instruction help does not explicitly show scan time, the instruction does use the execution rate to scale the integral and differential responses. One of the values in the control block is loop update time. this is where you tell the instruction how often the instruction is being executed. This is also the value that is used to scale the integral and derivative response.

Keith
 
Stu - then in effect the independent equation for AB software would really look like below? so increasing scan or update rate from 1 to 10 secs would result in larger outputs related to the integral and derivative parts of equation?

CV = [Kp * E] + [Ki*(scan rate secs)*integral Edt] - [Kd*(scan rate secs)*dPV/dt] + bias
 
Keith
Thanks for your follow up as well as Stu's. I posted equation in response to Stu comments. Could you review that posting. I am trying to understand the integral factor - I can visualize the area under the error/time curve and from what you and Stu are indicating it would be this accumulating area x Ki number x the scan rate for what the integral contribution to output is?
 
It is a little more complicated than that. It will do the Time Based Calculations for Ki and Kd on every Scan, but it will use the value entered in the Update Time for the Calculation.

So, it does the Calculation based on 1 Second passing, but in fact only the Scan Time has passed, say 34ms from your first Post. This obviously skews the result quite badly.

Stu....
 
Don't allow the equation as presented affect your understanding of what is happening. The reference equation is the reference equation. It is there to make clear the function the plc is performing. But it isn't exactly what is happening. Also, when you are considering the output action of the PID think about what will happen in a fixed time period first (1 second for example) and then consider what would need to be done to compensate for a different loop time.

For example, internal to the plc the "integral" is really a digital sum performed once every instruction scan. the equation would something like:

IntSum = IntSum + (Ki * Error * LoopUpdateTime)

Assume an initial IntSum of 0, an error of 1, a Ki of 1 and a LoopUpdate Time of 1. Assuming a constant error, I think it is pretty clear that after one second and one loop update IntSum will be 1, after 2 seconds and 2 loop updates the output will be 2 and so on.

If we change the system so the instruction is scanned twice a second, LoopUpdateTime will change to 0.5. All other things being equal, after the first scan at 0.5 seconds IntSum will equal 0.5, after 2 scans at 1 second IntSum will be 1, after three scans at 1.5 seconds IntSum will be 1.5, after 4 scans at 2 seconds IntSum will be 2 and so on. As you can see, the value of IntSum at 1 and 2 seconds is the same. All that changed is there are intermediate values between those two as a result of the extra scans. But by using the LoopUpdateTime as part of the function the basic nature of the function doesn't change with how often the loop is called...as long as you tell it the right loop update rate.

The same is true of the derivative except the function is divided by LoopUpdateRate instead of multiplied. In implementation, the derivative is actually a digital difference. It will have a form something like:

DiffOut = Kd*(Error - ErrorN-1)/LoopUpdateRate

Keith
 
Keith - thanks for update and making things a little clear.

have other question with loop update at 1 sec and plc scan rate at 0.035 sec. if Ki value in block is at 0.001 then the real effective Ki value would be .001/.035 = 0.028? also if Kd in block is 0.025 then real Kd value is 0.025 x 0.035 = .000875?
 
Originally posted by michaeli:

if Ki value in block is at 0.001 then the real effective Ki value would be .001/.035 = 0.028? also if Kd in block is 0.025 then real Kd value is 0.025 x 0.035 = .000875?

You have the multiply and divide reversed.
Kiact = Ki * ScanRate
Kdact = Kd/ScanRate

Also, I noticed in your original post that you talk about Ki in terms of 1/sec and Kd in terms of sec. But then you posted this equation:

CV = [Kp * E] + [Ki*(scan rate secs)*integral Edt] - [Kd*(scan rate secs)*dPV/dt] + bias

I would try to refer to the the direct gains as Ki and Kd and the times as Ti and Td. I don't often deal with the time version of PID tuning values. But keep in mind that with the integral value Ki is proportional to 1/Ti. In the equation I copied in, increasing Ki will increase the summation rate. Conversely, increasing Ti with DECREASE the summation rate. So make sure you know which one you are dealing with or you will seriously confuse yourself.

Keith
 
pid update

Stu
i just took the independent PID equation and dropped in (x scan rate) for the integral and Deviation part of equation apparently not correct. but its correct that the Ki term is 1/sec and Kd term is sec. so with my pid update rate of 0.001 and plc scan of 35 ms then the true effective Ki is 0.001x0.035=0.000875 and Kd is 0.025/.035=0.7?
 

Similar Topics

Hi all, splitting out from this thread because it's a somewhat different question to the original. I have to migrate some code from a Micrologix...
Replies
17
Views
4,148
Hi all, I've been tasked with migrating a standalone control box with a Micrologix 1100 into an existing 5380 Compact Logix controller. It has a...
Replies
9
Views
2,436
Today I upgraded an L55 processor with an L82, which ended up being the 2nd unsuccessful attempt but thats a different story. After starting the...
Replies
15
Views
4,515
Below is how I set my PID LoopUpdate time, feel free to make suggestion or comments. The PID loop is used to regulate water back pressure. Since...
Replies
0
Views
1,249
Just tuned a heating application where my natural period was 250 seconds. Everything I've read says that the loop update time should be 5-10 times...
Replies
1
Views
1,636
Back
Top Bottom