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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How can I find maximize value?

jlee-2
1-Newbie

How can I find maximize value?

33.PNG

I want to find max value about omega when v is variable.

I make solve block and I retrict each range.

But I can't get omega max with variable v.

In other words, I want to find max location about curves.

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:jlee-2)

jinsuk Lee wrote:

thank you for information

You can do as shown below, but I would suggest that you make your function P() more stable as it will fail for certain values. At least put a try command around it and replace values where it fails by NaNs.

I used a vector with just 24 values for Omega as calculation time for any valy of P is quite long. That way the accuracy is just 0.5 rpm. For an accuracy of two decimals you would need more than thousend values in Omega and I bet it will take much longer than using maximize (which still yields a more accurate result).

1.png

View solution in original post

19 REPLIES 19

Send please the Mathcad-sheet

I am sorry. l am late

I attached my file.

RichardJ
19-Tanzanite
(To:jlee-2)

There is another spreadsheet of data required: NREL-5MW data.xlsx.

this is not necessary when you open my file.

Do you have a problem when you open my file?

RichardJ
19-Tanzanite
(To:jlee-2)

If it's not necessary how do you think I got the name of the spreadsheet?

excel.png

ah this data is reference data. so although it isn't exist, it doesn't give a problem.

just need "nrel-aero-data

Werner_E
24-Ruby V
(To:jlee-2)

In my opinion your sheet is an impertinence.

I guess that few people would be willing to wait "endless" until your sheet finishes its calculations and then wade through 21 rather confusing pages just to answer your question. At least I won't.

I guess you could address a wider audience if you streamline your sheet significantly. Delete ALL variable and function definitions, calculations, evaluations, plots, etc. which do not relate to the functions your question applies to and try to stay within the page margins as people with a small monitor won't like to scroll left-right just to find some "hidden" definitions. Your sheet sure could be compressed significantly way and will evaluate much faster.

Delete ALL variable and function definitions, calculations, evaluations, plots, etc

If I delete these, I can't get my result values?

I don't understand

Werner_E
24-Ruby V
(To:jlee-2)

You want a question answered.

So you can delete ALL regions which do not relate, which are not needed. Just leave the definitions necessary for the functions which your question is about. You should know what to delete and what to let remain as you wrote that sheet and should know the dependencies.

To make it clear: I wasn't suggesting this as a solution to your problem. I just recommend to set up s special sheet just for your special question and leave away all which is not specifically needed.

Its just a suggestion of mine, because, as you want to get an answer, IMHO you should make it as convenient to potential question answeres as you can. But of course you also can hope for someone who has much spare time, patience and longaminity and is willing to spend it on examining your sheet.

okay I understand

jlee-2
1-Newbie
(To:jlee-2)

I delete unnecessary files to clean my file according to Werner opinion and then I attached my file again

Werner_E
24-Ruby V
(To:jlee-2)

Sorry, can't help. Doubt that all stuff is really needed. Still too large and far to slow - but probably thats just me.

that's okay.

Anyway, I wonder how to reduce calculating time in my work.

I don't know how I can reduce althogh you said to me to reduce calculating before.

Werner_E
24-Ruby V
(To:jlee-2)

jinsuk Lee wrote:

that's okay.

Anyway, I wonder how to reduce calculating time in my work.

That would need a quite good understanding of whats happening in your sheet and what should be calculated.

You have a lot of solve blocks which are called very (too) often and maybe even are nested (one block may call the other - haven't looked that close, though.

You redefine quite a lot of functions in your sheet, using the same name and so overwriting the previous function. Not sure if this is as it should be. For instance CD and CL are defined twice in a very similar way. You should know why but I am confused, especially as later calculation (which are vital for the function P()) use both the old (via function chd()) and the new (via function ct() and others) definition. Hard to image that that should be as you intend.

So I guess that unless you redesign the whole sheet from scratch it would be hard to speed it up or maybe correct it.

Unless you consider a complete redesign you may just implement slight improvements. For instance you can cut the calculation time for the numeric integration (functon MO()) approximately in half when you precalculate the values of m() as each is calculated twice now.

1.png

No quantum leap, but constant dripping wears away the rock.


Concerning your original question I wonder why you don't do in the solve block the very same which you did above? Simply replace 3 m/s by v and it should work. Or are you searching something else?

2.png

BTW, the pic is a fake as I wasn't willing to wait for the calculations to finish, but I am pretty sure that it should work OK that way if you dare to wait until calculation ends.

Thank you to inform.

I used "maximize". but it delay a lot time. so I wonder it is possible to replace "maximize" to "max"

Is it possible?

Werner_E
24-Ruby V
(To:jlee-2)

Thats sure possible but you will lose precision. "max" will work on a vector, not a function. So you first would create a vector consisting of Omega values - the more, the slower. Then evaluate P() using that vector as argument (you may have to vectorize to be on the safe side) and let max chose the maximum of the resulting vector.

But calculation of P() takes a lot of time and if if you use too few values for Omega, you may end up with a very inaccurate result.

thank you for information

Werner_E
24-Ruby V
(To:jlee-2)

jinsuk Lee wrote:

thank you for information

You can do as shown below, but I would suggest that you make your function P() more stable as it will fail for certain values. At least put a try command around it and replace values where it fails by NaNs.

I used a vector with just 24 values for Omega as calculation time for any valy of P is quite long. That way the accuracy is just 0.5 rpm. For an accuracy of two decimals you would need more than thousend values in Omega and I bet it will take much longer than using maximize (which still yields a more accurate result).

1.png

thank you very much.

I can improve my skill about mathcad for you.

thank you for helping

Top Tags