Nonlinear pH Control Based on Reaction Invariant and Self-Tuning PID Controller

⎯ pH neutralization process analytical model represents two processes dynamic. They mix reaction and reaction invariance that are achieved by solving the nonlinear electric charge balance acid-base. Reaction invariants are quantities that take the same values before, during and after a reaction. We identify a set of reaction invariants that are linear transformations of the species mole numbers. The material balances for chemically reacting mixtures correspond exactly to equating these reaction invariants before and after reaction has taken place. This research used HCl (strong acid) that is titrated by NaOH (Strong Base). All dynamic will perform nonlinear model, so we need the nonlinear controller scheme too. Therefore we choose the Self-Tuning-Controller (STCPID) that is part of adaptive control which has ability to handle nonlinearity and process load change. To find Figure of merit the STC in this work the control system compare with PID conventional controller scheme. The simulation result has a good and suitable performance under several tests (set-point and load change).


I. INTRODUCTION
he model and control of pH has been paid considerable attention in many practical papers.Titration curves are traditional classical pH-models.They describe the pH-value as a function of acid-base content difference.Experimental titration curves usually present the pH-value as a function of added acid or base volume; the only difference is in the scaling.The shape of the titration curve is determined by the participating chemical components.Theoretical titration curves require the knowledge of the equilibrium constants and the total concentrations of acids and bases.Experimental curves, on the other hand, only require a sample.Theoretical titration curves can be generated from the charge balance (also known as electro neutrality equation) that takes into account all the charged ions of the solution.In this paper pH model is determined base on reaction invariant scheme.The term "reaction invariant" was originally introduced by Fjeld et al., [1] but the pH process formulation of reaction invariants was presented by Gustafsson and Waller, [2] as a systematic matrix formulation of the physico-chemical modeling procedure.The stoichiometric chemical reactions and the charge balance form together a set of equations that can be used for determining the reaction invariants with the help of simple linear algebra.An early review of the reaction invariants and their use was presented by Waller and Mäkilä, [3].A recent paper by the same researchers in 2001 extended the concept of reaction invariants to mole numbers.A set of reaction invariants that are linear transformations of the species mole numbers were identified.With this set of reaction invariants the consistency of experimental data and the reaction chemistry can be checked easily and the material balances of complex chemical reactions can be written in simple collected matrix structure.The dynamics of an acid-base reaction process in a CSTR is often taken to be a "first linear system" From the control engineer's point of view this is a linear model where the time constant and the process gain vary both with pH and with the buffer concentrations in the system.The contradiction appear from the equation "titration curve", pH is negative of logarithmic H+ concentration, this is a nonlinear mathematical model.The linear model will bond the range of pH operation.The pH process exhibits severe nonlinear and time varying behavior and therefore cannot be controlled with a PI or a controller based a linear control algorithm like PID controller.So far many different approaches to dealing control pH.[4], [5], [6] proposed a modification of linear PID control to handle a unique nonlinear pH neutralization process.The control scheme is divided three-linearization.The corresponding area is determined each parameter PID controller tuning automatically using the Dahlin Method Tuning, so they have three PID controls.The disadvantage of this method is occurred if the pH value at the transition of that area which was not covered, Hendra Cordova [7] devised an auto-switch PID controller method based on control errors and tuning parameter of the PID controller can obtain.The adaptive control 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 PID and pH process 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 [8].According to several control scheme which studied by any researcher above, the Adaptive Control is one of compromising to handle and good performance in modeling and pH control [9].Therefore, this paper proposed the input-output representation of the nonlinear adaptive technique for control of a pH neutralization process with Self-Tuning Controller (STCPID) scheme using recursive prediction error method.pH by the prediction model approximation is used to identify and represent pH process.This section begins with Nonlinear pH Control Based on Reaction Invariant and Self-Tuning PID Controller Hendra Cordova 1 , Heri Justiono 1 , Ali Masduki 27 T presenting the companion form system model and demonstrating how STCPID can use to control pH nonlinear model.

II. REACTION INVARIANT TO PH MODELING
The process model in this paper uses schematic is shown in Fig. 1.There are two flowrates, Fa, Fb for acid and base solution.Initially the tank fills some acid or base volume V is in accordance with titrating scheme.In this paper we will discuss two acid-base reaction and weak acid titrating with strong base.First, thoughtful discussion will reveal the entire reaction invariant variable.In this paper, the continuous process model (Fig. 1, appendix), consists of a mixing tank with an initial amount of strong acidic or base solution.
pH Model for Strong Acid (HCl) and Base (NaOH).The chemical reaction with their dissociation constant for Acid (Ka), Base (Kb) and Water (Kw) can be written, HCl Based on Makilla and Waller [2] and Manji [10] the modified reaction formulae (1) can be written compactly in standard matrix form Where N T is stoichiometric matrix and m is a vector of chemical symbols.The vector m should be chosen to give a stoichiometric matrix appropriate structure in the following form: (4) We can define vector p, which components are the concentrations of chemical species involved in the system.It is given by p= (5) where [p i ] stands for the molar concentration of component i. Vector p can be decomposed by the following linear transformation: where q and z are the vectors of reaction invariants and reaction variants, respectively.Considering the equation above, it is clear that q=Dp.According to Waller and Mäkilä (1981), matrix D can be calculated by equation 7 as follows: where I is the identity matrix and W 1 and W 2 correspond to the partitioning of W.
Here W 1 is a nonsingular matrix and represents a base for the reaction invariants.Thus, for the hydrochloric acid-sodium hydroxide system, the partitioning considered above results in The matrix above is used to perform the variable of reaction invariant for pH modeling.The dynamic mass balance is also derived from the same scheme.Consequently, for this system, the vector of reaction invariants q is given by From vector q, the first component is suitable for the development of a dynamic model for the purpose of controlling the system and for carrying out the stability analysis.Since the combination of invariants is also an invariant, it can be shown that [Na + ] and [Cl -] are also reaction invariants.Since we know that q(1) for the pure neutral water is equal to zero, it should remain equal to zero after the addition of strong acid and strong base.NaOH, HCl are a strong base and acid which fully dissociates (i.e.strong electrolytes which ionize completely in water), the concentration and dissociation constant equal to zero, [NaOH] = [HCl]= 1/Kb=1/Ka=0, and hence equation for electrically neutral is, Combining equation ( 1), ( 9) and ( 10) we have the following polynomial in H + ,, The equation above can solve to obtain [H + ] and also pH=-log [H + ].Derivation of the following balance equations, taking into account the reaction invariants of the system, is also straightforward: where, xa=[Cl -] + [HCl] as total ionic concentration of the acid and xb=[NaOH]+[Na + ] for the total ionic concentration of the base (the reaction invariant variable), Fa, Fb are the acid, base flow rate Ca, Cb is the acid, base concentration and V is the CSTR liquid volume [11], [12], [13], [14].The other pH model is derived for another acid-base combination, we'll describe below, pH model for weak acid (H 3 PO 4 ) and strong base (NaOH), The phosphoric acid (H 3 PO 4 ) in water decompose into a phosphoric ion and three hydrogen, so it has a three acid dissociation constant for each ion, H 3 The equilibrium constant of water at the same temperature is Kw=10 -14 .The reaction invariant for NaOH derives from Equation (1).Reaction invariant variable can be written as, The combination of equation ( 1), ( 15)-( 18) we have the electroneutraliry equation as,

III. SELF TUNING CONTROL
Self-Tuning Controller (STCPID) is the part of adaptive control can handle the non-linear process like pH.The example of Plant nonlinearities is pH neutralization process.Self-tuning control can be thought of as an on-line automation of the off-line model-based tuning (re-tuning) procedure performed by control engineers.Fig. 2 depicts the architecture of an indirect self-tuning controller where these two operations are clearly seen.It is possible to reformulate the self-tuning problem in a way that the model estimation step essentially disappears, in which case the controller parameters are directly adapted, this is the so-called direct self-tuner [15].
Estimator is the procedure that develops models of a dynamic system (plant) based on the input and output (y,u) signals from the system, Where B and A are parameter polynomial in shift operator q -1 .There many alternative ways to make realtime estimation, both in continuous and discrete time using the form is called Autoregressive eXogenuous (ARX) [15], where, ] ,..., , , ,..., , , ,..., , [ ) ( Re-Tuning (self-tuning) process is finding the proper controller action (a new signal u) in order to anticipate the change of parameter process.In this paper the controller is PID with parameter Kp, Ti and T D based on Ziegler-Nichols method.It needs to know process gain (Ku) and period (Tu) ultimate.The basic idea of this calculation is to find feedback gain to reach stability border of closed loop [16].For process transfer function defined by equation ( 21) or (22), the characteristic equation of closed loop is, A(q)+ Kp B(q)=0 (24) When the closed system is on the stability border, one or more roots of its characteristic equation are on stability border and the other roots are stable.In complex variable z (discrete form) similar with q, the stable region is the inner of unit circle, the stability border is unit circle and rest is unstable region.For practical use the recurrent control algorithms which compute the actual value of the controller output u(k) from the previous value u(k-1) and from compensation increment seem to be suitable.The Ziegler -Nichols formula gives for setting the PID controller these relations.Proportional gain, Kp= 0,6 Kpu, Time integral, Ti = 0,5 Tu.The form of controller (PID) with T 0 as time sample, and Time Derivative T D = 0,125 Tu.where Kpu, Tu are gain and period ultimate [16], u(k)=q 0 e(k)+q 1 e(k-1)+q 2 e(k-2)+u(k-1) (25) where The controller and process plant above are the part of STCPID for maintaining the pH reference until the process value achieving the steady state.The control valve dynamic model is used linear 1 st order without lagtime.

IV. RESULT AND DISCUSSION
The simulation result consists of two experiments, the first is simulated for reaction invariant pH model, and the second is STCPID to pH control Fig.
(1).The system is a continuous stirred tank reactor (CSTR) with 1 L volume (V).The inlet streams consist of a strong acid (HCl) stream (Fa, 0,5 L/sec., Ca, 0.001 mol/L), a strong base (NaOH) stream (Fb, 0-2 L/sec., Cb vary with value 0-0.001 mol/L).In order to capture the characteristics of the pH process, experiment and simulation-using Eq. ( 1)-( 14) was done by adding HCl with NaOH (1-750 mL) and can see in Fig. 3.The result have no different indicating thee reaction invariant perform a good method for pH modeling.Fig. 5 above is the reaction invariant variable xa and xb response.As mentioned before from Eq. ( 10)-( 14) the xa is the ion of Cl -and xb is Na + .Initially the xa 0.01 M (mol/L) and the pH=-log 0.01=2 and tend to zero when the flowrate of NaOH (Fb, L/sec.)increase (indicating the ion of Cl -or [H + ]) will neutralized by base.The variable xb tend to the opposite of xa (dotted-line).
Fig. 4 showed a group of titration curves at different acid (HCl) concentrations.The shape of curve is same as "S" curve, increasing the concentration cause the graph tend to right shift in according to more acid dense the solution.It takes a time to reach pH 10-12 (base condition).
The pH curve strong acid-base only falls a very small amount until quite near the equivalence point.Then there is a steep plunge and tend too much (dramatically) with small volume change.At the equivalent point the quantity xa equal to xb at around 0.005 M (4-7 sec.), this is the neutral point (pH=7).Before that point, the xb (Na + ) will increase and at 0.009 M the pH have the 10-11 value (CSTR in base condition).The other simulation is simulated titration between week acid (H 3 PO 4 ) and strong base (NaOH) using Eq.15-20 with the parameter with 2 L volume (V).The inlet streams consist of H 3 PO 4 strong acid (HCl) stream (Fa, 0,118 L/sec., Ca, 0.012 mol/L), a strong base (NaOH) stream (Fb, 0-15 L/sec., Cb vary with value 0-0.05 mol/L).Polyprotic acids (H 3 PO 4 ) have more than one proton that may be removed by reaction with a base.In aqueous solution, this acid will be distributed in four different species; the acid and the three conjugate bases [17].When completely ionized, a mol of phosphoric acid will give three hydrogen ions and a phosphate ion, but the hydrogen ions come off one at a time at different pH and with different Ka.At the first when NaOH equal to zero, and the pH equal to 2 (-log 0.01).For region 2 (Ka2) the value of pH equal to pKa2 (-log Ka2=-log 6.38 x 10 -7 ) which is equal to pH 7 (some time called the equivalent point).Past that point, the all acid has been assumed.Although the above equation is valid, it is easier to calculate the pH from through the excess added base pH=14-log([NaOH]-[H 3 PO 4 ]).Fig. 7 is pH response for H 3 PO 4 added the various NaOH flowrate.The curve of pH tends to right shift when decreasing in the base flow (0.6-1 L/minute).Therefore the equivalent point reaction invariant variable xa and xb (Eq.18) will shift to the left when the increasing NaOH flow 0,6-1 L/min (Fig. 8 a-c).The neutral or equivalent point (pH 7) in this model has around 0.01 M for xa or xb.
The pH modeling simulation Fig. 6-8 were showed a good result using the reaction invariant, so the next step is applied the STCPID scheme to performed pH closed loop control system.In this paper the simulation, use the HCl and NaOH solution as a process plant (Fig. 3) (3) for open loop and its parameter (Ca, Cb, Fa, Fb and V).The PID controller scheme is choose to compare the STCPID performance for handling simulation test.The first test is response for fixed set-point (pH (7 and 9) that can see in Fig. 9(a), the STCPID reach the set-point in 40-50 second without oscillation but the PID controller scheme cannot reach pH 7 and also has a bigger oscillation at initial simulation.Both the controller scheme can reach pH 9 and again the PID has an oscillation before the steady state.PID scheme cannot track the set-point that is caused by control action (u=Fb mL/sec.)that doesn't change to proper value (Fig. 10); meanwhile, according to Fig. 3 and 4 the small change to in base volume will cause the change in pH.Another reason is that the reaction invariant xa, xb does not meet the equivalent point, and they are remaining in -0.0003 M and 0.0003 M until the end simulation.But, the proper (xa, xb) was shown for STCPID control below, In order to evaluate performance of the controller, the set-point forced to change between pH 9 to 5 and 5 to 7 as shown Fig. 12.
Fig. 12 initially as shown, significant oscillation occur in PID scheme, but doesn't happen in STCPID scheme because of appropriate tuning parameter.The better performance was shown in Fig. 13 by STCPID than PID scheme, especially when the pH changes from 5 to 7 (neutral point).The STCPID advantage tuning to automatically tuning is tested under random set-point change as seen Fig. 14 and 15.As can see in Fig. 14, the STCPID can track set point and able to avoid the load change.Fig. 16 is the control action u that manipulated the change of NaOH flowrate based on set-point change at 50 and 100 second.From the theory of section, 2 there are two problems for pH control, nonlinearity and load disturbance that can change the process parameter.The STCPID is the controller scheme that has an estimator and re-tuning section to handle that problem, so the control will stable in their set point.The estimator is used to predict the parameter process.As mentioned before, the random acid change will the change the process, Fig. 17

Fb(k-1)…+ Fb(k-1)]
Now we will look the ability of STCPID to automatically if the process (set point) changes.In this paper the Fb(k-1) is the base flowrate and u(k-1) for control action, we assumed they are same value (mL/sec.).The next to do by STCPID scheme is updating the new PID parameter (Re-Tuning process), proportional gain Kp, time integral Ti, and time derivative T D due to parameter or a new process equation (27).
Fig. 18 show all PID parameter, we'll discus one by one.The proportional gain Kp (Fig. 18a) at initial start from 0-1000 to make the base (NaOH) appropriate flowrate at the 0.1 mL/sec maximum, as the pH set-point change from pH 8-7.5 the valve or base flow must decrease to anticipated it, the same to do at 100 second the value become 450 (0.01 mL/sec).The time integral, Ti (Fig. 18 b), is used to reduce the offset pH process from set-point but its value big in fast moment, because the pH can track the set-point.The time derivative T D (Fig. 18b) is used to avoid the load change and will constant at 0.1 until the end of simulation.
All the PID parameter change is called the self-tuning PID controller due to anticipated nonlinearity and process parameter change.The other test for STCPID is to show the ability to handle the random load HCL (Fa) change as see Fig. 19 and the set point.
Once again, the advantage for STC scheme can see in Fig. 20.At Fig. 20a the random load and set point will automatically updating the process parameter by estimator.The updating and retuning run with recursive to send the proper control signal for pH control systems via open and closed the control valve.
The qualitative performance for all control strategy is calculated by performance index standard.It is shown in Table 1 (settling time Ts and ITAE).The index performance with various set-point change is calculated by average value each reference.The better settling time (Ts) is reached by STC than PID scheme and fastest to achieving pH 7. The NA is abbreviation for Not Available for achieving the pH reference.At pH set point 7 the PID cannot have the Ts and STC reach the 43, 58 second.For the other set point 7, 5 and 9 the STC better than PID with the 43 s, 3s and 1 second in the difference.The ITAE is used to measure the qualitative (minimum energy) for all the time simulation consumption.For pH 7,5 and 9 STC has a good performance comparing with PID it has 15,000, 11,000 in the difference value.
In pH 9 the ITAE PID (2,485) is better than STC (3,217).The all result show that the reaction invariant and STC can be performed a good result due to nonlinearity and pH process parameter change.In this paper the reaction invariant with electro neutrality balance is used to modeling the nonlinear mathematical pH model or neutralization process.In this scheme, the Self Tuning Controller (STC) with based PID scheme is done well choose the controller action according to set point and load (disturbance) in pH process.
The advantage was shown to updating automatically PID parameter (Kp, Ti and T D ) The simulation results satisfactory performing to 2%-5% steady state error and well done to track the fixed or set-point change (tracking the set-point).The advantage the STC is not need the large time and ITAE reach the minimum value.

Fig. 4 .Fig. 5 .
Fig. 4. pH response by increasing acid concentration (0.001-0.015M) is the estimator result due to the change of set point at 50 and 100 second random based on Fig. 15.At the first simulation (0-50 second) the simulation at normal condition and all θ's parameter track to its value, at 50-100 second load and set-point change to pH 8 and updating process by estimator begin, as can see θ 1 , θ 2 , θ 3 , θ 4 converge to estimation (prediction) parameters 0.001, 0, -0.001 and 0, and repeat again at 100 second where the pH change to 7. All the sample of simulation the estimator will perform a new process based on equation 22, pH(k)=θ T (k)φ(k-1) (27) where,

Fig. 19 .Fig. 20 .
Fig. 19.Random load (HCl, Fa) change unknown parameters, φ the variable from measured input, output (y,u) process.es(k) is random unknown unmeasured variable.The variables ϕ n are called the regression variable or repressors and the model in Eq. (22) is also called a regression model.The parameter estimation (Estimator) problem is to find estimate θ