#### Abstract

This work concerns designing multiregional supervisory fuzzy PID (Proportional-Integral-Derivative) control for pH reactors. The proposed work focuses, mainly, on two themes. The first one is to propose a multiregional supervisory fuzzy-based cascade control structure. It would enable modifying dynamics and enhance system’s stability. The fuzzy system (master loop) has been chosen as a tuner for PID controller (slave loop). It takes into consideration parameters uncertainties and reference tracking. The second theme concerns designing a hybrid neural network-based pH estimator. The proposed estimator would overcome the industrial drawbacks, that is, cost and size, found with conventional methods for pH measurement. The final end-user-interface (EUI) front panel and the results that evaluate the performance of the supervisory fuzzy PID-based control system and hybrid NN-based estimator have been presented using the compatibility found between LabView and MatLab. They lead to conclude that the proposed algorithms are appropriate to systems nonlinearities encountered with pH reactors.

#### 1. Introduction

In order to overcome the nonlinearity issue found with most real plants, a wide variety of linear control systems have been developed [1]. PID controllers and conventional algorithms are the most popular control methods used in industry [1–3]. Nevertheless, they are proper for a specific operation range with a linearized plant model. Whenever perturbations lead the process to work out of its operating point, manual adjustment of PID controller parameters is required. Different approaches have been developed to deal with such issue, like predictive model based and neural networks [1]. In [4–7], the utilization of fuzzy logic as online PID tuner has been proposed. Fuzzy control systems are able to supervise the controller performance in the steady state and transition state. Despite this, such algorithms may have poor dynamic performance at certain operating points. To enlarge the working points that are covered by the controlled plant, a multiregional supervisor control is being considered in this work, as will be explained on the coming sections [7].

Our primary motivation is to build end-user-interface (EUI) using the compatibility found between LabView and MatLab. The designed EUI would provide a flexible testbed for modeling and implementation of advanced control strategies without the expense or danger of working with real-time processes.

In this paper, there are two main contributions:

(i) The first one is the development of a multiregional supervisory fuzzy PID (MSF-PID) system to improve the accuracy and modify the dynamics of the PID-controlled pH process. The proposed algorithm has been designed with cascade structure.

The proposed fuzzy-based control works in subdivided regions. These regions are derived from the preknowledge experience about input-output pattern of the corresponding process. It is concerned with adjusting the gains of PID control with respect to parameter uncertainties and environmental conditions.

(ii) The second contribution concerns proposing an alternative and nonconventional estimation method of process output. Using the compatibility features found between multilayer perceptrons (MLP) and radial basis function (RBF) neural networks, a hybrid NN-based (HNN) estimator is developed. This intelligence-based estimator would replace the real hardware so that it ensures a compact size and a reduced cost when comparing with the conventional methods of measurement. It will also compensate the errors we might encounter with conventional methods of measurement [8, 9].

#### 2. Preliminaries

##### 2.1. Supervisory Fuzzy Controller

Supervisory fuzzy controller is a hierarchical one with the supervisor at the highest level, as shown in Figure 1. The fuzzy supervisor can use any available data from the control system to characterize the system’s current behavior so that it knows how to change the controller and ultimately achieve the desired specifications. In addition, the supervisor can be used to integrate other information into the control decision-making process.

Figure 1 shows the supervisory fuzzy PID where is the control action and is the process output.

The adjustment of PID parameters is carried out by some candidate rules as follows:(i)*If* steady-state error is large* then* increase the proportional gain.(ii)*If* the response is oscillatory* then* increase the derivative gain.(iii)*If* the response is sluggish* then* increase the proportional gain.(iv)*If* the steady-state error is too big* then* adjust the integral gain.(v)*If* the overshoot is too big* then* decrease the proportional gain.In some applications, controller gains are quantified according to different types of responses a priori identified from experiments on the real process [7].

##### 2.2. Hybrid Neural Network

The hybrid structure of neural networks (HNNs) consists of MLP and RBF. Figure 2 shows the structures of RBF and MLP. The main difference between MLP and RBF is that, unlike the MLP, there is only a hidden layer in RBF network which contains nonlinear nodes called RBF units that measure the distance between an input data vector and the center of their RBF [8].

**(a)**

**(b)**

The MLP and RBF networks are trained using a supervised training rule which attempts to minimize the error between the network and the target output patterns. If target outputs are not required for training, the learning rule is unsupervised and the network extracts its own features from the training set.

For choosing the optimal and adequate structure, certain number of neuronal architectures would be studied. Different initialization of synaptic parameters has been done for each architecture to ensure that the training of the NN converges towards the least error criterion. For each structure, the mean square error of the training and validation databases could be calculated. Then, the optimal structure is the structure which has the least square error in the validation base. The training had been done using Levenberg-Marquardt algorithm [8]. The training is carried out on a field of study called “*field of training*.” We create three databases belonging to the field of training: training, validation, and testing database, as in Figure 3.

#### 3. pH Reactor: Modeling, Controlling, and Estimation

Figure 4 demonstrates the pH reactor considered in this work. It is one of the most demanded processes in different industrial sectors such as food and diary, medicine, and biomedical industry [10, 11].

##### 3.1. Model of pH Reactor

The logarithmic relation between the base streams as manipulated variable and the pH value as a master process variable has been studied, as will be seen in Section 3.2. This relation is subdivided into three operating zones (two linear ranges and one nonlinear range). It aims, mainly, to enlarge operating range of controlling pH and modify its close-loop response.

In our case, the considered titration process has a strong acid (HCL) with a constant flow value [2 mL/sec], where its concentration is equal to [0.95 mol/L]. The manipulated variable will be the flow of strong base (NaOH), with a concentration [1.9 mol/L]. At this level, pH would be calculated using the following equation [1, 7]:where , are the concentration values of acid and base, respectively, in the outlet stream, , are the volumetric flow rates of acid and base, respectively, is the volume, and is a constant that depends on the strength of acid. In our case, = 1 is considered for strong acid-strong base system [7, 10].

##### 3.2. MSF-PID Control of pH Reactor

In this subsection, a modified cascade structure of MSF-PID control system is proposed to meet the industrial control demands due to its nonlinearities which interfere with gain adjustment of the process.

Figure 5 shows the block diagram of the pH-based fuzzy supervisory control system. As it can be seen from the block diagram, the fuzzy system takes three inputs, auxiliary variable (), error in pH value (*e*), and change in error (*de*), and generates three outputs: proportional gain , integral gain , and derivative gain .* U* is the control action; is the manipulated variable and represents the flow of base.

The proposed control system is working on three subdivided titration regions. These three regions have been chosen with respect to the value of base flow rate that manipulates the pH value inside the reactor, Figure 6.

Since the variables and their state are linguistic values, they can only be interpreted qualitatively and inexactly. Therefore, a technique is needed to describe these vague values. Fuzzy set is one of the perfect tools to process the linguistic information.

Regarding structure of proposed fuzzy, there are three inputs to fuzzy inference: auxiliary input (region 1: low; region 2: medium; and region 3: high), error* e* and derivative of error* de*, and three outputs which are , , and . The PID controller has two inputs (control error and derivative of error).

Figures 7(a) and 7(b) show the membership functions of all the inputs and outputs. They are composed of different shapes (triangular and Gaussian) and sizes to accomplish all linear and nonlinear features found with such process dynamics (Figure 6) and also to ensure smooth operation around set point (modified dynamics) and a minimum steady-state error (enhanced stability).

**(a)**

**(b)**

The widths of the fuzzy sets used for controllers are not the same and they have been determined by trial and error experience. The width of the fuzzy sets for has been chosen , for is and for is . And for inputs, the range of set point as an auxiliary input is , the range for the error has been chosen , and for error rate is . The auxiliary input is used to precisely localize at which region pH varies.

The designed fuzzy tuner would upgrade the values of , , and upon to the fuzzy inputs (, as measured inputs and the set point as AV). The structure of the classical controller is supposed to be . Two tables would be supplied (Tables 1(a) and 1(b)), as an example, to show the fuzzy rules with respect to two measured inputs ( and ) and a fixed set point (AV = medium), since the medium state of the third input means that the process runs in region 2 (nonlinear region) as seen in Figure 6. The AV is used to specify where pH is located (linear or nonlinear regions).

Table 1(a) shows the fuzzy rules which are used to determine the fuzzy outputs (*K*_{P} and* K*_{I}) with respect to measured inputs; these rules would ensure the enhanced stability with minimum residual error at the final state.

Table 1(b) shows the fuzzy rules used to determine* K*_{D}. In Table 1(b), the rules have been designed in a way where the best dynamic features (smooth rising time and least over- and undershooting) could be assured with the presence of derivative control action.

Table 1 presents only the rules with respect to measured inputs ( and ). It is also showing the influence of measured inputs on PID control gains of the proposed structure (). But the set point (AV) is also necessary to specify the region of operation (linear or nonlinear, Figure 6).

##### 3.3. HNN-Based pH Estimator

One of the main objectives of this paper is the design and application of a numerical pH estimator integrated into titration process as an industrial replacement of real hardware electrodes to measure pH. The proposed estimator is designed with LabView and MatLab. First, the MLP and RBF are used separately to design pH estimator. Then, a hybrid NN structure is developed to accomplish the best features found in both MLP and RBF. The split-sample method is implemented to select the optimal NN structure.

A conventional pH measurement loop is made up of three components: the pH sensor, which includes a measuring electrode, a reference electrode, and a temperature sensor; a preamplifier; and an analyzer or transmitter. The measuring electrode, which is sensitive to the hydrogen ion, develops a potential (voltage) directly related to the hydrogen ion concentration of the solution [12, 13].

Many troubles of conventional pH measurement could be faced in practice, for example, electrical interference, relay hunting, in-line calibration, current transmission 4–20 mA, pH measurement in liquids with hydrofluoric acid, prevention of chemical wastage, and manual temperature compensation [13].

To overcome the drawbacks which might be found with conventional method for measuring pH, technical and commercial ones, an HNN-based pH estimator has been proposed. The HNN estimator aims to achieve high accuracy and hardness and treat the nonlinearity of titration curve.

The main structural difference between MLP neural network and RBF one is that, in MLP, the main function is a tansig in first layer but in RBF the main function is Gaussian in latest layer; this makes RBF-NN better than MLP-NN in nonlinear stages of titration process.

The testing database is of different values than the precedent ones (training and validation database). The error between the real and observed pH values is defined for each parameter by the relative error (RE) (pH) as illustrated in Figure 8.

Figure 8 shows the computed relative error (RE) at both nets. It seems that the RE produced by MLP-NN is 1.82% which is larger than that of RBFNN (0.133%). That is why the MLPNN is recommended to be used with linear regions in the titration process and the RBFNN with nonlinear region, as will be seen later.

Referring to the multiple regions established on titration curve (Figure 6), it can be noted that the RBF network would deal tightly with region 2 (fast variation) when* Q*_{b} varies from 0.8 lt/min to 1.2 lt/min, and the MLP-NN would ensure the rabidity when dealing with the linear regions (1 and 3).

Figure 9 shows the performance of the proposed hybrid net, where it can be seen that the allowance of the sum-squared error (SSE) has been reached (10^{−14}) with 11 epochs. So both the accuracy and the speed enquiries have been achieved.

With this estimator, the industrial costs could be reduced when replacing the real hardware with numerical hybrid structure connected to the base stream (flow transmitter), and the size could be also reduced. So, the work could match the commercial benefits, when realized.

#### 4. Simulation with LabView/MatLab

##### 4.1. Design Steps

The process has one manipulated variable which is the flow of base . Inside the process, a scalar circuit has been designed that has two values (0 or 1) while* Q*_{b} is limited between 0 and 2.

The design process is divided into three steps.

*First step* is determining the valve position from 0 to 1; then, the position of valve returned to the input of the process and multiplied by the flow again to give a new flow value and a new valve position. This step will be repeated periodically during the life time of system.

*Second step* is determining the ions of hydrogen by proposing an inverse model of the process. The result from this process is returned partially as a feedback to insure the continuity of the system.

*Third step* is designing the mixer block diagram; as mentioned previously, the inputs of mixer are (diameter, length, flow, and initial height), while it has two outputs which are flow out and level.

##### 4.2. EUI

Using the compatibility found between LabView and MatLab (M-files) as programming languages, the HNN-based pH estimator has been designed, Figure 10.

The final EUI has been created (Figure 11) to facilitate users’ studying and analyzing of pH reactor and titration process at different control strategies.

#### 5. Results

The comparative results of PID controller and supervisory fuzzy PID controller within the three regions of the titration curve and towards the set point tracking are presented in Figures 12, 13, and 14. Figure 12 shows the response of PID-controlled pH reactor. Because of the decrement in the static gain of the process, the dynamic response becomes slower for operating point superior to 9.8 (70%).

**(a)**

**(b)**

**(c)**

**(d)**

In Figure 13, the overshoots and undershoots were smaller than 5%. It appears more satisfactory than that shown in Figure 12.

The auxiliary input, , has been used as an additional fuzzy input to generate new results that modifies the overall performance of the control system. Figure 14 shows the performance of multiregional supervisory fuzzy PID controller with set point tracking (: ) at three operating regions in titration process for weak acid and strong acid.

Figures 12, 13, and 14 clearly show a superior performance of the multiregional fuzzy PID-based cascade controller over the pH reactor with minimal resulting errors.

#### 6. Evaluation of Results

The performance of the proposed multiregional supervisory fuzzy-based controller has been evaluated and compared with conventional PID-based algorithm. The evaluation was performed using the integral of absolute error (IAE) and integral of the absolute value of the error-weighted time (ITAE), as given in Tables 2 and 3.

From Tables 2 and 3, it could be clearly noticed that the multiregional supervisory fuzzy PID is better in performance than PID at all reference points.

#### 7. Conclusions and Future Work

##### 7.1. Conclusions

(i)The nonlinear behavior exhibited by the pH process was tested using multiregional supervisory fuzzy PID-based cascade control. It is proved to be smoother and more robust than classical PID ones that suffer from problems of parameter tuning.(ii)Two kinds of neural inverse models (MLP and RBF) are developed to simultaneously estimate the pH value. Two input parameters (base flow and temperature variation) are considered to train, test, and validate the proposed HNN structure. The obtained results ensure the higher accuracy and rapidity of the hybrid structure. The optimal structure of the proposed HNN estimator has been achieved for a set of readings containing 200 samples.

##### 7.2. Suggestions for Future Work

(i)A rational controller could be added to manage the percentage in variation of base stream with respect to acid stream (e.g., weak or strong). Thus, the dynamics shown in Figure 14 can be further modified.(ii)Other nonlinear control strategies could be included into the module and chosen by the end-user to verify the performance of the plant and how it responds to different algorithms.(iii)The proposed numerical and hybrid NN-based estimator could be realized using digital signal processor (DSP).

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgment

This project was supported by the Deanship of Scientific Research at Prince Sattam bin Abdulaziz University (Kingdom of Saudi Arabia) under Research Project no. 2014/01/2125.