After six and a half years, I still get email about my article "PID
Without a PhD"
(http://www.wescottdesign.com/articles/Sampling/pidwophd.html ) from
people who are asking for clarifications, or are asking questions that
go beyond what I could say in the 5000 word limit that Embedded Systems
Programming magazine imposed.

The one I got today made me think.

It didn't make me think because it was hard to figure out the answer, or because it was hard to explain the answer so it would be understood. It made me think because the writer was asking me about the dimensions of the gains in a PID controller, and I was impressed that someone who was obviously just approaching the subject was paying enough attention to want to do a correct job of dimensional analysis.

It made me think of the innumerable times when I've done some complex calculation and ended up proving something absurd such as measures of length in units of gallons, and the subsequent discovery of my error. It made me think of the Mars Climate Orbiter which crashed because one team specified a motor in pound-seconds while another one used Newton-seconds (http://mars.jpl.nasa.gov/msp98/news/mco990930.html ). It made me think of how much I like MathCad, because I can set variable values with the correct units, and how inconvenient nearly every other programming language is because numbers are just that -- anonymous numbers.

So I thought I'd write a little bit about dimensional analysis, why I like it, and why you should use it, even if you think it is tedious and trite.

Dimensional analysis is a method used by engineers and scientists that extends the notion that "you can't compare apples to oranges" to the nth degree. Dimensional analysis says that every variable in any physical problem has units, and that you ignore these units at your peril.

The basic rules of dimensional analysis are these:

1. There are very few naked (i.e. dimensionless) numbers. 2. You can only add (or compare) two numbers of like dimension -- you can't compare feet with pounds, and if you're being strict you can't even compare pounds (which is strictly a measure of force) with kilograms (which is strictly a measure of mass). 3. You can multiply (or divide) numbers of any dimension you want; the result is a new dimension. So if I pour water into a pan, the water at the base of the pan exerts a certain force on each bit of area, the resulting pressure is measured in pounds/square inch (PSI), or in Newtons per square meter (N/m^2, or Pascal). 3a. You can honor famous people by naming dimensions after them -- Pascal is the metric unit of pressure, Ampere of current. Avins, Grise, and Wescott have yet to be defined.

So why is dimensional analysis so cool?

If you are doing a long calculation and you track your dimensions, some mistakes will show up as incorrect dimensions.

It can give you insight into the operation of a system -- most explanations of fluid dynamics that I have seen rely heavily on dimensional analysis in their arguments, and when they do so such aerodynamically important quantities as Reynold's numbers and Mach numbers fall out.

When you do design with physical systems, careful dimensional analysis keeps you out of trouble, even when you're getting the math right. Remember that Mars Lander? Had someone been carefully checking dimensions instead of looking at numbers and making assumptions, it would have been a successful mission instead of a famous crash.

How do you use dimensional analysis?

For working forward, such as finding the relationship between an aircraft's speed and it's lift, or finding the relationship between mass, speed and energy (remember E = mC^2?) you find out the dimensions that your answer

For working backward, you do all of your calculations with dimensions, then make sure that, for example, if you're commanding a system in feet it's moving in feet, and not apples/minute. If your answer ends up being in gallons/inch^2, you know you're close but may have to multiply by a constant.

For a more full exposition of dimensional analysis I refer you to the Wikipedia article (http://en.wikipedia.org/wiki/Dimensional_analysis ), or whatever your own web searches turn up.

In the mean time, the next time you're dealing with a knotty problem -- make sure to track those dimensions. The Martian lander you save may be yours!

The one I got today made me think.

It didn't make me think because it was hard to figure out the answer, or because it was hard to explain the answer so it would be understood. It made me think because the writer was asking me about the dimensions of the gains in a PID controller, and I was impressed that someone who was obviously just approaching the subject was paying enough attention to want to do a correct job of dimensional analysis.

It made me think of the innumerable times when I've done some complex calculation and ended up proving something absurd such as measures of length in units of gallons, and the subsequent discovery of my error. It made me think of the Mars Climate Orbiter which crashed because one team specified a motor in pound-seconds while another one used Newton-seconds (http://mars.jpl.nasa.gov/msp98/news/mco990930.html ). It made me think of how much I like MathCad, because I can set variable values with the correct units, and how inconvenient nearly every other programming language is because numbers are just that -- anonymous numbers.

So I thought I'd write a little bit about dimensional analysis, why I like it, and why you should use it, even if you think it is tedious and trite.

Dimensional analysis is a method used by engineers and scientists that extends the notion that "you can't compare apples to oranges" to the nth degree. Dimensional analysis says that every variable in any physical problem has units, and that you ignore these units at your peril.

The basic rules of dimensional analysis are these:

1. There are very few naked (i.e. dimensionless) numbers. 2. You can only add (or compare) two numbers of like dimension -- you can't compare feet with pounds, and if you're being strict you can't even compare pounds (which is strictly a measure of force) with kilograms (which is strictly a measure of mass). 3. You can multiply (or divide) numbers of any dimension you want; the result is a new dimension. So if I pour water into a pan, the water at the base of the pan exerts a certain force on each bit of area, the resulting pressure is measured in pounds/square inch (PSI), or in Newtons per square meter (N/m^2, or Pascal). 3a. You can honor famous people by naming dimensions after them -- Pascal is the metric unit of pressure, Ampere of current. Avins, Grise, and Wescott have yet to be defined.

So why is dimensional analysis so cool?

If you are doing a long calculation and you track your dimensions, some mistakes will show up as incorrect dimensions.

It can give you insight into the operation of a system -- most explanations of fluid dynamics that I have seen rely heavily on dimensional analysis in their arguments, and when they do so such aerodynamically important quantities as Reynold's numbers and Mach numbers fall out.

When you do design with physical systems, careful dimensional analysis keeps you out of trouble, even when you're getting the math right. Remember that Mars Lander? Had someone been carefully checking dimensions instead of looking at numbers and making assumptions, it would have been a successful mission instead of a famous crash.

How do you use dimensional analysis?

For working forward, such as finding the relationship between an aircraft's speed and it's lift, or finding the relationship between mass, speed and energy (remember E = mC^2?) you find out the dimensions that your answer

___must___have, then you hunt down candidates in that field.For working backward, you do all of your calculations with dimensions, then make sure that, for example, if you're commanding a system in feet it's moving in feet, and not apples/minute. If your answer ends up being in gallons/inch^2, you know you're close but may have to multiply by a constant.

For a more full exposition of dimensional analysis I refer you to the Wikipedia article (http://en.wikipedia.org/wiki/Dimensional_analysis ), or whatever your own web searches turn up.

In the mean time, the next time you're dealing with a knotty problem -- make sure to track those dimensions. The Martian lander you save may be yours!

--

Tim Wescott

Wescott Design Services

Tim Wescott

Wescott Design Services

Click to see the full signature.