원시데이터 수집 시스템
선정목록으로

Fuzzy Gain Scheduling and Feed-Forward Control for Drinking Water Treatment Plants (DWTP) Chlorination Process

관련 필름·전자재료 · (15) 디스플레이 패널재료

기본 정보

저자
  1. Javier Gámiz — Department of Industrial Control System, Aguas de Barcelona, Barcelona, Spain|||Automatic Control Department, Universitat Politècnica de Catalunya, Barcelona, Spain
  2. Ramón Vilanova — Department of Telecommunications and Systems Engineering, Universitat Autònoma de Barcelona, Barcelona, Spain
  3. Herminio Martínez García — Electronics Engineering Department, Universitat Politècnica de Catalunya, Barcelona, Spain
  4. Yolanda Bolea — Automatic Control Department, Universitat Politècnica de Catalunya, Barcelona, Spain
  5. Antoni Grau — Automatic Control Department, Universitat Politècnica de Catalunya, Barcelona, Spain
DOI
10.1109/access.2020.3002156
저널
IEEE Access
발행년도
2020
발행기관
Institute of Electrical and Electronics Engineers
피인용수
5
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1109/access.2020.3002156
토픽
Membrane Separation Technologies
OpenAlex ID
W3035055174

평가 내용

관련도
관련
사업분야
필름·전자재료 · (15) 디스플레이 패널재료
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 디스플레이 패널재료' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Chlorination in drinking water treatment plants (DWTP) is the final process applied to water before it is sent to storage tanks in the supply network for subsequent human consumption. An excessive dosage of chlorine or, conversely, too small a dosage, may breach existing legal regulations on mandatory limits. Furthermore, excessive amounts generate an unnecessary cost in terms of chlorine and, collaterally, problems due to an increase in the maximum permitted amounts of such by-products as trihalomethanes, which are carcinogenic compounds for humans. In DWTP where there is no significant variability in the quality of the water to be treated, a type of control that is proportional to the flow rate in the effluent can have fully satisfactory results. However, in a control strategy applied when there are inherently long delays in the process, variability in the quality of the water to be treated and considerable variations in flow, a proportional type of control does not tend to work and an alternative type is needed. This article presents the strategy and results of a control method that combines a feed-forward system with gain scheduling in a (Proportional-Integral) PI control. The control system design was validated beforehand by simulation and then applied to a real DWTP, producing satisfactory experimental results.

본문 69,541자

본문 펼치기
Received May 18, 2020, accepted June 9, 2020, date of publication June 12, 2020, date of current version June 24, 2020. _Digital Object Identifier 10.1109/ACCESS.2020.3002156_ # Fuzzy Gain Scheduling and Feed-Forward Control for Drinking Water Treatment Plants (DWTP) Chlorination Process JAVIER GÁMIZ <sup>1,2</sup>, RAMON VILANOVA 3, (Member, IEEE), HERMINIO MARTÍNEZ-GARCÍA 4, (Member, IEEE), YOLANDA BOLEA <sup>1</sup>, (Member, IEEE), AND ANTONI GRAU 1, (Senior Member, IEEE) 1Automatic Control Department, Universitat Politècnica de Catalunya, 08034 Barcelona, Spain 2Department of Industrial Control System, Aguas de Barcelona, 08028 Barcelona, Spain 3Department of Telecommunications and Systems Engineering, Universitat Autònoma de Barcelona, 08193 Barcelona, Spain 4Electronics Engineering Department, Universitat Politècnica de Catalunya, 08034 Barcelona, Spain Corresponding author: Javier Gámiz (javier.gamiz@upc.edu) This work was supported in part by the Catalan Government under Project 2017 SGR 1202, and in part by the Spanish Government under Project DPI2016-77271-R co-funded with European Union ERDF Funds. ABSTRACT Chlorination in drinking water treatment plants (DWTP) is the final process applied to water before it is sent to storage tanks in the supply network for subsequent human consumption. An excessive dosage of chlorine or, conversely, too small a dosage, may breach existing legal regulations on mandatory limits. Furthermore, excessive amounts generate an unnecessary cost in terms of chlorine and, collaterally, problems due to an increase in the maximum permitted amounts of such by-products as trihalomethanes, which are carcinogenic compounds for humans. In DWTP where there is no significant variability in the quality of the water to be treated, a type of control that is proportional to the flow rate in the effluent can have fully satisfactory results. However, in a control strategy applied when there are inherently long delays in the process, variability in the quality of the water to be treated and considerable variations in flow, a proportional type of control does not tend to work and an alternative type is needed. This article presents the strategy and results of a control method that combines a feed-forward system with gain scheduling in a (ProportionalIntegral) PI control. The control system design was validated beforehand by simulation and then applied to a real DWTP, producing satisfactory experimental results. INDEX TERMS Chlorination process, drinking water treatment plants, fuzzy control, gain scheduling. I. INTRODUCTION Chlorine is the most widely used disinfectant in drinking water treatment plants (DWTP) due to its high efficiency as a germicide and its excellent capacity to eliminate odors and tastes from water destined for human use. It is also used in Wastewater Treatment Plants (WWTP) to minimize the public health risks associated with exposure to reclaimed water, where the most important goal is the reduction of pathogens during tertiary treatments [1]. Chlorination processes at output from DWTP have been extensively analyzed in terms of control. The interest lies in achieving a fully automated process, in which humans The associate editor coordinating the review of this manuscript and approving it for publication was Mohsin Jamil . only intervene as supervisors, and in which the quality of the effluent complies with the established regulations, while optimizing operating costs. In the last decade, advances in online instrumentation [2]–[5], i.e. our ‘eyes’ on the ground, together with controllers with the capacity to run advanced control algorithms [6], have successfully automated processes that were traditionally controlled manually. However, in the case of chlorination, it would be no use having the finest instrumentation and controls to address the problem if the chemistry of the water to be treated is not taken into consideration. Most problems in chlorination control come down to an improper understanding of the chemistry of water, inexistent or incomplete modeling, and/or problems derived from a poor choice of sensors or actuators. The reaction of chlorine when it comes into contact with water can be divided into several phases [7], which clearly mark the control strategy applied. In a first phase, a significant part of the chlorine reacts quickly with the existing (organic and inorganic) matter [8], these reactions occur between the first 5 and 10 minutes [9] after the chlorine comes into contact with the water. The amount of organic matter and nitrogenous substances that react in these first moments will cause considerable variation in the gain of the process in a quick reaction and must be taken into account when designing the control system. When the variability in water quality is homogeneous, this problem will be barely exist. However, when treating waters in which this amount of organic matter can vary, and therefore its chlorine demand too, a control is required with variable gains that adapt to this characteristic. The problem is heightened by the occasional existence of ammonia, which might vary the process gain in a non-linear manner and cause what is called a ‘breakpoint scenario’. In these cases, the measurement of residual chlorine at output, the controlled variable, goes through three states with different behaviors. Depending on the nitrogen-derived compound that is reacting in each of these three states, the demand for chlorine will vary. The control system in these cases must be able to deal with these changes in water chemistry and detect when the transition from one state to another occurs [10]. This phenomenon is explained in [11] from the point of view of water chemistry, as well as the influence when computing the process gain for the control system. The remaining part of chlorine that has not reacted at first, reacts more slowly and requires a minimum period of contact with water in order for its disinfection to be effective. This time is normally between 20 and 30 minutes. This characteristic must be taken into account when designing the control system since it can considerably affect the behavior, as will be seen in the results of later sections. This reading time by the residual chlorine meter in output will also be affected by the variations in flow that may occur in the system. For example, the system delay will vary if the flow is 1 m <sup>3</sup> /s or triple that amount (3 m <sup>3</sup> /s) and, depending on the system, and not taking this time into account could hinder the implemented control. There are also certain problems that can hinder the control of chlorination caused by the sensors and actuators used. Regarding residual chlorine analyzers, it is important to consider their location to ensure that their free chlorine reading is a real value and therefore significant. They must therefore be located somewhere that guarantees that the water to be treated at its highest flow has been in contact with the chlorine for at least 30 min, otherwise the meter reading will not be correct. Likewise, it is important to measure genuinely free chlorine and not combined chlorine. In the case of combined chlorine readings, the control system would produce an incorrect measurement that, depending on its state in the breakpoint [12], [13], could cause underdosing due to chlorine dosage increasing without taking this into account. In these cases, where there could be ammonia in the water to be treated, the installation of an ammonia analyzer is highly recommended, and almost obligatory. Its reading setting (every 5-10 min.) will also be a factor to be taken into account in the design of the control system since this will entail an additional delay on top of those inherent to the chlorination process. Normally, the drawback of this type of analyzer is that, apart from a sampling time below 0.02 ppm or 0.05 ppm, it does not give a reliable reading. There are no online analyzers on the market that offer such precision of particles per billion (ppb) of NH4-N. The error in this measurement range makes it hard for the control system to anticipate, since the output variable cannot be computed directly as a function of the input ammonia variable. In this case, the possible chlorine demand must be estimated, based on other indirect parameters such as temperature, water origin or pH. In most cases, the chlorine used for disinfection in large drinking water treatment plants tends to be supplied in pressurized chlorine tanks or drums. The output of chlorine gas from these drums is transferred to the chlorinators (actuators), where chlorine gas is mixed with auxiliary water to obtain chlorinated water with concentrations ranging from 1 to 3 gr/l. If the variability in the dosage is large, as is the case in the present study, there are sure to be different chlorinators to hence cover a wide range of flow rates. Switching between these chlorinators with different ranges of action, as well as changes in the drums due to chlorine gas depletion, will cause considerable disturbances to the control system and these will require a quick response in order to keep the output within the desirable limits. In summary, for DWTP treating large flows, there are different possible problems that the control system must consider when automating the chlorination process: - Large variations in chlorine demand, due to the diversification of the organic matter present in the water to be treated and the occasional appearance of ammonia. - Long delay times in the measurement of chlorine at effluent output, due to the inherent time that the process requires in order for disinfection to be effective. - Unreliable sensors that measure combined chlorine as well as free chlorine or mechanical errors in actuators. _A._ _RELATED LITERATURE_ Depending on the origin of the water to be treated and the available instrumentation and control, the strategies used in drinking water chlorination processes may also vary. In drinking water supply tanks, a form of post-chlorination is performed on water that has already been treated beforehand and the main demand for chlorine from organic and inorganic compounds has already been covered. In [13] presents a model for estimating chlorine decay in water output from the DWTP, the object of the control presented in this article. In relation to the problems with long delays and major disturbances, some kind of control at output evidently needs to be recommended. Hence, a model-based predictive control (MPC) algorithm is used to try to optimize the future behavior of the plant in each interval, computing a sequence of manipulated future variables [14]. Reference [15] addresses the problem of chlorination control in supply tanks using an MPC based on the flow to be treated and the system model. In this case, the chlorine decay for different flow rates is known, and the controller can predict and anticipate before detecting deviations on the setpoint in the effluent. Reference [16] addresses the control of chlorination in drinking water supply systems based on a robust predictive control model. The use of Epanet simulation software [17]–[19] should be highlighted in applications for systems controlling drinking water supply. This software can also describe in great detail the behavior of the reaction kinetics of chlorine in the water treated for a supply. However, the computation requirements and not working in 3 dimensions mean it is unsuitable for the type of application being presented. In [20] propose a control system based on the ratio between flows of water to be treated from wells and the demand for chlorine to be dosed. Reference [9] presents a highly detailed overview of different chlorination control strategies in WTP, ranging from manual control to automated systems based on feedback algorithms such as PID combined with feed-forward. In the case of manual control, the need for the presence of a technician to set the dosage is an operating cost that must be taken into account. For DWTP in which variability in the quality of the water to be treated is minimal, this manual strategy may work well. The technician in this case sets the dosage and is aided by an output instrument that can make rectifications if it veers from the desired setpoint. This operation can be repeated 2 to 3 times a day and does not take long, so the operational effort is sustainable. The need for automation mainly arises when the variability in flow and water quality at input make manual operation unfeasible in terms of costs and ‘human in the loop’ unreliability. In this sense, a first level of automation with respect to manual dosage is what is called flowpacing. In this case, for a chlorine demand with little variability and without disturbances of quality, the strategy might work, but not when the demand is variable. The first option to address these changes in water quality (chlorine demand) is to close the control loop and apply, for example, a PID algorithm that compensates for the effect of possible disturbances at output. If the range of flow rates of the water to be treated varies, the integral gain of the controller should also vary since the system downtime changes. Non-constant water quality will affect the system gain, and consequently controller gain. From all of the above, it follows that for a type of water with variable delays and demands, the gain of the PID controller must be adjusted to the different operating points. Reference [21] describes a system that compensates for this variability in system gain, using a PID controller with variable parameters based on the particle swarm optimization (PSO) computational method for chlorination of drinking water. Reference [22] presents an adaptive predictive PI controller that adapts or self-adjusts depending on demand. Another strategy presented in [23] uses a cascaded PI to control chlorination in contact tanks with long downtimes. As alternative strategies to PID algorithms, [24] presents a control algorithm in which the variability of demand is addressed through the use of neural networks for a drinking water plant with a nominal flow rate of 0.9 m <sup>3</sup> /s. Reference [25] addresses the problem of chlorination control by means of a predictive control strategy using a controller in a dynamic matrix configuration. _B._ _CONTRIBUTION_ This article presents a strategy to control chlorination processes with severe disturbances and long delay times. A system of distributed parameters is addressed from the point of view of simulation and control, the identification of such parameters as diffusion, convection and decay of chlorine having been necessary at each point of operation. A gain scheduler and feed-forward control system designed on the basis of the operator’s experience and data validated by more than 5 years of records is used. The proposed control model can be applied to plants where there is variability in the demand for chlorine, thus providing a method for the design of a type of control system that takes this factor into consideration. It can also be applied to respond to severe disturbances in water chemistry, such as the appearance of ammonia; or operations such as changes between chlorination cabins that are not always linear. Also, as a contribution, based on the variation in flows it offers a potential solution for changes in downtimes that might affect the control system. One of the advantages of this article over other solutions reported on the current state-of-the art is that it might not require specific hardware for physical implementation. Indeed, this study provides a solution involving an easily implemented control strategy using the existing hardware in the DWPT under study. Specifically, the market controller used is a commercial PLC (Programmable Logic Controller) made by Rockwell Automation. Unlike other control systems presented in the literature, this one requires much less computation, is easily exportable to other architectures (since it is based on a standard), and is also robust enough to be used in industrial environments. _C._ _STRUCTURE_ The remainder of the article is structured as follows. Section II describes the chlorination plant in terms of hydraulics and equipment. Section III presents and describes the mathematical model applicable to chlorination treatment, identifies the system and presents the parameters for different chlorine flow rates and demands. Section IV explains the structure of the implemented controller and details the tuning parameters that were run in the actual plant. Section V explains how the simulator used to test the control system was designed and run. Section VI details the running of the algorithm designed in a market PLC controller. Section VII presents the results obtained from fuzzy gain scheduling and feed-forward (FGS & FF) control, both in the custom-built simulator and in the aforementioned actual treated plant. FIGURE 1. Diagram of the chlorination plant that is used this study. Finally, Section VIII presents the conclusions based on the results obtained. II. DRINKING WATER TREATMENT PLANT The DWTP that is the object of this article is one of the most technologically advanced water treatment plants in operation. Producing 120 Hm3 of drinking water a year and with a maximum capacity of 6 m <sup>3</sup> /s, it is one of the biggest drinking water treatment plants in Southern Europe. At this DWTP, traditional processes such as pretreatment, clarification and final disinfection of water coexist alongside other latest generation ones, such as treating water with ozone and active carbon, and reverse osmosis. For disinfection, there are two chlorination tanks, the first of these being the subject of the work presented herein. _A._ _CHLORINATION PLANT LAYOUT_ Figure 1 shows a diagram of tank 1 where the first chlorination of the water to be treated at the WTP is performed. The 10,000 m <sup>3</sup> tank is hydraulically connected to a second tank of identical size and which, in the event of an anomaly in either of these tanks, can treat the entire flow of the plant. As mentioned earlier, the object of study in this article is the first tank (figure 1). However, it would also be applicable to the second tank, albeit modifying the control system parameters. In fact, both tanks are cleaned every year and while this is happening, all the water to be treated only passes through the one tank that is still in service. The flow of water to be treated in tank 1 comes from a small chamber in which water from a traditional treatment by granular activated carbon filters (FGACF) is mixed with water treated by reverse osmosis (FRO). On output from both treatment processes, there are respective flow meters that show the flow from both the osmosis and carbon filter treatments, FRO and FGACF, respectively. The sum of these two flows will be the total flow to be treated variable, and the input for the control system presented in this article. The actual flow treated by the plant is between 5.5 m <sup>3</sup> /s, at maximum performance, and a minimum flow in certain situations of 1.5 m <sup>3</sup> /s. Under normal conditions, the distribution by GACF and by RO is 50%. However, this distribution may change by hours depending on the operating conditions of the DWTP. This flow balance must be taken into account by the control system because it will cause variations in the system’s gain, as shall be explained later. The theoretical residence time in the tanks can vary between 30 min and 2.5 hours, depending on the flow. It is important for this time, depending on the velocity of the water, to be considered by the control system in order to modify its integral gain. The tank is divided by a baffle that forces the water to travel 200 meters, 100 m in one direction and 100 m more in the opposite direction. This design is due to the need to guarantee a minimum reaction time so that the dosage of chlorine that comes into contact with the water can be effective. The sensors and actuators that are used to perform the control are flow meters (FT, flow transmitter) ( _FRO_, _FGACF_ ), a quality transmitter (Q), ammonia analyzer in the mixing chamber (AN1) and a temperature transmitter (TT). Both level meters (LT, level transmitter) are available for tanks 1 and 2. Two free chlorine analyzers located at the midpoint (specifically at 87 _m_ ) at the end of the tank ( _AN2_, _AN3_, respectively). As actuators there are four chlorination cabins that produce a flow of chlorinated water ( _FCHLORINE_ ) in accordance with the setpoint. Of the four cabins, two have a range of 0-40 Kg/h and the other two of 0-160 Kg/h. The main meter that closes the loop from the control system in question is AN2, but there is a second meter (AN3) on output from tank 1. Should there be any problem with AN2, meter AN3, with the corresponding settings, becomes the control system process variable. Tank 2 has two residual chlorine analyzers AN4 and AN5 that serve a similar purpose as tank 1 but with different setpoints and settings. Neither the control nor meters in tank 2 are studied in this article. III. MATHEMATICAL MODEL. SYSTEM IDENTIFICATION The chlorine dispenser system in the contact tanks can be characterized as a distributed parameter system that occurs in two connected reactors. The effects of advection, diffusion, and reaction can be generalized by the partial derivative equation in the following linear form [26]: where _U_ is the velocity of water through the tank (m/s). In the case of the tank being studied in this article, the diffusion coefficient ( _D_ ) was obtained from simulations with the commercial CFD Comsol <sup>˙</sup> software and its value ranges <sup>_�c_</sup> - _c(x)_ + <sup>_∂c(x)_</sup> _�t_ <sup>=</sup> <sup>_Qc(x)_</sup> <sup>−</sup> <sup>_Q_</sup> _∂x_ _V_ <sup>_�c_</sup> _�t_ _∂x_ _�x_ - _DAc_ + <sup>_∂_</sup> _∂x_ _∂c(x)_ _∂x_ _∂c(x)_ _∂x_ - _kVc_ (1) + _Ac_ - _∂c(x)_ _∂x_ where _V_ is the volume of the tank (m <sup>3</sup> ), _Q_ is the flow (m <sup>3</sup> /s), c is the concentration of chlorine (ppm), _D_ is the diffusion coefficient (m <sup>2</sup> /s), _AC_ is the cross-sectional area of the tank (m <sup>2</sup> ), and _k_ is the first order chlorine decay coefficient (s <sup>−1</sup> ). If we simplify the model and _�x_ and _�t_ tend to 0, equation (1) can be expressed as: _∂∂ct_ <sup>=</sup> <sup>_D_</sup> _∂_ <sup>_∂_</sup> _x_ <sup>2</sup> <sup>_<u>c</u>_</sup> <sup>2</sup> (2) _∂_ <sup>_∂_</sup> x <sup>_<u>c</u>_</sup> <sup>−</sup> <sup>_kc_</sup> _∂_ <sup>_∂_</sup> _x_ <sup>2</sup> <sup>_<u>c</u>_</sup> <sup>2</sup> <sup>−</sup> <sup>_U_</sup> _∂_ <sup>_∂_</sup> x <sup>_<u>c</u>_</sup> from 0.0055 m <sup>2</sup> /s to 0.013 m <sup>2</sup> /s for velocities of between 1.5 m <sup>3</sup> /s and 3.7 m <sup>3</sup> /s respectively. Velocity ( _U_ ) according to previous flows and the dimensions of the tank is between 0.052 m/s and 0.12 m/s. Dosage ( _c_ ) under normal conditions without ammonia is between 0.15 ppm and 2 ppm of chlorine, depending on the system’s gain. The chlorine decay constant ( _k_ ) depends on different variables that must be taken into account when designing the control system. A significant part of the chlorine ( _c_ ) reacts quickly with the existing (organic and inorganic) matter, and the remaining matter reacts with the remaining fraction. Given the location of chlorine analyzer _AN2_, the time that elapses from dosage on entering the tank to measurement is sufficient for the chlorine to react completely and quickly. If the reactive term in equation (2) is developed as shown, the decay in chlorine can be divided as the sum of one fast-acting fraction and one slow-acting one. Reference [8] presents a second-order model that differentiates between both reactions, the fast reaction having a decay coefficient that is differentiated from the slow one: _<u>dc</u>_ (3) _dt_ <sup>= −</sup> <sup>_kRc_</sup> <sup>2 −</sup> <sup>_ksc_</sup> If we replace the reactive term – _kc_ of equation (2) with the expression of equation (3) we get: _∂∂ct_ <sup>=</sup> <sup>_D_</sup> _∂_ <sup>_∂_</sup> _x_ <sup>2</sup> <sup>_<u>c</u>_</sup> <sup>2</sup> (4) _∂_ <sup>_∂_</sup> x <sup>_<u>c</u>_</sup> <sup>−</sup> <sup>_kRc_</sup> <sup>2 −</sup> <sup>_ksc_</sup> _∂_ <sup>_∂_</sup> _x_ <sup>2</sup> <sup>_<u>c</u>_</sup> <sup>2</sup> <sup>−</sup> <sup>_U_</sup> _∂_ <sup>_∂_</sup> x <sup>_<u>c</u>_</sup> TABLE 1. System parameters for minimum (0.15 PPM), Typical (0.25 PPM), and maximum (0.35 PPM) chlorine demand at different flow rates. the different constants of the process depending on the chlorine reaction phase in which it occurs. With the appearance of ammonia, the system gain for the DWTP in question changes dramatically and for each ppm of ammonia, a dosage of 7.5 times ppm of chlorine is required. The value of 7.5 has been obtained from 5-year statistical data. _A._ _SYSTEM IDENTIFICATION_ If we consider the reaction of chlorine in the treated tank to be a homogeneous reaction, the model presented in equation (4) can be characterized with a fairly precise degree of fit to a system with 2nd order transfer function with delay and two real poles as presented in equation (5): _Kp_ G(s) = ( _T_ 1 _s_ + 1)( _T_ 2 _s_ + 1) <sup>_e_</sup> <sup>−</sup> <sup>_Td_</sup> <sup>_s_</sup> (5) where _Kp_ is the system gain, _T_ 1 and _T_ 2 the time constants, and _Td_ the delay. If we assign the parameters of equation (2) to equation (5) we find that _Kp_ will depend on _kR_, time constants _T_ 1 and _T_ 2 will depend on the velocity of the water flow _U_ and of diffusion _D_ and, finally, _Td_ will depend on the velocity _U_, equation (6). For the purposes of the control system presented in this article, the fourth term (– _ksc_ ) is practically negligible, as shown in [13] for the type of water treated, _kS_ is between 0.5 day <sup>−1</sup> and 0.008 day <sup>−1</sup> and the maximum time until the meter reading for a flow of 1.5 m <sup>3</sup> /s is 30 min. The third term (– _kRc_ <sup>2</sup> ), unlike the fourth, is decisive, since the initial chlorine demand will cause the system gain to vary, and so the control system needs to take this into account. The nonlinear term (− _kRc_ <sup>2</sup> ), in turn, can be decomposed into a whole set of reactions of water with organic and inorganic matter and ammoniacal compounds such as ammonia. For the case discussed in this article, the chlorine demand due to organic and inorganic matter can vary between 0.15 ppm and 0.5 ppm of chlorine. This variation has been determined from 5-year statistical data and heavily depends on water temperature and therefore on the time of year when the water is treated. Another aspect that has a major influence is the origin of the water; i.e. how the inflow is distributed between FCAG or RO treatment. If the water predominantly comes from FCAG, the system gain will be low, unlike when the flow comes from RO, whereupon much of the organic matter has been eliminated and, therefore, the demand for chlorine will be close to 0. The appearance of ammonia in reactions will cause variations in system gain in a non-linear manner and its considerable impact needs to be taken into account by the control system. Reference [27] presents an in-depth study of the reaction of chlorine and ammonium compounds, determining For the case of the chlorination tank being studied in this article, a subset of system gains, time constants _T_ 1 and _T_ 2 and delays _Td_ for different operation points and chlorine demands at different flow rates is shown in Table 1. IV. CONTROL STRATEGY The main objective of the control system designed and implemented herein is to cover the basic demand for chlorine in tank 1 (figure 1). The purpose of tank 2 is to dose the established setpoint (usually 1.0 ppm) to guarantee compliance with the quality requirements of current legislation in the supply network. A control strategy with feed-forward and PI control with variable gains computed from a fuzzy supervisor has been designed for both tanks. This article describes the control for tank 1, which differs from the control for tank 2 (fig. 1), and also in the parameterization of the gains, by considering compensation for the appearance of ammonia in the mixing chamber. However, as mentioned earlier, it should be noted that although the control described in this article focuses on tank 1, it would also be applicable to tank 2, modifying the parameters of the control system. _Kp_ <sup>_(kR)_</sup> _G(s)_ = <u>�</u> <u>��</u> _<u>p</u>_ <u>�</u> _T_ 1 <sup>_(U_</sup> <sup>_,D)_</sup> s + 1 2 <sup>_(U_</sup> <sup>_,D)_</sup> s + 1 1 <sup>_(U_</sup> <sup>_,D)_</sup> s + 1 <u>��</u> _T_ 2 <sup>_(U_</sup> <sup>_,D)_</sup> _d_ _s_ (6) <u>�</u> _e_ <sup>−</sup> <sup>_T_</sup> <sup>(</sup> <sup>_U_</sup> <sup>)</sup> FIGURE 2. Diagram of the block control scheme of the chlorination plant analyzed in this study. _A._ _CONTROL SCHEME_ Figure 2 shows a block diagram of the control implemented for tank 1. There is a fuzzy supervisor that controls, on the one hand, a block of variable gains, input for a PI control. On the other hand, it controls a feed-forward block that generates two outputs ( _FF_MON, FF_NH_ 4) in addition to the control signal generated by the PI controller. The fuzzy supervisor input variables are temperature, ammonium (NH <sup>+</sup> 4 <sup>) in the mixing chamber, and the flow rates</sup> from reverse osmosis (FRO) and the granular activated carbon filters (FGACF). The setpoint (SCL) for the control system tends to be between 0.3 ppm and 0.6 ppm of free chlorine at output from tank 1. This study has obtained four operating points (flows, 1.5 m <sup>3</sup> /s, 2.0 m <sup>3</sup> /s, 2.7 m <sup>3</sup> /s, 3.7 m <sup>3</sup> /s) applying [28], depending on the possible range of flows to be treated, from 1.5 m <sup>3</sup> /s to 5.0 m <sup>3</sup> /s. _B._ _FUZZY GAIN SCHEDULING DESIGN_ The gains of the PI controller for the four described operating points were computed depending on the temperature in the mixing chamber and the water distribution between RO and FCAG. Based on historical data and with the help of the statistical tool R [29] it was possible to validate that the chlorine demand varies in winter and summer between 0.3 ppm and 0.5 ppm of chlorine due to temperature. This demand can drop to 0.15 for cases in which a large amount of the treated flow is from reverse osmosis, where a large part of the organic and inorganic matter has been eliminated. In equation (7), the controller transfer function for the controller gain differences computed at the operating points is presented in a generic manner. _Gc (s)_ = _Kpn_ + <sup>_<u>Kin</u>_</sup> (7) _s_ Let _Gc_ be the controller transfer function, let _Kpn_ be the proportional gain, let _Kin_ be the integral gain for _n_ taking values in the range 1, 2, 3 and 4 for the different operating points. It is well worth to note that there will be different values of proportional and integral gain for every operating point. TABLE 2. Controller gains for different operating points and different gains. FIGURE 3. Structure of the fuzzy supervisor. Table 2 presents the gains (Kpn, Kin) obtained in Matlab⃝R using the _PID Tuner_ tool [30] for every operating point. To choose the controller parameters, the minimum overshoot and minimum settling time criteria prevailed. Gain scheduling involved use of a fuzzy supervisor that, depending on the temperature in the mixing chamber and the distribution of flow rates between RO and FCAG, interpolates the different gains of the control system. The tool used in the design of the fuzzy supervisor was the Rockwell Automation RSLogix 5000 Fuzzy Designer commercial software [31]. Figure 3 shows a general block diagram of the structure of the fuzzy supervisor made with this tool. The linguistic variables that were defined are Flow, _Temperature,_ _TPGacf_ and _Amonium_ . The inference engine ( _GainSc_FF_ ) for the control system is based on 18 rules that modify the parameters of the PI controller. Depending on the temperature and origin of the water, the control system makes an estimate of the demand for chlorine based on the organic matter in the water to be treated. This estimated chlorine demand ( _FF_MON_ ) is a value that is added to the PI controller output variable. Depending on the amount of ammonium in the water to be treated, the control system computes a value, _FF_ _ _NH_ 4 _,_ which is added to the PI control output. Its value can vary between 0 and 7.375 ppm depending on the ammonia in the water (0...1 ppm). For example, figure 4 shows for the linguistic variable Flow with a universe of discourse _U_ = [1 _._ 0 _,_ 5 _._ 0], the four fuzzy sets ( _c_ 1 _. . . c_ 4) with the respective linguistic values (labels) FIGURE 4. Fuzzy sets (llow, low, medium, high) on the flow input variable, Flow [1..5] and a membership value of 0.3 at low and 0.7 at medium. FIGURE 5. Fuzzy sets on temperature. _llow_, _low_, _medium_ and _high_ with GAMMA and LAMBDA type membership functions. In the specific case, for a flow value of 3.2 m <sup>3</sup> /s, the degrees of membership to the _low_ and _medium_ sets are 0.3 and 0.7, respectively. Meanwhile, figure 5 shows for the variable _Temperature_, with a universe of discourse _U_ = [5 _._ 0 _,_ 20 _._ 0], the 2 fuzzy sets that it contains, with linguistic values _winter_ and _summer_, and with GAMMA type membership functions. Table 3 shows a subset of the rules defined to interpolate the different gains of the control system. The defuzzification algorithm applied was the center average method. The output variables _Kp_, _Ki_ y _FF_MON_ are classified into singleton fuzzy sets with vectors [0.3, 0.4, 0.6], [0.0003, 0.00045, 0.0006, 0.00075, 0.0009], and [0.15, 0.25, 0.35], respectively. Empirically, it has been verified, from 5-year historical data, that the chlorine demand in cases where there is no ammonia ranges between 0.15 and 0.35 ppm of chlorine. The case of lower demand (0.15 ppm) occurs when the flow from Reverse Osmosis (FRO) is predominant with respect to the flow from carbon filters (FGACF). In winter with a FGACF greater than 50% the demand can be around 0.35 ppm and 0.25 ppm in summer. For example, for a value of the Flow variable of 2.68 m <sup>3</sup> /s, a Temperature value of 10.0 <sup>◦</sup> C and a percentage filter flow ( _TPFGCAF_ ) of 0.7, the degree of membership for rules 1 and 2 in table 3 would be 0.18 and 0.82, respectively. For this specific case, the output variables _Kp_, _Ki_ and _FF_MON_ would be computed according to equations (8) (9) and (10): TABLE 3. Subset of defined inference rules for _Kp_, _Ki_ y _FF_MON_ . FIGURE 6. 3D input-output graph of the control system for integral gain Ki, _Flow_ and the percentage _TPGacf_ of water from GACF. _Ki_ <sup>∗</sup> <sup>=</sup> - _Mk_ <u>=1</u> <sup>_A (ck_</sup> <sup>_) .ck_</sup> <u>�</u> _Mk_ =1 <sup>_A (ck_</sup> <sup>_)_</sup> = <sup><u>0</u></sup> <sup>_._</sup> <sup><u>82 ∗</u></sup> <sup>_<u>high</u>_</sup> <sup>+ 0</sup> <sup>_._</sup> <sup><u>18 ∗</u></sup> <sup>_<u>hhigh</u>_</sup> <sup>+ 0</sup> <sup>_._</sup> <sup><u>18 ∗</u></sup> <sup>_<u>hhigh</u>_</sup> = 0 _._ 000777 0 _._ 82 + 0 _._ 18 (9) _FF_ _ _MON_ <sup>∗</sup> = - _Mj_ =1 <sup>_A (cl) .cl_</sup> <u>�</u> _Ml_ =1 <sup>_A (cl)_</sup> = <sup><u>0</u></sup> <sup>_._</sup> <sup><u>82 ∗</u></sup> <sup>_<u>high</u>_</sup> <sup>+ 0</sup> <sup>_._</sup> <sup><u>18 ∗</u></sup> <sup>_<u>high</u>_</sup> <u>�</u> _Ml_ =1 <sup>_A (cl)_</sup> 0 _._ 82 + 0 _._ 18 = 0 _._ 35 (10) for the weighted output functions _Aj,k,l, A_ ( _cj,k,l_ ) is the maximum of the degrees of membership of all the rules with the consequent _Aj,k,l_ ; _cj,k,l_ is the position of the centroid of the member function _Aj,k,l_, and _M_ is the set number of _Aj,k,l,_ with two low (0.18) and _medium_ (0.82) fuzzy sets. Applying equations (8), (9) and (10) to equation (7), at time _t_ = 1, and considering that the existing ammonia is _FF_ _ _NH_ 4 = 0, the controller would provide an output as shown in (11). _u_ = _Kpe_ + _Ki_ _edt_ + _FFMON_ + _FFNH_ 44 = 0 _._ 6 _e_ + 0 _._ 00077 _edt_ + 0 _._ 35 + 0 (11) _Kp_ <sup>∗</sup> <sup>=</sup> - _Mj_ =1 <sup>_A_</sup> _Mj_ =1 <sup>_A_</sup> - _cj_ - _.cj_ <u>�</u> _Mj_ =1 <sup>_A_</sup> <u>�</u> _cj_ <u>�</u> - _cj_ <u>�</u> _cj_ _.cj_ = <sup><u>0</u></sup> <sup>_._</sup> <sup><u>82 ∗</u></sup> <sup>_<u>high</u>_</sup> <sup>+ 0</sup> <sup>_._</sup> <sup><u>18 ∗</u></sup> <sup>_<u>high</u>_</sup> <u>�</u> 0 _._ 82 + 0 _._ 18 0 _._ 82 + 0 _._ 18 = 0 _._ 6 (8) where _e_ is the error obtained from the difference between the setpoint and the process variable, measurement of free chlorine by sensor _AN_ 2. Figure 6 shows a 3D lattice graph for the _Flow_ and _TPGacf_ input variables and the _Ki_ output variable. As shown in the FIGURE 7. Fuzzy sets on the Ammonium input variable. graph, there is a difference in the range of _Ki_ gains depending on whether we are working in a situation of normal flow through filters ( _TPGacf_ [0.25...1.00]) or whether we are in a predominantly osmosis flow zone ( _TPGacf_ [0...0.25]). _C._ _AMMONIUM COMPENSATOR DESIGN_ The control system must compensate for severe disturbance in cases where ammonia is detected in the mixing chamber. There are currently ammonium analyzers (NH4-N) on the market that have acceptable precision and accuracy with sample times of 5 min. The problem with these analyzers is that below 0.02 ppm, their measurements are not reliable. This problem is solved by the designed control system, with the estimation of chlorine demand based on the temperature and origin of the water to be treated. As explained in Section II ( _Plant_ _Layout_ ), there is a meter in the mixing chamber that enables the control system to detect the presence of ammonia and generate a proportional output in addition to the PI control action (Figure 2). The meter output is used by the control system for values above 0.02 ppm of NH4. For ammonium compensation, the control system uses a conventional TakagiSugeno model that offers a smooth change between the different slopes of action on the control variable. As shown in figure 7, two work zones have been defined, equivalent to the _Error_ and _Good_ fuzzy sets. The _Error_ set represents those values at which the meter measures below 0.02 ppm and the _Good_ set those values between 0.02 ppm and 1.0 ppm. Below 0.02 ppm the value measured by the sensor is not considered to be a reliable reading. For the specific case in the figure, a typical value (0.37 ppm of NH4-N) is shown in winter for ammonia load episodes. Hourly values from the last 5 years have been analyzed and a linear correlation of 0.93 has been obtained between the ammonium meter readings and the chlorine demand. Equation (12) presents the correlation line obtained with the statistical program _R_ . With the appearance of ammonia, the controller output due to _FF_NH_ 4 is updated by multiplying the existing ammonium value (NH4) by the value slope of 7.37529. _y_ = 7 _._ 37529 ∗ _NH_ 4 + 0 _._ 39694 (12) In equation (12) the value of the ordinate at origin is 0.39694 and is equivalent to the chlorine demand due to the organic and inorganic matter present. This value is already TABLE 4. Defined inference rules for the output variable _FF_NH_ 4. taken into account by the control system in its _FF_MON_ term and is not added to the control variable in the finally implemented control. Table 4 shows the two rules defined for the ammonia output variable. For example, in the case of the control variable u in equation (11), with the appearance of 0.035 ppm of ammonia in the mixing chamber, the control system would produce an output as shown in equation (13). V. CONTROL SIMULATION Simulation is an important and necessary tool to test and validate control models before they are applied to operative installations. Note that that this proposed control has been run in a real plant that supplies drinking water to more than 2 million people. No errors are permissible, so a simulator was needed to easily test the control algorithm and make sure that it could be connected to the program being run in the PLC. The simulator was run on the Matlab/Simulink tool using the C language to code the functions that describe the plant’s behavior. The simulation code was programmed and encapsulated in an _S-Function_ (Level 2), and the interface was adapted to contrast data from the Supervisory Control and Data Acquisition (SCADA) software output with the simulation output. The proposed simulator can be set up for any PLC and SCADA controller with an open platform communications (OPC) interface. Figure 8 shows the model run in Simulink to compare the controller described in this article (sub-block 2 inset in the same figure 8) with a conventional PI algorithm (subblock 1). Block 1 of the figure is the running of the aforesaid conventional PI whose input parameters are proportional and integral gain. Block 2 is the control model named in figure FGS&FF with which we compared the PI. This model’s input parameters, in addition to the error between the setpoint and the AN2 value, are the different variables that, as shown above, enable the controller output to be computed: Flow, _Temperature_ _TPGacf_ and _Ammonium_ . The outputs of both controllers go to respective blocks, _Chloring_ _System1_ and _Chloring System2_, respectively, which model the chlorine dosage behavior, adding first order delay and response. The output from both blocks that model dosage are inputs to both plants ( _Tank1_, _Tank2_ ) with identical parameters. Finally, on output from the plants ( _Tank1_, _Tank2_ ) there are two blocks _u_ = _Kpe_ + _Ki_ _edt_ + _FFMON_ + _FFNH_ 4 _u_ = 0 _._ 6 _e_ + 0 _._ 000777 _edt_ + 0 _._ 35 + 0 _._ 2585 (13) FIGURE 8. Simulink model implemented to compare controllers. ( _Chlorine Analitzer_ ) that model the behavior of the chlorine analyzers (AN2), also including the reading delay and first order function that are characteristic of such measurements. The input variables to the system that have been modified for the different defined operating points have been delimited by block 3 in figure 8. A total of 16 comparisons were made, demand in winter and summer for the four operating points (1.5 m <sup>3</sup> /s, 2.0 m <sup>3</sup> /s, 2.7 m <sup>3</sup> /s, 3.7 m <sup>3</sup> /s) with a normal _FGACF_ flow. The controllers were also tested for scenarios where chlorine demand is low or high due to flow variations in _FGACF_ _.._ Finally, the system for the different ammonium values was tested and compared, producing different steps and revealing the response in both control models. The results obtained in all these comparisons are presented in the results section. Finally, we note that the function of block 4 ( _estimateCd_ ) in Figure 8 is to calculate the diffusion coefficient from the inlet flow and the chlorine demand depending on temperature. The output from this block is the input for the respective chlorination plant models. VI. THE HARDWARE. REAL IMPLEMENTATION The existing control architecture in the DWTP is based on the _ControlLogix_ system by Rockwell Automation [32]. User defined type (UDT) data structures were created to logically group the variables of the FGS&FF control system. Distributed throughout the DWTP they are linked to the PLCs that control the different processes (intermediate pumping, capture, chlorination, etc.). The SCADA supervisory layer that exchanges data with the controller is based on the _System_ _Platform_ solution by Wonderware [36]. Finally, the existing communication between the PLC controllers and the SCADA is based on the Ethernet/IP standard, Common Industrial Protocol (CIP). The FGS&FF control algorithm was run on the PLC that controls all production of chlorine and chlorine dioxide from the DWTP. This controller in turn communicates with the PLC that controls the carbon filters to read the flow from the filters ( _FGACF_ ). There is also communication with the osmosis controller to read the sum of flows ( _FRO_ ) for each of the 10 frames of the RO. The control system uses the two flows to calculate the proportion (0...1) of flow _FGACF_ ( _TPFGACF_ ) out of the total flow. Figure 9 shows a fragment of the code run in the PLC controller with an output equal to that of the example given in (14) for the first instant of time. The setpoint, for this example, is 0.5 ppm and the meter reading is 0.15 ppm of free chlorine. As shown in the figure, in the first line of code FIGURE 9. Parameterization of the _Fuzzy GainSC_FF_ instruction and the Control’s variable gain PI. we load the input variables of the fuzzy block _(GainSc_FF)_, namely the flow, ammonia and temperature. The percentage of water from the _FGACF_ carbon filters is also loaded based on the division of the _F_ GACF flow between the total flow. All of the variables are loaded into a data structure ( _FZ_DATA_ ) that was created to encapsulate all control system variables and parameters. In line 2 of Figure 9, the fuzzy instruction with the variables assigned in the previous line of code is run in second intervals. After it is run, the instruction provides as output the four variables required to parameterize the PI algorithm for each operating point. These variables in line 3 are assigned to the parameters of the PI controller. In the case of the example, the control system would produce the outputs: _Kp_ = 0 _._ 6, _Ki_ = 0 _._ 000777, _FFMON_ = 0 _._ 35 and _FFNH_ 4 = 0 _._ 258 with values identical to the case presented in [14]. In line 4 of figure 9, the PI controller is run with the parameterization obtained from the _GainSc_FF_ function and output ( _FZ_DATA.Dosage_ ) is loaded onto the control variable _FZ_DATA.Out_ . If we apply the controller shown in (14) with the parameterization that is being programmed in this example for a setpoint of 0.5 ppm and an AN2 meter reading of 0.15 ppm of chlorine, the controller output would obtain a value of 0.8187 equivalent to the ppm of chlorine to be dosed. This value would be multiplied by the flow to be treated and by 3.6 to obtain the Kg/h to be dispensed by the chlorine cabins, 11.78 Kg/h. The control system was started dynamically and smoothly so as not to produce abrupt changes when switching from semi-automatic to automatic mode. The semi-automatic mode is the one in which the operator sets the amount of chlorine to be dispensed in ppm and the control system varies the Kg/h to flowpacing. In turn, when the system is in FIGURE 10. Running the time calculation of the FGS&FF system in ‘ _Software-Manual’_ mode. automatic mode, the output is computed solely by the FGS&FF controller. In the system start-up sequence, the operator sets the amount of chlorine to be dispensed ( _dSEMI_ ) based on the state of the plant and his/her experience. After a preset stabilization time called T2End, the system switches from semi-automatic to automatic mode, the control variable then being controlled by the FGS&FF system. During _T2End_ the FGS&FF system goes into a mode called ‘ _Software-Manual_ ’ and forces output of the PI controller to the _dSEMI_ value. The _T2End_ function is computed for the time when the FGS&FF system is in ‘ _Software-Manual_ ’ mode. This is obtained from the flow rate and the distance to the measuring point (i.e. where the AN2 sensor is located). Its purpose is to show when the system can switch to ‘ _Software-Automático_ ’ mode. Figure 10 shows part of the code that is used for _T2End_ function calculation. For the case of the example, with a flow rate of 4.0 m <sup>3</sup> /s, we get a velocity of 0.139 m/s for the tank section at input. Every second the distance traveled by the sheet of water is increased and is adapted to possible variations in flow (velocity). Once the _T2End_ time interval ends ( _T_ 2 _End_ = 0), i.e. the sheet of water has traveled the distance to the meter reading point, the FGS&FF system transfers control to the fuzzy supervisor, which goes from ‘ _Software-Manual_ ’ mode to what is called ‘ _Software-Automatic_ ’ mode, where the PI updates its output based on the error and the value of the _Kp_ and _Ki_ gains of the controller. VII. RESULTS This section presents the results obtained both in the custombuilt simulator and in the actual DWTP based on using the FGS&FF system. Note that the graphs chosen are those that are considered most significant, bearing in mind the problems presented in the introduction section, variation in chlorine demand, flow variations and, consequently, delay times and the appearance of the ammonium disturbances, which can cause non-linear variations in demand. _A._ _FACTORY ACCEPT TEST. SIMULATION_ The figures presented below were obtained by comparing the FGS&FF control system with a conventional PI control in the simulator run for this purpose. The conventional PI was set to find the best response for flows between 3.7 m <sup>3</sup> /s and 1.5 m <sup>3</sup> /s and a high chlorine demand, typical of the winter season (figures 11 and 12). Figures 13 and 14 show the results of the comparison for the same IP parameterization as in the previous tests FIGURE 11. Fuzzy gain scheduling & feed-forward (FGS&FF) vs. PI controllers: Step response at 3.7 m <sup>3</sup> /s with high demand (winter period). FIGURE 12. Fuzzy gain scheduling & feed-forward (FGS&FF) vs. PI controllers: Step response at 1.5 m <sup>3</sup> /s with high demand (winter period). FIGURE 13. Fuzzy gain scheduling & feed-forward (FGS&FF) vs. PI controllers: Step response at 3.7 m <sup>3</sup> /s with low demand (summer period). (figures 11 and 12) but this time for low chlorine demand (summertime). As shown, the computed gains for a high demand do not work properly with a low chlorine demand, producing a very significant oscillation at the PI controller output. FIGURE 14. Fuzzy gain scheduling & feed-forward (FGS&FF) vs. PI controllers: Step response at 1.5 m <sup>3</sup> /s with low demand (summer period). FIGURE 15. Fuzzy gain scheduling & feed-forward (FGS&FF) vs. PI controllers: Step response at 3.7 m <sup>3</sup> /s for an ammonium step. Figure 15 shows a comparison between the two control systems with a step of 0.04 ppm ammonium. This is a highly typical situation in the winter season and in the DWTP under study in this article. Note that the time between when the FGS&FF and the conventional PI reach the set point is 100 minutes. For both systems there is a strong initial drop in the process variable (measured by the _AN2_ sensor) which is inevitable and is due to the distance between the generation of chlorine in the cabins and the dosage point. When ammonium is detected in the mixing chamber, the FGS&FF controller reacts by raising its output in relation to the amount of ammonium. However, the approximately 10 minutes that the chlorine takes to travel the distance to the dosage means there is an inevitable drop in chlorine at the outlet. Figure 16 shows an episode with a stepwise increase in ammonium and subsequent decrease in the same. It can be observed that the time difference in reaching the setpoint between the FGS&FF and the PI is still around 100 min. The distance between each successive step of ammonium may produce the effect that the output never reaches the desired chlorine setpoint. The opposite case is a drop in ammonium for short episodes and small intervals in the decrease that FIGURE 16. Response to Ammonium episode from 0.02 to 0.05 ppm NH4. can also lead to never reaching the set point. Fortunately, this phenomenon rarely occurs and is due to a highly concentrated bag of chlorine in the mixing chamber. _B._ _REAL TIME SCADA TREND_ The following are graphs obtained with the _Historian Client_ _Trend_ tool of the SCADA in the DWTP in question. Three cases are presented that show the behavior of the FGS&FF controller in response to the problems raised in the introduction section. Table 5 shows a description and range of the variables used in the graphs. Figure 17 shows an episode of a stepwise increase in ammonium where the FGS&FF system is able to act in advance and counteract the decrease at the outlet ( _AN2_ ). Figure 16 featured the same situation but simulated, and shows that for a setpoint of 0.3 ppm, the initial drop is 0.1 ppm of chlorine, similar to the drop presented for the actual behavior in Figure 17. Note that both _AN2_ and _AN3_ are always within the ±0.1 ppm interval of chlorine around the setpoint (which in this case is equal to 0.55 ppm). TABLE 5. Description and range of variables used in the graphs. Figure 18 shows a typical situation of increase in flow that occurs when switching between treating water from aquifers and rivers. In a normal situation, the treated water is of fluvial origin; however, when the turbidity of the river is high due to the effect of rain, aquifer water is treated instead. When river water can be treated again, the DWTP begins to process this water. This effect can be observed in the graph that, for a short period of time, goes from treating 2 m <sup>3</sup> /s of aquifers to almost 5 m <sup>3</sup> /s of river water. The successive stepwise increase in _FRO_ by 0.4 m <sup>3</sup> /s (the capacity of an RO frame) can also be observed, as can a gradual increase in water from carbon filters ( _FGACF_ ). As can be seen, throughout this flow episode, a low but sufficient ammonium level remains constant enough for the control system to take it into account (0.023 ppm of NH4-N). Throughout the described action, the FGS&FF controller keeps the tank output ( _AN3_ ) within the range of 0.1 ppm around the setpoint. Meanwhile, figure 19 represents an instance of using sodium hypochlorite to clean the carbon filters. This cleaning is done periodically depending how long the filter has FIGURE 17. FGCFF controller’s response to an ammonium episode from 0.03 to 0.05 ppm NH4. FIGURE 18. Transient response of the control system to an increase in flow of more than 100%. FIGURE 19. Response of the control system to an increase in flow of more than 100%. been washing the filter. The effect caused to the system is a decrease in chlorine demand of approximately 0.2 ppm of chlorine. Until minute 100, the system maintains the chlorine output at the 0.55 ppm setpoint. As shown, the FGS&FF system, after dosing hypochlorite and an increase in chlorine at the outlet, reacts and corrects its dosage to stabilize the chlorine as required. Throughout the episode of four continuous cleaning operations, the control system keeps the tank outlet (AN3) within the interval of ±0.1 ppm of chlorine around the setpoint (equal to 0.55 ppm). VIII. CONCLUSIONS Chlorination systems in drinking water treatment plants can present different problems that make it difficult for control of chlorination in effluent to be effective. Long downtimes, variation in chlorine demand, or the occasional appearance of various nonlinear ammonia disturbances are just some of these problems that have a major effect on the design of the control system when it comes to automating the chlorination process. This process belongs to the group of distributed parameter systems where the phenomena of diffusion or convection arise and which must be taken into account both in the simulation and in the control. This article has presented the analysis, design and implementation of a control system based on variable gains and feed-forward that addresses these problems. For each operating point, the parameters that describe the behavior of the system had to be identified. The article has described the design of the controller, explaining the control architecture, the set of fuzzy rules used, its implementation in a real system and the simulation and experimental results obtained in a real treatment plant. The FGS&FF control has been compared with a conventional PI. The results show a considerable improvement to the system with respect to the use of a conventional PI. Stable output from the control system is guaranteed, within the expected margins in case of any variation in chlorine demand, flow rate or any possible disturbance such as the appearance of ammonia or cleaning with sodium hypochlorite. REFERENCES [1] A. Costán-Longares, M. Montemayor, A. Payán, J. Méndez, J. Jofre, R. Mujeriego, and F. Lucena, ‘‘Microbial indicators and pathogens: Removal, relationships and predictive capabilities in water reclamation facilities,’’ _Water_ _Res._, vol. 42, no. 17, pp. 4439–4448, Nov. 2008, [doi: 10.1016/j.watres.2008.07.037.](http://dx.doi.org/10.1016/j.watres.2008.07.037) [2] H. Lange. _Real-Time_ _Control_ _System_ _Optimizes_ _Phosphorus_ _Removal_ _in_ _the Dairy Industry Problem_ . Accessed: Mar. 31, 2020. [Online]. Available: https://www.hach.com/cms/documents/industry-food/Phosphorusremoval-in-dairy-applications-DOC063.53.30314.pdf [3] B. Dabkowski and M. White, ‘‘RTC-N: Modelling ammonia-based aera tion control in real time for deeper process control,’’ HACH, Ames, IA, USA, Tech. Rep. DOC043.53.30404, Sep. 2017. [4] Endress+Hauser. _Sludge_ _Treatment_ _and_ _Disposal—Efficient_ _&_ _Safe_ . Accessed: Mar. 31, 2020. [Online]. Available: https://www.endress. com/en/industry-expertise/water-wastewater/Sludge-treatment-anddisposal [5] Endress+Hauser. _Automation_ _of_ _Nitrogen_ _Removal_ _From_ _Wastewater_ . Accessed: Mar. 31, 2020. [Online]. Available: https://www.endress. com/en/solutions-lowering-costs/analytical-solutions/automationnitrogen-removal-wastewater [6] Rockwell Automation. _Controles_ _de_ _Supervisióny_ _Adquisición_ _de_ _Datos_ _Controlador_ _Agua|_ _Caso_ _Práctico_ . Accessed: Mar. 31, 2020. [Online]. Available: https://www.rockwellautomation.com/es_ES/news/casestudies/detail.page?pagetitle=SCADA-PAC-Water-%257C-CaseStudy&content_type=casestudy&docid=beb20046e03177c3188f 42a5eee39973 [7] S. Judd and G. C. White, _Handbook_ _of_ _Chlorination_ _and_ _Alternative_ _Disinfectants_, vol. 77, 5th ed. Hoboken, NJ, USA: Wiley, 2010, no. 4. [8] D. Gang, ‘‘Modeling chlorine decay in surface water,’’ _J._ _Environ._ _Infor-_ _mat._ [, vol. 1, no. 1, pp. 21–27, Mar. 2003, doi: 10.3808/jei.200300003.](http://dx.doi.org/10.3808/jei.200300003) [9] R. M. Clark, ‘‘Chlorine demand and TTHM formation kinetics: A second-order model,’’ _J. Environ. Eng._, vol. 124, no. 1, pp. 16–24, 2002, [doi: 10.1061/(asce)0733-9372(1998)124:1(16).](http://dx.doi.org/10.1061/%0x28asce%0x290733-9372%0x281998%0x29124:1%0x2816%0x29) [10] E. A. Kobylinski, G. L. Hunter, and A. R. Shaw, ‘‘On line con trol strategies for disinfection systems: Success and failure,’’ _Proc._ _Water_ _Environ._ _Fed._, vol. 2006, no. 5, pp. 6371–6394, Jan. 2006, [doi: 10.2175/193864706783761716.](http://dx.doi.org/10.2175/193864706783761716) [11] E. A. N. Furlong and F. M. D’Itri, ‘‘Trihalomethane levels in chlorinated Michigan drinking water,’’ _Ecol. Modell._, vol. 32, nos. 1–3, pp. 215–225, [1986, doi: 10.1016/0304-3800(86)90028-1.](http://dx.doi.org/10.1016/0304-3800%0x2886%0x2990028-1) [12] A. E. Griffin, B. Ph, and N. S. Chamberlin, ‘‘Break-point chlorination,’’ _Amer. J. Public Health_, vol. 31, pp. 803–808, Dec. 1941. [13] F. Nejjari. (2013). _Chlorine_ _Decay_ _Model_ _Calibration_ _and_ _Comparison:_ _Application_ _to_ _a_ _Real_ _Water_ _Network_ . Accessed: Apr. 22, 2019. [Online]. Available: https://upcommons.upc.edu/bitstream/handle/ 2117/22893/CCWI13_Fatiha1.pdf [14] R. V. Ignacio Santín and C. Pedret. _Control_ _and_ _Deci-_ _sion_ _Strategies_ _in_ _Wastewater_ _Treatment_ _Plants_ _for_ _Operation_ . Accessed: Apr. 4, 2020. [Online]. Available: https://books.google.es/books?hl=es&lr=&id=7qNDDQAAQBAJ&oi= fnd&pg=PR5&dq=Control+and+Decision+Strategies+in+Wastewater &ots=AoU2XzMoM9&sig=K8bvB6w8mSa6TwfaZryvsQwcko8 #v=onepage&q=ControlDecis.Strategies Wastewater&f=false [15] Rockwell Automation. _Predictive_ _Model_ _for_ _Chlorination_ . Accessed: Jan. 6, 2020. [Online]. Available: https://www.instrumentation.co.za/print. aspx?editorialtype=A&editorialid=3799 [16] T. Chang, ‘‘Robust model predictive control of water quality in drinking water distribution systems,’’ Ph.D. dissertation, Dept. Electron., Elect. Syst. Eng., Univ. Birmingham, Birmingham, U.K., Sep. 2016. [17] _Análisis_ _de_ _Redes_ _de_ _Agua_ _Usando_ _EPANET—Anma_ . Accessed: Mar. 26, 2020. [Online]. Available: https://anmatecnologia.wordpress. com/2018/07/09/analisis-de-redes-de-agua-usando-epanet/ [18] A. G. Seyoum and T. T. Tanyimboh, ‘‘Integration of hydraulic and water quality modelling in distribution networks?: EPANET-PMX,’’ _Water_ _Resour._ _Manage._, vol. 31, no. 41, pp. 4485–4503, Nov. 2017, doi: [10.1007/s11269-017-1760-0.](http://dx.doi.org/10.1007/s11269-017-1760-0) [19] S. Kara, I. E. Karadirek, A. Muhammetoglu, and H. Muhammetoglu, ‘‘Real time monitoring and control in water distribution systems for improving operational efficiency,’’ _Desalination_ _Water_ _Treatment_, vol. 57, no. 25, [pp. 11506–11519, May 2016, doi: 10.1080/19443994.2015.1069224.](http://dx.doi.org/10.1080/19443994.2015.1069224) [20] W. Cueto and R. Rivas, ‘‘Sistema de control basado en autómatas program ables de la red de distribución de agua potable Troncoso,’’ _Ing. Electrónica,_ _Automáticay Comun._, vol. 12, no. 2, pp. 6–14, 2003. [Online]. Available: http://www.bvsde.paho.org/bvsacg/fulltext/sistemacontrol.pdf [21] W. Xin, L. Ran, W. Yanghua, P. Yong, and Q. Bin, ‘‘Self-tuning PID controller with variable parameters based on particle swarm optimization,’’ in _Proc._ _3rd_ _Int._ _Conf._ _Intell._ _Syst._ _Design_ _Eng._ _Appl._, Jan. 2013, [pp. 1264–1267, doi: 10.1109/ISDEA.2012.297.](http://dx.doi.org/10.1109/ISDEA.2012.297) [22] K. Gajam, Z. Zouaoui, P. Shaw, and Z. Chen, ‘‘Design of an adaptive self tuning smith predictor for a time varying water treatment process,’’ _Proc._ _IFAC ADCHEM2009 Conf._, 2009, pp. 875–879. [23] T. J. Kingham and T. M. Hoggart, ‘‘Chlorination control in a large water treatment works,’’ in _Proc._ _IEE_ _Colloq._, 1995, p. 112, [doi: 10.1049/ic:19950738.](http://dx.doi.org/10.1049/ic:19950738) [24] A. Felipe, H. Librantz, F. Cosme, and C. Gustavo, ‘‘Artificial neural networks to control chlorine dosing in a water treatment plant,’’ _Acta_ _Scientiarum_ [, vol. 40, Sep. 2018, Art. no. e37275, doi: 10.4025/actascitech-](http://dx.doi.org/10.4025/actascitechnol.v40i1.37275) [nol.v40i1.37275.](http://dx.doi.org/10.4025/actascitechnol.v40i1.37275) [25] A. Pastre, ‘‘Modelling and control of potable water chlorination,’’ Ph.D. dissertation, Dept. Chem. Eng., Pollut. Res. Group, Univ. Natal, Durban, South Africa, 2003. [26] S. C. Chapra and R. P. Canale, ‘‘Numerical methods for engineers,’’ _Math._ _Comput._ _Simul._, vol. 33, no. 3, p. 260, 2015, doi: [10.1016/0378-](http://dx.doi.org/10.1016/0378-4754%0x2891%0x2990127-O) [4754(91)90127-O.](http://dx.doi.org/10.1016/0378-4754%0x2891%0x2990127-O) [27] M. K. Stenstrom and H. G. Tran, ‘‘A theoretical and experimental investiga tion of the dynamics of breakpoint chlorination in dispersed flow reactors,’’ Dept. Civil Eng., School Eng. Appl. Sci., Water Resour. Program, Univ. California, Los Angeles, CA, USA, Tech. Rep. UCLA–Eng 84-38, Jul. 1984. [28] E. Duviella, ‘‘Conduite réactive des systèmes dynamiques étendus à retards variables. Cas des réseaux hydrographiques, Automatic,’’ Inst. Nat. Polytechn. Toulouse, Toulouse, France, Tech. Rep., 2005. [Online]. Available: https://tel.archives-ouvertes.fr/tel-00010309 [29] The R Fundation. _R:_ _The_ _R_ _Project_ _for_ _Statistical_ _Computing_ . Accessed: Mar. 28, 2020. [Online]. Available: https://www.r-project.org/ [30] _PID_ _Controller_ _Tuning_ _in_ _Simulink—MATLAB_ _&_ _Simulink—MathWorks_ _España_ . accessed: Apr. 5, 2020. https://es.mathworks.com/help/slcontrol/ gs/automated-tuning-of-simulink-pid-controller-block.html [31] Rockwell Automation. _RSLogix_ _5000_ _Fuzzy_ _Designer_ _User_ _Man-_ _ual_ . Accessed: Mar. 31, 2020. [Online]. Available: http://literature. rockwellautomation.com [32] Rockwell Automation. _Automatización_ _Industrial|Seguridad_ _Indus-_ _trial|Rockwell_ _Automation_ _España_ . Accessed: Mar. 29, 2020. [Online]. Available: https://www.rockwellautomation.com/es_ES/overview.page [33] AVEVA. _Wonderware_ _Solutions_ _Are_ _Now_ _AVEVA_ _Solutions_ . Accessed: Mar. 29, 2020. https://sw.aveva.com/wonderware JAVIER GÁMIZ received the degree in computer engineering from the Universidad Nacional de Educación a Distancia (UNED), Spain, in 2008, and the master’s degree in automatic control and robotics from the Universidad Politécnica de Catalunya (UPC), in 2010, where he is currently pursuing the Ph.D. degree in control science and engineering. His research interests include non-linear control, SCADA and PLC integration, operation technology (OT), and control in automation systems around water. He has been an Associate Professor with UPC, since 2002. In the water control industry, he has extensive experience as an Engineer with the AGBAR Group, Control Systems Department, since 1992. Since 2018, he has been the Manager of the Department of Industrial Control Systems, Aguas de Barcelona. He has been certified by the ITIL Foundation, as a Senior Engineer in computer services management, and in electronics and robotics for regulation and automatic control techniques, and as a Senior Engineer in Applications Automation, by the AQPE (Professional Engineers Qualification Agency). RAMON VILANOVA (Member, IEEE) received the degree and the Ph.D. degree from the Universitat Autònoma de Barcelona, in 1991 and 1996, respectively. He is currently a Full Professor of automatic control and systems engineering with the School of Engineering, Universitat Autònoma de Barcelona, where he develops educational task teaching subjects of signals and systems, and automatic control and technology of automated systems. His research interests include methods of tuning of PID regulators, systems with uncertainty, analysis of control systems with several degrees of freedom, application to environmental systems, and development of methodologies for design of machine-man interfaces. He is the author of several book chapters and has more than 100 publications in international congresses/journals. He is a member of IFAC, IEEE-IES, and the Technical Committee on Factory Automation. HERMINIO MARTÍNEZ-GARCÍA (Member, IEEE) received the B.Eng. degree (Hons.) in electrical engineering and the M.S. and Ph.D. degrees (Hons.) in electronics engineering from the Technical University of Catalonia (UPC, BarcelonaTech), Barcelona, Spain, in 1994, 1998, and 2003, respectively. From 1995 to 2000, he was an Assistant Professor with the Department of Electronics, College of Industrial Engineering, Barcelona (EUETIB-CEIB). In September 2000, he joined the Department of Electronics Engineering, UPC, where he became an Associate Professor, in 2006. He became a Researcher with the Energy Processing and Integrated Circuits (EPIC) Group, UPC. From October 2008 to March 2009, he was a Visiting Professor with the Analog and Mixed Signal Center (AMSC), Department of Electrical and Computer Engineering, Texas A&M University (TAMU), College Station, TX, USA. His research interests include industrial control, dc–dc power converters and their control, and analog circuit design with emphasis in analog microelectronics. He received the National Award during his studies. YOLANDA BOLEA (Member, IEEE) received the M.S. and Ph.D. degrees in telecommunications engineering and automatic control from the Technical University of Catalonia (UPC), Barcelona, Spain, in 1999 and 2010, respectively. She is currently an Associate Professor with the Department of Automatic Control, UPC, giving lectures on modeling and simulation of dynamic systems, chemical control process with the Industrial Engineering School. She is in charge of the Robotic Laboratory, Industrial Engineering School. Her research interests include advanced control, robust control and LPV control, and robotics. She is also interested in education on sustainable development in engineering. She is an IEEE member with the Industrial Electronics Society (IEEE-IES) and the Technical Committee on Factory Automation. ANTONI GRAU (Senior Member, IEEE) received the M.S. and Ph.D. degrees in computer science from the Technical University of Catalonia (UPC), Barcelona, in 1990 and 1997, respectively. He is currently a Professor with the Department of Automatic Control, UPC, giving lectures on computer vision, digital signal processing, and robotics with the School of Informatics of Barcelona and the Industrial Engineering School. His research interests include computer vision, pattern recognition, autonomous mobile robots, factory automation, and education on sustainable development. He is a Senior Member of the IEEE Industrial Electronics Society (IEEE-IES), co-chairing the Technical Subcommittee FA11: Intelligent and Cooperative Robotics. He chaired several international conferences. He serves as an Associate Editor for the TRANSACTIONS ON INDUSTRIAL INFORMATICS.

섹션 본문 67문단 · 47,916자

(제목 없음)

1Chlorination in drinking water treatment plants (DWTP) is the final process applied to water before it is sent to storage tanks in the supply network for subsequent human consumption. An excessive dosage of chlorine or, conversely, too small a dosage, may breach existing legal regulations on mandatory limits. Furthermore, excessive amounts generate an unnecessary cost in terms of chlorine and, collaterally, problems due to an increase in the maximum permitted amounts of such by-products as trihalomethanes, which are carcinogenic compounds for humans. In DWTP where there is no significant variability in the quality of the water to be treated, a type of control that is proportional to the flow rate in the effluent can have fully satisfactory results. However, in a control strategy applied when there are inherently long delays in the process, variability in the quality of the water to be treated and considerable variations in flow, a proportional type of control does not tend to work and an alternative type is needed. This article presents the strategy and results of a control method that combines a feed-forward system with gain scheduling in a (Proportional-Integral) PI control. The control system design was validated beforehand by simulation and then applied to a real DWTP, producing satisfactory experimental results.INDEX TERMS Chlorination process, drinking water treatment plants, fuzzy control, gain scheduling.110018This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ VOLUME 8, 2020

I. INTRODUCTION

2Chlorine is the most widely used disinfectant in drinking water treatment plants (DWTP) due to its high efficiency as a germicide and its excellent capacity to eliminate odors and tastes from water destined for human use. It is also used in Wastewater Treatment Plants (WWTP) to minimize the public health risks associated with exposure to reclaimed water, where the most important goal is the reduction of pathogens during tertiary treatments [1].

3Chlorination processes at output from DWTP have been extensively analyzed in terms of control. The interest lies in achieving a fully automated process, in which humans The associate editor coordinating the review of this manuscript and approving it for publication was Mohsin Jamil . only intervene as supervisors, and in which the quality of the effluent complies with the established regulations, while optimizing operating costs. In the last decade, advances in online instrumentation [2]- [5], i.e. our 'eyes' on the ground, together with controllers with the capacity to run advanced control algorithms [6], have successfully automated processes that were traditionally controlled manually. However, in the case of chlorination, it would be no use having the finest instrumentation and controls to address the problem if the chemistry of the water to be treated is not taken into consideration. Most problems in chlorination control come down to an improper understanding of the chemistry of water, inexistent or incomplete modeling, and/or problems derived from a poor choice of sensors or actuators.

4The reaction of chlorine when it comes into contact with water can be divided into several phases [7], which clearly mark the control strategy applied. In a first phase, a significant part of the chlorine reacts quickly with the existing (organic and inorganic) matter [8], these reactions occur between the first 5 and 10 minutes [9] after the chlorine comes into contact with the water. The amount of organic matter and nitrogenous substances that react in these first moments will cause considerable variation in the gain of the process in a quick reaction and must be taken into account when designing the control system. When the variability in water quality is homogeneous, this problem will be barely exist. However, when treating waters in which this amount of organic matter can vary, and therefore its chlorine demand too, a control is required with variable gains that adapt to this characteristic. The problem is heightened by the occasional existence of ammonia, which might vary the process gain in a non-linear manner and cause what is called a 'breakpoint scenario'. In these cases, the measurement of residual chlorine at output, the controlled variable, goes through three states with different behaviors. Depending on the nitrogen-derived compound that is reacting in each of these three states, the demand for chlorine will vary. The control system in these cases must be able to deal with these changes in water chemistry and detect when the transition from one state to another occurs [10]. This phenomenon is explained in [11] from the point of view of water chemistry, as well as the influence when computing the process gain for the control system.

5The remaining part of chlorine that has not reacted at first, reacts more slowly and requires a minimum period of contact with water in order for its disinfection to be effective. This time is normally between 20 and 30 minutes. This characteristic must be taken into account when designing the control system since it can considerably affect the behavior, as will be seen in the results of later sections. This reading time by the residual chlorine meter in output will also be affected by the variations in flow that may occur in the system. For example, the system delay will vary if the flow is 1 m 3 /s or triple that amount (3 m 3 /s) and, depending on the system, and not taking this time into account could hinder the implemented control.

6There are also certain problems that can hinder the control of chlorination caused by the sensors and actuators used. Regarding residual chlorine analyzers, it is important to consider their location to ensure that their free chlorine reading is a real value and therefore significant. They must therefore be located somewhere that guarantees that the water to be treated at its highest flow has been in contact with the chlorine for at least 30 min, otherwise the meter reading will not be correct. Likewise, it is important to measure genuinely free chlorine and not combined chlorine. In the case of combined chlorine readings, the control system would produce an incorrect measurement that, depending on its state in the breakpoint [12], [13], could cause underdosing due to chlorine dosage increasing without taking this into account. In these cases, where there could be ammonia in the water to be treated, the installation of an ammonia analyzer is highly recommended, and almost obligatory. Its reading setting (every 5-10 min.) will also be a factor to be taken into account in the design of the control system since this will entail an additional delay on top of those inherent to the chlorination process. Normally, the drawback of this type of analyzer is that, apart from a sampling time below 0.02 ppm or 0.05 ppm, it does not give a reliable reading. There are no online analyzers on the market that offer such precision of particles per billion (ppb) of NH4-N. The error in this measurement range makes it hard for the control system to anticipate, since the output variable cannot be computed directly as a function of the input ammonia variable. In this case, the possible chlorine demand must be estimated, based on other indirect parameters such as temperature, water origin or pH.

7In most cases, the chlorine used for disinfection in large drinking water treatment plants tends to be supplied in pressurized chlorine tanks or drums. The output of chlorine gas from these drums is transferred to the chlorinators (actuators), where chlorine gas is mixed with auxiliary water to obtain chlorinated water with concentrations ranging from 1 to 3 gr/l. If the variability in the dosage is large, as is the case in the present study, there are sure to be different chlorinators to hence cover a wide range of flow rates. Switching between these chlorinators with different ranges of action, as well as changes in the drums due to chlorine gas depletion, will cause considerable disturbances to the control system and these will require a quick response in order to keep the output within the desirable limits.

8In summary, for DWTP treating large flows, there are different possible problems that the control system must consider when automating the chlorination process:

9• Large variations in chlorine demand, due to the diversification of the organic matter present in the water to be treated and the occasional appearance of ammonia.

10• Long delay times in the measurement of chlorine at effluent output, due to the inherent time that the process requires in order for disinfection to be effective.

11• Unreliable sensors that measure combined chlorine as well as free chlorine or mechanical errors in actuators.

A. RELATED LITERATURE

12Depending on the origin of the water to be treated and the available instrumentation and control, the strategies used in drinking water chlorination processes may also vary. In drinking water supply tanks, a form of post-chlorination is performed on water that has already been treated beforehand and the main demand for chlorine from organic and inorganic compounds has already been covered. In [13] presents a model for estimating chlorine decay in water output from the DWTP, the object of the control presented in this article. In relation to the problems with long delays and major disturbances, some kind of control at output evidently needs to be recommended. Hence, a model-based predictive control (MPC) algorithm is used to try to optimize the future behavior of the plant in each interval, computing a sequence of VOLUME 8, 2020 manipulated future variables [14]. Reference [15] addresses the problem of chlorination control in supply tanks using an MPC based on the flow to be treated and the system model. In this case, the chlorine decay for different flow rates is known, and the controller can predict and anticipate before detecting deviations on the setpoint in the effluent. Reference [16] addresses the control of chlorination in drinking water supply systems based on a robust predictive control model. The use of Epanet simulation software [17]- [19] should be highlighted in applications for systems controlling drinking water supply. This software can also describe in great detail the behavior of the reaction kinetics of chlorine in the water treated for a supply. However, the computation requirements and not working in 3 dimensions mean it is unsuitable for the type of application being presented. In [20] propose a control system based on the ratio between flows of water to be treated from wells and the demand for chlorine to be dosed. Reference [9] presents a highly detailed overview of different chlorination control strategies in WTP, ranging from manual control to automated systems based on feedback algorithms such as PID combined with feed-forward. In the case of manual control, the need for the presence of a technician to set the dosage is an operating cost that must be taken into account. For DWTP in which variability in the quality of the water to be treated is minimal, this manual strategy may work well. The technician in this case sets the dosage and is aided by an output instrument that can make rectifications if it veers from the desired setpoint. This operation can be repeated 2 to 3 times a day and does not take long, so the operational effort is sustainable. The need for automation mainly arises when the variability in flow and water quality at input make manual operation unfeasible in terms of costs and 'human in the loop' unreliability.

13In this sense, a first level of automation with respect to manual dosage is what is called flowpacing. In this case, for a chlorine demand with little variability and without disturbances of quality, the strategy might work, but not when the demand is variable. The first option to address these changes in water quality (chlorine demand) is to close the control loop and apply, for example, a PID algorithm that compensates for the effect of possible disturbances at output. If the range of flow rates of the water to be treated varies, the integral gain of the controller should also vary since the system downtime changes. Non-constant water quality will affect the system gain, and consequently controller gain. From all of the above, it follows that for a type of water with variable delays and demands, the gain of the PID controller must be adjusted to the different operating points. Reference [21] describes a system that compensates for this variability in system gain, using a PID controller with variable parameters based on the particle swarm optimization (PSO) computational method for chlorination of drinking water. Reference [22] presents an adaptive predictive PI controller that adapts or self-adjusts depending on demand. Another strategy presented in [23] uses a cascaded PI to control chlorination in contact tanks with long downtimes. As alternative strategies to PID algorithms, [24] presents a control algorithm in which the variability of demand is addressed through the use of neural networks for a drinking water plant with a nominal flow rate of 0.9 m 3 /s. Reference [25] addresses the problem of chlorination control by means of a predictive control strategy using a controller in a dynamic matrix configuration.

B. CONTRIBUTION

14This article presents a strategy to control chlorination processes with severe disturbances and long delay times. A system of distributed parameters is addressed from the point of view of simulation and control, the identification of such parameters as diffusion, convection and decay of chlorine having been necessary at each point of operation. A gain scheduler and feed-forward control system designed on the basis of the operator's experience and data validated by more than 5 years of records is used.

15The proposed control model can be applied to plants where there is variability in the demand for chlorine, thus providing a method for the design of a type of control system that takes this factor into consideration. It can also be applied to respond to severe disturbances in water chemistry, such as the appearance of ammonia; or operations such as changes between chlorination cabins that are not always linear. Also, as a contribution, based on the variation in flows it offers a potential solution for changes in downtimes that might affect the control system.

16One of the advantages of this article over other solutions reported on the current state-of-the art is that it might not require specific hardware for physical implementation. Indeed, this study provides a solution involving an easily implemented control strategy using the existing hardware in the DWPT under study. Specifically, the market controller used is a commercial PLC (Programmable Logic Controller) made by Rockwell Automation. Unlike other control systems presented in the literature, this one requires much less computation, is easily exportable to other architectures (since it is based on a standard), and is also robust enough to be used in industrial environments.

C. STRUCTURE

17The remainder of the article is structured as follows. Section II describes the chlorination plant in terms of hydraulics and equipment. Section III presents and describes the mathematical model applicable to chlorination treatment, identifies the system and presents the parameters for different chlorine flow rates and demands. Section IV explains the structure of the implemented controller and details the tuning parameters that were run in the actual plant. Section V explains how the simulator used to test the control system was designed and run. Section VI details the running of the algorithm designed in a market PLC controller. Section VII presents the results obtained from fuzzy gain scheduling and feed-forward (FGS & FF) control, both in the custom-built simulator and in the aforementioned actual treated plant. Finally, Section VIII presents the conclusions based on the results obtained.

II. DRINKING WATER TREATMENT PLANT

18The DWTP that is the object of this article is one of the most technologically advanced water treatment plants in operation. Producing 120 Hm3 of drinking water a year and with a maximum capacity of 6 m 3 /s, it is one of the biggest drinking water treatment plants in Southern Europe.

19At this DWTP, traditional processes such as pretreatment, clarification and final disinfection of water coexist alongside other latest generation ones, such as treating water with ozone and active carbon, and reverse osmosis. For disinfection, there are two chlorination tanks, the first of these being the subject of the work presented herein. Figure 1 shows a diagram of tank 1 where the first chlorination of the water to be treated at the WTP is performed. The 10,000 m 3 tank is hydraulically connected to a second tank of identical size and which, in the event of an anomaly in either of these tanks, can treat the entire flow of the plant.

A. CHLORINATION PLANT LAYOUT

20As mentioned earlier, the object of study in this article is the first tank (figure 1). However, it would also be applicable to the second tank, albeit modifying the control system parameters. In fact, both tanks are cleaned every year and while this is happening, all the water to be treated only passes through the one tank that is still in service.

21The flow of water to be treated in tank 1 comes from a small chamber in which water from a traditional treatment by granular activated carbon filters (F GACF ) is mixed with water treated by reverse osmosis (F RO ). On output from both treatment processes, there are respective flow meters that show the flow from both the osmosis and carbon filter treatments, F RO and F GACF , respectively. The sum of these two flows will be the total flow to be treated variable, and the input for the control system presented in this article. The actual flow treated by the plant is between 5.5 m 3 /s, at maximum performance, and a minimum flow in certain situations of 1.5 m 3 /s. Under normal conditions, the distribution by GACF and by RO is 50%. However, this distribution may change by hours depending on the operating conditions of the DWTP. This flow balance must be taken into account by the control system because it will cause variations in the system's gain, as shall be explained later. The theoretical residence time in the tanks can vary between 30 min and 2.5 hours, depending on the flow. It is important for this time, depending on the velocity of the water, to be considered by the control system in order to modify its integral gain. The tank is divided by a baffle that forces the water to travel 200 meters, 100 m in one direction and 100 m more in the opposite direction. This design is due to the need to guarantee a minimum reaction time so that the dosage of chlorine that comes into contact with the water can be effective.

22The sensors and actuators that are used to perform the control are flow meters (FT, flow transmitter) (F RO , F GACF ), a quality transmitter (Q), ammonia analyzer in the mixing chamber (AN1) and a temperature transmitter (TT). Both level meters (LT, level transmitter) are available for tanks 1 and 2. Two free chlorine analyzers located at the midpoint (specifically at 87 m) at the end of the tank (AN2, AN3, respectively). As actuators there are four chlorination cabins that produce a flow of chlorinated water (F CHLORINE ) in accordance with the setpoint. Of the four cabins, two have a range of 0-40 Kg/h and the other two of 0-160 Kg/h. The main meter that closes the loop from the control system in question is AN2, but there is a second meter (AN3) on output from tank 1. Should there be any problem with AN2, meter AN3, with the corresponding settings, becomes the control system process variable. Tank 2 has two residual chlorine analyzers AN4 and AN5 that serve a similar purpose as tank 1 but with different setpoints and settings. Neither the control nor meters in tank 2 are studied in this article.

III. MATHEMATICAL MODEL. SYSTEM IDENTIFICATION

23The chlorine dispenser system in the contact tanks can be characterized as a distributed parameter system that occurs in two connected reactors. The effects of advection, diffusion, and reaction can be generalized by the partial derivative equation in the following linear form [26]:

24where V is the volume of the tank (m 3 ), Q is the flow (m 3 /s), c is the concentration of chlorine (ppm), D is the diffusion coefficient (m 2 /s), A C is the cross-sectional area of the tank (m 2 ), and k is the first order chlorine decay coefficient (s −1 ).

25If we simplify the model and x and t tend to 0, equation (1) can be expressed as:

26where U is the velocity of water through the tank (m/s).

27In the case of the tank being studied in this article, the diffusion coefficient (D) was obtained from simulations with the commercial CFD Comsol˙software and its value ranges VOLUME 8, 2020 from 0.0055 m 2 /s to 0.013 m 2 /s for velocities of between 1.5 m 3 /s and 3.7 m 3 /s respectively. Velocity (U ) according to previous flows and the dimensions of the tank is between 0.052 m/s and 0.12 m/s. Dosage (c) under normal conditions without ammonia is between 0.15 ppm and 2 ppm of chlorine, depending on the system's gain.

28The chlorine decay constant (k) depends on different variables that must be taken into account when designing the control system. A significant part of the chlorine (c) reacts quickly with the existing (organic and inorganic) matter, and the remaining matter reacts with the remaining fraction. Given the location of chlorine analyzer AN2, the time that elapses from dosage on entering the tank to measurement is sufficient for the chlorine to react completely and quickly. If the reactive term in equation (2) is developed as shown, the decay in chlorine can be divided as the sum of one fast-acting fraction and one slow-acting one. Reference [8] presents a second-order model that differentiates between both reactions, the fast reaction having a decay coefficient that is differentiated from the slow one:

29If we replace the reactive term -kc of equation (2) with the expression of equation (3) we get:

30For the purposes of the control system presented in this article, the fourth term (-k s c) is practically negligible, as shown in [13] for the type of water treated, k S is between 0.5 day −1 and 0.008 day −1 and the maximum time until the meter reading for a flow of 1.5 m 3 /s is 30 min.

31The third term (-k R c 2 ), unlike the fourth, is decisive, since the initial chlorine demand will cause the system gain to vary, and so the control system needs to take this into account. The nonlinear term (−k R c 2 ), in turn, can be decomposed into a whole set of reactions of water with organic and inorganic matter and ammoniacal compounds such as ammonia. For the case discussed in this article, the chlorine demand due to organic and inorganic matter can vary between 0.15 ppm and 0.5 ppm of chlorine. This variation has been determined from 5-year statistical data and heavily depends on water temperature and therefore on the time of year when the water is treated. Another aspect that has a major influence is the origin of the water; i.e. how the inflow is distributed between FCAG or RO treatment. If the water predominantly comes from FCAG, the system gain will be low, unlike when the flow comes from RO, whereupon much of the organic matter has been eliminated and, therefore, the demand for chlorine will be close to 0.

32The appearance of ammonia in reactions will cause variations in system gain in a non-linear manner and its considerable impact needs to be taken into account by the control system. Reference [27] presents an in-depth study of the reaction of chlorine and ammonium compounds, determining the different constants of the process depending on the chlorine reaction phase in which it occurs. With the appearance of ammonia, the system gain for the DWTP in question changes dramatically and for each ppm of ammonia, a dosage of 7.5 times ppm of chlorine is required. The value of 7.5 has been obtained from 5-year statistical data.

A. SYSTEM IDENTIFICATION

33If we consider the reaction of chlorine in the treated tank to be a homogeneous reaction, the model presented in equation (4) can be characterized with a fairly precise degree of fit to a system with 2nd order transfer function with delay and two real poles as presented in equation (5):

34where K p is the system gain, T 1 and T 2 the time constants, and T d the delay. If we assign the parameters of equation (2) to equation (5) we find that K p will depend on k R , time constants T 1 and T 2 will depend on the velocity of the water flow U and of diffusion D and, finally, T d will depend on the velocity U , equation (6).

35For the case of the chlorination tank being studied in this article, a subset of system gains, time constants T 1 and T 2 and delays T d for different operation points and chlorine demands at different flow rates is shown in Table 1.

IV. CONTROL STRATEGY

36The main objective of the control system designed and implemented herein is to cover the basic demand for chlorine in tank 1 (figure 1). The purpose of tank 2 is to dose the established setpoint (usually 1.0 ppm) to guarantee compliance with the quality requirements of current legislation in the supply network. A control strategy with feed-forward and PI control with variable gains computed from a fuzzy supervisor has been designed for both tanks. This article describes the control for tank 1, which differs from the control for tank 2 ( fig. 1), and also in the parameterization of the gains, by considering compensation for the appearance of ammonia in the mixing chamber. However, as mentioned earlier, it should be noted that although the control described in this article focuses on tank 1, it would also be applicable to tank 2, modifying the parameters of the control system. A. CONTROL SCHEME Figure 2 shows a block diagram of the control implemented for tank 1. There is a fuzzy supervisor that controls, on the one hand, a block of variable gains, input for a PI control. On the other hand, it controls a feed-forward block that generates two outputs (FF_MON, FF_NH 4 ) in addition to the control signal generated by the PI controller.

37The fuzzy supervisor input variables are temperature, ammonium (NH + 4 ) in the mixing chamber, and the flow rates from reverse osmosis (F RO ) and the granular activated carbon filters (F GACF ). The setpoint (S CL ) for the control system tends to be between 0.3 ppm and 0.6 ppm of free chlorine at output from tank 1. This study has obtained four operating points (flows, 1.5 m 3 /s, 2.0 m 3 /s, 2.7 m 3 /s, 3.7 m 3 /s) applying [28], depending on the possible range of flows to be treated, from 1.5 m 3 /s to 5.0 m 3 /s.

B. FUZZY GAIN SCHEDULING DESIGN

38The gains of the PI controller for the four described operating points were computed depending on the temperature in the mixing chamber and the water distribution between RO and FCAG. Based on historical data and with the help of the statistical tool R [29] it was possible to validate that the chlorine demand varies in winter and summer between 0.3 ppm and 0.5 ppm of chlorine due to temperature. This demand can drop to 0.15 for cases in which a large amount of the treated flow is from reverse osmosis, where a large part of the organic and inorganic matter has been eliminated. In equation (7), the controller transfer function for the controller gain differences computed at the operating points is presented in a generic manner.

39Let G c be the controller transfer function, let K pn be the proportional gain, let K in be the integral gain for n taking values in the range 1, 2, 3 and 4 for the different operating points. It is well worth to note that there will be different values of proportional and integral gain for every operating point. Table 2 presents the gains (K pn , K in ) obtained in Matlab R using the PID Tuner tool [30] for every operating point. To choose the controller parameters, the minimum overshoot and minimum settling time criteria prevailed.

40Gain scheduling involved use of a fuzzy supervisor that, depending on the temperature in the mixing chamber and the distribution of flow rates between RO and FCAG, interpolates the different gains of the control system.

41The tool used in the design of the fuzzy supervisor was the Rockwell Automation RSLogix 5000 Fuzzy Designer commercial software [31]. Figure 3 shows a general block diagram of the structure of the fuzzy supervisor made with this tool. The linguistic variables that were defined are Flow, Temperature, TPGacf and Amonium. The inference engine (GainSc_FF) for the control system is based on 18 rules that modify the parameters of the PI controller. Depending on the temperature and origin of the water, the control system makes an estimate of the demand for chlorine based on the organic matter in the water to be treated. This estimated chlorine demand (FF_MON) is a value that is added to the PI controller output variable.

42Depending on the amount of ammonium in the water to be treated, the control system computes a value, FF_NH 4 , which is added to the PI control output. Its value can vary between 0 and 7.375 ppm depending on the ammonia in the water (0. . . 1 ppm).

43For example, figure 4 shows for the linguistic variable Flow with a universe of discourse U = [1.0, 5.0], the four fuzzy sets (c 1 . . . c 4 ) with the respective linguistic values (labels) VOLUME 8, 2020 llow, low, medium and high with GAMMA and LAMBDA type membership functions. In the specific case, for a flow value of 3.2 m 3 /s, the degrees of membership to the low and medium sets are 0.3 and 0.7, respectively.

44Meanwhile, figure 5 shows for the variable Temperature, with a universe of discourse U = [5.0, 20.0], the 2 fuzzy sets that it contains, with linguistic values winter and summer, and with GAMMA type membership functions. Table 3 shows a subset of the rules defined to interpolate the different gains of the control system. The defuzzification algorithm applied was the center average method. The output variables for the weighted output functions A j,k,l , A(c j,k,l ) is the maximum of the degrees of membership of all the rules with the consequent A j,k,l ; c j,k,l is the position of the centroid of the member function A j,k,l , and M is the set number of A j,k,l, with two low (0.18) and medium (0.82) fuzzy sets.

45Applying equations (8), (9) and (10) to equation (7), at time t = 1, and considering that the existing ammonia is FF_NH 4 = 0, the controller would provide an output as shown in (11). u = K p e + K i ed t + FF MON + FF NH 4 4 = 0.6e + 0.00077 ed t + 0.35 + 0 (11) where e is the error obtained from the difference between the setpoint and the process variable, measurement of free chlorine by sensor AN2. Figure 6 shows a 3D lattice graph for the Flow and TPGacf input variables and the K i output variable. As shown in the

C. AMMONIUM COMPENSATOR DESIGN

46The control system must compensate for severe disturbance in cases where ammonia is detected in the mixing chamber. There are currently ammonium analyzers (NH 4 -N) on the market that have acceptable precision and accuracy with sample times of 5 min. The problem with these analyzers is that below 0.02 ppm, their measurements are not reliable. This problem is solved by the designed control system, with the estimation of chlorine demand based on the temperature and origin of the water to be treated. As explained in Section II (Plant Layout), there is a meter in the mixing chamber that enables the control system to detect the presence of ammonia and generate a proportional output in addition to the PI control action (Figure 2). The meter output is used by the control system for values above 0.02 ppm of NH 4 . For ammonium compensation, the control system uses a conventional Takagi-Sugeno model that offers a smooth change between the different slopes of action on the control variable.

47As shown in figure 7, two work zones have been defined, equivalent to the Error and Good fuzzy sets. The Error set represents those values at which the meter measures below 0.02 ppm and the Good set those values between 0.02 ppm and 1.0 ppm. Below 0.02 ppm the value measured by the sensor is not considered to be a reliable reading. For the specific case in the figure, a typical value (0.37 ppm of NH 4 -N) is shown in winter for ammonia load episodes.

48Hourly values from the last 5 years have been analyzed and a linear correlation of 0.93 has been obtained between the ammonium meter readings and the chlorine demand. Equation (12) presents the correlation line obtained with the statistical program R. With the appearance of ammonia, the controller output due to FF_NH 4 is updated by multiplying the existing ammonium value (NH 4 ) by the value slope of 7.37529. y = 7.37529 * NH 4 + 0.39694 (12) In equation (12) the value of the ordinate at origin is 0.39694 and is equivalent to the chlorine demand due to the organic and inorganic matter present. This value is already taken into account by the control system in its FF_MON term and is not added to the control variable in the finally implemented control. Table 4 shows the two rules defined for the ammonia output variable.

49For example, in the case of the control variable u in equation (11), with the appearance of 0.035 ppm of ammonia in the mixing chamber, the control system would produce an output as shown in equation (13).

V. CONTROL SIMULATION

50Simulation is an important and necessary tool to test and validate control models before they are applied to operative installations. Note that that this proposed control has been run in a real plant that supplies drinking water to more than 2 million people. No errors are permissible, so a simulator was needed to easily test the control algorithm and make sure that it could be connected to the program being run in the PLC.

51The simulator was run on the Matlab/Simulink tool using the C language to code the functions that describe the plant's behavior. The simulation code was programmed and encapsulated in an S-Function (Level 2), and the interface was adapted to contrast data from the Supervisory Control and Data Acquisition (SCADA) software output with the simulation output. The proposed simulator can be set up for any PLC and SCADA controller with an open platform communications (OPC) interface. Figure 8 shows the model run in Simulink to compare the controller described in this article (sub-block 2 inset in the same figure 8) with a conventional PI algorithm (subblock 1). Block 1 of the figure is the running of the aforesaid conventional PI whose input parameters are proportional and integral gain. Block 2 is the control model named in figure FGS&FF with which we compared the PI. This model's input parameters, in addition to the error between the setpoint and the AN2 value, are the different variables that, as shown above, enable the controller output to be computed: Flow, Temperature TPGacf and Ammonium. The outputs of both controllers go to respective blocks, Chloring System1 and Chloring System2, respectively, which model the chlorine dosage behavior, adding first order delay and response. The output from both blocks that model dosage are inputs to both plants (Tank1, Tank2) with identical parameters. Finally, on output from the plants (Tank1, Tank2) there are two blocks (Chlorine Analitzer) that model the behavior of the chlorine analyzers (AN2), also including the reading delay and first order function that are characteristic of such measurements.

52The input variables to the system that have been modified for the different defined operating points have been delimited by block 3 in figure 8. A total of 16 comparisons were made, demand in winter and summer for the four operating points (1.5 m 3 /s, 2.0 m 3 /s, 2.7 m 3 /s, 3.7 m 3 /s) with a normal F GACF flow. The controllers were also tested for scenarios where chlorine demand is low or high due to flow variations in F GACF .. Finally, the system for the different ammonium values was tested and compared, producing different steps and revealing the response in both control models. The results obtained in all these comparisons are presented in the results section.

53Finally, we note that the function of block 4 (estimateCd) in Figure 8 is to calculate the diffusion coefficient from the inlet flow and the chlorine demand depending on temperature. The output from this block is the input for the respective chlorination plant models.

VI. THE HARDWARE. REAL IMPLEMENTATION

54The existing control architecture in the DWTP is based on the ControlLogix system by Rockwell Automation [32].

55User defined type (UDT) data structures were created to logically group the variables of the FGS&FF control system. Distributed throughout the DWTP they are linked to the PLCs that control the different processes (intermediate pumping, capture, chlorination, etc.). The SCADA supervisory layer that exchanges data with the controller is based on the System Platform solution by Wonderware [36]. Finally, the existing communication between the PLC controllers and the SCADA is based on the Ethernet/IP standard, Common Industrial Protocol (CIP).

56The FGS&FF control algorithm was run on the PLC that controls all production of chlorine and chlorine dioxide from the DWTP. This controller in turn communicates with the PLC that controls the carbon filters to read the flow from the filters (F GACF ). There is also communication with the osmosis controller to read the sum of flows (F RO ) for each of the 10 frames of the RO. The control system uses the two flows to calculate the proportion (0...1) of flow F GACF (TP FGACF ) out of the total flow. Figure 9 shows a fragment of the code run in the PLC controller with an output equal to that of the example given in (14) for the first instant of time. The setpoint, for this example, is 0.5 ppm and the meter reading is 0.15 ppm of free chlorine. As shown in the figure, in the first line of code we load the input variables of the fuzzy block (GainSc_FF), namely the flow, ammonia and temperature. The percentage of water from the F GACF carbon filters is also loaded based on the division of the F GACF flow between the total flow. All of the variables are loaded into a data structure (FZ_DATA) that was created to encapsulate all control system variables and parameters.

57In line 2 of Figure 9, the fuzzy instruction with the variables assigned in the previous line of code is run in second intervals. After it is run, the instruction provides as output the four variables required to parameterize the PI algorithm for each operating point. These variables in line 3 are assigned to the parameters of the PI controller. In the case of the example, the control system would produce the outputs: K p = 0.6, K i = 0.000777, FF MON = 0.35 and FFNH 4 = 0.258 with values identical to the case presented in [14].

58In line 4 of figure 9, the PI controller is run with the parameterization obtained from the GainSc_FF function and output (FZ_DATA.Dosage) is loaded onto the control variable FZ_DATA.Out. If we apply the controller shown in (14) with the parameterization that is being programmed in this example for a setpoint of 0.5 ppm and an AN2 meter reading of 0.15 ppm of chlorine, the controller output would obtain a value of 0.8187 equivalent to the ppm of chlorine to be dosed. This value would be multiplied by the flow to be treated and by 3.6 to obtain the Kg/h to be dispensed by the chlorine cabins, 11.78 Kg/h.

59The control system was started dynamically and smoothly so as not to produce abrupt changes when switching from semi-automatic to automatic mode. The semi-automatic mode is the one in which the operator sets the amount of chlorine to be dispensed in ppm and the control system varies the Kg/h to flowpacing. In turn, when the system is in automatic mode, the output is computed solely by the FGS&FF controller.

60In the system start-up sequence, the operator sets the amount of chlorine to be dispensed (d SEMI ) based on the state of the plant and his/her experience. After a preset stabilization time called T2End, the system switches from semi-automatic to automatic mode, the control variable then being controlled by the FGS&FF system. During T2End the FGS&FF system goes into a mode called 'Software-Manual' and forces output of the PI controller to the d SEMI value. The T2End function is computed for the time when the FGS&FF system is in 'Software-Manual' mode. This is obtained from the flow rate and the distance to the measuring point (i.e. where the AN2 sensor is located). Its purpose is to show when the system can switch to 'Software-Automático' mode. Figure 10 shows part of the code that is used for T2End function calculation. For the case of the example, with a flow rate of 4.0 m 3 /s, we get a velocity of 0.139 m/s for the tank section at input. Every second the distance traveled by the sheet of water is increased and is adapted to possible variations in flow (velocity). Once the T2End time interval ends (T 2End = 0), i.e. the sheet of water has traveled the distance to the meter reading point, the FGS&FF system transfers control to the fuzzy supervisor, which goes from 'Software-Manual' mode to what is called 'Software-Automatic' mode, where the PI updates its output based on the error and the value of the K p and K i gains of the controller.

VII. RESULTS

61This section presents the results obtained both in the custombuilt simulator and in the actual DWTP based on using the FGS&FF system. Note that the graphs chosen are those that are considered most significant, bearing in mind the problems presented in the introduction section, variation in chlorine demand, flow variations and, consequently, delay times and the appearance of the ammonium disturbances, which can cause non-linear variations in demand.

A. FACTORY ACCEPT TEST. SIMULATION

62The figures presented below were obtained by comparing the FGS&FF control system with a conventional PI control in the simulator run for this purpose. The conventional PI was set to find the best response for flows between 3.7 m 3 /s and 1.5 m 3 /s and a high chlorine demand, typical of the winter season (figures 11 and 12). Figures 13 and 14 show the results of the comparison for the same IP parameterization as in the previous tests (figures 11 and 12) but this time for low chlorine demand (summertime). As shown, the computed gains for a high demand do not work properly with a low chlorine demand, producing a very significant oscillation at the PI controller output. Figure 15 shows a comparison between the two control systems with a step of 0.04 ppm ammonium. This is a highly typical situation in the winter season and in the DWTP under study in this article. Note that the time between when the FGS&FF and the conventional PI reach the set point is 100 minutes. For both systems there is a strong initial drop in the process variable (measured by the AN2 sensor) which is inevitable and is due to the distance between the generation of chlorine in the cabins and the dosage point. When ammonium is detected in the mixing chamber, the FGS&FF controller reacts by raising its output in relation to the amount of ammonium. However, the approximately 10 minutes that the chlorine takes to travel the distance to the dosage means there is an inevitable drop in chlorine at the outlet. Figure 16 shows an episode with a stepwise increase in ammonium and subsequent decrease in the same. It can be observed that the time difference in reaching the setpoint between the FGS&FF and the PI is still around 100 min. The distance between each successive step of ammonium may produce the effect that the output never reaches the desired chlorine setpoint. The opposite case is a drop in ammonium for short episodes and small intervals in the decrease that can also lead to never reaching the set point. Fortunately, this phenomenon rarely occurs and is due to a highly concentrated bag of chlorine in the mixing chamber.

B. REAL TIME SCADA TREND

63The following are graphs obtained with the Historian Client Trend tool of the SCADA in the DWTP in question. Three cases are presented that show the behavior of the FGS&FF controller in response to the problems raised in the introduction section. Table 5 shows a description and range of the variables used in the graphs. Figure 17 shows an episode of a stepwise increase in ammonium where the FGS&FF system is able to act in advance and counteract the decrease at the outlet (AN2). Figure 16 featured the same situation but simulated, and shows that for a setpoint of 0.3 ppm, the initial drop is 0.1 ppm of chlorine, similar to the drop presented for the actual behavior in Figure 17. Note that both AN2 and AN3 are always within the ±0.1 ppm interval of chlorine around the setpoint (which in this case is equal to 0.55 ppm). Figure 18 shows a typical situation of increase in flow that occurs when switching between treating water from aquifers and rivers. In a normal situation, the treated water is of fluvial origin; however, when the turbidity of the river is high due to the effect of rain, aquifer water is treated instead. When river water can be treated again, the DWTP begins to process this water. This effect can be observed in the graph that, for a short period of time, goes from treating 2 m 3 /s of aquifers to almost 5 m 3 /s of river water. The successive stepwise increase in F RO by 0.4 m 3 /s (the capacity of an RO frame) can also be observed, as can a gradual increase in water from carbon filters (F GACF ). As can be seen, throughout this flow episode, a low but sufficient ammonium level remains constant enough for the control system to take it into account (0.023 ppm of NH 4 -N). Throughout the described action, the FGS&FF controller keeps the tank output (AN3) within the range of 0.1 ppm around the setpoint.

64Meanwhile, figure 19 represents an instance of using sodium hypochlorite to clean the carbon filters. This cleaning is done periodically depending how long the filter has FIGURE 17. FGCFF controller's response to an ammonium episode from 0.03 to 0.05 ppm NH4. VOLUME 8, 2020 been washing the filter. The effect caused to the system is a decrease in chlorine demand of approximately 0.2 ppm of chlorine. Until minute 100, the system maintains the chlorine output at the 0.55 ppm setpoint. As shown, the FGS&FF system, after dosing hypochlorite and an increase in chlorine at the outlet, reacts and corrects its dosage to stabilize the chlorine as required. Throughout the episode of four continuous cleaning operations, the control system keeps the tank outlet (AN3) within the interval of ±0.1 ppm of chlorine around the setpoint (equal to 0.55 ppm).

VIII. CONCLUSIONS

65Chlorination systems in drinking water treatment plants can present different problems that make it difficult for control of chlorination in effluent to be effective. Long downtimes, variation in chlorine demand, or the occasional appearance of various nonlinear ammonia disturbances are just some of these problems that have a major effect on the design of the control system when it comes to automating the chlorination process. This process belongs to the group of distributed parameter systems where the phenomena of diffusion or convection arise and which must be taken into account both in the simulation and in the control.

66This article has presented the analysis, design and implementation of a control system based on variable gains and feed-forward that addresses these problems. For each operating point, the parameters that describe the behavior of the system had to be identified. The article has described the design of the controller, explaining the control architecture, the set of fuzzy rules used, its implementation in a real system and the simulation and experimental results obtained in a real treatment plant.

67The FGS&FF control has been compared with a conventional PI. The results show a considerable improvement to the system with respect to the use of a conventional PI. Stable output from the control system is guaranteed, within the expected margins in case of any variation in chlorine demand, flow rate or any possible disturbance such as the appearance of ammonia or cleaning with sodium hypochlorite.

참고문헌 15건

  1. Real time monitoring and control in water distribution systems for improving operational efficiency Desalination and Water Treatment · Taylor & Francis · 2015 10.1080/19443994.2015.1069224
  2. Modelling and control of potable water chlorination Water Science & Technology · Pergamon Press · 2002 10.2166/wst.2002.0216
  3. The Handbook of Chlorination and Alternative Disinfectants 1992
  4. Self-tuning PID Controller with Variable Parameters Based on Particle Swarm Optimization 2013 10.1109/isdea.2012.297
  5. Modeling Chlorine Decay in Surface Water Journal of Environmental Informatics · International Society for Environmental Information Sciences · 2003 10.3808/jei.200300003
  6. Chlorine Decay Model Calibration and Comparison: Application to a Real Water Network Procedia Engineering · Elsevier BV · 2014 10.1016/j.proeng.2014.02.135
  7. Relation of Ammonia-Nitrogen to Break-Point Chlorination American Journal of Public Health and the Nations Health · American Public Health Association · 1941 10.2105/ajph.31.8.803
  8. Microbial indicators and pathogens: Removal, relationships and predictive capabilities in water reclamation facilities Water Research · Elsevier BV · 2008 10.1016/j.watres.2008.07.037
  9. Trihalomethane levels in chlorinated Michigan drinking water Ecological Modelling · Elsevier BV · 1986 10.1016/0304-3800(86)90028-1
  10. Design of an Adaptive Self-Tuning Smith Predictor for a Time Varying Water Treatment Process IFAC Proceedings Volumes · Elsevier BV · 2009 10.3182/20090712-4-tr-2008.00143
  11. Chlorination control in a large water treatment works 1995 10.1049/ic:19950738
  12. Chlorine Demand and TTHM Formation Kinetics: A Second-Order Model Journal of Environmental Engineering · American Society of Civil Engineers · 1998 10.1061/(asce)0733-9372(1998)124:1(16)
  13. Integration of Hydraulic and Water Quality Modelling in Distribution Networks: EPANET-PMX Water Resources Management · Springer Science+Business Media · 2017 10.1007/s11269-017-1760-0
  14. On Line Control Strategies for Disinfection Systems: Success and Failure Proceedings of the Water Environment Federation · Water Environment Federation · 2006 10.2175/193864706783761716
  15. Numerical Methods for Engineers 2016