Gas station without pumps

2015 January 4

Thermal control loop working (sort of)

Classes start tomorrow, so I spent yesterday making sure that the incubator control project was feasible. I had gotten the fan feedback control working well back in September, but I’d put the project aside for Fall quarter and only got back to it this week.  As a reminder, here are the previous posts on the project:

Here is the interior of the styrofoam box, with the lid open.  The 6"×12" aluminum plate covers the bottom.  The thermistor is on the left, propped up by a rubber foot, the resistor in is the center, and the fan is sitting on a foam pad on the right. (The foam is to reduce noise until I can get the fan proper mounted in a baffle.)

Here is the interior of the styrofoam box, with the lid open. The 6″×12″ aluminum plate covers the bottom. The thermistor is on the left, propped up by a rubber foot, the resistor in is the center, and the fan is sitting on a foam pad on the right. (The foam is to reduce noise until I can get the fan proper mounted in a baffle.)

I left the foam out this time, which made for a somewhat noisy fan, and I still haven’t built a baffle—I’m still using the bent-wire-and-paper deflector shown in the photo. What I worked on yesterday was the software—since the temperature changes are fairly slow, it takes a long time to tune the control loops.

One thing I did was to try to reduce measurement noise further on the thermistor measurements. I now add 60  analog-to-digital readings. They’re 10 bits on the Arduino-compatible board (a Sparkfun redboard), so adding 60 still fits in an unsigned 16-bit word. I now get noise of about ±0.05°C, which is half the least-significant-bit of the converter.  I doubt that I can do better in precision without switching to a processor with a better analog-to-digital converter, though I could do digital filtering with a 1Hz low-pass filter to smooth out the remaining noise.

I copied the fan feedback control loop (with the anti-windup provisions) described in Improving feedback for fan for temperature control, but made two changes:

  • I changed the integration time and K_p for the thermal control loop, since the temperature response is much slower than the fan response.
  • Because of the huge asymmetry in the temperature response (the resistor and metal plate can heat up much more quickly than they cool down), I turn off the heater the moment it gets over temperature, no matter with the PI loop suggests, but I only switch to full-on when the air temperature is 3°C too cold. For the fan, I used a symmetric window around the set point for using the PI loop rather than full-on/full-off.

Here are some results from tuning experiments:

The blue curve switched to PI control at 23.5°C, the other two at 22°C. The green curve has pretty tight control over the temperature, but does overshoot a bit.

The initial temperatures were not all identical, because I wasn’t always willing to let everything cool down all the way to room temperature after each tuning run. I could only do about 1 tuning run an hour, which could pose problems for the freshman design seminar, as we don’t have long lab times—only the 70-minute lecture-schedule meeting times.

I continued the best of those runs with another step, up to 35°C, then let it cool down.

The step to 35°C has more ringing than the step to 25°C. I terminated the run before it had finished cooling, because the 32-bit µs timer wrapped around.

The cool-down at the end fits a 0.0069 °C/s line better than it fits an exponential decay to the ambient temperature.  If I do fit an exponential decay curve, I get a time constant of around 1975 seconds.

A simple thermal-resistance, thermal-capacity model is not a very good one for predicting how the system will behave, particularly since we’re not measuring the temperature of the large thermal mass (the aluminum plate and power resistor), but of the air, which has a large thermal resistance from the plate.  The time constant for the aluminum-air transfer is larger than the time constant for the electricity-aluminum transfer, which is why we get so much overshoot when we turn off the power to the resistor—the aluminum plate has gotten much hotter than the air, and continues to transfer heat to it, even though no more heat is being added to the aluminum.

Still, it is worth seeing what we get if we model the box a simple thermal mass and thermal resistor. The steady-state 35°C seems to need about 9W (PWM of 51/256) and the 25°C 3W (PWM of 17/256) with an ambient temperature of about 19°C, implying that the styrofoam box has a thermal resistance of about 1.9°C/W.

To see what is really going on, I’ll have to heat the box to 35°C, then start the cool down with a reset 32-bit timer.

Single-step warming from 16.9°C to 35°C. The steady state at 35°C is about 9.32W, for a thermal resistance of 1.8°C/W. The rise of 0.0451°C/s at 45W implies a thermal capacity of 998 J/°C.

Heating at 45W (9V, 1.8Ω) results in a temperature rise of about 0.0451 °C/s. This warm-up rate at 45W implies a thermal capacity of about 998 J/°C. We may want to adjust our thermal capacity estimate, since some of the 45W put in escapes through the box—maybe about 3–4W at the temperatures where the rise was measured. This reduces the thermal capacity estimate to about 910 J/°C.

The cool down from 35°C starts out as a straight line (about -0.0074°C/s or -26.5°C/hour), but gradually starts behaving more like the exponential we would expect from a thermal-resistance and thermal-capacity model.

The time constant for the cooling is about 1380s, but the initial cooling is too slow for a simple exponential.

The time constant for the cooling is about 1380s, but the initial cooling is too slow for a simple exponential.

The time constant of 1380 s, combined with a thermal capacity of 910 J/°C gives a thermal resistance of 1.5 °C/W, a bit lower than the 1.8°C/W I estimated from the steady-state power.

I continued the cooling (with the timer wrapped around) to see if I got a clean exponential at low temperature differences:

The exponential seems to fit well here, with a time constant of 2300s.  Combined with the 910 J/°C, this gives a thermal resistance of 2.5°C/W, which seems a little high compared to the other estimates.

The exponential seems to fit well here, with a time constant of 2300s. Combined with the 910 J/°C, this gives a thermal resistance of 2.5°C/W, which seems a little high compared to the other estimates.

So I’ve made some progress on the thermal control loop (though I’d like to reduce the overshoot and ringing) and I have a crude model for the box: a thermal mass with capacity about 910 J/°C and thermal resistance 2±0.5 °C/W.

Still on my to-do list for this project:

  • Consider using a PID controller for the temperature to get faster response without overshoot.  (If I can reduce the noise problem.) I should be able to reduce the noise with a digital filter, but I’m already pushing well beyond what I’m comfortable covering in a freshman class. Tuning a PID controller is even trickier than tuning a PI controller, which is already going to take most of the quarter to teach.
  • Design and build baffling for the fan to get better airflow in the box. This might be a good thing to get students to do, particularly if we can get them to learn how to use the laser cutter. But even handsaws would suffice, given some thin plywood or masonite, some angle irons, and nuts and screws.
  • Figure out how to get students to come up with workable designs, when they are starting from knowing nothing. I don’t want to give them my designs, but I want to help them find doable subproblems. Some of the subproblems they come up with may be well beyond the skills that they can pick up in the time frame of the course. The more I work on this project, the more I realize that I and the students will have to be happy with them having explored the options, without getting all the problems solved.
  • Add changes to the cumulative error term whenever KP or TI are changed, to keep the PWM output the same after the changes—currently changing any of the control loop parameters adds a huge disturbance to the system. I don’t know how important this is—I’ve been doing my tuning of the thermal loop by recompiling, rather than by changing parameters on the fly. The quick changes were handy for the fan loop, where I could see things happening quickly, but for the thermal loop each experiment took about an hour, so there was no need for a fast parameter change.
  • Research control algorithms other than PI and PID, particularly for asymmetric systems like the temperature control, where I can get fairly quick response to the inputs when heating, but very slow response when cooling. The asymmetric window for switching between on/off and PI control seems to have helped here, but there is probably a more principled way to handle asymmetric control inputs. Maybe I should ask some of the control-theory faculty for some pointers.
  • Develop a more detailed thermal model with separate components for the aluminum plate and the air in the box. It may be worth adding another thermistor, taped to the aluminum plate, to monitor that temperature. The extra thermistor would also allow much tighter temperature control, avoiding overshoot on air temperature.

 

2014 September 11

Thermal models for power resistor with heatsink

Last night I fit a simple thermal model to temperature measurements of some power resistors: T(t) = PD+A+(T_{0}-PD-A)e^{-t/(DM)}, where P is the power in watts, D is thermal resistance in °K/W, M is thermal mass in J/°K, A is the ambient temperature in °C, and T0 is the initial temperature.

I ran into problems with the 1.8Ω 50W THS501R8J resistor, because it heated up very fast and I could only get a few measurements when delivering power, before I had to turn it off.  I proposed adding a heatsink, a 6″×12″ sheet of aluminum 0.063″ thick, to increase the thermal mass M and decrease the thermal resistance D.  I estimated that the thermal mass should increase by the heat capacity of that much aluminum (74.33 cm3 at 2.422 J/°K/cm3, giving 180 J/°K), but I did not have a good way to estimate the change in thermal resistance.

The 6"×12" plate is much larger than the power resistor, which is bolted in the center with M3 screws (American 6-32 screws are a little too big for the holes in the resistor).

The 6″×12″ plate is much larger than the power resistor, which is bolted in the center with M3 screws (American 6-32 screws are a little too big for the holes in the resistor). I used a thin layer of white thermal grease to get better thermal conduction between the resistor case and the aluminum plate.

I do not expect the simple thermal model to work well, because it assumes that you have an isothermal object—all the aluminum at the same temperature.  But a large flat plate is going to have significant thermal spreading resistance, so that the resistor in the center is hotter than the edges of the plate.

With a heatsink the time constant DM is about 260s, only a little faster than the 347s without the heatsink, but the thermal resistance is much lower, so the maximum temperature (PD+A) is  much lower.

With a heatsink the time constant DM is about 260s, only a little faster than the 347s without the heatsink, but the thermal resistance is much lower, so the maximum temperature (PD+A) is much lower.

As expected, the fit is not great. When cooling off, the initial temperature of the resistor is higher than of the surrounding plate, so the initial cooling at the resistor is faster than the eventual cooling, when resistor and the plate are closer in temperature, because heat is being transferred to the plate as well as to the air. The increase in thermal mass  (about 100 J/°K) was less than my crude estimate based on the heat capacity of the added aluminum (180 J/°K)—this is probably also due to the thermal spreading resistance and the non-uniform temperature of the heatsink.

resistance rated power heatsink? test power M [J/°K] D [°K/W] DM [s] T [°C]
10.10Ω 100W No 8.288W 101.7 6.38 649 75.7
8.21Ω 50W No 10.169W 32 11.58 371 143.7
1.81Ω 50W No 43.174W 31.9 10.87 347 495.8
1.81Ω 50W Yes 43.174W 131.7 1.97 260 110.3

Note: the asymptotic temperature T in the table above is with the 9V power supply I have, which does not have quite constant voltage over the range of powers tested. With a 12v supply, temperatures would be much higher: D V^2/R +A .  The asymptotic temperature is also the maximum when the resistor is sitting in still air that is unconfined.  A fan would reduce thermal resistance and make the asymptotic temperature lower, but confining the resistor in a box (like in the incubator design) would make the “ambient” temperature not be constant—the relevant thermal resistance is how slowly the air in the box loses heat, which for the thick-walled styrofoam boxes we’ll use is a very high thermal resistance.  Without a feedback loop and PWM to keep the power down, even the 10Ω resistor would get very hot in a styrofoam box.

I should probably test the 10Ω 100W resistor on the heatsink also, to see if that reduces the time constant DM.  I expect the thermal mass to go up by something between 100 and 180 J/°K, but the thermal resistance to drop to around 1–1.5 °K/W, getting DM in the ballpark of 300s.  I don’t think I’ll do that today, though, as making measurements every 20 seconds for 2000 seconds is tedious and leads to cramping in the hand that aims the IR thermometer and keeps the trigger pulled.

Which raises a pedagogical question: Should I have students do the measurements?  Should I show them how to make a recording thermometer with a thermistor first? They’ll need to figure out how to use a thermistor for measuring air temperature anyway.

The thermistors I have at home (NTCLE100E3103JB0) only go up to 125°C, and I’d want them to have one that goes to at least 175°C for this lab, which means using something like NTCLG100E2103JB (10kΩ, ±5%, ±1.3% on B-value, -40°C to 200°C), which is only 35¢ in 10s, so still cheap. I should get myself some of these higher temperature thermistors and test out the recording . (Or the tighter tolerance NTCLE203E3103SB0, which only goes up to 150°C, or the wider temperature range 135-103LAF-J01, which goes to 300°C.)

How will I attach the thermistor to the resistor for temperature measurement? tape?  (I have to be sure not to short out the thermistor leads on the aluminum case of the resistor.)

Air temperature sensing poses less of a mounting challenge, but the thermal delays will be quite large—I have to look at how difficult it will be to tune a PID or PI controller with large delays—we really don’t want huge overshoot.  If the students have multiple temperature measurements (resistor temperature and air temperature, for example), they may need a more complicated control loop than a simple 1-variable PID controller.  How much can we simplify this?  (Perhaps a PI or PID controller based on the air temperature, with over-temperature shutdown on the resistor temperature?  Then tuning the PID controller with the constraint that the gain be kept low enough to keep the over-temperature shutdown from kicking in?)

Thermal models for power resistors

Filed under: freshman design seminar — gasstationwithoutpumps @ 06:46
Tags: , , , ,

I recently bought some power resistors, to use as dummy loads for testing PWM circuits and to use as heating elements in an “incubator” design for the freshman design seminar.  I bought 3 resistors: 10Ω 100W HSC10010RJ,  8.2Ω 50W THS508R2J, and 1.8Ω 50W THS501R8J.

I want to make simple models for the thermal behavior of these resistors when they are not mounted on a heatsink, but are just sitting on a low-thermal-conductance surface.  The simple model will have two parameters: a thermal mass M (in joules/°C) and a thermal resistance D (in °C/W).  If we just had the thermal mass, we would have \frac{dT}{dt} = \frac{dE}{dt}/M = P/M, where E is the thermal energy, and P is the power delivered to the resistor, and the temperature would increase linearly: T(t) = T_{0} + Pt/M. But as the temperature increases above the ambient temperature, the resistor loses energy at a rate proportional to the temperature difference from ambient: \frac{dT}{dt} = (P - (T(t)-A)/D)/M.  We can rewrite this as a standard first-order differential equation: \frac{dT}{dt} + \frac{T(t)}{DM} = \frac{PD+A}{DM}, which has the solution T(t) = PD+A+(T_{0}-PD-A)e^{-t/(DM)}.  Note that \lim_{t\rightarrow\infty}T(t)= PD+A, independent of the thermal mass, and the cool down with P=0 is dependent only on the initial temperature, the ambient temperature, and the product DM, not on D and M separately.

To find the parameters for each resistor, I connected each to my 9V 6A power supply, and measured the temperature at regular intervals with an IR thermometer.  For the 50W resistors, I blackened the bodies of the resistors with a felt-tip pen to make the IR thermometer more accurate—I had not done that with the 100W resistor, but it took so long to make the measurements on that resistor that I did not want to go back and remeasure it.  It had a colored finish and may have been closer to being a blackbody radiator than the 50W resistors, so the errors may not be too large.The errors due to not holding the gun in a perfectly fixed position probably contribute more error.

The fits are not too bad—this simple model seems to represent the thermal behavior of the resistors fairly well.

The 100W resistor, as expected, has a very high thermal mass and fairly low thermal resistance.  With a low power input (8% of rated power), the equilibrium surface temperature is still quite low.

The 100W resistor, as expected, has a very high thermal mass and fairly low thermal resistance. It heats up and cools down slowly. With a low power input (8% of rated power), the equilibrium surface temperature is still quite low, only about 76°C—well below the 240°C melting temperature of styrofoam. Even with a 12V supply the temperature would only get up to (12V*12V/10Ω)*6.38°C/W + 25°C=117°C.

The 8.2Ω 50W resistor has a lower thermal mass but a higher thermal resistance than the 100W resistor.  It heats up much faster, and cools down somewhat faster than the 100W resistor.  It is being run at about 20% of the rated power, and it is supposed to be able to be run at up to 40% of rated power (20W) without a heat sink.

The 8.2Ω 50W resistor has a lower thermal mass but a higher thermal resistance than the 100W resistor. It heats up much faster, and cools down somewhat faster than the 100W resistor. It is being run at about 20% of the rated power, and it is supposed to be able to be run at up to 40% of rated power (20W) without a heat sink.

The 1.8Ω 50W resistor has similar thermal characteristics to the 8.2Ω 50W resistor (is is the same package in the same series), but because the power is much higher 86% of rated power, it heats up very fast and would exceed the temperature specs for the resistor if left on for more than a couple of minutes.

The 1.8Ω 50W resistor has similar thermal characteristics to the 8.2Ω 50W resistor (it is the same package in the same series), but because the power is much higher 86% of rated power, it heats up very fast and would exceed the temperature specs for the resistor if left on for more than a couple of minutes.

Adding a large heatsink would increase the thermal mass and decrease the thermal resistance of any of the resistors. If I want to use the 1.8Ω resistor, I will definitely need a heatsink! I can run the 8.2Ω resistor without a heatsink at 9V, but at 12V it would get up to 230°C, too close to the melting point of styrofoam. The 10Ω 100W resistor could be used safely even at 12V. I’ll try adding a 6″×12″ sheet of 0.063″ thick aluminum.  According to the Wikipedia article on heat capacity, the specific heat capacity of aluminum is about 2.422 J/°K/cm3, so the sheet should add a thermal mass of about 180 J/°C, but computing the thermal resistance is complicated, so I’ll just measure the temperature rise and fit the model.  Even if the heat dissipation were not increased (very unlikely), the greater thermal mass and resulting 7× slower response will make measurements easier and less likely to result in overheating the 1.8Ω resistor.

I’ve now tested that my power supply is capable of delivering 8.84V/1.81Ω = 4.88A. I still need to put the 1.8Ω and 8.2Ω resistors in parallel and see if I can get 6A from the power supply. The output impedance of the power supply seems to be about 78mΩ, given how much voltage drop there is with increasing current. Most of that may be the wiring from the power supplies to the resistor, as the power supply senses the voltage as it leaves the power supply, before the IR drop of the wiring.