xlUNIFAC , a Computer Program for Calculation of Liquid ...randhol/xlunifac/report.pdf · xlUNIFAC...
Transcript of xlUNIFAC , a Computer Program for Calculation of Liquid ...randhol/xlunifac/report.pdf · xlUNIFAC...
xlUNIFAC, a Computer Program for Calculation of
Liquid Activity Coe�cients Using the UNIFAC Model
by
Preben Randhol and Hilde K. Engelien
20th June 2000
Abstract
A program called xlUNIFAC has been developed for the calculation of activitycoe�cient using the UNIFAC model reported by Fredenslund et. al. [1].
It gives the user the ability to add and edit the group volume and area parametersas well as the interaction parameters. The user can also de�ne new components andadd new subgroups and main groups to the model.
The program developed also gives the calculated values of the various variables inthe equations for the user to inspect. This will hopefully give the user a betterunderstanding of the UNIFAC model.
Contents
1 Introduction 1
2 Theory 2
2.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 UNIFAC groups and parameters . . . . . . . . . . . . . . . . . . . . 5
2.4 Application of the model . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 The Program 9
3.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Results 10
5 Discussion 13
6 Conclusion 15
References 16
Notations 17
A xlUNIFAC User Guide 18
A.1 Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
A.1.1 Intermediate Calculations . . . . . . . . . . . . . . . . . . . . 20
A.2 De�ning New Components . . . . . . . . . . . . . . . . . . . . . . . . 21
A.3 Adding a New Subgroup . . . . . . . . . . . . . . . . . . . . . . . . . 22
A.4 Adding Interaction Parameters . . . . . . . . . . . . . . . . . . . . . 23
B Source Code 24
List of Figures
2.1 The division of the components acetone and benzene into functionalgroups de�ned by the UNIFAC model. Acetone consists of the sub-groups CH3 and CH3C=O and benzene consists of 6 ACH subgroups. 6
2.2 Schematic representation of how the subgroups are grouped into maingroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1 Comparison between the calculated and measured activity coe�-cients of the n-pentane-acetone system at 306K. The lines are thecalculated values, the diamond markers, �, are the measured activitycoe�cients of n-pentane (1) and the open squared markers, �, arefor acetone (2). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 Comparison between the combinatorial and residual part of the ac-tivity coe�cients of the system n-pentane-acetone at 306K. The n-pentane (1) data is given by the solid lines while the acetone (2) isgiven by the dashed lines. The lower lines are from the combinatorialpart and the steeply rising lines are the residual part. . . . . . . . . . 12
5.1 Three di�erent arrangement of functional groups that could be pos-sible for acetone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
A.1 The tabs here are: xlUNIFAC, Introduction, Calculation, De�ne Com-ponent. To jump to say the �De�ne Component� worksheet click onthe tab with that name. If the tab you are looking for is not visibleuse the arrows to the left of the tabs to scroll the row of tabs to theleft or right until it is visible . . . . . . . . . . . . . . . . . . . . . . . 18
A.2 The calculation worksheet. Here you de�ne the components, molefractions and temperature of the mixtures you want to calculate theactivity coe�cients of. The activity coe�cient is then given in thetables marked ln γi and γi below. . . . . . . . . . . . . . . . . . . . . 19
A.3 De�ning the components by either clicking on the arrow button andchoose the component from the pre-de�ned list or click in the �eldleft of the button to start typing the name until the component appears. 19
A.4 You cannot skip a row when de�ning the components. In this examplethe program will only read the acetone data and compute the activitycoe�cients of acetone. . . . . . . . . . . . . . . . . . . . . . . . . . . 20
A.5 The name of the component is added in the empty yellow �eld to theright of �Name:� and the subgroups are de�ned in the row below bywriting their names and number. The table is found in the worksheet�De�ne Component� . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
A.6 The de�nition of acetone in subgroups. The subgroups are 1 CH 3
and 1 CH3C=O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
A.7 A section of the Rk, Qk table in the �Table Rk,Qk� worksheet. . . . . 22
A.8 The amn interaction table in the �Table Interaction� worksheet. Saythe main group m is ACH and n is CH2, then amn = −11.12 andanm = 61.13 thus amn 6= anm . . . . . . . . . . . . . . . . . . . . . . 23
List of Tables
2.1 Group volume and surface area parameters, Rk, Qk for various sub-groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Main group interaction parameters, amn, anm . . . . . . . . . . . . . 7
4.1 The worksheets in the program and their purpose. . . . . . . . . . . 10
4.2 Activity coe�cients are calculated for several di�erent systems andcompared with measured data from Fredenslund et al. [9]. . . . . . . 11
B.1 The Visual Basic functions that was programmed and their purpose. 24
1 Introduction
In the chemical industry, especially in separation, there is a great need for describ-ing vapour-liquid equilibria for multi-component mixtures. This equilibria can beexpressed by the vapour phase fugacity and the liquid phase activity coe�cient.Experimental mixture data is needed to calculated the activity coe�cients. Thereis a large variety of liquid mixtures in the chemical industry and it is therefore de-sirable to correlate a limited amount of experimental data so as to calculate activitycoe�cients for mixtures where little or no data is available. The group contributionmethod provide such a procedure.
The objective of the group contribution methods is to enable the prediction of phaseequilibrium data for a very large number of possible mixtures of interest from thecontribution of relatively few functional groups which make up the compounds. TheUNIFAC model for estimating liquid phase activity coe�cients that was developedin 1975 by Fredenslund et. al [1] is such a group contribution method and also themodel that is probably most useful for process design.
There are a number of applications where UNIFAC can be used and one importantexample is in the design of distillation columns. The advantages of using UNIFACis mainly that of predicting phase equilibria for systems where no or insu�cientexperimental data are available.
Since the development of the UNIFAC model extensive work has been carried out toreview and develop the model; there have been several additions and new estimationsof the UNIFAC parameters, e.g. Skjold-Jørgensen et. al. [3], Tiegs et. al. [4].
The objective of this project has been to develop a program in Excel 1 for calculatingthe liquid activity coe�cients from the UNIFAC model. The program lets theuser select mixtures of up to 15 components. It is also possible to calculate 5di�erent mixtures of the selected components simultaneously. The program alsoallows the user to add and edit components as necessary using the UNIFAC subgroupde�nition. The user may also add and edit interaction-, group volume- and grouparea-parameters.
The program is intended for further use by students in the Applied Thermodynamicscourse at the Faculty of Chemistry and Biology at NTNU.
1Excel is a trademark of Microsoft Coroperation
1
2 Theory
2.1 Background
UNIFAC is a group contribution method that combines the solution of functionalgroups concept and the UNIQUAC model. The latter is a model for calculatingactivity coe�cients. UNIQUAC is a generalisation of Guggenheim's quasi-chemicalanalysis.
The idea of the group contribution method is that a molecule consists of di�er-ent functional groups and that the thermodynamic properties of a solution can becorrelated in terms of the functional groups.
The advantage of this method is that a very large number of mixtures can bedescribed by a relatively small number of functional groups.
2.2 Model
The UNIFAC model is developed as a combination of the UNIQUAC (UniversalQuasi-Chemical) model and the solution of functional groups concept.
The solution of functional groups concept is a �exible method with a large rangeof applicability. Instead of considering a liquid as a solution of molecules it isconsidered as a solution of groups where the groups are structural units or buildingblocks such as CH3, OH, CH (see Figure 2.1). These building blocks form themolecule. In the group contribution method it is assumed that a physical propertyof a �uid is the sum of the contributions made by the molecules' functional groups.So, the activity coe�cients are determined by the properties of the groups ratherthan by the properties of the molecules.
The total Gibbs free energy function is the sum of the Gibbs free energy from theideal situation and the excess Gibbs free energy. UNIFAC is a method to calculateactivity coe�cients so only the non-ideal contribution is of interest. The excessGibbs free energy can then be de�ned as the di�erence between the real Gibbs freeenergy and the ideal Gibbs free energy at the actual conditions:
GE ≡ G(actual solution at T, P and x) −G(ideal solution at T, P and x)
The excess Gibbs free energy function of UNIFAC can be divided into a combinato-rial part and a residual part, see equation (2.1). The combinatorial part, equation(2.2), provides the contribution due to di�erences in size and shape of the molecules
2
in the mixture and the residual part, equation (2.3), is essentially due to energyinteractions between the groups.
(gE
RT
)T, P
=(gE
RT
)combinatorial
+(gE
RT
)residual
(2.1)
(gE
RT
)combinatorial
=∑
i∈Componentsxi
{− lnxi +
[1− z
2qi
]lnφi +
z
2qi ln θi
}(2.2)
(gE
RT
)residual
=∑
i∈Componentsxi
∑k∈Groups
v(i)k
{ln Γk + ln Γ(i)
k
}(2.3)
The activity coe�cients are a measure of the deviation from ideality. Hence for anideal liquid the activity coe�cients are equal to unity. The activity coe�cients canbe de�ned from the excess molar Gibbs energy as:
(δnT g
E
δni
)T,P,nj ; i6=j
= RT ln γi
Thus the activity coe�cient can also be divided into a combinatorial and a residualpart as given in equation (2.4).
ln γi = ln γC + ln γR (2.4)
The combinatorial part is taken from the UNIQUAC model by Abrams and Praus-nitz [5]. Only pure component properties are used in this equation. The combina-torial part is expressed as :
ln γCi = lnΦi
xi+
z
2qi ln
θiΦi
+ li −Φi
xi
∑j
xjlj (2.5)
where li = z2(ri−qi)− (ri−1), θi is the average surface fraction de�ned by equation
(2.6) and Φi is the average segment fraction de�ned by equation (2.7).
θi =qixi∑j qjxj
(2.6)
3
Φi =rixi∑j rjxj
(2.7)
The parameter z is the lattice coordination number which depend on how themolecules are packed. It may have a value between 6 and 12. However for liq-uids at ordinary conditions it is found empirically that z is close to 10, accordingto Prausnitz et. al. [2]
The parameters ri and qi are pure component parameters and are measures ofmolecular van der Waals volumes and molecular surface areas respectively. For theUNIFAC model they are calculated as the sum of the group volume and group areaparameters, Rk and Qk as given in equations (2.8) where v
(i)k is the number of groups
of type k in molecule i. The group parameters Rk and Qk are obtained from thevan der Waals group volumes and surface areas [6].
ri =∑k
v(i)k Rk; qi =
∑k
v(i)k Qk (2.8)
In the UNIFAC model the residual part of the activity coe�cient is replaced by asolution of groups concept. The residual part is expressed as :
ln γRi =∑
k∈groupsv
(i)k
(ln Γk − ln Γ(i)
k
)(2.9)
where Γk is the group residual activity coe�cient and Γ(i)k is the group residual
activity coe�cient of group k in a reference solution containing only moleculesof type i. The term Γ(i)
k is needed to obtain the normalisation that the activitycoe�cient γi becomes unity as xi → 1.
The group residual activity coe�cient is given in equation (2.10) where the sumsare over all di�erent groups in the mixture. θm is the area fraction of group m andde�ned in equation (2.11). Xm is the mole fraction of group m in the mixture.
ln Γk = Qk
[1− ln
(∑m
θmΨmk
)−∑m
θmΨkm∑n θnΨnm
](2.10)
θm =QmXm∑nQnXn
(2.11)
4
Xm =∑
i v(i)m xi∑
i
∑k v
(i)k xi
(2.12)
The group interaction parameter ψmn is given in equation (2.13) where Umn isthe interaction energy between the groups m and n. Parameter amn is the groupinteraction parameter for groups m and n. There are two parameters for eachgroup-group interaction, amn and anm, where amn 6= anm. The group interactionparameters are evaluated from experimental phase equilibria data.
ψmn = exp(−Umn − Unn
RT
)= exp
(−amn
T
)(2.13)
The equation for Γk can also be used for calculating Γ(i)k except that the group
composition variable θk is changed to be the group fraction of group k in pure�uid i.
2.3 UNIFAC groups and parameters
The UNIFAC model de�nes two di�erent groups; subgroups and main groups. Sub-groups are the smallest �building blocks� and the main groups are used to groupsubgroups together, see Figures 2.1 and 2.2. The reason for this is that thoughthe subgroups have di�erent volume and surface area parameters, the interactionparameters are the same for all subgroups within a main group.
There are three types of parameters needed for the UNIFAC model: group volumeparameters, Rk, group surface area parameters, Qk, and group interaction parame-ters, amn and anm (here the indices k, m, and n signi�es di�erent groups).
Table 2.1 lists a few examples of UNIFAC subgroups and their parameters. Exam-ples of main group interaction parameters are listed in Table 2.2.
The parameters for the model have been published for various speci�c group inter-actions. The parameters are normally based on experimental vapour-liquid equilib-rium data and can be found in references such as Tiegs et. al. [4], Reid et. al. [6].There is also the Dortmund Data Bank which contains all published experimentalvapour-liquid equilibrium data [7]. This data bank is constantly being updated andcontains all new experimental data.
5
ENZENEB
HC
HC
CH
CH
CH
CH
CETONEA
CH3
CH3
C=O
Figure 2.1: The division of the components acetone and benzene into functionalgroups de�ned by the UNIFAC model. Acetone consists of the subgroups CH 3 andCH3C=O and benzene consists of 6 ACH subgroups.
CH2
CH3
CHC
CH2
Subgroups Main group
Figure 2.2: Schematic representation of how the subgroups are grouped into maingroups
6
Table 2.1: Group volume and surface area parameters, Rk, Qk for various sub-groups
Main Group Subgroup Rk Qk
1 CH2 CH3 0.9011 0.848CH2 0.6744 0.540CH 0.4469 0.228C 0.2195 0.000
2 C=C CH2=CH 1.3454 1.176CH=CH 1.1167 0.867CH2=C 1.1173 0.988CH=C 0.8886 0.676C=C 0.6605 0.485
3 ACH ACH 0.5313 0.400AC 0.3652 0.120
4 ACCH2 ACCH3 1.2663 0.968ACCH2 1.0396 0.660ACCH 0.8121 0.348
Table 2.2: Main group interaction parameters, amn, anm
Group 1 2 3 41 0 86.02 61.13 76.52 -35.36 0 38.81 74.153 -11.12 3.446 0 167.04 -69.7 -113.6 -146.8 0
7
2.4 Application of the model
According to Coulson [8], there are some limitations in the use of the UNIFACmodel and some speci�c limitations are:
• Pressure should not be greater than a few bar (limit of about 5 bar).
• Temperature should be below 150◦C.
• Calculations are only applicable to condensable nonelectrolytes.
• Components must not contain more than 10 functional group.
The restrictions on pressure is due to the assumption that (aE)T,V ≈ (gE)T,P atlow pressures. To derive the expression for the excess Gibbs energy of mixing, theexcess Helmholtz energy of mixing is used. The interaction parameters are assumedindependent of temperature. This is a approximation that is reasonable withina limited temperature range. The theory builds upon the energy released by acondensation process, so the the components should be condensable [2].
There are a number of applications where UNIFAC can be used and one importantexample is in the design of distillation columns as it can predict phase equilibria forsystems where no or insu�cient experimental data are present.
8
3 The Program
3.1 Background
The calculation of UNIFAC is relatively simple mathematically. It consists mainlyof summations and looking up values in di�erent tables. But to do the calculationsby hand is rather laborious and can easily lead to errors. The UNIFAC model isalso growing as more groups are added to it to widen its scope of calculation andaccuracy. A model with 50 main groups consists of 2450 interaction parametersalone, 100 main groups gives 9900 parameters. Therefore using a computer tocalculate the activity coe�cients will reduce the labour for the user greatly.
Another objective for developing the program was that it can be used in the AppliedThermodynamics course at the Faculty of Chemistry and Biology at NTNU.
3.2 Development
As mentioned previously, the program has been designed so that it can be used foreducational purposes also. Therefore, rather than just calculating and presentingthe activity coe�cients directly, the program also provides several tables with thevalues of the di�erent variables involved in the calculations. This will make theuser able to examine the in�uence of the di�erent variables on the activity coef-�cient. The development was done in a spreadsheet to better comply with thisobjective. Developing the program in this way also serve two other considerations;easier maintainability and the possibility to alter the UNIFAC model to newer ex-tended versions.
The program was also developed with scalability in mind. As mentioned earlier theUNIFAC model grows as more groups are added. Therefore it is possible for theuser to add more subgroups, main groups and parameters in the program. Newcomponents can also be added as needed by the user. The parameter tables canalso be altered as newer and better parameters are reported. The current upperlimits of the program are 200 subgroups, 100 main groups and 300 components, butthis can easily be extended by changing the program.
9
4 Results
The program contains the UNIFAC model as described in Section 2. The Rk, Qkand amn parameters are taken from Reid et al. [6]. This reference gives an extensivetabulation of the parameters with 47 main groups and 90 subgroups.
The program provides the calculation of the activity coe�cients for a mixture ofup to 15 di�erent components selected by the user from a database of pre-de�nedcomponents. The user can add more components as needed. The activity coe�cientscan be calculated simultaneously for 5 di�erent mixture of the selected componentsat a given temperature.
Table 4.1: The worksheets in the program and their purpose.
Worksheet name Purpose
xlUNIFAC Welcomes the user and shows the copyrightnotice with a link to the license.
Introduction A short introduction of the program.Calculation Where the values are entered and the activity
coe�cients are calculated.De�ne Component Where the components are de�ned.Table Rk,Qk Contains the table with the links between
main groups and subgroups as well as the Rkand Qk parameters of the subgroups.
Table Interaction Contains the table with the amn and anm in-teraction parameters for the main groups.
Calc Combinatorial Part Where the combinatorial part of the activitycoe�cients are calculated.
Calc Residual Part Where the Γk are calculated for the residualpart of the activity coe�cients.
Calc Residual Part (Pure) Where the Γ(i)k are calculated for the residual
part of the activity coe�cients.License Contains the license of the program.Table combobox This is a hidden worksheet used internally by
the program.
The Table 4.1 gives the Excel worksheets in the program. The Visual Basic func-tions that were programmed are given in Appendix B. The program returns thecalculated values of ln γi and γi, but it also gives calculations of the other variables,
10
see Appendix A for more information about this.
The program was tested by calculating activity coe�cients of various systems andthen comparing them to measured data. Table 4.2 gives activity coe�cients calcu-lated by the program and the measured values from Fredenslund et al. [9].
Table 4.2: Activity coe�cients are calculated for several di�erent systems andcompared with measured data from Fredenslund et al. [9].
Component Activity coe�cient γi
1 2 T [K] xi Calculated Measured
1-hexene hexane 333.2 0.121 1.05 1.022benzene hexane 298.2 0.100 1.48 1.550toluene methanol 337.2 0.034 6.41 7.453benzene methanol 363.2 0.144 3.71 3.729acetone hexane 318.2 0.100 3.82 3.368acetone benzene 318.2 0.096 1.41 1.436acetic acid heptane 293.2 0.084 6.92 6.731ethanol water 313.2 0.043 5.04 2.398water 2-propanol 328.2 0.141 2.61 2.9652-propanol water 328.2 0.046 9.15 7.706
Lo et al. [10] gives experimental activity coe�cients at various compositions of ann-pentane-acetone system. To test the program the activity coe�cients for thesecompositions were calculated. A comparison between the calculated results andmeasured data is given in Figure 4.1.
As the program also gives the values for the combinatorial and residual part it ispossible to see how they in�uence the activity coe�cients of the n-pentane-acetanesystem, see Figure 4.2.
11
1
1.5
2
2.5
3
3.5
4
4.5
5
0 0.2 0.4 0.6 0.8 1
activ
ity c
oeff
icie
nt
X1
γ1
γ2
Figure 4.1: Comparison between the calculated and measured activity coe�cientsof the n-pentane-acetone system at 306K. The lines are the calculated values, thediamond markers, �, are the measured activity coe�cients of n-pentane (1) and theopen squared markers, �, are for acetone (2).
-0.5
0
0.5
1
1.5
2
0 0.2 0.4 0.6 0.8 1
ln (
activ
ity c
oeff
icie
nt)
X1
Residual part
Combinatorial Part
1 2
Figure 4.2: Comparison between the combinatorial and residual part of the activitycoe�cients of the system n-pentane-acetone at 306K. The n-pentane (1) data is givenby the solid lines while the acetone (2) is given by the dashed lines. The lower linesare from the combinatorial part and the steeply rising lines are the residual part.
12
5 Discussion
The fundamental assumption of the group contribution method is additivity; thecontributions made by one group is assumed to be independent of that of anothergroup. This assumption is only valid when the in�uence of any one group in amolecule is not a�ected by the nature of other groups in that molecule Fredenslundet. al. [9].
When making a component using functional groups one looses the speci�c structuralinformation of that component. By doing this it is assumed that the functionalgroups are independent of each other and that a functional group has the samein�uence in all components in which it is present. So the group contribution methoddo not distinguish between 1-hexanone and 3-hexanone, i.e. where the carbonylgroup C=O is situated. This is of course not correct [2].
This creates a problem in de�ning the subgroups. If a larger subgroup is de�nedthen more structural information of the molecule can be included. If the groupdistinction is carried to the limit then the individual molecules are recovered andthe advantage of the group contribution method is lost as the number of parametersneeded in the calculation will be the same as the number of mixtures. It is thereforeimportant that the functional groups are de�ned so as to achieve a compromisebetween accuracy of prediction and engineering utility.
This can be illustrated by an example using acetone. The smallest possible func-tional groups would be two CH3 and one C=O group, see Figure 5.1a. The largestfunctional group would be the whole component which would make the UNIFACmodel more or less equal to the UNIQUAC model, see Figure 5.1c. The actual def-inition for acetone is one CH3 and one CH3C=O, see Figure 5.1b. This de�nitionretains some of the structural information of the component.
For some molecules it has been necessary to de�ne new subgroup or use the wholemolecule as the subgroup. Examples are benzene and water, respectively.
There exists a lot of di�erent extended versions of UNIFAC. Voutsas et. al. [11]gives a critical evaluation of some of these. These are developed to serve di�erentrequirements. Most of these increase the number of parameters needed, f.ex. in caseof dealing with polymers the free-volume contribution has to be accounted for [2].
The program developed uses the original UNIFAC model developed by Fredenslundet. al. [1]. The UNIFAC parameters used in the program is taken from Reid et.al. [6]. It should be noted that the parameters are continuously being updated andthat the user of the program must decide if any changes are required.
13
CH3
CH3
C=O
a)
CH3
CH3
C=O
b)
CH3
CH3
C=O
c)
Figure 5.1: Three di�erent arrangement of functional groups that could be possiblefor acetone.
The program, xlUNIFAC, has been developed in Excel. There are many advan-tages of using a spreadsheet for these calculations. As a spreadsheet is designedfor the calculations of data it is easy to present the intermediate calculations intables. This makes it easier for the user to follow the calculations. This is an ad-vantage if used for educational purposes to give the user a better understanding ofthe UNIFAC model.
A spreadsheet is also advantageous when working with large tables of data thatneeds to be updated and revised by the user. The data can be easily changed bythe user without much computer experience. If a similar UNIFAC model made in aprogramming language, e.g. Ada 95 or Fortran, should have the same �exibilityand user friendliness then great e�ort needs to be put into the programming.
A possible disadvantage of the program being so open to changes by the user is thatmistakes can give errors in the results or problems in the program, e.g. deletionof formulas etc. It is therefore recommended not to turn of the protection of theworksheets and keep a backup of the original program.
A disadvantage of using spreadsheets for this task can be that the calculationstakes longer time than a specialised program developed in another programminglanguage, e.g. Ada 95 or Fortran, would. However, the xlUNIFAC programseems to calculate at an adequate speed when ran on a relatively new computer.
The program provides the calculation of the activity coe�cients for a mixture of upto 15 di�erent components selected from a database of pre-made components. Theactivity coe�cients can be calculated simultaneously for 5 di�erent mixture of theselected components. These limitations are due to speed and size considerations.
The number of components which can be de�ned is limited to 300 and the numberof subgroups and main groups are limited to 200 and 100, respectively. All these�limitations� can be extended easily if needed. It should be noted that the currentparameter tables include data for 47 main groups and 90 subgroups.
14
6 Conclusion
A program called xlUNIFAC has been developed for the calculation of activitycoe�cient using the UNIFAC model reported by Fredenslund et. al. [1].
Calculations of the n-pentane-acetone system at 306K gives good agreement withmeasure activity coe�cients. Calculations of various other systems have also beenmade and the resulting activity coe�cients agreed well with measured data.
The program gives the user the ability to de�ne new components and add and alterparameter such as group volume, group area and interaction parameters. It alsoallows the user to add new main and subgroups.
The program also gives the calculated values of the various variables in the equationsfor the user to inspect. This will hopefully give the user a better understanding ofthe UNIFAC model.
The speed of the calculations is reasonable on relatively new computers.
15
References
[1] Fredenslund A., Jones, R.L., Prausnitz, J.M., �Group-Contribution Estimationof Activity Coe�cients in Nonideal Liquid Mixtures� , AIChE J., No. 6, Vol. 21,1086-1099, 1975
[2] Prausnitz, J.M., Lichtenthaler R.N., Azevedo E.G., �Molecular Thermodynam-ics of Fluid-Phase Equilibria� , 3rd ed, Prentice Hall PTR, 1999
[3] Skjold-Jørgensen, S., Kolbe, B., Gmehling, J., Rasmussen, P., �Vapor-LiquidEquilibria by UNIFAC Group Contribution. Revision and Extension� , Ind. Eng.,Chem. Process Des. Dev., Vol. 18, No. 4, 1979
[4] Tiegs, D., Rasmussen, P., Gmehling, J., Fredenslund, A., �Vapor-Liquid Equi-libria by UNIFAC Group Contribution. Revision and Extension 4� , Phase Equi-libria and Separation Processes, SEP 8508, 1985
[5] Abrams, D. S., Prausnitz, T. M. �Statistical Thermodynamics of Liquid Mix-tures: A New Expression for the Excess Gibbs Energy of Partly or CompletelyMiscible Systems� , AIChE J., Vol. 21, No. 1, 1975
[6] Reid, R.C., Prausnitz, B.E., Poling, B.E, �The Properties of Gases and Liq-uids� , 4th ed, McGraw-Hill, 1987
[7] Gmehling, J, �Vapor-liquid equilibrium data collection� , DECHEMA ChemistryData Series, Vol. 1, 1977
[8] Coulson, J.F, Richardson, J.M, �Chemical Engineering� , Vol. 6, revised 2nd ed,1996
[9] Fredenslund, A., Gmehling, J., Rasmussen, P., �Vapor-Liquid Equilibria usingUNIFAC� , Elsevier, 1977
[10] Lo, T.C., Beiber, H.H., Karr A.E., �Vapor-Liquid Equilibrium of n-Pentane-Acteone, J. Chem. Eng. Data, Vol. 7, No. 3, 327-331, 1962
[11] Voutsas, E. C., Tassios, D. P., �Prediction of In�nite-Dilution Activity Coef-�cients in Binary Mixtures with UNIFAC. A Critical Evaluation , Ind. Eng.Chem. Res. 35, 1438-1445, 1996
[12] Roman S., �Writing Excel Macros� , O'Reilly & Associates Inc., 1st ed, 1999
16
Notations
aE Helmholtz excess molar energyamn Binary interaction parameterΦ Average Segment fractionGE Gibbs excess energygE Gibbs excess molar energyΓk Group residual activity coe�cient of group k
Γ(i)k Group residual activity coe�cient of group k in a reference
solution containing only molecules of type iγi Activity coe�cient of component iγCi Combinatorial part of the activity coe�cient of component iγRi Residual part of the activity coe�cient of component ini Number of mole of molecule inT Total number of molesQk Group area parameter of group kqi Pure component area parameter of component iθ Average Area fractionRk Group volume parameter of group kri Pure component volume parameter of component iT TemperatureUmn Interaction energy between group m and nv
(i)k Number of groups of type k in molecule iXm Group mole fractionxi Mole fractionψ UNIFAC interaction parameterz Lattice coordination number
17
A xlUNIFAC User Guide
The program, xlUNIFAC, is an Excel workbook with some Visual Basic functionsto calculate activity coe�cients using the UNIFAC model. The workbook is dividedinto several worksheets. In order to jump to a speci�c worksheet just press on thetab on the bottom of the window with the name of the worksheet you seek, refer toFigure A.1. For instance if you want to look at the combinatorial calculations justpress the tab named �Calc Combinatorial Part�. If you do not see the tab you arelooking for you can scroll the row of tabs by pressing the arrows left of all the tabs,see Figure A.1, until the tab appears.
Figure A.1: The tabs here are: xlUNIFAC, Introduction, Calculation, De�ne Com-ponent. To jump to say the �De�ne Component� worksheet click on the tab withthat name. If the tab you are looking for is not visible use the arrows to the left ofthe tabs to scroll the row of tabs to the left or right until it is visible
A.1 Calculation
To calculate activity coe�cients you must �rst input the components, their molefractions and the temperature. To do this you have to go to the worksheet named�Calculation�, refer to Figure A.2
A mixture can contain up to 15 components. To specify a component you pressthe button with the arrow as shown in Figure A.3 and choose the component fromthe list. Note that the component must be pre-de�ned in the �De�ne Component�worksheet in order for it to show up on the list (refer to subsection A.2 for infor-mation how to do this). You can also click in the �eld to the left of the button andstart typing the name of the component until it appears in that �eld.
Note that when choosing the components you must start with the �rst row and godownwards without skipping any rows until all components have been selected, seeFigure A.4.
Now you can specify the mole fractions of the components. It is possible to inputup to 5 di�erent mixtures of the selected components. These will be calculatedsimultaneously. If you for a component choose a mole fraction equal to zero, it will
18
TemperatureNo Do not choose "[n/a]" 1 2 3 4 5
1 17 4.7000E-02 T = 307 K2 13 9.5300E-013 -14 -15 -16 -17 -18 -19 -1
10 -111 -112 -113 -114 -115 -1
ΣΣΣΣ( x_i ) 1.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
No 1 2 3 4 5 1 2 3 4 5
1 1.6078E+00 4.9920E+002 5.2464E-03 1.0053E+003456789
101112131415
Components Molefractions (of up to five different compositions)
Activity coefficient, γ γ γ γiln γγγγi
NB: After selecting a component, you must
click in this sheet before pressing F9
to calculate the resultPress the F9 key
ac etone
n-Pen tane
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
[empty ]
Figure A.2: The calculation worksheet. Here you de�ne the components, molefractions and temperature of the mixtures you want to calculate the activity coef-�cients of. The activity coe�cient is then given in the tables marked ln γi and γibelow.
No Do not choose "[n/a]"
1 172 13
acetone
n-Pentane
Figure A.3: De�ning the components by either clicking on the arrow button andchoose the component from the pre-de�ned list or click in the �eld left of the buttonto start typing the name until the component appears.
19
No Do not choose "[n/a]"
1 172 -13 13
acetone
[em pty]
n-P en tane
Figure A.4: You cannot skip a row when de�ning the components. In this examplethe program will only read the acetone data and compute the activity coe�cientsof acetone.
not be included in the calculations and the activity coe�cient will not be calculatedfor that component. So if you want to calculate one mixture with and one withouta component you can set the component's mole fraction in the one mixture to zeroand the desired mole fraction in the other mixture and then calculate the results.
After entering the mole fractions you must also enter the temperature, in Kelvin,for the calculation.
Now press the key marked F9 on your keyboard to calculate the activity coe�cients.The results appear at the bottom of the �Calculation� worksheet. Note that if youhave just selected a component you need to click outside the component selectionbox before pressing the F9 key2.
Note that sometimes the calculations take a rather long time. This happens espe-cially after new components have been added.
When the calculation is �nished the ln γi and γi are presented in the tables at thebottom of the �Calculation� worksheet, refer to Figure A.2.
A.1.1 Intermediate Calculations
If you want to look at the intermediate calculations such as the combinatorial andresidual part of the activity coe�cient, simply click on the appropriate tab. Forexample if you want to look at the the residual part you click on the tab marked�Calc Residual Part�. This worksheet calculates the variables used in the calculationof Γk. To see the residual part of the activity coe�cient you will have to jump tothe worksheet called �Calc Residual Part (Pure)�. This also contains the variablesneeded to calculate Γ(i)
k . To understand the tables in the latter worksheet you willhave to compare the subgroup table with the other tables to �nd which subgroup
2Ideally there should be a button that you could press to start the calculations, but it was notpossible to get this working properly
20
the variables are calculated for. This does not apply for the residual part of theactivity coe�cient.
A.2 De�ning New Components
To add a new component you need to go to the worksheet marked �De�ne Compo-nent�. In this worksheet you will �nd a long table where components are de�ned.
To add a new component you need to go to the �rst empty name �eld, see FigureA.5. Please note that you must not skip a name �eld when adding a new component.The reason is that the program only reads this table until it reaches an empty name�eld due to speed considerations of the calculations.
Name:
Sub group: CH3 CH OHNo of subgr: 2 1 1
1 3 15
Name:
Sub group:
No of subgr:
-1 -1 -1
2-propanol
Figure A.5: The name of the component is added in the empty yellow �eld to theright of �Name:� and the subgroups are de�ned in the row below by writing theirnames and number. The table is found in the worksheet �De�ne Component�
To de�ne the component you enter its name in the yellow name �eld and then in therow below you start de�ning the subgroups of the component. A list of the namesof the various subgroups can be found in the worksheet labelled �Table Rk, Qk�.You type in the name of the �rst subgroup and then in the cell directly below youspecify how many of that subgroup is present in the component. Then you give thenext subgroup and so on. So if you wanted to de�ne the component benzene youwould have to write subgroup name ACH and that there are 6 of that subgroup inbenzene. Please look at Figure A.6 for another example. Note that the subgroupsmust be de�ned from the left to the right without skipping any cells as the programonly reads until it encounters an empty cell.
Now it is very important that you Save the workbook. After that you must pressthe key F9 on your keyboard so that the program can read your new component.It may take some time for the program to �nish.
21
Name:
Sub group: CH3 CH3CONo of subgr: 1 1
acetone
Figure A.6: The de�nition of acetone in subgroups. The subgroups are 1 CH 3 and1 CH3C=O.
A.3 Adding a New Subgroup
To add a new subgroup jump to the worksheet �Table Rk,Qk�. Here you will �nd arather long table of main groups, subgroups, Rk and Qk parameters.
Go to the right cell in the table where the new subgroup should go and enter itsname as well as its Rk and Qk parameters and the number of the main group it ispart of, see Figure A.7. Note that if the main group is also new, you will have toadd the interaction parameters as well as explained in section A.4.
Be sure to put the subgroup in the right place according to the literature tables. Itis not arbitrary where you place it.
Now Save the workbook and then press the key F9 on your keyboard.
Main group Subgroup Group name Rk Qk
1 1 CH3 0.9011 0.8481 2 CH2 0.6744 0.5401 3 CH 0.4469 0.2281 4 C 0.2195 0.0002 5 CH2=CH 1.3454 1.1762 6 CH=CH 1.1167 0.8672 7 CH2=C 1.1173 0.9882 8 CH=C 0.8886 0.6762 9 C=C 0.6605 0.4853 10 ACH 0.5313 0.4003 11 AC 0.3652 0.120
Figure A.7: A section of the Rk, Qk table in the �Table Rk,Qk� worksheet.
22
A.4 Adding Interaction Parameters
The interaction parameters are added in the worksheet �Table Interaction�. Inthis worksheet there is a large table of interaction parameters. Remember thatamn 6= anm so you will have to enter both the interaction parameters for maingroup m for all the main groups n you have data for, see Figure A.8
The name of the main group can be de�ned right before the �rst column in them'th row. The name will then automatically copied in the m'th column in the rowjust over the �rst row.
Now Save the workbook and then press the key F9 on your keyboard.
n 1 2 3 4 5m Name CH2 C=C ACH ACCH2 OH
1 CH2 0 86.02 61.13 76.5 986.52 C=C -35.36 0 38.81 74.15 524.13 ACH -11.12 3.446 0 167 636.14 ACCH2 -69.7 -113.6 -146.8 0 803.25 OH 156.4 457 89.6 25.82 0
Figure A.8: The amn interaction table in the �Table Interaction� worksheet. Saythe main group m is ACH and n is CH2, then amn = −11.12 and anm = 61.13 thusamn 6= anm
23
B Source Code
The Visual Basic functions that was programmed in order to be able to calculatethe activity coe�cients using the UNIFAC model.
Table B.1: The Visual Basic functions that was programmed and their purpose.
Name Purpose
Getmolname Reads the components name from the �De-�ne Component� worksheet.
Prodsum Calculates∑
i ai · bi and return the sum.Stringsearch Searches through a range for a spesi�c text
string and returns the row number if it wasfound otherwise it returns -1.
Getrql Returns a value from a range at a spesi�cposistion. Used to get the ri, qi, li and
∑vk
values.Calculaterq Used to calculate the ri and qi values for a
component.
Calc_vmxi Calculates∑
i
(v
(i)m · xi
)Calc_thetapsi Calculates
∑m θmΨmk
Calc_thetapsi_pure Same as Calc_thetapsi except that it is usedfor the calculation of Γ(i)
k
Calc_sum_sum_thetapsi Calculates∑
m(θmΨkm/(∑
n θnΨnm))Calc_sum_sum_thetapsi_pure Same as above but for calculation of Γ(i)
k
Get_subgroups Gets all the subgroups of the components inthe mixtures
Get_subgroup_pure Gets the subgroup of a componentPsi Returns the ψmn value for main groups m and
n at temperature T.Get_value_of_subgroup Retrives either Rk or Qk of a subgroupCalc_y_resid Calculates the residual part of the activity
coe�cientFind_gamma Finds the right Γ(i)
k
24
Public Function getmolname(row As Integer, rng As Range) As String
If rng.Cells(row, 1).Value = "" Then
getmolname = "[n/a]"
Else
getmolname = rng.Cells(row, 1).Value
End If
End Function
Public Function prodsum(rng1 As Range, rng2 As Range) As Variant
Dim I As Long
Dim total As Double
total = 0#
If rng1.Rows.Count <> rng2.Rows.Count Then
prodsum = "#not same length"
Else
For I = 1 To rng1.Rows.Count
total = total + rng1.Cells(I, 1).Value *
rng2.Cells(I, 1).Value
Next I
prodsum = total
End If
End Function
Public Function StringSearch(rng As Range, Text As String) As Integer
Dim Offset As Integer
Dim I As Integer
Offset = -1
For I = 1 To rng.Rows.Count
If StrComp(Text, rng.Cells(I, 1).Value) = 0 Then
Offset = I
Exit For
25
End If
Next I
StringSearch = Offset
End Function
Public Function Getrql(rng As Range, RowOffset As Integer,
ColOffset As Integer) As Double
If RowOffset > 0 Then
Getrql = rng.Cells(RowOffset, ColOffset).Value
Else
Getrql = 0#
End If
End Function
Public Function calculaterq(Definition As Range, table As Range,
rorq As Integer) As Double
Dim I As Integer
Dim total As Double
total = 0#
For I = 1 To Definition.Columns.Count
If Definition.Cells(2, I) = -1 Then
Exit For
Else
total = total + Definition.Cells(1, I) *
table.Cells(Definition.Cells(2, I).Value,
2 + rorq).Value
End If
Next I
calculaterq = total
End Function
26
Public Function calc_vmxi(m As Integer, Molecules As Range,
Definition As Range, x As Range) As Double
Dim I As Integer
Dim j As Integer
Dim vm As Integer
Dim result As Double
result = 0#
For I = 1 To Molecules.Rows.Count
If (Molecules.Cells(I, 1).Value = -1) Then
Exit For
End If
vm = 0
For j = 1 To 11
If (Definition.Cells(Molecules.Cells(I, 1).Value + 4,
j + 2).Value = -1) Then
Exit For
ElseIf (Definition.Cells(Molecules.Cells(I, 1).Value + 4,
j + 2).Value = m) Then
vm = Definition.Cells(Molecules.Cells(I, 1).Value + 3,
j + 2).Value
Exit For
End If
Next j
result = result + vm * x.Cells(I, 1).Value
Next I
calc_vmxi = result
End Function
Public Function Calc_thetapsi(Groups_rng As Range, theta_rng As Range,
main_k As Integer, amn_rng As Range,
T As Double) As Double
27
Dim m As Integer
Dim total As Double
Dim main_m As Integer
total = 0#
If main_k > 0 Then
For m = 1 To theta_rng.Rows.Count
If Groups_rng.Cells(m, 1).Value = 0 Then
Exit For
Else
main_m = Groups_rng.Cells(m, 2).Value
End If
total = total + theta_rng.Cells(m, 1).Value * Psi(main_m,
main_k, amn_rng, T)
Next m
End If
Calc_thetapsi = total
End Function
Public Function Calc_thetapsi_pure(Subgroups_rng As Range,
k As Integer, theta_rng As Range,
Groups_rng As Range,
amn_rng As Range,
T As Double) As Double
Dim m As Integer
Dim total As Double
Dim main_m As Integer
Dim main_k As Integer
total = 0#
If k <> -1 Then
main_k = Groups_rng.Cells(k, 1).Value
If main_k > 0 Then
For m = 1 To Subgroups_rng.Rows.Count
28
If Subgroups_rng.Cells(m, 1).Value <> -1 Then
main_m = Groups_rng.Cells(
Subgroups_rng.Cells(m, 1).Value, 1).Value
total = total + theta_rng.Cells(m, 1).Value *
Psi(main_m, main_k, amn_rng, T)
Else
Exit For
End If
Next m
End If
End If
Calc_thetapsi_pure = total
End Function
Public Function Calc_sum_sum_thetapsi(Groups_rng As Range,
theta_rng As Range,
theta_Psi_rng As Range,
main_k As Integer,
amn_rng As Range,
T As Double) As Double
Dim m As Integer
Dim total As Double
Dim main_m As Integer
total = 0#
If main_k > 0 Then
For m = 1 To theta_rng.Rows.Count
If Groups_rng.Cells(m, 1).Value = 0 Then
Exit For
Else
main_m = Groups_rng.Cells(m, 2).Value
End If
total = total + (theta_rng.Cells(m, 1).Value *
29
Psi(main_k, main_m, amn_rng, T) /
theta_Psi_rng.Cells(m, 1).Value)
Next m
End If
Calc_sum_sum_thetapsi = total
End Function
Public Function Calc_sum_sum_thetapsi_pure(Subgroups_rng As Range,
k As Integer,
Groups_rng As Range,
theta_rng As Range,
theta_Psi_rng As Range,
amn_rng As Range,
T As Double) As Double
Dim m As Integer
Dim total As Double
Dim main_m As Integer
Dim main_k As Integer
total = 0#
If k <> -1 Then
main_k = Groups_rng.Cells(k, 1).Value
If main_k > 0 Then
For m = 1 To Subgroups_rng.Rows.Count
If Subgroups_rng.Cells(m, 1).Value <> -1 Then
main_m = Groups_rng.Cells(
Subgroups_rng.Cells(m, 1).Value, 1).Value
Else
Exit For
End If
total = total + (theta_rng.Cells(m, 1).Value *
Psi(main_k, main_m, amn_rng, T) /
30
theta_Psi_rng.Cells(m, 1).Value)
Next m
End If
End If
Calc_sum_sum_thetapsi_pure = total
End Function
Public Function calc_xm_pure(Molecules As Range, Molecule_no As Integer,
Definitions As Range,
Subgroup As Integer) As Double
calc_xm_pure = 0#
If Molecules.Cells(Molecule_no, 1).Value <> -1 Then
If Definitions.Cells(Molecules.Cells(Molecule_no, 1).Value + 3,
Subgroup + 2).Value <> -1 Then
calc_xm_pure = Definitions.Cells(Molecules.Cells(
Molecule_no, 1).Value + 2,
Subgroup + 2).Value /
Definitions.Cells(Molecules.Cells(
Molecule_no, 1).Value, 13).Value
End If
End If
End Function
Public Function get_subgroup_pure(Molecules As Range,
Molecule_no As Integer,
Definitions As Range,
Subgroup As Integer) As Integer
get_subgroup_pure = -1
If Molecules.Cells(Molecule_no, 1).Value <> -1 Then
31
get_subgroup_pure = Definitions.Cells(Molecules.Cells(
Molecule_no, 1).Value + 3,
Subgroup + 2).Value
End If
End Function
Public Function get_subgroups(Molecules As Range,
Definitions As Range,
Previous As Integer) As Integer
Dim Smaller As Integer
Dim I As Integer
Dim m As Integer
Dim Current_Row As Integer
Dim Subgroup As Integer
Smaller = 9999
For I = 1 To Molecules.Rows.Count
If Molecules.Cells(I, 1).Value = -1 Then
Exit For
Else
Current_Row = Molecules.Cells(I, 1).Value
For m = 1 To 11
Subgroup = Definitions.Cells(Current_Row + 3,
m + 2).Value
If (Subgroup = -1) Then
Exit For
ElseIf (Subgroup > Previous And
Subgroup < Smaller) Then
Smaller = Subgroup
End If
Next m
End If
Next I
32
If Smaller = 9999 Then
get_subgroups = 0
Else
get_subgroups = Smaller
End If
End Function
Public Function get_value_of_subgroup(rng As Range,
Subgroup As Integer) As Variant
get_value_of_subgroup = rng.Cells(Subgroup, 1).Value
End Function
Public Function Psi(m As Integer, n As Integer, amn_rng As Range,
T As Double) As Double
Psi = Exp(-(amn_rng.Cells(m, n).Value / T))
End Function
Public Function calc_vk(Molecules As Range, Definitions As Range,
Subgroup As Integer) As Integer
Dim I As Integer
Dim m As Integer
Dim vk As Integer
Dim Current_Row As Integer
vk = 0
For I = 1 To Molecules.Rows.Count
If Molecules.Cells(I, 1).Value = -1 Then
Exit For
Else
Current_Row = Molecules.Cells(I, 1).Value
For m = 1 To 11
If (Subgroup = Definitions.Cells(Current_Row + 3,
m + 2).Value) Then
vk = vk + Definitions.Cells(Current_Row + 2,
m + 2).Value
33
Exit For
ElseIf (Definitions.Cells(Current_Row + 3,
m + 2).Value = -1) Then
Exit For
End If
Next m
End If
Next I
calc_vk = vk
End Function
Public Function calc_y_resid(I As Integer, Subgroup_rng As Range,
Gamma_rng As Range, vk_rng As Range,
Subgroup_pure_rng As Range,
Gamma_pure_rng As Range) As Double
Dim k As Integer
Dim result As Double
Dim tmp As Double
result = 0#
For k = 1 To vk_rng.Rows.Count
tmp = 0#
If Subgroup_pure_rng.Cells(k, I).Value <> -1 Then
tmp = vk_rng.Cells(k, I).Value *
(find_gamma(Subgroup_pure_rng.Cells(k, I).Value,
Subgroup_rng, Gamma_rng) -
Gamma_pure_rng.Cells(k, I).Value)
Else
Exit For
End If
result = result + tmp
Next k
34
calc_y_resid = result
End Function
Public Function find_gamma(m As Integer, Subgroup_rng As
Range, Gamma_rng As Range) As Double
find_gamma = 0#
For n = 1 To Subgroup_rng.Rows.Count
If Subgroup_rng.Cells(n, 1).Value = m Then
find_gamma = Gamma_rng.Cells(n, 1).Value
Exit For
ElseIf Subgroup_rng.Cells(n, 1).Value = 0 Then
Exit For
End If
Next n
End Function
35