Artijicial
ELSEVIER
Znrelligence in Engineering 12 (1998) 275-281 0 1998 Elsevier Science Limited All rights reserved. Printed in Great Britain 0954-1810/98/$19.00
Intelligent control of wastewater treatment plants S. A. Manesis’, D. J. Sapidisb& R. E. Kingu3* ‘Department
of Electrical
and Computer Engineering, University of Patras, Patras 26500, Greece bIndelec S.A., Halandri 15232, Greece
(Received 25 March 1997; revised version received 20 June 1997; accepted 28 July 1997)
In recent years intelligent control of large-scale industrial processes has brought about a revolution in the field of advanced control. Knowledge-based techniques which use linguistic rules elicited from human experts are at the core of this class of systems, of which fuzzy and neural controllers are two examples that have been applied with success. This paper presents an intelligent control system which can be embedded in a commercial programmable logic controller for the control of wastewater treatment plants. 0 1998 Elsevier Science Limited. All rights reserved. Key words: intelligent control, fuzzy control, knowledge-based control, wastewater treatment plants.
1 INTRODUCTION Over the last two decades or so wastewater engineering undergone significant advances in both theory
operators, has had a significant impact in the process industry. The cement industry was, in fact, the first process industry to apply intelligent control techniques in the late 1970s in the form of fuzzy control, and today hundreds of industrial plants worldwide are controlled by such controllers. 3,4,9-13,18,23,24,26 In conventional hard controllers, the knowledge which is
has
and practice.lS6,17 Experience gained from the operation of numerous wastewater plants, coupled with the results of recent research in the field, has led to improved plant design and wastewater management. Today, effective control of wastewater treatment plants is of critical importance not only for economic reasons but also to satisfy stringent environmental constraints. Manual control of wastewater treatment plants is today the norm since conventional automatic control techniques do not provide the level and quality of control necessary to satisfy the environmental specifications imposed by civic and environmental authorities. Due to the complexity of wastewater treatment processes, furthermore, most wastewater treatment plants are operated far from optimally. The principal reason why such plants are difficult to control automatically is the uncertainty and vagueness with which most functions associated with their operation are characterised, and this is why human operators have, until now, constituted the final link for closed-loop plant control. In recent years intelligent contro1,537321the discipline that performs human-like tasks in environments of uncertainty and vagueness with minimal interaction with human
*Corresponding
systems, rule-based
pertinent
to the process being controlled
and the methods for
using this knowledge are interrelated and can be expressed in analytical form. To apply such techniques, explicit knowledge of the microscopic behaviour of the process is essential. In contrast, in intelligent or soft control, there is a clear demarcation between the knowledge and the information about the process data and the inference mechanism for applying this knowledge. As a consequence deep knowledge of the process dynamics, i.e. the macroscopic behaviour of the process, is not essential. Intelligent control is therefore particularly attractive when the expertise to control a process is available in the form of linguistic rules acquired from normal operational experience. A fundamental attribute of intelligent control is its ability to work with symbolic, inexact and vague data which human operators comprehend best. Indeed, its ability to deal with incomplete and ill-defined information, an inherent characteristic of wastewater treatment plants, permits implementation of human-like control strategies which have hitherto defied solution by any of the conventional hard control techniques. Certainly for processes which are
author. 215
276
S. A. Mmzesis et al.
known microscopically, hard control techniques can yield excellent results and hard control is clearly the methodology to be preferred. Modern control techniques have, however, in general failed to solve industrial problems and the thousands of industrial plants worldwide which rely on three-term (PID) controllers attest to the limitations of these techniques. and artificial neural networksg314 are two examples of soft computing which have migrated into the realm of industrial control over the last two decades. Chronologically, fuzzy control was the first and its application in the process industry has led to significant improvements in product quality, productivity and energy consumption. Fuzzy control is now firmly established as one of the leading advanced control techniques in use in industry. Uncertainty, either in the values of the controlled parameters or the controlled variables, can sometimes be accounted for using conventional, adaptive, robust or stochastic control techniques. However, where the knowledge about the process under control is vague or uncertain or where the process is so complex and imprecise as to defy the use of the powerful analytical techniques of modern control theory, then intelligent control must be viewed as a serious candidate. Whatever objections may exist to using such unconventional control techniques, the unquestionable fact remains that there are hundreds of plants in the process industry, transportation systems and even home appliances which are being controlled very effectively by intelligent controllers. Wastewater treatment in large urban areas is of major importance today and most civic authorities are being forced to consider the matter with urgency. Much time and money is being invested in improving existing plants and in constructing new plants to meet the ever-increasing demands of urban sprawl. Because of the complexity and interactions of the principal variables in such plants, conventional control techniques can provide only limited capabilities and as a result most wastewater plants today are controlled manually. Though the field is clearly ideally suited to the application of intelligent control techniques, it Fuzzy
]ogic2,22,24,27
Prirnury \
is remarkable that the literature on such applications is sparse, presumably because the field of intelligent control is relatively new and few environmental engineers are familiar with it. The only known examples of intelligent control of wasrewater treatment plants are in the city of Vienna, which has been using fuzzy control since 1992. Hoechst has used fuzzy control in the aerobic processing step in wastewater recycling plants in Germany. To broaden the familiarity of the technique this paper outlines a practical intelligent control system for wastewater treatment plants which can be embedded in a commercial programmable logic controller.25 The system has been exhaustively tested by expert plant operators and has proved particularly useful for training new plant operators.
2 WASTEWATER
TREATMENT
Wastewater treatment plants typically have two principal stages: the primary stage, which includes the bar racks, grit chamber and primary settling tank whose objective is the removal of the organic load and solids in the wastewater to a degree of 30-50%; and the secondary stage, whose objective is the biological treatment of the organic load and which is essential when a higher degree of treatment is required. A schematic of the basic components of a wastewater treatment plant is shown in Fig. 1. Here the sub-processes of chlorination, fusion and sludge drying are included for completeness but are not part of the plant to be controlled. Secondary treatment is normally performed in the final stage of the wastewater treatment process. The removal of organic load (biochemical oxygen demand or BOD, mixed liquid suspended solids or MLSS) in conjunction with primary treatment, in this stage, leads to an overall treatment level of the order of go-90%. Through suitable modification of the biological treatment process, stabilisation of the
selrling mnh
Pig. 1. Schematicof a typical wastewater treatment plant.
Intelligent control of wastewater treatment plants nitrogen compounds (nitrates, ammonia) can also be achieved. Biological treatment is classified by the type of micro-organisms that are used in the removal of the organic load and is either aerobic, anaerobic or both. Because of the anoxic zone in aerobic treatment, the removal of both nitrates and ammonia is possible. Interest is normally focused on secondary biological treatment and on aerobic treatment in particular. The wastewater treatment plant considered in this paper involves extended aeration and is a variation of the active sludge method. A schematic of the plant is shown in Fig. 2. Here the biological reactor possesses a tank with two zones as well as a secondary settling tank. Wet sludge is fed into the anoxic zone in which low oxygen conditions (DO < 0.5 mg 1-l) prevail and denitrification initially takes place. To operate satisfactorily, this stage requires low oxygen concentrations and the presence of nitrates. The sludge is subsequently transferred to a second, aerated zone where organic load is removed and nitrification take place. A fraction of this sludge is then returned to the anoxic zone while the remainder is fed to the secondary settling tank. The quantity of sludge returned for further treatment depends on factors which affect nitrification and denitrification and is one of the process variables which must be controlled. Finally, a fraction of the sludge in the secondary settling tank is returned to the biological reactor while the remainder is removed and fed to the fusion stage. The fraction of sludge fed back to the biological reactor is a variable which must consequently be controlled. In all wastewater treatment plants it is necessary that the oxygen content in the aerated zone of the reactor be subjected to close control. Oxygen content depends on the removal of the organic load and nitrification and, for its removal, nitrification and denitrification are the three principal quantities in a wastewater treatment plant which must be controlled. This is achieved by a suitable control
Reactor
271
strategy involving the following three manipulated variables: (1) the oxygen supply to the aerated zone (OzFeed); (2) the mixed liquid returns rate from the aerated zone to the anoxic zone of the biological reactor (R-ml); and (3) the sludge returns rate from the secondary settling tank to the biological reactor (R-sludge). The quantities which are appropriately measured by suitable instrumentation and constitute the controlled variables of the plant are: (1) (2) (3) (4) (5)
the ammonia concentration in the reactor (N-NH3); the nitrate concentration in the reactor (N-NOj); the dissolved oxygen in the reactor (DO); the temperature in the reactor (TEMP); the mixed liquid suspended solids concentration in the reactor (MLXS); (6) the difference in biochemical oxygen demand D(BOD) between the entrance and exit of the secondary settling tank.
The location of the necessary instrumentation to this end is shown in Fig. 2. These six variables thus constitute the inputs to the intelligent controller. By the nature of the process and the interaction of the controlled variables, it is obvious that effective control can only be achieved by means of a multivariable controller. Conventional singleloop industrial three-term controllers which are usually used thus cannot be expected to provide satisfactory control for a wide range of situations. The principal problem faced in designing conventional multivariable controllers is the lack of satisfactory microscopic models of the wastewater treatment process due to the vagueness with which the process and its dynamics are known as well as the variability of its environment. The sheer complexity of the control task explains why wastewater treatment plants have hitherto been controlled only by human operators.
Meusurrmeni Tmzperuture. und MLSS
of. DO
Sertiing tank \ I
Fig. 2. The wastewater treatment processand its principal variables.
278 3 AUTOMATIC PLANTS
S. A. Manesis et al. CONTROL
OF WASTEWATER
Having established the principal controlled and manipulated variables, the next task in developing an intelligent controller for a wastewater treatment plant, using linguistic techniques, is to establish a set of linguistic descriptors for each manipulated variable. These are expressions of the type Very high, High, Low, OK etc. which are commonly used by plant operators The integrity of an intelligent controller is directly related to the number of such descriptors, but practical limitations place a limit on this number. The granularity of the controller is inversely proportional to the number of linguistic descriptors. Because of the nature of the process, it is doubtful whether high granularity is indeed necessary. It is also obvious that a large number of descriptors increases the memory requirements of the controller and thereby its cost. Three descriptors are generally sufficient to describe the controller input variables. These three are HZ (High), OK and LO (Low), and examples of their membership functions over the universe of discourse ~&I,~ U,in] are shown in Fig. 3. Trapezoidal membership functions allow for a finite region on the universe of discourse on which the membership function has unit value. The locations of the centroids of the membership functions can be considered as the modal points of the fuzzy resolution while the number of such modal points corresponds to the number of fuzzy states of the variable. Finally, the intermodal spacing of the membership functions is a measure of the resolution of the variable. It is obvious that the overall accuracy of the intelligent control system is directly related to this resolution.15 In a similar manner, the manipulated variables or controller outputs, must be allocated an appropriate number of linguistic descriptors. Here, five descriptors, i.e. VH (VeryHigh), HZ (High), OK, LO (Low) and VL (VeryLow) provide sufficient fineness of control for most practical purposes. Finally, for computational simplicity, singletons, as shown in Fig. 4, provide a convenient way to describe the membership functions of the controller outputs where high accuracy is not of paramount importance. The choice of
An example of the singleton membership functions of the fuzzy setsof the controller outputs. singletons leads to a particularly simple arithmetic procedure for defuzzification. The knowledge with which an existing plant is controlled is normally elicited from expert plant operators by way of extensive interviews. This is a painstaking task and one that is critical for proper operation as erroneous or conflicting rules invariably lead to unsatisfactory control. If the 6 manipulated variables each have 3 descriptors, then the theoretical maximum number of linguistic rules is 3” or 729, a number which is clearly unmanageable. In practice fewer than 50 rules are normally necessary to provide acceptable control of a wastewater treatment plant. Of these, 27 rules are required to stabilise the organic load (BOD), 11 rules to stabilise the nitrification process while 12 rules, similar to those for nitrification, are required to stabilise the denitrification process. The total of 50 rules form the generic knowledge base of an intelligent wastewater treatment plant controller. This number is considered essential for the control of wastewater treatment plants under most operating conditions. A representative sample of these linguistic control rules is shown in Fig. 5. The inference engine of the intelligent controller manipulates linguistic control rules of the form: R: if ((D(BOD) is Y,) and (MLSS is YZ)and (TEMP is Y,) is U3) and (DO is Y4) and (N-NH3 is Ys) and (N-NOs) is Y6) then (OzFeed is Ut) and (R-Sludge is U2) and (R-ml is Ua) where Y, and U, are the linguistic descriptors of the m controller inputs and n outputs respectively. At every sampling instant, the instantaneous outputs of the process are measured. Some signal pre-conditioning may be found to be necessary in practice in order to avoid random fluctuations due to extraneous instrumentation noise. For the kth linguistic rule, the values of the membership functions corresponding to the process outputs (i.e. the controller inputs) are computed to form the array dP(BODN,
Pig. 3. A tiizzy set of one of the controller input variables.
&MLss)
. . . I.&N
-NO,)
the minimum element of which is the degree offuljilment of that rule and is a measure of the contribution of that rule to
279
Intelligent control of wastewater treatment plants 1
2
3
4
5
6
7
8
9
Fig. 5. A subset of the rule base. The linguistic descriptors are: L = Low, OK = nomA, ff = High, VH = VeryHigh, VeryBig, S = Small, VS = VerySmall, N = Normal. the final control action, i.e.
The union of the weighted products of the corresponding membership functions of the controller output fuzzy sets (v(.)} is subsequently computed to form the resultant output membership functions. The membership function of the jth controller output is thus the result of the max operator: max{ alv[(02Feed),
a2v~(R_Sludge), asv{(R-ml)}
The engineering values of the controller outputs, necessary to drive the actuators of the plant under control, are obtained following defuzzification of the output membership functions. When the membership functions of the controller outputs are described by p singletons the centre of gravity (COG) of the jth controller output is simply the inner product: Yj=
<
Pj,
Zj>
where the coefficients Pj
= A?.-
E [O, l]
fu1 l=l
are the fractional degrees of fuljlment while the array { zj} contains the locations of the singletons of the membership functions of the outputs which, for the case of five equispaced singletons, are { 0,25, 50,75, lOO}%. Hence, if no more than two membership functions overlap, no more than two elements of the array { cp} can be non-zero. The special case where only one element is non-zero (and this will have unit value) occurs when only one rule is fired, indicative of an exact linguistic rule match.
4 APPLICATION
EXAMPLE
A study of the operational needs of a proposed wastewater treatment plant for the city of Patras in Greece was undertaken recently with a view to evaluating the available alternatives. Intelligent control was considered as a viable
B = Big, VB =
candidate and an extensive study was undertaken to develop a suitable, simple, reliable and inexpensive control system which would satisfy the environmental requirements. The resultant system has been very effective as a training simulator for new plant operators until the new treatment plant is completed. The essential wriables and the control rules with which the plant is controlled were elicited from expert plant operators and plant supervisors. A fuzzy system shell (PROFUZZY S5@ by Siemens) was used to develop the intelligent controller. The introduction of the linguistic control rules, the definition of the membership functions, the specification of the input and output signals of the controller and the definition of the data interchanged between the host PC and the slave PLC were the principal steps of the design procedure. The shell uses trapezoidal membership functions, Mamdani max-min inference16,‘9,20 and COG defuzzification. The host computer is linked to a Simatic S5-115U PLC equipped with digital and analogue inputoutput cards to which the plant sensors and actuators are directly connected via a serial RS232 port. In addition, the PLC will perform all the essential interlocking and sequencing functions necessary for startup and shutdown of the plant as well as for issuing alarms when abnormal situations appear. Once the controller is completed and shown to operate satisfactorily via s#imulation on the host platform, a run-time version of the software is downloaded onto a commercial PLC by appropriate software which is complementary to the fuzzy system development shell. Following installation of the run-time version of the embedded controller, the link to the development system may be broken unless it is desired to monitor the v‘ariations of the inputs and outputs of the controller in real time. In this case, communication between the shell and the controller is achieved by means of a PLC formatted data file in which the controller input and output variables are suitably encoded. The ranges of the six process variables are as follows (these in turn uniquely specify the universe of discourse of each controller input): D(BOD) = [O, 501 nominal level = 25 mg 1-l MLSS = [15OO, X500] nominal level = 3500 mg 1-l TEMP = [IO, 301 nominal level = 20°C
280
S. A. Manesis
Fig. 6. Variations
et aI.
in oxygen feed in response to a triangular
DO = [0..5, 3.01 nominal level = 1.75 mg 1-l N-NH3 = [O, 5001 nominal level = 250 mg 1-l N-NO3 = [O, 3.01 nominal level = 1.5 mg 1-l while the controller outputs are all normalised to the range [O, 1001%. Under normal operating conditions the plant outputs are given nominal values of 50% and the corresponding levels of reactor stabilisation, nitrification and denitrification are 90%, 70% and 60% respectively. Finally, Fig. 6 shows the effect on the oxygen feed to the reactor of a triangular perturbation of 50% on D(BOD) and MLSS about their nominal values. In the figure, both nitrification and denitrification are considered acceptable whereas oxidation is not. In this case the critical control variable is 02Feed. Here, for example, at the instant where D(BOD) is low and MLSS is high (designated by an asterisk) the controller demands maximum OzFeed, as expected.
5 CONCLUSIONS Intelligent control is diffusing rapidly into areas and processes too complex to control by conventional hard control techniques. The control of wastewater treatment plants is no exception and intelligent control of such plants is eminently feasible. The results of this study proved very favourable and the potential of intelligent control of wastewater treatment plants appears unlimited. In this paper, the design of a simple, reliable and inexpensive intelligent controller for wastewater treatment plants which may be embedded in a commercial programmable logic controller has been presented. The performance of the controller has been evaluated over a
perturbation
in the D(BOD).
wide range of operational conditions by expert plant operators and found to compare very favourably with that of human operators.
REFERENCES 1. Andersen, K. and Kola, K., Practical experience with wastewater treatment. In Seminar on Design and Operation of yastewater Treatment Plants, Patras, 1990. 2. Astrom, K.J., Anton, J.J. & Arzen , K.-E. Fuzzy Control. Automatica, 1986, 22(3). 3. Bernard, J. A. Use of a rule-based system for process control. IEEE Control Systems Magazine, 1988, S(5). 4. Boverie, S., Demaya, B. and Titli, A., Fuzzy logic control compared with other automatic control approaches. In Proc. 30th CDC Conference, Brighton, 1991. 5. DeSilva, C. W., Intelligent control. Fuzzy Logic Applications. CRC Press, Boca Raton, 1995. 6. Gilles, G., Takacs, P. and Takacs, I., Simulation: A key component in the development of an integrated computerbased approach to waste water treatment plant control. In Proc. IEE Conference on Control Applications, Glasgow, 1994, pp. 1023-1028. 7. Harris, C. J., Moore, C. G. and Brown, M., Intelligent control - aspects of fuzzy logic and neural nets. World Scientific Publishers, NJ, 1993. 8. Hunt, K.J., Sbarbaro, D., Zbikowski, R. & Gawthrop, P.J. Neural networks for control systems - a survey. Automatica, 1992, 28(6), 1083-1112. 9. Jamshidi, M., Vadiee, N. and Ross, T. J. (Editors), Fuzzy and Hardware Logic and Control - Intelligentware Applications. Prentice Hall, New Jersey, 1993. 10. King, R. E. and Karonis, F. C., Rule-based systems in the process industry. In Proc. 25th IEEE CDC, Athens, 1986. 11. King, R. E. and Karonis, F. C., Multi-layer expert control of a large-scale industrial process. In Fuzzy Computing, ed. M. M. Gupta and T. Yamakawa, Elsevier Science Publishers, Oxford, 1988.
Intelligent
control
of wastewater
12. King, R. E. Expert supervision and control of a large-scale plant. J. Intelligent and Robotic Systems, 1992, 2(3). 13. King, R. E., Synergistic fuzzy control. In Applications of Fuzzy Control - Towards High Intelligence Quotient Systems, ed. M. Jamshidi, A. Titli, L. A. Zadeh and S. Boverie. Prentice-Hall, New Jersey, 1997. 14. Kosko, B., Neural Networks and Fuzzy Systems. PrenticeHall, New Jersey, 1992. 15. Lu, Y.-Z., industrial Intelligent Control. J. Wiley, New York, 1996. 16. Mamdani, E.H. An application of fuzzy algorithms for the control of a dynamic plant. Proc. ZEE, 1974, 121(12). 17. Nielsen, M. K., Madesn, H. and Carsetensen, J., Identification and control of nutrient removing processes in wastewater treatment plants. In Proc IEE Conference on Control Applications, Glasgow, 1994, pp. 1005-1010. 18. Negoita, C. V., Expert Systems and Fuzzy Systems. Benjamin Cummings Publishing, 1985. 19. Patyra, M. J. and Mylnak, D. M., Fuzzy Logic Implementation and Application. J. Wiley-Teubner, NJ, 1996.
treatment
plants
281
20. Ross T. J., Fuzzy Logic with Engineering Applications. McGraw-Hill, New York, 1995. 21. Saridis, G.N. Toward the realization of intelligent control. Proc. IEEE, 1979, 87(S). 22. Shirley, R. S. Some lessons learned using fuzzy systems for process control. IEEE Trans. Control Systems, 1987, 7(6). 23. Sugeno, M., Industrial Applications of Fuzzy Control. Elsevier Science Publishers, Oxford, 1985. 24. Terano, T., Asai, K. and Sugeno, M., Applied Fuzzy Systems. Academic Press, New York, 1989. 25. Wegmann, H., Fuzzy control and neural networks: Industrial applications in the world of PLCs. In Proc. Third IEEE Co@ on Control Applications, Glasgow, 1984. 26. Yen, J., Langari, R. and Zadeh, L. A. (Eds.), Industrial Applications of Fuzzy Logic and Intelligent Systems. IEEE Press, NY, 1995. 27. Zadeh, L. A., Outline of a new approach to the analysis of complex systems and decision processes. IEEE Trans. Systems, Man and Cybernetics, 1973, SMC3 (1).