Yield Optimization Using Artificial Neural Networks in Biodiesel Production from Soybean Oil

Biodiesel plays an important role in reducing the dependency of petroleum fuels and reduce environmental pollution. Biodiesel has attracted attention as a renewable, non-toxic, and biodegradable fuel. In the past years, researchers have expanded their work to new methods of obtaining biodiesel. In this work, biodiesel production using soybean oil from the industry is described. Biodiesel was further analyzed and compared with the EN biodiesel specifications. The characterization of biodiesel was performed in order to obtain density, viscosity and flash point. Moreover, the study was focused in optimized the biodiesel yield, obtain from soybean oil using Artificial Neural Networks (ANN). The variable parameters were molar ratio between methanol and oil, reaction temperature and catalyst quantity. The paper concludes that the ANN can be successfully used to optimize the biodiesel yield.


1.Introduction
This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.
Vegetable oil is an organic complex mixture extracted from the seeds or other organs of a plant. Examples include olive oil, sunflower oil, soybean oil, castor oil and coconut oil.
Soybean oil consists of approximately 88.1%wt triglycerides, 9.8%wt phospholipids, 1.6% wt unsaponifiable components and 0.5%wt free fatty acids. Most of the oil is in the oil bodies (liposomes) of the cotyledon cells. Soybeans contain about 18% to 20% oil compared to other oilseeds, such as canola (40%) and sunflower (43%).
Soybean oil is currently a major raw material to produce biodiesel (NBB). The most common method of producing biodiesel is by catalytic transesterification of vegetable oils or animal fats with methanol or ethanol in the presence of sodium hydroxide (which acts as a catalyst) [1].
The transesterification reaction produces methyl or ethyl esters (biodiesel) and glycerol as byproduct. Catalytic transesterification is the most widespread method for biodiesel production. This involves breaking down the triglyceride structure and changing the alkyl groups with the hydroxide group in alcohol to obtain the new ester (biodiesel). The main purpose of transesterification is to reduce the viscosity and increase the volatility of vegetable oil. Reactions involved in biodiesel production can be homogenously catalyzed to achieve the maximum production in a relatively short time.
Cao et al [1] studied the transesterification of soybean oil in supercritical methanol in the absence of catalyst. A co-solvent, propane was added to the reaction mixture in order to decrease the operating temperature, pressure and molar ratio of alcohol to vegetable oil. A high yield of biodiesel was observed, and the process is environmentally friendly.
Xie et al [2] obtained biodiesel by transesterification of soybean oil with methanol using ZnO loaded with KF as a solid base catalyst. The authors found that the catalyst with 15 wt.% KF loading and calcined at 873 K showed the optimum activity. The results indicated that the activity of the catalysts was correlated with their basicity.
Shu et al. [3] synthesized the La/zeolite beta by an ion exchange method and used to synthesize the biodiesel (fatty acid methyl esters, FAME). The La(NO3)3 was applied as the ion exchange precursor to incorporate La ion into zeolite beta. The transesterification was carried out in a batch reactor and the composition of the FAME product was determined by a potassium hydroxide saponification method. Results of the experiment showed that La/zeolite beta shows higher conversion and stability than zeolite beta to produce biodiesel. The product consists of a mixture of monoalkyl esters primarily and the optimal reaction condition were found for, a molar ratio methanol/ soybean oil of 14.5, reaction temperature 333 K and catalyst/soybean oil mass ratio of 0.011.
Santos et al. [4] optimized the production of biodiesel from soybean oil and methanol using sodium hydroxide as catalyst. The study and optimization were carried out at low catalyst concentration (0.2 to 0.6 w/w). The reaction was carried out with application of low-frequency high-intensity ultrasound under atmospheric pressure and ambient temperature, in a batch reactor. Total consumption of oil was obtained when alcohol to oil ratio of 9:1 and catalyst concentration of 0.2% were applied.
Pasupulety et al. [5] realized the transesterification of soybean oil over calcium oxide supported on Al2O3 as solid base catalysts. Solid base catalysts were synthesized by wet impregnation of CaO on acidic, basic and neutral Al2O3. The catalytic system (with CaO + CDG-calcium diglyceroxide) on neutral Al2O3 showed higher activity in the transesterification of soybean oil.
Several authors [6][7][8][9] considered that density and viscosity are important properties of biodiesel. The developments of studies and mathematical models that can describe the influence of biodiesel proprieties present a great interest for the future. Biofuel obtained from soya bean has the better oxidation stability.
Farobie et al. [10] used spiral reactor to obtain non-catalytic biodiesel production with supercritical methanol (SCM) and supercritical ethanol (SCE). The experimental data were used to create artificial neural network (ANN) model in order to predict biodiesel yield. The results showed that ANN was the powerful tool to estimate biodiesel yield that was proven by a high value.
Yuste et al. [11] developed an artificial neural network (ANN) model 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 like 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.
Moradi et al. [12] studied the transesterification of soybean oil to biodiesel using KOH in different process conditions. Biodiesel yield for these conditions was obtained 93.2% in 1 h. In addition, the artificial neural network has been applied to estimate the biodiesel yield. The multilayer feed forward neural network with three inputs and one output has been trained with different algorithms and different numbers of neurons in the hidden layer.
This study focuses on transesterification of soybean oil to biodiesel using NaOH as catalyst for different experimental conditions. Also, the ANN was utilized to compute the optimum values for these operating conditions in order to obtain the maximum biodiesel yield.

2.Materials and methods
Soybean oil was purchased from a commercial society from Prahova County, Romania. The commercial sodium hydroxide was used as a catalyst in the transesterification reaction due to its efficiency. The soybean oil provided by the society was accompanied by a guarantee certificate of analyses that for company privacy we don't have the right to use it in this article. Soybean oil with an acid value of 0.2 mg NaOH/g and an average molecular weight of 884.65 g/mol was used in all experiments. Methanol was supplied by Merck at a concentration of 99.8%. https://doi.org /10.37358/Rev. Chim.1949 Rev. Chim., 71 (5)

Experimental operation
This spiral reactor was equipped with thermocouples connected with a union tee fitting to measure temperatures inside the reactor. The transesterification reaction was performed within one hour. The mixture was moved to a separating funnel allowing glycerin to separate for 24 hours. After glycerin removal, the mixture was washed three times with distilled water to remove the catalyst or glyceride residues. After reaching the desired working temperature, the catalyst and methanol were added to the laboratory reactor.
In order to obtain biodiesel for the 27 experiments performed, the following parameters were varied: reaction temperature, methanol/oil molar ratio, and NaOH catalyst concentration. The stirring time in the reactor was kept constant at 2h.

Biodiesel characterization
The specific density of the biodiesel obtained for the optimal conditions (60 0 C, 9:1) was determined using EN ISO 3675 method at 20 0 C. The obtained results were 875 kg/m 3 . The kinematic viscosity of the biodiesel was 3.11 mm 2 /s determined using ASTM 6751. The flow point was 2 0 C and the flammable temperature t760 was 178.63 determined using EN ISO 3679 method.
This International Standard ISO 3675 specifies a method for the laboratory determination, using a glass hydrometer, of the density at 15°C of products, and mixtures of products normally handled as liquids and having a Reid vapor pressure (RVP) of 100 kPa or less. ISO 3679 specifies procedures for flash point tests, within the temperature range of -30 °C to 300 °C, for paints, including water-borne paints, adhesives, solvents, petroleum, and related products. The procedures are used to determine whether a product will or will not flash at a specified temperature (flash no-flash Procedure A) or the flash point of a sample (Procedure B). When used in conjunction with a flash detector, ISO 3679:2015 is also suitable to determine the flash point of fatty acid methyl esters (FAME).

Artificial Neural Network
Artificial neural networks (ANN) are a branch of artificial intelligence (AI), a technology which is meant to simulate human intelligence. AI is used in a wide spectrum of fields to solve complex, nonlinear problems.
An ANN is an algorithm which simulates the functioning of animal nervous central system, especially the brain. The ANN can learn from examples, are fault tolerant and are able to handle noisy and complex data. Once trained, an ANN can predict at a high speed the information it was designed to predict to begin with.
To maintain the similarity with the biological nervous systems, an ANN is built from many computational devices, called neurons. The neuron of an artificial neural network has the structure presented in Figure 1 [13]: From Figure 1 it can be noticed that a neuron works based on some mathematical calculations. Thus, the input (noted with p) is multiplied by a weight, noted with w. The result of this multiplication is summed with the bias, noted with b. The resulting value is noted with n and it is called net input. The net input becomes the argument for the function f, which is called transfer function (or activation function). The result returned by the transfer function is noted with a and is the neuron output.
For a given set of values for w, p and b, the value of the output depends of the transfer function that is utilized. A couple of the most utilized transfer functions are presented in [13]: https://doi.org /10.37358/Rev. Chim.1949  The structure of the neuron from Figure 1 is presented for the case in which the neuron receives only one input. This was made intentionally, for simplicity reasons. In practice, a neuron very often receives two or more inputs. The only difference in this case is that the input, the weight and the bias are not scalars, but matrices and the subsequent computations are made taking this fact into account.
Each neuron from a layer has the same structure presented in Figure 1. The structure of a layer of neurons is presented in Figure 2  To successfully train a network, using supervised training, a training database is needed. A training database is a collection of input-output pairs which tell the network the proper behavior. The general structure of these pairs is presented in equation (1): In equation (1), the values , = 1 … represent inputs to the network and the values , = 1 … represent the correct corresponding outputs (target outputs). As the inputs are applied to the network, by training, the network outputs are compared to the targets.
Training an artificial neural network using supervised learning means adjusting the values of the weights and biases for each neuron so as the output of the network matches as closely as possible the outputs of the training database.
The artificial neural network used in this paper will be a network with a single hidden layer, trained using a supervised training algorithm. Thus, a training database is needed. It contains real results, obtained experimentally. The training database is provided in Table 2. As it can be seen in Table 2, the inputs for the ANN are temperature (°C), the methanol/oil molar ratio and the sodium hydroxide concentration. The output of the ANN is the biodiesel yield (%). The results obtained with the created artificial neural network will later be used to discover the parameters' values so as the yield is maximum.

Network framework
The Python language, version 3.7.4 was used to create and use the Artificial Neural Network. Python is a robust and powerful interpreted language that can be downloaded for free from the official site [14]. This language also has many libraries, which can be downloaded for free from Python's official libraries site, The Python Package Index [15].
To implement all the details required to configure and use an ANN, the latest version of the Keras library was used [16]. The backend and other libraries that are used by Keras also have the latest version.
The ANN used in this paper was created using the Sequential model provided by the library. Analyzing the training database from Table 2 and using trial and error, the following configuration was used:  3 neurons for the input layer. This is because there are three inputs for the ANN;  32 neurons for the hidden layer;  One neuron for the output layer. This is because the ANN has only one output. The transfer function for each neuron of the hidden layer was chosen to be the sigmoid function. The sigmoid function is a mathematical function whose graph is an S-shaped curve [13]. It is also known as the log-sigmoid function.
The transfer function for the output layer was chosen to be the exponential linear unit, shortly elu. Is another very used function for fast and accurate learning [17,18]. The mathematical expression for elu function is presented in equation (2): To train the created ANN, the following parameters were used:  Training algorithm: stochastic gradient descent. Learning rate: 0.0001;  Objective function to be minimized: mean squared error;  Function that evaluates the ANN training performance (metrics function): accuracy. The training algorithm, objective function and metrics function are thoroughly described in the Keras documentation [16].
The ANN training was made with the following settings:  1000 epochs;  Validation split: 0.25 (25% of the training database is used as validation data);  Shuffle the training data.

Optimization algorithm
The ANN created and trained as specified earlier was used for the optimization process, to determine the value of the three parameters that give the maximum yield . The optimization method  used involves creating a table with soybean oil yields given different values for the three inputs,  searching from the created table the maximum yield and taking as answer the three corresponding parameters. Because the training database is small (but well correlated), to offset the variance's influence on the results, for each input the experiment was repeated three times, taking as a result the average of the results obtained from these experiments.
The considered values of the three inputs were in the following range:  Temperature: between 45°C and 60°C, step 1°C;  Molar ratio methanol/oil: 3:1, 6:1 and 9:1;  NaOH concentration: between 0.5% and 2%, step 0.5% The optimization algorithm that was used has the following steps: 1. Initialization phase. The initial values of the three parameters are assigned: temperature is set to 45°C, molar ratio to 3:1 and the sodium hydroxide concentration is set to 0.5%. Also, assign 0 to variables a, b, c and d; 2.  (variables a, b, c and d) The presented algorithm returns the highest yield given the input data that must be processed by the ANN. If more detailed optimizations are required, the steps can be tweaked.
In the above algorithm, the significance of variables r, a, b, c and d are:  raverage estimated yield  amaximum yield;  btemperature where maximum yield is obtained;  cmolar ratio where maximum yield is obtained;  d -NaOH concentration where maximum yield is obtained.

Results and discussions
The experimental results obtained are presented in Table 2. This table displays reaction temperatures between 45 and 60 0 C. The biodiesel yield increased with an increasing reaction temperature. The maximum yield for soybean oil using NaOH was obtained at 60 0 C.
Three stoichiometric molar ratios of methanol/oil were considered: 3:1, 6:1 and 9:1. A 3:1 ratio was not enough to complete the transesterification reaction, so a higher ratio is required to achieve a higher reaction rate. For NaOH, the maximum yield was obtained for a molar ratio of 9:1.
The amount of NaOH catalyst used to obtain the soybean oil ranged from 0.5-2%. The maximum oil yield using NaOH was obtained for 0.5%. The decrease in the yield of biodiesel with the increase https://doi.org /10.37358/Rev. Chim.1949 Rev. Chim., 71 (5) of the amount of catalyst can be attributed to the saponification of triglyceride and the dissolution of methyl ester in glyceride. Therefore, the optimum conditions for maximum biodiesel yield were reaction temperature 60 0 C, 0.5% NaOH and molar ratio methanol/oil = 9:1.
Biodiesel yields from the experimental results were calculated by dividing the moles of product biodiesel by moles of fatty acid group in the initial triglyceride (TG) as: Biodiesel yield =mol of product biodiesel/mol of fatty acid group in initial triglyceride The optimization algorithm provided the results presented in Table 3. It is worth mentioning that Table 3 contains only partial results, including the optimum solution, due to space reasons. The relative error, specified in the above table was computed according to the formula: In formula (3), the notations are:  ethe ANN yield estimation (%)  othe biodiesel obtained yield (%) From Table 3, the ANN provides estimation relative errors that vary from 0.13% to 5.17% (the same thing is true for the results not included in the table), which makes the results obtained from the ANN reliable.
The highest estimated yield was 89.01% (the bolded line in the table), which is obtained at 60°C, 3:1 methanol/oil molar ratio and 0.5% sodium hydroxide concentration. This result is close to the experimentally obtained result of 90.7%, however, the difference is that the ANN estimated result uses a different ratio than the other type of result. The difference in results can be assigned to the number of data from the training database to begin with. If the number is larger (which, possibly, can lead to a reconfiguration of the ANN), the difference between the two types of results will be lower. On the other hand, there are only a handful of experimental data, taken at some precise points, which leads to a lower precision in determining the optimum solution experimentally.

4.Conclusions
In this study, biodiesel yields in methanol from soybean oil transesterification using spiral reactor were predicted using ANN model.