usnistgov / REFPROP-wrappers

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

Matlab fails to solve #525

Closed Alhabeeb86 closed 6 months ago

Alhabeeb86 commented 1 year ago

Hi, In my case: 1- Matlab + refprop version 9.1 works perfectly with mixtures (e.g. R455A) but fails with pure substances (e.g. R134a , R1234yf or R1234ze) 2- Matlab + refprop version 10 works perfectly with pure substances but fails with mixtures

The failure message is
Error using refpropm (line 464) [SHFLSH error 248] single-phase iteration did not converge, T, deltaT = 0.18222E+12 0.45896E-01 K.

I think because I use linking files that corresponding to version 9.1 refpropm.m REFPRP64.dll refprop.h REFPRP64_thunk_pcwin64.dll rp_proto64.m

Thanks

ianhbell commented 1 year ago

HS are the most challenging inputs; neither H nor S are independent variables of the EOS. You need to provide more information, impossible to debug given the provided description.

Alhabeeb86 commented 1 year ago

I want to calculate pressure (P4) depending on HS, and unfortunately I don't have another option.

P4=refpropm('P','H',h4_is1000,'S',s4_is1000,fluid); % ejector outlet pressure (kPa)

ianhbell commented 1 year ago

First: refpropm is deprecated and no longer supported. You need to switch to the python interface which is more full-featured. Not related to this problem though.

You can workaround this problem by doing the iterative calculation yourself, iterating on pressure and quality to get the right enthalpy and entropy. That's the only thing I can recommend at this point.

Alhabeeb86 commented 1 year ago

You mean to use Python instead of Matlab?

ianhbell commented 1 year ago

Yes, that is a good option, but more generally, to call Python from MATLAB: https://github.com/usnistgov/REFPROP-wrappers/tree/master/wrappers/MATLAB

Alhabeeb86 commented 1 year ago

" but more generally, to call Python from MATLAB" This mean I can use Matlab but use Python interface?

ianhbell commented 1 year ago

Yes, please see the page i linked.

Alhabeeb86 commented 1 year ago

OK Thanks

Also, I would like to let you know that deleting REFPROP and install it again solves the problem.