IJCPE Vol.10 No.1 (March 2009) Iraqi Journal of Chemical and Petroleum Engineering Vol.10 No.1 (March2009) 9-16 ISSN: 1997-4884 Nonlinear Adaptive Control of a pH Process Salam K. Al-Dawery * , Hameed Ali Omran Al-Anbari and Duraid Fadhel Ahmed * Chemical Engineering Department - College of Engineering - University of Baghdad – Iraq Abstract In this paper a nonlinear adaptive control method is presented for a pH process, which is difficult to control due to the nonlinear and uncertainties. A theoretical and experimental investigation was conducted of the dynamic behavior of neutralization process in a continuous stirred tank reactor (CSTR). The process control was implemented using different control strategies, velocity form of PI control and nonlinear adaptive control. Through simulation studies it has been shown that the estimated parameters are in good agreement with the actual values and that the proposed adaptive controller has excellent tracking and regulation performance. Introduction The regulations on the quality of industrial waste have become increasingly stringent in recent years. Industrial waste must be neutralized before it discharged as effluent from the manufacturing plant, and must be maintained within stringent environmental limits. The control of pH, the subject of this study, fined important application in wastewater treatment and chemical industry. However, pH control is a difficult due to the following reasons: (I) the process is highly nonlinear dynamics (II) waste streams frequently have multiple unidentified components, variable composition, and variable flow (III) it is very sensitive to disturbances near the point of neutrality. Thus, the control of pH process requires the application of advanced control techniques. A key difficulty seems to be the wide range of operating condition over which good control is required. Use of a conventional, fixed gain, feedback controller tuned for the treatment plant waste will often provide an unstable or unsatisfactory result. This can prevent by application of adaptive control (1). The dynamics and control of pH in stirred tanks have been treated extensively in the literature. Hoyle (2) gave some guidelines in the process design and choice of equipment for controlling the pH of plant. A classical analogue PID controller is the first method implemented for controlling pH. A feedforward controller based on the feed flowrate and/or feed pH was implemented on pH process control by Shinskey (1973a). Myron and Shinskey (3) combined the feedforward controller together with nonlinear controller in order to calculate the required size of the manipulated variable. Wright and Kravaris (4) presented a novel technique for designing PI controller. The equivalent objective, being linear in states, yielded superior performance in comparison with fixed-term PI control. Jacobs and Hewkin (5) designed a modern control technology, in the form of an online digital computer using recently developed control algorithm. Many different model based control methods have been proposed under different problem settings. Among them are inline process-model based control, nonlinear inferential control, and nonlinear control using strong acid equivalent, etc. While different non- adaptive techniques have been attempted, many researchers to overcome the intrinsic uncertainties of the process model have also studied adaptive nonlinear control (6). Gustafsson and Waller (7) designed a nonlinear adaptive controller; they found it outperforms those of the conventional PID and linear adaptive controllers. Lakshmi et al. (8) proposed an University of Baghdad College of Engineering Iraqi Journal of Chemical and Petroleum Engineering Nonlinear Adaptive Control of a pH Process 10 IJCPE Vol.10 No.1 (March 2009) adaptive internal model control technique; it may not work properly for more complex neutralization process. Yoon et al. (9) presented an adaptive backstepping state feedback controller for a pH process with a proof on internal stability. In this paper, two methods were experimentally applied, first, the use of the computer to replace the conventional analogue PID controller in a typical single input single output pH control loop where there appeared to be scope for improving performance, secondly the use of an adaptive controller. Theory Velocity form The operation of an ideal PI controller is described by  ) 1 ( 0 EdtEKPP c  (1) In conventional control applications, a controller, whose output approximates the right side of Equation (1), can be built through the use of pneumatic components or operational amplifiers, integrators, and summers. In computer-control applications a discrete equivalent to Equation (1) is employed. In the development of algorithms that are based on Z transforms we specify the nature of the response to be achieved, whereas in the digital equivalent to the PI controller we adjust the constants Kc and Ti so as to achieve a desired response (10). An alternative form for the PI and PID control algorithms is the so-called velocity form. In this form, one does not compute the actual value of the controller output signal at the nth sampling instant, but its change from the preceding period (11). To obtain the digital equivalent to the PI controller, the integral term of Equation (1) is numerically approximated to give an expression for the output of the algorithm at sampling instant. Thus        E T kEKPkP i c  )()( 0 (2) P (k): controller output at nth sampling instant. Po: steady state output of the control algorithm that gives zero error. E (k): error (set point – measurement) at the nth sampling instant. Equation (2) is referred to as the “ position “ form of the control algorithm, since the actual controller output is computed. To derive an alternate form of the algorithm, the expression for controller output at the (k-1) th sampling instant was written as:        E T kEKPkP i c  )1()1( 0 (3) Then we subtract Equation (3) from Equation (2) to obtain        )()1()()1()( kE T kEkEKkPkP i c  (4) Equation (4) is referred to as the velocity form of the PI algorithm, because it computes the incremental output instead of the actual output of the controller. The velocity form of the algorithm also provides some protection against reset windup, because it does not incorporate sums of error sequences (10). Nonlinear Adaptive Control A nonlinear relation between reagent flow and measured pH distinguishes the pH control. If uniform damping is to be achieved in a highly nonlinear pH control loop, a complementary nonlinear control function must be used. The simplest form of this nonlinear function appears as a combination of three straight lines as shown in Figure (1). Both the widths of the deadband and the gain within it must be adjustable to match the particular process being encountered. As with the process titration curve, the controller gain is not simply the slope of the nonlinear function at a given point, but rather the slope of a line connecting that point with zero error. In mathematical terms, the gain Gf can be represented by the following nonlinear function f (e) Salam K. Al-Dawery, Hameed Ali Omran Al-Anbari and Duraid Fadhel Ahmed 11 de edf e ef G f )()(  (5) Where e and f (e), the error input and its function expressed in the same units. The nonlinear function can be described as eGbeef l  )()( (6) Where b is the width of half the deadband and Gl is the gain within the deadband. Then the GF is lF G e be G    )( ( (7) The nonlinear function must be adjusted fit the particular process being controlled. In the absence of a titration curve, or when the buffering is variable, this becomes a trial and error procedure. With the deadband set at zero, a limit cycle will ordinarily ensure, even with a very wide proportional band. The width of the limit cycle is a guide of the deadband need not be quite as wide to stop the limit cycle. An unbuffered system will require the lowest available setting of Gl. If Gl is too low for a given process, however, it can actually promote a limit cycle exceeding the width of the deadband. Adjustment of the proportional band should be made for fast recovery from upsets that drive the measurement outside of the deadband. If the proportional band is too narrow, an excursion outside the deadband on one side will produce enough corrective action to drive the measurement out the other side, thereby creating a limit cycle larger than the deadband, but the natural period. The nonlinear function described is symmetrical, and is therefore only useful for control in the neutral region. If control is desired at some other point, for example, pH=3, nonlinear compensation is desirable but it must be asymmetric. For a simple titration curve, it is possible to remove the high gain region from one side of the set point and adjust the deadband width so that its edge coincides with the knee of the curve (12). Figure (1): The dead band width and gain in a nonlinear controller. Experimental Work Description of the Experimental Equipment A simplified schematic diagram of the pH neutralization system is shown in Figure (2). The process consists of an (base or acid) solution that prepared in a 100 liter feed tank in the base of the equipment, from which it is pumped via a variable area flow meter, and a hand-operated valve, into a stirred mixing vessel of approximately 3.318 liters capacity. The reagent (acid or base) is held in a 50 liter feed tank integral with feed tank, the whole being constructed in PVC. The reagent is pumped into the mixing vessel via a variable area flow meter, a hand valve, and a pneumatically operated control valve. A dip electrode and a pH transmitter/ indicator monitor the pH of the solution in the mixing vessel whose output is a current in the range 4-20 mA. This current is fed to a converter unit where converts it to 0-10 volts and then sends to the computer control system. A control signal output from computer control in the range 0-10 volts is fed to a converter unit where converts it to 4-20 mA. The signal supplied to a current/pressure (I/P) converter that in turn supplies an air pressure signal in the range 3-15 psig to operate the control valve Nonlinear Adaptive Control of a pH Process 12 IJCPE Vol.10 No.1 (March 2009) Description of the Computer Control System The computer control system requires a personal computer and an interface unit that consists of an analog to digital converter (ADC) and a digital to analog converter (DAC). This work has involved the use of IBM PC/386 personal computer that is used for process monitoring and control. The interface unit receives an analog signal from the converter unit and converts it to a digital signal through an ADC then sends it to the computer. The output signal from the computer is loaded to the DAC that converts it to an analog signal. Then this signal is fed to a converter where coverts it to 4-20 mA. The hardware block diagram of the digital computer control system is shown in Figure (3). Experimental Arrangement The application of the pH control was tested for three sets of effluent and reagent, these are 1. Caustic soda (effluent) –Hydrochloric acid (reagent). 2. Ammonia (effluent) – Hydrochloric acid (reagent). 3. Acetic acid (effluent) – Caustic soda (reagent). The runs of the experiment were carried out at various conditions (feed concentration, feed flowrate, set point change). Using two different disturbances carried out the study of the dynamic behavior. First, the flowrate of acid stepped up from 0.5 lit. /min. to 0.7 lit. /min. and secondly the flowrate of base stepped down from 0.5 lit./min. to 0.2 lit./min. and stepped up to 0.5 lit./min.. To determine the controller settings, several disturbances were made and under all control methods. Influent flow stepped down from 0.5 to 0.3 lit. /min. by using valve, pH set point stepped down from the neutral point to 5, and then after 7 minutes stepped back to 7 and pH set point stepped up from the 8.72 to 10, and then after 7 minutes stepped back to 8.72. Figure (2) pH Control System Figure (3): Hardware components of digital computer control system. Salam K. Al-Dawery, Hameed Ali Omran Al-Anbari and Duraid Fadhel Ahmed 13 Results and Discussion In this section, the adaptive nonlinear controller presented in 2.2 is applied to the pH neutralization system. In order to ascertain the advantages offered by the adaptive nonlinear control strategy, experimental results are also presented for a PI controller and the non-adaptive version (velocity form) controller. The controllers are evaluated for setpoint changes and disturbances in effluent flowrate. Open-Loop Behavior In this section, the steady state and dynamic open-loop behavior of the experimental pH system is investigated. Open-loop responses for the effluent flowrate changes are shown in Fig. (4) and Fig. (5). Fig. (4) shows the pH response to 40% increase in the effluent flow, which was changed from 0.5 to 0.7 lit. /min. Fig. (5) shows the response on a pulse change in effluent flowrate from 0.5 to 0.2 and then 0.5 lit. /min.. Faster responses were reported for high and low pH than for nearly neutral found a slower response in going from water to acid than in going from acid to water. Response at pH 7 is very fast when a strong acid is neutralized by a strong base, or vice versa. At a total flowrate (Fa+ Fb) of 1 lit./min. a basic system apparent time constant of 221 second. and dead time of 4 sec. were obtained by using Cohen & Coon settings from dynamic experimental results. The theoretical dynamics would predict a basic time constant of 199 second and gain of the process (KP) equal to -2.17x 106 pH. min./mol . The approximate transfer function describing the system is first order with dead time, therefore: Conventional control The performance of a conventional PI controller for effluent flowrate changes is shown in Fig. (6). Derivative action is not included in the controller because of the pH measurement time delay. It is clear from the results that a conventional, with fixed parameters controller is unsuitable for the control of a system with high nonlinear. Velocity Form of the PI Control A digital computer has been interfaced to control the pH of effluent. It is programmed to implement feedback control. The velocity form presented in section 3.1 for setpoint change and effluent flowrate disturbance. The setpoint change performance of the velocity form controller is shown in Fig. (8). The controller produces oscillatory control moves, which induce sustained pH oscillation. The flowrate disturbance is shown in Fig. (7). It appears that the oscillation result from instability mechanism (i.e. the system is unstable at this operating point) because the pH and effluent flowrate are near their steady state values when the oscillation begin, some of the improvement in performance from the PI conventional controller. For all the neutralization system the strong base/strong acid, weak acid/strong base and weak base/strong acid solutions, the best controller gain and reset time are found and presented in Table (1). Nonlinear Adaptive Control The adaptive nonlinear controllers for setpoint change and effluent disturbance are shown in Fig. (9) and Fig. (10). The small pH oscillations observed in the response of the adaptive controller for these disturbances are caused mainly by the high process gain and process noise. The adaptive controller yields slightly improved pH responses as compared to the non-adaptive controller for the disturbances. The pH responses in Fig. (9) and Fig. (10) demonstrate the adaptive controller is able to provide good control for a wide range of conditions. The best PI controller settings (gain and reset time), the deadband width (b) and the adaptation gain are found and presented in Table (2). Figure (4): Comparison between the simulated and experimental pH responses for pulse change in base flow rate, NaOH-HCl.   )8( 1199    S eK F pH SG St P a d Nonlinear Adaptive Control of a pH Process 14 IJCPE Vol.10 No.1 (March 2009) Figure (5): Comparison between the simulated and experimental pH responses for pulse change in base flowrate, NaOH-HCl. Figure (6): Process Response under PI (conventional) Method, Flowrate Stepped (NaOH/HCL). Figure (7): Comparison between the simulated and experimental pH responses for step in base flowrate reduced from 0.5 to 0.3 lit./min. under velocity form of PI control, NaOH-HCl. Figure (8): Comparison between the simulated and experimental pH responses for pH set point stepped down from 7 to 5 and then stepped back under velocity form of PI control, NaOH-HCl. Figure (9): Comparison between the simulated and experimental pH responses for pH set point stepped down from 7 to 5 and then stepped back under nonlinear adaptive control, NaOH-HCl. Figure (10): Comparison between the simulated and experimental pH responses for step in base flowrate reduce from 0.5 to 0.3 lit./min. under nonlinear adaptive control, NaOH-HCl. Salam K. Al-Dawery, Hameed Ali Omran Al-Anbari and Duraid Fadhel Ahmed 15 Table 1: The PI Controller Settings for Velocity Form of PI control. Table 2:The PI Controller Settings for Nonlinear Adaptive Control Conclusions This paper has presented the improvement of a pH control process by using two methods. The velocity form and adaptive versions of the controller were compared to a conventional PI controller on a bench scale pH neutralization system, which exhibits significant nonlinear and time varying behavior. It is concluded that a digital computer can give substantially improved control of pH because of the ease which it can process information and exploit it by implementing feedback control. Numerical simulations demonstrated that the parameter as well as the state estimates are in good agreement with the actual values and that the proposed adaptive controller has excellent tracking and regulation performance under various changes in influent streams of the pH process. The adaptive method provides better control for the neutralization process by reducing the size of the pH deviation to process disturbances. A reduction in the oscillation level around the neutral point was also achieved. References 1. Ylostalo, T., Hyotyniemi, H. and Jutile, P., "Comparison of adaptive control methods in pH process control" ISA research triangle part C, North Caroline, 2000. 2. Hoyle, D. L., "Designing for pH Control", Chem. Eng., Vol. 48, No. 24,P. 121, (1976). 3. Orava, P. J., and Niemi, A. J., "State Model and Stability Analysis of a pH Control process", Int. J. Control, Vol. 20, No. 4,P. 557, (1974). 4. Wright, R. A. and Kravaris, C., “Nonlinear pH control in a CSTR “, American Control Conference Proceeding, P.21, Sep. 1986. 5. Jacobs, M. A., Hewkin, M. A., "Online Computer Control of pH in an Industrial Process", IEE Proc., Vol. 127, Pt. D, No. 4,P. 161, (1980). 6. Tae Chul Lee and Dae Ryook Yang, "Indirect Adaptive Backstepping Control of a pH Neutralization", Ind. Eng. Chem. Res., Vol. 40, P. 4102, (2001). 7. Gustafsson, T. K., Waller, K. V., "Dynamic Modeling and Reaction Invariant Control of pH ", Chem., Eng., Sci., Vol. 38, P. 389, (1983). 8. Patwardhan, R. S., Lakshminarayanan, S. and Shah, S. L., “Nonlinear Model Predictive Control Using PLS Based Hammerstein and Wiener Models”, Presented at the A. I. Ch. E. Meeting, LA, Session 217,Nov., (1997). 9. Yoon, S. S., Yoon, T. W., Yang, D. R. and Kang, T. S., “Indirect Adaptive Nonlinear Control of a pH Process”, IFAC 99, (China), (1999), pp. 139. 10. Pradeep, B. Deshpande, and Raymond, H. Ash, ” Elements of Computer Process Control”, (1981). Time of Integral action τI, min. Gain Kc lit./min./pH System 0.5 0.03 NaOH/HCl 0.5 0.05 HAc/NaOH 0.5 0.05 NH3/HCl System Set point Band Kc gain within band Time of integral action τI b1 b2 NaOH/HCl 7 10 4 1 2 2 1 1 1 0.05 0.05 0.05 0.5 0.5 0.5 HAc/NaOH 7 10 4 1 2 2 1 1 1 0.06 0.06 0.06 0.5 0.5 0.5 NH3/HCl 7 10 4 1 2 2 1 1 1 0.06 0.06 0.06 0.5 0.5 0.5 Nonlinear Adaptive Control of a pH Process 16 IJCPE Vol.10 No.1 (March 2009) 11. George, Stephanopoulos, “Chemical Process Control An Introduction to Theory and Practice”, Prentice/Hall International, Inc., (1984). 12. Shinskey, F. G., “pH and pION Control in Process and Waste Stream”, John Wiley & Sons, (1973).