zdas04
Mechanical
- Jun 25, 2002
- 10,274
I just had occssion to fix a problem that I've been having with a very complex empirical equation for several years.
Units are a problem in equations with fractional exponents, logs, trig functions so most of the time people just put in the numbers with confidence that the constants take care of unit conversions.
I had an equation that was expecting pressure in lbf/ft^2. I put this equation into my "notebook" MathCAD file (13 MB of useful relationships) several years ago and didn't document it very well. I use the equation a few times a year and for the last couple of years I've gotten answers that haven't made much sense. This morning I looked it up and found that it wanted psf not the psi that I was giving it.
I just went through my whole notebook and changed every entry in every empirical equation to require units. I did this by dividing each varible by the proper unit within the equation and then multiply the entire expression times the units that the empirical equation is supposed to return. I get the added benefit that I don't have to convert units offline anymore. If the equation wants pipe length in miles, I can define the "PipeLen" vairable in meters and the "PipeLen/mi" in the equation converts it.
This technique also makes the equations self documenting. For anyone who regularly uses empirical equations I would highly recommend it.
David
Units are a problem in equations with fractional exponents, logs, trig functions so most of the time people just put in the numbers with confidence that the constants take care of unit conversions.
I had an equation that was expecting pressure in lbf/ft^2. I put this equation into my "notebook" MathCAD file (13 MB of useful relationships) several years ago and didn't document it very well. I use the equation a few times a year and for the last couple of years I've gotten answers that haven't made much sense. This morning I looked it up and found that it wanted psf not the psi that I was giving it.
I just went through my whole notebook and changed every entry in every empirical equation to require units. I did this by dividing each varible by the proper unit within the equation and then multiply the entire expression times the units that the empirical equation is supposed to return. I get the added benefit that I don't have to convert units offline anymore. If the equation wants pipe length in miles, I can define the "PipeLen" vairable in meters and the "PipeLen/mi" in the equation converts it.
This technique also makes the equations self documenting. For anyone who regularly uses empirical equations I would highly recommend it.
David