Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

What am I missing

AK_12735104
7-Bedrock

What am I missing

I have a code that is looking through the matrix and selects creepage based on my input parameters (PD, MG and working voltage WV). It works great....in picture 1.

 

picture 1picture 1

 

Now, I want to add a linear interpolation between 2 values of the voltage. I made a variable "a" doing linear interpolation and tested it works as expected, which it do. Column variable for searching in matrix is hardcoded at the beginning for test.

picture2.png

 

Now, since it work, code A (linear interpolation of the creepage) replace code B (that is using only search method w/o interpolation) in the original code.

picture3.png

 

That is the only change in original code. Code A is tested it works, gives values I need but after A replaces B function that is calling creepage(WV,PD,MG) is complaining "These units are not compatible". What am I missing? I dont see any problem there.

 

thanks

 

Running on Mathcad Prime 11.0.1.0

ACCEPTED SOLUTION

Accepted Solutions

Thank you Wener,

I removed volts from the function and noticed I already strip WV of the units in parameters passed to the function when I call it. That fixed the problem.

View solution in original post

2 REPLIES 2
Werner_E
25-Diamond I
(To:AK_12735104)

Its hard to debug just a picture. So if possible you should post the sheet itself or at least create a sheet using dummy data which shows the same undesired effect.

 

In your last picture the code to the left looks like vector WV has unit Volt, but the elements in matrix creepage.IEC are dimensionless.

But in the code to the right it looks like both  WV as well as creepage.IEC have the same units, possible both are dimensionless. So just replacing Code B by Code A must fail because of the division of WV by unit Volt in Code A.

 

BTW, is there any reason you code the linear interpolation yourself and don't use Prime's "linterp" function?

Thank you Wener,

I removed volts from the function and noticed I already strip WV of the units in parameters passed to the function when I call it. That fixed the problem.

Announcements


Top Tags