usnistgov / REFPROP-wrappers

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

There is a problem with python calling ctREFPROP #537

Closed funzeng closed 1 year ago

funzeng commented 1 year ago

Description

1. When I import the ctREFPROP package in python, I get an error when I run the following code:

import os, sys import ctREFPROP.ctREFPROP as ct r = ct.REFPROPFunctionLibrary(os.environ['RPPREFIX'],'dll')

r.SETPATHdll(os.environ['RPPREFIX']) z = [1] T = 200 # K p = 101.325 # kPa r.SETUPdll(1, 'NITROGEN.FLD', 'HMX.BNC', 'DEF') r.SETREFdll("DEF",1,z,0,0,0,0) D, Dl, Dv, x, y, q, e, h, s, Cv, Cp, w, ierr, herr = r.TPFLSHdll(T,p,z) eta, tcx, ierr, herr = r.TRNPRPdll(T,D,x) wm = r.WMOLdll(z) image Error message:KeyError:‘RPPREFIX’

The process shows that there is a problem in this piece of code:

r = ct.REFPROPFunctionLibrary(os.environ['RPPREFIX'],'dll')

2. Someone told me it might be an issue with the environment variable setting,So I changed the above piece of code to: r = ct.REFPROPFunctionLibrary('C:\Program Files (x86)\REFPROP\REFPRP64.DLL', 'dll') But I don't have this file:'C:\Program Files (x86)\REFPROP\REFPRP64.DLL'

3. So I went looking for where this dll file might exist. It seems that this file is in the refprop package, but I imported the dll file path in Python and found that it didn't work.

Versions

REFPROP Version: 10.2 Operating System and Version: Win11 Access Method: Python

ianhbell commented 1 year ago

You need to purchase and install REFPROP. Only then can you use ctREFPROP.

funzeng commented 1 year ago

Got it, thanks!