New Metric Prefixes Get Bigger And Smaller

It always fascinates us that every single thing that is made had to be designed by someone. Even something as simple as a bag and box that holds cereal. Someone had to work out the dimensions, the materials, the printing on it, and assign it a UPC code. Those people aren’t always engineers, but someone has to think it out no matter how mundane it is before it can be made. But what about the terms we use to express things? Someone has to work those out, too. In the case of metric prefixes like kilo, mega, and pico, it is apparently the General Conference on Weights and Measures that recently had its 27th session. As a result of that, we have four more metric prefixes to learn: ronna, quetta, ronto, and quecto.

Apparently, the new prefixes are to accommodate “big data” which is rapidly producing more data than there are atoms in the Universe. There were actually proposed earlier in a slightly different form but accepted at the conference. Apparently quecca is too close to a Portuguese swear word. So what do these actually mean? A QB (quettabyte) would be 1030 bytes while an RB (ronnabyte) is only 1027.  So 1 QB would be 1,000,000 yottabytes (YB) the previous top of the scale.

Continue reading “New Metric Prefixes Get Bigger And Smaller”

Just What On Earth Is A Therm?

With the news here in Europe full of the effect of the war in Ukraine on gas supplies and consequently, prices, there it was on the radio news: a unit of measurement so uniquely British that nobody uses it in the real world and nobody even has a clue what it really means. We’re speaking of the Therm, one of those words from our grandparents’ era of coal gas powered Belling cookers and Geyser water heaters hanging over the bath, which has somehow hung on in the popular imagination as a mysterious unit of domestic gas referred to only in the mass market news media. What on earth is a therm, and why are we still hearing it on the news in the UK?

You can’t Buy A Therm

Asking the internet what a therm is reveals the answer, it’s 100,000 BTU. What’s a BTU? A British Thermal Unit, another anachronistic measurement five decades after the UK went metric, it’s the amount of energy required to raise a pound of water by a degree Fahrenheit. Which in turn is about 1,054 joules, in today’s measurements. So a therm is thus a unit of energy, can we take a look at our gas meters and see how many of them we’ve used this winter? Not so fast, because gas isn’t sold by the therm. Older gas meters had cubic feet on them, and we’re guessing that now they’re calibrated in cubic meters. We can’t even buy a therm of gas, so why on earth are the British media still using it? Continue reading “Just What On Earth Is A Therm?”

Fail Of The Week: Mistaking Units For Values

Usually when we post a Fail Of The Week, it’s a heroic tale of a project made with the best of intentions that somehow failed to hit its mark. The communicator that didn’t, or the 3D-printed linkage that pushed the boundaries of squirted plastic a little bit too far. But today we’re bringing you something from a source that should be above reproach, thanks to [Boldport] bringing us a Twitter conversation between [Stargirl] and [Ticktok] about a Texas Instruments datasheet.

The SN65220 schematic
The SN65220 schematic

The SN65220 is a suppressor chip for USB ports, designed to protect whatever the USB hardware is from voltage spikes. You probably have several of them without realising it, the tiny six-pin package nestling on the PCB next to the USB connector. Its data sheet reveals that it needs a resistor network between it and the USB device it protects, and it’s this that is the source of the fail.

There are two resistors, a 15kO and a 27O, 15k ohms, and 270 ohms, right? Looking more closely though, that 27O is not 270 with a zero, but 27O with a capital “O”, so in fact 27 ohms.

The symbol for resistance has for many decades been an uppercase Greek Omega, or Ω. It’s understood that sometimes a typeface doesn’t contain Greek letters, so there is a widely used convention of using an uppercase “R” to represent it, followed by a “K” for kilo-ohms, an “M” for mega-ohms, and so on. Thus a 270 ohm resistor will often be written as 270R, and 270 kilo-ohm one as 270K. In the case of a fractional value the convention is to put the fraction after the letter, so for example 2.7kilo-ohms becomes 2K7. For some reason the editor of the TI datasheet has taken it upon themselves to use an uppercase “O” to represent “Ohms”, leading to ambiguity over values below 1 kilo-ohm.

We can’t imagine an engineer would have made that choice so we’re looking towards their publishing department on this one, and meanwhile we wonder how many USB devices have gone to manufacture with a 270R resistor in their data path. After all, putting the wrong resistor in can affect any of us.

Naming Names

We have all heard that good variable names are important for creating readable programs — advice that will serve you well when you come back to your code two years later, or even twenty. Sometimes, when you are so deep in the zone and begin to question a variable name that you made three levels up the calling hierarchy, it can be helpful to take a step back and review your variable naming conventions. The wikipedia article on computer program naming conventions is a good starting point, where you can dig into the nitty gritty of Hungarian notation like bFlag, case separated names like camelCase, and so on. But sometimes you have to go meta, and need names to describe the names themselves.

For example, in everyday usage the terms parameter and argument are often used interchangeably. But strictly speaking, a parameter is a placeholder, the variables in a function declaration for example (see image above). An argument is the actual value itself, say the number 50.334 in the example.

We recommend that units of measure should always be clearly specified in your comments, perhaps even in the variable names if you’re mixing different systems in the same program. At Hackaday we prefer to use SI units, check out NIST SP 330 if you’re interested. But invariably, there are going to be exceptions for years to come. We like to deal with those at the edges during I/O if possible, thus keeping a consistent set of units in the core of the program.

What about the terms number and value? We like to think of a number as being a kind of value. For example, a function’s return value could be a number, say a velocity. Or it could return an enumeration or a boolean. Sometimes the perfect meta-name for something will collide with a reserved keyword in your programming language, names like string or data for example. In these cases you have to be creative and find suitable synonyms, perhaps text and payload.

Using consistent and precise language can be tedious, but it can be just as helpful as good commenting and variable naming practices. Do you have any examples where precise terminology such as this has been been helpful or perhaps tripped you up? If so, share in the comments section below.

 

 

There Is No Such Thing As An Invalid Unit

The Mars Climate Orbiter was a spacecraft launched in the closing years of the 1990s, whose job was to have been to study the Martian atmosphere and serve as a communications relay point for a series of other surface missions. It is famous not for its mission achieving these goals, but for the manner of its premature destruction as its orbital insertion brought it too close to the planet’s atmosphere and destroyed it.

The ill-fated Mars Climate Orbiter craft. NASA [Public domain].
The ill-fated Mars Climate Orbiter craft. NASA [Public domain].
The cause of the spacecraft entering the atmosphere rather than orbiting the planet was found in a subsequent investigation to be a very simple one. Simplifying matters to an extent, a private contractor supplied a subsystem which delivered a reading whose units were in the imperial system, to another subsystem expecting units in the SI, or metric system. The resulting huge discrepancy caused the craft to steer towards the surface of the planet rather than the intended orbit, and caused the mission to come to a premature end. Billions of dollars lost, substantially red faces among the engineers responsible.

This unit cock-up gave metric-using engineers the world over a brief chance to feel smug, as well as if they were being honest a chance to reflect on their good fortune at it not having happened on their watch. We will all at some time or another have made an error with respect to our unit calculations, even though in most cases it’s more likely to have involved a simple loss of a factor of ten, and not with respect to a billion dollar piece of space hardware.

But it also touches on one of those fundamental divides in the world between the metric and imperial systems. It’s a divide that brings together threads of age politics, geography, nationalism, and personal choice, and though it may be somewhere angels fear to tread (we’ve seen it get quite heated before to the tune of 885+ comments), it provides a fascinating subject for anyone with an interest in engineering culture.

Continue reading “There Is No Such Thing As An Invalid Unit”

What’s So Bad About The Imperial System Anyway?

As a Hackaday writer, you can never predict where the comments of your posts will go. Some posts seem to be ignored, while others have a good steady stream of useful feedback. But sometimes the comment threads just explode, heading off into seemingly uncharted territory only tangentially related to the original post.

Such was the case with [Steven Dufresne]’s recent post about decimal time, where the comments quickly became a heated debate about the relative merits of metric and imperial units. As I read the thread, I recalled any of the numerous and similarly tangential comments on various reddit threads bashing the imperial system, and decided that enough was enough. I find the hate for the imperial system largely unfounded, and so I want to rise to its defense.

Continue reading “What’s So Bad About The Imperial System Anyway?”