Electronics-Related.com
Forums

PID Heater Control

Started by rickman November 22, 2015
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? > > 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?
On a totally different line of thought than my previous response: A traditional thermostat/anticipator acts, more or less, like a proportional-derivative controller with a relay output ("relay" is just control systems jargon for an on-off switch). There's usually hysteresis in the switch, but that's not uncommon with relay-output controllers, and it's the anticipator that -- more or less -- provides the derivative action. (Note the "more or less" -- "sorta-kinda" might be better. At any rate, don't get wrapped around the axle if it's not exactly the same -- because it isn't.) Such a system will still show some sensitivity of the long-term average controlled temperature to ambient conditions -- your plant (or house, whatever) will be a bit colder on average when ambient is colder, and warmer on average when ambient is warmer. Putting a bit of integrator action into a controller like that will, perforce, guarantee that the average temperature of the plant is as close to correct as can be achieved with available sensors. It won't prevent the heat from cycling up and down, however -- that's a consequence of turning the heat on and off close to, or slower than, the thermal time constant of the plant. Whether the benefit from integral action in the controller is worth the effort in such a circumstance is going to depend on the individual cases. I suspect that in general it won't, but I'm sure there are edge cases where it'll be all that's needed. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 11/23/2015 11:39 AM, Tim Wescott wrote:
> On Mon, 23 Nov 2015 01:24:38 -0500, rickman wrote: > >> 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. > > Think sigma-delta, or PWM, with the heater on/off being a one-bit DAC. > > If you PWM the heater at a faster rate than the control loop, or if you > run the output of the PID into a sigma-delta stage (that's either going > as fast as, or faster than, the control loop), then the heater command > will get low pass filtered in both the heating element and in the plant's > thermal mass. This will make the heater & driver act much more like a > continuous element than a relay element. At that point, a PID becomes > fairly worthwhile.
You are describing things that are not part of the design I was describing. The control is to turn the heater on or off on each pass of the PID loop. The PID loop runs 10 times faster than the temperature measurement. I fail to see how this is any better than running the PID loop at the same rate as the temperature measurement. I also fail to see how the PID loop will improve on a simple set point with an anticipator. -- Rick
On 11/23/2015 1:07 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? >> >> 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? > > On a totally different line of thought than my previous response: > > A traditional thermostat/anticipator acts, more or less, like a > proportional-derivative controller with a relay output ("relay" is just > control systems jargon for an on-off switch). There's usually hysteresis > in the switch, but that's not uncommon with relay-output controllers, and > it's the anticipator that -- more or less -- provides the derivative > action. > > (Note the "more or less" -- "sorta-kinda" might be better. At any rate, > don't get wrapped around the axle if it's not exactly the same -- because > it isn't.) > > Such a system will still show some sensitivity of the long-term average > controlled temperature to ambient conditions -- your plant (or house, > whatever) will be a bit colder on average when ambient is colder, and > warmer on average when ambient is warmer. > > Putting a bit of integrator action into a controller like that will, > perforce, guarantee that the average temperature of the plant is as close > to correct as can be achieved with available sensors. It won't prevent > the heat from cycling up and down, however -- that's a consequence of > turning the heat on and off close to, or slower than, the thermal time > constant of the plant. > > Whether the benefit from integral action in the controller is worth the > effort in such a circumstance is going to depend on the individual > cases. I suspect that in general it won't, but I'm sure there are edge > cases where it'll be all that's needed.
It is not clear to me that your assumptions are correct. For example, ignoring the issue of the anticipator, the idea that without an integral term in the control loop, the average temperature will be sensitive to the ambient isn't clear to me. Consider the controlled temperature as a function of time in two cases. In one case the heat leaking from the chamber is 1/10 the rate at which the heating element adds heat and in the other case heat leaks at 1/2 the rate of the heater. The control loop is a simple temperature set point with a fixed amount of plus and minus hysteresis. In the 1/10 rate case the heat will be on 1/10 of the time. The graph will be a saw tooth with the warming slope being 1/9th the width of the cooling slope. The average temperature will be the set point. The 1/2 cooling rate will give a sawtooth graph with equal heating and cooling periods... and again the average temperature will be the set point. What periods of heating and cooling would you expect a PID controller could provide if it is not using PWM modulation of the heating, but rather the PID loop directly turns the heat on or off? If heating a house, the furnace should not be cycled too often, so there is no opportunity to modulate the heat cycle over short periods. However, the system is question is an electric oven so such modulation would be possible, but only by adding another layer of complexity to the code which is not what is being discussed. -- Rick
On Mon, 23 Nov 2015 13:24:50 -0500, rickman wrote:

> On 11/23/2015 11:39 AM, Tim Wescott wrote: >> On Mon, 23 Nov 2015 01:24:38 -0500, rickman wrote: >> >>> 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. >> >> Think sigma-delta, or PWM, with the heater on/off being a one-bit DAC. >> >> If you PWM the heater at a faster rate than the control loop, or if you >> run the output of the PID into a sigma-delta stage (that's either going >> as fast as, or faster than, the control loop), then the heater command >> will get low pass filtered in both the heating element and in the >> plant's thermal mass. This will make the heater & driver act much more >> like a continuous element than a relay element. At that point, a PID >> becomes fairly worthwhile. > > You are describing things that are not part of the design I was > describing.
Well, look at your critique about my level of detail, and then go look in a mirror. Besides, you seemed to be talking about changing a design to make it better -- so I'm giving you ways to change a design to make it better.
> The control is to turn the heater on or off on each pass of > the PID loop. The PID loop runs 10 times faster than the temperature > measurement. I fail to see how this is any better than running the PID > loop at the same rate as the temperature measurement.
Well, if you're just looking for justification in your thinking that a PID loop isn't going to help, then believe what you want. If that's your goal, then posting questions on USENET is probably a bad idea, because someone may tell you something that's contrary to your cherished notions. So are you just looking for self-justification, or do you want to improve the performance of the system? If you have a controller that's operating 10 times faster than the temperature measurement, and you want to improve the performance of the thing, then consider PWM-ing the output one way or another.
> I also fail to > see how the PID loop will improve on a simple set point with an > anticipator.
The anticipators that I know about introduce bias (they're basically heaters that warm the air inside a thermostat when the heat is on). So as the heat is on for a longer proportion of the time, the temperature seen by the regulating element (the bi-metallic switch, in this model) is, on average, higher than the temperature being regulated, which depresses the regulated temperature. I'm sure that you're not dealing with an electro-mechanical thermostat, but if the control you propose is going to emulate it, you'll undoubtedly successfully emulate the problems. I don't have the work to hand, but I've simulated a heating system with a typical relay-with-hysteresis thermostat: even without an anticipator, and in spite of the fact that a simple switch is often viewed as having "infinite" gain, simple on-off control does not regulate the long-term average temperature error to zero the way that a controller with an unbiased sensor and an integrator will. So in that regard, PID (or anything with a correctly applied integrator) is better. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Mon, 23 Nov 2015 13:43:30 -0500, rickman wrote:

> On 11/23/2015 1:07 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? >>> >>> 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? >> >> On a totally different line of thought than my previous response: >> >> A traditional thermostat/anticipator acts, more or less, like a >> proportional-derivative controller with a relay output ("relay" is just >> control systems jargon for an on-off switch). There's usually >> hysteresis in the switch, but that's not uncommon with relay-output >> controllers, and it's the anticipator that -- more or less -- provides >> the derivative action. >> >> (Note the "more or less" -- "sorta-kinda" might be better. At any >> rate, don't get wrapped around the axle if it's not exactly the same -- >> because it isn't.) >> >> Such a system will still show some sensitivity of the long-term average >> controlled temperature to ambient conditions -- your plant (or house, >> whatever) will be a bit colder on average when ambient is colder, and >> warmer on average when ambient is warmer. >> >> Putting a bit of integrator action into a controller like that will, >> perforce, guarantee that the average temperature of the plant is as >> close to correct as can be achieved with available sensors. It won't >> prevent the heat from cycling up and down, however -- that's a >> consequence of turning the heat on and off close to, or slower than, >> the thermal time constant of the plant. >> >> Whether the benefit from integral action in the controller is worth the >> effort in such a circumstance is going to depend on the individual >> cases. I suspect that in general it won't, but I'm sure there are edge >> cases where it'll be all that's needed. > > It is not clear to me that your assumptions are correct. For example, > ignoring the issue of the anticipator, the idea that without an integral > term in the control loop, the average temperature will be sensitive to > the ambient isn't clear to me. Consider the controlled temperature as a > function of time in two cases. In one case the heat leaking from the > chamber is 1/10 the rate at which the heating element adds heat and in > the other case heat leaks at 1/2 the rate of the heater. The control > loop is a simple temperature set point with a fixed amount of plus and > minus hysteresis. In the 1/10 rate case the heat will be on 1/10 of the > time. The graph will be a saw tooth with the warming slope being 1/9th > the width of the cooling slope. The average temperature will be the set > point. The 1/2 cooling rate will give a sawtooth graph with equal > heating and cooling periods... and again the average temperature will be > the set point. > > What periods of heating and cooling would you expect a PID controller > could provide if it is not using PWM modulation of the heating, but > rather the PID loop directly turns the heat on or off? > > If heating a house, the furnace should not be cycled too often, so there > is no opportunity to modulate the heat cycle over short periods. > However, the system is question is an electric oven so such modulation > would be possible, but only by adding another layer of complexity to the > code which is not what is being discussed.
I'm not going to spend my free time simulating your system for you. That's what you're paid to do. So why don't you spend your free -- or paid -- time simulating your system for you? I've done this stuff before, it's too long for me to remember the detailed answer, but I do remember that when you actually take the trouble to simulate the system, or calculate it's behavior mathematically, you find a dependency on average temperature with ambient. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 11/23/2015 2:14 PM, Tim Wescott wrote:
> On Mon, 23 Nov 2015 13:24:50 -0500, rickman wrote: > >> On 11/23/2015 11:39 AM, Tim Wescott wrote: >>> On Mon, 23 Nov 2015 01:24:38 -0500, rickman wrote: >>> >>>> 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. >>> >>> Think sigma-delta, or PWM, with the heater on/off being a one-bit DAC. >>> >>> If you PWM the heater at a faster rate than the control loop, or if you >>> run the output of the PID into a sigma-delta stage (that's either going >>> as fast as, or faster than, the control loop), then the heater command >>> will get low pass filtered in both the heating element and in the >>> plant's thermal mass. This will make the heater & driver act much more >>> like a continuous element than a relay element. At that point, a PID >>> becomes fairly worthwhile. >> >> You are describing things that are not part of the design I was >> describing. > > Well, look at your critique about my level of detail, and then go look in > a mirror. > > Besides, you seemed to be talking about changing a design to make it > better -- so I'm giving you ways to change a design to make it better.
I get tired of discussions devolving into pissing matches. I'm trying to explore a particular point. Is a PID controller any better than a typical setpoint thermostat? No, I can't define every nuance of the question up front. But I'm not looking for ways to add complexity. I'm trying to understand the simple issues. I'm not trying to tick you off, I'm sorry if my posts seem like that to you. You posts do seem like you are getting ticked off which is not my intent.
>> The control is to turn the heater on or off on each pass of >> the PID loop. The PID loop runs 10 times faster than the temperature >> measurement. I fail to see how this is any better than running the PID >> loop at the same rate as the temperature measurement. > > Well, if you're just looking for justification in your thinking that a PID > loop isn't going to help, then believe what you want. If that's your > goal, then posting questions on USENET is probably a bad idea, because > someone may tell you something that's contrary to your cherished notions. > > So are you just looking for self-justification, or do you want to improve > the performance of the system?
SED is a great place to learn little and get arguments at every turn. I don't have a system to improve the performance of. I am trying to understand if a simple PID controller is any better than a set point controller. I'm not looking for arguments. If you really can't discuss this without getting ticked off why don't we drop it?
> If you have a controller that's operating 10 times faster than the > temperature measurement, and you want to improve the performance of the > thing, then consider PWM-ing the output one way or another.
I'm not trying to change anything, I'm trying to understand the issues in the existing concept.
>> I also fail to >> see how the PID loop will improve on a simple set point with an >> anticipator. > > The anticipators that I know about introduce bias (they're basically > heaters that warm the air inside a thermostat when the heat is on). So > as the heat is on for a longer proportion of the time, the temperature > seen by the regulating element (the bi-metallic switch, in this model) > is, on average, higher than the temperature being regulated, which > depresses the regulated temperature.
Yes, the purpose of this is to "anticipate" the additional heating that will happen when the heat is turned off and the heat element cools down. The electromechanical thermostats do this with a heater, but a software approach can do it more effectively by estimating the cooling rate of the heating chamber (simple time measurement).
> I'm sure that you're not dealing with an electro-mechanical thermostat, > but if the control you propose is going to emulate it, you'll undoubtedly > successfully emulate the problems.
I think that is an oversimplification of the situation. The mechanical thermostat typically has a large hysteresis which is very overdone. A software set point controller can use any size hysteresis appropriate.
> I don't have the work to hand, but I've simulated a heating system with a > typical relay-with-hysteresis thermostat: even without an anticipator, > and in spite of the fact that a simple switch is often viewed as having > "infinite" gain, simple on-off control does not regulate the long-term > average temperature error to zero the way that a controller with an > unbiased sensor and an integrator will. So in that regard, PID (or > anything with a correctly applied integrator) is better.
I'm not sure how important a long term average value is in most cases. Perhaps if you were controlling a crystal oven that might be an important point. In this case the oven just needs to be regulated to a narrow hysteresis range. I'm trying to understand if a simple PID controller adds anything to the picture other than complication. I'm not trying to make it any more complicated. The data shown for the existing PID controller (which is likely not tuned perfectly) is clearly not as good as could be achieved with a set point controller. It shows lots of rather random excursions. On the other hand, all of this is overkill for the application and far superior to the mechanical controller it has replaced. -- Rick
On 11/23/2015 2:17 PM, Tim Wescott wrote:
> On Mon, 23 Nov 2015 13:43:30 -0500, rickman wrote: > >> On 11/23/2015 1:07 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? >>>> >>>> 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? >>> >>> On a totally different line of thought than my previous response: >>> >>> A traditional thermostat/anticipator acts, more or less, like a >>> proportional-derivative controller with a relay output ("relay" is just >>> control systems jargon for an on-off switch). There's usually >>> hysteresis in the switch, but that's not uncommon with relay-output >>> controllers, and it's the anticipator that -- more or less -- provides >>> the derivative action. >>> >>> (Note the "more or less" -- "sorta-kinda" might be better. At any >>> rate, don't get wrapped around the axle if it's not exactly the same -- >>> because it isn't.) >>> >>> Such a system will still show some sensitivity of the long-term average >>> controlled temperature to ambient conditions -- your plant (or house, >>> whatever) will be a bit colder on average when ambient is colder, and >>> warmer on average when ambient is warmer. >>> >>> Putting a bit of integrator action into a controller like that will, >>> perforce, guarantee that the average temperature of the plant is as >>> close to correct as can be achieved with available sensors. It won't >>> prevent the heat from cycling up and down, however -- that's a >>> consequence of turning the heat on and off close to, or slower than, >>> the thermal time constant of the plant. >>> >>> Whether the benefit from integral action in the controller is worth the >>> effort in such a circumstance is going to depend on the individual >>> cases. I suspect that in general it won't, but I'm sure there are edge >>> cases where it'll be all that's needed. >> >> It is not clear to me that your assumptions are correct. For example, >> ignoring the issue of the anticipator, the idea that without an integral >> term in the control loop, the average temperature will be sensitive to >> the ambient isn't clear to me. Consider the controlled temperature as a >> function of time in two cases. In one case the heat leaking from the >> chamber is 1/10 the rate at which the heating element adds heat and in >> the other case heat leaks at 1/2 the rate of the heater. The control >> loop is a simple temperature set point with a fixed amount of plus and >> minus hysteresis. In the 1/10 rate case the heat will be on 1/10 of the >> time. The graph will be a saw tooth with the warming slope being 1/9th >> the width of the cooling slope. The average temperature will be the set >> point. The 1/2 cooling rate will give a sawtooth graph with equal >> heating and cooling periods... and again the average temperature will be >> the set point. >> >> What periods of heating and cooling would you expect a PID controller >> could provide if it is not using PWM modulation of the heating, but >> rather the PID loop directly turns the heat on or off? >> >> If heating a house, the furnace should not be cycled too often, so there >> is no opportunity to modulate the heat cycle over short periods. >> However, the system is question is an electric oven so such modulation >> would be possible, but only by adding another layer of complexity to the >> code which is not what is being discussed. > > I'm not going to spend my free time simulating your system for you. > That's what you're paid to do. So why don't you spend your free -- or > paid -- time simulating your system for you? > > I've done this stuff before, it's too long for me to remember the > detailed answer, but I do remember that when you actually take the > trouble to simulate the system, or calculate it's behavior > mathematically, you find a dependency on average temperature with ambient.
I'm not asking you to simulate anything. I just described a system simple enough to be simulated in your head and gave you the result. It may be somewhat unrealistic given the vagaries of real world situations, but it is clear enough to show a set point controller maintains an average temperature controlled by the set point when the cooling losses are constant, at least to a first order approximation. -- Rick
On Mon, 23 Nov 2015 14:48:16 -0500, rickman wrote:

> On 11/23/2015 2:17 PM, Tim Wescott wrote: >> On Mon, 23 Nov 2015 13:43:30 -0500, rickman wrote: >> >>> On 11/23/2015 1:07 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? >>>>> >>>>> 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? >>>> >>>> On a totally different line of thought than my previous response: >>>> >>>> A traditional thermostat/anticipator acts, more or less, like a >>>> proportional-derivative controller with a relay output ("relay" is >>>> just control systems jargon for an on-off switch). There's usually >>>> hysteresis in the switch, but that's not uncommon with relay-output >>>> controllers, and it's the anticipator that -- more or less -- >>>> provides the derivative action. >>>> >>>> (Note the "more or less" -- "sorta-kinda" might be better. At any >>>> rate, don't get wrapped around the axle if it's not exactly the same >>>> -- >>>> because it isn't.) >>>> >>>> Such a system will still show some sensitivity of the long-term >>>> average controlled temperature to ambient conditions -- your plant >>>> (or house, whatever) will be a bit colder on average when ambient is >>>> colder, and warmer on average when ambient is warmer. >>>> >>>> Putting a bit of integrator action into a controller like that will, >>>> perforce, guarantee that the average temperature of the plant is as >>>> close to correct as can be achieved with available sensors. It won't >>>> prevent the heat from cycling up and down, however -- that's a >>>> consequence of turning the heat on and off close to, or slower than, >>>> the thermal time constant of the plant. >>>> >>>> Whether the benefit from integral action in the controller is worth >>>> the effort in such a circumstance is going to depend on the >>>> individual cases. I suspect that in general it won't, but I'm sure >>>> there are edge cases where it'll be all that's needed. >>> >>> It is not clear to me that your assumptions are correct. For example, >>> ignoring the issue of the anticipator, the idea that without an >>> integral term in the control loop, the average temperature will be >>> sensitive to the ambient isn't clear to me. Consider the controlled >>> temperature as a function of time in two cases. In one case the heat >>> leaking from the chamber is 1/10 the rate at which the heating element >>> adds heat and in the other case heat leaks at 1/2 the rate of the >>> heater. The control loop is a simple temperature set point with a >>> fixed amount of plus and minus hysteresis. In the 1/10 rate case the >>> heat will be on 1/10 of the time. The graph will be a saw tooth with >>> the warming slope being 1/9th the width of the cooling slope. The >>> average temperature will be the set point. The 1/2 cooling rate will >>> give a sawtooth graph with equal heating and cooling periods... and >>> again the average temperature will be the set point. >>> >>> What periods of heating and cooling would you expect a PID controller >>> could provide if it is not using PWM modulation of the heating, but >>> rather the PID loop directly turns the heat on or off? >>> >>> If heating a house, the furnace should not be cycled too often, so >>> there is no opportunity to modulate the heat cycle over short periods. >>> However, the system is question is an electric oven so such modulation >>> would be possible, but only by adding another layer of complexity to >>> the code which is not what is being discussed. >> >> I'm not going to spend my free time simulating your system for you. >> That's what you're paid to do. So why don't you spend your free -- or >> paid -- time simulating your system for you? >> >> I've done this stuff before, it's too long for me to remember the >> detailed answer, but I do remember that when you actually take the >> trouble to simulate the system, or calculate it's behavior >> mathematically, you find a dependency on average temperature with >> ambient. > > I'm not asking you to simulate anything. I just described a system > simple enough to be simulated in your head and gave you the result. It > may be somewhat unrealistic given the vagaries of real world situations, > but it is clear enough to show a set point controller maintains an > average temperature controlled by the set point when the cooling losses > are constant, at least to a first order approximation.
Well, there you go. You're smarter than the resident control expert. Have fun! -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Monday, November 23, 2015 at 3:07:59 PM UTC-5, Tim Wescott wrote:
> On Mon, 23 Nov 2015 14:48:16 -0500, rickman wrote: > > > On 11/23/2015 2:17 PM, Tim Wescott wrote: > >> On Mon, 23 Nov 2015 13:43:30 -0500, rickman wrote: > >> > >>> On 11/23/2015 1:07 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? > >>>>> > >>>>> 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? > >>>> > >>>> On a totally different line of thought than my previous response: > >>>> > >>>> A traditional thermostat/anticipator acts, more or less, like a > >>>> proportional-derivative controller with a relay output ("relay" is > >>>> just control systems jargon for an on-off switch). There's usually > >>>> hysteresis in the switch, but that's not uncommon with relay-output > >>>> controllers, and it's the anticipator that -- more or less -- > >>>> provides the derivative action. > >>>> > >>>> (Note the "more or less" -- "sorta-kinda" might be better. At any > >>>> rate, don't get wrapped around the axle if it's not exactly the same > >>>> -- > >>>> because it isn't.) > >>>> > >>>> Such a system will still show some sensitivity of the long-term > >>>> average controlled temperature to ambient conditions -- your plant > >>>> (or house, whatever) will be a bit colder on average when ambient is > >>>> colder, and warmer on average when ambient is warmer. > >>>> > >>>> Putting a bit of integrator action into a controller like that will, > >>>> perforce, guarantee that the average temperature of the plant is as > >>>> close to correct as can be achieved with available sensors. It won't > >>>> prevent the heat from cycling up and down, however -- that's a > >>>> consequence of turning the heat on and off close to, or slower than, > >>>> the thermal time constant of the plant. > >>>> > >>>> Whether the benefit from integral action in the controller is worth > >>>> the effort in such a circumstance is going to depend on the > >>>> individual cases. I suspect that in general it won't, but I'm sure > >>>> there are edge cases where it'll be all that's needed. > >>> > >>> It is not clear to me that your assumptions are correct. For example, > >>> ignoring the issue of the anticipator, the idea that without an > >>> integral term in the control loop, the average temperature will be > >>> sensitive to the ambient isn't clear to me. Consider the controlled > >>> temperature as a function of time in two cases. In one case the heat > >>> leaking from the chamber is 1/10 the rate at which the heating element > >>> adds heat and in the other case heat leaks at 1/2 the rate of the > >>> heater. The control loop is a simple temperature set point with a > >>> fixed amount of plus and minus hysteresis. In the 1/10 rate case the > >>> heat will be on 1/10 of the time. The graph will be a saw tooth with > >>> the warming slope being 1/9th the width of the cooling slope. The > >>> average temperature will be the set point. The 1/2 cooling rate will > >>> give a sawtooth graph with equal heating and cooling periods... and > >>> again the average temperature will be the set point. > >>> > >>> What periods of heating and cooling would you expect a PID controller > >>> could provide if it is not using PWM modulation of the heating, but > >>> rather the PID loop directly turns the heat on or off? > >>> > >>> If heating a house, the furnace should not be cycled too often, so > >>> there is no opportunity to modulate the heat cycle over short periods. > >>> However, the system is question is an electric oven so such modulation > >>> would be possible, but only by adding another layer of complexity to > >>> the code which is not what is being discussed. > >> > >> I'm not going to spend my free time simulating your system for you. > >> That's what you're paid to do. So why don't you spend your free -- or > >> paid -- time simulating your system for you? > >> > >> I've done this stuff before, it's too long for me to remember the > >> detailed answer, but I do remember that when you actually take the > >> trouble to simulate the system, or calculate it's behavior > >> mathematically, you find a dependency on average temperature with > >> ambient. > > > > I'm not asking you to simulate anything. I just described a system > > simple enough to be simulated in your head and gave you the result. It > > may be somewhat unrealistic given the vagaries of real world situations, > > but it is clear enough to show a set point controller maintains an > > average temperature controlled by the set point when the cooling losses > > are constant, at least to a first order approximation. > > Well, there you go. You're smarter than the resident control expert. > > Have fun!
Rick may not want to be "prickly", but he often comes across that way. I'll take him at his word though. No insult intended Rick, but smart people sometimes are less adept at the social graces. Besides driving the error signal to zero, doesn't a PI controller also have a faster response, compared to just P? Instead of a flat gain, you get more gain at lower frequencies. (That might not be right.. I'm far from a control expert :^) George H.
> > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
On 11/23/2015 4:11 PM, George Herold wrote:
> On Monday, November 23, 2015 at 3:07:59 PM UTC-5, Tim Wescott wrote: >> On Mon, 23 Nov 2015 14:48:16 -0500, rickman wrote: >> >>> On 11/23/2015 2:17 PM, Tim Wescott wrote: >>>> On Mon, 23 Nov 2015 13:43:30 -0500, rickman wrote: >>>> >>>>> On 11/23/2015 1:07 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? >>>>>>> >>>>>>> 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? >>>>>> >>>>>> On a totally different line of thought than my previous response: >>>>>> >>>>>> A traditional thermostat/anticipator acts, more or less, like a >>>>>> proportional-derivative controller with a relay output ("relay" is >>>>>> just control systems jargon for an on-off switch). There's usually >>>>>> hysteresis in the switch, but that's not uncommon with relay-output >>>>>> controllers, and it's the anticipator that -- more or less -- >>>>>> provides the derivative action. >>>>>> >>>>>> (Note the "more or less" -- "sorta-kinda" might be better. At any >>>>>> rate, don't get wrapped around the axle if it's not exactly the same >>>>>> -- >>>>>> because it isn't.) >>>>>> >>>>>> Such a system will still show some sensitivity of the long-term >>>>>> average controlled temperature to ambient conditions -- your plant >>>>>> (or house, whatever) will be a bit colder on average when ambient is >>>>>> colder, and warmer on average when ambient is warmer. >>>>>> >>>>>> Putting a bit of integrator action into a controller like that will, >>>>>> perforce, guarantee that the average temperature of the plant is as >>>>>> close to correct as can be achieved with available sensors. It won't >>>>>> prevent the heat from cycling up and down, however -- that's a >>>>>> consequence of turning the heat on and off close to, or slower than, >>>>>> the thermal time constant of the plant. >>>>>> >>>>>> Whether the benefit from integral action in the controller is worth >>>>>> the effort in such a circumstance is going to depend on the >>>>>> individual cases. I suspect that in general it won't, but I'm sure >>>>>> there are edge cases where it'll be all that's needed. >>>>> >>>>> It is not clear to me that your assumptions are correct. For example, >>>>> ignoring the issue of the anticipator, the idea that without an >>>>> integral term in the control loop, the average temperature will be >>>>> sensitive to the ambient isn't clear to me. Consider the controlled >>>>> temperature as a function of time in two cases. In one case the heat >>>>> leaking from the chamber is 1/10 the rate at which the heating element >>>>> adds heat and in the other case heat leaks at 1/2 the rate of the >>>>> heater. The control loop is a simple temperature set point with a >>>>> fixed amount of plus and minus hysteresis. In the 1/10 rate case the >>>>> heat will be on 1/10 of the time. The graph will be a saw tooth with >>>>> the warming slope being 1/9th the width of the cooling slope. The >>>>> average temperature will be the set point. The 1/2 cooling rate will >>>>> give a sawtooth graph with equal heating and cooling periods... and >>>>> again the average temperature will be the set point. >>>>> >>>>> What periods of heating and cooling would you expect a PID controller >>>>> could provide if it is not using PWM modulation of the heating, but >>>>> rather the PID loop directly turns the heat on or off? >>>>> >>>>> If heating a house, the furnace should not be cycled too often, so >>>>> there is no opportunity to modulate the heat cycle over short periods. >>>>> However, the system is question is an electric oven so such modulation >>>>> would be possible, but only by adding another layer of complexity to >>>>> the code which is not what is being discussed. >>>> >>>> I'm not going to spend my free time simulating your system for you. >>>> That's what you're paid to do. So why don't you spend your free -- or >>>> paid -- time simulating your system for you? >>>> >>>> I've done this stuff before, it's too long for me to remember the >>>> detailed answer, but I do remember that when you actually take the >>>> trouble to simulate the system, or calculate it's behavior >>>> mathematically, you find a dependency on average temperature with >>>> ambient. >>> >>> I'm not asking you to simulate anything. I just described a system >>> simple enough to be simulated in your head and gave you the result. It >>> may be somewhat unrealistic given the vagaries of real world situations, >>> but it is clear enough to show a set point controller maintains an >>> average temperature controlled by the set point when the cooling losses >>> are constant, at least to a first order approximation. >> >> Well, there you go. You're smarter than the resident control expert. >> >> Have fun! > > Rick may not want to be "prickly", but he often comes across that way. > I'll take him at his word though. No insult intended Rick, but smart > people sometimes are less adept at the social graces.
Certainly there is no intent to tick people off. I guess it just comes naturally... ?? I consider it to be a shortcoming of the medium. I write with a deadpan emotional intent, most of the time, but I guess it must be read as though I am trying to offend. I really don't know what Tim is ticked off about. I give a *very* simple example that can be considered entirely in your mind and describe the results. Tim seems to think it requires simulation and gets mad about it when I point out how simple it is. Or maybe I'm not understanding what he is upset about. Don't know.
> Besides driving the error signal to zero, doesn't a PI controller also > have a faster response, compared to just P? Instead of a flat gain, > you get more gain at lower frequencies. (That might not be right.. > I'm far from a control expert :^)
Ok, but your model assumes there is some variability to the control I think. If the control consists of deciding on each cycle of the PID loop whether to turn the heater on or off, how does a PID controller improve response? If the desire is to turn the heater on at a smaller deviation from the set point, the hysteresis can be set closer to the set point, no? To be honest, if you don't care how often the heat is turned on, why would you even need hysteresis? Just turn on the heat when the temperature is below the set point and off again when the set point is reached. Then the only issue is the overshoot from the thermal mass of the heating element. An anticipator can help with that. The other point was that running the PID loop faster than the temperature is updated seems pointless. The person who has designed this approach creates a process for each part of the algorithm, one for measuring the temperature, one for running the PID and others. I'm not clear at all why he thinks the PID is usefully run faster than the temperature is updated. I can't get anything out of him other than because "it's fun". I'm just trying to understand how a PID controller can work better than the set point controller when there is no proportional control over the heat, just on and off. The only thing I can think is that the PID, when properly designed, will inherently consider the thermal mass of the heating element while with the set point controller it has to be accounted for by an anticipator. Even so, I don't see the two as much similar, is that wrong? BTW, who is "the resident control expert"? -- Rick