Closed MwangiST closed 8 months ago
How did you compile and link REFPROP? A lot more information is needed to have any chance of helping you.
Hello Ian, A part of the code is;
implicit integer (i-k,m,n)
parameter (ncmax=150)
parameter (ipropmax=200)
character*255 hOut,hUnits,herr,hUArray(ipropmax)*50
dimension Output(ipropmax),iUArray(ipropmax)
dimension z(ncmax),x(ncmax),y(ncmax),x3(ncmax)
dimension ymass(ncmax),ymole(ncmax)
o=1000.d0
call REFPROP (' ',' ','DLL#',0,0,0,0d0,0d0,z, Output,hUnits,i,x,y,x3,q,ierr,here)
call SETFLUIDS('METHANE;ETHANE',ierr)
call ERRMSG (ierr,herr)
if (ierr.gt.0) write (*,*) here
c---Loop over different concentrations for the first refrigerant ("")
DO i = 0, 10
c---Loop over different concentrations for the second refrigerant ("")
DO j = 0, 10
c---Set concentrations (fractional mass fractions)
z(1) = REAL(i) / 10.0 ! Fractional concentration for the first refrigerant
z(2) = REAL(j) / 10.0 ! Fractional concentration for the second refrigerant
iMass = 1 ! Mass fractions for composition
c---Set input temperature and pressure
t = TEvaporatorIn
p = pEvaporatorIn
c---Calculating saturation properties if phase is not known, call TPFLSH(If two phase, quality is returned as q)
call TPFLSH (t,p,z,d,dl,dv,x,y,q,e,h,s,cv,cp,w,ierr,herr)
if (ierr.gt.0) write (*,*) herr
How did you compile and link the REFPROP library?
P.S. Don't use implicit variable definitions in Fortran. It is a very bad practice that introduces a lot of issues
Hey, I'm trying to create components on TRNSYS 18, so I have to call REFPROP 10 in the FORTRAN codes I created, I have REFPROP 10 on my laptop, and I'm working on visual studio code, I just do not know how to make FORTRAN read the refprop, which file it should read?
What are you trying to achieve?
I'm creating components on TRNSYS 18 which have to read properties of liquid air, propane, methanol, So i'm trying to make a fortran code calls refprop 10, here is the code i used, but somehow it can not call the refprop ```fortran program test_call implicit none integer, parameter :: ncmax=20 integer, parameter :: ipropmax=200 double precision x(ncmax),y(ncmax),x3(ncmax),z(ncmax) double precision P,T,V,Output,q,qcalc dimension Output(ipropmax) integer iUnit,iMass,ierr,iFlag,iOut character*255 hOut,herr
call GETENUM(0,'SI with C',iUnit,ierr,herr) ! SI with C;
iMass=1 ! Mass basis properties
call REFPROP ('R410A',' ',' ',iUnit,iMass,0,0d0,0d0,z,Output,hout,iOut,x,y,x3,q,ierr,herr)
T=20 ! Celsius
q=1 ! quality
call REFPROP1('TQ','P',iUnit,iMass,T,q,z,P,qcalc,ierr,herr)
Print *,'Dew-point pressure at the temperature',T,' (Celsius)is: ',P,'(MPa)'
q=0 ! quality
call REFPROP1('TQ','P',iUnit,iMass,T,q,z,P,qcalc,ierr,herr)
Print *,'Bubble-point pressure at the temperature',T,' (Celsius)is: ',P,'(MPa)'
Print *,'Program finished successfully.'
end
What is the result of that program? What are the values of ierr and herr at each step? What operating system? What version of REFPROP? Looks like 10
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\admin\AppData\Local\Temp\cca5hLNZ.o:tempCodeRunnerFile.f90:(.text+0x51): undefined reference to `getenum_'
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\admin\AppData\Local\Temp\cca5hLNZ.o:tempCodeRunnerFile.f90:(.text+0x169): undefined reference to `refprop_'
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\admin\AppData\Local\Temp\cca5hLNZ.o:tempCodeRunnerFile.f90:(.text+0x21f): undefined reference to `refprop1_'
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\admin\AppData\Local\Temp\cca5hLNZ.o:tempCodeRunnerFile.f90:(.text+0x376): undefined reference to `refprop1_'
collect2.exe: error: ld returned 1 exit status
this is the result of the program, yes it's refprop10, and i run the code on visual studio code
How did you compile refprop? How did you link refprop?
That is my question, how can i link both? the fortran code and refprop?
How did you make your project in VS?
I think you need to look into the TRNSYS docs. There should be something about linking other code. It seems like your linking is incorrect.
I'm trying to call refprop in single fortran code first, when it works, I'll link it in trnsys, but I can not do the first step, so I'm asking how to link REFPROP in the single FORTRAN code on visual studio code?
How did you add REFPROP into your project?
I can not add it, I'm asking how to add it program test_call implicit none integer, parameter :: ncmax=20 integer, parameter :: ipropmax=200 double precision x(ncmax),y(ncmax),x3(ncmax),z(ncmax) double precision P,T,V,Output,q,qcalc dimension Output(ipropmax) integer iUnit,iMass,ierr,iFlag,iOut character*255 hOut,herr
call GETENUM(0,'SI with C',iUnit,ierr,herr) ! SI with C;
iMass=1 ! Mass basis properties
call REFPROP ('R410A',' ',' ',iUnit,iMass,0,0d0,0d0,z,Output,hout,iOut,x,y,x3,q,ierr,herr)
T=20 ! Celsius
q=1 ! quality
call REFPROP1('TQ','P',iUnit,iMass,T,q,z,P,qcalc,ierr,herr)
Print *,'Dew-point pressure at the temperature',T,' (Celsius)is: ',P,'(MPa)'
q=0 ! quality
call REFPROP1('TQ','P',iUnit,iMass,T,q,z,P,qcalc,ierr,herr)
Print *,'Bubble-point pressure at the temperature',T,' (Celsius)is: ',P,'(MPa)'
Print *,'Program finished successfully.'
end
I wrote this in a files and saved it on the refprop directory, that's what i do
Are you able to compile and run a program that doesnt use REFPROP?
yes
What does your project look like in vscode? screenshot?
I think the files need to be in the same folder as your main source. Also note you are mixing format styles.
But I also don't use VSCode and only use CMake to build projects linking with REFPROP. In general we do not support MINGW and only support Intel compilers on windows and gfortran elsewhere.
I'm using intel on windows, can you suggest any solution?
But you are not compiling with Intel Fortran
See REFPROP-cmake(https://github.com/usnistgov/REFPROP-cmake) to see how to set things up with CMake for cross-platform builds.
I think you need to read some docs for how to compile FORTRAN in general, none of this is refprop-specific.
Hi, I am working on creating a new TRNSYS Type linked with Reprop 10
Description
I am creating a new component in TRNSYS using FORTRAN linked to Refprop. The purpose is to model a Vapor Compression Cycle with CO2(R744) refrigerant mixtures.
Error C:\Users\220343~1\AppData\Local\Temp\ccziZxbh.o:Type221.f90:(.text+0x5bc): undefined reference to `refprop_'