As long-time readers of this space know, I take an annual pilgrimage to my family’s summer place on the beaver-shark infested shores of Lake Huron, Ontario’s vast inland sea. One Thursday in August several years ago I was relaxing on the beach with a few of my visiting Waterloo alum friends when there was an enormous explosion a couple of bays over. Four huge white clouds billowed into the clear blue sky.
This was less shocking than you might imagine. There had been rather a lot of loud bangs coming from the nuclear power plant near the cottage that year as they were dismantling the heavy water towers. CANDU nuclear power plants use heavy water as coolant; heavy water extraction requires large quantities of dangerously toxic heavier-than-air gasses. Since the utility had stockpiled enough heavy water to last for the expected lifetime of the facility, they were dismantling the apparatus and removing the toxic threat.
However, these four huge clouds did not look like the dust clouds you’d expect from a demolished tower; they looked like perfectly ordinary, if somewhat vertical, white fluffy clouds.
Well, whatever. We went back to our conversation.
A few minutes later one of my guests reported that the water was not working in the cottage. This also is a not entirely uncommon situation; cottage water systems can be finicky to say the least.
The first thing I checked was that all the water supplies were in fact not working; the toilet tank was not filling, the kitchen sink was not running, and so on. We get our water from a well; clearly the problem was with the pump.
I checked to make sure that the pump was switched on. It was switched on, but not running.
I checked the electrical service panel. None of the breakers were tripped.
I tried turning on a light.
Aha! We’ve had a power failure. That explains it.
And that was when I suddenly put two and two together and realized that a huge explosion at a nuclear power plant, and me not being able to run the water pump just might have a causal connection. This was when I started to get a bit more worried, and turned on a battery-powered satellite radio receiver.
As it turns out, the power wasn’t just off in my neighbourhood; for the last ten minutes there had been no power anywhere from the wilds of Northern Ontario to Manhattan Island; 55 million people were without power.
So I went and found my neighbour, Frank, who was relaxing on his deck with a cold drink. He’s a retired Ontario Hydro engineer, and therefore I held him personally responsible for the fact that I was going to have to barbecue the spaghetti I was planning on having for dinner. The first thing Frank pointed out to me was that in just a few minutes we were about to see a rare but entirely predictable event: a steady stream of vexed, bucket-carrying children streaming from their cottages to fetch lake water with which to flush their toilets. (Cheap manual labour is why you bring children to the beach.) And sure enough, within about two minutes there were half a dozen kids with buckets running up and down the sand.
The next thing he pointed out to me was that by all appearances the safety systems at the plant had done their job flawlessly. The interesting thing about electrical power is that every watt you produce has to get consumed immediately. There’s no storage capacity in the system whatsoever; we simply do not have the technology to quickly store excess power for later. Which means that when one power plant goes offline for some reason, power gets routed to the cities it was servicing from other providers. But the sudden increase in demand might cause dangerously high current on one of the other plant's lines, causing that plant to shut down, and now we’ve got two plants offline, but the city that is drawing that power is still trying to draw the power from somewhere. Perhaps the city distribution stations detect the overcurrent situation, trip their breakers and shut down, and suddenly you’ve got the opposite problem; now you have an entire city offline so there is now too much power being produced. And so it goes; as more and more power plants and cities go offline there are vast surges of power going back and forth across the grid in just a few seconds. Pretty soon there is nothing left connected to the grid except a few power plants all desperately trying to power something, anything. Huge backwashes of power come hurtling along the transmission lines back to the plants, which can't be good.
In that situation, what do you do? You have to stop producing power immediately, because that’s making it worse for everyone else. The plant near my cottage uses the heat produced by decaying uranium to make superheated heavy water steam. That is then passed through heat exchangers to make not-radioactive high pressure steam, which then runs conventional generator turbines. When those turbines need to turn themselves off in a hurry the safety system simply dumps the steam running through the turbines directly into the atmosphere, instantly liberating billions upon billions of joules into the atmosphere and making four really enormous fluffy clouds and a heck of a noise.
Upon digesting this explanation, I suggested that Frank go into his shed, find the crank that restarts the power plant, and head on over there to show them how it was done in his day, a suggestion which he politely declined. So we barbecued the spaghetti, drank lemonade, and sent small children to fetch water from the lake. One of the best things about being at the beach is that you don’t need electricity for anything.
Next time: Writing a "simple" refactoring isn't necessarily as simple as you might think.