Closed yuycsmart closed 5 years ago
Please post your C++ code so that we can see what you did.
Seems like there is something wrong with your C++ code. The fact that the molar mass is different is a serious issue, suggesting a non-trivial error. That the critical point location is different suggests an alternative error.
In Python (should be like C++), I do:
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
RP = REFPROPFunctionLibrary('/home/ian/refprop')
RP.SETPATHdll('/home/ian/refprop')
print(RP.REFPROPdll('NITROGEN*ARGON*OXYGEN','','M;TC;PC', 0,0,0,0,0,[0.7812,0.0092,0.2096]))
results:
28.958600656, 132.82329394807982, 3850.035229536823
full output:
REFPROPdlloutput(z=array('d', [0.7812, 0.0092, 0.2096, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), Output=array('d', [28.958600656, 132.82329394807982, 3850.035229536823, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0, -9999990.0]), hUnits='g/mol', iUCode=4294967282, x=array('d', [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), y=array('d', [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), x3=array('d', [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), q=-9999990.0, ierr=4294966980, herr='[CRTHMX warning -316] The true critical point is unknown. Estimated values based on previous fits of the critical lines were returned. For a Type I binary mixture, the values are generally close. For other Type I mixtures the values are rough estimate')
The C++ code is the same with REFPROP software example. I use .cpp and .h to compute the pure fluid and there is nothing wrong, but using the mixture example, the result is wrong. For example, the R410A:
char *FLD_PATH;
FLD_PATH = "C:\\Program Files\\REFPROP\\fluids\\";
strcpy(hf,FLD_PATH);
strcpy(hfmix,FLD_PATH);
//...initialize the program and set the pure fluid component name
i=2;
strcpy(hf,"r32.fld");
strcat(hf,"|r125.fld");
strcpy(hfmix,"hmx.bnc");
strcpy(hrf,"DEF");
strcpy(herr,"Ok");
x[0]=0.69761;
x[1]=0.30239;
//...Call SETUP to initialize the program
SETUPdll(i, hf, hfmix, hrf, ierr, herr, refpropcharlength*ncmax,refpropcharlength,lengthofreference,errormessagelength);
if (ierr != 0) printf("%s\n",herr);
double wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas;
//....long info_index=1;
INFOdll(i,wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas);
printf("WM,TC,PC %10.4f,%10.4f,%10.4f\n",wm,tc-273.15,pc/1000.0);
for air composition:
i=3;
strcpy_s(hf,"nitrogen.fld");
strcat_s(hf,"|argon.fld");
strcat_s(hf,"|oxygen.fld");
strcpy_s(hfmix,"hmx.bnc");
strcpy_s(hrf,"DEF");
strcpy_s(herr,"Ok");
x[0]=0.7812; //Air composition
x[1]=0.0092;
x[2]=0.2096;
//...Call SETUP to initialize the program
SETUPdll(i, hf, hfmix, hrf, ierr, herr, refpropcharlength*ncmax,refpropcharlength,lengthofreference,errormessagelength);
if (ierr != 0) printf("%s\n",herr);
double wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas;
//....long info_index=1;
INFOdll(i,wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas);
printf("WM,TC,PC %10.4f,%10.4f,%10.4f\n",wm,tc-273.15,pc/1000.0);
The results for r32/r125(0.69761/0.30239) are : 120.0214(WM), 66.0230(TC-℃), 3.6177(PC-MPa), while by using REFPROP software, the results for R410A are 72.585414(WM), 71.3440(TC-℃), 4.9012(PC-MPa).
The results for nitrogen/argon/oxygen(0.7812/0.0092/0.2096) are 31.9988(WM), -118.5690(TC-℃), 5.0430(PC-MPa), while by using REFPROP software, the results for air are 28.965(WM), -140.62(TC-℃), 3.786(PC-MPa).
I don't know why. Thanks for helping me.
I cleaned up the formatting of your issue...
The key problem is that you are not getting what you think you are getting. The INFOdll function (https://refprop-docs.readthedocs.io/en/latest/DLL/legacy.html#f/_/INFOdll) returns properties of the pure fluids in the mixture, not the mixture itself.
Understand. INFOdll(i,wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas): i means the number of the composition.
I have another question, that is how to get the R410A_eta; by using r32/r125(0.69761/0.30239) or call mixture file-- R410A.MIX. The results are same ot not.
TRNPRPdll(T, D, z, eta, tcx, ierr, herr, herr_length)
Thanks.
Try it! R410A.MIX is only a predefined mixture. It still uses the mixture model, so defining the mixture with specified composition or with R410A.MIX should be identical (if not that is a bug and please report it). Make sure you use mole fractions in TRNPRPdll (and the units of mol/L for density).
Thanks, I find why and know the answers. Thanks again.
If you are satisfied, please close the issue in the web interface.
Description
The issue of calculated property values mismatch upon reordering the components. [Description of the issue] The property results by defining new mixtures is different from the property results by using the refprop software. For example, the air composition(nitrogen/argon/oxygen---0.7812/0.0092/0.2096), the results by using C++ are 32(Wm) ,-119℃ (TC), 5.043MPa (PC); but by using the refprop software the results are 29(Wm) ,-140℃ (TC), 3.85MPa (PC).
I totally follow the refprop example _C++,the diffrerance is reasonable or there is something wrong, please tell me why,thanks.
Expected behavior: [What you expect to happen] Tell me why, I totally follow the refprop example _C++. Actual behavior: [What actually happens] The property results by defining new mixtures is different from the property results by using the refprop software.
Versions
REFPROP Version: [REFPROP version you are using] 9.1 Operating System and Version: [OS you are running REFPROP on] Windows 7 Access Method: [How you are accessing REFPROP (i.e. Python, other wrapper)] C++
Additional Information
none If possible, please post examples and/or screenshots of the issue.