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 http://www.wescottdesign.com
In Praise of Dimensional Analysis
Started by ●April 24, 2007
Reply by ●April 24, 20072007-04-24
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!"
Reply by ●April 24, 20072007-04-24
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
Reply by ●April 24, 20072007-04-24
Reply by ●April 24, 20072007-04-24
Tim Wescott <tim@seemywebsite> writes:> [...]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..." %%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO http://home.earthlink.net/~yatescr
Reply by ●April 24, 20072007-04-24
On Tue, 24 Apr 2007 15:17:05 -0700, Tim Wescott <tim@seemywebsite> wrote:>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!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
Reply by ●April 24, 20072007-04-24
Tim Wescott wrote: ...> (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.Hear! hear! We need more of this. (T as the dimension of gain is absurd.)> 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.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.> 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).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. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●April 24, 20072007-04-24
John Larkin wrote:> On Tue, 24 Apr 2007 15:17:05 -0700, Tim Wescott <tim@seemywebsite> > wrote: > >> 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! > > 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 >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
Reply by ●April 25, 20072007-04-25
["Followup-To:" header set to sci.electronics.design.] John Larkin 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.Yes.> The integral is in volt-seconds.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
Reply by ●April 25, 20072007-04-25
Tim Wescott wrote:> 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! >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.






