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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Need Help writing a formula/equation to find a number in chart

ptc-4605612
1-Newbie

Need Help writing a formula/equation to find a number in chart

I do not know if this is where I ask this/post this because I am new, however I have an excel chart in my Mathcad 15 equation sheet (I will convert it to a Mathcad table in alittle) and I want to create a for/while loop (or whatever) that can find an insulation type regarding a number that a previous equation spits out.

i.e.

Th = #

I want to then take this number and compare it to a chart that have insulation constants and have it spit out what insulation type is needed for the certain numbers.

Thank you, if you need more information I will glady supply it if needed.

23 REPLIES 23

Kevin Price wrote:

I do not know if this is where I ask this/post this because I am new, however I have an excel chart in my Mathcad 15 equation sheet (I will convert it to a Mathcad table in alittle) and I want to create a for/while loop (or whatever) that can find an insulation type regarding a number that a previous equation spits out.

i.e.

Th = #

I want to then take this number and compare it to a chart that have insulation constants and have it spit out what insulation type is needed for the certain numbers.

Thank you, if you need more information I will glady supply it if needed.

Unfortunately, I can't see your Excel image for some reason. However, from the sound of it, you might want to use one or two of Mathcad's lookup functions: hlookup, vlookup, lookup and match.

Stuart

Temperature Tolerance ClassMaximum Operation Temperature AllowedAllowable Temperature Rise at Full Load 1.0 Service Factor MotorAllowable Temperature Rise 1.15 Service Factor Motor
°C°F°C°C
A1052216070
B1302668090
F155311105115
H180356125135

Here is my table that I am trying to grab values from.

StuartBruff if the values are not exactly like the values in the table like the temperature is 114.5 celsius however it fits for insulation A how would I do that.

Kevin Price wrote:

StuartBruff if the values are not exactly like the values in the table like the temperature is 114.5 celsius however it fits for insulation A how would I do that.

Hi Kevin,

I think you might want something like the attached. I've written a short function to basically hunt through the temperature column to find the 'correct' lower band limit and then return the Tolerance Class.

Stuart

I used the str2arr function however its saying its not defined even though I put the data in the string before?

MikeArmstrong
5-Regular Member
(To:StuartBruff)

Nice example Stuart.

Mike

Thank you for the very good formula sheets, however I can only follow it until a point and your skill level is way above mine in Mathcad, therefore I am trying to find a simplier way of doing this and be able to explain to people how I got it.

Thank you

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

Kevin Price wrote:

Thank you for the very good formula sheets, however I can only follow it until a point and your skill level is way above mine in Mathcad, therefore I am trying to find a simplier way of doing this and be able to explain to people how I got it.

Thank you

Stuart's example seems a little complicated because he has manipulated the data and actually shown you how to handle strings. Even if you don't understand Stuart's work, I would suggest you keep it for reference because it massively helped me over the years.

Mike

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

Kevin how about interpolating between the values in the table?

Mike

Didn't even think about that, do you have an example you can show me? In the mean time I will attempt that myself

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

I will write something for you now. Just for curiosity. If the temperature the driving parameter? Also what data do you want extracting?

Mike

The driving parameter is temperature. I have written an equation sheet to finding temperature for insulation for an AC motor. The chart I have attached to the document is the wrong one, the write chart Im having my temperatures being compared to is shown below:

Insulation Class1.0 Service Factor1.15 Service Factor
Class A105115
Class B130140
Class F155165
Class H180190

I am having the temperature found spit out what insulation is needed by finding that temperature

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

Very, very simple example attached. I haven't interpolated through the results because it won't work with the strings in the table.

Mike

I did manipulated your equation to work with my Tabs number however I am trying to have numbers that are not extactly the values listed in the table, as in 327.5 K best for Insulation H however when I did that it said no match because its not an exact value from the table.

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

That's not an issue if its greater or less than the extreme values, but do what happens if it falls in between?

Mike

I am confused by your wording in your question, can you try to reword it? I have a value that is greater than all of the values at 327 K and its saying no match so I was trying to see if there is a way I can fix that to just accept the highest insulation type which would be H

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

Have a look at the attached. I have set the upper and lower limits as you requested, but it still doesn't select a result is the temp falls in between a value.

Mike

Thanks I will try to work it to give me the insulation type with any temperature value. I am trying to work it so that if its less than the higher value then its the lower insulation class

MikeArmstrong
5-Regular Member
(To:ptc-4605612)

That can be done too, but will require a little more work. I'll have a look tomorrow if you don't have an answer by then.

Mike

Kevin Price wrote:

Thanks I will try to work it to give me the insulation type with any temperature value. I am trying to work it so that if its less than the higher value then its the lower insulation class

That's what my posted worksheet does.

The mfloor(z,v) function returns the index of the row of the element of vector v that is less than or equal to z. This is a quite a general purpose utility function.

The second function tolclass(temp) is tailored to your data set and returns the insulation class that is applicable to temperature temp.

From the point of view of answering your question, you can reasonably ignore the part before the definition of mfloor; this first part is only there to save me the effort of typing the table in by hand. I've rejigged the worksheet slightly to show which bits you can ignore and I've modified the function str2mat to be in the Variable Style, which means it's easier to use.

As an aside, the functions str2arr and str2mat are not built-in functions, they are defined in the collapsed Area called "Utilities" (just double-click on the Area to open it or close it again)

Stuart

Thank you and how can I hide the programming like you did so its not all cluttered in my equation sheet?

I know there is an easier way via the table I have however I can not figure it out to save my life right now. please a Mathcad wizard, I am in need of help haha

Thank you everyone for your help, here is my final calculation sheet that I used and derived your formulas to fit my need. If you have any questions or concerns please feel free to comment.

I can't express the how much help all of you gave

Calcs.png

Top Tags