Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming and Units.... 2

Status
Not open for further replies.

Qshake

Structural
Jul 12, 2000
2,672
All

I would appreciate any advice on how to solve the attached problem with units.

Before I tried to use units in this MathCAD sheet, I was able to evaluate the function, Vu(x) for the maximum and minimum as shown in the attached sheet. Now, having defined units for all the variables necessary to calculate Vu(x) I cannot get anything. The MathCAD sheet outlines the Vx:=Vu(x) as all red, meaning undefined.

I've tried a lot of things to no avail. I can see from the MathCAD website that units can be used in programming.

I appreciate any help.

Thanks,
Q

Regards,
Qshake
[pipe]
Eng-Tips Forums:Real Solutions for Real Problems Really Quick.
 
Replies continue below

Recommended for you

Probably ran into SUC, which sucks. SUC stands for static unit checking and is one of the worst new "features" of versions later than 11.2a.
 
Is it possible to post the actual worksheet, preferrably in M11 format?

On the face of it, the only thing I can see at all is that your indexed x is actually defined as 0ft..48.75ft2, since you have Ltot*ft in the definition of x.

TTFN

FAQ731-376
 
IRstuff - thanks for the clarification on the ft^2. I had been trying so many things that I've left a few ends open.

If I can back save to M11 I will repost tomorrow.

Thanks again.

Q

Regards,
Qshake
[pipe]
Eng-Tips Forums:Real Solutions for Real Problems Really Quick.
 
BTW, I also found out via examples on the MathCAD website that when using units with plots or graphs, the units will default to the base units. I didn't know that either beforehand. I just assumed if you had a variable in kips, it plotted in kips and not pounds.

And for my example, I see that there is an issue between pound-mass and pound-force. SO to read the correct values from the graphs I produced you have to divide Vu(x) by 32,200 to get an answer in kips.

I suppose somewhere in the beginning of my definitions for units I didn't distinguish between mass and force. But then I did try to rely on the MathCAD base units.....

I appreciate the tips.

Regards,
Qshake
[pipe]
Eng-Tips Forums:Real Solutions for Real Problems Really Quick.
 
The workaround of choice, if such a thing makes any sense, is to divide the quantities being graphed by the units desired, i.e., a force function divided by lbf. This effectively normalizes the display graph to the desired units, and avoids any transcription errors with conversion factors.

TTFN

FAQ731-376
 
Like IRSTUFF said, if you put TOTAL_FORCE/kcs in your y-axis (for example) you get the right magnitude line with the benefit of it being self-documenting.

David
 
You can't have units in a vector subscript. V[x, and M[x both require x to be unitless. You could divide by ft, or define x as unitless initially then multiply by ft where necessary.

Peter
 
pstuckey, et al -

I owe you all an update (perhaps just to help you or others in the future).

Where I defined the range, x:=0..Ltot, I now know that when using units you must use the format, x:= 0ft, 1.0ft..Ltot, where Ltot has units of feet. In this case, the 1.0ft is the increment of the step. Once I found that out, the Ltot was then defined, x was defined and condequently Vu(x) was defined.

Then came the matter of what pstuckey notes. I had to divide the subscript, x in Vx by ft in order for it to be unitless. Once completed the whole set up works just as it did.

Whew! I love the program but like many programs wish there were more clear error messages.

Thanks to all for your help and directions.

Q



Regards,
Qshake
[pipe]
Eng-Tips Forums:Real Solutions for Real Problems Really Quick.
 
I think it is clearer to first define a range variable, like n:=0..N-1, where N is the number of elements.
Then define the vector x[n:=n*ft
 
Does your series of "if"'s require an "otherwise" at the end? I don't see one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor