Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

error: value has units but unitless

Status
Not open for further replies.

mohammed43

Civil/Environmental
May 5, 2012
49
I strated learning MATHCAD few days back and started first design worksheet as attached. But i couldnt resolve the error: This value has units:Unitless, but must have units:pressure..
Iam getting the abov eerror in the program. can someone help me to resolve the error..

Thanks
 
Replies continue below

Recommended for you

It was there earlier

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
btw. A cheap fix would be to define kl.r outside of the programming loop.

alternately, the whole thing can be written as a compound If statement.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
Thanks!!
If I want to use compound if statement(conditional branching), how can I assign KLr (calculate max kl/r in the if statement)

Thanks once again for the help..
 
Why? It does not affect the if statement in any way.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
I think the most natural way to fix the problem is to use "otherwise" statements.

In Mathcad a program is only allowed to return values of equal dimensions for all cases. E.g. you can't write a function which returns a length, if the argument is 1 and an area if the argument is 2. The way you have written your routine it may happen, that the line which assigns klr is the last line evaluated and so klr would be returned. klr is unitless and the other possible return values are of dimension pressure and that doesn't work. Using otherwise statements makes it clear to Mathcad that all cases are covered and klr will never be a return value. Its also good habit to use explicit return statements.

See the attached file for a few ways to handle the situation, also covering your question about the assignment of klr in case of the nested if functions, but I in no way would recommend using that confusing display.
 
 http://files.engineering.com/getfile.aspx?folder=3799c817-85f8-4a2e-b237-982bf568ae00&file=Tubular_member_b.xmcdz
Thanks for your help..
I really liked the way you explained different case scenarios...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor