# PID Heater Control

• posted

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```
• posted

Compared to what? Yes, compared to a lot of things.

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.

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```
• posted

A conventional type thermostat with a set point and a hysteresis band.

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.

What problems does an anticipator create?

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```
• posted

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.

Certainly not. There's no new information.

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 ```
• posted

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.

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

want to discuss it. I would like to understand the reality.

```--

Rick```
• posted

hm

he

You may want to read up on "dithering".

```--
Bill Sloman, Sydney```
• posted

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.

This is confusing; the 'D' term, in PID, is an anticipator.

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.

• posted

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 ```
• posted

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```
• posted

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.

Yes, it is. But it's still called a PID controller (by everyone).

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.

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 ```
• posted

Digital samples. Typically the delta between the last and the current measurement is considered to be the derivative.

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.

I don't see how any of this is better than just taking the temperature measurement.

```--

Rick```
• posted

It's not nearly as simple as that.

Of course, only the backwards difference is causal.

But difference between samples may be small compared to quantization or other noise (especially if you are sampling at a relatively high rate) so that method (alone) is typically not sufficient either- filtering is required if you really want the D.

--sp

```--
Best regards,
Spehro Pefhany ```
• posted

He posted a series of temp samples and they showed very low noise, none that I could see by inspection. So that's not an issue.

```--

Rick```
• posted

Ok, now you are adding a unit to take the range of values output by the PID controller and generate a pulse train from that. That is not the design I was asking about. I was discussing direct, on/off control from the output of the PID.

Fine, but that is not what the design in question is using.

This is the issue I want to discuss. In this system a thermocouple will respond much faster than the heating element.

Even if the heater doesn't have the "shell", it will remain hotter than it's surroundings for some time. The heat in the element has to dissipate into the oven.

I have taken measurements of the air temperature with a thermocouple and found it to be very stable. I'm not sure what you are talking about.

The anticipator is nothing like a D function. It doesn't react to the temperature at *all*. It simply models the temperature of the heating element to help prevent overshoot at the end of a heating cycle.

```--

Rick```
• posted

No. You _really_ can not conclude that until you know the required D gain for the tuned system (the time constant for D).

It more than likely is an issue in a real system (as opposed to a simulation with double-precision numbers).

Avoiding the math (you shouldn't) to get an intuitive idea- if you want to cut the heat back 50% when the temperature is rising at 1 degree per 60 seconds, and your sample rate is 10Hz then you need a gain of several hundred, so a fraction of a hundreth of a degree of noise (including quantization noise) is important.

--sp

```--
Best regards,
Spehro Pefhany ```
• posted

If the resolution of the temperature measurement is just 0.1 degree, then that will be difficult.

```--

Rick```
• posted

I don't know the nature of your heater (system), but if the transfer function is linear then I think it can be approached as a discrete-data control system. The Laplace representation of the heater's system you can be transformed into the Z-domain. Then you can design something like a dead-beat controller for it. That might be the fastest you can get.

A good book would be the one by Benjamin C. Kuo: "Digital Control Systems" if you had the time.

joe

• posted

Maybe someone meant 'feed forward control'?

If (just for example) the water heater is an electric shower, the feed forward signal would be proportional to the flow of water and subtracted from the proportional negative feedback term.

joe

• posted

Sampling at 'a relatively high rate' is useless. Filtering would then indeed be the logical thing to do.

joe

• posted

That is correct. Given a fixed temperature measurement period, the best thing to do is synchronise the on/off switching with the measurement, transform it into the z-domain and calculate the analogue components needed to get the right control.

I think this book 'sums it up' quite (very) comprehensively: