cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Beginner Programming Doubt

ejanssen
1-Visitor

Beginner Programming Doubt

Hi !,

I trying to learn the programming methods at mathcad, for that I'm triyng to make a loop to classificate a Pressure Vessel according to the fluid,Pressure, Volume. But i cant get it, if any one could help me with that.

2015-10-30_10-41-13.png

ACCEPTED SOLUTION

Accepted Solutions

I think he correctly handled that by defining "l" which removes the units from L.

The problem I think was the use of "while" in the second program.  It should really be another "if" statement.  See attached.

Alternatively, I would recommend the use of a matrix "lookup" function.  I think that might provide a more concise solution.

View solution in original post

13 REPLIES 13

How about the attached?

You were comparing L which had the units of energy to the values in your program.

Mike

I think he correctly handled that by defining "l" which removes the units from L.

The problem I think was the use of "while" in the second program.  It should really be another "if" statement.  See attached.

Alternatively, I would recommend the use of a matrix "lookup" function.  I think that might provide a more concise solution.

ejanssen
1-Visitor
(To:MJG)

Mark, that was exactly what i need, thanks for your quick help !

MJG
18-Opal
18-Opal
(To:MJG)

Also, consider multiplying the limits of L by the intended unit.  This will allow you to define L in any units, and Mathcad will do the proper conversion while classifying your fluid.

MikeArmstrong
12-Amethyst
(To:MJG)

Mark Gase wrote:

Also, consider multiplying the limits of L by the intended unit.  This will allow you to define L in any units, and Mathcad will do the proper conversion while classifying your fluid.

This would have been my way of setting it up.

ejanssen
1-Visitor
(To:MJG)

Can you show me an example of this oder way to do it ? It is always good to know more than one method.

MJG
18-Opal
18-Opal
(To:ejanssen)

Here is what I meant by my comment on the units.

You'd want to set up the second program similarly.

Regarding my comment about setting this up as a matrix lookup function - I'd have to play with it since I don't typically do those.  Not sure I have the time right now.

MJG
18-Opal
18-Opal
(To:MJG)

Curiosity got the better of me.  Here is how to approach this with a vlookup function.

Hi Mike,

Thanks for the quick reply, in your example the "Grupo" is not the correct it shoud show "Grupo 5" for a L<1.

Also i want to classificate the Category, that is a function of the Grupo and the Fluid ( A or C)test.png

That's because I divided L by kN*m. It works if you divide L by MPa*m^3.

Mike

StuartBruff
23-Emerald III
(To:ejanssen)

Emilio Janssen wrote:

Hi !,

I trying to learn the programming methods at mathcad, for that I'm triyng to make a loop to classificate a Pressure Vessel according to the fluid,Pressure, Volume. But i cant get it, if any one could help me with that.

2015-10-30_10-41-13.png

Noting that you had made the argument to Grupo dimensionless, does the attached do the kind of thing you want?

Stuart

StuartBruff
23-Emerald III
(To:StuartBruff)

StuartBruff wrote:

Emilio Janssen wrote:

Hi !,

I trying to learn the programming methods at mathcad, for that I'm triyng to make a loop to classificate a Pressure Vessel according to the fluid,Pressure, Volume. But i cant get it, if any one could help me with that.

2015-10-30_10-41-13.png

Noting that you had made the argument to Grupo dimensionless, does the attached do the kind of thing you want?

I had a few spare minutes, so I tidied the worksheet up a bit and handled L with units:

Stuart

Thanks Stuart, very usefull those examples and methods !!

Announcements

Top Tags