Self-Tuning Pid Neural Network Controller to Control Nonlinear Ph Neutralization in Waste Water Treatment

The conventional PID control (linear) is popular control scheme that is used in almost pH control at waste water treatment process. pH model with respect to titration liquid flow rate has been known to be intrinsically difficult and nonlinear, especially when the process is conducted to non-linear range pH reference (pH 4-8), the settling time reach a long time. Therefore in this paper the nonlinear controller with self-tuning PID scheme is performed handle pH by training a neural-network based on backpropagation error signals. The pH process model is combination between CSTR (Continuous Stirred Tank Reactor) linear dynamic with H3PO4, HF, HCl, H2S flow rate and nonlinear static electro neutrality (wiener process model). The simulation result has a good and suitable performance under several tests (set-point and load change). The simulation result show the pH control system can follow the change of pH set-point and load with the average steady state error 0.00034. The settling time achieved at 50 second faster than conventional PID controller scheme.


I. INTRODUCTION
H neutralization plays an important part in several chemical processes, pharmaceutical, wastewater treatment and biotechnology.The pH process exhibits severe nonlinear and time varying behavior and therefore cannot be controlled with a controller based a linear control algorithm like PID controller [1].So far, many different approaches to dealing controlling pH with control algorithm were presented.[2] devised a neural PID controller method in which a neural network is trained on the basis of control errors and tuning parameter of the PID controller can obtain.[3], [4], [5], [6] used self-tuning technique to adjust PID parameters on-line.However this was based on the assumption that process to be controlled is linear.The application to control the real pH plant is done by [7], [8], but the result is proper in just fixed pH and performance degradation occur if the pH change given.[9] were modeled based on the reaction between a strong basic solution and strong acid and a digital PI control algorithm was used as the controller with no dead time.On this model, and indirect adaptive backstepping controller is designed by combining a backsteppping controller and the recursive prediction error method.According to several control scheme which studied by any researcher above, the Neural Network is one of compromising and popular technique to handle and reached a good performance in modeling and pH control.Among them have the same difficulties, more sensitive to error action, so the actuator control valve based mechanical component must respond more often than before.It caused much component process for long period will have a little bit lifetimes.On the other hand, the programming code more complicated including many algorithm identification (with neural network or adaptive), parameter estimation, recursive least square and controller structure design [10].In this paper, the objective is to control and maintain the pH in neutralization and various pH reference change by manipulating a strong base stream flow rate using direct backpropagation neural networks algorithm.The identification is not required the inverse modeling.The neural only just training of error and control signal to determine the best PID controller parameters automatically that will system more robust and stable and the computer calculation program is simpler too, because the time consumption for learning or neural network training algorithm need just little time.

II. THE NONLINEAR PH NEUTRALIZATION PROCESS
The data models are based on process at PT. Petrokimia Gresik [11].It has effluent waste process unit to neutralize of the waste product before flowing into river.The schematic pH neutralization process control block diagram based on P&ID SA unit contain pH adjusting Tank 1 or reactor tank (TK661), the lime tank (TK 6622) that is used to control the pH value and coagulation tank (TK 6612) presented below: The pH closed control system that is used in this paper consist of pH sensor, controller and control valve to flow the limestone fluid according the control signal u from controller.Actually, the pH control is done manually by open and closes the valve from lime tank under pH sample observation (laboratories).Therefore it require a long time (about 2 days), while waste and process which thrown remain to walk or take place.As mentioned above, this is a reason to design a pH control system.There are five pipe (waste fluid) flow in the reactor tank from the unit plant before waste product treatment unit, SA Plant and Aux Boiler Blow-Down, Gypsum Plant Waste Water, Run off and Permeated Water and ALF 3 Plant Waste Water.A dynamic model of the pH neutralization process is obtained from component material balance (see appendix) and the equilibrium relationship under assumption Self-Tuning Pid Neural Network Controller to Control Nonlinear Ph Neutralization in Waste Water Treatment Hendra Cordova 1 , Andry Fitra Wijaya 1 P of perfect mixing, constant vessel volume V, and so on are proposed by [12] and related as follows: where Ca, Cb is the concentration of effluent stream and acid solution (CaOH), qa, qb is the flow rate of the influent stream, and V is the volume of the mixture in the CSTR (continuous stirred tank reactor).The answer or solution of equation 1 and 2 are not achieving the pH values directly, and this is a problem how to determine the concentration of H + .Based on process schematic figure 1 the reaction between influent stream and titrating stream can be represented as, The equilibrium constants for the reaction are calculated based on equation 3.a to 3.g are determined as follow, where Ka 1 is dissociation constant of H 3 PO 4 , Ka 2 is the dissociation constant of HF, K a3 is dissociation constant of H 2 S and K w is the dissociation of water at 25 0 C. The influent of HCl (strong acid) and Ca(OH) 2 as strong base which fully dissociates and hence the dissociation constant are equal to zero.The chemical equilibrium is modeled using the concept of reaction invariant proposed by reference [13].For this system, two reactions invariant are involved for each stream.Based on the electroneutrality condition, the sum of the ionic charge in the solution must be zero.Therefore we have, From the equation 1 and d 2, xa is a charge-related quantity and xb is the concentration of the calcium ion can be defined as ] [ + = Ca xb (10) These invariants are independent of the extent of the reaction.A relation between hydrogen ion concentration and reaction invariant can be rewritten using equation 4 through 10 to give equation below, Actually, the pH value is not defined as a hydrogen ion concentration but as ion activity.However, it can be assumed that the ion activity is same as the ion concentration for the infinitely diluted solution.Hence, the pH value can be logarithm of the hydrogen ion concentration determined using the above equations and the negative if xa and xb are known.The equation 11 is called static nonlinear equation (equation without derivative component) and can be rewritten,  u caused the variable of H + is polynomial in order 5.Much software in recent today can helpful to determine this root, for example Matcad or Matlab.The pH values can be found directly after the H + is achieved.

III. PID SEL-FTUNING CONTROLLER WITH NEURAL NETWORK (PIDNNC)
Overall structure of the Neural PID controller is given in figure 2 proposed in this paper used multilayer feed forward network in which set-point, past plant outputs and past controller commands are introduced as input patterns as see below : At first, the output layer produces values of P(K p ), I(K I ) and D(K D ) by arbitrarily initialized weights.Those values are used as tuning parameters of the PID controller and the controller gives control command u based on the difference between the set point and the plant output.The control error defined by the difference between the actual plant output y and the set point is back-propagated by the learning rules and the networks is trained to generate appropriate tuning parameters in order to reduce the control error.The velocity form of a PID controller is given by, The velocity form does not need a nominal value of controller output u as that in the position form.The controller output is given by control errors e(n), e(n-1) and e(n-2) and values of K p , K I and K D from a learned neural network.In the present neural network values of r(n+1), y(n), y(n-1) … and u(n-1)…, bias are fed into the layer and tuning parameters P(K p ), I(K I ) and D(K D ) are obtained from output layer in figure 3. The structure of neural network is, According to figure 3 for neural network in this paper the definition each layer is, With one hidden layer bias (-1) is introduced into the last node and bipolar sigmoid function (equation 21) is used as activation function.The better [14] proposed and optimal form of sigmoid function so that convergence during the learning procedure is guaranteed according to systems dynamics and formulated below,  Using chain-rule method [15] the equation 18 is proposed to weight update is given by, To faster the training computation for neural training is used by modification of equation 19 as see below, The learning rate (η) and the momentum (α) are the parameters that can take to avoid the local minimum in training phase.Its value is determined by trial error, but any researcher proposed takes between 0 and 1.The controller training is also used the error-back-propagation algorithm, by take the definition r(n) is the set-point or reference value and y(n) is the plant output, the error for controller is The ∂yk(n-1)/ ∂wkj (n-1) term in equation 23 is determined and given by equation below, can be obtained from input and output plant.The weight initialization is not used random number as usual researches do to train a neural network.The reason is caused that the error between set-point and controlled signal must lie in -1 to 1 range or 100% to -100%, so for suppressing the error signal this paper take a half value.The computer code simulation program is also based on equation 17, 26 and 27 to create the proper parameter of PID controller.

IV. RESULT AND DISCUSSION
The first simulation is determined the best neural network architectures.As mentioned above the pH control and learning procedure run in the same time, its mean the control action is directly forced to final control element during learning.The experiment is separated in two ways, the pH control without load change and disturbances absent, the second test is pH control with load (disturbance) change.All the simulation was compared with PID scheme only [11].

A. The Initialization Tuning of PID Controller
The PID tuning that was used in this paper proposed by Ziegler-Nichols (ZN).The step input (open valve 5% to 10%) is injected to the pH process, the tuning scheme is given by figure below, 8 -500 1.000 1.500 2.000 2.500 3.000 3.500 4.000 4.500 7.5 -7 6.5 -6 -5.5 - The parameter combinations for the best neural network learning are 10 nodes in the input layer, 30, 3 nodes in the hidden and input layers, its parameters will make the neural reach the desired error.A learning rate (η) 0.5 and momentum (λ) 0.9 were used and the sampling time is 1 second in all simulation.

B. Fixed pH set-point without load (base flow rate) change
The pH control simulation comes into two ways, with or without load present or change.The load (disturbance) qa is flow of acid stream from disposal.
In Figure 5, the regulated q b started at 15 m 3 /hr, but upon passing the neutralization pH 6 (dot line), 7 and 8 (dash line) dropped slowly to the value that stoichiometrically neutralized the wastewater stream.A decrease in q b results in faster neutralization time and lesser q b .Initially, as shown in figure 5(b), oscillation occurs because of in appropriate PID tuning parameters.The proportional gain (K p ) increase to close by slowly the control valve fed the base flow faster but at the end pH reach the reference the flow have constant value (look figure 5(b) dash line for pH 8 and dot line for 6), this indicate the better (stable) performance occur in all pH control and also for integral (K I ) and derivative (K D ) term.
The pH control design is measured by qualitative parameters in time and percentage.The rise time (t r ) is the time required for the response to come within the ± 5% the ultimate value (reference or set-point).The settling time (t s ) is required for the response to come 2-5% from the reference point (steady state error, Ess).Table 1 shows the fixed set-point qualitative performance, as can see the all parameter PIDNNC better than PID.

C. Fixed pH set-point with disturbance
The PID controllers were tested using the feed disturbance sequence of acid flow (q a ) as regulators at fixed set points PID control with parameter (K p , K I and K D ) did fine self tuning (figure 6c) and reduce the overshoot or oscillation (figure 6a) for any fixed set-point given with the manipulated variable alternating between zero and full range (figure 6b).The oscillation occurs at the beginning figure 6 and reduces at the end.Figure 6d is the load or disturbance from acid flow.Figure 7 is simulation result with the load present in sequence form.Figure 7a.looks the pH output have small oscillation (compare with figure 6a).
---------Kp 500 1,000 1,500 2,000 2,500 3,000 3,500 4,000 4,500 500 1,000 1,500 2,000 2,500 3,000 3,500 4,000 4,500 1,000 1,500 2,000 2,500 3,000 3,500 4,000 4,500 It because the load or disturbance acid flow in figure 7d has a closer period time than 6d, so the control signal by flowing the base flow is not different in each iteration (Figure 7b).It also followed by three parameters of PID control, the value is not slightly different than the fixed set-point in pH control.The performance pH control with PIDNNC is performing a good output.The significant oscillation at the first come load occur but reduced in the steady state area, and the pH 7 or neutral condition achieve.

D. Set-point tracking pH reference change
The next simulation is set-point tracking performance.The results described here are for PIDNNC which tuned for tested at set-point 6 to 7 or 8 and these results are indicative of the results for controller tuned and tested at other set-point.Figure 8 the pH set-point change started at 7, 8, 7, 6, and 7 for the end of pH value.The better to reach for pH output with PIDNNC in the first time pH reference (figure 8a).
The maximum changes in the control output (it also flow from valve actuator) are ± 20 m 3 /hr.The control output in the response to the rising pH change.Every set-point change, the control signal in base flow in figure 8b is change to make a proper flow until the pH reach each setpoint.The proportional PIDNNC tuned to appropriate signal to come the valve with suitable action (figure 8c).According to PIDNN scheme, every set-point change the controller must change automatically (self-tuning) its parameter.The derivative term in figure 8d like another set-point simulation does not have the different value, it happen because the steady state error or offset is faster, so the integral and derivative term in PIDNNC is not near a big constant.Any researchers choose only PI term to control pH.This reason is the valve must open and closed to tracking the set-point change.The PIDNNC control work well due to controller tuning automatically.The all simulation gives the 2-5% for steady state error.

VII. APPENDIX
The parameter that is used in neutralization tank figure 1

AbstractThe
conventional PID control (linear) is popular control scheme that is used in almost pH control at waste water treatment process.pH model with respect to titration liquid flow rate has been known to be intrinsically difficult and nonlinear, especially when the process is conducted to non-linear range pH reference (pH 4-8), the settling time reach a long time.Therefore in this paper the nonlinear controller with self-tuning PID scheme is performed handle pH by training a neural-network based on backpropagation error signals.The pH process model is combination between CSTR (Continuous Stirred Tank Reactor) linear dynamic with H 3 PO 4 , HF, HCl, H 2 S flow rate and nonlinear static electro neutrality (wiener process model).The simulation result has a good and suitable performance under several tests (set-point and load change).The simulation result show the pH control system can follow the change of pH set-point and load with the average steady state error 0.00034.The settling time achieved at 50 second faster than conventional PID controller scheme.Keywords pH Neutralization, PID Controller, Backpropagation training, Neural Network

Fig. 3 .
Fig.3.The neural network structure the output layer is denoted by subscript k is f 2 (net k )=C k.net k , with C k =constant and the same activation function as in equation 16.In the beginning of learning it's cannot know trained values of tuning parameters in advance and so we introduced a linear-type activation function which different from sigmoid function.In an error-back-propagation algorithm the cost function J (denoted by E) is defined as the squared sum of the difference between the desired output (Target k ) and the output obtained from the output layer (out k ), method to minimize the cost function is based the error in equation 17 propagate to input layer if the error target can't meet the goal.The equation to weight output update (∆w jl ) as write below, ∂E/∂w jk in equation 19 can be rewritten as transformed equation by the chain rule to updated the weight and bias as follow, )

=
K D (K p , K I and K D are proportional, integral and derivative gain).The PID controller is also update (tuning) to feed the proper signal control by change the best parameter controller in the form the chain rule method is used to train and update the controller for self-tuning term, it describe by equation below,

Fig. 4 .
Fig. 4. The ZN Tuning procedure with open-loop or reaction curve method