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

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

Need advice plz how to manage the NaN in the condition

sm�ller-2
11-Garnet

Need advice plz how to manage the NaN in the condition

Hey,

community.

I could manage so far the loadcaseprogramming but i have a problem how to get rid with the "NaN" value.

At Page 8 of the mathcad file i need the smalest safety factor which i calculate out of the 5 Calculations.

BUT WITHOUT THE NAN VALUE. When i do a minimum it shows me always a 0 when NaN occurs anywhere,

How Can i write the condition with excluding a zero result?

I just want to see the minimum safety factor without the zero.

Is there a Possibility to comprimise my programmcode?

Best thx 😃

8 REPLIES 8

Can you guarantee that all the values Re.Ti, i=1,2,3,4,5 are positive (apart from the possibility of being NaN)?

Then a very easy solution is available (-> look for the negative max of the values -Re.Ti)

Otherwise a three-line routine could be used:

R

Hmm maybe i described little wrong:

its about the safety factors on Page 8

I need the smallest safety factor i calculate out of the 5.

When i do the negativ maximum im getting the highest value of the safety factor.

I need to look of the smallest safety factor excluding the NaN

im always getting the Zero as minimal value and not the smallest of the other one hmm 😞

Not sure where I had my head. The routine(s) I suggested were nonsene in more than one sense.

Here is a replacement for min working on 5 elements which seems to do what you need.

Hey, thx

I think i solved the problem now. Dont know what i did done wrong.

ONly one question where i would need your help.

I think i need the on error function applied on every loadcase row. BUt when i do on error i always get only a zero.

As to see on page 9 the first row can be calculated normal only on the second row ther eis the problem with the zero

HOw can i define the on error function that it should be applayied on every row?

See Page 9 on my File

I think its only a small addition

Best thx!

You are searching for the maximum of the second row of s.D. But as the whole row is consisting only of NaN's, what did you expect as answer?

No "onerror", whatever you may think of here, can help in this situation.

You have to trace back where those NaN's stem from which probably is a tedious task given the complexity of your sheet.

First step is to look at the calculation of s.D5, etc.

As you can see on the right side you are using for your calculation a lot of variables containing NaN meaning that something went wrong in a previous calculation.

You have to trace back to the roots of the problem. One single NaN in any calculation will give you an NaN as result.

WE

Yea thx for help!

I think i found the failure the problem is this:

I have 5 given process conditions and im calculating for all 5 conditions the thicknes

pd1 t1 pd2 t2

for this system conditions i have a excel makro where i calculate the Re1 to Re5

Now when i dont have 5 conditions. I have a empty cell in excel. After im reading it in mathcad i have this NaN.

So this is the reason where the NaNs are coming from.

But this is no problem. When im calculating the wallthickness im doing the max (p1-p5) so the NaNs are no problem because they are zero then.

And with the stack function i can filter the NaN from the irelevant conditions.

This problem occured in the second row. After i was looking in excel i didnt defined any numbers for the conditions.

So thats why mathcad had a problem because there was nothing to calculate. For this Loadcase.

Thx for help so far. My Routine is working now i need to get the final variables in Excel and continue the work.

Its all about what im writing in the ExcelInput file

logicaly....

Top Tags