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. 

March 7th, 2005, 04:03 PM  #1 
Lifetime Supporting Member

What is P in PID? ...
Greetings to all,
this thread is intended to complete the series of topics which sort of “came to be” in response to the questions “What is I in PID?” which I attempted to answer in this thread ... and “What is D in PID?” which I covered in this thread ... disclaimer: there are MANY ways of setting up PID control ... the information below focuses on just ONE of the most common methods used for the AllenBradley PLC5 family of processors ... specifically, I will be using the “ISA” equation (also known as the “Dependent Gains” equation) for the examples in this thread ... readers who are interested in PID control as used in the SLC500 and MicroLogix and ControlLogix systems should also be able to follow this material without too much trouble ... and so for the basic question: “What is P in PID?” ... the simplest answer that I can offer is that “P” represents the Proportional action ... and that it reacts to the amount of Error – the difference between the SP (Setpoint) and the PV (Process Variable) ... well, if you’re anything like I am, answers like that one leave much to be desired ... they seem to be written by people who fully understand the subject – and intended for other people who already fully understand the subject ... that doesn’t help me out a great deal ... and so the material that I’m posting here is intended for people who do NOT already understand the subject ... going one step further, as everyone is certainly aware, all students are not “created equal” ... the same explanations that can be effectively to teach one, might not work at all while trying to teach another ... throughout this thread I’ll be using some of the most effective methods of explaining the topic that I’ve come up with over the years in my weeklong PID classes ... these are the same types of handson experiments that I use to give the students something of a “feel” for how the PID is supposed to act when it’s “right” ... and how to recognize and correct problems when it’s “wrong” ... just keep in mind that these classes are not intended for engineers who will be developing a control strategy for a brand new system – but rather for maintenance technicians who will be working on and around existing systems ... and specifically on AllenBradley PLC systems using PID control ... basically that means that the “elegant” math (calculus, differential equations, etc.) that most people expect (and many people dread) will not be included here ... instead I’ve always had good success from using a more “common sense” approach to explain the ideas involved ... and I promise that the math included here will never get any more complicated than the simple arithmetic used to balance a checkbook or calculate a proper tip for a good waiter ... on the other hand ... I sincerely hope that my distinguished colleague Peter Nachtwey will take a look at this and offer his constructive criticism to the discussion ... I’m always interested in comparing the “elegant math” methods that he uses for analysis and tuning with the (shall we say?) “lessthanelegant” methods that I rely on ... and of course anyone else out there who wants to take a crack at this is more than welcome to jump in ... moving right along ... before we can really understand how the PID’s Proportional action functions, we need to have a basic idea of how a typical process reacts when placed under any type of control ... we’ll use a simple gas oven as an example ... in Figure 1 the gas to the oven has been turned off for a very long time ... the temperature of the room air surrounding the oven is 75 degrees F ... the oven has cooled down so that its temperature is also exactly 75 degrees ... in other words, the system has reached a “steady state” in which it will neither heat up, nor cool down, until something is changed ... as noted in the figure, there is no heat entering the oven ... and no heat leaving the oven ...
__________________

March 7th, 2005, 04:04 PM  #2 
Lifetime Supporting Member

continued ...
in Figure 2 the gas valve has been manually set for 80% of full flow ... a large amount of heat from the burner is now entering the oven ... as the oven heats up from its initial 75 degrees condition, a difference of temperature develops between the oven and the surrounding room air ... the laws of physics say that this condition will cause heat energy to leave the hotter oven and flow into the cooler room air ... and (this is the important part) the GREATER THE DIFFERENCE between the temperature of the oven and the temperature of the air, then the GREATER THE AMOUNT of heat which will flow ... let’s suppose that the temperature of the oven has increased to 154 degrees as shown in the figure ... the room air is still at 75 degrees ... and so “some” amount of heat is now leaving the oven ... of course the amount of heat coming from the gas burner is very large ... and so despite the loss of heat to the surrounding air, the oven continues to get hotter ... and hotter ...
__________________

March 7th, 2005, 04:07 PM  #3 
Lifetime Supporting Member

continued ...
in Figure 3 our system has reached another “steady state” ... the temperature of the oven has increased to 348 degrees ... the room air is still at its original 75 degrees ... and even though the gas burner is still turned on to its 80% setting, the oven will NOT increase in temperature ... that’s because the increased difference in temperature between the hot oven and the cool air is now sucking heat OUT OF the oven EXACTLY as fast as the gas flame can push heat INTO the oven ... it is VERY important that you understand this concept ... let’s nail it down ... while we’re trying to heat our oven, it’s as though there is an invisible “LOAD” which is working against us ... and the most important thing about this load is that it does NOT remain constant ... instead it increases in strength as the difference in temperature between the oven and the air increases ... if it were not for this increasing load on our system, then the oven temperature would continue to climb – and climb – and climb ... and eventually we’d have a meltdown condition ... the only reason that this doesn’t happen is because  at some definite point  the amount of heat leaving the oven eventually BALANCES the amount of heat entering the oven ... it EXACTLY balances ... and that’s what causes the steady state condition that we see in Figure 3 ... consider what would happen if the room temperature were to increase to 80 degrees ... in that case the temperature difference between the oven and the air would DECREASE ... and so less heat would flow from the oven to the air ... and the temperature of the oven would increase above the steady state condition of 348 degrees shown in our example ... and eventually some new steady state temperature would result ... let’s assume for a moment that the previous 348 degree oven temperature was “just right” ... to maintain our “just right” temperature of 348 degrees under these new “hotter room air” conditions, we’d have to manually change our gas valve setting in order to decrease the amount of heat supplied to the oven ... and of course if the room temperature were to decrease to 70 degrees, then the temperature difference between the oven and the air would INCREASE ... and so more heat would flow from the oven to the air ... and the temperature of the oven would decrease below the steady state condition of 348 degrees shown in our example ... eventually some new steady state temperature would result ... under these new “cooler room air” conditions, we’d have to manually change our gas valve setting to increase the amount of heat supplied to the oven in order to maintain our “just right” temperature of 348 degrees ...
__________________

March 7th, 2005, 04:08 PM  #4 
Lifetime Supporting Member

continued ...
in Figure 4 we’ve improved our oven to include automatic control for the gas valve ... specifically, we’ve added “Proportional” control ... item B is often referred to as a “bellows motor” ... basically it’s a small metal container connected to a sensor bulb by a very thin hollow tube ... when the fluid inside the bulb (something such as mercury) is heated, it expands ... this increases the pressure inside the bellows motor ... the corrugated design of the bellows allows it to also expand ... this provides a linear motion which raises the right end of the lever ... the lever pivots at the fulcrum F so that as the right end rises, the left end lowers ... this action slightly closes the gas valve G ... and the higher the oven temperature, the more the gas valve closes ... soon we’ll replace this mechanical controller with a PLCbased PID instruction ... but in the meantime, we can learn a lot about how the Proportional adjustment functions by studying the lever action shown in the three detail sketches of Figure 4 ... consider the word “proportion” ... another word that could be used for this type of action is “ratio” ... and one very common example of a “ratioinaction” is a simple lever ... in the top detail, the fulcrum point is positioned exactly at the center of the lever ... this adjustment sets up a “onetoone” ratio between the amount of movement at the bellows end of the lever and the gas valve end ... in technical terms, this adjustment could be referred to as a setting for a Proportional gain of 1.00 ... in the middle detail, the fulcrum has been repositioned closer to the right end of the lever ... let’s assume that the “bellows end” of the lever is now just onefourth as long as the “gas valve end” ... this adjustment sets up a “onetofour” ratio between the amount of movement at the bellows end of the lever compared to the gas valve end ... specifically, now any amount of movement from the bellows will move the gas valve four times as far ... this adjustment could be referred to as a setting for a Proportional gain of 4.00 ... in the bottom detail, the fulcrum has been repositioned closer to the left end of the lever ... let’s assume that the “bellows end” of the lever is now four times as long as the “gas valve end” ... this adjustment sets up a “fourtoone” ratio between the amount of movement at the bellows end of the lever compared to the gas valve end ... specifically, now any amount of movement from the bellows will move the gas valve only onefourth as far ... this adjustment could be referred to as a setting for a Proportional gain of 0.25 ... while this type of mechanical linkage might look crude and oldfashioned, you should keep in mind that there are still many systems in use today that rely on these same concepts ... more importantly, the Proportional action of our modern PLCbased control is directly descended from the methods shown in Figure 4 ... and so as you type in various numbers to “tune” the PID’s Proportional action, it might help to think about how this type of control was originally adjusted by mechanically shifting the fulcrum point of a simple lever ...
__________________

March 7th, 2005, 04:09 PM  #5 
Lifetime Supporting Member

continued ...
in Figure 5 we’ve set up a PLC5 to control the Hotrod trainer ... well, actually it’s the “RAMROD” which is a software simulated Hotrod ... but, for our purposes today, the operation will be identical to the real thing ... before we dig into PID control, it might be a good idea to take a quick look at the On/Off control being used in Figure 5 ... notice that the Ramrod has been adjusted for a Setpoint of 200 degrees ... incidentally, we’ll keep this same Setpoint throughout all of the examples in this discussion ... the data shown in Figure 5 was captured after the system had been in operation for quite awhile ... notice that the temperature is continuously oscillating between a maximum of 242 degrees and a minimum of 187 degrees ... another thing to notice is that the Ramrod system heats up faster than it cools off ... you can tell this because the “heating up” side of each wave has a greater angle to its slope than the angle of the “cooling off” side of the wave ... notice also that the Ramrod’s natural period of oscillation is approximately 3.9 minutes ... that gives us about five and a half waves during our 22 minute graph ... now honestly none of these features are critical to our discussion of Proportional control ... but Figures 5 and 6 (which follows) were included to help our more experienced readers get a “feel” for the Ramrod’s operating characteristics ... if there’s any interest in analyzing it, I’ll be happy to post the actual data from these tests ...
__________________

March 7th, 2005, 04:10 PM  #6 
Lifetime Supporting Member

continued ...
in Figure 6 we have an “open loop” test which was run in the manual mode ... like the test shown in Figure 5, this one is also intended to demonstrate some of the operating characteristics of the Ramrod ... we need to spend some time on this one ... before we get started, be sure that you realize that the Setpoint is NOT shown on this graph ... that’s because for this particular test we’re operating in the manual mode ... the black trace shown by points A, B, C, and D is the CV (Control Variable) ... it shows how much “drive” is being fed to the heater ... the fact that the PV does not “follow” the black trace is of absolutely NO importance ... do not get caught up in this common beginner’s mistake ... now notice that the CV started out at point A and was kept at a constant 10% setting up to point B ... then at point B the CV was suddenly “stepped” from its 10% setting all the way up to an 80% setting at point C ... then it was kept steady throughout the rest of the graph all the way to point D ... this is a very common form of test ... now notice that at point J, the PV (Process Variable) had originally settled down at a steady state of 109 degrees ... it maintained this same temperature from point J up to point K ... and notice that the PV did not even begin to respond for about 0.6 minutes AFTER the CV was stepped up from 10% to 80% ... some people call this “flatline” period (the time period between point B and point K) the system’s “lag” ... I (and many others) refer to it as the system’s “deadtime” ... and I’m sure that there are other names for it floating around out there ... after it reached point K, the PV started to respond to the increased CV drive ... the temperature really began to “take off” at point L ... this particular point marks the temperature’s maximum rate of change ... suppose that a complete beginner happened to be watching the Ramrod system as it started heating up (as shown in Figure 6) ... if he didn’t know any better, then he could easily assume that the rapid change of temperature shown from point K to point L might actually continue on for quite some time ... incidentally, this rate of change calculates out to be about 48 degrees per minute ... if that rate of increase continued on unchanged, it would trace the straight line shown from point L to point X ... then the temperature would go “off the charts” (above 500 degrees) ... well, a beginner might be confused by that “possibility” ... but we know that it just won’t happen that way ... remember that we covered the reason why the temperature won’t just “keep right on climbing” when we discussed the physics involved in Figure 3 ... so the truth of the matter is that after that initial “rapid rise” from point K to point L, the rate of the temperature rise starts to “fall off” and eventually levels out at a new steady state value of 348 degrees at point M ... now we’ve finally got the foundation laid ... on to the next post and we’ll start examining the PID’s Proportional action in detail ...
__________________
Last edited by Ron Beaufort; March 7th, 2005 at 04:35 PM. Reason: added detail ... 
March 7th, 2005, 04:12 PM  #7 
Lifetime Supporting Member

continued ...
now let’s set up a PID instruction and see how it reacts when we try to use “Proportional only” control for our Ramrod heating system ...
in Figure 7 the PID’s Setpoint (blue trace) has been set for a target of 200 degrees ... to keep things as close to “applestoapples” as possible, we’ll keep that same setting throughout this entire discussion ... also, the PID’s Integral and Derivative actions will always be turned off throughout these tests ... as the test shown in Figure 7 begins, the Proportional action has been given a setting of 0.00 ... in other words, the Proportional action has been turned OFF completely ... specifically, the Ramrod has NOT been heating and so the temperature has settled down at a steady state of 75 degrees – room temperature ... under these conditions the PID will calculate an Error signal of 25% of full scale (200 minus 75 equals 125 ... 125 divided by 500 equals 0.25) ... soon after the test begins, we manually increase the PID’s Proportional setting from 0.00 to 1.00 ... this causes a sudden jump in the CV ... the size of this jump is determined by two things: (1) the size of the Error, and (2) the setting of the PID’s Proportional action ... in the case shown at the beginning of Figure 7, the Error has already been calculated to be 25% ... multiplying this by the Proportional setting of 1.00 results in a CV of 25% drive to the heater (0.25 multiplied by 1.00 equals 0.25) ... the results of this calculation are shown in Figure 7 by the CV as it instantly jumps up from 0% up to 25% ... this new CV causes the Ramrod to begin heating ... as soon as the “deadtime” has elapsed, the PV starts to increase ... and that brings us to the “Catch 22” of Proportionalonly control ... since the Proportional action is based on the size of the Error (the deviation from the target) we run into a big problem as soon as the PV heads toward the target ... specifically, as the PV approaches the Setpoint, the Error decreases (that’s a good thing) ... as the Error decreases, the Proportional action decreases ... so the CV has less “drive” available to push the PV closer to the Setpoint (and that’s a bad thing) ... this “itkeepslosingsteam” effect of Proportionalonly control really confuses many beginners ... specifically, they usually ask: “but if the PV is still below the Setpoint, then why doesn’t the Proportional action just drive the CV harder in an effort to put the PV on the target?” ... working through the math for the conditions at the end of Figure 7 should help us answer that question ... and keep in mind that the PID is NOTHING but math ... for the test conditions at the end of Figure 7 notice that the Setpoint is still 200 degrees ... the PV has reached a temperature of 126 degrees ... so the PID calculates an Error of 15% (200 minus 126 equals 74 ... 74 divided by 500 equals 0.148) ... the PID then multiplies the Error by the Proportional setting to calculate the Proportional action as 15% (0.148 multiplied by 1.00 equals 0.148 ... and since we're dealing with integer values, the PLC rounds off the result to 15%) ... and the sad truth is that a CV of 15% is simply not enough to push the PV any higher than 126 degrees ... some beginners work through this and STILL have a problem understanding why the Proportionalonly controller won’t work ... they often wonder: “well, the CV increased ... and the temperature went up ... but why didn’t it KEEP going up until it reached the Setpoint?” ... the answer to that question goes back to the concepts we covered in Figure 3 ... remember that while we’re trying to heat our system, it’s as though there is an invisible “LOAD” which is always working against us ... and this load does NOT remain constant ... instead it increases in strength as the difference in temperature between the Ramrod and the room air increases ... at some definite point, the amount of heat LEAVING the Ramrod exactly balances the amount of heat ENTERING the Ramrod ... and for the settings used in Figure 7, that definite point is reached at 126 degrees ... and we’ll have a steady state condition at that point until something changes ...
__________________
Last edited by Ron Beaufort; March 7th, 2005 at 04:42 PM. Reason: note about roundoff issues ... 
March 7th, 2005, 04:13 PM  #8 
Lifetime Supporting Member

continued ...
in Figure 8 we’ll try using a higher Proportional setting ... maybe this will get us closer to the Setpoint ... as the test shown in Figure 8 begins, the Proportional action has once again been turned OFF completely by a setting of 0.00 ... the PID will again calculate an Error signal of 25% of full scale (200 minus 75 equals 125 ... 125 divided by 500 equals 0.25) ... soon after the test begins, we manually increase the PID’s Proportional setting from 0.00 to 2.00 ... naturally this causes a sudden jump in the CV ... the size of this jump is determined by two things: (1) the size of the Error, and (2) the setting of the PID’s Proportional action ... in the case shown at the beginning of Figure 8, the Error has already been calculated to be 25% ... multiplying this by the Proportional setting of 2.00 results in a CV of 50% drive to the heater (0.25 multiplied by 2.00 equals 0.50) ... the results of this calculation are shown in Figure 8 by the CV as it instantly jumps up from 0% up to 50% ... this new CV causes the Ramrod to begin heating and soon the PV starts to increase ... but as the PV approaches the Setpoint, the decrease in Error causes a decrease in the Proportional action ... and so the CV has less “drive” available to raise the PV closer to the Setpoint ... for the test conditions at the end of Figure 8 the PV has reached a temperature of 147 degrees ... so the PID calculates an Error of about 11% (200 minus 147 equals 53 ... 53 divided by 500 equals 0.106) ... the PID then multiplies the Error by the Proportional setting to calculate the Proportional action as 21% (0.106 multiplied by 2.00 equals 0.212) so the 2.00 Proportional setting of Figure 8 gets us closer than the 1.00 setting of Figure 7 ... but still “no cigar” ... let’s try doubling it again ...
__________________

March 7th, 2005, 04:15 PM  #9 
Lifetime Supporting Member

continued ...
as the test in Figure 9 begins, the Proportional action has been turned OFF completely by a setting of 0.00 ... the PID will again calculate an Error signal of 25% of full scale (200 minus 75 equals 125 ... 125 divided by 500 equals 0.25) ... soon after the test begins, we manually increase the PID’s Proportional setting from 0.00 to 4.00 ... the size of the CV jump is always determined by two things: (1) the size of the Error, and (2) the setting of the PID’s Proportional action ... in the case shown at the beginning of Figure 9, the Error has already been calculated to be 25% ... multiplying this by the Proportional setting of 4.00 results in a CV of 100% drive to the heater (0.25 multiplied by 4.00 equals 1.00) ... the results of this calculation are shown in Figure 9 by the CV as it instantly jumps up from 0% up to a fully on condition of 100% ... as this new CV causes the Ramrod to begin heating, the PV approaches the Setpoint and the decrease in Error causes a decrease in the Proportional action ... for the test conditions at the end of Figure 9 the PV has reached a temperature of 167 degrees ... so the PID calculates an Error of about 7% (200 minus 167 equals 33 ... 33 divided by 500 equals 0.066) ... the PID then multiplies the Error by the Proportional setting to calculate the Proportional action as about 27% (0.066 multiplied by 4.00 equals about 0.264 ... some discrepancy due to roundoff is to be expected) ... so the 4.00 Proportional setting of Figure 9 gets us closer than the 2.00 setting of Figure 8 ... let’s try doubling it again ...
__________________

March 7th, 2005, 04:16 PM  #10 
Lifetime Supporting Member

continued ...
as the test in Figure 10 begins, the Proportional action has been turned OFF completely by a setting of 0.00 ... the PID will again calculate an Error signal of 25% of full scale (200 minus 75 equals 125 ... 125 divided by 500 equals 0.25) ... soon after the test begins, we manually increase the PID’s Proportional setting from 0.00 to 8.00 ... the Error has already been calculated to be 25% ... multiplying this by the Proportional setting of 8.00 results in a CV of 100% drive to the heater (0.25 multiplied by 8.00 equals 2.00) ... so actually the Proportional action would be 200%  but naturally the CV can’t go any higher than fully on – or 100% ... the results of this are shown in Figure 10 by the CV as it instantly jumps up from 0% up to a fully on condition of 100% ... and incidentally, if you compare the traces of Figure 10 and Figure 9, you’ll see that the increased setting used in Figure 10 kept the CV at 100% for a longer period of time ... as the new CV causes the Ramrod to begin heating, the PV approaches the Setpoint and the decrease in Error causes a decrease in the Proportional action ... and this time we see just a little bit of oscillation starting to take place ... that’s because the longer time that the CV spent at 100% allowed the PV to keep increasing for a longer period of time ... it got as far up as 196 degrees before it started to fall off again ... at this point the PID calculated a CV of about 6% (200 minus 196 equals 4 ... 4 divided by 500 equals 0.008 ... 0.008 multiplied by 8.00 equals 0.064 ... about 6%) ... like I said earlier, the PID is NOTHING but math ... for the test conditions at the end of Figure 10 the PV has reached a temperature of 181 degrees ... so the PID calculates a CV of about 31% (200 minus 181 equals 19 ... 19 divided by 500 equals 0.038 ... 0.038 multiplied by 8.00 equals 0.304 ... or about 31% with allowance for roundoff) ... so the 8.00 Proportional setting of Figure 10 has us almost there ... this time let’s increase it to 12.00 and try again ...
__________________

March 7th, 2005, 04:17 PM  #11 
Lifetime Supporting Member

continued ...
as the test in Figure 11 begins, the Proportional action has been turned OFF completely by a setting of 0.00 ... the PID will again calculate an Error signal of 25% of full scale (200 minus 75 equals 125 ... 125 divided by 500 equals 0.25) ... soon after the test begins, we manually increase the PID’s Proportional setting from 0.00 to 12.00 ... the Error has already been calculated to be 25% ... multiplying this by the Proportional setting of 12.00 results in a CV of 100% drive to the heater (0.25 multiplied by 12.00 equals 3.00) ... so actually the Proportional action would be 300%  but naturally the CV can’t go any higher than fully on – or 100% ... the results of this are shown in Figure 11 by the CV as it instantly jumps from 0% up to a fully on condition of 100% ... and incidentally, comparing the traces of Figure 11 and Figure 10 shows that the increased setting used in Figure 11 kept the CV at 100% for a slightly longer period of time ... as the new CV causes the Ramrod to begin heating, the PV approaches the Setpoint and the decrease in Error causes a decrease in the Proportional action ... and this time we see some serious oscillations that take most of the 22 minute graph to finally die out ... that’s because the longer time that the CV spent at 100% allowed the PV to keep increasing for a longer period of time ... this time it got up as far as 207 degrees (past the Setpoint) before it started to fall off again ... at this point the PID calculated a CV of about 0% (200 minus 207 equals 7 ... 7 divided by 500 equals 0.014 ... 0.014 multiplied by 12.00 equals 0.168 ... about 2%) ... naturally the CV can’t go any lower than fully off at 0% ... but the math is still perfectly valid ... and while we’re here, let’s run through the math on that next wave of the oscillations ... the PV drops to a temperature of 176 degrees ... so the PID calculates a CV of about 57% (200 minus 176 equals 24 ... 24 divided by 500 equals 0.048 ... 0.048 multiplied by 12.00 equals 0.576 ... or about 57% with allowance for roundoff) ... by spending some time and thought on this particular exercise, you can start to develop a “feel” for what causes such oscillations to form ... and what causes them to eventually die out ... for the test conditions at the end of Figure 11 the PV has reached a temperature of 186 degrees ... so the PID calculates a CV of about 33% (200 minus 186 equals 14 ... 14 divided by 500 equals 0.028 ... 0.028 multiplied by 12.00 equals 0.336 ... or about 33% with allowance for roundoff) ... so the 12.00 Proportional setting of Figure 11 gets us just a little bit closer to where we want to be ... but now we’re starting to see some serious oscillations at these higher settings ... oh, what the heck ... let’s go ahead and increase it to 16.00 and just see what happens ...
__________________
Last edited by Ron Beaufort; March 7th, 2005 at 04:58 PM. Reason: minor typing corrections ... 
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 
PID  A challenge, is a PID good enough?  Peter Nachtwey  LIVE PLC Questions And Answers  21  June 26th, 2019 06:14 AM 
PID, which one is in your PLC?  Peter Nachtwey  LIVE PLC Questions And Answers  8  July 29th, 2004 01:33 AM 
Use a PID?  MarBa  LIVE PLC Questions And Answers  4  May 8th, 2003 10:31 PM 
how often should I trigger the PID?  Ron Beaufort  LIVE PLC Questions And Answers  11  February 22nd, 2003 12:57 PM 
Cascading  Sparky  LIVE PLC Questions And Answers  24  February 17th, 2003 01:33 PM 