Unfortunately, python wrapper cannot be used in ironpython environment (or at least I didn’t success to do so). So I had to find another way to use it directly in Revit. I used shared library (.dll) which can be downloaded on sourceforge : http://sourceforge.net/projects/coolprop/files/CoolProp/5.1.1/shared_library/Windows/64bit/.
It was a little tricky for a non professional programmer like me to understand how to call this CoolProp.dll properly. ctypes tutorial describe how to do it with standard python library. CoolProp documentation says that CoolProp support stdcall and cdecl call which means that you are supposed to be able to use cdll and windll. I tried and failed with windll then I found a post on stackoverflow that describe the same process i used but with cdll. I still don’t understand why windll didn’t work but at least I can use CoolProp in an IronPython environment.
import ctypes
#Load CoolProp shared library
CP = ctypes.cdll.LoadLibrary("/PathTo/CoolProp.dll")
#making PropsSI function call shorter
PropsSI = CP.PropsSI
#Convert python data type entered in PropsSI function call to expected argtypes for PropsSI function in the .dll
PropsSI.argtypes = (ctypes.c_char_p, ctypes.c_char_p, ctypes.c_double, ctypes.c_char_p, ctypes.c_double, ctypes.c_char_p)
#Convert returned value from .dll to desired data type which is a float in python
PropsSI.restype = ctypes.c_double
#You can then call PropsSI function as in previous article
print PropsSI('C','T',275.15,'P',101325,'INCOMP::Water')
For more info about data types check here
Next article will talk about how to add fluids in Revit using CoolProp power !