In Praise of Dimensional Analysis

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 _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
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
My high-school physics book had a cartoon in it where Einstein was standing in front of a chalkboard, having crossed out E=mc and E=mc^3. The caption was something along the lines of, "Aha! So the units *do* work out in that one!"
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Joel Kolstad wrote:

The one I remember has E=mc and E=mc**3 written down, and someone straightening up the books on a nearby bookshelf saying. "Well now that's all squared away."
-- glen
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

That was one of Gary Larson's classic Far Side cartoons. "Everything is squared away. Yep, squa-a-a-a-a-ared away ..."
Mark
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Very good post! We tend to get lazy doing plain ohm's law calculations, since they are so simple. But this creates the bad habit of ignoring the dimensions on more complex problems where errors are more likely.
We need to break these old bad habits and reinforce new ones. Your article is a very good place to start.
Thanks!
Mike Monett
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Essential in electro-mechanical system design and analysis!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Perhaps you can say dimensional analysis is where theory and reality meet.
--
% Randy Yates % "And all that I can do
%% Fuquay-Varina, NC % is say I'm sorry,
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

In a PID controller, we are summing voltages (which is fine) but they also represent an error, the time integral of an error, and the derivative of an error.
The error is in volts. The integral is in volt-seconds. But we sum them, and nothing explodes!
John
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
John Larkin wrote:

If the output of the integrator is in volts, then it's gain must be in volt/volt-second.
If the integrator is buried in software, then it's gain is in counts/count-tick, though you'll often see integrator gain expressed as (something)/(something-seconds) -- because someone has taken it on themselves to obscure the sampled nature of the controller by scaling the integrator (and derivative) gain.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
["Followup-To:" header set to sci.electronics.design.] John Larkin wrote:

Yes.
No. It's volts. The gain of the integrator has the unit V/(Vs), and the integration is volts over time, so the seconds cancel out and you get volts again. A similar arguments holds for the differential term.
robert
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
John Larkin wrote:

Hmmm... X double dot = - X
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Nope. It's
X double dot = - (omega squared) X
-- Mark
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Apr 24, 8:19 pm, John Larkin

Somewhere, often in the form of an R*C, those volt-seconds are divided by seconds to get back to volts.
Mark
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tim Wescott wrote:
...

Hear! hear! We need more of this. (T as the dimension of gain is absurd.)

But those are vitally important. The arguments to transcendental functions had darn well be dimensionless, even if you need to do extra work (normalize) to make them so. The sine if two meters is a mistake.

Sometimes you can't even compare numbers of like dimension. For example, the dimensions of torque and work are the same, but they are inherently incommensurable. The MKS dimensions of volts are obscure, but electromagnetic dimensions hang together even if they stand apart from the more common ones. (The unit of flux is a volt-second; the unit of inductance is volt-second/ampere-turn. "Turn", like radian. is dimensionless.)
...
Our educators should make more of a big deal of this than they do. Thanks, Tim.
Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Jerry Avins wrote:

Actually, my science teacher in High School emphasized units; minimal steps that must be shown in solving a given problem was 1) present the equation in standard form (E = I * R), 2) substitute the knowns WITH UNITS (22 Volts = I Amps * 11 Ohms), 3) solve for the unknown AND GIVE UNITS (I = 2 Amps); draw a box around the answer WITH UNITS so it can be found. Any of these criteria found missing will result in a grade of ZERO for that question (therefore, since there is no box, i get a ZERO). It was acceptable to add any number of intervening steps either for clarity or ease of calculation.
Saved my butt in college as i was able to derive an equation from the units involved in the question; with that, i solved the problem and passed the test.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

He deserves kudos. I'm amazed how many IEEE papers you see where units are left off of graphs, equations containing "magic constants" are presented without specifying the units assumes that are required to make the constant correct, etc.!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Cj4gT3VyIGVkdWNhdG9ycyBzaG91bGQgbWFrZSBtb3JlIG9mIGEgYmlnIGRlYWwgb2YgdGhpcyB0 aGFuIHRoZXkgZG8uCj4gVGhhbmtzLCBUaW0uCj4KPiBKZXJyeQo+IC0tCj4gRW5naW5lZXJpbmcg aXMgdGhlIGFydCBvZiBtYWtpbmcgd2hhdCB5b3Ugd2FudCBmcm9tIHRoaW5ncyB5b3UgY2FuIGdl dC4KPiCvr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+vr6+v r6+vr6+vr6+vr6+vr6+vr6+vrwoKSGVsbG8gSmVycnkgZXQgYWwsCkkgY2FuIGFzc3VyZSB5b3Ug dGhhdCBteSBzdHVkZW50cyBhcmUgZm9yY2VkIHRvIHNob3cgdW5pdHMgYWxsIG9mIHRoZQp3YXkg dGhyb3VnaCB0aGVpciBwaHlzaWNzIGNhbGN1bGF0aW9ucy4gSSBhbHNvIHNob3cgdGhlIHV0aWxp dHkgb2YKZXhwcmVzc2luZyB0aGluZ3MgYXMgcmF0aW9zLCBzbyB0aGUgdW5pdHMgY2FuY2VsIG91 dC4gU3VjaCBhcyBnaXZlbiBhCnBlbmR1bHVtIGNsb2NrIHRoYXQgcnVucyBub3JtYWxseSBvbiBF YXJ0aCwgaG93IG11Y2ggZmFzdGVyL3Nsb3dlcgp3aWxsIGl0IGJlIG9uIHRoZSBNb29uPyAgKGdf bW9vbiBhcHByb3ggMS82IHRoYXQgb2YgdGhlIEVhcnRoJ3MpCgpDbGF5CgoKCg=
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

A venerable approach. Galileo used it, in fact. Algebra, at the time, he felt was not yet rigorously founded while ratios had been for quite some time.
Jon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Jonathan Kirwan wrote: (snip)

I had known that Galileo's first experiments with rolling balls were an attempt to slow down the fall of gravity, and allow him to understand the effect. I hadn't known why he decided to do it that way, without the algebra to show what the result would mean.
-- glen
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Sun, 29 Apr 2007 14:29:36 -0800, glen herrmannsfeldt

Galileo probably began considering motion like this at least as early as 1586, I think, having written a dialogue on problems of motion that year. He must have considered inclined plane experiments as early as 1591, since he added them to his De Motu that year. But I seem to recall that his immersion into building them would have been around 1601-1602.
The details about his thinking, as well as copies of some of his folios, can be found in Sillman Drake's "Galileo: Pioneer Scientist." I recommend it.
Jon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.