This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. 

Try our online
PLC Simulator FREE.
Click here now to try it.

New Here? Please read this important info!!!
December 22nd, 2004, 10:11 PM  #1  
Lifetime Supporting Member

What is “D” in PID? ... fundamentals of Derivative
Greetings to all,
this series of posts is in response to a request from jvalle in this post in which he asked for a basic explanation of the PID’s Derivative action ... I’ll do my best to tackle that subject in this and in the next several posts which follow ... first things first ... different PLC manufacturers perform the Derivative action in different manners ... as if that weren’t confusing enough, even the same manufacturer (for example: AllenBradley) may perform the Derivative action in different ways even within the same processor (example: compare the units used for the Derivative with the PLC5’s “ISA – Dependent Gains” equation and the units used with the same processor’s “AB – Independent Gains” equation ... going even further, within either of the equations mentioned just above, the Derivative action can be based on either the “Error” or on the “Process Variable” ... now the purpose of mentioning all of this at the beginning is not to just confuse you ... but instead only to point out that all of what I’m about to say should be considered a “getting started” lesson for the Derivative action ... I’ll try to be as specific as possible but please keep in mind that there will be exceptions to all of the “rules” which I am about to cover ... if you have specific questions about any part of this, then please post with as much detail as you can manage about whatever you find to be most confusing ... I’ll do what I can to explain the subject in greater detail ... with all of that having been said, let’s move along ... I’ll base all of my examples (unless otherwise noted) on the following setup: an AllenBradley PLC5 processor ... using an Ntype (integer) control block ... using the “ISA – Dependent Gains” equation ... the Error calculation is set for “E = SPPV” ... the Derivative action is based on the “Process Variable” ... the minimum data input to the PID is “0” ... the maximum data input to the PID is “4095” ... Quote:
(1) the Proportional action ... (2) the Integral action ... and (3) the Derivative action ... of these three components, the Derivative that we’re talking about today is the one that is probably the least understood and the hardest to use ... in fact, many experienced programmers will simply tell you to: “just turn the Derivative off – and then leave it off – it’s more trouble than it’s worth” ... I’m not going to enter into that particular debate ... my purpose in writing this is to take a shot at explaining how the Derivative action works and how it is measured ... whether to use it or not remains totally up to you ... now since this series of posts is (after all) about the PID’s Derivative action, I’ll assume (gosh I hate that word) that you’re already familiar with how the PID calculates its Proportional action and its Integral action ... as we move further through this subject of the Derivative action, we’ll eventually talk about how the PID’s Proportional setting (Kc) also influences the amount of response that we’ll get from both the Integral action and the Derivative action ... and incidentally that is why the particular equation that we’re using for our examples is called the “Dependent Gains” equation ... specifically, the amount of Integral response and Derivative response both “DEPEND” on the PID’s Proportional setting ... on to the next post ...
__________________


December 22nd, 2004, 10:12 PM  #2  
Lifetime Supporting Member

continued from the previous post ...
this post is intended to be a quick review of how the PID is executed in a “stepbystep” manner based on time ... in most cases the “time” issue is taken care of by programming a timer’s Done bit which is then used to “trigger” the PID into executing ... for the purposes of discussion, I usually call each execution of the PID a “tick” ... the red lines in the figure below are used to show how the PID’s action can be broken down into a series of these regularlyspaced stepbystep “ticks” or intervals ...
[attachment] the figure shows a common type of “trend” (a graph) of a process being controlled by a PID ... the three signals that we’re most interested in right now are the black trace (the PV  Process Variable – or “input” signal) ... and the blue trace (the SP – Setpoint – or “target” value) ... and the green trace (the CV – Control Variable – or “output” signal) ... each of these are labeled at the right end of their traces ... the red lines on the trend are there just to help us discuss how the operation of the PID takes place in a “stepbystep” fashion just like the “tickticktick” of a clock ... each “tick” is used to “trigger” the PID into executing at an evenlyspaced interval of time ... another perfectly valid way to think about this “stepbystep” execution is in terms of the PID’s “update” time ... but that particular terminology can sometimes lead to miscommunication ... let’s just stay with “ticks” for this discussion ... let’s begin discussing the figure above by looking at what is happening between point A and point B ... between point A and point B the PV (black) is tracking along right on top of the SP (blue) ... in other words, here the PID is giving perfect control of the process ... and if we take a look at the CV (green) during this particular period, we’ll see that it’s happily simmering right along from point C to point D ... the sun is shining ... the birds are singing ... life is lovely ... and then, just as the PV is reaching point B, the operator decides to crank the SP up a notch ... you can see the SP move instantly from point B right straight up to point E ... now let’s take a careful stepbystep look at what happens next ... time is marching on ... and eventually we reach the time of the PID’s next “tick” ... and now when the PID is triggered into execution, it sees the PV (its input) just as it reaches point P1 ... notice that the PV is still simmering along from point B to point P1 without ANY change in its value ... when triggered into operation at point P1, the PID faithfully does its math calculations and finds out that the PV is now suddenly quite a bit “off target” from the SP ... and based on the present value of the SP and the present value of the PV, the PID calculates a new value for the CV ... and based on that new value, the CV is increased from point D right up to point C1 ... and time is still marching on ... eventually we reach the time of the PID’s next “tick” just as the PV reaches point P2 ... and if we look very closely, this time we might notice just a very slight increase in the value of the PV ... this rise in the PV is due to the recent increase in the CV ... that increase in the CV (output) is forcing the PV (input) to move toward the desired SP (target) ... and now when the PID is triggered into operation at point P2, it does its math calculations again and comes up with another new value for the CV ... and based on that new value, the CV is increased again ... this time from point C1 up to point C2 ... and time is still marching on ... eventually the PID “ticks” again just as the PV reaches point P3 ... and this time we notice a little bit more increase in the value of the PV ... the increased CV is still forcing the PV to keep moving toward the SP ... and when the PID is triggered into operation at point P3, it comes up with another new value for the CV ... and the CV is increased again ... this time from point C2 up to point C3 ... and just once more for good measure ... and time is still marching on ... eventually the PID “ticks” again just as the PV reaches point P4 ... and this time we notice even more of an increase in the value of the PV ... the increased CV is still forcing the PV to keep moving toward the SP and by now the PV has finally started making a substantial amount of change from one tick to the next ... and as before, when the PID is triggered into operation at point P4, it comes up with another new value for the CV ... BUT ... this time the CV is not increased ... instead it is decreased in value from point C3 down to point C4 ... Quote:
now on to the next post ...
__________________


December 22nd, 2004, 10:13 PM  #3  
Lifetime Supporting Member

continued from the previous post ...
this post will focus on the basics of how the Derivative action responds to various types of inputs ... as we work through this please remember that these examples are based on a certain specific brand of PLC (AllenBradley) ... and a certain specific platform (PLC5) ... and a certain specific equation (ISA – Dependent Gains) ... and a certain specific signal for our Derivative action (the PV) ... etc. ... the main point is that different systems use different methods of handling the Derivative action ... what follows is just one (but a very common one) of those many different methods ...
the top trace (black) in the figure below shows an artificial PV (input) signal that we’ll use for discussion purposes ... the basic idea is that if we feed this exact same input signal into our PID over and over again, then we can use slightly different adjustments for our PID tuning values each time ... we can then compare “applestoapples” by examining any differences in the PID’s output from one experiment to the next ... [attachment] the top trace starts out at point A with the PV perfectly tracking the SP line ... specifically, between point A and point B, the PID is giving us perfect control of the process ... the SP is 2000 ... the PV is at 2000 ... the sun is shining ... the birds are singing ... life is lovely ... Quote:
now on to the next post for the discussion ...
__________________


December 22nd, 2004, 10:14 PM  #4 
Lifetime Supporting Member

continued from the previous post ...
and now let’s talk about those three examples of Derivative action shown in the previous picture ... let’s start out with the first one (the one labeled “Derivative Action X”) ... notice that as we moved along from point A to point B, the Derivative action was “zero” ... specifically, the PID’s Derivative action was contributing NOTHING to the CV signal ... but as soon as we reached point B, things changed ... specifically the PV changed ... and the Derivative action is always closely monitoring the PV signal watching for any change ...
simply put: the Derivative does not like changes in the PV  and it will do whatever it can do in order to counteract any PV changes that it sees ... important note: keep in mind that the three signals shown at the bottom of this figure are NOT the CV (the total output of the PID) ... instead they represent ONLY the Derivative action which I have mathematically extracted from the CV for the purposes of this discussion ... and so in very basic terms, what we’ve seen so far is that as long as the PV was tracking along horizontally (neither going up  nor going down) then the Derivative action was “happy” and contributing nothing to influence the CV ... BUT ... just as soon as the PV started going downward in value, the Derivative began making a positive (plus sign) contribution ... this positive contribution serves to increase the CV in an effort to overcome the PV’s downward path ... now let’s talk very briefly about that “rounded off” appearance which occurred when the Derivative first started reacting ... this is due to the AllenBradley method of “filtering” the Derivative action ... a full explanation of this filtering is beyond what we’ll have time to cover in this discussion ... but you can do some research about it by starting on page 144 of the PLC5 Instruction Set Reference Manual ... for our purposes today, we’ll just say that the initial response of the Derivative action is “rounded off” and so it takes a few ticks to arrive at its final value ... there’s a little more to it than that, but nothing which will affect our present discussion ... tip: since you have no real control over it, it’s not really worth your time to figure out the Derivative filtering action ... ... next let’s follow the PV along from point C to point D ... during this part of the trend, the PV has “leveled out” ... the PID now sees the PV as a signal which is neither going up nor going down ... and this makes the Derivative action “happy” again ... and notice the effect on the Derivative action between point C and point D ... specifically, between point C and point D the Derivative has dropped back to its “zero” base line again ... of course the action was initially “rounded off” (by the filtering action) but as long as the PV holds “steady” for awhile, the Derivative action will soon drop back to “zero” ... and be SURE to notice that the PV does NOT have to be “on target” for the Derivative to cancel its contribution ... specifically, from point C to point D the SP is still at its original setting of 2000 ... and the PV with its present value of 1500 is way down below that ... so we are definitely “off target” here ... but the Derivative action is still satisfied with that arrangement ... just as long as there is no “change” in the PV, then the Derivative action will be “satisfied” and will cancel (make zero) its contribution to the CV ... and now let’s see what happens next ... from point D to point E the PV starts rising ... and be SURE to notice that the rate of the rise (the slope of the line) is exactly ONE HALF the rate of the fall which occurred between point B and point C ... the PID sees the change in the PV and calculates a value for the Derivative action ... and notice two things ... (1) the number that the Derivative comes up with is exactly ONE HALF of the value that was calculated earlier ... and (2) the value is now a NEGATIVE value ... the “onehalf” value is because the slope of the line (between D and E) is now onehalf of the previous slope (between B and C) ... the negative value results because this time the line is sloping UPward instead of DOWNward ... the biggest thing about the Derivative which “just doesn’t make sense” to most beginners is the fact that the Derivative can “fight against” a change in the PV “EVENWHENTHEPVISHEADINGINTHERIGHTDIRECTION!” ... now that’s really weird when you first think about it ... let’s make sure that you recognize this important effect ... the PV is presently “down in the basement” at a value of 1500 ... the SP (target) is presently up there at 2000 ... beginning at point D, the PV starts HEADINGINTHERIGHTDIRECTION up toward the SP ... but the Derivative cranks out a NEGATIVE value which tends to keep the PV “AWAY FROM” the desired target ... and also notice that even when the PV eventually reaches and then crosses the SP (just before point E) the Derivative STILL keeps the same negative value in place ... even though the PV is now heading AWAY FROM the SP ... and that’s one BIG reason why a lot of technicians can’t seem to come to grips with the Derivative action ... specifically, about half the time the darn thing is working AGAINST us as we try to move the PV toward the target ... secret handshake: here’s the reason that the Derivative was designed to act this way ... the Derivative knows that if the PV keeps heading in ANY one direction (even if it’s the RIGHT direction) then the PV will eventually go TOO FAR and overshoot the target ... one common way of saying this is that the Derivative action is designed to “anticipate” where the PV is going to eventually end up ... and in its fanatical little mathematical mind, even the RIGHT direction will eventually become the WRONG direction if the PV keeps travelling in that direction for too long ... continuing on ... from point E to point F the PV levels out again ... and regardless of the fact that the PV is now “too high” and above the desired target, the Derivative action is once again satisfied that the PV is no longer rising or falling in value ... and so from point E to point F the Derivative action goes back to zero again ... time marches on ... from point F to point G the PV begins to decrease in value ... by now you should have a pretty good idea of how the Derivative action is going to respond when the PV begins to slope downward ... specifically, the Derivative action generates a positive number to contribute to the CV ... this positive number will have the effect of trying to cancel out the falling action of the PV ... and once again, the Derivative seems to be working against us ... it’s actually cranking out a number which tends to prevent the PV from approaching the desired target ... from point G onward, the PV levels out on the SP and continues off into the sunset ... and the Derivative happily goes back to zero ... but notice that it is NOT the fact that the PV is “right on target” that satisfies the Derivative action ... actually it is the fact that the PV is no longer increasing or decreasing in value ... another way of nailing this idea down is to point out that the Derivative doesn’t “give a hoot” about the SP ... as a matter of fact, it never even looks at the SP ... here in a nutshell is the Derivative action’s narrowminded little view of the world: (1) is the PV going down? ... I don’t like that ... I’ll contribute a “positive” value to the CV in order to keep the PV from going down any further ... (2) is the PV going up? ... I don’t like that ... I’ll contribute a “negative” value to the CV in order to keep the PV from going up any further ... (3) is the PV holding steady? ... now there’s finally something that I DO like ... so I’ll make my contribution to the CV a “zero” in order to let the PV continue on its present steady path ... notice that in all of this there is NO mention of whether the PV is headed in the wrong direction – or in the right direction ... the Derivative just doesn’t care about that ... all it cares about is whether the PV is changing or not ... as far as the Derivative action is concerned, “change is bad” ... “steady is good” ... period ... now on to the next post to work on the math ...
__________________

December 22nd, 2004, 10:14 PM  #5 
Lifetime Supporting Member

continued from the previous post ...
in our specific examples, the units being used to measure the Derivative action are “minutes” ... this is not an easy unit of measure for most people to understand ... but let’s work through it using the last figure attached above and see if we can make sense of it ...
first let’s say that the period of time from point B to point C is 10 seconds long ... note that I sketched in ten little marks on the PV trace to help illustrate this idea ... now notice that during that 10 second amount of time, the PV signal dropped 500 counts (from 2000 to 1500) ... that corresponds to a “rate of decrease” of 50 counts per second (500 divided by 10 equals 50) ... now if the PV happened to continue on at that same rate of decrease for one full minute, it would decrease in value 3000 counts (50 times 60 equals 3000) ... notice that for the trace labeled “Derivative Action X” the Derivative setting (Kd) has been set for “0.10” minutes ... what this means is that the Derivative action will start out by calculating a value equal to 0.10 times the PV’s “one minute” rate of change ... specifically, the Derivative action’s BASIC contribution to the CV will come out to be “300” between point B and point C (3000 times 0.10 equals 300) ... but hold on ... that’s just the BASIC calculation ... there’s one more step to do before we’re done ... since we’re using the very common “Dependent Gains” equation, the Derivative’s BASIC calculation gets multiplied by the PID’s Proportional setting ... for our example “X”, the Proportional gain is set for “1.50” ... and so the Derivative action will contribute a value of “+450” to the CV during the time between point B and point C (300 times 1.50 equals 450) ... and that’s how the PID internally calculates the Derivative action ... sonofagun ... it’s all just plain old arithmetic ... once we nail down the pattern, any fourthgrade elementary school student who’s “pretty good” with math should be able to do these calculations ... secret handshake: even though the PID is “based on” some fairly sophisticated ideas from calculus, there is NO higherlevel math involved in anything that the PID does ... specifically, the only math that our PID performs can always be defined in terms of regularoldeveryday “add, subtract, multiply and divide” arithmetic ... and so if you feel the same way that I do about math (I don’t really like it much at all) then take heart ... as long as you can do enough basic arithmetic to accurately balance your personal checkbook, then you should be able to handle all of the math involved in the PLC’s calculations for PID control ... now let’s work through another couple of examples ... for each example we’ll use the same 10 second period of time from point B to point C ... and remember that during that 10 second amount of time the PV signal dropped 500 counts ... and that’s the equivalent of a “rate of decrease” of 3000 counts per minute ... notice that for the trace labeled “Derivative Action Y” the Derivative setting (Kd) has been set for “0.08” minutes ... and so the Derivative action will start out by calculating a value equal to 0.08 times the PV’s “one minute” rate of change ... specifically, the Derivative action’s BASIC contribution to the CV between point B and point C will come out to be “240” (3000 times 0.08 equals 240) ... but that’s just the BASIC calculation ... now we need to multiply the results of that first step by the PID’s Proportional setting ... for our example “Y” the Proportional gain is still set for “1.50” ... and so the Derivative action will contribute a value of “+360” to the CV during the time between point B and point C (240 times 1.50 equals 360) ... and another example ... notice that for the trace labeled “Derivative Action Z” the Derivative setting (Kd) is still set for “0.08” minutes ... and so the Derivative action will start out by calculating a value equal to 0.08 times the PV’s “one minute” rate of change ... specifically, the Derivative action’s BASIC contribution to the CV between point B and point C will come out to be “240” (3000 times 0.08 equals 240) ... but that’s just the BASIC calculation ... now we need to multiply the results of that first step by the PID’s Proportional setting ... for our example “Z” the Proportional gain has been changed to a setting of “1.75” ... and so in this example the Derivative action will contribute a value of “+420” to the CV during the time between point B and point C (240 times 1.75 equals 420) ... we need to talk about that last one ... notice that the “Kd” setting for example “Y”, and the “Kd” setting for example “Z”, were both IDENTICAL ... and yet in example “Z” we got a lot stronger response from the Derivative action ... (420 compared to 360) ... the stronger response resulted from the increase in the PID’s Proportional setting ... specifically, “Kc” in example “Y” was set for “1.50” ... but in example “Z” the “Kc” setting was increased to “1.75” ... this example graphically illustrates one of the BIG PICTURE ideas involved in tuning most control loops (specifically those using the “Dependant Gains” equation) ... the thing to remember is that while you are busily cranking the PID’s “Kc” setting up and down to get more or less Proportional action, you’re also affecting the amount of response from the Derivative action ... and also for the Integral action too ... is that a “good” thing? ... or a “bad” thing? ... I’m not here to debate the issue ... I’m just trying to make you aware of it and to give you some type of “feel” for how the Derivative works ... now let’s do just one more example ... this time we’ll look at the Derivative action’s response for the time period from point D to point E ... and let’s just use the trace in the middle for this example ... the one labeled “Derivative Action Y” ... first let’s say that the period of time from point D to point E is 24 seconds long ... and notice that during that 24 second amount of time the PV signal rose 600 counts (from 1500 to 2100) ... that corresponds to a “rate of increase” of 25 counts per second (600 divided by 24 equals 25) ... now if the PV happened to continue on at that same rate of increase for one full minute, it would increase in value 1500 counts (25 times 60 equals 1500) ... notice that for the trace labeled “Derivative Action Y” the Derivative setting (Kd) has been set for “0.08” minutes ... and so the Derivative action will start out by calculating a value equal to 0.08 times the PV’s “one minute” rate of change ... specifically, the Derivative action’s BASIC contribution to the CV will come out to be “120” between point D and point E (1500 times 0.08 equals 120) ... but remember, that’s the BASIC calculation ... next the Derivative’s BASIC calculation gets multiplied by the PID’s Proportional setting ... for our example “Y”, the Proportional gain is set for “1.50” ... and so the Derivative action will calculate a value of “180” based on these settings and conditions (120 times 1.50 equals 180) ... and we’re still not QUITE finished yet ... since the PID is witnessing an “INcrease” in the PV during this time period, it needs to generate a “NEGATIVE” value for the Derivative action in order to counteract the rise in the PV ... and so the final value that the Derivative action contributes to the CV in this example will be “180” (and be sure to note the “negative” sign) ... a quick disclaimer ... the internal math performed by the PID is often “rounded off” between one step and the next ... if you try your own experiments with these ideas using actual hardware, you will probably notice some minor discrepancies of one or two counts in your expected results ... now on to the next post for the “good stuff” you’ve been waiting patiently for ...
__________________

December 22nd, 2004, 10:15 PM  #6 
Lifetime Supporting Member

continued from the previous post ...
up until now we’ve been looking at how the Derivative action is calculated – and how it’s measured ... now it’s finally time to see what (if anything) the Derivative can do to help us in our efforts to set up PID control for an actual process ...
the figure below shows three trends of the same process ... let’s say that this is a heating system ... in each trend the only setting which gets changed is the “Kd” setting for the Derivative action ... note: as you look at this figure you need to keep in mind that the CV (green) trace does NOT represent just the Derivative action’s contribution to the CV ... this time (unlike the figure in a previous post) the trace represents the ENTIRE total value of the CV ... not just the Derivative action ... [attachment] “Trace 1” shows what the boss has decided is “perfect” control of his process ... let there be no debate on whether this is actually “perfect” control or not ... if the allpowerful boss is happy, then this is as good as it gets ... we’ll accept his judgement and use this tuning as our “benchmark” to compare with the other two examples ... notice that the PV (black) trace starts out at point A ... the SP (blue) trace also starts out at point A but you can’t see it – because it’s being hidden behind the PV ... this means that the PID has the system under perfect control ... the CV (green) trace is simmering along from point D ... the sun is shining ... the birds are singing ... life is lovely ... and now the operator shoves the SP up to point J ... the PID sees that the operator wants a higher temperature ... the PID cranks out a new higher value for the CV which takes it up to point E ... this higher value for the CV eventually causes the PV to rise ... and by the time we’ve reached point X, the PV has started to rise at a fairly respectable rate of increase ... the PID has obviously seen that the PV is headed in the right direction and has already started to decrease the CV from its maximum value at point E ... as time marches on, the PV continues to rise and finally reaches the SP at point Z ... then it settles down “right on target” with no overshoot and no oscillation ... once again, the boss is convinced that this is simply “perfect” control of his process ... and we’re not about to argue with him ... and just so that we’ll have some numbers to compare, let’s say that the Derivative setting (Kd) that we’re using for Trace 1 is “0.08” minutes ... next let’s look at the next example ... “Trace 2” shows the results of decreasing our Derivative setting (Kd) by a factor of four from the “perfect” setting which was used for Trace 1 ... in other words, suppose that our PID has now been tuned for a Derivative setting of “0.02” minutes (0.08 divided by 4 equals 0.02) ... let’s see what happens ... notice that the PV (black) trace starts out at point B ... the SP (blue) trace also starts out at point B ... once again the PID has the system under perfect control ... the CV (green) trace is simmering along from point F ... the sun is shining ... the birds are singing ... life is lovely ... and now the operator shoves the SP up to point K ... the PID sees that the operator wants a higher temperature ... the PID cranks out a new higher value for the CV which takes it up to point G ... this higher value for the CV eventually causes the PV to rise ... and by the time we’ve reached point X, the PV has started to rise at a fairly respectable rate of increase ... the PID starts to decrease the CV from its maximum value at point G ... as time marches on, the PV continues to rise and finally reaches the SP at point Y ... but this time it goes a little bit too far and slightly “overshoots” the SP before it finally settles down on the target ... the boss is NOT pleased with this performance ... and the first thing that he wants to know is “what changed?” ... the answer is that we simply cut down on the amount of Derivative action that our PID is using ... specifically, the PID’s Proportional setting and its Integral setting are both unchanged from Trace 1 to Trace 2 ... only the Derivative was altered ... next let’s look at the next example ... “Trace 3” shows the results of increasing our Derivative setting (Kd) by a factor of four from the “perfect” setting which was used for Trace 1 ... in other words, suppose that our PID has now been tuned for a Derivative setting of “0.32” minutes (0.08 multiplied by 4 equals 0.32) ... let’s see what happens ... notice that the PV (black) trace starts out at point C ... the SP (blue) trace also starts out at point C ... once again the PID has the system under perfect control ... the CV (green) trace is simmering along from point H ... the sun is shining ... the birds are singing ... life is lovely ... and now the operator shoves the SP up to point L ... the PID sees that the operator wants a higher temperature ... the PID cranks out a new higher value for the CV which takes it up to point I ... this higher value for the CV eventually causes the PV to rise ... but this time as the PV starts to rise at a reasonable rate, the PID goes “nuts” and starts to oscillate ... sure enough, the PID started to decrease the CV from its maximum value at point I – but in this example the decrease was made much too rapidly ... this time not only does the PV oscillate, it also overshoots the SP ... and worst of all, it never does quite settle down on the target (at least not during the time shown on the graph) ... the boss is VERY displeased ... and the answer to the inevitable question “what changed?” is that we simply increased the amount of Derivative action for our PID ... specifically, we never even touched the PID’s Proportional setting or its Integral setting ... both remained unchanged from Trace 1  through Trace 2 – and now into Trace 3 ... once again only the Derivative was altered ... on to the next post for a more detailed analysis of the Derivative action in each of the trends ...
__________________

December 22nd, 2004, 10:28 PM  #7 
Lifetime Supporting Member

continued from the previous post ...
now let’s take a closer look at all three of our example trends ... first let’s check out the sudden increases in the CV which took place as soon as the SP was increased in each trend ...
in trace 1, notice the increase of CV from point D to point E ... in trace 2, notice the increase of CV from point F to point G ... in trace 3, notice the increase of CV from point H to point I ... all of these increases are virtually identical ... that’s because in each case the Proportional action and the Integral action were the only things responsible for these increases – and the settings for those particular actions were NOT changed from one trend to the next ... specifically, the Derivative action had NO influence (either positive or negative) on the initial increase of the CV ... (warning: major idea coming up) ... because as we’ve already learned, the Derivative only reacts to CHANGESINTHEPV ... and notice for each trend that during the periods when the CV was initially increased, the PVHADNOTCHANGED yet ... look at the PV as it leaves point A in Trace 1 ... and as it leaves point B in Trace 2 ... and as it leaves point C in Trace 3 ... flat line ... flat line ... flat line ... but eventually when the PV did begin to respond, a different situation developed in each one of the three trends ... look carefully at what happens in each trend as the PV reaches point X ... note: point X marks the position in each trend where the PV has begun making its MAXIMUM RATE OF CHANGE ... and we know that the Derivative absolutely hates to see any change in the PV ... in Trace 1 the measurement labeled “Q” indicates how much CV was “left over” at point X after the Derivative action had done its best to counteract the change (the increase) in the PV ... I knew one oldtimer technician who described the Derivative action by saying that he used it to “clamp a lid” on the PV when it tried to come up too fast ... the “perfect” response (no overshoot – no oscillation) which we obtained in Trace 1 was due to the Derivative action’s ability to “clamp a lid” on the PV when it started to change too rapidly ... specifically, in Trace 1 the Proportional action and the Integral action had both worked hard to initially increase the CV ... they did this in an attempt to bring the PV up to the new SP ... since the Derivative action cares nothing about the SP, he just “chilled out” and waited ... but as soon as the PV started making its turn upward, the Derivative action started to crank out its negative contribution to the CV ... that negative contribution pulled the CV down from its initial maximum value at point E ... and so at point X, only the “just right” amount of CV indicated by measurement “Q” remained ... the PV was still able to increase toward the SP ... but the negative response from the Derivative action limited the PV’s rate of increase so that no overshoot occurred in Trace 1 ... in Trace 2 the measurement labeled “R” indicates how much CV was “left over” at point X after the Derivative action had made its negative contribution to the CV ... that negative contribution pulled the CV down slightly from its initial maximum value at point G ... but at point X the “too much” amount of CV indicated by measurement “R” still remained ... now compare the size of measurement “R” in Trace 2 to the size of measurement “Q” in Trace 1 ... the “onefourth” setting used for the Derivative action in Trace 2 resulted in a much reduced “negative” response ... and since the CV was allowed to remain at its higher value for a longer period, the PV in Trace 2 was allowed to climb too rapidly and eventually it overshot the SP ... we might say that there was not enough Derivative action to “anticipate” and prevent the overshoot condition ... in Trace 3 the measurement labeled “S” indicates just how little CV was “left over” at point X after the Derivative action had made its negative contribution to the CV ... that substantial negative contribution pulled the CV down quite rapidly from its initial maximum value at point I ... and so at point X the amount of CV indicated by measurement “S” was quite small ... now compare the size of measurement “S” in Trace 3 to the size of measurement “Q” in Trace 1 ... the “times four” setting used for the Derivative action in Trace 3 resulted in a much stronger “negative” response ... in Trace 3 the CV was forced down very quickly ... so quickly in fact that the PV actually “turned around” soon after it had started upwards ... notice that near point Y, the PV had reversed its direction and was actually headed back downward AWAY FROM the SP (target) ... continuing on, once the PV had been forced to abandon its upward path, it actually leveled off and began traveling in a horizontal direction ... the Derivative action saw this new horizontal direction as one which was neither rising – nor falling ... the Derivative liked this “steady” PV signal and so it calculated a “zero” for its contribution to the CV ... the Proportional action and the Integral action then took over again and started to drive the CV (and thus the PV) back upward again ... and that’s what caused the oscillations to form ... now on to the next post ...
__________________

December 22nd, 2004, 10:29 PM  #8 
Lifetime Supporting Member

continued from the previous post ...
quick review: so far we’ve talked about how the PID gets executed “stepbystep” based on time ... and we’ve seen how the Derivative tries to cancel out ANY and ALL changes in the PV ... and we’ve seen how the PID calculates its values for the Derivative action ... and we’ve learned how the Derivative’s units of measure (minutes) relate to how much action will be provided ... and we’ve seen an example of how a “just right” amount of Derivative might be able to keep a process from overshooting the setpoint ...
next let’s look at some examples of what might happen if we try using Derivative action on a system with a “noisy” input signal ... the figures below show the “air flow” control loop of the Hotrod trainer ... the length of each graph is 1.10 minutes ... you can find a picture of the Hotrod here ... the basic idea is that the two muffin fans at the far left are blowing air through the clear tube ... one of the dampers (the one on the left) is being positioned by using PID control to control the pneumatic pressure to its actuator ... the damper opens and closes to regulate the amount of air flowing through the tube ... the muffin fan at the right end of the tube is called the “turbine” and is not electrically wired ... air from the other two fans forces the turbine to turn ... a photoswitch shoots a beam of light through the blades of the turbine ... pulses from the broken beam of light are fed to a Red Lion “pulse rate to analog” converter ... this produces a 4 to 20 mA analog current signal which is used for the PID’s input (PV) signal ... [attachment] Figure 1 shows the Hotrod’s air flow system running in the manual mode ... the CV is being held at a constant 75% value ... note the “noise” on the PV ... try to guess how the Derivative action would react to this “jittery” input signal ... remember that the Derivative action responds to “changes in the PV” ... the PV line of this system is constantly changing up – and then changing down ... your guess for how the Derivative will respond to this type of signal should be somewhere between “completely crazy” and “totally nuts” ... now look at Figure 2 ... here we’ve dialed in just a small amount (0.02 minutes) of Derivation action ... a few seconds into the graph, the SP was suddenly “stepped” from 20% up to 40% ... the PID was able to keep the PV pretty close to the SP ... but look at what’s happening to the CV near the top of the graph ... the Derivative action reacts to the constant change of the PV (the “signal noise”) by continuously driving the CV up and down in an effort to counteract the changes that it sees in the PV ... oldtimers used to call this situation “hunting” because the CV is constantly changing up and down just as if it’s “hunting” for the appropriate value ... next think about the poor Hotrod ... the PID tuning being used in Figure 2 looks pretty bad on the graph ... but is sounds even worse in the field ... consider that this CV (output signal) is wired up to an I/P (current to pressure) transducer ... the poor I/P is continuously hammering back and forth ... it builds up pressure to the actuator ... and then it bleeds the pressure off ... over and over ... one of my students said that it sounds like a “cat fight” with all of the hissing and spitting going on ... just how long do you think that the I/P will last with this type of treatment? ... next think about the pneumatic actuator for the damper ... this thing is extending and retracting over and over ... so how long do you think that it will last? ... we’ll do a little bit more with the Hotrod’s air flow tuning in the next post ... but before we leave Figure 1 behind, I want to make one more important point about PID tuning to any beginners out there ... some of my students have seen an erratic PV signal like the one shown in Figure 1 and have tried to “clear up that oscillation” by adjusting the PID tuning values ... it won’t happen ... the “jitter” that you see in Figure 1 is not due to “tuning” ... notice that the system is in the MANUAL mode ... the noise that you see here is due to either (A) the air flow is actually increasing and decreasing rapidly ... or (B) the air flow itself is actually steady but the instrumentation (the signal acquisition, processing, transmission, etc.) is fluctuating ... or (C) both A and B above ... regardless of what’s causing the “noise” you can’t expect to “tune it out” by adjusting the PID ... specifically, you’re either going to have to fix the hardware – or learn to live with the noise ... tuning the PID is NOT the answer ... now on to the next post and we’ll finish up with the Derivative ...
__________________
Last edited by Ron Beaufort; December 22nd, 2004 at 10:31 PM. 
December 22nd, 2004, 10:30 PM  #9 
Lifetime Supporting Member

continued from the previous post ...
again we’ll be working with the Hotrod’s air flow system ... as before, each graph below will be 1.10 minutes in length ... in each graph the SP will be “stepped” from 20% to 40% ... and based on the discussion at the very end of the last post, you already know that you’ll continue to see the same amount of “noise” or “jitter” on the PV signal ...
[attachment] in Figure 3 we have what some people would consider a “reasonably welltuned” system ... we could spend at least a day or two debating that statement – but we won’t ... let’s just say that “whatwe’vegot” is “whatwe’vegot” and get on with life ... now notice that the Derivative action is turned “off” in this figure (Kd = 0.00) ... so whatever we see, we can’t blame it on the Derivative ... specifically, all of the chatter on the CV trace is due to the Proportional action and/or the Integral action ... now notice that there is just a little bit of “overshoot” soon after the change in the SP ... let’s say that we decide to eliminate this overshoot by “clamping a lid” on the PV by dialing in just a tiny little bit of Derivative action ... and based on the results of Figure 2 (in the last post) we already know that “0.02” for a Derivative setting is too much ... so let’s try just half of that amount ... and incidentally, since we’re using the Ntype (integer) control block for our PID, “0.01” is the very smallest Derivative setting available ... specifically, the next smaller setting is “0.00” which would turn the Derivative completely “off” ... and in Figure 4 we have the results ... the PV overshoot has been eliminated ... but take a look at the CV signal and compare it to the CV of Figure 3 ... that extra “chatter” on the CV is due to the Derivative action that we’ve just added to our PID tuning ... so this system demonstrates an important tuning “tradeoff” for us to consider ... is the “eliminationoftheovershoot” worth the extra “wearandtear” on the field devices? ... maybe ... maybe not ... each application has its differences and so you just can’t say that “one size fits all” ... now let’s take a look at Figure 5 ... here the tuning has been “relaxed” a little bit ... compare the Proportional setting (Kc = 0.80) of Figure 5 with the Proportional setting (Kc = 1.50) of Figure 3 ... notice that we’re only using about onehalf of the Proportional action that we had dialed in before ... and to compensate for the reduced amount of Proportional action we’ve more than doubled the Integral action ... as you compare the two “Ti” settings remember that where the Integral is concerned, a SMALLER number gives MORE Integral action ... and so in Figure 5 we’ve decided to cut back on the “fasteracting” Proportional action ... and use more of the “sloweracting” Integral action to keep us on target ... and when we compare Figure 5 to Figure 3, the results aren’t too shabby ... we’ve got a little less “overshoot” (not enough improvement to brag about I’m afraid) and it does take a little bit longer for the PV to “get up to” the SP ... but this tuning could be considered “adequate” for many industrial applications ... and now take a good look at the difference in the CV signals ... the CV is a lot less “jittery” in Figure 5 than in Figure 3 ... and so cutting back on the Proportional action might help make the life expectancy of our field hardware just a little bit longer ... well now ... if the results in Figure 5 are “adequate” with NO Derivative, then would the response be any better with just a little bit of Derivative added in? ... for the answer see Figure 6 ... and to my way of thinking, the answer is “no” ... the PV trace of Figure 6 is almost identical with the PV trace of Figure 5 ... and when we look at the increased “jitter” on the CV signal, I’d say that we were actually better off with the tuning of Figure 5 ... specifically, without the Derivative ... and just for completeness ... you should be aware that the amount of Derivative action being used in Figure 6 is only approximately onehalf of the amount of Derivative action being used in Figure 4 ... even though the settings for “Kd” (0.01) are exactly the same... why do I say that? ... because the “Kc” (Proportional) setting in Figure 6 is approximately onehalf of the “Kc” setting in Figure 4 ... and remember, the BASIC value of the Derivative action gets multiplied by the Proportional (Kc) setting before it gets sent to the CV ... and so ... this series of posts has been my personal contribution to the fundamental question “What is D in PID?” ... of course there is more to the subject than I’ve been able to cover in these few posts ... but hopefully I’ve been able to answer (at least in a basic way) the questions of “whatisit?” and “howisitmeasured?” and “whatcanitdoforus?” and “whatcanitdoagainstus?” ... as I said in the beginning, this discussion of the PID’s Derivative action was intended to serve as a “getting started” point ... I’ve tried to include enough detail in this so that anyone who wants to go further with this subject will have a reasonably firm foundation upon which to build ... despite the length of this, I’m quite sure that there will be at least a few questions which I have failed to answer ... I’ll do my best to address those in future posts IF (and only if) the questions are specific enough to allow a reasonably concise answer ... a disclaimer: quite a lot of this was done in between work on other projects ... I apologize in advance for the inevitable mistakes which I know that I must have made ... and as always, comments, corrections and additions will be welcome ... just remember that I said in the beginning: “there will be exceptions to all of the ‘rules’ which I am about to cover” ... and of course, “your mileage may vary” ... and finally ... recently someone told me: “Ron, you should write a book” ... and maybe I’ll do that someday ... with that possibility in mind, I include this notice for the material in this series of posts: © Copyright 2004, R. H. Beaufort, Charleston, SC – All rights reserved ... my work here is done ...
__________________

December 22nd, 2004, 11:14 PM  #10 
Member

Just one question:
How long did it take to type all of that?
My attention span is barely long enough to read something that long, much less type all of it... You should charge admission for these "classes" I see you included copyright information, I'm sure Eric won't mind if you include a link to "his" legal disclaimer/EULA Thanks. Last edited by 93lt1; December 22nd, 2004 at 11:32 PM. 
December 23rd, 2004, 03:25 AM  #11 
Member
Join Date: Nov 2004
Location: Somerset
Posts: 112

wow
__________________
You need experience to avoid making mistakes. Guess where experience comes from.... 
December 23rd, 2004, 07:50 AM  #12 
Member

As usual Ron, a very impressive explanation.

December 23rd, 2004, 07:53 PM  #13 
Lifetime Supporting Member

and one more approach to the Derivative’s “units of measure” ...
Greetings to all,
probably one of the hardest things about mastering the Derivative action is to develop a “feel” for the “minutes” units of measurement ... the approach that I covered in a previous post is perfectly valid and it generally “makes sense” to most beginning students ... there is another approach, however, which seems to work better for the type of students who tend to think (as I do) more “graphically” rather than “mathematically” ... with these people in mind, here is one more approach to explaining the Derivative action ... incidentally, this is the same “graphical” explanation which was used by Ziegler and Nichols in their famous paper written in 1942 ... if you want to do some extra research on your own, you can find an online copy of their paper here ... just remember that Ziegler and Nichols used the term “Preact” for the Derivative action and that the responses that they used for their illustrations are not filtered (rounded off) the way the AllenBradley Derivative responses are ... the bottom trace (black) in the figure shown below represents the same “sample” PV signal that we used in some of our previous examples ... basically it starts out on the SP ... from point Q to point R the signal ramps downward at a rate of 50 counts per second ... from point R to point S the signal levels out ... then from point S to point T the signal ramps upward at a rate of 25 counts per second ... trends X, Y and Z each have two traces ... the P trace (blue) represents the CV response that would be produced by a Proportional only controller ... the Proportional setting (Kc) is displayed for each trace ... the PD trace (green) in each trend represents the CV response that would be produced by a controller using both Proportional action and Derivative action ... the Derivative setting (Kd) is also displayed for each trace ... [attachment] let’s begin by looking at the P trace (Proportional only  blue) which starts out at point Z ... notice that as soon as the PV starts to ramp downward from point Q, the P signal begins to ramp upward ... this is the PID controller’s attempt to increase the CV and bring the PV back up to the SP ... as we continue to follow the P trace from point Z all the way across the graph, we see that it forms a perfect “mirror image” of the PV signal ... and this is exactly what we would expect from a controller which is using only Proportional action ... next let’s look at the PD trace (Proportional and Derivative  green) which starts out at point Z ... notice that just like the P (Proportional only) signal, as soon as the PV starts to ramp downward from point Q, the PD signal begins to ramp upward ... once again, the PID controller is attempting to increase the CV and bring the PV back up to the SP ... but notice how much more rapidly the signal increases now that we’ve added in some Derivative action to our tuning ... follow the PD trace up to point I ... this is just an arbitrary point that I picked for discussion ... but for simplicity I did make sure that the point was located after the “filtered” (rounded off) area of the trace ... now look at point J on the P trace ... the distance (in time) between point I and point J represents the amount of “anticipation” the Derivative action has added to the CV ... specifically, the response of the CV which used both Proportional and Derivative actions (PD) rose much more rapidly than the CV which used Proportional action alone (P) ... important idea coming up: the distance (in time) between point I and point J is 0.10 minutes ... and that time corresponds with the setting for the Derivative action which in example Z is “0.10 minutes” ... so basically what we are saying when we specify a Derivative setting (Kd) of “0.10 minutes” is that we want the PID to “speed up” the response of the CV beyond what the Proportional action alone would produce ... and the amount of time that we want to “advance” or “speed up” the CV response is (in this example) 0.10 minutes ... as I said at the beginning of this post, some of my students find this particular approach to the Derivative’s units of measure to be much more “intuitive” than the “multiply it out” approach which I used earlier ... on the other hand, other students seem to find the first approach much easier to comprehend ... I’ve decided to just put both approaches up for discussion ... you are free to choose whichever method makes more sense to you ... now let’s continue our discussion ... next let’s follow the PD trace on to point K ... this is just another arbitrary point that I picked for discussion ... and again, for simplicity’s sake, I made sure that the point was located after the “filtered” (rounded off) area of the trace ... now that we’ve followed the PD trace to point K, take a look at point L on the P trace ... the distance (in time) between point K and point L represents the amount of “anticipation” that the Derivative action has added to the CV ... specifically, the response of the CV which used both Proportional and Derivative actions dropped off much more rapidly than the CV which used Proportional action alone ... and the distance (in time) between point K and point L matches our Derivative setting of “0.10 minutes” ... and so ... in simplest terms we could sum up this example of the “graphical” approach to the Derivative action by saying: a Derivative setting of “0.10 minutes” will “speed up” or “advance” the CV response of a Proportional only controller by 0.10 minutes ... specifically, the CV will “increase” 0.10 minutes faster  and it will “decrease” 0.10 minutes faster – than would a CV which is using Proportional action alone ... by now you should be able to recognize the same “speed up” effect of the Derivative action on the other example trends in the figure ... I do want to make sure that you realize that the distance (in time) from point A to point B (on trace X) is only onehalf as long as the corresponding distance from point E to point F (on trace Y) ... and also only onehalf as long as the distance from point I to point J (on trace Z) ... and that’s due, of course, to the difference in the Derivative settings (Kd) between the traces ...
__________________
Last edited by Ron Beaufort; December 23rd, 2004 at 08:16 PM. 
December 27th, 2004, 02:04 PM  #14 
Member

Thanks Ron
Hello Ron,
Thank you very much for the post. I will need some time to really read it over and let it sink in. I am working on getting a trend made up for the loop we were working on. (Ive been too busy) I will get it posted sometime this week. I have one more question for you, since you described integral and derivative so well (better than I have ever had anyone explain it to me) would you please do the same to the proportional gain??? I have an good idea of how it works, but that is what I thought of integral and derivative before you described them. I found out that I was wrong about them. I just want to be sure on everything. Thanks again. jvalle Last edited by jvalle; December 27th, 2004 at 02:07 PM. 
December 29th, 2004, 08:06 AM  #15 
Lifetime Supporting Member

Greetings Joel,
sure ... I'll be glad to take a shot at the Proportional action for you ... but it will probably be a week or two before I'll have anything to post ... the company that I work for is trying to move into newer, larger offices across town ... add the holidays into that mix and things are pretty hectic for me right now ... but stay tuned ...
__________________

Bookmarks 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)  
Thread Tools  
Display Modes  


Similar Topics  
Thread  Thread Starter  Forum  Replies  Last Post 
AB PLC5 PIDs  Derek McFarland  LIVE PLC Questions And Answers  23  March 2nd, 2005 01:18 AM 
Derivative using a PID Loop  power_guy  LIVE PLC Questions And Answers  2  January 10th, 2004 12:31 PM 
Use a PID?  MarBa  LIVE PLC Questions And Answers  4  May 8th, 2003 08:31 PM 
how often should I trigger the PID?  Ron Beaufort  LIVE PLC Questions And Answers  11  February 22nd, 2003 10:57 AM 
Cascading  Sparky  LIVE PLC Questions And Answers  24  February 17th, 2003 11:33 AM 