PID - what is it anyway?

Ron Beaufort

Lifetime Supporting Member
Join Date
Jul 2002
Location
Charleston, SC
Posts
5,701
Just for beginners who aren’t even sure how to spell PID ...

This post is written in response to several questions that I’ve received by emails and by phone calls from people who are obviously too sensitive to publicly post the basic question: “Just what the heck is PID anyway?” The common complaint is that as soon as the subject of PID comes up, the discussion immediately turns to “tuning” and “update times”, etc. It seems that some beginners don’t have ANY idea of what this subject is all about. In other words: “Tune it? I don’t even know what it is!”

Disclaimer: This material is NOT intended to cover PID in any serious detail. There are many things (yes, even important things) which I have been forced to leave out in order to keep this from being completely overwhelming. And so this is intended just as a starting point. I’m sure that many people will read this and say: “Forget it - I’m sorry I asked”. Still, for those poor souls who have no idea what the PID mystery is all about - and yet who really want to know - here is a brief overview. I offer it for what it’s worth.

Let’s start with an analogy. Suppose that my precious little wife has a nice new Buick automobile. This big Buick has plenty of power. I, on the other hand, drive a little red truck which doesn’t have much power at all. Each of these vehicles has a cruise control system. The cruise control in my wife’s car works fine - but the cruise control in my truck is broken.

[attachment]

Figure A starts out with my wife driving along on a level road. The cruise control is keeping the Buick’s speed at a steady 50 mph. Then at point “H” on the graph, the car starts to go up over a little hill. The car’s speed (the red line) starts to decrease a little bit - but then the cruise control system quickly adjusts the amount of gas to the engine - and within just a few seconds the speed is back at 50 mph. Wanda Faye is happy.

Next suppose that I decide to fix the cruise control in my truck by robbing parts from my wife’s car. I find a small plastic box under the dashboard of each vehicle. The boxes are identical - but mine has a definite “burnt up” smell to it. I unplug the box from my wife’s car - and then plug it into my truck. As I’m doing this, I notice three little adjustment screws on each box. One screw is marked “P” - the next screw is marked “I” - and the last screw is marked “D”. I’m not sure what these screws are for - so I just leave them at their factory settings. Now I’m ready to try out “my” cruise control and see if it works.

Figure B starts out with my truck moving along on a level road. The cruise control is keeping the truck’s speed at a steady 50 mph. Then at point “H” on the graph, the truck starts to go up over a little hill. The truck’s speed (the red line) starts to decrease a little bit - and then the cruise control system starts to increase the amount of gas to the engine. The problem is that the cruise control is still adjusted (or “tuned” we might say) for the performance of my wife’s big powerful Buick. Remember, my truck has very little power - and so it needs a LOT more gas in order to maintain a constant speed of 50 mph while going up that hill. Figure B shows the “sluggish” response as the cruise control finally - eventually - tediously - gets the speed back on target. I find this slow response to be genuinely annoying.

Next suppose that I decide to adjust the P, I, and D screws on the little box. I turn one screw clockwise a few notches - and another screw counterclockwise a few notches - and keep experimenting by driving up that same little hill again - and again - and again. After several days of adjusting, I decide that the response shown in Figure C is as good as it’s going to get. Sure it’s not quite as good as the response shown in Figure A - but then my little truck has a lot less power than the Buick - and so I really can’t expect to get the same crisp response.

Now suppose that my wife finally decides that she wants her Buick’s cruise control system to work again. So I take the little box out of my truck and reinstall it back into her car. But - big mistake - I forget to readjust the P, I, and D screws. I simply leave them “tuned” for the characteristics of my little truck.

Figure D starts out with my wife driving along on a level road. The cruise control is keeping the Buick’s speed at a steady 50 mph. Then at point “H” on the graph, the car starts to go up over a little hill. The car’s speed (the red line) starts to decrease a little bit - and then the cruise control system increases the amount of gas to the engine. The problem is that the gas isn’t being increased “just enough” for the Buick’s response. Instead, the cruise control pumps in the large amount of gas required to get MY LITTLE TRUCK up the hill at a constant 50 mph. Of course, this is WAY TOO MUCH gas for the big powerful Buick. As the car’s speed suddenly increases it “overshoots” the target and goes much too fast. Next, the cruise control tries to compensate by letting up on the gas - but now the speed drops way too low. Again, the poor cruise control tries to compensate by increasing the gas - and look at the runaway oscillations which result. Believe me, Wanda Faye is NOT happy with the performance of her cruise control.

Luckily I was smart enough to mark the Buick’s original factory settings for the P, I, and D screws before I messed around with them. So I retune the system to match the Buick’s response and we’re back to the conditions shown in Figure A.

What we’ve seen so far: Different systems (vehicles in our analogy) have different operating characteristics. To get adequate control, the controller has to be “tuned” so that its response matches the characteristics of the specific system being controlled.

[continued in next post]

buick truck pid ad.jpg
 
[continued from previous post]

Many years ago, long before there were PLC’s, control engineers started thinking to themselves: “Wouldn’t it be nice if we had some way of analyzing a system BEFORE we tried to tune its controller? That way we could simply CALCULATE the proper settings for the P, I, and D screws without all of the waste involved with the trial-and-error method.”

Here (explained in a very simplified manner) are some basic ways of graphically analyzing the characteristics of some common types of systems. In other words, let’s talk about some features on a graph that would tend to “catch the eye” of a trained professional.

[attachment]

Figure E shows a common “step test” applied to my wife’s big Buick. The controller is in the manual mode so there is no “target” speed on the graph. (Incidentally, that’s what the term “open-loop” test means - “manual control”.) The blue line indicates the controller’s output (also known as the CV or “Control Variable”). The graph starts out with the CV held at a constant value - and the car’s speed (known as the PV or “Process Variable”) shown as a red line. Notice that so far the speed is constant - there will be NO HILLS in this type of test. Then, at a certain point, we suddenly increase the CV to a new steady value. In other words, we increase the gas and then hold it steady - while we watch what happens to the speed of the car. After a certain amount of time, the speed starts to climb. Next, the speed will level off and eventually settle out at a new steady speed - a speed which corresponds to the amount of gas that we’re now feeding to the engine.

Figure F shows a common “step test” applied to my little truck. Again, the graph starts out with the CV held at a constant value - and the truck’s speed shown as a red line. Notice that so far the speed is constant. Then, at a certain point, we suddenly increase the CV to a new steady value. In other words, we increase the gas and then hold it steady - while we watch what happens to the speed of the truck. After a certain amount of time the speed starts to climb. Next, the speed will eventually settle out at a new steady speed - a speed which corresponds to the amount of gas that we’re now feeding to the engine.

We can make it easier to analyze this type of graph by drawing a straight tangent line which touches the Process Variable (speed) line - and which traces the “maximum climb” part of the speed line. You’ll see such a slanted line drawn in Figure E - and another one drawn in Figure F. The slope of each line (the angle “R” on each graph) gives us a quick idea of the relative “horsepower” or “get-up-and-go” capability of each system. Shown this way, it’s quite easy to visually compare the two systems and see which one is going to be able to respond more quickly when the controller calls for an increase in speed.

Other things to notice on Figures E and F are the arrows marked “dCV” and “dPV”. You should already know that “CV” refers to the Control Variable - and “PV” refers to the Process Variable. Secret handshake: When engineers put a little “d” in front of something, it usually stands for the Greek letter “delta” - and simply means “the change in ...” In other words, the arrows in Figures E and F indicate “the change in” the CV - and “the change in” the PV.

Notice that the same amount of change in the CV (gas) was made in Figure E and in Figure F - but look at the much greater change in the PV (speed) for the big Buick when compared to the change in the PV (speed) for the little truck. Clearly these two systems are very different in their responses.

Next, notice the distance “L” on each graph. This indicates the system’s LAG - an indication of how long the system “waits around” before it actually starts responding to a change in the CV. Notice that the lag period starts as soon as the CV is stepped up (increased). But also notice that the lag period doesn’t end exactly where the PV begins to first “curve upward”. Instead, picture the initial PV line to be extended to the right horizontally (as shown in green). Most practitioners consider the end of the lag period to be at the point where the slanted “tangent” line intersects this extended PV line. In other words, where the PV begins making a SIGNIFICANT change in value. Note: Some people refer to the “lag” as the system’s “deadtime” - there’s a little more to it than that - but for this simple beginner’s description either reference would be ok.

Notice that the Buick’s lag period (as shown in Figure E) is much shorter than the lag period for the truck (as shown in Figure F). Generally speaking, systems with longer lags are harder to control than systems with shorter lags.

And so - Figure E and Figure F have shown us how to visually recognize some of the differences in the characteristics of one system when compared to another. So how does that really help us?

Back in 1942, two engineers (Ziegler and Nichols) came up with a method of analyzing the graphical information contained in figures such as Figures E and F - and of using this information to mathematically calculate “recommended” tuning values for the P, I, and D settings of the controller.

Incidentally, “P” stands for “proportional” - “I” stands for “integral” - and “D” stands for “derivative”.

If you’re still with me, this would be a good time to look at a previous post which I used as an example of the Ziegler-Nichols Reaction-Curve Method.

http://www.plctalk.net/qanda/showthread.php?postid=21345#post21345

Basically, I used a freehand sketch of a step change test and applied the Z-N method to it. The calculated values for P, I, and D are shown near the lower right corner of the graph. For this controller, the P setting is identified as Kc, the I setting is identified as Ti, and the D setting is identified as Td.

Finally, suppose that you had an Allen-Bradley PLC-5 which you wanted to use as a cruise control for your car. This would be one example (but not a very realistic one, I’m afraid) of a PID application.

In very simplest terms, you would program a PID for an Allen-Bradley controller by entering a PID instruction on a rung - much as you would enter a timer. Part of the setup will require you to enter things such as:

PV = where will I get the analog input signal? (example: from the car’s speedometer)

CV = where will I put the analog output signal? (example: to the car’s gas setting)

Kc = how much Proportional action does this system need? (suggestion: do a step change test - graph the response - calculate the values)

Ti = how much Integral action does this system need? (suggestion: do a step change test - graph the response - calculate the values)

Td = how much Derivative action does this system need? (suggestion: do a step change test - graph the response - calculate the values)

Sorry, but that’s all I have time for today. I hope this helps - I know that it would have helped me when I first got started.

buick truck pid ef.jpg
 
Ron,

Your analogy using the big car/little truck was quite helpful to me. I haven't yet had an opportunity to work with PID circuits, but I know the time is coming.

Many, many thanks for your time and generosity.

Grover
 
Very nice Ron. I have used the analogy of a family to describe what the P, I, and D terms do. (I did not come up with this analogy, but it seems to get the point across.)

P is like a child. It just runs around wide open making a general mess of things.
I is like the mother. Reining in the child and trying to control him.
D is like the dad. He's not sure what is going on, but if it keeps up, he is going to step in and do something to make it stop.
 
Ron, this is possibly the best example I've ever seen of a non-selfish genuinely-sharing approach to explaining a technical concept. My hat's off to you.

If you don't mind, one hopefully constructive comment. You seem, in my view, to have fallen into the same trap that you observed so many others have fallen into---that of beginning to describe what PID is and immediately moving to how to tune it.

If you don't mind, let me attempt to provide a bare-bones concept of what PID is. It won't have the sheer cleverness of your explanation but I'll try my best. Hopefully, it will fit well with your work above.

My attempt is in the next post.
 
PID What is it?

We all have seen examples of direct or manual control of a process variable. A speed control pot connected to a fan motor or a cable system connected to a remote valve handle are examples. The key here is that the control input (the pot or the cable loop) directly control the process element whether increasing or decreasing.

The big difference with PID control is that there is no direct connection between the control input (the pot, for example) and the output action such as a fan speed changing or a valve moving. Instead, your control input is routed to a device which compares what you want (the position of the pot, for example)(this is the control variable CV in Ron's post) with a signal coming back from the process element (a tachometer on the fan motor, or position transmitter on a valve)(this is the process variable PV in Ron's post).

When this device does this comparison, it generates an error signal either positive or negative. NOW HERE COMES THE CRITICAL PART! It is this error signal that controls the output to the process element, not your input signal. This error can occur due to you changing the control input or, something upsetting the process (the fan motor is dragged down for some reason, or the valve pushed out of position).

If this error signal is positive, it means that the fan motor is turning slower than you want it to turn. The positive signal goes to the fan motor and makes it go faster. If the error had been negative, the fan was turning too fast so the signal driving the fan motor is reduced so it slows down to match the speed you said you wanted it to go.

Now, if you consider what was just presented above, you can see that if you amplify the error signal, you will reduce the amount of error necessary to get your desired result. This is proportional gain or P, because it always is in direct proportion to the error signal. You might say then, well, let's pour huge amounts of gain at the system so the error will be very small. That's ok, except that at some point, depending on lots of factors in the whole system, too much P gain will cause the system to become unstable and constantly hunt around for the right point hopelessly overshooting it everytime. This instability limits how much gain you can use. Ron refers to some techniques for predicting how much of this gain will be possible but many many systems are manually tuned in the field. I'm going to stay away from tuning issues.

Another thing that happens when you use only P gain is that as output signals increase, it takes a larger and larger error signal to drive it assuming that the gain is held constant. (Remember, if you have all the P gain possible without instability already, you can't add more to reduce the higher errors needed for large output signals)

To beat this problem, another kind of gain called integral gain or I is applied to the error signal. This gain is based, not on the size of the error, but, on how long the error continues. The longer the error continues, the larger the signal becomes. This I gain is useful for taking the error and, over time, driving it toward zero. Since it is based on time, it is very useful for taking large output signals with their companion large error, and still driving them toward zero error. As a result, I gain makes a nice complement to P gain and the two are almost always used together.

The third type of gain is differential gain or D gain. This is a separate gain that operates only on the rate of change in the error. For example, if the error suddenly increases, the D gain applies an extra "poke" to the output to offset this sudden error and attempt to correct it quickly. It also can be positive or negative depending on which way the error changes. D gain is used somewhat less frequently than P and I gain and only in systems that need very snappy, quick response operation. As with P gain, too much I gain and especially D gain can lead to instability which is to be avoided.

This description is sure to cause some "purists" heartburn. It is only intended as a basic help for grasping fundemental concepts. Hopefully, it has helped someone here.
 
Excellent basic starting point description from you gentlemen. I came up in a slightly different world, temperature control, where the parameters were known as Proportional, Rate and Reset but the temperature world has basically gone back to the now common terms. The old terms still appear though.
Ron, sounds about right. The wife has the Buick and you have the little truck. "She who must be obeyed". Know the feeling well.
beerchug
 
Sincere thanks, I go all the way back to B.I.F. flow control units with bellows, stings and mercury chambers. Cam operated tank level transmitters with mercury switches, then came solid state, SCADA and etc.... Got away from controls/ water and waste for a decade. So I am a beginner again in many ways. Love the RsLogix 5000. Tags; how did we program without them. But I digress.

Just a sincere thanks to you ALL for your time.

Jeff
 
PID idea is very old thing who base on RC-circuits.

Forget it. Today we have microprocessors and we can control how we like with difference and with or without time. In other words, P or PI control. D part belongs to Rolling mill.
 
PID idea is very old thing who base on RC-circuits.

Forget it. Today we have microprocessors and we can control how we like with difference and with or without time. In other words, P or PI control. D part belongs to Rolling mill.

You really don't know much, do you? I thought I had you on ignore... going to fix that now.
 
PID idea is very old thing who base on RC-circuits.

Forget it. Today we have microprocessors and we can control how we like with difference and with or without time. In other words, P or PI control. D part belongs to Rolling mill.
?????
Have you been drinking seppo ?

PID is a method to control something by feed-back. It does not matter if done with analogue electronics and tuned with pot-meters, or done in a microprocessor and tuned by changing discrete values.

Ron's text is till good.
 
The trucks been good. The PID content is even better. How much of that stuff do you have to smoke to have 40 years of experience and not know how to spell PID?
 

Similar Topics

I have S7 1512C controler for controlling 48 PID temperature loop, the output is PWM. Please I need the best, most efficient way to write the...
Replies
5
Views
213
Hi all, I'm having trouble solving a problem I've been working on for several months, and thought you might like a stab at it. The machine runs...
Replies
22
Views
840
How can I connect PID Output to a valve. In ladder logic program is there any logic do I want to add between valve and PID? PV=SP What will be the...
Replies
7
Views
383
I'm setting up a PID for a 50hp RO pump in a water treatment plant. When I go to manual mode on hmi I set the swm bit, I also ons the pid output%...
Replies
5
Views
524
I am setting up control for Hypochlorite dosing. The easy part is the dosing calculation for flow pacing but I would also like to setup trimming...
Replies
8
Views
890
Back
Top Bottom