Professional Documents
Culture Documents
VGG
July 2021
Table of Contents
1. Introduction...................................................................................................................................4
2. Literature review............................................................................................................................6
3. Methods of Sulfur analysis..........................................................................................................11
3.1. Analytical methods...................................................................................................................11
3.1.1 GC-FPD (Gas chromatography-Flame photometric detectors):...................................11
3.1.2 GC-PFPD (Gas chromatography – Pulsed flame photometric detectors):....................11
3.1.3 HPLC-MS (High performance liquid chromatography – Mass spectroscopy):............11
3.1.4 ESI-MS (Electrospray ionization- Mass spectroscopy):...............................................12
3.1.5 NMR (Nuclear Magnetic resonance):..........................................................................12
3.2 Chemical methods................................................................................................................13
3.2.1 Determination of Sulphur in Organic Compounds by Oxidation with Hypobromite
Solution: 13
3.2.2 Determination of sulfur in organic compounds by gravimetric method:......................13
4. Data Analysis..................................................................................................................................14
4.1 Thermodynamics of Liquid-liquid equilibria:-.....................................................................14
4.2 Thermodynamic Models:.....................................................................................................14
4.2.1 Wohl’s Three suffix Model:.........................................................................................15
4.2.2 Morgules Model:..........................................................................................................15
4.2.3 Wilson Model:.............................................................................................................16
4.2.4 NRTL Model:..............................................................................................................16
4.2.5 UNIQUAC Model:.......................................................................................................17
4.2.6 UNIFAC Model:..........................................................................................................19
4.2.7 COSMO-RS:................................................................................................................20
4.3 Summary of Thermodynamic Models:.................................................................................21
4.4 Model fitting and optimization:...........................................................................................22
5. Work done so far:........................................................................................................................25
6. Summary:....................................................................................................................................25
7. References...................................................................................................................................26
8. Appendices:.................................................................................................................................29
Table 1: Based on desulfurization of fuel oil using ionic liquid................................................6
Table 2: Based on the regeneration of ionic liquid....................................................................7
Table 3: Based on the Liquid-liquid equilibrium:......................................................................9
Table 4: Binary interaction parameters present in literature and predicted using NRTL model
..................................................................................................................................................23
Y
Figure 1: Experimental and correlated data of the ternary system ([C8mim]-[NTf2] +
Thiophene + Cyclohexane) (Alonso, Arce, Francisco, et al. 2008).........................................24
Figure 2: Experimental and correlated data of the ternary system ([C8mim]-[NTf2] +
Thiophene + Cyclohexane(Alonso, Arce, Francisco, et al. 2008; Alonso, Arce, and Soto
2008)........................................................................................................................................24
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
1. Introduction
Sulfur in motor fuels had implicated as a contributing factor to global warming and acid rain.
It is also a catalyst poison for automobile catalytic converters and refinery catalytic
crackers(Alonso, Arce, Francisco, et al. 2008). The combustion of sulfur compounds in
gasoline and diesel fuel will results in emission of SO x and sulfate particulate matter, which is
major cause of air pollution and acid rain. To reduce these pollutions due to sulfur oxide, all
the government around the world introduce stringent environmental laws.
Hydrodesulphurization (HDS) is one of the conventional method to remove sulfur compound
for industrial purposes. But these methods require high temperature (>300°C), high pressure
(>4MPa), high energy cost, and not able to remove aromatic heterocyclic sulfur compounds,
such as thiophene, benzothiophene (BT) and its derivatives. To meet the new environmental
regulations, various alternative deep desulfurization processes have investigated in past few
years, including bio desulfurization, adsorption, oxidation and extractive desulfurization.
Among these new processes, extractive desulfurization appears to be particularly promising
and is currently receiving more attention. A lot of organic solvents such as
polyalkyaleneglycol were used a extractants for the removal of sulfur compounds from the
fuel, but the results were not satisfactory(Gao et al. 2009).
Recently, various ionic liquids (ILs) have used as extractants for the removal of sulfur
compounds from the fuel because of their unique physical and chemical properties, such as
negligible vapor pressure, high chemical and thermal stability and ability to dissolve a wide
range of organic and inorganic compounds. It is combination of usually organic cations
(derivatives of N, N - substituted imidazolium, N-substituted pyridinium, tetra -alkylated
ammonium, tetra -alkylated phosphonium, etc.), and organic or inorganic anions.(Singh and
Savoy 2020) The extractive desulfurization process using ILs can be complementary
technology for the HDS process. The ILs extractive desulfurization of fuel oil have higher
extraction ratio and greater selectivity compared to organic solvent extractive desulfurization
because of the unique solvent characteristics of ILs. For the extractive desulfurization
process, the key parameter is to select an effective IL that is nontoxic, chemically stable to
moisture and air, and not expensive for commercial applications. After the desulfurization of
fuel oil recovery and regeneration of ionic liquid has carried out by using various methods,
such as distillation, extraction with water, extraction with organic solvent, adsorption on solid
surface, membrane separation, crystallization and force field separation, etc. Among these
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
methods distillation and extraction are two of the most commonly used methods.(Lucero,
Javier, and Lucero 2011). Liquid –liquid extraction in the regeneration of the ionic liquid has
been most commonly used method. To predict the separation, it is necessary to know the
liquid-liquid equilibrium (LLE) data for a particular system. Various thermodynamic models
such as NRTL, UNIQUAC and UNIFAC can be use to predict the LLE. These models use
the activity coefficients, which require proper binary interaction parameters that can represent
LLE for highly non-ideal liquid mixtures usually encountered in aromatic extraction(Banerjee
et al. 2007).
The experimental data have been correlated by means of the NRTL(H. and J.M. 1968) and
UNIQUAC(Abrams and Prausnitz 1975) equations(Simoni et al. 2008). Sometimes screening
of the huge number of possible ionic liquids and hydrocarbons mixtures is experimentally not
feasible, the use of predictive models and/or computational methods is a viable option for the
design of the best solvent. Thus, the Conductor-like Screening Model for Real Solvents
(COSMO-RS) will also use to describe the liquid–liquid equilibria(Ferreira et al. 2014).
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
2. Literature review
Pressure = 200
psig
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
1
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
In the FPD, sulfur compounds are combusted in a hydrogen-rich flame as they eluted
from the GC column. During combustion, the sulfur forms an excited state sulfur
dimmer (S2*) which emits a characteristics light energy as it returns to the ground
state. The emission from the S2* are detected by a photomultiplier tube (PMT) and
the response of PMT is quadratic and proportional to the amount of sulfur present.
(Saleh 2020)
3.1.2 GC-PFPD (Gas chromatography – Pulsed flame photometric detectors):
In these method of analysis sample is place in the magnetic field. Then excite the nuclei
sample into nuclear magnetic resonance with the help of radio waves to produce NMR
signals. These NMR signals are detected with sensitive radio receivers. The resonance
frequency of an atom in a molecule is changed by the intramolecular magnetic field
surrounding it. This gives details of a molecule’s individual functional group and its
electronic. This method provides details of the reaction state, structure, chemical environment
and dynamics of a molecule.
Most NMR analysis are performed by C-NMR or H-NMR. Sulfur compounds can be
detected by the C-NMR in the form of sulfonium salts, sulfides and thiophenes.(1386 )سینا
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
Hypobromite Solution:
Procedure: The accurately weighed organic compound was fused with sodium and 1 g of
fusion mixture in a 5 to 6 inches long Pyrex-glass fusion tube for about 10 minutes, and the
red-hot tube was then plunged into a beaker containing water. The solution obtained was
warmed and then filtered. The pieces of broken glass from the fusion tube were ground in a
mortar and then washed, and the washings were added to the previous filtrate. To prevent
atmospheric oxidation, the solution must not be heated, and it must be filtered through a filter
paper previously washed with water, otherwise inaccurate results will be obtained owing to
the absorption of sulphide on the filter paper.
Seventy-five millilitres of 0.1 N sodium hypobromite solution were added to the filtrate, and
the flask was set aside for about 5 minutes. Twenty millilitres of 10% potassium iodide
solution and 50 ml of 2 N sulphuric acid were then added, and the liberated iodine was
titrated against sodium thiosulphate with starch as indicator.
It was, however, found more convenient to adjust the filtrate after fusion, to a known volume
and to take a 10-ml aliquot of the filtered solution for the determination. The procedure was
then the same as described above, except that only one-tenth of the stated volumes of sodium
hypobromite, potassium iodide and sulphuric acid were used.(Hashmi, Elahi, and Ali 1963)
Procedure: Transfer a 5-g sample to a 400-ml beaker and add 40 ml of nitric acid and 40 ml
of hydrochloric acid. Curry along a blank cover with a watch glass and boil down to about
20-ml. Add 25 ml of perchloric acid boil to fumes of perchloric acid and fume for several min
add nitric acid dropwise until the solution is colorless or only slightly yellow. If it is
suspected that tin or antimony are present add 10 ml of hydrobromic acid (48 %) evaporate to
fumes with the cover lid ajar and continue fuming until the volume of perchloric acid is about
10 ml wash down the watch glass and sides of the beaker with water and evaporate to fumes
again. Cool and dilute to about 200 ml with water heat to boiling add 20 ml of barium
chloride solution, and then boil for 2 min allow to stand overnight at room temperature. Filter
through a tared sintered porcelain crucible of fine porosity, and transfer and wash with water.
Dry the crucible at 1500C for 15 min. heat at 7500C for 30 min, cool in a desiccator and
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
4. Data Analysis
The chemical potential (μi) governs mass transfer in a closed system and at equilibrium, μ i
must be uniform throughout the entire systems. The chemical potential uniformity at
equilibrium for a heterogeneous closed system consisting π phases and N components at
constant pressure and temperature is given as follows(Li 2015)
μ i1 =μi 2=… μ i π
Where i is the component under consideration. While it is difficult to compute an absolute
value of the chemical potential, computing the changes of the chemical potential that
accompany changes in temperature, pressure and compositions is feasible(Li 2015). For the
two phase and multicomponent systems the phase equilibria is given by the following
equations
f i v =f i l
f i L1=f i L2
The liquid-liquid equilibrium data is rewrite by the isoactivity equations
x i I∗γ i I =x i II ∗γ i II
During the calculations of LLE we need to use two approaches first is the minimization of
Gibbs free energy and second one is solving of isoactivity equations(Li 2015).
4.2 Thermodynamic Models:
Since the 1950s, intensive attention has been given to the development of thermodynamic
models to quantify deviation of liquid mixtures from ideal solution. The deviations are
usually characterised by activity coefficients. These models are mainly based on developing
excess-Gibbs-energy equations and cover both aqueous electrolyte and organic non-
electrolyte systems. Initially these models are correlative and require a group of binary
interaction parameters to be regressed from available experimental data, and then the
correlations can be extended to conditions beyond where the data for parameter regression
are obtained. Gradually these binary parameters are generalized to a wider range of data or
are attributed to basic functional groups of molecules thus entitling these models with
predictive capabilities. In addition, thermodynamic models based on quantum mechanics are
emerging with the development of powerful computers(Li 2015).
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
Most of the equations relating activity coefficient and concentration of the solution were
derived from these excess free energy relationships. Wohl’s proposed, statistically, a general
method for expressing excess free energy and provided some rough physical significance to
the various parameters appearing in the equations. Wohl’s equation for excess free energy
contained terms for compositions, effective molal volumes and effective volumetric fraction
of the separate constituents of the solution. From these equations, the following empirical
relations for activity coefficient could be written(Narayanan n.d.).
q1
( (
ln γ 1=z 22 A+2 B
q2 ))
− A z1
q2
( (
ln γ 22=z 21 B+2 A
q1 ))
−B z 2
z1 and z2 are the effective volume fractions of the separate components in the solution and q 1
and q2 are the effective molal volumes. z and q are related as:
x1
z 1=
q2
x1 + x 2
( )
q1
x2
z 2=
q1
x2 + x 1
( )
q2
It involves three parameters, A, B and (q1/q2) which are characteristics of the binary system.
4.2.2 Morgules Model:
When the term (q1/q2) is unity in above equation, we get the following expression, which is
known as the Margules three-suffix equation.(Narayanan n.d.)
The constant A in the above equation is the terminal value of ln g1 at x 1 = 0 and the constant
B is the terminal value of lng2 at x2 = 0. When A = B, the Margules equation takes the
following simple form.
ln γ 1= A∗x 22 ln γ 2= A∗x 21
The Wilson model uses the concept of “local composition” and derives the equations on the
basis of two assumptions. First, it is assume that the free energy of mixing is similar to the
Flory-Huggins equation:
gm
=∑ x i∗lnζ i
RT i
where ζi is the “local” volume fraction of component i about a central molecule of the same
type.
The activity coefficient model for the multicomponent proposed by the Wilson is,
ln γ i=−ln (1−∑ x i A ji )+1−∑ ¿ ¿
i j
The Wilson model has two binary interaction parameters for each pair of components and is
able to predict multi-component properties from binary data. However, the representation of
systems with negative deviations from ideality is not as good as that of systems with positive
deviations. More importantly, the Wilson model is unable to predict limited miscibility thus
should only be used for completely miscible systems where a single liquid phase is
present(Anon n.d.). This drawback significantly limits its usage in solvent extraction(Li
2015).
4.2.4 NRTL Model:
The non-random two liquid (NRTL) model use the concept of “local composition” and
derives the equation of excess Gibbs energy in a somewhat more rigorous way.
The non-randomness of mixing is taken into consideration in the NRTL model Wilson
suggested a relation between local mole fraction x11 of molecules 1 and local mole fraction
x21 of molecules 2, which are in the immediate neighborhood of molecule 1:
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
−α g
x21
=
x 2 exp( RT )
12 12
x 11 −α g
x exp (
RT )
12 11
1
The NRTL model generally predicts large heats of mixing, which is characteristic of
electrolyte solutions. The generalised form of the NRTL equation for solution containing
multiple components is as follows:
N N N
gE
=∑ xi ∑ τjiGjixj ¿/ ∑ Gkixk ¿
RT i=1 j=1 k=1
Gij=exp ¿
And
gij−gji
τij=
RT
Here, gij is an energy parameter that characterizes the interaction of species i and j, and the
parameter αij=αji is related to the nonrandomness in the mixture (α ji =0 corresponds to
complete randomness, or an ideal solution).(Simoni et al. 2008)
The activity coefficient is obtained by appropriate differentiation of the above equation,
(Tasrios 1973)
N
∑ τ ij G ji x j N
x j Gij
j=1
lnγi= N
+∑ N
¿)
j=1
∑ G ki x k ∑ G ki x k
k=1 k=1
In this model, each pair of molecules have two adjustable energy parameters (τ ji and τji) and
one non-randomness parameter (αji) that can be either adjustable or fixed to characterise the
non-ideality of solutions. The model is able to correlate VLE and LLE systems with
satisfactory accuracy and has the capability to predict equilibria of ternary systems from
binary data, including strongly non-ideal mixtures, especially partially immiscible systems.
A few years after proposal of the NRTL model, another model was derived by extending and
generalizing the quasi-chemical theory of Guggenheim. The resulting universal quasi-
chemical equation (UNIQUAC)(Abrams and Prausnitz 1975) turned out to be applicable to a
wide range of non-electrolyte systems, including polymer solutions and the model reduces to
several well-known equations including the NRTL and Wilson model when well-defined
simplifications are made. The excess molar Gibbs free energy of the UNIQUAC model has
two parts, namely a combinatorial part and a residual part. The combinatorial part describes
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
the dominant entropic contribution and depends on the composition and the sizes and shapes
of the molecules. Thus, it requires only pure-component data which is given as constant. The
residual part accounts for the enthalpy of mixing and depends also on the intermolecular
forces on top of the composition and pure-component data. Therefore, the residual part
contains the two binary adjustable parameters for each molecular pair(Li 2015). The equation
for the UNIQUAC model is
g E g comb gres
= +
RT RT RT
g comb N ∅i N
θ
=∑ x i ln ( )+ 5 ∑ qi xi ln ( i )
RT i=1 xi i=1 ∅i
N
gres
=−∑ q i x i ln ¿ ¿
RT i=1
r i xi
∅ i= N
∑ r j xj
i=1
qi xi
θi = N
∑ qj x j
j=1
And
−∆ uij
τ ij =exp ( )
RT
Here, ri and qi represent a relative volume and surface area, respectively, for component i. It
follows that Φi and θi are volume and surface area fractions, respectively, for component i.
The binary interaction parameters ∆uij (or the equivalent τij) are estimated from experimental
data(Simoni et al. 2008).
The activity coefficient for component i from the above equation becomes(Abrams and
Prausnitz 1975)
N N N
∅i θi θ j τ ij
ln γ i=ln
xi ( )
+5 qi ln
∅i i ( )
+l −(∅ ¿ ¿ i/x i ) ∑ x j l j −qi ln ( ∑ θ j τ ji )+q i−q i ∑
j=1 j=1 j=1
N
∑ θk τ kj
¿
k=1
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
Where,
l j =5 ( r i−q i )−(r j −1)
The UNIQUAC model uses only two adjustable binary parameters for each pair of molecules,
albeit it requires pure-component constants. The model is applicable to a wide range of
mixtures for both VLE and LLE with accuracy comparable to that of the NRTL model.
However, similar to the NRTL model, the UNIQUAC model is also a correlative model with
little predictive capability.
Following the UNIQUAC model, a group-contribution method was developed. The method,
namely UNIFAC model (UNIQUAC Functional-group Activity Coefficient)(Com- and
Engineering 1975), combines the solution-of-functional-groups concept with the extension of
the UNIQUAC method and contains two adjustable parameters for each pair of functional
groups. Essentially the UNIFAC model is similar to the UNIQUAC model except for that the
former splits the interactions between molecules to that between functional groups. This
treatment significantly reduces the number of interaction parameters since the number of
functional groups is much fewer than that of chemical compounds. More importantly, with
parameters characterising interactions between pairs of functional groups obtained from
existing equilibrium systems, the model allows calculation of other systems that are not
involved in the parameter regression. Therefore, the UNIFAC model is a predictive model for
non- electrolytes.
In the UNIFAC method, the combinatorial part of the UNIQUAC activity coefficients
equation is used directly. Only pure component properties enter into this equation. Parameters
ri and qi are calculated as the sum of the group volume and area parameters, Rk, and Qk, of
functional groups, given below:
r i=∑ ϑik R k
k
q i=∑ ϑik Qk
k
where υk (i) is the number of groups of type k in molecules i. Group volume and area
parameters Rk and Qk are obtained from the van der Waals group volume and surface area
(Com- and Engineering 1975).
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
where Γk is the group residual activity coefficient and Γ k (i) is the residual activity coefficient
of group k in a reference solution containing only molecules of type i.
The group activity coefficient Γk is is found from an expression similar to above equation and
it also holds for Γki:
ln Γ k =Q k ¿
where Θm is the area fraction of group m, and the sums are over all different groups. Θ m is
calculated in a manner similar to that for θi:
Qm X m
Θ m=
∑ Qn X n
n
4.2.7 COSMO-RS:
COSMO-RS (Conductor like Screening Model for Real Solvents)(Klamt 1995) is also a
semi-theoretical model, whereas, it is essentially different from the models reviewed above
since it is based on information obtained from quantum chemistry and does not require binary
interaction parameters. As an initial step, COSMO-RS performs a quantum chemistry
calculation using COSMO to obtain the screening charge density σ on the surface of
molecules, which is the most time consuming step and fortunately the information can be
stored in a data base for subsequent use. The screening charge density σ is then combined
into a statistical thermodynamic methodology to calculate the chemical potentials of
molecules, which are the basis of calculations of thermodynamic properties including activity
coefficients and vapour pressure.
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
Throughout the COSMO-RS, the interactions arise from the screening charge density of each
molecule, namely the σ-profile. The σ-profile of a mixture, P S(σ), is assumed to be the sum of
the σ-profiles of all the components weighted by mole fractions:
Ps ( σ ) =∑ x i pi ( σ )
i
The Wilson model first used the local composition concept and satisfactorily correlated a
variety of VLE systems with two binary parameters for each pair of molecules, however, it
failed to correlate LLE systems where the behaviour of components are highly non-ideal. The
inheritor of the local composition concept, the NRTL model, incorporated the two-liquid
theory and introduced the non-randomness parameters, it successfully correlated both VLE
and LLE systems including highly non-ideal systems.
The UNIQUAC model is established on the basis of quasi-chemical analysis with two
adjustable parameters for each pair of molecules. It is comparable to the NRTL model in
terms of correlating equilibrium data. It is also the basis for development of the UNIFAC
model, which is a predictive model characterising the non-electrolyte systems by distributing
the interactions to functional groups. With well regressed parameters from a wide range of
experimental data, the UNIFAC model usually produces satisfactory predictions.
COSMO-RS has similarity with the UNIFAC model in terms of statistical thermodynamics,
however, it is supposed to be more rigorous than other models because it starts from the
surface charge density of molecules obtained from quantum chemistry calculations. Besides,
it does not require binary interaction parameters and theoretically can predict systems
involving any component (non-electrolytes) regardless of whether experimental data is
available or not.(Zheng et al. 2014).
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
The correlation of the experimental data was done with the NRTL equation. The value of the
non-randomness parameter,α was fixed to 0.1, 0.2, and 0.3. The binary interaction parameters
were produced by mathematical software “MATLAB” and programme of it is given in
appendix. It uses two objective functions first was residual function (F) and second was mean
error of the solute distribution ratio (∆β).(Alonso, Arce, Francisco, et al. 2008)
2 .5
( xijk −x ijkpred )
F=100 (∑k
min ∑ ∑
i j 6M )
2 .5
β k −β kpred
∆ β=100 ( ∑
( βk ) )
k M
Where xi is the experimental composition in mole fraction, and xipred is the corresponding
calculated composition for component i. Other subscripts and superscripts are: j for phases (I,
II) and k for tie-lines. M refers to the number of experimental tie-lines.
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
Table : Binary interaction parameters present in literature and predicted using NRTL
model
Parity plot
1
0.9
0.8
0.7
x1
Experimental
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Model predicted
Parity plot
1
0.9
0.8
0.7
x1
Experimental
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Model predicted
6. Summary:
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
7. References
8. Appendices:
A. Following is the code for objective function for optimization using NRTL
function f=fun_NRTL121(x)
R=8.314;
T=298.15;
% Experimental Data
x1alfa=[0.000 .000 .003 .004 .009 .000 .000 .000 .000 .000];
x2alfa=[0 .097 .213 .424 .55 .659 .853 .903 .943 1.00];
x3alfa=[1 .903 .784 .572 .441 .341 .147 .097 .057 0.00];
x1beta=[1.00 .907 .788 .683 .615 .569 .555 .504 .443 .288];
x2beta=[0.00 .093 .212 .317 .385 .431 .445 .499 .557 .712 ];
x3beta=[0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000];
alfa=.3;
t12=x(1)./(R*T); % deltag12=x(1)
t21=x(2)./(R*T); % deltag21=x(2)
t13=x(3)./(R*T); % deltag13=x(3)
t31=x(4)./(R*T);% deltag31=x(4)
t23=x(5)./(R*T);% deltag23=x(5)
t32=x(6)./(R*T);% deltag32=x(6)
% captital G
G12=exp(-alfa.*t12);
G21=exp(-alfa.*t21);
G13=exp(-alfa.*t13);
G31=exp(-alfa.*t31);
G23=exp(-alfa.*t23);
G32=exp(-alfa.*t32);
fi1=x1alfa+G21.*x2alfa+G31.*x3alfa;
fi2=G12.*x1alfa+x2alfa+G32.*x3alfa;
fi3=G13.*x1alfa+G23.*x2alfa+x3alfa;
% find out theta
theta1=x2alfa.*t21.*G21+x3alfa.*t31.*G31;
theta2=x1alfa.*t12.*G12+x3alfa.*t32.*G32;
theta3=x1alfa.*t13.*G13+x2alfa.*t23.*G23;
% activity coeficient for the 1st phase
gamma1alfa=exp(theta1./fi1 - (x1alfa.*theta1./fi1.^2)+
(x2alfa.*G12/fi2).*(t12-theta2./fi2)+(x3alfa.*G13./fi3).*(t13-
theta3./fi3));
gamma2alfa=exp(theta2./fi2 - (x2alfa.*theta2./fi2.^2)+
(x1alfa.*G21/fi1).*(t21-theta1./fi1)+(x3alfa.*G23./fi3).*(t23-
theta3./fi3));
gamma3alfa=exp(theta3./fi3 - (x3alfa.*theta3./fi3.^2)+
(x1alfa.*G31/fi1).*(t31-theta1./fi1)+(x2alfa.*G32./fi2).*(t32-
theta2./fi2));
% fi
fi1beta=x1beta+G21.*x2beta+G31.*x3beta;
fi2beta=G12.*x1beta+x2beta+G32.*x3beta;
fi3beta=G13.*x1beta+G23.*x2beta+x3beta;
% find out theta
theta1beta=x2beta.*t21*G21+x3beta.*t31.*G31;
theta2beta=x1beta.*t12*G12+x3beta.*t32.*G32;
theta3beta=x1beta.*t13*G13+x2beta.*t23.*G23;
% activity coefficient for the 1st phase
gamma1beta=exp(theta1beta./fi1beta - (x1beta.*theta1beta./fi1beta.^2)+
(x2beta.*G12./fi2beta).*(t12-theta2beta./fi2beta)+
(x3beta.*G13./fi3beta).*(t13-theta3beta./fi3beta));
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
gamma2beta=exp(theta2beta./fi2beta - (x2beta.*theta2beta./fi2beta.^2)+
(x1beta.*G21./fi1beta).*(t21-theta1beta./fi1beta)+
(x3beta.*G23./fi3beta).*(t23-theta3beta./fi3beta));
gamma3beta=exp(theta3beta./fi3beta - (x3beta.*theta3beta./fi3beta.^2)+
(x1beta.*G31./fi1beta).*(t31-theta1beta./fi1beta)+
(x2beta.*G32./fi2beta).*(t32-theta2beta./fi2beta));
% x1betapred=(gamma1alfa./gamma1beta).*x1alfa;
x2betapred=(gamma2alfa./gamma2beta).*x2alfa;
%x3betapred=(gamma3alfa./gamma3beta).*x3alfa;
%x1alfapred=(gamma1beta./gamma1alfa).*x1beta;
x2alfapred=(gamma2beta./gamma2alfa).*x2beta;
%x3alfapred=(gamma3beta./gamma3alfa).*x3beta;
Bk=x2beta./x2alfa;
Bkpred=x2betapred./x2alfapred;
ErrorDB=((Bk-Bkpred)./Bk).^2;
ErrorDB(1)=0;
% Objective functions
f(1)=100*(sum((x1alfa.*gamma1alfa-x1beta.*gamma1beta).^2+
(x2alfa.*gamma2alfa-x2beta.*gamma2beta).^2+(x3alfa.*gamma3alfa-
x3beta.*gamma3beta).^2)/(6*length(x1alfa)))^.5;
f(2)=100*(sum(ErrorDB)/length(x1alfa))^.5;
end
clc;
clear;
R=8.314;
T=298.15;
alfa=.2;
%% Experimenta data
x1alfa=[0.000 .000 .003 .004 .009 .000 .000 .000 .000 .000];
x2alfa=[0 .097 .213 .424 .55 .659 .853 .903 .943 1.00];
x3alfa=[1 .903 .784 .572 .441 .341 .147 .097 .057 0.00];
x1beta=[1.00 .907 .788 .683 .615 .569 .555 .504 .443 .288];
x2beta=[0.00 .093 .212 .317 .385 .431 .445 .499 .557 .712 ];
x3beta=[0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000];
%% Binary interaction parameters
x(1)=-10028;
x(2)=22860;
x(3)=-6439;
x(4)=32932;
x(5)=-8592;
x(6)=10044;
t12=x(1)./(R*T); % deltag12=x(1)
t21=x(2)./(R*T); % deltag21=x(2)
t13=x(3)./(R*T); % deltag13=x(3)
t31=x(4)./(R*T);% deltag31=x(4)
t23=x(5)./(R*T);% deltag23=x(5)
t32=x(6)./(R*T);% deltag32=x(6)
% captital G
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
G12=exp(-alfa.*t12);
G21=exp(-alfa.*t21);
G13=exp(-alfa.*t13);
G31=exp(-alfa.*t31);
G23=exp(-alfa.*t23);
G32=exp(-alfa.*t32);
fi1=x1alfa+G21.*x2alfa+G31.*x3alfa;
fi2=G12.*x1alfa+x2alfa+G32.*x3alfa;
fi3=G13.*x1alfa+G23.*x2alfa+x3alfa;
% find out theta
theta1=x2alfa.*t21.*G21+x3alfa.*t31.*G31;
theta2=x1alfa.*t12.*G12+x3alfa.*t32.*G32;
theta3=x1alfa.*t13.*G13+x2alfa.*t23.*G23;
% activity coeficient for the 1st phase
gamma1alfa=exp(theta1./fi1 - (x1alfa.*theta1./fi1.^2)+
(x2alfa.*G12/fi2).*(t12-theta2./fi2)+(x3alfa.*G13./fi3).*(t13-
theta3./fi3));
gamma2alfa=exp(theta2./fi2 - (x2alfa.*theta2./fi2.^2)+
(x1alfa.*G21/fi1).*(t21-theta1./fi1)+(x3alfa.*G23./fi3).*(t23-
theta3./fi3));
gamma3alfa=exp(theta3./fi3 - (x3alfa.*theta3./fi3.^2)+
(x1alfa.*G31/fi1).*(t31-theta1./fi1)+(x2alfa.*G32./fi2).*(t32-
theta2./fi2));
% fi
fi1beta=x1beta+G21.*x2beta+G31.*x3beta;
fi2beta=G12.*x1beta+x2beta+G32.*x3beta;
fi3beta=G13.*x1beta+G23.*x2beta+x3beta;
% find out theta
theta1beta=x2beta.*t21*G21+x3beta.*t31.*G31;
theta2beta=x1beta.*t12*G12+x3beta.*t32.*G32;
theta3beta=x1beta.*t13*G13+x2beta.*t23.*G23;
% activity coefficient for the 1st phase
gamma1beta=exp(theta1beta./fi1beta - (x1beta.*theta1beta./fi1beta.^2)+
(x2beta.*G12./fi2beta).*(t12-theta2beta./fi2beta)+
(x3beta.*G13./fi3beta).*(t13-theta3beta./fi3beta));
gamma2beta=exp(theta2beta./fi2beta - (x2beta.*theta2beta./fi2beta.^2)+
(x1beta.*G21./fi1beta).*(t21-theta1beta./fi1beta)+
(x3beta.*G23./fi3beta).*(t23-theta3beta./fi3beta));
gamma3beta=exp(theta3beta./fi3beta - (x3beta.*theta3beta./fi3beta.^2)+
(x1beta.*G31./fi1beta).*(t31-theta1beta./fi1beta)+
(x2beta.*G32./fi2beta).*(t32-theta2beta./fi2beta));
%% Predicted value
x1betapred=(gamma1alfa./gamma1beta).*x1alfa;
x2betapred=(gamma2alfa./gamma2beta).*x2alfa;
x3betapred=(gamma3alfa./gamma3beta).*x3alfa;
x1alfapred=(gamma1beta./gamma1alfa).*x1beta;
x2alfapred=(gamma2beta./gamma2alfa).*x2beta;
x3alfapred=(gamma3beta./gamma3alfa).*x3beta;
%% Coefficient of determination or goodness of fit
Error1beta=(x1beta-x1betapred).^2;
Error2beta=(x2beta-x2betapred).^2;
Error3beta=(x3beta-x3betapred).^2;
Error1alfa=(x1alfa-x1alfapred).^2;
Error2alfa=(x2alfa-x2alfapred).^2;
Error3alfa=(x3alfa-x3alfapred).^2;
a1=mean(x1alfa);
a2=mean(x2alfa);
a3=mean(x3alfa);
a4=mean(x1beta);
a5=mean(x2beta);
a6=mean(x3beta);
Selection and regeneration of potential ionic liquid for the hydro-processing feedstock
error1beta=(x1beta-a4).^2;
error2beta=(x2beta-a5).^2;
error3beta=(x3beta-a6).^2;
error1alfa=(x1alfa-a1).^2;
error2alfa=(x2alfa-a2).^2;
error3alfa=(x3alfa-a3).^2;
sse=sum(Error2beta+Error3beta+Error1alfa+Error2alfa+Error3alfa);
sst=sum(error2beta+error3beta+error1alfa+error2alfa+error3alfa);
R2=(sst-sse)/sst;
fprintf('Coefficient of dettermination=\n');
disp(R2);
plot(x1alfapred,x1alfa,'r*')
hold on
plot([0 1],[0 1])
plot(x2alfapred,x2alfa,'go')
plot(x3alfapred,x3alfa,'b^')
xlabel('model predicted')
ylabel('Experimental')
legend('x1','diagonal line','x2','x3')
title('parity plot')