You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running RP.SETFLUIDSdll and RP.REFPROPdll I occasionally receive a -101 error. I resolved repeating the query for that case alone, which solves the issue (I have never received -101 twice in a row).
I am unsure about the reason for the error. At any rate it should not fail once and then work, in my opinion. Details below.
Workaround for RP.SETFLUIDSdll:
importosfromctREFPROP.ctREFPROPimportREFPROPFunctionLibrary,get_default_DLL_extension,REFPROPInstanceRP_PATH=os.path.join(os.path.dirname(__file__), '..','resources','REFPROP')
extension=get_default_DLL_extension()
RP=REFPROPFunctionLibrary(RP_PATH,extension)
RP.SETPATHdll(RP_PATH)
loaded_fluids=[]
defcheck_fluid(fluid:str):
fluid=fluid.upper()
globalloaded_fluidsiffluidisNone:
raiseValueError('❌ No fluid specified')
iffluidnotinloaded_fluids:
# check if fluid is knownierr=RP.SETFLUIDSdll(fluid.upper())
ifierr!=0:
ifierr==-101: # try again. For some reason trying twice does the trickierr=RP.SETFLUIDSdll(fluid.upper())
ifierr!=0:
# throw errorerrmsg=RP.ERRMSGdll(ierr)
raiseValueError(f'❌ Fluid {fluid} not found in REFPROP FLD files. Error code: {ierr}: {errmsg}')
else:
loaded_fluids.append(fluid)
print(f'✅ Fluid {fluid} loaded in REFPROP')
returnTrueelse:
returnTrue
Description
When running RP.SETFLUIDSdll and RP.REFPROPdll I occasionally receive a -101 error. I resolved repeating the query for that case alone, which solves the issue (I have never received -101 twice in a row).
I am unsure about the reason for the error. At any rate it should not fail once and then work, in my opinion. Details below.
Workaround for RP.SETFLUIDSdll:
Workaround for RP.REFPROPdll:
Steps to Reproduce
Use the functions defined above
Expected behavior: ierr = 0 first try
Actual behavior: ierr = 101 --> ierr = 0
Versions
REFPROP Version: 10.0
Operating System and Version: Windows 10.022631 and Linux
Access Method: Python
Additional Information
The text was updated successfully, but these errors were encountered: