Tuesday, August 27, 2013

Installer Tips for Open Source Developers

So, I've recently had to install a lot of software from source. I used to do this a lot — back in the days when I was a Linux hobbyist and had nothing better to do — but in recent years, I have tended to just live with whatever versions of software libraries come with whatever Linux distro I happen to be using on a particular machine, usually the latest Ubuntu LTS (although I've used Slackware, Red Hat, SuSE, Mandriva, Yellow Dog, and CentOS in addition to Irix, Solaris, and FreeBSD).

One thing that hasn't changed one iota in (almost) twenty years is the utter cluelessness of niche developers when it comes to packaging their software, and it's driving me nuts. Just because your software isn't totally mainstream doesn't mean you can subject your (potential) users to an installation nightmare of manually editing Makefiles and making decisions about minutiae of configuration and installation.

The rules are very, very, simple indeed. Everyone who's ever installed anything from source knows the rules, so why the hell don't niche developers?

Here it is. The standard way of installing from source is

After I download a (well-behaved tarball), I expect to be able to do this:

    $ tar xzf foo-1.2.3.tar.gz
    $ cd foo-1.2.3
    $ ./configure
    $ make
    $ make test|check
    $ sudo make install

There are a small number of variations, of course, you can use 7zip or bzip2 instead of gzip, and so on. At a push, you can inflict CMake or SCons on me, but, frankly, I don't care how much of a pain in the hole the Autotools are (and, as a developer, I hate them), ideally you should use them because that's what your users expect, and they don't really care if it takes you a day of frustration to figure out. If that's significant in the context of your overall software development, it's probably not worth installing your software in the first place.

If you insist on inflicting your egotistical notions of how installation from source should work, the one thing you absolutely cannot do is ignore now well-established conventions about where stuff goes: absent any explicit instruction from me, you install your shit in the appropriate directories in /usr/local and nowhere else. I don't care that it's easier for you to just copy great gobs of shit into /opt/IAmSoImportant and leave all the painful configuration to me, and for the love of all that is good and right, if you install anything directly in /usr, interfering with the packaging system of my distro, I will hunt you down like a rabid dog and hammer a mechanical pencil into your eye with your detached and still-bleeding leg. I know it's hard to decide whether you should put your headers directly in /usr/local/include or in a subdirectory thereof, or your libraries in /usr/local/lib or in a subdirectory thereof, and it's often subtly debatable how “platform independent” that file really is, so whether it should go in /usr/local/share/foo or somewhere else is, in the end, a judgement call. I know. I sympathise. I really do. But if you can't decide, and you wrote the damn thing, how the hell do you expect me to?

In short, if you want your software to ever have the slightest chance of “catching on” and becoming popular, you can't just do the fun stuff, you have to suck it up, make a decision or two, and do the mundane and tedious stuff that makes installation easy for your users and packaging easy for distributions.

End of rant :o)

Thursday, August 8, 2013

Rapid Charging Electric Cars

One of the things that comes up repeatedly with electric cars is how fast you can charge them. The current answer is “overnight” or, at least, on the order of hours. Some more bullish electric car proponents argue that charging stations could be built that would reasonably match gasoline filling speeds. I don't think that's plausible.

The EPA limits gasoline filling speeds to 10 gpm (gallons per minute), or 0.63 l/s (liters per second). The volumetric energy density of gasoline is about 36 MJ/l (megajoules per liter), which means that, at the gas station, energy is flowing into your tank at a rate of 36 MJ/l * 0.63 l/s = 22.7 MJ/s = 22.7 MW (megawatts).

Now, suppose that the battery-to-wheels efficiency of an electric car is five times the tank-to-wheels efficiency of a gasoline car, which is a fairly reasonable assumption. Then we only need a charging power of 22.7/5 =  4.5 MW. Generously supposing 90% efficiency from grid to battery, we need “only” draw five million watts off the power grid.

That is an absolutely vast amount of electric power: not much less than is needed to supply 4,000 American homes. This is not a plug-in device.

A reasonable rule of thumb for distribution level electricity supply is “100VA/kV” in other words, if you were to be a 10kV primary customer, you can expect to be able to draw at most 1 MVA (the difference between VA and watts is not important for the current discussion). On that basis, the 5MW charging station will need to be a 69 kV subtransmission customer of the local power utility. One charging station, not a gas station forecourt with 8 of them.

Now, let's talk about slew rate. You can't just turn on a 5 MW load (for want of a round number) like a 60W lightbulb. Call your local power company and ask them how quickly they would allow a subtransmission customer to turn on a 5 MW load. The answer cannot be faster than they can spin up a gas turbine. The slew rate of a “hot” GE gas turbine generator is, at most, 5%-per-minute. In other words, to be able to even ramp-up a 5MW charger to full power in one minute would take 100MW of spinning reserve, and only after that have you hit gas pump-equivalent power.

Let's look at that another way. Take the 85kWh (kilowatt hour) battery in the top-end Tesla Model S. 85kWh is 306MJ. Suppose you want to charge that sucker in a minute flat, which is not unreasonable given its range of 265 miles: one minute would give you ten gallons of gas, at least enough to run a modern luxury car for that distance. To supply 306 MJ in 60s is 306/60 = 5.1 MW. Pretty much the same number.

In synopsis, refuelling an electric car at the same rate as a gas pump, any way you look at it, requires something of the order of 5 MW of electric power. This is, practically speaking, impossible. Notice that I haven't mentioned cost. Economically speaking, it is utterly beyond any reason: the charger alone would cost millions. Recharging an electric car at even ten percent of gas-pump equivalent speeds (requiring “only” a half-megawatt charger), presents enormous technical challenges in electricity supply.

In short, the technical challenges of recharging an electric car on consumer-acceptable timescales is almost nothing to do with the car or its battery.