-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hello,
In Excel VBA code that makes frequent REFPROP DLL calls to obtain fluid properties for nitrogen and helium mixtures there are certain mixture ratio ranges and pressure + temperature combinations that cause an error (ierr=355, herr = "[SATSPLN 355 error] Spline routine failed." ) with an iFlag = 1 setting and the need to call the DLL with iFlag = 0 to reliably obtain the properties. With iFlag = 0 setting the resulting code execution time for a multiple fluid properties call loop increases from 0.5 to >20 seconds and renders REFPROP totally unsuitable for the task. For the typical pressure (1 to 20 MPa) and temperature (273 to 473 K) ranges properties are needed at, the nitrogen/helium mol. fraction ranges where SATSPLN errors occur are from approximately 0.8/0.2 to 0.35/0.65, i.e., nitrogen content of 35 to 80%. Generally, above or below the range there is no SATSPLN error and the code's multiple fluid properties call execution loop is less than 0.5 seconds and completely satisfactory.
A code example is shown below:
Sub FluidProperties(T As Double, P As Double)
'
' Subroutine to return the fluid properties from REFPROP V10
'
' The Passed Temperature must be in K and the Pressure in MPa
'First find the Density
Retry_iFlag0:
Call REFPROPdll("", "TP<", "Dvap", iUnitNumb, iMass, iFlag, T, P, z(0), Output(1), hUnits, iUnits, x(0), y(0), x3(0), q, ierr, herr, 10000&, 255&, 255&, 255&, 255&)
'Check if a SATSPLN error has occurred and then turn off the SATSPLN routine call and rerun the REFPROP Call
If ierr <> 0 Then
iFlag = 0
GoTo Retry_iFlag0
End If
Density = Output(1) 'D - kg/m3
hIn = "TD"
hOut = "CPvap,CP/CVvap,Hvap,Svap,Wvap,VISvap,TCXvap"
Call REFPROPdll("", hIn, hOut, iUnitNumb, iMass, iFlag, T, Density, z(0), Output(1), hUnits, iUnits, x(0), y(0), x3(0), q, ierr, herr, 10000&, 255&, 255&, 255&, 255&)
Cp = Output(1) 'Cp - kJ/(kg-K)
CpCv = Output(2) 'Cp/Cv
Enthalpy = Output(3) 'H - kJ/kg
Entropy = Output(4) 'S - kJ/kg.K
SonicSpeed = Output(5) 'Speed of Sound - m/s
Viscosity = Output(6) / 1000000# 'Viscosity - Pa-s
Conductivity = Output(7) / 1000# 'Thermal conductivity - W/(m-K)
'Switch iFlag back to 1 {SATSPLN Call enabled} to get fastest method for future calls
If iFlag = 0 Then iFlag = 1
End Sub
Note that attempts to force REFPROP to only find the vapor phase properties, via < and vap suffixes, does not mitigate the SATSPLN error.
Is there something fundamentally wrong with the above example code that causes the SATSPLN error? If so, can someone please provide an example or recommendation how fast and reliable properties for nitrogen + helium mixtures can be obtained with REFPROP.
Help in this matter will be greatly appreciated.