usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
192 stars 127 forks source link

Unit in MATLAB #226

Closed RaySA19 closed 4 years ago

RaySA19 commented 5 years ago

Description

I am using REFPROP ( Python) version 10.0 and using MATLAB to find enthaply and other thermophysical properties of the mixed refrigerant I define . I have windows on my PC by the way. What I am trying to see if possible to do is to assign all the units of measure for all the inputs and outputs in MATLAB instead of typing ENGLISH or SI or MOLE SI. I keep running to these units issues and making the assumption when I type English or SI , MATLAB is using set of pre-chosen units based on what listed on REFPROP user guide. But I keep finding errors in my output properties when I run the mTALAB code. The reason I know know those outputs found by MATLAB are false is because when I simply use the REFPROP to find a specific property and select the proper units, I find a huge discrepancy between the values found by MATLAB and the ones I manually do it on REFPROP. I want to see if there is an example you can share how to type the unit of measure for each property in MATLAB code.

Let me know if you need copy of my MATLAB code.

Thanks,

Ray

ianhbell commented 5 years ago

One way, perhaps not the only one, to do what you want, is to call the REFPROPdll function for your specified output property in your specified unit system, and the hUnits string will contain the units of the first (and only first) output parameter. It is a consistently defined string for the units of the variable.

Personally, my solution is much simpler. I only use the MOLAR BASE SI units system (MASS BASE SI would also be fine), for which the units are unambiguous and there are never any unit conversions. I have learned through years of painful experience and error that any other unit system is only bound to cause problems, some more subtle than others.