Skip to main content
8-Gravel
March 29, 2022
Solved

Units conversion to SI

  • March 29, 2022
  • 2 replies
  • 3219 views

After embedding excel component within worksheet when an input is provided the excel convert it to SI system if the unit system is set to USCS any suggestions? 

 

 

 

Best answer by Werner_E

Internally Prime stores the values in SI units, regardless of the unit system chosen.

When the data is transferred to Excel (which does not support units), this unit is simply omitted.

To send the data you intend to Excel you simply have to get rid of the unit yourself by dividing by the correct unit.

The same is done in reverse when you transfer data calculated by Excel back to Mathcad - you multiply with the appropriate unit.

Werner_E_0-1648584621206.png

 

 

 

2 replies

Werner_E25-Diamond IAnswer
25-Diamond I
March 29, 2022

Internally Prime stores the values in SI units, regardless of the unit system chosen.

When the data is transferred to Excel (which does not support units), this unit is simply omitted.

To send the data you intend to Excel you simply have to get rid of the unit yourself by dividing by the correct unit.

The same is done in reverse when you transfer data calculated by Excel back to Mathcad - you multiply with the appropriate unit.

Werner_E_0-1648584621206.png

 

 

 

SPaulis
14-Alexandrite
July 8, 2022

Hi @JB_10220769,

 

Try this little program:

SPauliszyn_1-1657304544301.png

 

If you use ORIGIN=0 (the default), change "2" to a "1" and the index on the bottom outside of the big parenthesis from a "1" to a "0".

 

For any units that you commonly use in your input tables, US and SI, enter them as strings in the first column as you might enter them in a cell in Excel.  The second column in the matrix is the unit as Mathcad understands it.

 

Now when you try to use a string that is recognized in your list, the unit will be properly added to your value.  If the unit label is not recognized, it will simply return the value.  

 

So when I have a HUGE Excel data table like this:

 

SPauliszyn_5-1657305259373.png

 

 

I add the unit labels to a row in the data table (row 2 in this example).  Then when I import the data, I run a simple program that will go row by row and column by column, attempting to convert the values to 'unit values' by using the unit in the units row (row 2 in this case).  I would get something like this:

 

SPauliszyn_3-1657305086271.png

So once all the values have units, it doesn't matter if I do a calculation for a Canadian or US project, Mathcad handles all the conversions (after this point) beautifully.

 

Hope this might help you

 

 

 

 

"It's OK to fall in love with your heart, but you design with your head." Omer W. Blodgett
23-Emerald IV
July 8, 2022

"If you use ORIGIN=0 (the default), change "2" to a "1" and the index on the bottom outside of the big parenthesis from a "1" to a "0".":

 

I'd suggest to change "2" to "ORIGIN+1" and the index from "1" to "ORIGIN".

Then the function should work as intended for any value of ORIGIN. Note that while ORIGIN is generally chosen as either 0 or 1, it can be set to other values, like -1, or 17.

 

Success!
Luc

SPaulis
14-Alexandrite
July 8, 2022

Good suggestion @LucMeekes .  Since I keep these functions in separate included sheets, I can make this more versatile for anyone in my company using this.

 

I never thought of using ORIGIN as a simple variable (I have for TOL).  Thanks for the nudge one step further.  😁

"It's OK to fall in love with your heart, but you design with your head." Omer W. Blodgett