PID Controllers - Everything You Wanted to Know, But Were Afraid to Ask

Wow. For yucks, can you try running with P set to 100 and see what happens? Could it really be that you have the equivalent of a blast furnace heating your pot???
 
Sure I'll try 100 tomorrow. It's 750 watt heater for the small pot.
Ugh - I am an idiot again for going by memory and not double checking an equation. to minimize the derivative function, the value of D needs to be SMALL.

so ... try running with I = 1999, and D = 0

sorry about that......
 
Sure I'll try 100 tomorrow. It's 750 watt heater for the small pot.
the only other thing I can think of right now is that, despite the value of I being set to 1999, that, with a slow time to heat (large proportional band), that the integral term still has enough of a positive value to force the heater to continue heating past the setpoint (that will make more sense when I talk about the "standard form" of the control equation - and this is also a reason why I do not like that form - though it is commonly used).

IF THAT IS THE CASE, then maybe the best way to go here would be to try taking the opposite approach to tuning: start with I=1999 and D=0 (minimizing the effect of both of those terms), BUT then starting with a really small proportional band (P=1 or something like that). The system should overshoot, but hopefully heat up fast enough that the integral term does not cause it to keep heating. the INCREASE the value of P (make the proportional band larger and larger), which will slow the approach to the setpoint and hopefully you will reach a point where you no (or minimal) overshoot without the integral term exerting too much influence. (actually, this might be a good place to start using the damp constant - search out a setting for P where you get minimal overshoot, then start increasing the value of the damp constant until the overshoot is eliminated.

The damp constant is not part of the traditional PID algorithm, but might be useful here to compensate for not being able to actually turn off the integral term.

Does all that make sense?????
 
OK, I didn't check soon enough and missed your post until just now at 3:45pm CST. For the last 30 minutes it was heating from cold to setpoint of 675F (leaving room for more overshoot without getting so hot at 790F. I had P-99.9 with I-1999, and D-399 and boy was it heating SLOW!!! After 30 minutes or so it was only to 400F. I'll go change P=3, I=1999, & D-0 and we'll see what happens {g}

With the P=99.9 the heating was cycling pretty fast, 1 sec on, 1 sec off type of thing. I changed to P=3, I=1999; D-0 and now the heat is staying ON with pot showing temp of 430F. Temp climb from 430 to 530F in just a few minutes without ever turning OFF. I'll let it climb to 600F and if it doesn't start cycling I'll increase P. I'd like to see it start cycling well before it reaches setpoint so it doesn't overshoot so badly.

With autotune the damp constant was 0.2

Update, the setup point is 675F, and temp quickly ramped up and heater turned OFF (not sure when) but temp maxed at 705F and is now falling. I'll monitor to see where temp falls before heating back up again. I'll allow it to cycle a couple of times before changing anything.
 
Last edited:
Yeah - that slow heating is exactly what one would expect from a big proportional band - so that is reassuring. Ill be bummed if that device does not allow you to turn down the integral term enough to stop itfrom accumulating a large value during that prolonged value. To bad the thing cant display the vale of the integral...

i need to write a few more sections to try to clarify all that...
 
I changed P = 2.0 and moved the setpoint up to 700F to see it how fast it recovers the higher temp, and how much over shoot. It's slowly creeping up on 700F setpoint, shows 697-698-697-698, now holding 698F with heater cycling ON/OFF in about 1 sec intervals. S-L-O-W-L-Y creeping up on setpoint. 10 minutes (or more) later it's creeped up to 699F and cycling.

I'd really rather see a bit of overshoot when the need to heat up comes along than take so long to reach setpoint. Remember, this is operating outside in possible wind (fairly calm now), and as bullets are cast pot will empty, have more lead added to drop temp 50F to 100F, requiring heat up again.

The process doesn't require exact temp control, nothing like required for HT'ing a knife. With setpoint at 730F, temp can range from 725 to 735 (740?) with no problem.
 
Got it. You can try setting p=1 ... but question: if you dont need that accurate control, why not ditch the PID function, and set it up for on/off control with a small hysteresis (i dont know ... maybe 2degrees)? You will get max heat rate, some small (hopefully) overshoot, bu probably control within the range you wamt...

fwiw - what you describe above is pretty much exactly what you would expect from mostly pure proportional control. It must have been that integral term that was causing problems?
 
The problem with using a t'stat is cost. A t'stat that will actively control ±2F will cost a few bucks, then have to wire it in with relay, SSR requires a 12vdc power supply and I've got the PID already. Wouldn't setting PID to "limit" which is OFF/ON not be the same as an OFF/ON t'stat?

With the autotune settings of P=2.8; I=152; & D=38 the control is actually ok, perhaps ±3F when the pot is stable. Of course during casting session with lead being removed, and cold lead added it's have a hard time holding that.
 
But... the device you have can just be configured to behave as a thermostat. Sorry, again i am cooking dinner, so cant look at the manual ... but i am sure you can configure that aubern device to behave as an on/off thermostat with adjustable hysteresis. No more $, just set the parameters appropriately... sorry, just cant get to the computer right now...l
 
I really hadn't considered the OFF/ON function, but it seems to be exactly what you're talking about. From the manual: "To use the on/off mode, set outy to 3 or 4 depending on the output device to - + W R R be used. Then, set the Hy to the desired range based on control precision Alarm2 requirements. Smaller Hy values result in tighter temperature control, but also 240V buzzer 9 10 6 8 7 cause the on/off action to occur more frequently. In the PID parameters menu 11 13 (code 0036), only ot and FILt are used. P, I, D and SouF are not meaningful."

That would give a "3" as the outy setting since I've got SSR, I might try that and see what happens. The problem I expect is too much overshoot as the heat doesn't turn OFF until setpoint is reached, and I'm sure it's coast a good bit. Maybe playing around
 
Last edited:
Yeah - that might well happen - but worth finding out. If it works, good. If it does not, take note of the overshoot, and that will help you a lot to define your proportional band (if you goback to pid). The proportional band would need to at least (but somewhat bigger) than that on/off overshoot to start the element shutting down in time (does that make sense why that is?)
 
Cushing, I'm still interested, but won't be doing anything until the weekend. I've got a new mold, reloading dies, and brass coming in the next couple of days and I'll be casting some bullets then for a .45 acp.
 
Cushing, I'm still interested, but won't be doing anything until the weekend. I've got a new mold, reloading dies, and brass coming in the next couple of days and I'll be casting some bullets then for a .45 acp.
Ken - its a cold rainy day here today - so am stuck inside.... will try to get a couple more sections out on proportional PID output, and a start on the integral function.

In the meantime - a thought for you. Like I said, PID controllers are not designed to operate with huge instantaneous disruptions in the system (like, for example, adding several pounds of cold lead to a half empty, but hot, lead pot. With your system - could you re-wire it so that when you add lead (and when you initially start the thing heating) the PID controller is turned off (which should re-set the integral counter), and then you manually monitor until it is just up to temp, then you flick a switch to turn on the PID and start it controlling the temp???? Right now I think one of your issues is that the integral term is just getting out of hand while you are heating. if you can stop that from happening (by what I said above), then you can start its counter from a pretty stable situation, and it should have little problem keeping the temperature stable from there as you run your lots of castings.....
 
At this point I think I need to add some more information regarding the output of PID controllers, and then get a start on the integral term.

If we “get” what happens in the proportional band, then it should be clear that there is some mechanism for the PID controller to step down to lower levels of activity the thing it is controlling. The two ways (as far as I know) that they do this is to use a true proportional output, or to use “pulse width modulation.

In a way, true proportional output is the easiest to understand (but is much less common, and much more expensive). This is done by adjusting the output magnitude (typically the voltage of the PID control output) continuously to lower values. For example, if you are at the lower end of the proportional band, the output of the PID would be its full voltage (for current purposes, lets pick of a guess of 10 volts for “full” output). If you are 50% of the way down the proportional band, the PID output would be 50% of 10 volts (i.e. 5 volts). If you are 25% of the way down the proportional band below the setpoint, the output would be 25% (2.5 volts) and so on.

But because the actual output of the PID is not sufficient to drive most devices (like a pump, or a heating element, or a valve), you need some sort of “translation device” between the PID and the thing being controlled. If you are driving a heating element, you would need a glorified transistor to take the low voltage coming out of the PID, and create a large enough voltage to drive a heating element (not practical). More practical is generating enough continuously variable voltage to drive a continuously variable valve (more doable). But that intervening amplifying equipment, and the continuously adjustable actuators (like a continuously variable valve) are expensive. Hence the use of pulse width modulation.

Lets take for example a control period (in the auber controllers called the Cycle Rate) of 1 second. In this case, if the controller was at the very bottom of the proportional band (or below that), the PID output is “full on” for every second out of every second (I know that is an awkward statement, but I am using it to set up what follows). This looks like this:
upload_2020-3-19_16-42-52.png


With pulse width modulation, instead of running the output at some percentage value of full for the entire second, is instead keeps the output “full”, but turns it on or off so that the percentage of time it is “full on” equals the desired proportion of the output. For example, if the PID is reading 75% downward in the proportional band, the output is “full on” for 75% of the time, and is OFF for 25% of the time:
upload_2020-3-19_16-43-12.png

When it is 50% of the way downwards into the proportional band, it is “on” for 50% of the time, and “off” for 50% of the time:

upload_2020-3-19_16-43-31.png

And so on….

You need, however, to keep in mind that as you get closer and closer to the setpoint, the duration of the “on” time can start getting really, really short (and the opposite at the far lower end of the proportional band). (also, there are some PIDs out there that might now split up the second this way, and instead have a sequence of multiple on/off cycles during the second, as long as the total proportion of “on” time is the correct proportion of the depth into the proportional band.

This kind of output does not work well for, say a mechanical relay, or a solenoid or a solenoid activated valve (which has a minimum activation time (something like 0.2 seconds or more) and which really do not like to cycle on/off at a fast rate). You can buy devices that convert the pulse width modulation to a continuously variable voltage output …. But again, these things are expensive.

This type of control output does, however, work really well for a heating element. In these there is no moving part that takes time to physically move back and forth, and quickly flicking back and forth between full voltage (to the element) and zero voltage is actually a pretty good approximation (in terms of heat output) to a continuously variable voltage applied to the heating element. The only concern here is that there is no way the output of the PID (a few volts) is enough to drive a heating element directly. It is enough (barely) to drive a mechanical relay (which can then switch on and off the higher voltage and current to a heating element. Several PID’s actually have alternate output connections with slightly higher voltages designed to be enough to directly drive a mechanical relay. HOWEVER, remember above it was pointed out that near each end of the proportional band the duration of either “on” or “off” times can get really short, and mechanical relays just are not made to react that fast (and can burn out prematurely if they are made to).

Hence the use of solid state relays (SSR’s) sitting between the PID and the a heating element. They are more expensive than a mechanical relay, BUT they have absolutely no problem handling on/off cycle times down into very small fractions of a second.

Now, lets get back to where this post started. When I originally mentioned the Cycle rate, I pulled out the example of one second. The problem is that this value is adjustable in most PIDs. For example, in the Auber controller, the cycle rate can be varied from 2-199 seconds (it does not go as low as one second). One of the very reasons this value is adjustable is in case a mechanical relay is used, you do not get in to situation where the relay is being asked to cycle on rates much less than one second (so for a mechanical relay, you would set the value much higher – 30 seconds of 199 seconds).

BUT, if you are, say, heating an oven – you have a problem. If you are 10% down into the proportional band, the intent is that the heating element will be on for 10% of the time. If, using the Auber example, you have the cycle rate set at the minimum 2 seconds, the heating element will be turned on for 10% of that (0.1*2s = 0.2 sec), then will turn off for the remainder of 1.8 seconds, the controller will not act on any readings at all until that total of 2 seconds has elapsed. With the cycle rate set at maximum of 199 seconds, at 10% into the proportional band, the controller will turn on for (0.1 * 199 sec = 19.9 sec) and be off for the remaining 179.1 seconds, and nothing will be done until that total of 199 seconds has elapsed.

There are different scenarios that can occur when you are lower down in the proportional band. One example is that you have an oven with a really strong heating element, and small proportional band, and a large value of the cycle rate. The oven will heat at full bore just fine, just not quite hit the bottom of the proportional band, continue heating at 100% for another 199 seconds, and fly right past the setpoint, still heating at full bore. Other variations are all over the place. Things that will increase the likelihood of instability are: small proportional band, large value of cycle rate, and an extremely powerful heating element relative to the insulation of the oven.

The bottom line here, I think, is that for most of what knifemakers there is absolutely no reason not to use the smallest value of the cycle rate that you can (unless you have something mechanical in the system that is being cycled on and off).
 

Attachments

  • upload_2020-3-19_16-41-53.png
    upload_2020-3-19_16-41-53.png
    1.7 KB · Views: 1
  • upload_2020-3-19_16-42-20.png
    upload_2020-3-19_16-42-20.png
    2.2 KB · Views: 1
Last edited:
Ken - its a cold rainy day here today - so am stuck inside.... will try to get a couple more sections out on proportional PID output, and a start on the integral function.

In the meantime - a thought for you. Like I said, PID controllers are not designed to operate with huge instantaneous disruptions in the system (like, for example, adding several pounds of cold lead to a half empty, but hot, lead pot. With your system - could you re-wire it so that when you add lead (and when you initially start the thing heating) the PID controller is turned off (which should re-set the integral counter), and then you manually monitor until it is just up to temp, then you flick a switch to turn on the PID and start it controlling the temp???? Right now I think one of your issues is that the integral term is just getting out of hand while you are heating. if you can stop that from happening (by what I said above), then you can start its counter from a pretty stable situation, and it should have little problem keeping the temperature stable from there as you run your lots of castings.....

I have one of these for my smoker and I believe it does exactly that. When I open the door it senses it, presumably from the rapid drop in temperature, and shuts off the fan. Now I know it likely resets the integral counter - thanks for the info.

https://www.bbqguru.com/StoreNav?CategoryId=1&ProductId=405
 
If you are 50% of the way down the proportional band, the PID output would be 50%, to 10 volts.

Your info is really helpful, thanks for all of the effort. I believe you have a type-o in the above sentence. I think it should say:

If you are 50% of the way down the proportional band, the PID output would be 50%, to 5 volts.
 
Back
Top