Modeling and Control of a Biodiesel Transesterification Reactor

Dynamic Models for predicting the concentration profiles of the reactants and product in a Continuous Stirred Tank Reactor for the transesterification of used cooking oil (triglyceride) to biodiesel has been developed using the principle of conservation of mass. The developed system of differential equations were integrated numerically using fourth order Runge-Kutta algorithm embedded in ode 45 solver of 7.5 Mathlab program. The models were vali-dated by solving the model equations with kinetic data and other relevant data from literatures. The results and trends were similar and in agreement with those from these literatures. Simulations of the reactor to (±) step changes in the inlet flowrates of the reactants (used cooking oil and methanol) showed great effect on biodiesel production, (instability—oscillations and reduction in output concentration of biodiesel). A feedback control strategy was developed with a Proportional-Integral (PI) Controller and a close loop model was developed for control studies. The closed loop response of the reactor output (biodiesel concentration) showed continuous oscillatory response with offset. Hence the controller parameters (proportional gain C K and integral time I τ ) were tuned using the “On-Line Trial and Error Method” implemented using MathLab Simulink to obtain optimum values that ensured quick stability of the closed-loop system, reduced or no oscillatory response and no offset. The optimum controller parameters were: proportional gain and integral time τ = 17.157 minutes.


Background of Study
The increased demand for food, better communication technology, housing, How to cite this paper: Adokiye, T., Gunorubon, A.J. and Kenkugile, D.K. (2020) Modeling and Control of a Biodiesel Transesterification Reactor. Advances in Chemical Engineering and Science, 10, means of transportation, clothes and better standard of living has led to considerable increase in the number of industries and manufacturing companies. The resulting effect is increased energy consumption and requirement; hence necessitating increased research into readily available, sustainable and environmentally friendly energy sources. These energy sources include nuclear energy, fossil fuels (petroleum energy), solar energy, wind energy, hydro energy, and other alternative sources such as biofuel. In this group, biofuel has the advantage of producing no net output of carbon in the form of carbon dioxide [1], and is rapidly biodegradable and completely non-toxic; hence spillages are of less risk than fossil diesel spillages [2]. An important type of biofuel is biodiesel, which has become the foremost alternative biofuel being developed to reduce the World's dependence on fossil fuels. Also, growing concern on the use of fossil fuel particularly due to its environmental effects has made biodiesel an alternative fuel to those refined from petroleum feedstock as it reduces greenhouse emissions [3]. Its higher flash point than fossil diesel makes it safer in the event of a crash and it also has fuel properties similar to diesel fuel [4]. Biodiesel can be produced from renewable sources such as vegetable and animal oils, as well as from wastes, such as used cooking oil through a process called transesterification [5] which is the chemical reaction between triglyceride and alcohol in the presence of a catalyst to produce biodiesel and glycerol.

Biodiesel Production
The general reaction scheme and the set of consecutive reversible reactions for the transesterification of triglyceride (fat or oil) as given by [6] are shown in Figure 1.
In a typical esterification process, the triglyceride reacts with alcohol in the presence of a catalyst (usually a strong alkaline like sodium hydroxide) to form the mono-alkyl ester, or biodiesel and crude glycerol. Methanol or ethanol is the alcohol mostly used and produces methyl or ethyl esters respectively with potassium or sodium hydroxide as catalyst.
Researches on the effects of process parameter aimed at establishing optimum reaction conditions for maximum and profitable biodiesel production include works on the effects of temperature and pressure [20]; methanol-oil molar ratio [21], mixing rate [18], catalyst type [16] [22] and optimization of reactor parameters by [23] and [24]. The reaction mechanism for the transesterification of used vegetable oil to biodiesel occurs via a series of three-stage reversible reaction scheme; as with reversible reactions, the reactions can proceed in either direction if not effectively controlled. Implementation of an appropriate control strategy will ensure optimum biodiesel production and process stability. Research on the control of the biodiesel reactor is scanty, except the works of Mjalli & Hussain (2009) [25] that compared the predictive and self-tuning adaptive control strategies for biodiesel reactor and Olufemi & Ogbeide (2017) [26] that designed non-linear controllers for the biodiesel reactor. In this work a model for a feedback control strategy with Proportional Integral (PI) controller was developed for the continuous stirred tank reactor and used to study the effect of disturbance and determine optimum controller parameters that will ensure increased biodiesel production and stability of the reactor.

Methods
The mathematical models of the continuous stirred tank reactor (CSTR) were developed by applying the principle of conservation of mass on the reactor. These models (open loop process models) were ordinary differential equations and were solved with industrial process data [21] [26] [6] using the ode45 solver from MATLAB 7.5.0. The open loop models were used for reactor simulation to determine the effects of step-changes of ±10% in the reactants flowrate on the reactor performance-the concentrations of biodiesel produced. Simulation results showed instabilities in biodiesel concentrations due to changing reactants flowrate, hence requiring reactor control. The control objective was to ensure maximum production (concentration) of biodiesel as fluctuations in the inlet reactants flowrate occur. The feedback control configuration with Proportional-Integral (PI) controller was used to effect the control action. A closed loop block diagram of the process was drawn, from which the closed loop model of the process output (biodiesel concentration) was developed. The closed loop model equation of the process was developed in terms of the transfer functions of the components of the closed loop block diagram. To effectively ensure this control which is to minimize the effects of disturbances, obtain rapid and smooth responses to set point changes with little or no oscillations and eliminate steady state error (offset); the optimum values of the controller parameters (controller gain C K , the integral or reset time I τ ) had to be determined. This was achieved by controller tuning. This is a systematic selection of controller parameter values that achieves control objectives. An iterative procedure using the On-Line Trial and Error Method with the initial values of the parameters determined using the Ziegler's method of direct substitution for stability [27] implemented with MathLab Simulink was developed. The values of these parameters that stabilize the output in the reactor are the optimum controller setting for effective control of the process.

Reaction Kinetics
The reaction mechanism for a transesterification process [6] is given in Figure 1 was used to obtain the corresponding reaction rates for the reactions assuming first order elementary reaction rate as follows:

Open Loop Reactor Model
The open loop model is the model of the process without any form of control. In formulating the process (Continuous Stirred Tank Reactor) model, the following simplifying assumptions were made: the reactants were perfectly mixed therefore outlet conditions were the same as conditions within the reactor, density is constant and heat capacity varies negligibly with temperature, the reactor is perfectly insulated and there is no heat loss. Applying the principle of conservation of mass to each reaction component (i) involved in the process gave the model equation for constant reactor volume: Equation (7) can be written for each component by substituting the reaction rate of the various components as follows: Triglyceride: Diglyceride: ( ) Monoglyceride: Methyl Ester (biodiesel): Glycerol: These derived equations are the open-loop models for the transesterification process.

Closed Loop Reactor Model-Process Control
The Control Objective was to ensure the concentration of biodiesel (methyl ester) from the reactor was maintained at a maximum pre-specified level (stable and does not fluctuate with time) in the face of changing disturbances (step changes in the inlet feed flow rate-a Servo problem). The closed loop diagram of the process is shown in Figure 2 and the block diagram in Figure 3.   ) and load/ disturbance ( ( ) s d ) changes to give: where: ( )

Determination of the Transfer Functions
The transfer function of each component was obtained by expressing the component model equation in deviation variables form, Laplace transform the resulting equation and rearrange the final equation in the input-output form. The transfer function for the various components in the closed loop diagram ( Figure  3) was therefore obtained following this procedure as follows: 1) Process The transfer function for the process was obtained as: 2) Controller: Proportional-Integral (PI) Controller The controller of choice varies between the Proportional Integral (PI) and a Proportional Integral Differential controller (PID). As a result of the noise signal which cannot be accounted for within the framework of this study, a PI controller was used. The model equation for the output of a PI controller in deviation variables is [25]: Equation (17) was laplaced and rearranged to obtain the Transfer function as: where: c K = proportional gain; I τ = reset time.

4) Final Control Element (The Control Valve)
The values of the transfer functions of the measuring device and the final control element as given by Equations (19) and (20) are usually assumed as the transfer functions of these components of the closed loop do not change and have minimal effect on the system [27].

Reaction Rate Constants
The reaction rate constants for the transesterification process of palm oil as the triglyceride [6] was used in this study are as follows (Table 1).

Controller Parameter/Constants
The controller parameters: the proportional gain and reset time for the PI controller were determined using an iterative procedure-the On-Line Trial and Error Method with the initial values of the parameters determined using the Ziegler's method of direct substitution for stability [27].

Open Loop Model
The model equations are a system of coupled non-linear differential equations and were solved using Runge-Kutta 4 th order.

Open Loop Model Results/Response
The results obtained by solving the open loop model equations for the various components of the esterification reaction give the behavior of these components in the reactor. These results as predicted by the model equations are shown in Figures 4-9. Figure 4 and Figure 5 show how the concentrations of the reactants-triglyceride and methanol vary in the reactor with time.
The concentrations of the reactants-triglyceride and methanol decreased continuously with time as the reaction proceeds and becomes gradually constant-equilibrium gradually attained as reaction stops. Figure 6 and Figure 7 show the behavior of the intermediate products (diglyceride and monoglyceride) produced in the course of the reaction.
The concentrations of diglycerides increased sharply initially and continuously until it reached a maximum in the first three quarters of the reaction time and thereafter, gradually decreased till the end of the reaction. Similarly, the concentrations of monoglyceride increased slowly and continuously until it reached a maximum and thereafter gradually decreased to a very minute concentration at the end of the reaction. This confirms the formation of monoglyceride as an intermediate product which was almost completely used up during the reaction as shown by its concentration at the end of the reaction. These results and trends were similar and in agreement with similar works on the transesterification of The results of the concentration of the products-methyl ester (Biodiesel) and glyceride are shown in Figure 8 and Figure 9.
From Figure 8 and Figure 9, the concentrations of methyl ester and glyceride increased gradually continuously throughout the course of the reaction with the      rate of production of methyl ester (biodiesel) much higher than that of glyceride. The concentrations of these products increased continuously and gradually attained equilibrium towards the end of the reaction.

Effect of Disturbance-Step Changes in Reactant Flow Rates
The effects of step changes (increase and decrease) in the reactants (triglyceride and methanol) flowrates on the concentrations of methyl ester (biodiesel) are Advances in Chemical Engineering and Science shown in Figure 10 and Figure 11.
A 10% step increase in the inlet reactants flowrates means more reactants are available for reaction, this results in an increase in the rate of reaction and a corresponding increase in products formed. Figure 10 shows an initial sharp increase in biodiesel concentration which became gradual, then there was a decrease for a while then an increase. This increase-decrease trend continued throughout the reaction period and finally increased gradually at the end of reaction. Similarly, a 10% step decrease in the inlet reactants flowrates means less reactants are available for reaction, results in a decrease in the rate of reaction and a corresponding decrease in products formed. Figure 11 shows

Closed-Loop Response: Effect of the Controller
The closed loop responses of the biodiesel concentration in the reactor with a feedback PI controller at varying values of the controller parameters (controller gain K C and integral or reset time τ I ) aimed at stabilizing the concentration level of biodiesel were investigated. A typical response is shown in Figure 12. The concentration levels during these variations oscillated progressively with increasing amplitude and a low or high period of oscillation. This showed that the process was still unstable and the controller required more tuning. The controller parameters were continuously adjusted in a systematic way until the "best" values of controller parameters for the process-values that gave faster and less oscillatory response that becomes stable in the shortest possible time were obtained. The optimum values of these controller parameters obtained were: K C = 8.306 and τ I = 17.157 mins.
The behavior of the biodiesel concentrations at these values for ±10% step changes in the inlet reactants flowrates is shown in Figure 13 and Figure 14.   As seen in these figures the PI control was able to almost eliminated the oscillation (nullify the effect of the disturbances), stabilize the process and gave higher production of biodiesel in both cases compared to when there was no controller in place.

Conclusion
A dynamic model has been developed for the continuous stirred tank reactor for the transesterification of used cooking oil (triglyceride) to biodiesel by applying the principles of conservation of mass. The developed models were used to study the dynamic behaviour of the reactor. The model results gave the concentration time profiles of the reactants and products in the reactor. Simulation of the continuous stirred tank reactor to step changes in inlet reactants flowrate on the concentration time profile of the product-biodiesel showed fluctuations in the concentration time profile for biodiesel. Hence process control was effected using a proportional-integral feedback controller. A closed loop model (process with controller) was developed. The solution of the closed loop model to step changes in the inlet flowrate showed oscillatory response in the biodiesel concentration with offset over a long period. Controller tunning was therefore performed to obtain optimum values of the controller parameters (controller gain . 57 C I K τ = = mins which ensured stability and eliminated the offset (steady state error).