usnistgov / REFPROP-wrappers

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

Excel linking on M3 Pro macbook #624

Closed dtgerhardt closed 1 month ago

dtgerhardt commented 1 month ago

Description

Excel value error in refprop wrapper

Steps to Reproduce

  1. built refprop 10 using the following cmake flags: cmake .. -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE:FILEPATH=/opt/homebrew/bin/python3 -DCMAKE_FORTRAN_COMPILER=/opt/homebrew/bin/gfortran
  2. (build completed with no errors)
  3. Confirmed that the resultant librefprop.dylib works well via the python wrapper
  4. Followed all steps of https://github.com/usnistgov/REFPROP-wrappers/tree/master/wrappers/Excel#for-osx-with-office-365

Updated extract of the "Refprop10Code" module within REFPROP.XLA is shown below:

'OLD:
#If VBA7 And Win64 Then  
  Private Declare PtrSafe Sub REFPROPdll Lib "REFPRP64.DLL" (ByVal hFld As String, ByVal hIn As String, ByVal hOut As String, iUnitNumb As Long, iMass As Long, iFlag As Long, a As Double, b As Double, zm As Double, Output As Double, ByVal hUnits As String, iUnits As Long, x As Double, y As Double, x3 As Double, q As Double, ierr As Long, ByVal herr As String, ln1 As Long, ln2 As Long, ln3 As Long, ln4 As Long, ln5 As Long)
#Else  
  Private Declare Sub REFPROPdll Lib "REFPROP.DLL" (ByVal hFld As String, ByVal hIn As String, ByVal hOut As String, iUnitNumb As Long, iMass As Long, iFlag As Long, a As Double, b As Double, zm As Double, Output As Double, ByVal hUnits As String, iUnits As Long, x As Double, y As Double, x3 As Double, q As Double, ierr As Long, ByVal herr As String, ln1 As Long, ln2 As Long, ln3 As Long, ln4 As Long, ln5 As Long)
#End If

'NEW:
Private Declare PtrSafe Sub REFPROPdll Lib "/Users/davidgerhardt/Library/Group Containers/UBF8T346G9.Office/refprop/librefprop.dylib" (ByVal hFld As String, ByVal hIn As String, ByVal hOut As String, iUnitNumb As Long, iMass As Long, iFlag As Long, a As Double, b As Double, zm As Double, Output As Double, ByVal hUnits As String, iUnits As Long, x As Double, y As Double, x3 As Double, q As Double, ierr As Long, ByVal herr As String, ln1 As Long, ln2 As Long, ln3 As Long, ln4 As Long, ln5 As Long)
'Set the path to the fluid files.
'Comment out the following line to not use the directory in the RPPrefix environmental variable:
  hFld = Trim(Environ("RPPrefix")): If Right(hFld, 1) = "/" Then hFld = Left(hFld, Len(hFld) - 1)
'Any path can be set with the following line:
  hFld = "/Users/davidgerhardt/Library/Group Containers/UBF8T346G9.Office/refprop/"
  If hFld <> "" Then hIn = "PATH": Call REFPROPdll(hFld, hIn, hOut, 0&, 0&, 0&, 0#, 0#, z(1), Output(1), hUnits, iUnits, x(1), y(1), x3(1), q, ierr, herr, 10000&, 255&, 255&, 255&, 255&)

Expected behavior:

Actual behavior:

Versions

REFPROP Version: 10.0 Operating System and Version: Apple M3 Pro Sequoia 15.0.1 Access Method: Excel

Additional Information

I'm convinced the issue is in my REFPROP.XLA setup, but I cannot for the life of me find out where.

ianhbell commented 1 month ago

I would just stick with python. It is in theory possible to hook up to Excel on macs, but it seems to result only in heartburn.

dtgerhardt commented 1 month ago

OK, time to startup Parallels then.

ianhbell commented 1 month ago

Or time to learn how to use Python.