Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello all,
I'm an undergradute EE student who is currently working for a small engineering consultant firm and I've been asked by my boss to create two MATHCAD programs to calculate and graph the ampacity of various conductors. Two variants because one is to be done in "english" units (imperial), and the other in SI units.
So far I've been working off the IEEE Std 738-2006 standard, and have began programming various equations into MATHCAD. While doing so I've come across a few errors that I can't seem to figure out, and I am currently looking for some help in correcting them.
Please see the figure attached for a image of what my program currently consists of. The errors in the blue boxes are solely a consequence of the error in the red box.(From what I can tell) What I can't figure out is why the error in the red box is happening, and how to correct it. For the error in the red box, MATHCAD is telling me the value of Vw must be a scalar. Why is that? How do I fix this?
NOTE: I am currently using MATHCAD 14
I've also attached my most up to date version of the program thus far.
I look forward to any advice/suggestions/comments you guys have.
Thanks again!
Look carefully at your definition of Qc2. You have defined Vw as a function of Ta there, when it should just be a scalar:
Alan
The errors in the blue boxes are solely a consequence of the error in the red box.(From what I can tell)
No. Calculations in Mathcad are top left to bottom right. All page boundaries are just to show how it would be printed, and have no effect on calculation order. So Qc is flagged red because at that point in the worksheet the function is undefined.
Two variants because one is to be done in "english" units (imperial), and the other in SI units.
In Mathcad that is not necessary. Mathcad can handle units. If the worksheet is written in the correct way you could have one sheet that will work with either imperial or metric units (or even a mixture!).
Hello Mr. Jackson,
Can you explain further on how I wouldn't need to create two variants of the program, since MATHCAD can handle all the changes in units?
In order to calculate the ampacity of a given conductor, my program requires that the user provide various information such as,
If I leave it up to the user to provide input in whichever units he pleases (for example, wind speed could have units of m/s [SI] or ft/s [English]) how can I get MATHCAD to treat things accordingly?
Also, there are other constants such as the Dynamic viscosity of air, Air density and Thermal conductivity of air that are calculated using different formulas depending on whether the units are English or SI.
I have not written any code for the SI program yet, but what I have posted above is my best crack at the English unit version. Is there a way that I can allow the user to input SI units and still obtain the approriate outputs?(Without having to write a second variant of the program of course)
If so, how?
Thank you very much for your time and comments.
Cheers!
In most cases, making Mathcad handle units is trivial. Temperature units are a little more tricky, but not that hard. To learn about how to do this go to "help", "tutorials", "getting started primers", "Using units", and "help", "tutorials", "features in depth", "temperature and user defined units". Once you have read them, add the appropriate units for all of your input variables. When you do that some of your expressions will turn red, because of unit errors. In particular, you have some empirical formulas (weird exponents like 0.52 can only occur in an empirical formula). Making empirical formulas handle units correctly is not covered in the help or tutorials, so the easiest thing to do at that point is post the new worksheet here and I'll show you how to do it.
Hello again Mr. Jackson,
First off, thank you very much for your help! I've read through some of the tutorials and the user defined units seem pretty straight forward, however I am still quite confused for the temperature units.
Also, you had requested that I add units into my program. Does this only need to be done for the input portion of the program? After all, the other equations are all generated based on those inputs, so I assumed the resulting equations would contain the appropriate units. Is this correct?
Attached is my updated program with units added to the inputs at the start of the program. For the all the temperatures I simply selected the Degree Celsius (function) unit. Also, my angles are in units of degrees, so when I use cos(phi), does MATHCAD understand that phi should be evaluated as if it were degrees and not radians?
Furthermore, my boss provided me with a very old scan of the program he previously had for doing these sorts of calculations. It is based on the IEEE std 738-1986, and I have attached its contents to this post for you to view so that you have a better idea of what I am trying to achieve. (Note: Some of the equations are slighty different in the 1986 standard compared to the 2006 standard I am using)
Thanks again for all the help! I look forward to your comments!
EDIT: After reading more indepth within the tutorials, it appears the units within the functions is going to be quite troublesome. According to the tutorial, it is not possible to define a function that returns units that depend on the value of the inputs.
How is this fixed then? It would be a nuisance if I had to enter the units everywhere in all of my formulas... At that point I'd have to ask myself if adding the units is worth all the trouble. Is this easier than it looks? Am I misunderstanding something?
EDIT: After reading more indepth within the tutorials, it appears the units within the functions is going to be quite troublesome. According to the tutorial, it is not possible to define a function that returns units that depend on the value of the inputs.
How is this fixed then? It would be a nuisance if I had to enter the units everywhere in all of my formulas... At that point I'd have to ask myself if adding the units is worth all the trouble. Is this easier than it looks? Am I misunderstanding something?
You misunderstand. Mathcad will calculate the units, and carry them through. What is not allowed is a function that returns units with different dimensions depending on the value of the input, for example a function that returns length if the input is less than three, and mass otherwise.
The unit handling can fail in empirical equations though, because, for example, you can't add 1 to a value with units. It does require some work to get around that, but it's worth it. If you get it right, you have a single worksheet that will take the input values in any units, and you can display the results in any units.
Hello again Mr. Jackson,
First off thank you for another very informative reply!
I opened up the new work sheet you've attached and I have some questions.
Within the file you write,
(SEE FIGURE ATTACHED)
I am having difficulties using the postfix operator and the inverse temperature function. Please be patient with me, I will describe to you how I am trying to recreate the result you've displayed in the worksheet.
First, I click the Postfix operator within the evaluation tool bar. This open two placeholders. In the leftmost placehold I type in my function just as you have. After this I move over the the rightmost placeholder and I cannot seem to obtain the inverse temperature function. How do you do this part?
I would go into the second placeholder and within the Calculator toolbar, I click inverse, and then click Insert, Units, and select degrees celsius but it always shows up underneath the function (Not beside it like yours above), and it has another empty placeholder beside it.
Here is what I get when I try to do it,
(SEE FIGURE ATTACHED)
What am I doing wrong?
Also, I am confused as to how you use the Tfilm function described in celsius for one equation, and somehow use it in another under K units.
**All I want to be able to achieve is for the user to be able to enter the inputs in whichever units they desire (i.e. either english or SI) and obtain all of the desired outputs in both english and SI units.**
If I do as you've instructed above (i.e. divide each variable by their respective units, use a postfix operator in conjunction with an inverse function, and multiply the expression by the desired units), and for example purposes assume I used an inverse celsius temperature function within all my postfix operators for all my equations. Now all of a sudden the user desires the temperature in kelvin. Do I have to go into all the postfix rightmost placeholders and change the inverse function from celsius temperature to kelvin? What happens if all of sudden of one the variable units is now in meters instead of feet? Do I have to go into all the equations and instead of dividing by ft, change it to m?
That would be alot of work if I have to change the equations each time I change the units.
I am sorry if you aren't seeing much progress out of me, but I promise you I am trying to make things work. Can you sort out my last couple of questions so it's straight in my head how things are going to work. After that, I'll sit down and try to edit and tweak the worksheet with the methods you've suggested, and post my results here.
Thank you very much for all your patience and effort, I truly appreciate it.
I would go into the second placeholder and within the Calculator toolbar, I click inverse, and then click Insert, Units, and select degrees celsius but it always shows up underneath the function (Not beside it like yours above), and it has another empty placeholder beside it.
Turn on the "Custom Characters" toolbar. The inverse function is on there.
If I do as you've instructed above (i.e. divide each variable by their respective units, use a postfix operator in conjunction with an inverse function, and multiply the expression by the desired units), and for example purposes assume I used an inverse celsius temperature function within all my postfix operators for all my equations. Now all of a sudden the user desires the temperature in kelvin. Do I have to go into all the postfix rightmost placeholders and change the inverse function from celsius temperature to kelvin? What happens if all of sudden of one the variable units is now in meters instead of feet? Do I have to go into all the equations and instead of dividing by ft, change it to m?
Divide the variables in the empirical equation by whatever units were supposed to be used with that equation, and multiply the entire equation by whatever the specified output units are for that equation. Then it will work with any input units, even a mixture of SI and imperial, and the result can be displayed in any output units. If you wish, you can even show two evaluations of the result side by side, one with SI units, and one with imperial units.
Hello again Mr. Jackson,
Attached is my next attempt at dividing out all the units within the previous program.
I stated all of the desired units, and eliminated some of the "+ 273" portions in certain equations since the temperatures were in Kelvin by default.
My first problem arises when I attempt to multiply by a desired unit of W/ft*degC for the thermal conductivity of air at temperature Tfilm.
I have a few other smaller questions regarding the units when using if statements, and for theta.
All of my questions I have placed in red text within the updated work sheet.
Can you spot any other mistakes within the worksheet?
Please take a look, hopefully we are close to getting this working!
Cheers!
See the attached worksheet.
Hello again Mr. Jackson,
Thank you very much for the informative worksheet! I recreated what you have done within my own worksheet and everything seems to be working great!
The last thing I am trying to is achieve is to show that my program yields the same plots (and thus the same results) as the ones found in the older copy of the program. (Again, see the pdf previously posted in this thread for the old program)
As you can see within the updated worksheet, I have generated plots of the 4 functions, AMB12 through AMB9. What I am currently confused about is which particular units the two axes are using, and how I can adjust them.
The range on the vertical axis in the old program was from -10 to 60, and had units of degrees celsius, while the horizontal axis ranged from 1 to 10 and had units of ft/sec.
How can I check the units of the two axes in my graph? How can I change them to match the old program?
Again, the new program based on the IEEE std 738-2006 uses wind velocity in units of ft/hr not ft/sec, can I easily change between the two in the graph? If so, how?
Thank you very much for all your help!
On your graph, divide "Vw" by "ft/sec". Then, on the vertical axis, divide each function by deg C. One way: select the first function and use the "Custom Character" tool bar, select /oC: inverse Celsius. Perform the same for each function.
Mathcad will update the axis range to fit the graphs of the functions.
If you want to look at it using different units (i.e. miles/hr for the horizontal axis) simply update the units (denominator) and mathcad will again update the graph.
I hope this helps.
Norm
See the attached. It doesn't exactly match the graph in the pdf, but neither does your math. I don't understand what the difference is between the two graphs in the pdf. I also can't see any difference between the two pages of calculations.
Whilst this is certainly the case for Mathcad 15, just wanted to point out that this is not an issue in Prime.
Richard and other super users you may be aware of this already.
So for the benefit of those who are not aware...
Thanks
It actually wasn't an issue in version 11 either. It only became a problem when Static Unit Checking, not so affectionally known as SUC, was introduced in version 12. It took until Prime to get rid of it again!
Talk about good timing. This blog entry was just posted today!
http://blogs.ptc.com/2012/12/20/the-trickiness-of-temperature-units/
Also, my angles are in units of degrees, so when I use cos(phi), does MATHCAD understand that phi should be evaluated as if it were degrees and not radians?
Unless you specify, Mathcad will assume radians.
I noticed that in the pdf there ia a 180/pi. That's a conversion from radians to degrees. If you are using units, including degrees, get rid of it. Mathcad does the conversion automatically.