Connect with us

In Praise of Dimensional Analysis

Discussion in 'Electronic Design' started by Tim Wescott, Apr 24, 2007.

Scroll to continue with content
  1. Tim Wescott

    Tim Wescott Guest

    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!
     
  2. Joel Kolstad

    Joel Kolstad Guest

    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!"
     
  3. Mike Monett

    Mike Monett Guest

    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
     
  4. Charles

    Charles Guest

    Essential in electro-mechanical system design and analysis!
     
  5. Randy Yates

    Randy Yates Guest

    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,
    %%% 919-577-9882 % that's the way it goes..."
    %%%% <> % Getting To The Point', *Balance of Power*, ELO
    http://home.earthlink.net/~yatescr
     
  6. John Larkin

    John Larkin Guest

    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
     
  7. Jerry Avins

    Jerry Avins Guest

    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
     
  8. Tim Wescott

    Tim Wescott Guest

    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
    http://www.wescottdesign.com

    Posting from Google? See http://cfaj.freeshell.org/google/

    Do you need to implement control loops in software?
    "Applied Control Theory for Embedded Systems" gives you just what it says.
    See details at http://www.wescottdesign.com/actfes/actfes.html
     
  9. ["Followup-To:" header set to sci.electronics.design.]
    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
     
  10. Robert Baer

    Robert Baer Guest

    BUT.
    It is *very* useful to specify "dimensionless" numbers with their
    underlying dimensions, eg voltage regulation in volts per volt or if
    really good, in millivolts per volt; the latter giving a clue to a
    sensitivity or gain in the system.
    Also rather useful in error analysis.
     
  11. Robert Baer

    Robert Baer Guest

    Hmmm... X double dot = - X
     
  12. Robert Baer

    Robert Baer Guest

    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.
     
  13. Joel Kolstad

    Joel Kolstad Guest

    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.!
     
  14. No wonder. The PhDs without the PIDs are much more common, then the PIDs
    without the PhDs.

    BTW, in the theoretical physics, they use the dimensionless units to
    avoid the heavyweight dimension constants:

    e = c = h = 1

    How about that?

    No. It crashed because it is impossible to be perfect in all but in the
    very small projects. This problem is mich wider then just the agreement
    about the dimensions.

    The beloved Microsoft style is using the so-called 'hungarian notation'
    to avoid that sort of mistakes. lpSTR, HANDLE, DWORD and such.

    Charles Simonai, who is the inventor of this style, just recently made
    it safely to the space and back :)
    C++ allows you defining the explicit types like "VOLTAGE", "CURRENT" and
    such, so the dumb mistakes are avoided. However, this approach is seen
    by many as the counter productive and resulting in the inefficient code.
    Dimensional analysis is just a trivial check to avoid a class of a
    simple mistakes at the low level.

    "Wescott" would better be reserved as the name of the not yet discovered
    radioactive chemical element of the halogen group. "Avins" is a
    parameter of a Markov source. What could be "Grise" ?
    Because it is generating so much traffic! It is trivial, so anyone can
    add his two cents.

    There is a method of thermodynamic potentials, which derives a useful
    formulae from the dimension considerations by means of differentiation
    and integration. However if you divide your phone number by your SSN, it
    is not going to be very usefull.

    This is the basic thing not worth mentioning which every professional
    should do automatically.
    It would crashed of some other trivial or non-trivial reason. Or at some
    other time. Somebody else would be sacrificed as a scapegoat. That's the
    only difference.


    Vladimir Vassilevsky

    DSP and Mixed Signal Design Consultant

    http://www.abvolt.com
     
  15. Jerry Avins

    Jerry Avins Guest

    Vladimir Vassilevsky wrote:

    ...
    Spoilsport! :)

    Jerry
     
  16. Tim Wescott wrote:

    (snip)
    This reminds me of something that has occurred to me in the past, and
    that I would like to see if people here agree.

    It seems to me that in calculations physicists usually give variables
    quantities with dimensions, where engineers usually factor out the
    dimensions. For example,

    A physicist might say:

    F = m a, where the variable m might have the value 3kg or 5g.

    An engineer might say:

    F(Newtons) = m(kg) * a (m s**-2), such that m has the value 3 or 0.005.

    That is, the dimensions belong to the equation, but not to variables.

    It might be because most programming languages don't keep units with
    variables, so that one must factor them out before assigning a value
    to a variable.

    I would be interested to see if others agree or disagree.

    -- glen
     
  17. Phil Hobbs

    Phil Hobbs Guest

    I think that's true--engineers are typically taught to pull out all
    those fundamental factors of hbar, 4*pi/c**2, and so on, crunching them
    all into some anonymous constant to save labour and blunders. When you
    do that, you have to keep track of the units by hand, whereas in the
    physicists' method, the units get carried along automatically.

    In fact, people doing relativistic field theory usually use c=1 style,
    in which all the calculations are done with just numbers, and the proper
    conversion factors get figured out at the end, by reverse dimensional
    analysis--sticking in the right powers of c, hbar, G and so on to make
    the units come out right. It turns out that this is a well-defined
    procedure, so it saves labour and you still get the right answer at the
    end. (I'm not a field theorist, so I've never done this.)

    Cheers,

    Phil Hobbs
     
  18. 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
     
  19. Tim Williams

    Tim Williams Guest

    In that example, you showed kilograms or grams -- I grew up with thousands
    prefixes, so I change them on the fly as it suits me. A 1k resistor has
    always been, and always will be, a 1000 ohm resistor as well, and not a 1 *
    (1000 / 1k) resistor. :^P

    Tim
     
  20. RRogers

    RRogers Guest

    As usual Tim is right. I would like to be more explicit about it's
    use in control systems. It's what allows you to "close the loop" on
    the block diagram; for instance the plant is something like degC1/
    Volt, the transducer is something like Volts/degC2 and the controller
    is Volts/Volts. When multiplied this give degC1/degC2 as the gain and
    the units to measure during verification. Of course a real diagram
    has a lot more terms and different units; but the loop product must
    balance. Inserting the open loop process variables in proper units
    degC1/degC2 into the equations answers many questions.
    One additional point is that the form is not as specialized as it
    seems, but carries over to generalized Differential Geometry as vector/
    covector spaces. Applying dimensional analysis in this realm has
    allowed me to make sense of a lot of formulas. The units changes
    (volts->degC) correspond to mapping from one vector space to another
    (and back); the reduction to a gain scalar is the contraction of a
    covector and vector; and so forth.

    RayRogers
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-