My evil car knows I get cold easily, and it purposely screws with me when I desperately need hurricane winds of hot toasty air. “No heat for YOU” in its best Soup Nazi sneer, armrests crossed and headlights rolling in the air. “I just don’t feel like it right now.”

Northbranch Park. When I was *prepared* for the icicles.

Last spring, I jumped into my car, damp from a light afternoon shower and jacked up the heat. It was overcast but about 70ºF outside. Brrr - I was chilled! But when when I maxed out the temperature (90ºF) my car refused to emit the anticipated waves of warmth. Grrrr.

The gas tank was full, car nicely washed and detailed, clean air filter and sated with meandering drives in the country: she should be happy and content. But nooo, she’d gone bipolar and my car insurance doesn’t cover mental health.

Turns out, this behavior isn’t a fluke. My car has treated me disrespectfully in similar situations but she wonderfully and consistently ratchets up the thermal waves in the dead of winder all the way to 90ºF pretty darn quickly.

For years, I have vented at the apparent software bug in the temperature algorithm. I mean, CLEARLY, how hard could it be? In my “let’s reality-check grad students” hiatus a couple years ago, they handled a thermal control algorithm fairly easily after a couple hours in the lab (and ice and heat guns).

Maybe this seems like a trivial situation to chase, but I get cold easily. I have on sweats and my husband is wearing a T-shirt. So you see my motivation.

And thus, I set out to reverse engineer the algorithm to satisfy my rabid belief that some engineer somewhere was more interested in surfing the internet than field-testing the algorithm.

Symptoms

  • The outside temperature is around 65-70ºF.
  • Outside is overcast and lightly raining. But not always raining.
  • I’m not soaked, but nicely damp from hair to sneakers.
  • The engine’s on but the car’s not moving. Sitting at the curb.
  • I had the temperature set to 90ºF (max setting) and ENSURED all the buttons were appropriately set for heat to be flowing freely. The air came out lukewarm.
  • I am shivering. (Well, this isn’t really a symptom of the car, but more of my motivation for debugging the car.)

Background, more fact-finding and speculation

So, has this happened before? Any other relevant information? Well, it’s happened under similar situations and also when I’ve been driving. And the heater works in cold-cold weather just fine.

  • Heater works in the dead of winter.

Hmmm, this reminds me of one of the mysteries in my technical mystery book: Chapter 4: The Case of Thermal Runaway: Rare Transient Bugs Are Still Bugs!

So think of all the possible problems with a thermal control system. What can go wrong?

?? The heater circuit itself?

?? A relay turning current to the heater on and off?

?? The software algorithm itself? Thermal control algorithms generally have a setpoint or use the ambient temperature as part of the algorithm…could this be related?

?? What about the selection button (momentary up and down) on the dash?

?? Water/humidity/moisture?

?? Is my car sentient? (Heh heh I often secretly suspect it is.)

Hypothesis

Since the heater hasn’t stopped working completely, I don’t suspect hardware or mechanics unless I have a hairline fracture in a board or solder connection. Expanding and contracting board or something, but let’s save that idea for later.

  • Some climate control systems use heat from the engine and a fan - perhaps when the car isn’t moving, the heater can’t generate heat fast enough, and I just needed to wait longer.

Please let this not be. Hmmm, nope. This problem also happens after driving an hour on the highway.

And in the dead of winter, it works fine in all conditions - neither snow nor rain nor sleet prevents my faithful car from the swift completion of hauling my butt all over the NJ/PA area. So I’m gonna put my money on the software algorithm. Specifically, I have a couple more questions based on this idea.

  • The heater works in the cold but not at warmer ambient temperatures. Is ambient temperature used in the algorithm? If so, is there a specific ambient temperature when the heater suddenly stops working?

Mucking with the system

(That’s an official way of saying you’re going to experiment with the heater system during different outside temperatures and conditions.)

Since I didn’t originally intend to debug this, I ended up just mucking with it whenever it misbehaved.

Then one magical day with the outside temperature about 68°F, it didn’t work. Until I jacked it all the way to 90°F. Then it suddenly started blasting at about 1000 degrees. (Okay, just 90°F.) But after chill-chilll-chilll … FURNACE BLAST…. AHA!

Acted like a step function or an overwhelmed parent at Walmart (”Candy please mommy?” “No.” “Please!” “No.” “Please!” “No. No. WELL OKAY.”)

Eyes narrowed, perhaps no longer fully focused on the road, I knew I had a grasp on the slivery little tail of this one. Heh heh heh. My mucking suddenly became more methodical.

So I tested. When set to 90°F, it worked (i.e., toasty fireside). Set to 89°F; nada. Blows lukewarm. I went back and forth between the two several times. The behavior was repeatable.

Important data point - one would expect an algorithm like this one to be somewhat linear, or at a minimum, monotonically increasing in a happy meandering kind of way. Not with a sharp discontinuity at a specific temperature.

Someone put a step function in my car

So what’s the deal with the boundary between 89°F and 90°F? The business with ambient temperature was dancing in my head. In addition to informing me of my general north-westerly direction, my car revealed an ambient temperature of 69°F.

An idea quickly developed in my head. The difference between the ambient and desired temperature was 20°. A Nice Round Number.

So I waited until the ambient temperature dropped to 68° and then set the thermostat to 88°. Nada. But tweet it up to 89° and lo-and-behold the temperamental heater switched from tepid lukewarm to Caribbean Corona Afternoon!

Software for Step Functions

That’s it. The temperature control software algorithm in my car has a wonderful little feature that conditionally sort-of ignores heating requests when the requested temperature is less 20° hotter than the outside temperature.

Something like this:

#define TEMPERATURE_KLUDGE 20
if ((requested_temperature - outside_temperature) < TEMPERATURE_KLUDGE)
/* Do nothing */
else
Heat_dammit ();

BUT! That’s not all. The climate control limits the temperature to 90°, so requested_temperature can never be greater than 90.
Do the math … (90° - outside temp) < 20°

Therefore, max outside temp when the heater will Behave as Desired is < 70°

(What a crock.)

Validating the proposed problem

And here I often fall guilty of my own admonition to MAKE SURE your identified root cause is true and complete (that whole local versus global maxima thing I talked about when my computer went through its adolescent phase of completely ignoring me.)

So on the way to work yesterday, the temperature was 66°F. Darn close to the 68°F that started this mess.

This time the behavior was slightly different - the air was cool until I set it to about 87°F, and then when I slowly increased the setting to 90°, the temperature ratcheted up exponentially to inferno.

I hadn’t noticed this little crescendo at the end. (Probably because in earlier situations I’d been repeatedly jamming the “temperature up” button knowing full well it was already set to 90°F.)

As I continued my (loooong) commute, the outside temperature reached 68°F and I observed (felt) the same instantaneous furnace like before. BUT! With the temperature outside climbing into the low 70s, all behavior changed. Now the temperature DID slowly increase but not to a level I’d requested. And still, increasing the setting to 90°F instantaneously invoked The Furnace.

  • Outside temperature in the 60s and low 70s exhibit the temperamental behavior.
  • Outside temperature is IRRELEVANT when the temperature is set to 90°F. We need to add another line to the pseudo code.

Oh boy. A more refined view of the control algorithm:

#define TEMPERATURE_KLUDGE 20
#define MAX_TEMPERATURE 90
if (requested_temperature == MAX_TEMPERATURE && random_number(0,1))
{
heaters_on_full();
exit(0);
}
/* Be temperamental why don’t you */
if ( (requested_temperature > 65) && (requested_temperature - outside_temperature) < TEMPERATURE_KLUDGE)
{
heat_sortof_exponentially_a_little();
exit(0)
}
/* Behave like an adult */
Heat_nicely (requested_temperature, outside_temperature);

(I know, there’s no error or boundary checking here, etc. It’s PROTOTYPE code, something (we) software engineers are notoriously bad at abandoning when it’s time to write the REAL code.)

Local or Global Maxima? Validating Via Google

I hate going straight to Google, but after I understand the symptoms and have a hypothesis or two, I like to see if anyone else has this problem. I did a search and MANY people have issues with the climate control system with this model car.

“Ahhh! ” I dance merrily around the computer, “I’m not the only one!”

But their problems cluster around the unit automatically switching from recirculate to fresh air modes, usually at the most inopportune moments like sitting in traffic behind a diesel bus. Ack.

  • But AHA! Possibility that automatic switching between Fresh Air setting and Recirculate setting might be related to problem.

So this morning I REPEATED all my testing from yesterday on the Recirculate setting (which I generally always use), and unfortunately (or maybe fortunately), mine stays on Recirculate the whole time. So probably not tied into my problem. But try it …

  • Does the problem occur in Fresh Air setting? This could make it related to ambient temperature detection perhaps.

Same bug.

So I repeated on the Fresh Air setting.

Same results.

  • Is it related to the fan speed setting?

I admit I didn’t think of this until now. But temperature control is temperature control and fan speed is just another independent variable. But wouldn’t it be just so annoying if the heater behaves at lower fan speeds, a setting you’d never use when you actually want some emergency heat?!?

Which of course begs the question, why the hell is this 90°F inferno situation logical in the first place?

I can think of a couple things.

1) Personal Needs. Designers (erroneously) think that drivers will never want to jack up the heat 20 degrees when it’s already “pleasant” outside. (Remember the general rule - men are exothermic, women are endothermic. And women represent ~10% of the enrollment in software development-related college programs. Therefore, the setpoint on thermal control systems = Men.)

2) Laziness. Thermal control algorithms aren’t rocket science although delivering *accurate* temperature values can be challenging. But we don’t need real accuracy here, we need consistency and modestly logical behavior. I suppose the programmers couldn’t come up with an algorithm that terminated nicely at the 90 degree endpoint so they just implemented some hack code like above.

I dunno. Whatever. I just know I have to bring a sweater (oh, so rolls eyes) in case I might get caught outside in warm weather.

≈ ♦ ≈

See the comprehensive list of All the “Let’s Debug It” Mysteries

Let’s Debug It: A Rabid War between Technology and Nature (Jet Skis vs Mangroves)

Let’s Debug It: My Internet Security Software HATES me, TOLERATES me, REVILES me. Evil BitDefender

Let’s Debug It: Alaskan Scuba Stuff and iPods Don’t Exercise

Let’s Debug It: A Cat’s Plea to Microsoft - “Can You Hear Me Now?”

Let’s Debug It: “No Ma’am (Idiot), You’re Calling from Line 2″

Let’s Debug It: Keyboards and Endothermic Mammals

Let’s Debug It: Hacksaws are Your Friend

Let’s Debug It: My Computer Plays “I’m Ignoring You Now”