American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 SEWAGE TREATMENT SYSTEMS BASED ON FUZZY ADAPTIVE PID CONTROLLER Jun Pei1, Yan-min Song2, Bin-fei Li3 1 Tianjin University of Technology and Education, Tianjin, China, peijun61@yahoo.cn 2 3 Tianjin University of Technology and Education, Tianjin, China, songyan_min@126.com Tianjin University of Technology and Education, Tianjin, China, Flynn.li@yahoo.com Abstract. In the sewage treatment system, the dissolved oxygen concentration control, due to its nonlinear, time-varying, large time delay and uncertainty, is difficult to establish the exact mathematical model. While the conventional PID controller only works with good linear not far from its operating point, it is difficult to realize the system control when the operating point far off. To solve the above problems, the paper roposes a method which combine fuzzy control with PID methods and design a fuzzy adaptive PID controller based on S7-300 PLC .it use fuzzy inference method to achieve the online tuning for PID parameters. The control algorithm by simulation and practical application show that the system has strong robustness and good adaptability. Keywords: sewage treatment, S7-300 PLC, PID, dissolved oxygen concentration. Introduction In the sewage treatment system, dissolved oxygen content is an important biochemical indicator of the process of sewage treatment. it can directly and quickly reflect the operational status of the entire system. The dissolved oxygen process is affected by raw sewage water quality, temperature and pH value changes etc. It is characterized by highly nonlinear and strong coupling time-varying, large time delay and uncertainty and so on; Conventional PID control strategy is apparently difficult to achieve the desired control effect [2]. We can store the operating experience of professional workers into the computer as knowledge, and according to the actual situation at the scene, the computer can automatically adjust the PID parameters, so a intelligent PID controller is invented. As it is difficult to accurately describe the experience of the operator and the evaluation of various signals are not easily quantifiable representation, fuzzy theory is an effective way to solve this problem. Based on the basic theories of fuzzy mathematics, we add these fuzzy control rules and the relevant information into the computer as a knowledge repository. Then the computer system can automatically adjust for optimal PID parameters according to the actual response of the system by using fuzzy reasoning; that is fuzzy adaptive PID. This control method has good control effect for the lag or random interference systems [1]. 44 American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 Design of Adaptive Fuzzy PID Controller.The control system consists of hardware and software components. The hardware design makes S7-300 PLC as the core of the fuzzy adaptive PID control design, software design use MATLAB simulation software to test the reliability and stability of the system. A. Structure of the Fuzzy adaptive PID control system. As shown in Figure 1.the control system compares the dissolved oxygen concentration in aeration tank with the values of the dissolved oxygen detector and then put the deviation e and deviation change rate ec into the fuzzy controller. According to the relationship between three parameters of PID and the deviation e and ec, after the online-correction of parameters kp, ki, kd, the fuzzy PID controller output u is the control signal for the inverter, we can change the rotational speed of the motor to control the air supply blower to achieve the ultimate objective of the control of dissolved oxygen concentration by parameter u. Fuzzy inference system consists of input linguistic fuzzy and output linguistic defuzzification, rule base, fuzzy inference machine and other accessories. Fig. 1. Adaptive Fuzzy Controller System B. Input and output variables and the establishment of fuzzy membership function.The fuzzy adaptive PID control system in this paper is two-input three-output system, the control system involves two ilinguistic variables input for error e and error change rate ec, they are continuous variable of the real domain , the three output variables for the PID are kp, ki, kd. The error e and error change rate ec are all transformed into the discrete domain e = {-6, -5, -4, -3, -2, -1,0,1,2,3,4,5,6 }, while the kp, ki, kd are transformation into a discrete domain of {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}, and all their fuzzy subsets is {NB, NM, NS, ZO, PS, PM, PB}. there are 7 linguistic values, the error e, error change rate ec and the fuzzy decision decide the output values kp, ki, kd with the same membership function, which is Gaussian. C. PID parameter self-tuning principles and rule. To achieve PID control algorithm using a computer, the discrete PID control law is 45 American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 k 1 U (k ) K p e(k ) K i e(i) K d [e(k ) e(k 1)] (1) i 0 U(k) the controller output at K sampling time; e(k) the controller input (error signal) at k sampling time; kp, ki, kd proportional, integral and differential coefficient..In the fuzzy adaptive PID controller, fuzzy control system adjust the control parameters according to certain rules, which improve the control performance. PID parameter setting must take three parameters kp, ki, kd at different time and their interconnected relationships into account .The core of Fuzzy control design is summary of technical knowledge and practical experience of technical staff. According to the different e and ec, operators have come up a set of kp, ki, kd setting principles: 1) When e is large, in order to make the system have good tracking performance, we should take the larger Kp and smaller kd, and at the same time to avoid a large overshoot, the integral action should also be limited, usually ki = 0. 2) When the e is medium, in order to make the system response with smaller overshoot, we should take the smaller kp. The value of Ki should be appropriate kd has greater impact on the system response, so it should be made smaller. 3) When e is small, to make the system steady, ki and kp should be bigger, as well as to avoid oscillation near the equilibrium point and improve the anti-jamming performance of the system. when ec is bigger, kd should be smaller and vice versa. Fuzzy control table for the three parameters respectively are shown in Table 1, 2, and 3. Table 1. Fuzzy Control Table for kp kp ec NB NM NS ZO PS PB PB PM PM PS PS ZO PB PB PM PM PS ZO ZO PM PM PS PM PS PS PM PS PS PS ZO NS ZO NS NS NS NM NM NM NM NM PM PB e NB NM NS ZO PS PM PB 46 ZO ZO ZO NS ZO NS NM NM NM NM NM NB NB NB American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 Table 2. Fuzzy Control Table for ki ki ec NB NM NS ZO PS PM PB NB NB NB N M N M ZO ZO NB NM NM NB NM NS NM NS NS NM NS ZO NS NS ZO PS ZO ZO PS PM ZO ZO PS PM NS ZO PS PS PM PB ZO ZO PS PS PS PM PM PM PB PB PB PB e NB NM NS ZO PS PM PB Table 3. Fuzzy Control Table for kd ec kd NB NM NS ZO PS PM PB PS PS ZO ZO ZO PB PB NS NS NS NS ZO NS PM NB NB NB NM NB NM NM NS NM NM NS NS NS NS NS NS ZO ZO ZO ZO PS PS PS PS PM PM PS PS PS ZO ZO ZO ZO PB PB e NB NM NS ZO PS PM PB According to the fuzzy control model of the parameters and the membership form of fuzzy sets for the parameter, we can get fuzzy matrix rule table by applying the fuzzy synthetic inference design of PID parameters. The table realize dynamic setting of kp, ki, kd. We can get modified parameters from the table and calculate as follow [1]: 47 American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 k p k p k p ' ki ki' ki k d k d' k d Among k p = ei , eci p , k i = ei , ec i i , k d = ei , ec i d As shown in Figure 2, the picture is the PID parameter self-correction flow chart. In online operation, the control system completes PID parameters on-line correction by processing the results of the fuzzy logic rules look-up table and computing. Fuzzy ek , ec k Begin Take sample value Fuzzy setting ek r k yk eck ek ek 1 ek 1 ek k d k p k i Calculate ki kd k p Fuzzy PID control return Fig. 2. PID Parameter Self-Correction Flow Chart D. Fuzzy Adaptive PID Control System Simulation.In order to verify the feasibility of the design system, we test it by MATLAB simulation. Taking the dissolved oxygen process in sewage treatment into account, the system can be regarded as a inertia part, a proportional part, a lag part, that is, the system model can be presented as G(s) Ke st /(TP s 1) (5) 48 American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 Considering the field data we determine the K = 7.903, Tp = 2000s, t = 300s. Fuzzy PID control of dissolved oxygen simulation system uses the reference model established under the standard state and will not affect by environmental change. Fig. 3. Simulation Curve Analysis After the simulation curve analysis, we can draw the conclusion that the system using the fuzzy adaptive PID control algorithm has better system response speed and high precision adjustment. The system's static and dynamic characteristics are both good, almost no overshoot and oscillation, which is what the conventional simple PID control difficult to achieve and the control quality has been significantly improved. Fuzzy Adaptive PID Control Rules in the Implementation of the PLC.PLC is essentially a computer dedicated to industrial control, its hardware structure is basically the same with the micro-computer. In PLC Industrial applications , Siemens S7-300 is widely used, it is not only reliable, with a large number of instruction set, flexible configuration, easy programming but also support the host computer's real-time communication with configuration softwares [5]. Fuzzy PID parameter self-tuning software adopts modular programming called by the main program. In programming, we should first set up fuzzy rules table in PLC program memory and put quantitative factors into PLC memory. To simplify programming, fuzzy domain of the input elements {NB, NM, NS, ZO, PS, PM, PB} can replace by {1, 2, 3, 4, 5, 6, 7}. Put elements of the query table into the PLC sequentially. Conclusions This paper use MATLAB software to verify the feasibility of the controller algorithm, and with the STEP7 programming software to achieve system design The system has been applied to a sewage treatment plant in Hebei, the daily treatment capacity is 5000 m³ / d. through analysis of data generated by equipment operation, the system achieved a stable water quality, reducing energy consumption and has promotional value. 49 American Journal of Engineering and Technology Research Vol. 12, No. 1, 2012 Acknowledgment I would like to acknowledge and extend my heartfelt gratitude to my supervisor—Associate Professor Song Yanmin, for his vital encouragement and patient guidance, generous assistance and invaluable advice, all of which have been of inestimable worth to the completion of my thesis. Finally, my thanks would also go to my beloved parents for me boundless love and wholehearted support over all these past years. References [1] Liu jin-kun. “Advanced PID Control and MATLAB Simulation”, Electronic Industry Press, Beijing. [2] Yu Guang-ping, Zhang Ping, Wei Song-yan, “Human intelligent PID control and dissolved oxygen control in wastewater treatment applications”,Micro computer information, 2006(2): 13—15. [3] Du Shu-xin, “Wastewater biological treatment process modeling and control”,[J]. Control theory and application, 2002,19(5):660-666. [4] Xie Shi-hong, “MATLAB R2008 Dynamic Simulation Control System”, Chemical industry press, Beijing. [5] SIMATIC S7- 300 programming reference manual, Siemens AG, 2001.7. [6] Shi Xin-min, Hao Zheng-jie, “Fuzzy Control and MATLAB Simulation”, Qinghua University Press, Beijing. 2009.2. [7] Ren He-sheng, “Modern control theory and its application”, Electronic Industry Press, Beijing, 1992. [8] Song Yanmin,Bi Zhongwei,Research on optimal Electric control System for Sewage disposal 7th International Sympositum on Test and Measurement [J] ,2007,Volume 7: 58995902. [9] Hadi Saadat . Power System Analysis . McGraw-hill.1999:48-101. [10] Electric Power Research Institute . Power System Technology . IEEE. 1999 :692-695. 50