4 ## Last updated: 6 August 2010
5 ## Updated to be used with linux : 6 August 2011
7 #-------------------------------------------------------------------------------
9 # pressure, fugacity kPa
11 # composition mole fraction
13 # enthalpy, internal energy J/mol
14 # Gibbs, Helmholtz free energy J/mol
15 # entropy, heat capacity J/(mol-K)
17 # Joule-Thompson coefficient K/kPa
18 # d(p)/d(rho) kPa-L/mol
19 # d2(p)/d(rho)2 kPa-(L/mol)2
21 # thermal conductivity W/(m-K)
24 #-------------------------------------------------------------------------------
30 ###################### OS ADD ###############################
34 def __init__(self
, rp
):
36 def __getattr__(self
,n
):
37 return self
.rp
.__getattr
__(n
.lower()+"_")
40 if os
.name
== "posix":
41 rp
=RPWrapper(cdll
.LoadLibrary(dirname
+"fortran/librefprop.so.1.0.1"))
43 rp
=windll
.LoadLibrary(dirname
+"refprop.dll")
45 print "sorry your operating system is not convenient with this version of UCycLe using REFPROP"
47 ####################### END OS ADD ############################
52 fldpath
=fpath
+'fluids/'
53 mixpath
=fpath
+'mixtures/'
54 hfld
=create_string_buffer('', 10000)
55 hfm
=create_string_buffer(fpath
+'fluids/hmx.bnc', 255)
56 hrf
=create_string_buffer('DEF', 3)
57 hfile
=create_string_buffer('', 10000)
58 htype
=create_string_buffer('NBS', 3)
59 hmix
=create_string_buffer('NBS', 3)
60 hcomp
=create_string_buffer('NBS', 3)
62 herr
=create_string_buffer('', 255)
63 hname
=create_string_buffer('', 12)
64 hn80
=create_string_buffer('', 80)
65 hcas
=create_string_buffer('', 12)
68 x
=(c_double
*MaxComps
)(1)
69 xl
=(c_double
*MaxComps
)()
70 xv
=(c_double
*MaxComps
)()
71 xlkg
=(c_double
*MaxComps
)()
72 xvkg
=(c_double
*MaxComps
)()
74 #####################################################
75 # -- INITIALIZATION SUBROUTINES --
76 #####################################################
77 def SETPATH(value
= dirname
):
78 '''set path to refprop root containing fluids and mixtures'''
79 global fpath
, fldpath
, mixpath
81 fldpath
= fpath
+'fluids/'
82 mixpath
= fpath
+'mixtures/'
84 def SETUP(FluidName
='R22.FLD', FluidRef
='DEF'):
85 '''define models and initialize arrays'''
87 global nc
,hfld
,hfm
,hrf
,wm
89 hfld
.value
=fldpath
+FluidName
91 rp
.SETUPdll(byref(nc
),byref(hfld
),byref(hfm
),byref(hrf
),byref(ierr
),byref(herr
),c_long(10000),c_long(255),c_long(3),c_long(255))
94 h0
,s0
,t0
,p0
=c_double(0),c_double(0),c_double(0),c_double(0)
95 rp
.SETREFdll(byref(hrf
),byref(ixflag
),x
,byref(h0
),byref(s0
),byref(t0
),byref(p0
),byref(ierr
),byref(herr
),c_long(3),c_long(255))
97 rp
.WMOLdll(x
,byref(wm
))
100 def SETMIX(FluidName
='R404A.MIX', FluidRef
='DEF'):
101 '''open a mixture file and read constituents and mole fractions'''
103 global x
,nc
,hfld
,hfm
,hrf
,hfile
104 hfld
.value
=mixpath
+FluidName
106 rp
.SETMIXdll(byref(hfld
),byref(hfm
),byref(hrf
),byref(nc
),byref(hfile
),x
,byref(ierr
),byref(herr
),c_long(255),c_long(255),c_long(3),c_long(10000),c_long(255))
109 h0
,s0
,t0
,p0
=c_double(0),c_double(0),c_double(0),c_double(0)
110 rp
.SETREFdll(byref(hrf
),byref(ixflag
),x
,byref(h0
),byref(s0
),byref(t0
),byref(p0
),byref(ierr
),byref(herr
),c_long(3),c_long(255))
112 rp
.WMOLdll(x
,byref(wm
))
115 def SETREF(FluidRef
='DEF', ixflag
=1, h0
=0, s0
=0, t0
=0, p0
=0):
116 '''set reference state enthalpy and entropy'''
120 ixflag
=c_long(ixflag
)
121 h0
,s0
,t0
,p0
=c_double(h0
),c_double(s0
),c_double(t0
),c_double(p0
)
122 rp
.SETREFdll(byref(hrf
),byref(ixflag
),x
,byref(h0
),byref(s0
),byref(t0
),byref(p0
),byref(ierr
),byref(herr
),c_long(3),c_long(255))
125 def SETMOD(ncomps
=1, EqnModel
='NBS', MixModel
='NBS', CompModel
='NBS'):
126 '''set model(s) other than the NIST-recommended (NBS) ones'''
128 global nc
,htype
,hmix
,hcomp
132 hcomp
.value
=CompModel
133 rp
.SETMODdll(byref(nc
),byref(htype
),byref(hmix
),byref(hcomp
),byref(ierr
),byref(herr
),c_long(3),c_long(3),c_long(3),c_long(255))
136 def PUREFLD(icomp
=0):
137 '''Change the standard mixture setup so that the properties of one fluid can
138 be calculated as if SETUP had been called for a pure fluid'''
140 rp
.PUREFLDdll(byref(icomp
))
144 '''critical parameters'''
149 rp
.CRITPdll(x
,byref(tcrit
),byref(pcrit
),byref(Dcrit
),byref(ierr
),byref(herr
),c_long(255))
150 return tcrit
.value
,pcrit
.value
,Dcrit
.value
153 '''thermal quantities as a function of temperature and density'''
157 e
,h
,s
=c_double(),c_double(),c_double()
158 cv
,cp
=c_double(),c_double()
161 rp
.THERMdll(byref(t
),byref(D
),x
,byref(p
),byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(hjt
))
162 return p
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
,hjt
.value
165 '''ideal gas thermal quantities as a function of temperature and density'''
169 e
,h
,s
=c_double(),c_double(),c_double()
170 cv
,cp
=c_double(),c_double()
172 a
,g
=c_double(),c_double()
173 rp
.THERM0dll(byref(t
),byref(D
),x
,byref(p
),byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(a
),byref(g
))
174 return p
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
,a
.value
,g
.value
177 '''thermal quantities as a function of temperature and density'''
181 e
,h
,s
=c_double(),c_double(),c_double()
182 cv
,cp
=c_double(),c_double()
183 w
,Z
,hjt
=c_double(),c_double(),c_double()
184 A
,G
=c_double(),c_double()
185 spare1
,spare2
=c_double(),c_double()
186 spare3
,spare4
=c_double(),c_double()
187 rp
.THERM2dll(byref(t
),byref(D
),x
,byref(p
),byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(Z
),byref(hjt
),byref(A
),byref(G
),byref(xkappa
),byref(beta
),byref(dPdD
),byref(d2PdD2
),byref(dPdT
),byref(dDdT
),byref(dDdP
),byref(spare1
),byref(spare2
),byref(spare3
),byref(spare4
))
188 return t
.value
,D
.value
,p
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
,Z
.value
,hjt
.value
,A
.value
,G
.value
,xkappa
.value
,beta
.value
,dPdD
.value
,d2PdD2
.value
,dPdT
.value
,dDdT
.value
,dDdP
.value
191 '''miscellaneous thermodynamic properties'''
204 rp
.THERM3dll(byref(t
),byref(D
),x
,byref(xkappa
),byref(beta
),byref(xisenk
),byref(xkt
),byref(betas
),byref(bs
),byref(xkkt
),byref(thrott
),byref(pint
),byref(spht
))
205 return xkappa
,beta
,xisenk
,xkt
,betas
,bs
,xkkt
,thrott
,pint
,spht
208 '''entropy as a function of temperature and density'''
212 rp
.ENTROdll(byref(t
),byref(D
),x
,byref(s
))
216 '''enthalpy as a function of temperature and density'''
220 rp
.ENTHALdll(byref(t
),byref(D
),x
,byref(h
))
224 '''isochoric (constant volume) and isobaric (constant pressure) heat
225 capacity as functions of temperature and density'''
228 cv
,cp
=c_double(),c_double()
229 rp
.CVCPdll(byref(t
),byref(D
),x
,byref(cv
),byref(cp
))
230 return cv
.value
,cp
.value
232 def CVCPK(icomp
,t
,D
):
233 '''isochoric (constant volume) and isobaric (constant pressure) heat
234 capacity as functions of temperature and density for a given component'''
238 cv
,cp
=c_double(),c_double()
239 rp
.CVCPKdll(byref(icomp
),byref(t
),byref(D
),byref(cv
),byref(cp
))
240 return cv
.value
,cp
.value
243 '''residual Helmholtz and Gibbs free energy as a function of
244 temperature and density'''
247 Ar
,Gr
=c_double(),c_double()
248 rp
.GIBBSdll(byref(t
),byref(D
),x
,byref(Ar
),byref(Gr
))
249 return Ar
.value
,Gr
.value
252 '''Helmholtz and Gibbs energies as a function of temperature and density'''
255 a
,g
=c_double(),c_double()
256 rp
.AGdll(byref(t
),byref(D
),x
,byref(a
),byref(g
))
257 return a
.value
,g
.value
260 '''pressure as a function of temperature and density'''
264 rp
.PRESSdll(byref(t
),byref(D
),x
,byref(p
))
268 '''partial derivative of pressure w.r.t. density at constant temperature as a
269 function of temperature and density'''
273 rp
.DPDDdll(byref(t
),byref(D
),x
,byref(dpdD
))
276 def DPDDK(icomp
,t
,D
):
277 '''partial derivative of pressure w.r.t. density at constant temperature as a
278 function of temperature and density for a specified component'''
283 rp
.DPDDKdll(byref(icomp
),byref(t
),byref(D
),byref(dpdD
))
287 '''second partial derivative of pressure w.r.t. density at const temperature
288 as a function of temperature and density'''
292 rp
.DPDD2dll(byref(t
),byref(D
),x
,byref(d2PdD2
))
296 '''partial derivative of pressure w.r.t. temperature at constant density as a
297 function of temperature and density'''
301 rp
.DPDTdll(byref(t
),byref(D
),x
,byref(dpt
))
304 def DPDTK(icomp
,t
,D
):
305 '''partial derivative of pressure w.r.t. temperature at constant density as a
306 function of temperature and density for a specified component'''
311 rp
.DPDTKdll(byref(icomp
),byref(t
),byref(D
),byref(dpt
))
315 '''partial derivative of density w.r.t. pressure at constant temperature as a
316 function of temperature and density'''
320 rp
.DDDPdll(byref(t
),byref(D
),x
,byref(dDdp
))
324 '''partial derivative of density w.r.t. temperature at constant pressure as a
325 function of temperature and density'''
329 rp
.DDDTdll(byref(t
),byref(D
),x
,byref(dDdt
))
333 '''partial derivatives of enthalpy w.r.t. t, p, or D at constant t, p, or D as
334 a function of temperature and density'''
343 rp
.DHD1dll(byref(t
),byref(D
),x
,byref(dhdt_d
),byref(dhdt_p
),byref(dhdd_t
),byref(dhdd_p
),byref(dhdp_t
),byref(dhdp_d
))
344 return dhdt_d
.value
,dhdt_p
.value
,dhdd_t
.value
,dhdd_p
.value
,dhdp_t
.value
,dhdp_d
.value
347 '''fugacity for each of the nc components of a mixture by numerical
348 differentiation (using central differences) of the dimensionless residual
352 f
=(c_double
*MaxComps
)()
353 rp
.FGCTYdll(byref(t
),byref(D
),x
,f
)
357 '''second virial coefficient as a function of temperature'''
360 rp
.VIRBdll(byref(t
),x
,byref(b
))
364 '''2nd derivative of B (B is the second virial coefficient) with respect to T
365 as a function of temperature'''
368 rp
.DBDTdll(byref(t
),x
,byref(b
))
372 '''third virial coefficient as a function of temperature'''
375 rp
.VIRCdll(byref(t
),x
,byref(c
))
378 ######################## SAT
380 '''iterate for saturated liquid and vapor states given temperature
381 kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint'''
387 Dl
,Dv
=c_double(),c_double()
388 rp
.SATTdll(byref(t
),x
,byref(kph
),byref(p
),byref(Dl
),byref(Dv
),xl
,xv
,byref(ierr
),byref(herr
),c_long(255))
389 return p
.value
,Dl
.value
,Dv
.value
392 '''saturation temperature from pressure
393 kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint'''
399 Dl
,Dv
=c_double(),c_double()
400 rp
.SATPdll(byref(p
),x
,byref(kph
),byref(t
),byref(Dl
),byref(Dv
),xl
,xv
,byref(ierr
),byref(herr
),c_long(255))
401 return t
.value
,Dl
.value
,Dv
.value
404 '''iterate for temperature and pressure given a density along the saturation boundary.
405 kph--flag specifying desired root for multi-valued inputs
406 (has meaning only for water at temperatures close to its triple point)
407 -1=middle root (between 0 and 4C), 1=return highest temperature root (above 4C), 3=lowest temperature root (along freezing line)'''
414 Dl
,Dv
=c_double(),c_double()
415 rp
.SATDdll(byref(D
),x
,byref(kph
),byref(kr
),byref(t
),byref(p
),byref(Dl
),byref(Dv
),xl
,xv
,byref(ierr
),byref(herr
),c_long(255))
416 return kr
.value
,t
.value
,Dl
.value
,Dv
.value
419 '''iterate for temperature, pressure, and density given enthalpy along the saturation boundary
420 kph--flag specifying desired root
421 0 = all roots along the liquid-vapor line
422 1 = only liquid VLE root
423 2 = only vapor VLE roots
424 3 = liquid SLE root (melting line)
425 4 = vapor SVE root (sublimation line)'''
430 k1
,t1
,p1
,d1
=c_double(),c_double(),c_double(),c_double()
431 k2
,t2
,p2
,d2
=c_double(),c_double(),c_double(),c_double()
432 rp
.SATHdll(byref(h
),x
,byref(kph
),byref(nroot
),byref(k1
),byref(t1
),byref(p1
),byref(d1
),byref(k2
),byref(t2
),byref(p2
),byref(d2
),byref(ierr
),byref(herr
),c_long(255))
433 return nroot
.value
,k1
.value
,t1
.value
,p1
.value
,d1
.value
,k2
.value
,t2
.value
,p2
.value
,d2
.value
436 '''iterate for temperature, pressure, and density given energy along the saturation boundary
437 kph--flag specifying desired root
438 0 = all roots along the liquid-vapor line
439 1 = only liquid VLE root
440 2 = only vapor VLE roots
441 3 = liquid SLE root (melting line)
442 4 = vapor SVE root (sublimation line)'''
447 k1
,t1
,p1
,d1
=c_double(),c_double(),c_double(),c_double()
448 k2
,t2
,p2
,d2
=c_double(),c_double(),c_double(),c_double()
449 rp
.SATEdll(byref(e
),x
,byref(kph
),byref(nroot
),byref(k1
),byref(t1
),byref(p1
),byref(d1
),byref(k2
),byref(t2
),byref(p2
),byref(d2
),byref(ierr
),byref(herr
),c_long(255))
450 return nroot
.value
,k1
.value
,t1
.value
,p1
.value
,d1
.value
,k2
.value
,t2
.value
,p2
.value
,d2
.value
453 '''iterate for temperature, pressure, and density given an entropy along the saturation boundary
454 kph--flag specifying desired root
455 0 = all roots along the liquid-vapor line
456 1 = only liquid VLE root
457 2 = only vapor VLE roots
458 3 = liquid SLE root (melting line)
459 4 = vapor SVE root (sublimation line)
460 return nroot.value,k1.value,t1.value,p1.value,d1.value,k2.value,t2.value,p2.value,d2.value,k3.value,t3.value,p3.value,d3.value'''
465 k1
,t1
,p1
,d1
=c_double(),c_double(),c_double(),c_double()
466 k2
,t2
,p2
,d2
=c_double(),c_double(),c_double(),c_double()
467 k3
,t3
,p3
,d3
=c_double(),c_double(),c_double(),c_double()
468 rp
.SATSdll(byref(s
),x
,byref(kph
),byref(nroot
),byref(k1
),byref(t1
),byref(p1
),byref(d1
),byref(k2
),byref(t2
),byref(p2
),byref(d2
),byref(k3
),byref(t3
),byref(p3
),byref(d3
),byref(ierr
),byref(herr
),c_long(255))
469 return nroot
.value
,k1
.value
,t1
.value
,p1
.value
,d1
.value
,k2
.value
,t2
.value
,p2
.value
,d2
.value
,k3
.value
,t3
.value
,p3
.value
,d3
.value
471 ######################## END SAT
473 def CSATK(icomp
,t
,kph
=2):
474 '''heat capacity along the saturation line as a function of temperature for a given component
475 kph--flag specifying desired root
476 0 = all roots along the liquid-vapor line
477 1 = only liquid VLE root
478 2 = only vapor VLE roots
479 3 = liquid SLE root (melting line)
480 4 = vapor SVE root (sublimation line)'''
488 rp
.CSATKdll(byref(icomp
),byref(t
),byref(kph
),byref(p
),byref(D
),byref(csat
),byref(ierr
),byref(herr
),c_long(255))
489 return p
.value
,D
.value
,csat
.value
491 def DPTSATK(icomp
,t
,kph
=2):
492 '''heat capacity and dP/dT along the saturation line as a function of temperature for a given component
493 kph--flag specifying desired root
494 0 = all roots along the liquid-vapor line
495 1 = only liquid VLE root
496 2 = only vapor VLE roots
497 3 = liquid SLE root (melting line)
498 4 = vapor SVE root (sublimation line)'''
507 rp
.DPTSATKdll(byref(icomp
),byref(t
),byref(kph
),byref(p
),byref(D
),byref(csat
),byref(dpt
),byref(ierr
),byref(herr
),c_long(255))
508 return p
.value
,D
.value
,csat
.value
,dpt
.value
510 def CV2PK(icomp
,t
,D
):
511 '''isochoric heat capacity in the two phase (liquid+vapor) region'''
516 cv2p
,csat
=c_double(),c_double()
517 rp
.CV2PKdll(byref(icomp
),byref(t
),byref(D
),byref(cv2p
),byref(csat
),byref(ierr
),byref(herr
),c_long(255))
518 return cv2p
.value
,csat
.value
520 def TPRHO(t
,p
,kph
=2,kguess
=0,D
=0):
521 '''iterate for density as a function of temperature, pressure, and composition for a specified phase
522 kph--phase flag: 1=liquid 2=vapor
523 NB: 0 = stable phase--NOT ALLOWED (use TPFLSH) (unless an initial guess is supplied for D)
524 -1 = force the search in the liquid phase
525 -2 = force the search in the vapor phase
527 1 = first guess for D provided
528 0 = no first guess provided
529 D--first guess for molar density [mol/L], only if kguess=1'''
534 kguess
=c_long(kguess
)
536 rp
.TPRHOdll(byref(t
),byref(p
),x
,byref(kph
),byref(kguess
),byref(D
),byref(ierr
),byref(herr
),c_long(255))
539 #####################################################
540 # -- GENERAL FLASH SUBROUTINES --
541 #####################################################
544 '''flash calculation given temperature and pressure'''
549 D
,Dl
,Dv
=c_double(),c_double(),c_double()
550 q
,e
,h
,s
=c_double(),c_double(),c_double(),c_double()
551 cv
,cp
=c_double(),c_double()
553 rp
.TPFLSHdll(byref(t
),byref(p
),x
,byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
554 return D
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
557 '''flash calculation given temperature and density'''
563 Dl
,Dv
=c_double(),c_double()
564 q
,e
,h
,s
=c_double(),c_double(),c_double(),c_double()
565 cv
,cp
=c_double(),c_double()
567 rp
.TDFLSHdll(byref(t
),byref(D
),x
,byref(p
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
568 return p
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
571 '''flash calculation given pressure and density'''
577 Dl
,Dv
=c_double(),c_double()
578 q
,e
,h
,s
=c_double(),c_double(),c_double(),c_double()
579 cv
,cp
=c_double(),c_double()
581 rp
.PDFLSHdll(byref(p
),byref(D
),x
,byref(t
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
582 return t
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
585 '''flash calculation given pressure and enthalpy'''
591 D
,Dl
,Dv
=c_double(),c_double(),c_double()
592 q
,e
,s
=c_double(),c_double(),c_double()
593 cv
,cp
=c_double(),c_double()
595 rp
.PHFLSHdll(byref(p
),byref(h
),x
,byref(t
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
596 return t
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
599 '''flash calculation given pressure and entropy'''
604 D
,Dl
,Dv
=c_double(),c_double(),c_double()
605 q
,e
,h
=c_double(),c_double(),c_double()
606 cv
,cp
=c_double(),c_double()
608 rp
.PSFLSHdll(byref(p
),byref(s
),x
,byref(t
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(h
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
609 return t
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,h
.value
,cv
.value
,cp
.value
,w
.value
612 '''flash calculation given pressure and energy'''
617 D
,Dl
,Dv
=c_double(),c_double(),c_double()
618 q
,s
,h
=c_double(),c_double(),c_double()
619 cv
,cp
=c_double(),c_double()
621 rp
.PEFLSHdll(byref(p
),byref(e
),x
,byref(t
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
622 return t
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
624 def THFLSH(t
,h
,kr
=1):
625 '''flash calculation given temperature and enthalpy'''
631 D
,Dl
,Dv
=c_double(),c_double(),c_double()
632 q
,e
,s
=c_double(),c_double(),c_double()
633 cv
,cp
=c_double(),c_double()
635 rp
.THFLSHdll(byref(t
),byref(h
),x
,byref(kr
),byref(p
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
636 return p
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
638 def TSFLSH(t
,s
,kr
=1):
639 '''flash calculation given temperature and entropy
642 2=vapor in equilibrium with liq,
643 3=liquid in equilibrium with solid,
644 4=vapor in equilibrium with solid'''
651 D
,Dl
,Dv
=c_double(),c_double(),c_double()
652 q
,e
,h
=c_double(),c_double(),c_double()
653 cv
,cp
=c_double(),c_double()
655 rp
.TSFLSHdll(byref(t
),byref(s
),x
,byref(kr
),byref(p
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(h
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
656 return p
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,h
.value
,cv
.value
,cp
.value
,w
.value
658 def TEFLSH(t
,e
,kr
=1):
659 '''flash calculation given temperature and energy'''
665 D
,Dl
,Dv
=c_double(),c_double(),c_double()
666 q
,h
,s
=c_double(),c_double(),c_double()
667 cv
,cp
=c_double(),c_double()
669 rp
.TEFLSHdll(byref(t
),byref(e
),x
,byref(kr
),byref(p
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
670 return kr
.value
,p
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
673 '''flash calculation given density and enthalpy'''
677 t
,p
=c_double(),c_double()
678 Dl
,Dv
=c_double(),c_double()
679 q
,e
,s
=c_double(),c_double(),c_double()
680 cv
,cp
=c_double(),c_double()
682 rp
.DHFLSHdll(byref(D
),byref(h
),x
,byref(t
),byref(p
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
683 return t
.value
,p
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
686 '''flash calculation given density and entropy'''
690 t
,p
=c_double(),c_double()
691 Dl
,Dv
=c_double(),c_double()
692 q
,e
,h
=c_double(),c_double(),c_double()
693 cv
,cp
=c_double(),c_double()
695 rp
.DSFLSHdll(byref(D
),byref(s
),x
,byref(t
),byref(p
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(h
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
696 return t
.value
,p
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,h
.value
,cv
.value
,cp
.value
,w
.value
699 '''flash calculation given density and energy'''
703 t
,p
=c_double(),c_double()
704 Dl
,Dv
=c_double(),c_double()
705 q
,h
,s
=c_double(),c_double(),c_double()
706 cv
,cp
=c_double(),c_double()
708 rp
.DEFLSHdll(byref(D
),byref(e
),x
,byref(t
),byref(p
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
709 return t
.value
,p
.value
,Dl
.value
,Dv
.value
,q
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
712 '''flash calculation given enthalpy and entropy'''
716 t
,p
=c_double(),c_double()
717 D
,Dl
,Dv
=c_double(),c_double(),c_double()
718 q
,e
=c_double(),c_double()
719 cv
,cp
=c_double(),c_double()
721 rp
.HSFLSHdll(byref(h
),byref(s
),x
,byref(t
),byref(p
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(e
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
722 return t
.value
,p
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,e
.value
,cv
.value
,cp
.value
,w
.value
725 '''flash calculation given energy and entropy'''
729 t
,p
=c_double(),c_double()
730 D
,Dl
,Dv
=c_double(),c_double(),c_double()
731 q
,h
=c_double(),c_double()
732 cv
,cp
=c_double(),c_double()
734 rp
.ESFLSHdll(byref(e
),byref(s
),x
,byref(t
),byref(p
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(q
),byref(h
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
735 return t
.value
,p
.value
,D
.value
,Dl
.value
,Dv
.value
,q
.value
,h
.value
,cv
.value
,cp
.value
,w
.value
738 '''flash calculation given temperature and quality'''
739 global ierr
,herr
,xl
,xv
744 D
,Dl
,Dv
=c_double(),c_double(),c_double()
745 e
,h
,s
=c_double(),c_double(),c_double()
746 cv
,cp
=c_double(),c_double()
748 rp
.TQFLSHdll(byref(t
),byref(q
),x
,byref(kq
),byref(p
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
749 return kq
.value
,p
.value
,D
.value
,Dl
.value
,Dv
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
750 #Correction Gauth : xh en xv a 748 + ajout du xv dans les parametres globals carle 10 eme parametre est composition of vapor phase
753 '''flash calculation given pressure and quality'''
759 D
,Dl
,Dv
=c_double(),c_double(),c_double()
760 e
,h
,s
=c_double(),c_double(),c_double()
761 cv
,cp
=c_double(),c_double()
763 rp
.PQFLSHdll(byref(p
),byref(q
),x
,byref(kq
),byref(t
),byref(D
),byref(Dl
),byref(Dv
),xl
,xv
,byref(e
),byref(h
),byref(s
),byref(cv
),byref(cp
),byref(w
),byref(ierr
),byref(herr
),c_long(255))
764 return kq
.value
,t
.value
,D
.value
,Dl
.value
,Dv
.value
,e
.value
,h
.value
,s
.value
,cv
.value
,cp
.value
,w
.value
767 #### END FLASH > MANON
771 '''critical flow factor, C*, for nozzle flow of a gas'''
776 cs
,ts
,Ds
,ps
,ws
=c_double(),c_double(),c_double(),c_double(),c_double()
777 rp
.CCRITdll(byref(t
),byref(p
),byref(v
),x
,byref(cs
),byref(ts
),byref(Ds
),byref(ps
),byref(ws
),byref(ierr
),byref(herr
),c_long(255))
778 return cs
.value
,ts
.value
,Ds
.value
,ps
.value
,ws
.value
781 '''supercompressibility factor, Fpv'''
786 rp
.FPVdll(byref(t
),byref(D
),byref(p
),x
,byref(f
))
790 '''mixture Cp0 calculated by appropriate core CP0xxx routine(s)'''
793 rp
.CP0dll(byref(t
),x
,byref(cp
))
797 '''transport properties of thermal conductivity and
798 viscosity as functions of temperature and density
799 eta--viscosity (uPa.s)
800 tcx--thermal conductivity (W/m.K)'''
804 eta
,tcx
=c_double(),c_double()
805 rp
.TRNPRPdll(byref(t
),byref(D
),x
,byref(eta
),byref(tcx
),byref(ierr
),byref(herr
),c_long(255))
806 return eta
.value
,tcx
.value
809 'provides fluid constants for specified component'
812 ttrp
,tnbpt
,tc
=c_double(),c_double(),c_double()
815 Zc
,acf
,dip
=c_double(),c_double(),c_double()
817 rp
.INFOdll(byref(icomp
),byref(wmm
),byref(ttrp
),byref(tnbpt
),byref(tc
),byref(pc
),byref(Dc
),byref(Zc
),byref(acf
),byref(dip
),byref(Rgas
))
818 return wmm
.value
,ttrp
.value
,tnbpt
.value
,tc
.value
,pc
.value
,Dc
.value
,Zc
.value
,acf
.value
,dip
.value
,Rgas
.value
820 def GETHEADER(fluid
):
821 '''read and interpret text at head of FLD file'''
833 #f=open(fldpath+fluid+'.fld', 'r') # changed for UCyCle
834 f
= open(fldpath
+fluid
, 'r')
835 H
['shortname'],rhs
=gets()
836 H
['casnum'],rhs
=gets()
837 H
['fullname'],rhs
=gets()
838 H
['chemform'],rhs
=gets()
839 H
['synonym'],rhs
=gets() # R-Number
846 H
['accen'],rhs
=gets()
850 if lhs
[0:2].lower()=='ot':
851 H
['ref']='OTH' ## not sure why some fluids have OT0
854 H
['tphs']=a
[0]+','+a
[1]+','+a
[2]+','+a
[3]
857 if rhs
[0:2].lower()=='un':
867 def GETMIXHEADER(mix
):
869 f
=open(mixpath
+mix
, 'r')
870 s
=f
.readline().strip()
883 nc
=int(f
.readline().strip())
885 # read component names
888 lhs
,rhs
=f
.readline().strip().split('.')
890 H
['chemform']=chemform
893 s
=f
.readline().strip()
898 global hname
, hn80
, hcas
900 rp
.NAMEdll(byref(icomp
),byref(hname
),byref(hn80
),byref(hcas
),c_long(12),c_long(80),c_long(12))
901 lhs
,rhs
=hn80
.value
.split('!')
903 return hname
.value
.strip(),lhs
,hcas
.value
.strip()
906 rp
.XMASSdll(xmol
,xkg
,byref(wmix
))
910 rp
.XMOLEdll(xkg
,xmol
,byref(wmix
))
913 def LIMITX(htyp
='EOS',t
=0,D
=0,p
=0):
915 htyp
=create_string_buffer(htyp
, 3)
919 tmin
,tmax
,Dmax
,pmax
=c_double(),c_double(),c_double(),c_double()
920 rp
.LIMITXdll(byref(htyp
),byref(t
),byref(D
),byref(p
),x
,byref(tmin
),byref(tmax
),byref(Dmax
),byref(pmax
),byref(ierr
),byref(herr
),c_long(3),c_long(255))
921 return tmin
.value
,tmax
.value
,Dmax
.value
,pmax
.value
923 def LIMITK(htyp
='EOS',icomp
=1,t
=0,D
=0,p
=0):
925 htyp
=create_string_buffer(htyp
, 3)
930 tmin
,tmax
,Dmax
,pmax
=c_double(),c_double(),c_double(),c_double()
931 rp
.LIMITKdll(byref(htyp
),byref(icomp
),byref(t
),byref(D
),byref(p
),byref(tmin
),byref(tmax
),byref(Dmax
),byref(pmax
),byref(ierr
),byref(herr
),c_long(3),c_long(255))
932 return tmin
.value
,tmax
.value
,Dmax
.value
,pmax
.value
934 def LIMITS(htyp
='EOS'):
936 htyp
=create_string_buffer(htyp
, 3)
937 tmin
, tmax
, Dmax
, pmax
=c_double(),c_double(),c_double(),c_double()
938 rp
.LIMITSdll(byref(htyp
),x
,byref(tmin
),byref(tmax
),byref(Dmax
),byref(pmax
),c_long(3))
939 return tmin
.value
,tmax
.value
,Dmax
.value
,pmax
.value
946 wl
,wv
=c_double(),c_double()
947 rp
.QMASSdll(byref(qmol
),xl
,xv
,byref(qkg
),xlkg
,xvkg
,byref(wl
),byref(wv
),byref(ierr
),byref(herr
),c_long(255))
948 return qkg
.value
,wl
.value
,wv
.value
955 wl
,wv
=c_double(),c_double()
956 rp
.QMOLEdll(byref(qkg
),xlkg
,xvkg
,byref(qmol
),xl
,xv
,byref(wl
),byref(wv
),byref(ierr
),byref(herr
),c_long(255))
957 return qmol
.value
,wl
.value
,wv
.value
960 'molecular weight of mixture'
962 rp
.WMOLdll(x
,byref(wm
))
966 '''dielectric constant as a function of temperature, density'''
969 rp
.DIELECdll(byref(t
),byref(D
),x
,byref(de
))
973 '''surface tension'''
978 rp
.SURFTdll(byref(t
),byref(D
),x
,byref(sigma
),byref(ierr
),byref(herr
),c_long(255))
982 '''surface tension'''
986 Dl
,Dv
=c_double(),c_double()
987 rp
.SURTENdll(byref(t
),byref(Dl
),byref(Dv
),xl
,xv
,byref(sigma
),byref(ierr
),byref(herr
),c_long(255))
990 #####################################################
991 # single phase flash routines
992 #####################################################
995 '''from pressure and density'''
1000 rp
.PDFL1dll(byref(p
),byref(D
),x
,byref(t
),byref(ierr
),byref(herr
),c_long(255))
1003 def PHFL1(p
,h
,kph
=2):
1004 '''from pressure and enthalpy'''
1009 t
,D
=c_double(),c_double()
1010 rp
.PHFL1dll(byref(p
),byref(h
),x
,byref(kph
),byref(t
),byref(D
),byref(ierr
),byref(herr
),c_long(255))
1011 return t
.value
,D
.value
1013 def PSFL1(p
,s
,kph
=2):
1014 '''from pressure and entropy'''
1019 t
,D
=c_double(),c_double()
1020 rp
.PSFL1dll(byref(p
),byref(s
),x
,byref(kph
),byref(t
),byref(D
),byref(ierr
),byref(herr
),c_long(255))
1021 return t
.value
,D
.value
1023 def SETKTV(icomp
,jcomp
):
1024 '''set mixture model and/or parameters'''
1026 global hmodij
, hfmix
1030 rp
.SETKTVdll(byref(icomp
),byref(jcomp
),byref(hmodij
),byref(fij
),byref(hfmix
),byref(ierr
),byref(herr
),c_long(3),c_long(255),c_long(255))
1033 def GETKTV(icomp
,jcomp
):
1034 '''retrieve mixture model and parameter info for a specified binary'''
1035 global hmodij
,hfmix
,hfij2
,hbinp
,hmxrul
1039 rp
.GETKTVdll(byref(icomp
),byref(jcomp
),byref(hmodij
),byref(fij
),byref(hfmix
),byref(hfij2
),byref(hbinp
),byref(hmxrul
),c_long(3),c_long(255),c_long(48),c_long(255),c_long(255))
1043 '''retrieve parameter info for a specified mixing rule'''
1045 fij
,hfij2
=c_double(),c_double()
1046 rp
.GETFIJdll(byref(hmodij
),byref(fij
),byref(hfij2
),byref(hmxrul
),c_long(255))
1047 return fij
.value
,hfij2
.value
1050 '''melting line pressure as a function of temperature'''
1054 rp
.MELTTdll(byref(t
),x
,byref(p
),byref(ierr
),byref(herr
),c_long(255))
1058 '''melting pressure of water'''
1060 p1
,p2
=c_double(),c_double()
1061 rp
.MLTH2Odll(byref(t
),byref(p1
),byref(p2
))
1062 return p1
.value
,p2
.value
1065 '''melting line temperature as a function of pressure'''
1069 rp
.MELTPdll(byref(p
),x
,byref(t
),byref(ierr
),byref(herr
),c_long(255))
1073 '''sublimation line pressure as a function of temperature'''
1077 rp
.SUBLTdll(byref(t
),x
,byref(p
),byref(ierr
),byref(herr
),c_long(255))
1081 '''sublimation line temperature as a function of pressure'''
1085 rp
.SUBLPdll(byref(p
),x
,byref(t
),byref(ierr
),byref(herr
),c_long(255))
1088 #####################################################
1089 ## REFPROP FOR UCycLe TEST
1090 #####################################################
1091 def function(fun
,In1
,In2
, fluid
):
1095 #***************************************************************************
1097 #***************************************************************************
1101 #***************************************************************************
1103 #***************************************************************************
1106 #saturation temperature from pressure
1107 #kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint
1108 # return t.value,Dl.value,Dv.value
1112 elif fun
== 'tsat_s':
1114 #iterate for temperature, pressure, and density given an entropy along the saturation boundary
1115 #kph--flag specifying desired root
1116 # 0 = all roots along the liquid-vapor line
1117 # 1 = only liquid VLE root
1118 # 2 = only vapor VLE roots
1119 # 3 = liquid SLE root (melting line)
1120 # 4 = vapor SVE root (sublimation line)
1121 # return nroot.value,k1.value,t1.value,p1.value,d1.value,k2.value,t2.value,p2.value,d2.value,k3.value,t3.value,p3.value,d3.value
1122 sats
= SATS(In1
, kph
= 0)
1127 #flash calculation given pressure and enthalpy
1128 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,s.value,cv.value,cp.value,w.value
1129 ph
= PHFLSH(In1
, In2
)
1134 #flash calculation given pressure and entropy
1135 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,h.value,cv.value,cp.value,w.value
1136 ps
= PSFLSH(In1
, In2
)
1141 #flash calculation given enthalpy and entropy
1142 # return t.value,p.value,D.value,Dl.value,Dv.value,q.value,e.value,cv.value,cp.value,w.value
1143 hs
= HSFLSH(In1
, In2
)
1146 #***************************************************************************
1148 #***************************************************************************
1149 elif fun
== 'psat_t':
1151 #iterate for saturated liquid and vapor states given temperature
1152 #kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint
1153 # return p.value,Dl.value,Dv.value
1157 elif fun
== 'psat_s':
1159 #iterate for temperature, pressure, and density given an entropy along the saturation boundary
1160 #kph--flag specifying desired root
1161 # 0 = all roots along the liquid-vapor line
1162 # 1 = only liquid VLE root
1163 # 2 = only vapor VLE roots
1164 # 3 = liquid SLE root (melting line)
1165 # 4 = vapor SVE root (sublimation line)
1166 # return nroot.value,k1.value,t1.value,p1.value,d1.value,k2.value,t2.value,p2.value,d2.value,k3.value,t3.value,p3.value,d3.value
1167 sats
= SATS(In1
, kph
= 0) #Correction Gauth : kph = 0 , sinon il donne pas toutes les valeurs
1172 #flash calculation given enthalpy and entropy
1173 # return t.value,p.value,D.value,Dl.value,Dv.value,q.value,e.value,cv.value,cp.value,w.value
1174 hs
= HSFLSH(In1
, In2
)
1177 elif fun
== 'p_hrho':
1179 #flash calculation given density and enthalpy
1180 # return t.value,p.value,Dl.value,Dv.value,q.value,e.value,s.value,cv.value,cp.value,w.value
1181 dh
= DHFLSH(In2
, In1
)
1185 #***************************************************************************
1187 #***************************************************************************
1207 #flash calculation given temperature and pressure
1208 #return D.value,Dl.value,Dv.value,q.value,e.value,h.value,s.value,cv.value,cp.value,w.value
1209 tp
= TPFLSH(In2
, In1
)
1214 #flash calculation given pressure and entropy
1215 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,h.value,cv.value,cp.value,w.value
1216 ps
= PSFLSH(In1
, In2
)
1221 #flash calculation given pressure and quality
1222 # return kq.value,t.value,D.value,Dl.value,Dv.value,e.value,h.value,s.value,cv.value,cp.value,w.value
1223 pq
= PQFLSH(In1
, In2
,2) #Changement Gauth : rajout du 2pour avoir la quality sur base massique
1226 elif fun
== 'h_prho':
1228 #flash calculation given pressure and density
1229 # return t.value,Dl.value,Dv.value,q.value,e.value,h.value,s.value,cv.value,cp.value,w.value
1230 pd
= PDFLSH(In1
, In2
)
1235 #flash calculation given temperature and quality
1236 # return kq.value,p.value,D.value,Dl.value,Dv.value,e.value,h.value,s.value,cv.value,cp.value,w.value
1237 tq
= TQFLSH(In1
, In2
)
1240 #***************************************************************************
1241 #1.5 Specific volume (v)
1242 #***************************************************************************
1244 #Convertion from D to specific volume
1249 #D = mole/litre *1000/1000 = 1000*mole/m3
1250 #D*wm = kg/mole * 1000*mole/m3 = 1000*kg/m3
1252 #1/(wm*D) = m3/(1000*kg)
1255 #saturation temperature from pressure
1256 #kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint
1257 # return t.value,Dl.value,Dv.value
1258 satp
= SATP(In1
,kph
=2)
1259 return 1/(satp
[2]*wm
.value
)
1263 #saturation temperature from pressure
1264 #kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint
1265 # return t.value,Dl.value,Dv.value
1266 satp
= SATP(In1
,kph
=1)
1267 return 1/(satp
[1]*wm
.value
)
1271 #iterate for saturated liquid and vapor states given temperature
1272 #kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint
1273 # return p.value,Dl.value,Dv.value
1274 satt
= SATT(In1
,kph
=2)
1275 return 1/(satt
[2]*wm
.value
)
1279 #iterate for saturated liquid and vapor states given temperature
1280 #kph--phase flag: 1=bubblepoint, 2=dewpoint, 3=freezingpoint, 4=sublimationpoint
1281 # return p.value,Dl.value,Dv.value
1282 satt
= SATT(In1
,kph
=1)
1283 return 1/(satt
[1]*wm
.value
)
1287 #flash calculation given temperature and pressure
1288 #return D.value,Dl.value,Dv.value,q.value,e.value,h.value,s.value,cv.value,cp.value,w.value
1289 tp
= TPFLSH(In2
,In1
)
1290 return 1/(tp
[0]*wm
.value
)
1294 #flash calculation given pressure and enthalpy
1295 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,s.value,cv.value,cp.value,w.value
1296 ph
= PHFLSH(In1
, In2
)
1297 return 1/(ph
[1]*wm
.value
)
1301 #flash calculation given pressure and entropy
1302 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,h.value,cv.value,cp.value,w.value
1303 ps
= PSFLSH(In1
, In2
)
1304 return 1/(ps
[1]*wm
.value
)
1306 #***************************************************************************
1307 #1.7 Specific entropy (s)
1308 #***************************************************************************
1328 #flash calculation given temperature and pressure
1329 #return D.value,Dl.value,Dv.value,q.value,e.value,h.value,s.value,cv.value,cp.value,w.value
1330 tp
= TPFLSH(In2
, In1
)
1335 #flash calculation given pressure and enthalpy
1336 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,s.value,cv.value,cp.value,w.value
1337 ph
= PHFLSH(In1
, In2
)
1342 #***************************************************************************
1343 #*1.17 Vapour fraction
1344 #***************************************************************************
1348 #flash calculation given pressure and enthalpy
1349 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,s.value,cv.value,cp.value,w.value
1350 ph
= PHFLSH(In1
, In2
)
1355 #flash calculation given pressure and entropy
1356 # return t.value,D.value,Dl.value,Dv.value,q.value,e.value,h.value,cv.value,cp.value,w.value
1357 ps
= PSFLSH(In1
, In2
)
1360 ############################ END REFPROP FOR UCycLe TEST #########################'''
1364 #####################################################
1366 #####################################################
1368 if __name__ == '__main__':
1370 # setup for single fluid
1382 # SETMIX('R407C.MIX')
1384 # H = GETMIXHEADER('R407C.MIX')
1387 print 'wm=%0.3f g/mol'%(wm) # la masse
1388 tf,dl,dv=SATP(0,3) # get freezing point
1389 tc,pc,Dc=CRITP() # get critical point
1390 print 'tc=%0.2f C pc=%0.0fkPa Dc=%0.1fkg/m3'%(tc-k0,pc,Dc*wm)
1396 #print 'tl=%0.2f C Dl=%0.1fkg/m3 hl=%0.2fkJ/kg sl=%0.3fkJ/kg-K'%(tl-k0,dl*wm.value,hl/wm.value,sl/wm.value)
1403 #print 'tl=%0.2f C tv=%0.2f C Dl=%0.1fkg/m3 hl=%0.2fkJ/kg hv=%0.2fkJ/kg'%(tl-k0,tv-k0,dl*wm.value,hl/wm.value,hv/wm.value)