Prediction of ternary ion-exchange equilibrium using artificial neural networks and Law of Mass Action

The Law of Mass Action generally models the equilibrium data from ion exchange processes. This methodology is rigorous in terms of thermodynamics and takes into consideration the non-idealities in the solid and aqueous phases. However, the artificial neural networks may also be employed in the phase equilibrium modeling. In this study, both methodologies were tested to describe the ion exchange equilibrium in the binary systems SO4 -NO3 , SO4 -Cl, NO3-Cl and in the ternary system SO4 -Cl-NO3 , by AMBERLITE IRA 400 resin as ion exchanger. Datasets used in current study were generated by the application of the Law of Mass Action in the binary systems. Results showed that in the equilibrium modeling of binary systems both methodologies had a similar performance. However, in the prediction of the ternary system equilibrium, the Artificial Neural Networks were not efficient. Networks were also trained with the inclusion of ternary experimental data. The Law of Mass Action in the equilibrium modeling of the ternary system was more efficient than Artificial Neural Networks in all cases.


Introduction
Ionic exchange is a highly employed process for the treatment of effluents with ionic species, the purification of pharmacological compounds, in which adsorption of ionic species occurs in a porous material (such as artificial resins or zeolites) and followed simultaneously by a desorption process of other ionic species (already present in the exchanger) in equivalent amounts, according to the equation: where: A and B represent the ion pairs; z is the charge of the ionic species; R is the solid phase and S the liquid one.
Most industrial applications of the ion exchange process use fixed-bed column systems.The solution that would be treated has several distinct ions that compete with one another for active sites of the adsorbent material.According to Tamura (2004), the understanding and the prediction of ion exchange reactions are required for a better quantitative and efficient interpretation of ion exchange processes.Thermodynamic modeling of the ion exchange systems has a very important role in acquiring essential information for the project of ion exchange separation systems.

The Law of Mass Action
Approaches to describe equilibrium in ion exchange systems comprise adsorption isotherms (AI) and the Law of Mass Action (LMA).However, the formulation of IA models, such as Langmuir's isotherm, fails to take into account the effect of the solution's ion force of the counter-ion that desorpts the exchanger.LMA is a stricter approach for the representation of data equilibrium in ion exchange systems.
The Law of Mass Action is a model foregrounded on the fact that ion exchange is a reversible process which, according to the equation, is ruled by a chemical equilibrium that defines the selectivity of the ion exchanger.The reaction's equilibrium constant (K) may be calculated by the following (MEHABLIA et al., 1994): where: m j is the molality of species j in the liquid phase; y j is the mol fraction of the species j in the solid phase; γ Sj is the coefficient of the activity of the species j in the solution; γ Rj is the coefficient of the activity of the species j in the resin.
The parameters of the models of the coefficients of activity and the composition of each phase should be known so that the equilibrium constant of the Equation could be calculated.Literature shows several models, such as the Debye-Hückel, Bromley, Pitzer and Chen models, for the calculation of the coefficient in liquid phases.However, reliable theoretical formulations for the calculation of the coefficient of the activity of ions in the solid phase do not exist.Smith and Woodburn (1978) had originally proposed a solution to this problem which was later used by several authors (ALLEN et al., 1989;BOYER et al., 1999;CANEVESI et al., 2009;MEHABLIA et al., 1994;SHALLCROSS et al., 1988) who used Wilson's model for the calculation of the coefficient of activity for fluid phases to represent the non-idealities in the solid phase under analysis.The model's parameter was estimated from equilibrium data.
Wilson's model had the advantage that it predicted the behavior of the ion exchange ternary systems when the rates of equilibrium constants and the parameters of the models of the coefficients of activity for the ions in current phases were known.
Three chemical reactions of binary exchange may occur in an ion exchange ternary system, depending on the three equilibrium constants.In this case, the three equilibrium constants and the fraction of the three components involved may be related by the following equations: Since the equilibrium constants are a priori known, a system of non-linear equations may be obtained.Two equations are defined from the equilibrium constant and Equation 4. A system of equations is thus available whose unknowns are the three compositions of the solid phase which may be calculated by the numerical method for the solution of non-linear systems

Artificial Neural Networks
An important and highly relevant alternative for the modeling of industrial processes is the use of Artificial Neural Networks (ANNs).In spite of the fact that it has the highest number of parameters to be determined, ANN is a method that calculates variables in an explicit way, or rather, without the need of solving a system of non-linear equations.
ANNs are being successfully applied in several areas in the industry of chemical processes, such as, the solution of differential equations, interpolation of GPS data, studies of mono-and multi-component equilibrium data of adsorption, prediction of stability of phases, modeling of chicken carcasses cooling and others (FAGUNDES-KLEN et al., 2007;JHA;MADRAS, 2005;KLASSEN et al., 2009;PRAKASH et al., 2008;SCHMITZ et al., 2006;SILVA et al., 2003;SOUZA et al., 2006).
ANNs, a mathematical model based on the neural system of intelligent organisms, are capable of learning from experience and identify logical patterns in mathematical sequences.Neurons in ANN are placed in layers: the entrance, the intermediate and the exit layers.Each neuron comprises a mathematical logic structure in which the stimuli captured by the synapses are processed through the soma function and the threshold potential is represented by transference.Equation 5represents the above mathematically: where: w is the synaptic weight; x is the entry stimulus, b is the threshold; f represents the transference function; Y is the neurons' exit.Subscripts k and j represent respectively the number of layers and the stimulus.
ANN application is divided into three parts: training, validation and generalization.Data sets are required for ANN training so that it may identify patterns between the entrance and exit variables and adjust the synaptic weights by an optimization algorithm.The validation stage confers whether ANN effectively learned the previous training and the generalization stage is the effective use of the adjusted model to the simulation of the process under analysis.
ANN performance depends on several factors, such as the number of intermediate layers, the number of neurons in each layer and the function of the transference employed.The use of a great number of neurons converges to more precise responses, although they may trigger a network generalization issue when new entries occur.However, if the number of neurons is low, there is a possibility that the response obtained is not sufficiently precise.
Current research compares results of the modeling of ion exchange process of the binary systems SO 4 2--NO 3 -, SO 4 2--Cl -, NO 3 -Cl -and of the prediction of the ternary system SO 4 2--NO 3 --Cl -, by LMA and ANNs, in the concentration 0.2 N at 298 K, employing the resin AMBERLITE IRA 400 as ion exchanger and sodium as counterion.

Material and methods
The evaluation of LMA and ANN methodologies was undertaken by using equilibrium data of the binary systems SO 4 2--NO 3 -, SO 4 2--Cl -, NO 3 -Cl -and of the ternary system SO 4 2--NO 3 --Cl -, both at concentration 0.2 N and temperature 298 K, obtained by Smith and Woodburn (1978).These authors investigated the ion exchange of these ions in solution using the synthetic resin AMBERLITE IRA 400, with capacity for anion exchange of 1.4 eq L -1 .

Modeling by LMA
LMA was employed for the adjustment of equilibrium data of the binary systems to obtain the parameters of Wilson's model and the equilibrium constant for each binary system.Bromley's model was thus used to calculate the coefficient of ion activity in the solution, according to Equation 6: where: A is the Debye-Huckel Constant; I is the ion force defined by 2 , with z i as the number of íon i loads.F i is the sum of interaction parameters defined by Equation 7.
Term B is the parameter of Bromley's model of the electrolyte formed by the cation j and the anion i.Table 1 shows B rates for the systems under analysis.

  
where: Λ ij are Wilson's parameters and n is the number of ions in the solid phase.
The application of LMA requires estimates of the parameters of interaction Λ ij .For binary systems Λ ii =1, with crossed parameters determined as from the experimental data of equilibrium.
Parameters in current research were estimated with minimum quadratic error, represented by Equation and using Downhill Simplex method (NELDER; MEAD, 1965). where: ( ) is the fraction of the solid phase obtained experimentally and ( ) is the fraction of the solid phase calculated by the model.
When rates of parameter Λ ij are estimated, equilibrium curves of each binary system are produced for later utilization in ANN training and prediction of ternary equilibrium data.Curves were produced taking into account the composition in the interval [0.1], totaling 100 equilibrium scores for each binary pair.Further, ternary equilibrium curve was predicted to solve the non-linear equation system by modified Newton-Rapson method when Wilson's parameters and equilibrium constants from the analyzed binary system were taken into account.

Modeling by ANNs
Artificial Neural Networks were also employed in the modeling of equilibrium data of the binary systems SO 4 2--NO 3 -, SO 4 2--Cl -, NO 3 -Cl -and of the ternary system SO 4 2--NO 3 --Cl -.ANNs used a logistic function and only one hidden layer for activation.
In all cases, the number of neurons in the entrance and intermediate layers varied between 4 and 14 to decrease the rate function represented by the Equation.Synaptic weights were determined by the Downhill Simplex method (NELDER; MEAD, 1965).
Binaries of data equilibrium previously produced by LMA (100 scores for each system) were used for ANNs training so that a model adequately representing the exchange process of each system under analysis would be obtained.In this case ANNs' entry variables were total concentration of the liquid phase (N) and the compositions of each species; compositions in the solid phase were used as exit variables.
Ternary system's equilibrium data were predicted by employing the 100 data produced in each binary pair (300 scores in all) for training.ANNs' entry and exit variables were the same as those used in the network training for modeling the binary data.However, data were fed as ternary data, or rather, the normal fraction of the metal absent in the binary system was presumed to be equal to zero.Several network architectures were tested to obtain a structure with a good performance in the prediction of ternary equilibrium based on the target analysis.
So that the performance of Artificial Neural Networks in the prediction of the ternary system could be improved, other tests were undertaken using the network structure which had the best performance in previous tests.Five ternary experimental data were randomly inserted to the data set used previously in ANN training and thus concluding the validity, as has been done with other methodologies.

Results and discussion
Modeling equilibrium binary data By using MLA for the modeling of binary data, the parameters of the systems SO 4 2--NO 3 -, SO 4 2--Cl - and NO 3 --Cl -were adjusted as from the equilibrium binary data of the systems under analysis obtained by Smith and Woodburn (1978) and provided in Table 2. Table 2 shows equilibrium constants, Wilson's parameters and the rates of target functions obtained in current research for the optimization of these parameters.
It may be verified from Table 2 that parameters estimated by the Law of Mass Action have different rates than those originally obtained by Smith and Woodburn (1978).This difference is due to the type of target function used in the two research works.The target function in Smith and Woodburn (1978) was the coefficient of selectivity ( ) λ defined by Equation, whereas in current research it comprised the minimization of error among the compositions of ions in the resin.Figures 1, 2 and 3 show that MLA described in a precise way the experimental data of binary equilibrium obtained by Smith and Woodburn (1978).
The Law of Mass Action methodology was successfully employed by Shallcross et al. (1988), Valverde et al. (2002) and Vo and Shallcross (2003) who applied it for the prediction of the binary and ternary systems.
Several structures were tested to model the binary data by ANNs to obtain the structure that best represented the equilibrium data analyzed.Table 3 shows structures that produced the best result for each system and the respective rates of target functions and absolute average deviation (AAD).Table 4 presents results from the Law of Mass Action for each system, coupled to the respective rates of the target function and relative average deviations (AAD).Table 3 shows that ANNs adequately represent binary equilibrium data since target function and ADD rates, obtained from each system, were low.The comparison of the two methodologies showed that both described with precision the experimental data of equilibrium, which may be observed in Figures 1, 2 and 3.However, ANN application is more advantageous when compared to that of MLA, since data of resin composition may be directly obtained.This is due to the fact that MLA requires the solution of a non-linear system with the unknowns N-1, in which N is the number of ion species that participate in the exchange.In methods for the solution of equation systems, their convergence highly depends on a good initial estimate.

Prediction of ternary equilibrium data
Two approaches were employed to predict ternary equilibrium data, or rather, solving the equation system and predicting by ANNs.Whereas in the former, the adjusted parameters of binary systems were used (Table 2), prediction by ANNs was done by equilibrium curves produced by MLA applied to the binary data for the training of networks and experimental data, as a validation set.Neural networks with different structures were tested with variations between 4 and 14 in the number of neurons of the entry and intermediate layers.It has been verified that ANN had the best performance with 13-12-3 and target function equal to 3,953 x 10 -3 .
For the prediction of experimental data of ternary equilibrium, the network with the best target function was used.Table 5 shows the results.Other tests were undertaken with the addition of experimental data of ternary equilibrium applied to the Artificial Neural Network. Figure 5 shows improvements in the description of the ternary system equilibrium.AAD rates were equal to 11.55% for ANN trained with ternary data.Using only binary data, modeling by ANN presented AAD equal to 13.15%.
Results in Figure 5 show that ANNs failed to describe with precision the experimental data of equilibrium of the ternary system SO 4 2--Cl --NO 3 -.This fact demonstrates that the methodology is non-efficient in representing the equilibrium data of the ternary system, due to the fact that the network was trained only for binary equilibrium data.

Conclusion
In current investigation, the efficiency of the two methodologies, the Law of Mass Action and the Artificial Neural Networks, were compared with regard to the representation of data of the binary (SO 4 2--NO 3 -, SO 4 2--Cl -and NO 3 --Cl -) and ternary (SO 4 2--Cl --NO 3 ) equilibrium.
ANNs and the Law of Mass Action described with efficiency the binary equilibrium data which may be represented from AAD rates given in Tables 2 and 4, with close results obtained by MLA and ANNs.
ANNs did not reveal a good capacity for the prediction of the ternary system although Artificial Neural Networks fed with binary and ternary equilibrium data (AAD = 11.55) had a better efficiency than that trained only with binary data (AAD = 13.15).The Law of Mass Action (AAD = 10.07)managed to predict satisfactorily the behavior of the ternary system equilibrium.In fact, it was the methodology with the highest efficiency.
Nevertheless, the application of ANNs may be an alternative to conventional modeling since it calculates explicitly the fraction in phases in equilibrium.MLA requires the solution of nonlinear equation system.

Figure 5 .
Figure 5. Result from Modeling of Ternary Data by ANN with the addition of 5 data from Ternary Equilibrium.

Table 1 .
B rates in the calculation of the coefficient of ion activities in the solution.

Table 2 .
Parameters estimated by the application of the Law of Mass Action to binary data.

Table 3 .
Results from the application of ANNs to binary data.

Table 4 .
Results from the application of LMA to binary data.