A Predictive Neural Network-Based Cascade Control for pH Reactors

This paper is concerned with the development of predictive neural network-based cascade control for pH reactors. The cascade structure consists of a master control loop (fuzzy proportional-integral) and a slave one (predictive neural network). The master loop is chosen to be more accurate but slower than the slave one.The strong features found in cascade structure have been added to the inherent features in model predictive neural network. The neural network is used to alleviate modeling difficulties found with pH reactor and to predict its behavior. The parameters of predictive algorithm are determined using an optimization algorithm. The effectiveness and feasibility of the proposed design have been demonstrated using MatLab.


Introduction
The predictive neural network control (PNNC) is a straightforward application of neural networks to nonlinear control [1][2][3]. It is a combination of the main features of neural network (NN) with model predictive control (MPC). MPNNC is applied to industrial processes which usually contain extreme nonlinear dynamics. It aims to predict the behavior of the process with the existence of moving reference trajectory and disturbances by minimizing a certain cost function that takes into account the future output prediction errors [4].
The classical feedback control structures are not very efficient with industrial applications that contain complex nonlinearities. Hence, to enhance the stability of the controlled plant at different reference trajectories and to modify the dynamic features by reducing the settling time, a cascade control structure could be developed with a slave control loop faster but less accurate than the master one [5,6]. This control scheme would modify the overall performance of the controlled plant when comparing with the conventional control structures.
The chosen case study in this paper is the pH reactors. The difficulty of controlling pH processes resides in the nonlinear dynamics and parameter uncertainties of such processes. This behavior is due to the logarithmic relationship between the hydrogen ions concentrations [H + ] and the pH value [1]. This paper illustrates feasible control of the pH titration plant using predictive and intelligent-based techniques. It also investigates the performance of predictive neural network controller in cascaded structure against the more traditional single loop fuzzy PI controllers. As conclusion, the proposed cascaded structure and the MPNN controller have outperformed the conventional ones. Simulation results have been obtained using MatLab/Simulink. These results demonstrate the feasibility and effectiveness of the proposed design. This paper is structured as follows: in Section 2 the theoretical background of classical, neural network-based model predictive control algorithms and the cascade control structure are presented. In Section 3 the modeling and control of pH reactor are represented as a case study. Performance of the proposed controller, interpretation of results, and conclusions are presented in Sections 4, 5, and 6.

Neural Network-Based Modeling and Control.
To overcome the difficulties in the mathematical modeling of pH reactors in titration processes, many techniques would be used and have the capabilities to meet such demand. In our case, a data-based predictive neural network model is utilized.
Neural networks have been increasingly used in the chemical process industry [7], especially for modeling and control of some complex nonlinear processes where process understanding is limited [5]. For example, in the 90s of the last century, many researchers have explored the integration of process knowledge into black box models to provide "grey box" or "hybrid" models [8,9]. Over the years, there has been a tremendous amount of research focusing on modeling and control of pH chemical reactors with different control strategies [7][8][9][10][11]. A few of these researches undertaken over the past 5 years include nonlinear-based control; fuzzy control with genetic algorithm; adaptive heuristic control; PID-fuzzy control; and nonlinear generalized predictive control [7].
In this paper, a predictive neural network (PNN) model based on the experimental data is developed to study the performance of pH reactors in titration processes under different operating parameters such as the fluctuation in feed flow rate of acid and nonstationary pH setpoint. The proposed model was found to be capable of predicting accurately the unseen data of the titration process. The prediction error between the NN predictions and experimental data was found to validate our approach, as will be seen later.
The three steps involved in the development of NN model are the following: (a) Generation of input-output data to train the network: these data should contain all the relevant information about the dynamics of pH reactors. The input was given to the conventional model of the pH reactor and from the conventional model, the input and output were sampled for 0.02 sampling instants and the required sampled data are obtained to train the network. (b) The sigmoid activation function of a feed forward network was selected based on the trials with different structures of multilayer perceptron. The NN topology selected here consists of 4 neurons in the input layer, 7 neurons in the hidden layer, and one neuron in the output layer. Hence it is selected as optimal architecture of NN (lowest error), Figure 1. The back propagation algorithm is used in  the modeling of pH reactor as a training algorithm. Before training the process weights are initialized to small random numbers. The weights are adjusted till error gets minimized for all training sets. When the error for the entire set is acceptably low, the training is stopped. Table 1 shows the parameters used in developing the NN-based model for the pH reactor.
(c) Model validation: the final step is the validation. It aims to evaluate the model performance using training and test data. The input and target were presented to the network and the network was trained using Levenberg-Marquardt algorithm.

Classical Model-Based Predictive Control (MPC).
The scheme of classical MPC is shown in Figure 2. It consists of the plant model and the optimization block. It is one of several different model-based control techniques that are associated with the same idea, as it is.
Its target is to predict the future behavior of the process over a certain time horizon using the dynamic model and obtaining the control actions to minimize a certain criterion: where ( + ) is process output, ( + ) is reference trajectory, and ( + ) is the control output. It presents thestep ahead predictions. 1 and 2 are the limits prediction horizon of the controlled variable. is the prediction horizon of the reference signal; it is used to reduce the computational load of the method. is the weight of the control output [1].
Only the first control signal of the calculated sequence is applied to the controlled process at each sampling period. At the next sampling time the procedure is repeated. This is known as the receding horizon concept [1,2].
The process input and output constraints are as given in MPC algorithms are considered to be robust ones in industrial control applications because of their ability to handle constraints. Figure 3 shows the neural network (NN) as a function approximator. It has been applied very successfully in the identification and control of dynamic systems [5]. The unknown function corresponds to a controlled plant, and the neural network is the identified plant model. The difference between plant output and the NN output is the prediction error which is used as the NN training signal. NN uses previous inputs/outputs to predict future values of the plant output.

Model Predictive Neural Network Control (MPNNC).
Levenberg-Marquardt (LM) algorithm is used as an iterative technique to train the net. It locates the minimum of a function that is expressed as the sum of squares of nonlinear functions. The NN can be trained offline in batch mode, using data collected from the operation of the plant [1].

Cascade Control Structure.
Cascade control is a multiloop scheme commonly used in chemical plants [6] that can improve control performance of a system, when disturbances affect the control input. It consists of outer (master, C1) and inner (slave, C2) loop as shown in Figure 4. Inner and outer control loops are formed each with an individual feedback controller. The major benefit from using cascade control is that disturbances arising within the secondary loop are corrected by the secondary controller before they can affect the value of the primary controlled output.
The slave controller (C2) is tuned from model parameters (P2), while the master controller (C1) is tuned with the inner loop in operation from model parameters (P1).

Case Study
pH reactor system ( Figure 5) is a typical chemical reactor system with extremely nonlinear dynamics. It is one of the plants that submit challenges to scientist and engineers because of the lack of understanding the dynamics of such process and the difficulty to develop a suitable control strategy.

Modeling of Chemical
Reactor. The pH reactor has two input continuously flowing streams (base and acid), and this continuity of the process gives the titration a special theme, in which the dynamics of the titrated streams are involved. Referring to literature in modeling and dynamics of pH reactors [11][12][13], the following equation is derived: where and are the values of concentration for acid and base streams, respectively; and are their volumetric flow rates, respectively, and is a constant that depends on the strength of acid entering the reactor ( = 1, for strong acid-strong base system).
For simulation purposes, we would consider the mixer is an ideal continuous stirred tank reactor CSTR. The pH model of (3) pretends that the water is at the ideal temperature. Moreover, it is assumed that composition conditions which make the ion product exactly 10 14 , the concentrations of the acid and base, flow rates of the water, and value for the acid dissociation constant are known.
The titration curve, shown in Figure 6, shows clearly the direct S-relation between the pH value as a process output and the flow of base as a control output. So, pH is considered as the master process variable to be controlled that is affected directly by as a manipulated variable. The specifications of the considered pH model are that the strong acid (HCL) is flowing in constant value (2 mL/sec), its concentration is equal to 0.95 mol/L, the process variable will Flow rate, Q a Concentration, C a be the flow of strong base (NaOH), and its concentration is 1.9 mol/L.

Cascade Control of the pH Reactor.
The designed structure is the cascade one (Figure 7), where the outer fuzzy PIbased control loop (C1) is chosen to enhance stability at the final state, and the MPNNC (C2) is considered as an inner loop to improve dynamics by minimization of over/under shoots area and fasten the settling time.
Also, C1 is the outer (master) controller, C2 is inner (slave) controller, ADC is the analog to digital converter, DAC is the digital to analog converter, / is the pressure (3-15 psi) to current (4-20 mA) converter, F T T is the flow out transmitter of the product, F T C is the flow out controller of the product, pHT is pH transmitter, T S T is the temperature transmitter of steam in, F B CV i is the automatic control valve on the base stream, F A CV i is a manual-actuated control valve on the acid stream, T S CV i is the control valve on the steam in, 1 is the master controlled variable, 2 is the slave controlled variable,  U2 is the automatic setpoint of the slave controller, and U1 is measured setpoint of the master controller.

Fuzzy PI-Based Outer Loop (C1).
The outer controller has been chosen to be accurate but slower than inner controller and designed to enhance the stability of the overall dynamic response of the pH. The structure of the proposed fuzzy PI (C1) is shown in Figure 8. The goal of the proportional gain in fuzzy system ( FP ) is to maintain stability. But the integral gain ( FI ) is used to ensure low oscillations. Table 2 shows the fuzzy rule base for proportional gain FP and integral time FI (= 1/ FI ) where five fuzzy  Figure 8: The structure of PI controller with fuzzy adaptation (outer loop). triangular sets were considered for the error as a measure of the difference between the process output and its reference trajectory. Likewise, three triangular sets were considered for the output variables. For each case, five fuzzy rules were considered (Table 2).

MPNN-Based Inner Loop (C2).
The MPNN has been proposed in the inner loop to be faster than outer one (fuzzy PI-based one). It aims to modify the dynamics of the overall response of the plant and to upgrade the reference trajectory (SP2) of the slave controlled variable ( 2). The NN plant model is trained using the Levenberg-Marquardt algorithm. The training data were obtained from the nonlinear model of the pH reactor (see (3), Figure 6). The predictions are used by a numerical optimization program to determine the control signal that minimizes performance criterion over the specified horizon. The controller block was implemented in Simulink. Constraints and parameters values are 0 ≤ ≤ 0.02, 354 ≤ ≤ 365, 1 = 1, 2 = 7, = 3, and = 0.5. Figure 9 shows predicted plant output using predictive neural network when comparing with the real plant one. It is clear that the performance of the predictive neural network control (PNNC) is robust enough, since the predicted NN output well follows the real plant output referring to the same input function. The prediction error between the plant output and the NN output is used as the neural network training signal (Figure 3). Also, a random reference signal (as input function) is connected to the optimization block in the PNNC. Figure 10 demonstrates the simulation results obtained from implementation of the design shown in Figure 7.

Results
And hereby, to validate our design, the cascaded structure was compared with single feedback control structures, and the results are as given in Figure 11.
It has well been noted that the cascade MPNN-based structure ( Figure 10) provides enhanced stability and modified dynamics when comparing with conventional (singlefeedback) intelligent-based one, Figure 11.
The simulation results in Figures 10 and 11 are achieved at two operational modes of pH reactor, acidic solution when pH is equal to 13 and basic one when pH is equal to 4.5. And so, the nonlinear regions in the titration process and the linear ones, seen in Figure 5, are covered. Both cases aim to validate the proposed control philosophy (predictive NNbased cascade control) at two extreme and opposite operating conditions.

Interpretation of Results
The quantitative performance values, integration of absolute error (IAE), for the MPNN in cascade design and fuzzy PI controllers are calculated as given in The control performance of pH has been verified once with injection of acid stream flow rate as disturbance (rows 2 and 3) and also with submitting a nonstationary setpoint (rows 4 and 5).
It is well noted from Table 3 that when computing the IAE with single feedback design, it is found (as an example = 17.650) but for cascade structure it is equal to 3.333. So, it could be concluded that the single feedback design (column 4) is worse than that of cascade structure (column 3).

Conclusions and Future Work
6.1. Conclusions. This paper has demonstrated the usefulness and effectiveness of applying neural networks in a modelbased control strategy to control a pH reactor. Both the model predictive neural network as a master control loop and fuzzy PI controllers as slave one have been implemented in cascade structure ( Figure 6). The controller performance under multiple changes in setpoint as well as the effect of fluctuation in acid stream as a disturbance has been investigated. Comparison of performance with the conventional single feedback fuzzy PI controller indicated that cascade structure was more robust than the single feedback controller and gave better results in cases involving disturbances (Figures 10 and  11, Table 3).
Presented results confirm the known fact, with the chemical pH reactor, and when disturbances affect the control input, the cascade control structure can improve control performance in transient and steady-state conditions.

Suggestions for Future Work
(i) A rational controller could be added to manage the percentage in variation of base stream with respect to Mathematical Problems in Engineering 7 acid stream (e.g., weak or strong). Thus, the dynamics shown in Figure 10 can be further modified.
(ii) The proposed cascade structure and predictive NNbased controller could be realized using digital signal processor (DSP).