You are on page 1of 11

# LiBrH2O Library of EES

function massfraction_LiBrH2O(x)
{massfraction_LiBrH2O
massfraction_LiBrH2O returns the weight fraction of lithium bromide in a solution of
lithium bromide in water given the mole fraction, x}
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
massfraction_LIBrH2O=x*MW_LiBr/(x*MW_LiBr+(1-x)*MW_H2O)
end
function molefraction_LiBrH2O(w)
{molefraction_LiBrH2O
molefraction_LiBrH2O returns the mole fraction of lithium bromide in a solution of
lithium bromide in water given the mass fraction, w}
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
molefraction_LIBrH2O=w/MW_LiBr/(w/MW_LiBr+(1-w)/MW_H2O)
end
function P_LiBrH2O(T,x)
{\$P_LiBrH2O
P_LiBrH2O returns the pressure above a lithium bromide-water mixture at the given the
temperature and composition using the formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
T is the temperature C, K, F or R.
x is the mass fraction of lithium bromide if EES is configured to return properties in
mass units. It is the mole fraction if EES is configured for molar units.
P_LiBr is returned in units of Pa, kPa, MPa, bar, psia, or atm, depending on the EES unit
settings}
a[1..8]=[-2.41303e2, 1.91750e7, -1.75521e8, 3.25432e7, 3.92571e2, -2.12626e3,
1.85127e8, 1.91216e3]
m[1..8]=[3,4,4,8,1,1,4,6]
n[1..8]=[0,5,6,3,0,2,6,0]
t[1..8]=[0,0,0,0,1,1,1,1]
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
T_c=647.096 [K]
T_0=221 [K]
h_c = 37548.5 [J/gmol] "Enthalpy at the critical point for pure water"
T\$=UnitSystem\$('Temperature')
TK=convertTemp(T\$,K,T) "convert to K"
molef=x
if (UnitSystem('mass')=1) then x=molefraction_LiBrH2O(x)
i=0
s=0
repeat
i=i+1
s=s+a[i]*x^m[i]*abs(0.4-x)^n[i]*(TK/T_c)^t[i]
until (i>=8)
Theta=TK-s

Ts=convertTemp(K,T\$,Theta)
P\$=UnitSystem\$('Pressure')
P_LiBrH2O=pressure(Water,T=Ts,x=0)
end
function h_LiBrH2O(T,x)
{\$h_LiBrH2O
h_LiBrH2O returns the specific enthalpy given the temperature and composition using
the formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
T is the temperature C, K, F or R.
x is the mass fraction of lithium bromide if EES is configured to return properties in
mass units. It is the mole fraction if EES is configured for molar units.
h_LiBr is returned in units of kJ/kg, J/kg, Btu/lb_m, kJ/kmol, J/kmol, or Btu/lbmol,
depending on the EES unit settings}
a[1..30]=[2.27431,-7.99511, 385.239,-16394,-422.562,0.113314,-8.33474,17383.3,6.49763,3245.52,-13464.3,39932.2,-258877,-0.00193046,2.80616,40.4479,145.342,-2.74873,-449.743,-12.1794,0.00583739,0.233910,0.341888,8.85259,-17.8731,0.0735179,0.000179430,0.00184261,-0.00624282,0.00684765]
m[1..30]=[1,1,2,3,6,1,3,5,4,5,5,6,6,1,2,2,2,5,6,7,1,1,2,2,2,3,1,1,1,1]
n[1..30]=[0,1,6,6,2,0,0,4,0,4,5,5,6,0,3,5,7,0,3,1,0,4,2,6,7,0,0,1,2,3]
t[1..30]=[0,0,0,0,0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5]
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
T_c=647.096 [K]
T_0=221 [K]
h_c = 37548.5 [J/gmol] "Enthalpy at the critical point for pure water"
T\$=UnitSystem\$('Temperature')
H\$=UnitSystem\$('Energy')
TK=convertTemp(T\$,K,T) "convert to K"
if (UnitSystem('mass')=1) then x=molefraction_LiBrH2O(x)
i=0
s=0
repeat
i=i+1
s=s+a[i]*x^m[i]*abs(0.4-x)^n[i]*(T_c/(TK-T_0))^t[i]
until (i>=30)
h_w=Enthalpy(Water,T=T,x=0)
h_w=h_w*convert(H\$,J/kg)
if (UnitSystem('mass')=1) then h_w=h_w*MolarMass(Water)
h_w=h_w*convert(J/kmol,J/gmol)
h_molar=(1-x)*h_w+h_c*s
h_LiBrH2O=h_molar
MW=((x*MW_LiBr+(1-x)*MW_H2O)*1000)
if (UnitSystem('mass')=1) then h_LiBrH2O=h_molar/MW
h_LiBrH2O=h_LiBrH2O*convert(kJ/kg,H\$)
end
function Cp_LiBrH2O(T,X)

{\$Cp_LiBrH2O
Cp_LiBrH2O returns the Isobaric heat capacity given the temperature and composition
using the formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
T is the temperature in C, K, F or R.
x is the mass fraction of lithium bromide if EES is configured to return properties in
mass units. It is the mole fraction if EES is configured for molar units.
Cp_LiBr is returned in units of kJ/kg-K, J/kg-K, Btu/lb_m-R, kJ/kmol-K, J/kmol-K, or
Btu/lbmol-K, depending on the EES unit settings}
a[1..8]=[-14.2094,40.4943,111.135,229.980,1345.26,-0.0141010,0.0124977,0.000683209]
m[1..8]=[2,3,3,3,3,2,1,1]
n[1..8]=[0,0,1,2,3,0,3,2]
t[1..8]=[0,0,0,0,0,2,3,4]
Cp_t = 76.0226 [J/gmol-K]
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
T_c=647.096 [K]
T_0=221 [K]
T\$=UnitSystem\$('Temperature')
H1\$='Btu'
if (UnitSystem('kJ')=1) then H1\$='kJ'
if (UnitSystem('J')=1) then H1\$='J'
if (UnitSystem('SI')=1) then
if (UnitSystem('molar')=1) then H2\$='kmol' else H2\$='kg'
else
if (UnitSystem('molar')=1) then H2\$='lbmol' else H2\$='lb_m'
endif
H\$=UnitSystem\$('Energy')
TK=convertTemp(T\$,K,T) "convert to K"
H3\$=concat\$(H\$,'-'); H3\$=concat\$(H3\$,T\$)
if (UnitSystem('mass')=1) then x=molefraction_LiBrH2O(x)
i=0
s=0
repeat
i=i+1
s=s+a[i]*X^m[i]*abs(0.4-X)^n[i]*(T_c/(TK-T_0))^t[i]
until (i>=8)
Cp_w=Cp(Water,T=T,x=0)
Cp_w=Cp_w*convert(H1\$,J)
if (UnitSystem('mass')=1) then Cp_w=Cp_w*MolarMass(Water)
Cp_w=Cp_w*convert(J/kmol,J/gmol)
Cp_molar=(1-X)*Cp_w+Cp_t*s
Cp_LiBrH2O=Cp_molar
MW=((x*MW_LiBr+(1-x)*MW_H2O)*1000)
if (UnitSystem('mass')=1) then Cp_LiBrH2O=Cp_LiBrH2O/MW
if (UnitSystem('J')=1) then Cp_LiBrH2O=Cp_LiBrH2O*convert(kJ,J)
if (UnitSystem('ENG')=1) then Cp_LiBrH2O=Cp_LiBrH2O*convert(kJ/kg-K,Btu/lb_m-R)
end
function s_LiBrH2O(T,x)

{\$s_LiBrH2O
s_LiBrH2O returns the specific entropy given the temperature and composition using
the formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
T is the temperature in C, K, F or R.
x is the mass fraction of lithium bromide if EES is configured to return properties in
mass units. It is the mole fraction if EES is configured for molar units.
s_LiBr is returned in units of kJ/kg-K, J/kg-K, Btu/lb_m-R, kJ/kmol-K, J/kmol-K, or
Btu/lbmol-K, depending on the EES unit settings}
a[1..29]=[1.53091,-4.52564, 698.302,-21666.4,-1475.33,0.0847012,-6.59523,29533.1,0.00956314,-0.188679,9.31752,5.78104,13893.1,-17176.2,415.108,-55564.7,0.00423409,30.5242,-1.67620,14.8283,0.00303055,-0.0401810,0.149252,2.59240,0.177421,-0.0000699650,0.000605007,-0.00165228,0.00122966]
m[1..29]=[1,1,2,3,6,1,3,5,1,2,2,4,5,5,6,6,1,3,5,7,1,1,1,2,3,1,1,1,1]
n[1..29]=[0,1,6,6,2,0,0,4,0,0,4,0,4,5,2,5,0,4,0,1,0,2,4,7,1,0,1,2,3]
t[1..29]=[0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5]
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
T_c=647.096 [K]
T_0=221 [K]
s_c = 79.3933 [J/gmol-K]
T\$=UnitSystem\$('Temperature')
H1\$='Btu'
if (UnitSystem('kJ')=1) then H1\$='kJ'
if (UnitSystem('J')=1) then H1\$='J'
H\$=UnitSystem\$('Entropy')
TK=convertTemp(T\$,K,T) "convert to K"
if (UnitSystem('mass')=1) then x=molefraction_LiBrH2O(x)
i=0
s=0
repeat
i=i+1
s=s+a[i]*x^m[i]*abs(0.4-x)^n[i]*(T_c/(TK-T_0))^t[i]
until (i>=29)
s_w=entropy(Water,T=T,x=0)
s_w=s_w*convert(H1\$,J)
if (UnitSystem('mass')=1) then s_w=s_w*MolarMass(Water)
s_w=s_w*convert(J/kmol-K,J/gmol-K)
s_molar=(1-x)*s_w+s_c*s
s_LiBrH2O=s_molar
MW=((x*MW_LiBr+(1-x)*MW_H2O)*1000)
if (UnitSystem('mass')=1) then s_LiBrH2O=s_LiBrH2O/MW
if (UnitSystem('J')=1) then s_LiBrH2O=s_LiBrH2O*convert(kJ,J)
if (UnitSystem('ENG')=1) then s_LiBrH2O=s_LiBrH2O*convert(kJ/kg-K,Btu/lb_m-R)
end
function rho_LiBrH2O(T,X)
{\$rho_LiBrH2O
rho_LiBrH2O returns the density given the temperature and composition using the
formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)

## The function operates with the unit setting in EES.

T is the temperature C, K, F or R.
x is the mass fraction of lithium bromide if EES is configured to return properties in
mass units. It is the mole fraction if EES is configured for molar units.
rho_LiBr is returned in units of kg/m^3, kmol/m^3, lb_m/ft^3, or lbmol/ft^3 depending
on the EES unit settings}
a[1..2]=[1.746,4.709]
m[1..2]=[1,1]
t[1..2]=[0,6]
rho_c = 17873 [gmol/m^3] "density for water at the critical point"
MW_LiBr=0.08685 [kg/gmol]
MW_H2O=0.018015 [kg/gmol]
T_c=647.096 [K]
T_0=221 [K]
T\$=UnitSystem\$('Temperature')
TK=convertTemp(T\$,K,T)
if (UnitSystem('mass')=1) then x=molefraction_LiBrH2O(x)
if (UnitSystem('SI')=1) then
if (UnitSystem('molar')=1) then H\$='kmol/m^3' else H\$='kg/m^3'
else
if (UnitSystem('molar')=1) then H2\$='lbmol/ft^3' else H2\$='lb_m/ft^3'
endif
rho_sat=Density(Water,T=T,x=0) "mass density of water for saturated liquid state"
if (UnitSystem('SI')=1) then
R\$='kmol/m^3'
if (UnitSystem('mass')=1) then
rho_sat=rho_sat/MolarMass(Water)
R\$='kg/m^3'
endif
else
rho_sat=rho_sat*convert(lbm/ft^3,kg/m^3)
R\$='lbmol/ft^3'
if (UnitSystem('mass')=1) then
rho_sat=rho_sat/MolarMass(Water)
R\$='lb_m/ft^3'
endif
endif
i=0
s=0
repeat
i=i+1
s=s+a[i]*(X^m[i])*((TK/T_c)^t[i])
until (i>=2)
rho_sat_molar=rho_sat*1000 "convert to gmol/m^3"
d_molar=(1-X)* rho_sat_molar+rho_c*s
MW=((x*MW_LiBr+(1-x)*MW_H2O)*1000)
rho_LiBrH2O=d_molar/1000 "kmol/m^3"
if (UnitSystem('mass')=1) then rho_LiBrH2O=rho_LiBrH2O*MW
if (UnitSystem('Eng')=1) then rho_LiBrH2O=rho_LiBrH2O*convert(kg/m^3,lb_m/ft^3)
end
function Visc_LiBRH2O(T,x)

{\$Visc_LiBrH2O returns the viscosity of solutions of lithium bromide and water based
on the method described in:
Lee, R.J., DiGuilio, R.M., Jeter, S.M., and Teja, A.S.,
Properties of Lithium Bromide-Water Solutions at High Temperatures and
Concentrations- II Density and Viscosity,
ASHRAE Transactions, Paper 3381, RTP-527, pp. 709-714}
T\$=UnitSystem\$('Temperature')
TK=convertTemp(T\$,K,T)
if (TK<295) or (TK>475) then call Warning('The allowable temperature range for the
visc_LiBrH2O function is 295 K to 475 K')
w=x*100
if (UnitSystem('Molar')=1) then w=massfraction_LiBrH2O(x)*100
if (W<45) or (W>65) then call Warning('The allowable LiBr concentration range for the
visc_LiBrH2O function is between 0.45 and 0.65 mass fraction')
A1=-494.122+16.3967*W-0.14511*(W^2)
A2=28606.4-934.568*W+8.52755*(W^2)
A3=70.3848-2.35014*W+0.0207809*(W^2)
lnmu=A1+A2/TK+A3*ln(TK)
V=exp(lnmu)*0.001 {Pa-s}
V\$=UnitSystem\$('Viscosity')
Visc_LiBrH2O=V*convert(Pa-s,V\$)
end
function Cond_LiBRH2O(T,x)
{\$Cond_LiBrH2O returns the thermal conductivity of solutions of lithium bromide and
water based on the method described in:
Lee, R.J., DiGuilio, R.M., Jeter, S.M., and Teja, A.S.,
Properties of Lithium Bromide-Water Solutions at High Temperatures and
Concentrations- I Thermal Conductivity,
ASHRAE Transactions, Paper 3380, RP-527, pp. 702-708}
T\$=UnitSystem\$('Temperature')
TK=convertTemp(T\$,K,T)
if (TK<295) or (TK>475) then call Warning('The allowable temperature range for the
visc_LiBrH2O function is 295 K to 465 K')
W=x*100
if (UnitSystem('Molar')=1) then W=massfraction_LiBrH2O(x)*100
if (W<30) or (W>65) then call Warning('The allowable LiBr concentration range for the
visc_LiBrH2O function is between 0.30 and 0.65 mass fraction')
A1=-1407.53+11.0513*TK-1.46741e-2*(TK^2)
A2=38.9855-0.240475*TK+3.48073e-4*(TK^2)
A3=-0.265025+1.51915e-3*TK-2.32262e-6*(TK^2)
C=(A1+A2*W+A3*(W^2))*0.001 {W/m-K}
C\$=UnitSystem\$('Conductivity')
Cond_LiBrH2O=C*convert(W/m-K,C\$)
end
Subprogram LiBrCalcTfromPX(P,x:T)
TC=T_crit(Water)-0.1 {V8.582, V8.667}
TL=TC-447 {V8.583}
TG=(TC+TL)/2 {V9.122}
P=P_LiBrH2O(T,x)
end
Subprogram LiBrCalcxfromTP(T,P:x)
P=P_LiBrH2O(T,x)

end
function T_LiBrH2O(P,x)
{\$T_LiBrH2O
T_LiBrH2O returns the temperature of a lithium bromide-water mixture at the given the
pressure and composition using the formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
P is in units of Pa, kPa, MPa, bar, psia, or atm, depending on the EES unit settings
x is the mass fraction of lithium bromide if EES is configured to return properties in
mass units. It is the mole fraction if EES is configured for molar units.
T returned in units of C, K, F or R.
}
T\$=UnitSystem\$('Temperature')
P\$=UnitSystem\$('Pressure')
call LiBrCalcTfromPx(P,x:T)
T_LiBrH2O=T
end
function x_LiBrH2O(T,P)
{\$x_LiBrH2O
x_LiBrH2O returns the composition of a lithium bromide-water mixture at the given the
temprature and pressure using the formulation presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
T is in units of C, K, F or R.
P is in units of Pa, kPa, MPa, bar, psia, or atm, depending on the EES unit settings
x_LIBRH2O is the mass fraction of lithium bromide if EES is configured to return
properties in mass units. It is the mole fraction if EES is configured for molar units.}
T\$=UnitSystem\$('Temperature')
P\$=UnitSystem\$('Pressure')
call LiBrCalcxfromTP(T,P:x)
x_LiBrH2O=x
end
procedure Q_LiBrH2O(h,P,z: Q,T, x)
{\$Q_LiBrH2O
Q_LiBrH2O returns the quality, temperature, and liquid composition of a lithium
bromide-water mixture at the given the specific enthapy, pressure, and overall
composition of both phases. The procedure relies on correlations presented by
Patek and Klomfar, Int. J. of Refrigeration, Vol 29, pp. 566-578, (2006)
The function operates with the unit setting in EES.
T is in units of C, K, F or R.
P is in units of Pa, kPa, MPa, bar, psia, or atm, depending on the EES unit settings
x_LIBRH2O is the mass fraction of lithium bromide if EES is configured to return
properties in mass units. It is the mole fraction if EES is configured for molar units.}
T\$=UnitSystem\$('Temperature')
P\$=UnitSystem\$('Pressure')
h\$=UnitSystem\$('Energy')
Q=-100"subcooled"
x=z

T=T_LiBrH2O(P, x)
hL=h_LiBrH2O(T,x)
if (h=hL) then Q=0
if (h<=hL) then return
Q=0.1
It=1
repeat
It=It+1
Qlast=Q
x=z/(1-Q)
T=T_LiBrH2O(P, x)
hL=h_LiBrH2O(T,x)
if (h>hL) then
hv=enthalpy(Water,T=T,x=1)
hfg=hv-hL
Q=(h-hL)/(hfg)
{qq=(x-z)/x}
else
Q=0
endif
until (abs(Q-Qlast)<0.00001) and (iT>5) or (iT>100)
end
{9/11/09 Added T_LiBrH2O SAK}
{9/13/09 Added x_LiBrH2O and changed x_LiBrH2O to molefraction_LiBrH2O, and w to
massfraction_LiBrH2O}
{1/6/10 Fixed units for CP_LIBRH2O}
{1/6/10 Added protection against negative value raised to power by using abs(0.4-x)}
{6/1/10 Added upper limit of Tc on T in subprogram LiBrCalcTfromPX}
{6/4/10 Added Q_LiBRH2O}
{6/30/10 Changed defn of hfg in Q_LiBRH2O}
{9/12/10 Changed upper bound for T in LIBrCalcTfrom PX}
{9/27/10 h, cp, and s were not properly converted into English units}
{9/30/10 rho was not properly converted into English units}
{4/22/12 Subprogram that calculates T from PX had a typo in the upper bound for T}

## NH3H2O (Ammonia-Water) Properties

The NH3H2O procedure provides the thermodynamic properties of ammonia-water
mixtures in subcooled, saturated and superheated conditions. The procedure is
called from EES by the statement:

## CALL NH3H2O(Code,In1,In2,In3: T,P,x,h,s,u,v,q)

The 4 parameters to the left of the colon are inputs to the procedure; the eight
values to the right are outputs whose values are set by the NH3H2O procedure.
The NH3H2O routine used the following properties which must be in the
designated units.
T=[K]
P=[bar]
x=[ammonia mass fraction]
h=[kJ/kg]
s=[kJ/kg-K]
u=[kJ/kg],
v=[m3/kg]
q=[vapor mass fraction]

For saturated states, 0<=q<=1. Subcooled states are indicated with q=-0.001;
superheated states have q=1.001.

Code is a 3 digit integer indicating which of the 8 possible properties are provided
as input values. For example, a Code value of 123 indicates that the values of
properties 1,2, and 3 are provided in inputs In1, In2, and In3, respectively. The
property numbers correspond to their positions in the outputs. Properties 1,2, and
3 are thus temperature (T), pressure (P), and ammonia mass fraction(x).

Currently, NH3H2O supports Code values of 123, 128, 137, 138, 148, 158, 168,
178, 234, 235, 238, 248, 258, 268, and 278. However, one (or more) output values
can be fixed and EES will determine the corresponding input values in an iterative
solution. In this way, EES can determine the properties of ammonia-water given
any three independent properties.

Example:

T=450 [K]
P=10 [bar]
x=0.5
CALL NH3H2O(123,T,P,x: T,P,x,h,s,u,v,q)

"123=> T,P,x"

After solving, the arrays window will display the following results:

## The NH3H2O procedure is an example of an EES external procedure. This

procedure has been separately compiled (in Fortran, C, Pascal, etc.) and copied
into EES as a dynamically linked procedure .DLF file. The user may add any
functions or procedures in this way, extending the capability of EES. See the
manual for details.

## Ibrahim, O.M., Klein, S.A.,

"Thermodynamic Properties of Ammonia-Water Mixtures,"
ASHRAE Trans.: Symposia, 21, 2, 1495 (1993).

__________________________________________________________________
____________

Newer and more accurate correlations for ammonia-water mixture properties are
provided in the NIST REFPROP 9 program. REFPROP includes the correlation
developed by:

Reiner Tillner Roth, J. Phys. Chem. Ref. Data, Vol. 27 No. 1 (1998).

## Information on REFPROP is available at http://www.nist.gov/srd/nist23.cfm

Note that f-Chart Software provides an interface between EES and REFPROP so
that you can continue to use EES while accessing the NIST REFPROP data base.
See http://fchart.com/ees/ees-refprop.php for more information.