Energy & Fuels 2006, 20, 399-402
399
A Neural Network Approach to Simulate Biodiesel Production from Waste Olive Oil Antonio J. Yuste† and M. Pilar Dorado,*,‡ Department of Electronic, Telecommunication, and Automatic Engineering, UniVersity of Jae´ n, C/ Alfonso X el Sabio 28, 23700 Linares (Jae´ n), Spain, and Department of Mechanics and Mining Engineering, UniVersity of Jae´ n, C/Alfonso X el Sabio 28, 23700 Linares (Jae´ n), Spain ReceiVed July 22, 2005. ReVised Manuscript ReceiVed September 27, 2005
Most developed countries have environmental policies that promote the development and application of renewable energies, and among these is biodiesel. However, the optimization of the chemical reaction that is required to produce biodiesel, called transesterification, is a costly and time-consuming process that needs expensive reactants and laboratory equipment. In this context, an artificial neural network (ANN) model has been developed to simulate biodiesel production through the transesterification of used frying olive oil. Afterward, the model was validated with sets of experimental data obtained from the laboratory and that were not used during the training procedure. In this sense, simulated results were similar to those obtained with the help of the classical empirical tests required to perform the transesterification process in a laboratory, thus, indicating the simulated biodiesel yield function has properly reflected the real process. We can conclude that ANNs can be used to predict the biodiesel yield from used olive oil.
Introduction Most developed countries are becoming increasingly aware of the importance of environmental preservation. In this sense, to achieve a high level of environmental protection, environmental policies are promoting the use of renewable energies, punishing the emission of pollutants, and financing the research and use of renewable energies. Among many other alternative fuels for diesel engines that are derived from vegetable oils in its pure form, blended with diesel fuel or alcohol, winterized, and so forth, the one called biodiesel is the most widely accepted alternative to diesel fuel because of the similarity in its properties when compared to those of diesel fuel.1-3 Also, this alternative fuel for diesel engines emits a lower amount of the most regulated pollutants compared to diesel fuel.4 Biodiesel is produced by the transesterification of triglycerides (which can be found in animal fats and vegetable oils) with an alcohol in the presence of a homogeneous or heterogeneous catalyst. This reaction results in the production of monoalkyl esters, also called biodiesel, and glycerol as a byproduct.5 One of the main problems related to the wide acceptance of biodiesel is its economic viability. In this sense, to extend the use of biodiesel, it is important to decrease the costs related to biodiesel production. Otherwise, the transesterification of fats * Corresponding author. Phone: +34 953 648526. Fax: +34 953 648508. E-mail:
[email protected]. † Department of Electronic, Telecommunication, and Automatic Engineering. ‡ Department of Mechanics and Mining Engineering. (1) Dorado, M. P.; Ballesteros, E.; Arnal, J. M.; Go´mez, J.; Lo´pez, F. J. Energy Fuels 2003, 17, 1560-1565. (2) Geyer, S. M.; Jacobus, M. J.; Lestz, S. S. Trans. ASAE 1984, 27, 375-384. (3) Peterson, C. L. Trans. ASAE 1986, 29, 1413-1422. (4) Dorado, M. P.; Ballesteros, E.; Arnal, J. M.; Go´mez, J.; Lo´pez, F. J. Fuel 2003, 82, 1311-1315. (5) Otera, J. Chem. ReV. 1993, 93, 1449-1470.
and oils provides a costly fuel compared to diesel fuel. In fact, it is reported that approximately 70-95% of the final cost of biodiesel arises from the cost of the raw materials.6,7 So, to decrease the final cost of biodiesel, it is important to select inexpensive or low-cost raw materials, that is, used frying vegetable oil.8-11 On the other hand, time-consuming and costly laboratory tests are required to conduct the optimization of the parameters involved in the transesterification of the oils or fats, at each working condition. For this reason, it is of interest to implement a simulation process to accurately predict the biodiesel yield evolution while varying the initial condition values, thus, substituting part of the laboratory tests. Along these lines, an artificial neural network (ANN) model is an abstract simulation of a real nervous system that contains a collection of neuron units communicating with each other via axon connections. This technique is able to handle incomplete data, to deal with nonlinear problems, and once trained can perform predictions and generalizations at high speeds. Since the first fundamental modeling of neural nets was proposed in (6) Connemann, J.; Fischer, J. Biodiesel processing technologies. In International Liquid Biofuels Congress (unpublished). Curitiba, Parana, Brazil, July 19-22, 1998; 12 pp. http://www.biodiesel.de. (7) Krawczyk, T. In International news on fats, oils and related materials; American Oil Chemists Society Press: Champaign, IL, 1996; Vol. 7, p 801. (8) Nye, M. J.; Williamson, T. W.; Deshpande, S.; Schrader, J. H.; Snively, W. H. JAOCS 1983, 60, 1598-1601. (9) Mittelbach, M.; Pokits, B.; Silberholz, A. International Winter Meeting of the American Society of Agricultural Engineers, Nashville, TN, December 14-15, 1992; American Society of Agricultural Engineers St. Joseph, MI, 1992; pp 431-434. (10) Sams, T.; Tieber, J.; Mittelbach, M. Biodiesel from used frying oil. Proceedings in ALTENER Conference: Renewable Energy Entering the 21st Century. Sitges, November 25-27, 1996; pp 1391-1408. (11) Dorado, M. P.; Ballesteros, E.; Mittelbach, M.; Lo´pez, F. J. Energy Fuels 2004, 18, 1457-1462.
10.1021/ef050226t CCC: $33.50 © 2006 American Chemical Society Published on Web 11/03/2005
400 Energy & Fuels, Vol. 20, No. 1, 2006
terms of a computational model,12 ANNs have shown their suitability in diverse fields such as control, robotics, pattern recognition, forecasting, medicine, power systems, manufacturing, optimization, signal processing, and social and psychological sciences.13,14 Although several approaches have been described in the field of renewable energies, they were mainly focused on the use of ANNs in solar radiation and wind speed prediction, photovoltaic systems, and biomass gasification and estimation.15-17 This suggests that ANNs can be used for modeling other types of renewable energy production and use, that is, biodiesel. The target of this study is to determine whether the ANN can accurately simulate the performance of the waste olive oil transesterification reaction in order to obtain biodiesel, under different working conditions. Also, another objective is to provide a tool to assist decision making during the experimental process of biodiesel production from waste olive oil. Materials and Methods 1. Laboratory Tests to Perform the Optimization of the Transesterification Process. Used frying olive oil was selected as a raw material and collected from several hospital kitchens (Ciudad Sanitaria Reina Sofı´a, Hospital General Provincial, and Hospital Los Morales, Co´rdoba, Spain). Samples were filtered from solid impurities, and methanol and KOH were chosen as the most appropriate reagents according to ref 11. The oil was preheated at different temperatures, and then, the solution of methanol and KOH was added. The mixture was stirred and heated at different temperatures. To carry out the optimization of the transesterification process, the parameters involved in the process were identified. The most important parameters were the amount of catalyst (KOH) and methanol (all of them related to the initial amount of oil), the reaction time, and the reaction temperature. The rest of the parameters affecting the process were considered to have a lower impact on the results and were discarded. Then, the optimum value of each selected variable was found, while the rest of the parameters remained constant. The optimization of the transesterification process was conducted following the procedure given by ref 11. 2. ANN Methodology to Simulate Transesterification Performance. The simulation model was performed by means of a multilayer perceptron network, which was chosen because it is one of the most elementary forms of neural network structures (Figure 1). As shown in Figure 1, the multilayer perceptron consists of artificial neurons that constitute the input, the hidden, and the output layers of the neural network model. The input nodes forward the values of the input variables to the hidden layer, and the output nodes produce the final model estimations. The next step consisted of ANN training. The learning rule of an ANN, also called the training algorithm, is a procedure for modifying the weights of a network, ωij, to decrease the error between the desired target values and the experimental output. In the present study, the Marquardt-Levenberg (ML) algorithm, which is a nonlinear least-squares algorithm applied to the learning of the multilayer perceptrons, was applied and chosen to establish the (12) McCulloch, W. S.; Pitts, W. Bull. Math. Biophys. 1943, 5, 115133. (13) Casilari, E.; Jurado, A.; Pansard, G.; Dı´az-Estrella, A.; Sandoval, F. Electron. Lett. 1996, 32, 363-365. (14) Williams, M. Talking nets: an oral history of neural networks; MIT Press: Cambridge, MA, 1998. (15) Del Frate, F.; Wang, L. F. Int. J. Remote Sensing 2001, 22, 12351244. (16) Kaligirou, S. A. Renewable Sustainable Energy ReV. 2001, 5, 373401. (17) Guo, B.; Li, D. K.; Cheng, C. M.; Lu, Z. A.; Shen, Y. T. Bioresour. Technol. 2001, 76, 77-83.
Yuste and Dorado
Figure 1. Multilayer perceptron model.
weight assignment.18 In summary, the ML algorithm is a modified Gauss-Newton method that minimizes the error function using the Jacobian matrix and the Hessian of the objective function, but without having to compute the Hessian. The adaptive term included in the ML algorithm consisted of the calculation of eq 1: ωk+1 ) ωk - [JTk Jk + µI]-1JTk e(ω)
(1)
where ω is the weight matrix, k is the layer, µ is the learning rate, I is identity matrix, and e(ω) is a vector of network errors (the difference between the real and simulated outputs). J is the Jacobian matrix of the objective function that is calculated as shown in the following matrix (eq 2):
[
∂e1
∂ω111
J)
∂e2
∂ω111 ‚‚‚
‚‚‚ ‚‚‚
∂e1 ∂b11 ∂e2 ∂b11
‚‚‚ ‚‚‚
∂e1 ∂ω211 ∂e2 ∂ω211
‚‚‚ ‚‚‚
∂e1 ∂b21 ∂e2 ∂b21
]
(2)
When the scalar µ is zero, this is just Newtons’s method, using the approximate Hessian matrix. The parameter µ is increased or decreased at each step. When the sum of squares function to minimize increases, µ is multiplied by a factor β. If the error is reduced, then µ is divided by β.18 To prevent overtraining, a technique called cross-validation was also used. Overtraining is the situation in which the network memorizes the data of the training set but generalizes poorly. Although the network was not trained with the cross-validation set, it used the cross-validation set to choose the best set of weights. To perform the cross-validation method, the data set was separated into two sets, called the training set (also divided into the training subset and the validation subset) and the testing set (drawn with the rest of the patterns). Learning was performed on the training set, and then, the validation subset was used to evaluate the quality of the result. Finally, when the error was adequate, the test set was used for prediction and final error measure. The test set was reserved to assess the final performance measure (generalization). During the training phase, the ML method was applied to the training set for at least 500 epochs, and the error of the validation set was tested. The stopping condition was given if the error of the testing set experienced a continuous increase. Then, to determine the feasibility of the new set of weights, the error of the testing subset was computed. The process was repeated until the residual between the model output and the desired output decreased and the model learned the relation between the input and the output. 2.1. Determining the Number of layers of the Perceptron and the Number of Neurons. The first step of the process was to find the number of layers, the number of neurons in the layers, and the (18) Hagan, M.; Menhaj, M. IEEE Trans. Neural Networks 1994, 5, 989993.
ANN to Simulate Biodiesel Production
Energy & Fuels, Vol. 20, No. 1, 2006 401
type of neurons or activity function that correlates input and output. The most appropriate forms of the activity function were found to be a hyperbolic tangent function for the hidden layer and a linear transfer function for the output layer. The relationship between the input and the output of the ANN is shown in eq 3: f(n) )
2 -1 1 + e-2n
(3)
where the input to neuron j in layer k is ikj )
∑w
k k-1 i j,ioi
+ bkj ,
k ) 1:2
(4)
where b is the bias and the output from neuron j in layer k is o0j ) xj
(5)
As previously mentioned, the selected ANN was a multilayer okj ) f(ikj ),
k ) 0:2
(6)
Figure 2. Heuristic determination of the optimum number of neurons of the hidden layer.
perceptron network, with three layers of neurons (an input layer, one hidden layer, and an output layer). The number of input layer neurons was five and consisted of (Figure 1) the amount of catalyst (x1), the amount of oil (x2), the amount of alcohol (x3), the reaction temperature (x4), and the reaction time (x5). This set of variables constitutes the input data vector of the proposed multilayer perceptron. One output layer neuron, biodiesel yield (y), was determined in all cases, while the number of hidden neurons was determined by a heuristic procedure. This procedure consisted of testing different number of neurons, where the mean error of the output data for a small number of iterations in the batch training algorithm was verified. To perform the modeling technique, a set of input-output data was required. The convergence criterion consisted of minimizing the mean squared error, which is the difference between the neuron response and the corresponding correct (target) output, to a value less than 10-3.
Results and Discussion As mentioned before, the ANN built for this research was a multilayer perceptron network, with three layers of neurons. The number of input layer neurons (x1, x2, x3, x4, and x5) and output layer neurons (estimated biodiesel yield) was fixed (see Materials and Methods), while the number of hidden neurons was determined by a heuristic procedure. This method revealed that the optimum number of hidden neurons was 13. Results of this process are plotted in Figure 2. During the training, to adjust the weights, the cross-validation technique was used. Figure 3 shows an example of the first stage of the process. A value of µ ) 0.001 was used as a starting point, with β ) 10. It can be seen that the initially high mean squared error descended quickly to a small value. The process ended when the validation subset error reached the desired low value. Figure 4 shows the relative error of several patterns according to this subset. Although Figure 4 plots a pattern with a high relative error, the mean relative error is very small. To perform the modeling technique, a set of input-output data was required. From the available data, some of them were used for training the model, and the remaining data (still a high amount of data, called the testing set) were employed afterward to validate the network training and to check the prediction power of the present proposal. The sizes of the training and testing data sets were 45 samples. According to this, a set of 45 biodiesel samples was used for training the neural network. For these samples, the amount of catalyst (x1) varied from 0 to 2.65 g, the amount of oil (x2) from 90 to 110 g, the amount of
Figure 3. Training with LM method. Calculation of the weights during the convergency of the neural network.
Figure 4. Relative error of the network validation subset.
alcohol (x3) from 0 to 18 g, the reaction temperature (x4) from 0 to 70 °C, and the reaction time (x5) from 0 to 60 min. Once the ANN was trained and validated, the proposed ANN successfully predicted a set of 45 biodiesel samples picked at random from the region defined for the testing set. The results
402 Energy & Fuels, Vol. 20, No. 1, 2006
Yuste and Dorado Table 1. Weights and Bias of the Neural Network
weights between input and hidden neuron layers (W1)
bias of the hidden neurons (b1)
weights between hidden and output neuron layers (W2)
bias of the output neuron (b2)
-22.80 2.63 -113.35 -61.85 -177.25 4.70 2.44 -0.01 1.88 -2.37 20.60 15.03 -112.73
10.62 1.95 179.41 -443.98 60.72 -1.54 159.17 -4.22 1.29 -96.11 1.69 0.62 12.74
-18.09 -2.70 -604.91 604.95 -1.39 -3.73 -472.87 -8.63 1.41 -469.32 44.80 55.56 3.41
2.48
17.49 -2.57 -499.75 194.21 67.89 5.06 -161.85 -7.12 5.09 168.23 -48.45 3.84 7.59
34.18 -7.61 600.30 439.88 29.24 1.50 -11.49 -1.57 -1.04 11.67 55.26 0.25 -9.54
22.85 2.18 -49.26 -32.87 75.50 4.45 15.91 -1.82 -0.02 -114.29 -7.26 -10.91 45.33
9.99 50.31 -5.79 -4.08 -103.42 2.44 -0.19 -4.40 1.31 0.83 9.64 -0.72 46.28
are depicted in graphical form in Figure 5. Table 1 shows the weights of the neural network employed to obtain Figure 5. This table makes possible the prediction of the biodiesel yield under different input conditions. We would like to remark that the validation data were not used in the training process. Thus, the results in Figure 5 show how the neural network (NN) is able to predict results which were not known a priori. These data are actually obtained by means of experimental procedures which could be saved by the use of NNs. This fact provides the main contribution of this work. However, the NN described in Table 1 is restricted to predict data inside the region of the training samples, and extrapolation to another region could lead to nonsense results, as a consequence of the inherent limitations of NNs.19 It is worth noticing, in general, that the predictions
obtained from the ANN technique were very good for all situations during biodiesel production, thus, demonstrating the ANN’s modeling capabilities. Conclusions The results demonstrate that the ANN represents a strong alternative to the extensive laboratory testing needed to find out the optimum parameters to produce biodiesel from waste olive oil. In fact, simulated and experimental values are almost the same. This methodology has proven to be capable of modeling the production of biodiesel from waste olive oil, which is a process with a high nonlinear behavior. Usually, its utilization requires a big set of experimental information to train the network, though in this case, the availability of a minimum amount of experimental data would have permitted the training of the network. The reason for this is that experimental data are uniformly distributed within the operating region and properly cover the surface response of the process under investigation. In the present work, however, a big set of experimental data was available. This knowledge makes possible the establishment of a comparison between the experimental and estimated data (from the expert system), leading to a better understanding of the influence of the interactions between the reaction parameters, thus, helping to improve the transesterification process to produce biodiesel from waste olive oil and, in summary, reducing costs and long time-consuming laboratory tests. Acknowledgment. The authors wish to thank the Delegacio´n Provincial de la Seguridad Social de Co´rdoba (Spain) that provided the waste oil samples for testing. EF050226T
Figure 5. Estimated versus measured biodiesel yield.
(19) Karonis, D.; Lois, E.; Zannikos, F.; Alexandridis, A.; Sarimveis, H. Energy Fuels 2003, 17, 1259-1265.