Forums

PID Heater Control

Started by rickman November 22, 2015
If a heater is controlled by turning it on and off, does a PID algorithm 
help in more closely controlling the temperature?

Will running the PID loop faster than the temperature measurement 
improve anything?

How would a PID control be an improvement over a simple temperature 
comparison with or without an anticipator?

-- 

Rick
On Sun, 22 Nov 2015 14:33:55 -0500, rickman wrote:

> If a heater is controlled by turning it on and off, does a PID algorithm > help in more closely controlling the temperature?
Compared to what? Yes, compared to a lot of things.
> Will running the PID loop faster than the temperature measurement > improve anything?
Probably not much, however pulsing the heater on and off faster than the temperature measurement may well improve things -- it depends on whether you can turn the heater on and off quickly, and what it's thermal time constant is. In the extreme, turning power on and off to a heating element significantly faster than it's thermal time constant will give you steady, rather than pulsating, heat.
> How would a PID control be an improvement over a simple temperature > comparison with or without an anticipator?
Most on/off thermometer-ish systems need to see the temperature actually change to work. This is less the case with an anticipator, but that brings its own problems. In the case where the thermal loss is constant and the temperature needs to be held steady, and where the heating element is being pulsed significantly faster than the thermal time constant of the plant (if not the heater), then the PID would, in theory, hold the temperature dead steady -- or at least as steady as it can given how fast it is being pulsed on and off. -- www.wescottdesign.com
On 11/22/2015 4:11 PM, Tim Wescott wrote:
> On Sun, 22 Nov 2015 14:33:55 -0500, rickman wrote: > >> If a heater is controlled by turning it on and off, does a PID algorithm >> help in more closely controlling the temperature? > > Compared to what? Yes, compared to a lot of things.
A conventional type thermostat with a set point and a hysteresis band.
>> Will running the PID loop faster than the temperature measurement >> improve anything? > > Probably not much, however pulsing the heater on and off faster than the > temperature measurement may well improve things -- it depends on whether > you can turn the heater on and off quickly, and what it's thermal time > constant is. In the extreme, turning power on and off to a heating > element significantly faster than it's thermal time constant will give > you steady, rather than pulsating, heat.
If the temperature measurement isn't updated, how would the PID provide any better control over the temperature? At best it essentially does the same thing for 10 periods until the temperature reading is updated, at worse the integral term ramps up resulting in overshoot and oscillations.
>> How would a PID control be an improvement over a simple temperature >> comparison with or without an anticipator? > > Most on/off thermometer-ish systems need to see the temperature actually > change to work. This is less the case with an anticipator, but that > brings its own problems.
What problems does an anticipator create?
> In the case where the thermal loss is constant and the temperature needs > to be held steady, and where the heating element is being pulsed > significantly faster than the thermal time constant of the plant (if not > the heater), then the PID would, in theory, hold the temperature dead > steady -- or at least as steady as it can given how fast it is being > pulsed on and off.
How does a PID controller cycle the heat in absence of updated temperature readings? On the update of temperature, the differential and proportional terms will give a constant input to the calculation until the temperature is updated again. The integral term will push the integrator in a direction with a constant ramp for the duration of the temperature reading period. I suppose this could result in one pulse during the temperature reading period, but will create an internal overshoot for the next period which will show up as a too short pulse. Obviously this is all dependent on the parameters of the PID controller, but I'm having trouble picturing how the faster PID loop would provide any useful benefit rather than just causing oscillations. -- Rick
On Sun, 22 Nov 2015 14:33:55 -0500, the renowned rickman
<gnuarm@gmail.com> wrote:

>If a heater is controlled by turning it on and off, does a PID algorithm >help in more closely controlling the temperature?
It can help. You turn the heater on and off fast enough that it is effectively an analog output. It's called 'time proportioning' in the industry.
>Will running the PID loop faster than the temperature measurement >improve anything?
Certainly not. There's no new information.
>How would a PID control be an improvement over a simple temperature >comparison with or without an anticipator?
With an anticipator it might be fairly similar. Comparison normally needs some deadband so you would tend to get higher temperature ripple with comparison that with a time-proportioning PID. The output will turn off earlier in the latter case, as it needs no information from the sensor to do so (it can turn on and off many times per temperature measurement if you want, but it's commonly not done that way). --sp -- Best regards, Spehro Pefhany Amazon link for AoE 3rd Edition: http://tinyurl.com/ntrpwu8 Microchip link for 2015 Masters in Phoenix: http://tinyurl.com/l7g2k48
On 11/22/2015 6:13 PM, Spehro Pefhany wrote:
> On Sun, 22 Nov 2015 14:33:55 -0500, the renowned rickman > <gnuarm@gmail.com> wrote: > >> If a heater is controlled by turning it on and off, does a PID algorithm >> help in more closely controlling the temperature? > > It can help. You turn the heater on and off fast enough that it is > effectively an analog output. It's called 'time proportioning' in the > industry.
How does the PID loop turn the heater on and off any faster than a simple set point? Add an anticipator and overshoot is minimized.
>> Will running the PID loop faster than the temperature measurement >> improve anything? > > Certainly not. There's no new information. > >> How would a PID control be an improvement over a simple temperature >> comparison with or without an anticipator? > > With an anticipator it might be fairly similar. Comparison normally > needs some deadband so you would tend to get higher temperature ripple > with comparison that with a time-proportioning PID. The output will > turn off earlier in the latter case, as it needs no information from > the sensor to do so (it can turn on and off many times per temperature > measurement if you want, but it's commonly not done that way).
When you say "time-proportioning PID", you mean an output that is not just on or off, but a number that is used to control PWM? That would be above and beyond just PID. Someone in another group seems to be saying his PID loop running at 10x the temperature measurement rate gives him this fine on/off control. But his temperature measurements have lots of variation. Well, by "lots" I mean a lot more than I expect could be done easily by just setting a temperature and turning the heat on and off possibly with an anticipator. He is getting maybe &#2013266097;1 C&#2013266096;. My house thermostat keeps the temperature within 1 F&#2013266096; and it is not really trying. He doesn't really want to discuss it. I would like to understand the reality. -- Rick
On Sunday, November 22, 2015 at 4:44:37 PM UTC-8, rickman wrote:
> On 11/22/2015 6:13 PM, Spehro Pefhany wrote: > > On Sun, 22 Nov 2015 14:33:55 -0500, the renowned rickman > > <gnuarm@gmail.com> wrote:
> >> Will running the PID loop faster than the temperature measurement > >> improve anything? > > > > Certainly not. There's no new information.
Moreover, it takes two or more measurements of temperature to update a 'D' (differential) value. It's unclear whether this is about a time-sampled temperature measurement (with discrete approximations of integral, proportional, and derivative terms), or an analog measurement of temperature with analog differentiation and integration elements.
> >> How would a PID control be an improvement over a simple temperature > >> comparison with or without an anticipator?
This is confusing; the 'D' term, in PID, is an anticipator.
> Someone in another group seems to be saying his PID loop running at 10x > the temperature measurement rate gives him this fine on/off control.
If he is computing a new proportional term (or integral, or derivative), it means he has an extrapolation of his temperature measurements, and is applying that extrapolation to compute the PID response. The issue then becomes the accuracy of the extrapolation (which depends on the system and the extrapolation scheme). If he's not computing a new term, his 'PID' latches a heat setting until the next temperature update.
On Sun, 22 Nov 2015 16:55:04 -0500, rickman wrote:

> On 11/22/2015 4:11 PM, Tim Wescott wrote: >> On Sun, 22 Nov 2015 14:33:55 -0500, rickman wrote: >> >>> If a heater is controlled by turning it on and off, does a PID >>> algorithm help in more closely controlling the temperature? >> >> Compared to what? Yes, compared to a lot of things. > > A conventional type thermostat with a set point and a hysteresis band. > > >>> Will running the PID loop faster than the temperature measurement >>> improve anything? >> >> Probably not much, however pulsing the heater on and off faster than >> the temperature measurement may well improve things -- it depends on >> whether you can turn the heater on and off quickly, and what it's >> thermal time constant is. In the extreme, turning power on and off to >> a heating element significantly faster than it's thermal time constant >> will give you steady, rather than pulsating, heat. > > If the temperature measurement isn't updated, how would the PID provide > any better control over the temperature? At best it essentially does > the same thing for 10 periods until the temperature reading is updated, > at worse the integral term ramps up resulting in overshoot and > oscillations. > > >>> How would a PID control be an improvement over a simple temperature >>> comparison with or without an anticipator? >> >> Most on/off thermometer-ish systems need to see the temperature >> actually change to work. This is less the case with an anticipator, >> but that brings its own problems. > > What problems does an anticipator create? > > >> In the case where the thermal loss is constant and the temperature >> needs to be held steady, and where the heating element is being pulsed >> significantly faster than the thermal time constant of the plant (if >> not the heater), then the PID would, in theory, hold the temperature >> dead steady -- or at least as steady as it can given how fast it is >> being pulsed on and off. > > How does a PID controller cycle the heat in absence of updated > temperature readings? On the update of temperature, the differential > and proportional terms will give a constant input to the calculation > until the temperature is updated again. The integral term will push the > integrator in a direction with a constant ramp for the duration of the > temperature reading period. I suppose this could result in one pulse > during the temperature reading period, but will create an internal > overshoot for the next period which will show up as a too short pulse. > > Obviously this is all dependent on the parameters of the PID controller, > but I'm having trouble picturing how the faster PID loop would provide > any useful benefit rather than just causing oscillations.
Did you ACTUALLY READ what I took the time to write, in a spirit of helpfulness? ?? ???? "However, pulsing the heating element ..." If that statement doesn't make sense, ask about it -- because it makes all the difference. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 11/23/2015 1:15 AM, Tim Wescott wrote:
> On Sun, 22 Nov 2015 16:55:04 -0500, rickman wrote: > >> On 11/22/2015 4:11 PM, Tim Wescott wrote: >>> On Sun, 22 Nov 2015 14:33:55 -0500, rickman wrote: >>> >>>> If a heater is controlled by turning it on and off, does a PID >>>> algorithm help in more closely controlling the temperature? >>> >>> Compared to what? Yes, compared to a lot of things. >> >> A conventional type thermostat with a set point and a hysteresis band. >> >> >>>> Will running the PID loop faster than the temperature measurement >>>> improve anything? >>> >>> Probably not much, however pulsing the heater on and off faster than >>> the temperature measurement may well improve things -- it depends on >>> whether you can turn the heater on and off quickly, and what it's >>> thermal time constant is. In the extreme, turning power on and off to >>> a heating element significantly faster than it's thermal time constant >>> will give you steady, rather than pulsating, heat. >> >> If the temperature measurement isn't updated, how would the PID provide >> any better control over the temperature? At best it essentially does >> the same thing for 10 periods until the temperature reading is updated, >> at worse the integral term ramps up resulting in overshoot and >> oscillations. >> >> >>>> How would a PID control be an improvement over a simple temperature >>>> comparison with or without an anticipator? >>> >>> Most on/off thermometer-ish systems need to see the temperature >>> actually change to work. This is less the case with an anticipator, >>> but that brings its own problems. >> >> What problems does an anticipator create? >> >> >>> In the case where the thermal loss is constant and the temperature >>> needs to be held steady, and where the heating element is being pulsed >>> significantly faster than the thermal time constant of the plant (if >>> not the heater), then the PID would, in theory, hold the temperature >>> dead steady -- or at least as steady as it can given how fast it is >>> being pulsed on and off. >> >> How does a PID controller cycle the heat in absence of updated >> temperature readings? On the update of temperature, the differential >> and proportional terms will give a constant input to the calculation >> until the temperature is updated again. The integral term will push the >> integrator in a direction with a constant ramp for the duration of the >> temperature reading period. I suppose this could result in one pulse >> during the temperature reading period, but will create an internal >> overshoot for the next period which will show up as a too short pulse. >> >> Obviously this is all dependent on the parameters of the PID controller, >> but I'm having trouble picturing how the faster PID loop would provide >> any useful benefit rather than just causing oscillations. > > Did you ACTUALLY READ what I took the time to write, in a spirit of > helpfulness? ?? ???? > > "However, pulsing the heating element ..." > > If that statement doesn't make sense, ask about it -- because it makes > all the difference.
Yes, I read it. But that is very little detail. I think my reply showed I gave it consideration. If you don't want to discuss this, why reply? If you want to discuss it then perhaps a bit more clarity would be helpful. -- Rick
On Sun, 22 Nov 2015 19:44:25 -0500, the renowned rickman
<gnuarm@gmail.com> wrote:

>On 11/22/2015 6:13 PM, Spehro Pefhany wrote: >> On Sun, 22 Nov 2015 14:33:55 -0500, the renowned rickman >> <gnuarm@gmail.com> wrote: >> >>> If a heater is controlled by turning it on and off, does a PID algorithm >>> help in more closely controlling the temperature? >> >> It can help. You turn the heater on and off fast enough that it is >> effectively an analog output. It's called 'time proportioning' in the >> industry. > >How does the PID loop turn the heater on and off any faster than a >simple set point? Add an anticipator and overshoot is minimized.
The PID output feeds into a modulator with an independent time base that is much shorter than the dominant lag of the system. Say we have a proportional cycle time of 2 seconds. With a PID output of 0.5 you have the output on for 1 second and off for 1 second. With the PID output of 0.1 on for 200ms and off for 1.8 seconds.
>>> Will running the PID loop faster than the temperature measurement >>> improve anything? >> >> Certainly not. There's no new information. >> >>> How would a PID control be an improvement over a simple temperature >>> comparison with or without an anticipator? >> >> With an anticipator it might be fairly similar. Comparison normally >> needs some deadband so you would tend to get higher temperature ripple >> with comparison that with a time-proportioning PID. The output will >> turn off earlier in the latter case, as it needs no information from >> the sensor to do so (it can turn on and off many times per temperature >> measurement if you want, but it's commonly not done that way). > >When you say "time-proportioning PID", you mean an output that is not >just on or off, but a number that is used to control PWM? That would be >above and beyond just PID.
Yes, it is. But it's still called a PID controller (by everyone).
>Someone in another group seems to be saying his PID loop running at 10x >the temperature measurement rate gives him this fine on/off control. >But his temperature measurements have lots of variation. Well, by >"lots" I mean a lot more than I expect could be done easily by just >setting a temperature and turning the heat on and off possibly with an >anticipator. He is getting maybe &#2013266097;1 C&#2013266096;.
Well, in a simple thermal system with a fast temperature sensor (one and only one dominant lag) you may be able to turn the gain of a proportional controller up as far as you like and get pretty good control. At infinite gain, it's just a comparison. If you have a sensor or an actuator that responds relatively slowly, however, you will not get as good control. So it's dependent on the sensor and the rest of the system. But suppose you are using a typical industrial mica-insulated band heater- the internal parts get much hotter than the shell when it is on, so when you turn the heat off the heater surface temperature continues to rise for a while. Similarly, a sensor, especially an air sensor or a sensor in a protective housing, will lag behind the actual process variable. So when you turn the heat off the temperature reading continues to rise. Think of an amplifier with negative feedback that has phase shifts in each element. A PID controller can be tuned (or many can self-tune) to give acceptable control even with a less ideal system. Like most other things (amplifiers and negative feedback, for example) it's best to make the system as good as you can make it before trying to add complexity such as PID.
>My house thermostat keeps the >temperature within 1 F&#2013266096; and it is not really trying. He doesn't really >want to discuss it. I would like to understand the reality.
Room air temperature as read with a fast air sensor normally varies a bit more than that, though the *average* should be stable. You can't cycle forced air central heating fast enough to maintain the air temperature quite that constant- it's a limitation of the actuator in that case- so you get a ripple on top of a stable average. The anticipator in an old-style bimetallic thermostat is sort of a D function, but not quite since it's an on-off controller. It's also sort of a time proportioning modulator. BTW, modern thermostats have a setting that's something like cycles per hour rather than an anticipator. --sp -- Best regards, Spehro Pefhany Amazon link for AoE 3rd Edition: http://tinyurl.com/ntrpwu8 Microchip link for 2015 Masters in Phoenix: http://tinyurl.com/l7g2k48
On 11/22/2015 8:44 PM, whit3rd wrote:
> On Sunday, November 22, 2015 at 4:44:37 PM UTC-8, rickman wrote: >> On 11/22/2015 6:13 PM, Spehro Pefhany wrote: >>> On Sun, 22 Nov 2015 14:33:55 -0500, the renowned rickman >>> <gnuarm@gmail.com> wrote: > >>>> Will running the PID loop faster than the temperature measurement >>>> improve anything? >>> >>> Certainly not. There's no new information. > > Moreover, it takes two or more measurements of temperature to update > a 'D' (differential) value. It's unclear whether this is about a time-sampled > temperature measurement (with discrete approximations of integral, > proportional, and derivative terms), or an analog measurement of > temperature with analog differentiation and integration elements.
Digital samples. Typically the delta between the last and the current measurement is considered to be the derivative.
>>>> How would a PID control be an improvement over a simple temperature >>>> comparison with or without an anticipator? > > This is confusing; the 'D' term, in PID, is an anticipator.
Really? I thought the D term is a derivative responding to the rate of change. If the slope is upward, it will end the heating cycle a bit early, but if the slope is downward, it will start the heating cycle before it would otherwise which the anticipator won't do. The anticipator integrates in a manner similar to the heating element and is used to end the heating cycle early in the amount it is expected that the heater will continue to heat once the element is turned off. In typical bi-metallic thermostats this is done with a small heater in the thermostat which mirrors the heating element.
>> Someone in another group seems to be saying his PID loop running at 10x >> the temperature measurement rate gives him this fine on/off control. > > If he is computing a new proportional term (or integral, or derivative), it > means he has an extrapolation of his temperature measurements, and is > applying that extrapolation to compute the PID response. The issue then > becomes the accuracy of the extrapolation (which depends on the system > and the extrapolation scheme). > If he's not computing a new term, his 'PID' latches a heat setting until the next > temperature update.
I don't see how any of this is better than just taking the temperature measurement. -- Rick