1.1. Background of Study
The increased demand for food, better communication technology, housing, 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 , and is rapidly biodegradable and completely non-toxic; hence spillages are of less risk than fossil diesel spillages . 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 . 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 . 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  which is the chemical reaction between triglyceride and alcohol in the presence of a catalyst to produce biodiesel and glycerol.
1.2. Biodiesel Production
The general reaction scheme and the set of consecutive reversible reactions for the transesterification of triglyceride (fat or oil) as given by  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.
Research on various aspects of the transesterification process abound: works on the use of various oils as feedstock for the transesterification process include the use of: coconut oil , cottonseed oil , cashew nut shell liquid oil , jatropha oil , sunflower , palm oil  and beef tallow by .works on catalysts used include: chemical (homogeneous—alkali or acid, heterogeneous—solid acid or solid alkali catalyst) and biological (immobilized lipases) , heterogeneous base catalyst from waste eggshell  ; reaction kinetics of transesterification of: sunflower oil , jatropha oil  and of palm oil , .
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 ; methanol-oil molar ratio , mixing rate , catalyst type   and optimization of reactor parameters by  and . The reaction mechanism for the transesterification of
Figure 1. General reaction scheme and consecutive reversible reactions for the transesterification.
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)  that compared the predictive and self-tuning adaptive control strategies for biodiesel reactor and Olufemi & Ogbeide (2017)  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.
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    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 , the integral or reset time ) 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  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.
2.1. Reaction Kinetics
The reaction mechanism for a transesterification process  is given in Figure 1 was used to obtain the corresponding reaction rates for the reactions assuming first order elementary reaction rate as follows:
2.2. Model Development
2.2.1. 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:
Methyl Ester (biodiesel):
These derived equations are the open-loop models for the transesterification process.
2.2.2. 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.
AAS—Atomic Adsorption Spectrophotometer.
Figure 2. Closed-loop diagram of the process.
Figure 3. Block diagram of closed-loop system.
The general model equation for the output of a closed loop process  was applied to obtain the output (concentration of biodiesel, methyl ester: ) of the closed loop process in the Laplace domain in terms of transfer functions of the various components in Figure 3 due to set point ( ) and load/ disturbance ( ) changes to give:
= Transfer Function for the Final Control Element
= Transfer Function for the Controller
= Transfer Function for the Process
= Transfer Function for the Load
= Transfer Function for the Measuring Device
For the servo control problem: the set point undergoes step changes while the load does not change ( ); the feedback controller acts to keep the concentration of biodiesel ( ) close to the set point (maximum concentration of biodiesel) .
The output from Equation (14) becomes:
2.2.3. 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:
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 :
Equation (17) was laplaced and rearranged to obtain the Transfer function as:
where: = proportional gain; = reset time.
3) Measuring Device (Differential Pressure Cell)
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 .
2.3. Determination of Model Parameters
2.3.1. Reaction Rate Constants
The reaction rate constants for the transesterification process of palm oil as the triglyceride  was used in this study are as follows (Table 1).
Table 1. Reaction rate constants.
2.3.2. 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 .
2.4. Solution Techniques
2.4.1. Open Loop Model
The model equations are a system of coupled non-linear differential equations and were solved using Runge-Kutta 4th order.
2.4.2. Closed Loop Model
Substitution of the expressions for the various components of the close loop model into the close loop model equation, rearrange and invert Laplace transform to obtain the expression for the concentration of biodiesel in the time domain as:
3. Results and Discussion
3.1. 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.
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.
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 used oil in the literature: Yusuff et al. (2014) ; Olufemi & Ogbeide (2017) ; Leevijit et al. (2006) and Theerayut et al. (2006) .
Figure 4. Concentration of triglyceride in the reactor with time.
Figure 5. Concentration of methanol in the reactor with time.
Figure 6. Concentration of diglyceride in the reactor with time.
Figure 7. Concentration of monoglyceride in the reactor with time.
Figure 8. Concentration of biodiesel in the reactor with time.
Figure 9. Concentration of glyceride in the reactor with time.
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.
3.2. Effect of Disturbance—Step Changes in Reactant Flow Rates
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 an increase-decrease trend in the biodiesel concentrations but with a decreased actual value at each time and at the end of the reaction when compared to the concentrations when there were no disturbances. For both cases there were varying distortions in the concentrations of biodiesel and the concentration did not attain equilibrium.
Figure 10. Effect of step increase in inlet reactant flow rates on the concentration of biodiesel in the reactor with time.
Figure 11. Effect of step decrease in inlet reactants flow rates on the concentration of biodiesel in the reactor with time.
3.3. 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 KC 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: KC = 8.306 and τI = 17.157 mins.
Figure 12. Typical behavior of biodiesel concentration during tuning of controller parameters.
Figure 13. Effect of controller to step increase in inlet flow rates on the concentration of biodiesel in the reactor with time.
Figure 14. Effect of controller to step decrease in inlet flow rates on the concentration of biodiesel in the reactor with time.
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.
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 , the integral or reset time ) of mins which ensured stability and eliminated the offset (steady state error).
 Zaher, F.A. and Soliman, H.M. (2015) Biodiesel Production by Direct Esterification of Fatty Acids with Propyl and Butyl Alcohols. Egyptian Journal of Petroleum, 24, 439-443. https://doi.org/10.1016/j.ejpe.2015.10.007
 Babulal, K.S., Pradeep, A. and Muthukumar, P. (2015) Experimental Performance and Emission Analysis of C.I. Engine Fueled with Biodiesel. International Journal of Innovative Research in Science, Engineering and Technology, 4, 133-138.
 Lin, C.W. and Tsai, S.W. (2015) Production of Biodiesel from Chicken Wastes by Various Alcohol-Catalyst Combinations. Journal of Energy in Southern Africa, 26, 36-45.
 Theerayut, L., Worawut, W., Gumpon, P., Charktir, T. and Michael, A. (2006) Transesterification of Palm Oil in Series of Continuous Stirred Tank Reactor. Asian Journal of Energy and Environment, 7, 336-346.
 Rismawati, R., Zakir, S., Ainun, P.H., Rasdin, J. and Rahmania, M. (2018) The Production of Biodiesel from a Traditional Coconut Oil Using NaOH/γ-Al2O3 Heterogeneous Catalyst. IOP Conference Series: Earth and Environmental Science, 175, Article ID: 012025.
 Shankar, A.A., Pentapati, P.R. and Prasad, R.K. (2017) Biodiesel Synthesis from Cottonseed Oil Using Homogeneous Alkali Catalyst and Using Heterogeneous Multi Walled Carbon Nanotubes: Characterization and Blending Studies. Egyptian Journal of Petroleum, 26, 125-133.
 Nivetha, K., Prethika, M., Suhanika, P. and Sivarajasekar, N. (2019) Production of Biodiesel from Anacardium occidentale Shell Coat Oil. American International Journal of Research in Science, Technology, Engineering & Mathematics, 217-221.
 Eboibi, B.E., Eboibi, O., Okputu, J. and Okpohwo, K.A. (2018) Production and Analysis of Biodiesel from Jatropha curcas Seed. Journal of Applied Sciences and Environmental Management, 22, 26-33.
 Nattee, A., Amaraporn, K. and Attasak, J. (2019) Production of Biodiesel from Palm Oil under Supercritical Ethanol in the Presence of Ethyl Acetate. Energy Fuels, 33, 5322-5331.
 Eevera, T., Rajendran, K. and Saradha, S. (2009) Biodiesel Production Process Optimization and Characterization to Access the Suitability of the Product for Varied Environmental Conditions. Renewable Energy, 34, 762-765.
 Leevijit, T., Wisutmethangoon, W., Prateepchaikul, G., Tongurai, C. and Allen, M. (2006) Design and Test of a Continuous Reactor for Palm Oil Transesterification. Songklanakarin Journal of Science and Technology, 28, 791-802.
 Manash, J.B., Ankur, D., Valentina, D., Borah, M.J., Das, A., Das, V., Bhagan, N. and Daka, D. (2019) Catalyst Low Cost Heterogeneous Catalyst from Waste Egg Shell. Fuel, 242, 345-354. https://doi.org/10.1016/j.fuel.2019.01.060
 Mjalli, F.S. and Hussain, M.A. (2009) Approximate Predictive versus Self-Tuning Adaptive Control Strategies of Biodiesel Reactors. Industrial & Engineering Chemistry Research, 48, 11034-11047. https://doi.org/10.1021/ie900930k
 Olufemi, A.S. and Ogbeide, S.E. (2017) Dynamics and Control System Design for Biodiesel Transesterification Reactor. International Robotics & Automation Journal, 2, 1-6.
 Claire, M. (2008) Evaluation of Heterogeneous Catalysts for Biodiesel Production. PhD Thesis, School of Chemical Engineering and Advanced Materials, Newcastle University, Newcastle upon Tyne, 6-12.
 Tan, Y.H., Abdullah, M.O., Hipolito, C.N. and Taufiq-Yap, Y.H. (2015) Waste Ostrich and Chicken Eggshells as Heterogeneous Base Catalyst for Biodiesel Production from Used Cooking Oil: Catalyst Characterization and Biodiesel Yield Performance. Applied Energy, 160, 58-70.
 Yusuff, A.S., Ekwonu, M.C., Ajala, I., Adeyi, A.A. and Awofolaju, T.T. (2014) Modelling and Simulation of Transesterification Reaction in a Batch Reactor. Journal of Bioprocessing and Chemical Engineering, 1, 1-5.