Skip to main content
7-Bedrock
February 24, 2026
Solved

What am I missing

  • February 24, 2026
  • 1 reply
  • 100 views

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

Best answer by AK_12735104

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.

1 reply

25-Diamond I
February 24, 2026

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?

AK_127351047-BedrockAuthorAnswer
7-Bedrock
February 24, 2026

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.