Please help settle a debate about P and PI control loops

defcon.klaxon

Lifetime Supporting Member
Join Date
Feb 2015
Location
Far NorCal
Posts
616
Hello all,

I got into a discussion with a co-worker about P and PI loop behavior. I am hoping that someone can confirm the proper way to describe the differences so that we can put the issue to bed, haha. This would also help me immensely in understanding PID loop control and tuning. I've tried Google for good explanations but I keep finding examples that don't really translate well to my situation (car steering/cruise control are what I typically find, which aren't going to work in this situation).

Let's say you have a PID loop that controls pump speed to maintain system pressure. To make the conversation less "hypothetical", let's say the loop controls pump speed (output is 0-100), and the process variable is water pressure (0-150 PSI); the setpoint is 50 PSI.

For the first experiment, you use only proportional gain; no integral or derivative functionality.

My belief is that a loop using only proportional gain will cause the output to be solely reliant on the error and the proportional gain; in other words:
Code:
 Output = Kp*(SP-PV)
This would mean that as the water pressure (PV) rises to the setpoint (SP), the output of the loop is going to reduce, eventually reaching 0. Then as the water pressure starts decreasing, the P loop will turn it back on, but will again eventually reach 0 and will do this ad infinitum. This is what I believed causes oscillations in P control loops; you either has little gain and you never quite get to your setpoint, or you have too much gain and you oscillate with over and under shooting. Further, it is my understanding that the only way that the loop's PV will reach an SP and maintain that SP is to add integrator functionality. If you have a PI loop, then once your PV reaches the SP the loop maintains the output that got you there. Finally, if your system is sluggish in responding, the integrator will "wind up" and add output to get your PV moving, whereas a P controller's output is simply proportional to your error, and will happily sit at an output all day long even if it isn't moving and won't change, whereas the PI will increase output until maxed out until your PV starts moving.

My co-worker believes, conversely, that a P loop will maintain an output once a setpoint is reached and that adding the integrator is to add accuracy in maintaining the output, the last 5% of getting the PV to equal the SP, in other words.

The reason my co-worker believes this is that the equation for the PID loop we're discussing takes into account the previous cycle's output, shown here:

UH4B8oD.png


He interprets this equation to mean that when there is zero error, the output is equal to the previous output and therefore the loop will maintain that output. I believe that the previous values are simply the previous cycle's values (you see that the D portion uses n-1 & n-2, which makes me think the previous two cycles) and that this actually proves me point; the output isn't going to maintain because it's simply the last cycle's output, not the starting point.

He's since left the office and I've manually calculated several scans of the equation above, and see the output dropping as the PV increases with the output reaching zero when PV = SP. I feel fairly confident in my understanding of the differences between P and PI loops, and I think my math checks out and proves it, but I'd like to hear what you guys have to say to see if my understanding is correct or if I'm mistaken. If nothing else this has been a good challenge to my understanding of P/PI/PID loops and will help me tune loops in the near future.

Thanks!
 
Last edited:
You are looking at what is referred to as the incremental form of the PID equation. It has some benefits, not the least of which is the ease with which integral limiting and bumpless transfer can be handled. However, this form is leading your coworker a bit astray.

Within the limits of the accuracy of the summation (mn) the output with a proportional only controller will return to zero if the error becomes zero. This is caused by the difference in the scan errors becoming negative as the error decreases. this has the effect of subtracting from the summation mn as the error decreases. Assuming no rounding errors the summation will be zero when the setpoint is reached.

The integral term is there to account for losses in the system in integrating processes (tank level, positioning or pressure based on fill) as well as provide the sustaining output in non-integrating systems like temperature control. In a perfect world where there is nothing that isn't modeled the integral term would be unnecessary.

Originally posted by defcon.klaxon:

This would mean that as the water pressure (PV) rises to the setpoint (SP), the output of the loop is going to reduce, eventually reaching 0. Then as the water pressure starts decreasing, the P loop will turn it back on, but will again eventually reach 0 and will do this ad infinitum.

This isn't unconditionally correct. If a proportional only controller ever reaches the setpoint and settles at it in an integrating system that must mean the system has no losses (leaks in a pressure system). If it settles there is no reason for it to ever move off of that pressure. If something allows some material to escape the pressure will decrease and the the proportional term will cause more material to flow in to account for this proportional to the error. What causes oscillation is if the rate change of pressure is faster than the control system can keep up with and it overshoots the setpoint or the rate of change of flow excites a system pole. Without a damping term you will get oscillation. That said, your pressure example may be better aided by the addition of a derivative term.

Keith
 
Hi Keith,

Thanks a bunch for your response, it all makes sense. One thing I should provide clarification for:

If something allows some material to escape the pressure will decrease and the the proportional term will cause more material to flow in to account for this proportional to the error. What causes oscillation is if the rate change of pressure is faster than the control system can keep up with and it overshoots the setpoint or the rate of change of flow excites a system pole. Without a damping term you will get oscillation. That said, your pressure example may be better aided by the addition of a derivative term.

I left out a part of the example I was giving; that is, the pump I am controlling pumps directly into a water distribution system; thus, the pressure is always going to be bleeding off due to demand in the system. The rate of change is quite variable based on season (more water use during the summer), or extenuating circumstances like firefighters drawing water to fight a fire. So the pump in question starts and stops based on pressure setpoints (start when system pressure drops to 50 PSI, run until pressure is 100 PSI). The idea is that tanks up on a hill (fed from other wells) provide a baseline pressure, and this well "takes up the slack" in areas further from the tanks.

Thus, my understanding is that with a pure proportional controller, the pump's speed will decrease as the PV approaches SP and then as the PV starts lowering as pressure drops, the pump speed will increase to compensate, then return to 0, ad infinitum; if gain is too high, the PV will overshoot and oscillate. If the gain is just right, the PV will still oscillate but not egregiously but the loop will not maintain an output for steady state operation; if the gain is too low, the PV will take "a long time" to get to the SP and may never quite get there. Thus, the need for the integrator term.

If the system was sealed and there were no pressure leaks then it would make sense that the PV would approach the SP and then the PV would remain stable, but the output of the controller would approach and eventually reach 0.
 
Originally posted by defcon.klaxon:

Thus, my understanding is that with a pure proportional controller, the pump's speed will decrease as the PV approaches SP and then as the PV starts lowering as pressure drops, the pump speed will increase to compensate, then return to 0, ad infinitum;

Assuming that there is always at least some amount of usage or leakage, a proportional only controller used for flow based pressure control that is not tuned to the point of oscillation will never return the output completely to zero. Because there is always a requirement there will always be pump motion when using a continuous controller. The only way this would not be true is if you intentionally overrode the continuous controller output with something like a minimum speed value and then intentionally overshot the setpoint. But even in this case most of us wouldn't consider this "oscillation" in the classic sense, just as we wouldn't consider changes in pump speed due to changes in demand to be oscillation. Most of us tend to reserve the term oscillation relative to continuous controllers for those changes that are unwanted. While this limit to the definition isn't universally true it is the most common usage.

You also need to be a bit careful with an integral term in your controller also. If the integral term can't be tuned aggressively enough to keep up with the rate of change of demand then you run the risk of extended overshoot due to the integral when demand decreases.

Keith
 
In simple terms I think of it like this. Once you have a good P value for your system, you'll have a little overshoot, but still some error between your set point and process value at steady state, then you just add a little bit of I to take the error out, so that you're right on setpoint.
 
In a Proportional system the error will never be 0, as this means the pump is not running. when the water is flowing there must be an error to start the pump.
an your coworker is also correct as he says the output is the previous output, as all inside the K is zero.
 
Ignore your discrete-time PID equation for a second, to consider the classical continuous time version for P-only,
Co = Kp *e(t) + bias.

Let's assume a system is operating at steady-state (no load flow changes), and at the setpoint (e(t) = 0). The controller output is your bias term -- it's an amount that you've manually set to ensure steady-state at your operating point. If you make setpoint changes, P-only control should allow you to reach those setpoints with no offsets. Increasing the gain (Kp) will increase speed of response eventually towards oscillations. Changes made to the load flow will result in constant offset from setpoint proportional to your choice of Kp -- small offset for larger Kp and vice versa (whether offset exists to begin with is a function of the process ie, if the process has some integrating dynamics already). To remove offset, you need to change the bias.

Dynamically changing the bias is the purpose of an integrator. This is shown with the interactive equation in continuous-time as,
Co = Kp(e(t) + Ki * Int e(t) dt)

Changing the gains, Kp and Ki (or tau_i, or 1/tau_i...), changes the transient response of the system.
 

Similar Topics

Please help me, I have solve many week but still not solve it. I found trouble of factory talk studio when I set tag by browse address of OPC...
Replies
0
Views
80
Hello Everyone, i Have im my Industry a Endress & Hauser Promag400 this has a screen that constantly have that error, it says to wait, somebody...
Replies
2
Views
427
After replacing the 70 with the 525, the PLC can read from the drive and recognizes it as online, but no commands are being listened to. PLC is...
Replies
1
Views
493
To quickly test a plc output which is wired to a relay do I dob a cable between the output and 24vdc+ source I.e something with 24vdc+ live such...
Replies
6
Views
633
"Hello, I am a beginner learning about PLC. Could you please give me some advice? I want to write PLC instructions as follows: When the sensor...
Replies
18
Views
3,233
Back
Top Bottom