Wastewater Neutralization Control Based on Fuzzy Logic

Wastewater Neutralization Control Based on Fuzzy Logic: Experimental ... Journal of Chemical Information and Computer Sciences 2000 40 (4), 1052-1061...
0 downloads 0 Views 286KB Size
Ind. Eng. Chem. Res. 1999, 38, 2709-2719

2709

Wastewater Neutralization Control Based on Fuzzy Logic: Experimental Results Manel Adroer, Albert Alsina, Jordi Aumatell, and Manel Poch* Laboratori d‘Enginyeria Quı´mica i Ambiental, Departament d’Enginyeria Quı´mica, Agra` ria i Tecnologia Agroalimenta` ria, Universitat de Girona, Campus Montilivi, Facultat de Cie` ncies, 17071 Girona, Spain

Many industrial wastes contain acidic or alkaline materials that require neutralization of previous discharge into receiving waters or to chemical and biological treatment plants. The control of the wastewater neutralization process is subjected to several difficulties, such as the highly nonlinear titration curve (with special sensitivity around neutrality), the unknown water composition, the variable buffering capacity of the system, and the changes in input loading. To deal with these problems, this study proposes a fixed fuzzy logic controller (FLC) structure coupled with a tuning factor. The versatility and robustness of this controller has been proved when faced with solutions of variable buffering capacity, with acids that cover a wide pK range and with switches between acids throughout the course of a test. Laboratory experiments and simulation runs using the proposed controller were successful in a wide operational range. Introduction Neutralization is a common process used in chemical wastewater treatment; its control, however, is subject to many difficulties. In addition to the inherent nonlinearity of the pH vs base-acid titration curve, with particular sensitivity around neutrality, there are also difficulties associated with every specific wastewater due to the variable buffering capacity of the system, the complexity, and the nonstationary and unknown characteristics of the wastewater composition. Conventional control algorithms used in the neutralization control give inefficient performances, leading to the use of large mixers (Moore, 1978). To improve the neutralization control process, advanced controllers had been proposed. Riggs et al. (1990) combined a general control model with the identification of the titration curve being approximated based on a single hypothetical acid. Gaulian et al. (1990) developed a method to evaluate the curve off-line by interpolating the curve using a set of hypothetical acids. Using this knowledge, the gain of a feedback controller was determined. Kurtz (1985) proposed an adaptive controller that uses a reference model of the variation in the control deviation. Fuzzy logic control (FLC) is a powerful alternative to the former methods which has been applied recently to industrial processes control. This method is particularly well suited to deal with the nonlinear and uncertain behavior of the wastewater pH processes (Galluzo et al., 1991). FLC maps numeric input data into linguistic variable terms through predefined membership functions. Fuzzy inference is achieved by producing a conclusion by referring the input data to a set of “ifthen” rules which are based on expert knowledge. Finally, a numeric output is obtained (Kosko, 1992; Cox, 1994). Garrido et al. (1997) compared the application of a fuzzy controller with the advanced controllers proposed * To whom correspondence should be addressed. E-mail: [email protected]. Telephone: 34.972.418438. Fax: 34.972. 418150.

by Riggs et al. (1990), Gaulian et al. (1990), and Kurtz (1985). Results obtained showed that FLC could be considered a valuable tool in the wastewater neutralization processes testing them in computer simulations. Much of the recent research in the field of pH control has been conducted using fuzzy logic. Parekh et al. (1994) proposed an in-line control based on fuzzy logic. Other authors constructed fuzzy-model-based controllers. For instance, Kelkar and Postlethwaite (1994) and Sing and Postlethwaite (1997) proposed a fuzzy relational model of the process embedded into a predictive control structure; Kavsek-Biasizzo et al. (1997) proposed a predictive controller that combined a Takagi-Sugeno fuzzy model and a dynamic matrix control (DMC) strategy. Yle´n and Jutila (1997) developed a modified self-organizing fuzzy controller (SOC) that combined both the nonlinear input-output mapping and the learning capability. Menzl et al. (1996) proposed a selfadaptive fuzzy control system. Aoyama et al. (1995) proposed an internal model control (IMC) scheme using a fuzzy neural network for the process model. Chen and Chang (1996) used bounded neural networks or bounded fuzzy logic systems for constructing the nonlinear relationship between PID controller parameters and the local operation control conditions. Karr and Gentry (1993) developed a technique for producing adaptive FLC’s using genetic algorithms (GA). Few studies, however, have been devoted to the experimental implementation of the pH-control algorithms, even though it is an unavoidable stage in appraising applicability to real industrial processes. The objective of this paper was to test a controller based on fuzzy logic to a wastewater neutralization process. To achieve the objective, a controller based on the algorithm proposed by Garrido et al. (1997) with an adaptive factor to tune fuzzy response and to improve robustness under variable buffering capacity conditions was developed. The proposed controller was tested experimentally in a treatment plant and with simulations under different conditions: variable buffering capacities of the wastewater, changes in the acid concentration of the wastewater, and switches between acids.

10.1021/ie980268n CCC: $18.00 © 1999 American Chemical Society Published on Web 05/25/1999

2710 Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999

Figure 1. Flow diagram of the proposed controller.

Description of the Proposed Neutralization Process In this study the neutralization process was developed for treating large volumes of wastewater in small reactors. To achieve this objective, a particularly fast and flexible control is needed. The system is expected to adjust itself around the set point, fixed at pH ) 7, after a disturbance. The proposed system consists of a stirred reactor through which a continuous flow of acid solution to be neutralized is passed and where the alkaline reagent flow is added. The amount of alkali required to neutralize the acid solution is defined as the ratio between the flow of added base and the inflow of acidified water. Thus, the system tolerates possible variation in the incoming flow. The flow emerging from the neutralization reactor is collected in a tank where the water is allowed to homogenize with no additional control. In this study, the control algorithm used to determine the alkaline dosage does not require the knowledge of the value of the alkali solution concentration. The measurements required are the pH in the neutralization reactor and the flow of acidified water. The control cycles are distributed regularly during the process at a constant interval of relative time T (∆T ) 0.04). T is a dimensionless parameter which is a function of the flows, real time, and reactor volume and is calculated using the following equations:

T ) tQ/V ) t/θ

(1)

θ ) V/Q

(2)

where Q is the total flow running through the reactor, V is the reactor volume, θ is the water residence time in the reactor, and t is the real time. In this study, the residence time of the reactor was approximately 60 s. Description of the Controller The development of a FLC involves appropriate definitions of the input and output variables, a number of linguistic terms and their membership functions, the

rule base, the inference mechanism, and a defuzzification method. The FLC output needs to be tuned to achieve a successful performance because the dynamics of the process can change with time, and the fuzzy logic controller itself could not be robust enough to deal with this temporal variation. Therefore, a tuning factor (F) was included in the proposed controller to make it possible to use the same fuzzy sets, the rule table, and the membership functions under widely different conditions of buffering capacity. The proposed controller, as shown in Figure 1, has two inputs: the error (ek) and change of error (∆ek), which are calculated using the following equations:

ek ) pHsp - pHk

(3)

∆ek ) ek - ek-1

(4)

where ek is the difference between the pH set point and the actual pH at step k and ∆ek is the difference between the error at step k and the error at step k-1. The former parameter can be considered as a measure of the velocity of change of the error, given the fact that the error measurements are done at fixed constant intervals. Positive values of ek indicate that the solution is acidic. A positive value of ∆ek indicates that the solution is evolving toward lower pH values (becoming more acidic). The two inputs (ek and ∆ek) are used in the FLC to obtain a value of the FLC output (Respk), whereas only ek is used to calculate the tuning factor (Fk). The flow ratio (ratk) between the flow of added base (Q(k)Alk) and the inflow of acidified water (Q(k)acid wat) is related to Respk, Fk, and the flow ratio calculated at step k - 1 as shown by the following equation:

Qk(Alk) Qk(acid wat)

) ratk ) ratk-1eRespkFk

(5)

This equation estimates the final action of the controller. Once ratk has been obtained, the flow of alkaline solution needed to neutralize the inflow solution at step

Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999 2711

Figure 2. Membership functions for FLC input variables (error (a, top) and change of error (b, middle)) and the FLC output variable (resp (c, bottom)).

k is calculated by multiplying ratk by the total acidified water flow (eq 5). Description of the FLC The three main steps of the decision-making process of the FLC are fuzzyfication, inference, and defuzzification (Figure 1). All of these steps are strongly related to the incorporated human knowledge and experience contained in the fuzzy rule base. The universe of discourse of the FLC input (e and ∆e) and output (resp) variables are covered by fuzzy sets which are characterized by membership functions (µ). Figure 2 shows the membership functions, which are assumed to be triangular and trapezoidal at the extremes. These shapes have been adopted because they can be manipulated efficiently, in terms of real-time requirements, by the inference engine. The membership functions are distributed at regular intervals. In Figure 2, e has been divided into nine fuzzy sets: NG is negative great, NM is negative medium, NL is negative low, NS is negative small, ZE is zero, PS is

positive small, PL is positive low, PM is positive medium, and PG is positive great. resp has also been divided into nine fuzzy sets with the same linguistic labels. The universe of discourse of ∆e requires less fuzzy sets to obtain acceptable control. In this case the linguistic labels NS and PS were not considered. Therefore, the number of fuzzy sets for ∆e was seven. The membership functions are distributed in such a way that overlapping between neighbor membership functions is 50%. That is, the sides of the triangles cross each other at a truth value ordinate of 0.5. This degree of overlapping provides fine tuning and ensures a response with no abrupt changes. Fuzzy Rule Base. The control strategy of the fuzzy controller is formulated using a set of statements. The expert knowledge is expressed by if-then rules. In this study, these rules were as follows: if the error is NG and the change of error is NG, then the resp is NG. The rule base (decision matrix) implemented is shown in Table 1. The number of rules that contain this decision matrix is 63. A gradual variation between consecutive

2712 Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999 Table 1. Decision Matrix change of error error

NG

NM

NL

ZE

PL

PM

PG

NG NM NL NS ZE PS PL PM PG

NG NG NM NM NL NS NS ZE PS

NM NM NL NL NS NS ZE PS PS

NM NM NL NS NS ZE PS PL PL

NL NL NS NS ZE PS PS PL PL

NL NL NS ZE PS PS PL PM PM

NS NS ZE PS PS PL PL PM PM

NS ZE PS PS PL PM PM PG PG

if-then rules was imposed in the rule generation to obtain a continuous and smooth control surface. To create the decision matrix, the authors have assumed the following simple and logical rules: (1) When e ) ZE and ∆e ) ZE, the only logical response is resp ) ZE. (2) If error has a maximum negative value (e ) NG) and is becoming more negative at the maximum velocity (∆e ) NG), it is obvious that the alkali dosing ratio must be drastically decreased and then the response should be resp ) NG. If the situation is the opposite (e ) PG and ∆e ) PG), then the response should be PG. (3) There must be no jump in the decision matrix. That is, two contiguous elements located in a row, in a column, or in a diagonal decision matrix line must have either the same output fuzzy set (resp) or a contiguous one. For instance, if the output fuzzy set corresponding to the coordinates e ) NS and ∆e ) PL is ZE, then the eight output fuzzy sets next to it must be either ZE, NS, or PS. (4) There cannot be more than one output fuzzy set ZE in any row or column of the decision matrix. Simulations using different matrices have shown that more than one ZE per row or column results in instabilities. Even with these limitations, there are many design possibilities for a decision matrix, especially for the elements located at the outer part of the matrix. These elements control the speed of recovery when confronted with large changes in the operating conditions and also determine the oscillatory tendency of the system. However, for the elements located at the matrix core, the choices are more limited. For instance, the optimal output fuzzy set for the element with coordinates e ) NS and ∆e ) PL would probably be ZE. In this case, the pH is slightly higher than desired but evolves slowly toward a decreasing error. Therefore, the best action should be to maintain a constant dosing ratio without any change. Fuzzy Inference. The fuzzy inference generates consequent linguistic variables from the activated input fuzzy sets based on the implications contained in the fuzzy rule base. For each possible pair of antecedent elements from the input fuzzy sets (error and change of error), there is a corresponding output fuzzy set. In this study, the membership degree of any output fuzzy set is obtained from the minimum of the two truth values of the rule premise. The combination of these values is done using the membership functions in a fuzzy intersection operation (eq 6).

µ(respk) ) min(µ(ek),µ(∆ek))

(6)

This operation was repeated at every cycle step (k), for all possible input fuzzy set combinations. In most

Figure 3. Mapping surface of the output (Resp) of FLC as a function of the two inputs (e and ∆e).

instances there were four µ(respk) greater than zero, corresponding to two µ(ek) and two µ(ek) with nonzero values. If any output fuzzy set was activated more than once, its final µ(respk) function was the sum of all of the membership functions of this element (eq 7).

µ(respk(i)) ) µ′(respk(i)) + µ′′(respk(i))

(7)

Defuzzification. The FLC output must be a deterministic value. The defuzzification stage converts the fuzzy conclusion into a numeric output. The final output is the result of combining the individual inferences. In this study, the centroid method of defuzzification was implemented (Kosko, 1992). Using this method, the output value is computed as follows:

Respk ) i)n

(µ(respk(i))∫resp)Min ∑ i)1

resp)Maxi i

i)n

resp × µ(resp) d(resp)) (8)

(µ(respk(i))∫resp)Min ∑ i)1

resp)Maxi i

µ(resp) d(resp))

where n is the number of activated output fuzzy sets (maximum four); µ(respk(i)) is the truth membership value of each output fuzzy set at step k having a µ greater than zero, and Mini and Maxi are the minimum and maximum resp values, respectively, for which the µ function of the i output fuzzy set has nonzero Values. Respk is the final FLC output value for step k. The integrated values corresponding to each output fuzzy set are calculated at the start of the process and do not need to be repeated at the beginning of each control step. Figure 3 shows the mapping surface between the inputs and the output. Description of the Tuning Factor Module The present study introduces a tuning factor (F) to the FLC. This factor is a scaling parameter that adjusts the output of the fuzzy controller throughout the process. Therefore, the FLC parameters (fuzzy rule base

Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999 2713

and input and output membership functions) can remain unchanged for any type of acid considered in the neutralization process. This factor is self-adaptive and effective under a residence time of the reactor of ca. 1 min. The proposed tuning factor was calculated based on the value of this factor assigned to the previous control cycle (Fk-1) and on the situation at which the system was during the actual cycle (aux) as shown by the following algorithm:

Fk ) Fk-1(1 + aux)

(9)

The values of the tuning factor (Fk) range between 0.015 and 0.25. The maximum value corresponds to the neutralization process of a HC1 solution, which has a minimal buffer capacity (pK too low to be measured), and the maximum value corresponds to the neutralization of a H3PO4 solution, which has a maximal buffer capacity (pK ) 7.21 for the second proton). When the system is close to the set point and is relatively stable (i.e., abs(ek) < 0.2 and abs(∆ek) < 0.2), the controller is kept out of action. This situation is considered as a dead zone for the control, and the alkaline dosing flow as well as the tuning factor is kept constant. In those cases when the system is out of the control dead zone, the error values of an immediately anterior, short time interval were studied and two possible scenarios were considered to calculate aux. To decide in which scenario the system is at, it is necessary to study the evolution of the error within the time interval. To do so, in this study, the time interval considered was approximately the last 30 s of the process, which represents the last 15 error measurements (n ) 15). On the basis of these measurements, the variable Dif, which allows the decision of the scenarios, was defined as shown in eq 10. i)n

Difk )

∑ i)1

i)n

|ei| - |

ei| ∑ i)1

n

(10)

Once Dif was estimated, the scenario and the value of aux was designated using the following reasoning: (1) If all of the error values for the time interval do not have the same sign (i.e., the pH oscillates), then Dif > 0. This situation indicates that the system is probably oscillating around the set point. To dampen the oscillations, the system gain of the system needs to be diminished (i.e., the value of the tuning factor should be decreased). The magnitude of the decrease of the tuning factor should be proportional to the Dif value. In other words, the broader the oscillation is, the greater the decrease of the tuning factor value should be. In fact, the limit for the controller to take action against oscillation was set at Dif > 0.2, instead of Dif > 0. Thus, small oscillations around the set point do not have any influence. Under this scenario, the value of aux is calculated using the following equation, where b ) 10:

auxk ) -Dif/b

if Dif g 0.2

(11)

(2) If the error values for the time interval have the same sign, then Dif ) 0. This indicates that the system has an excess or a deficiency of alkaline dosage. Therefore, the gain needs to be increased (i.e., the value of the tuning factor should be increased) to cause a rapid

increase or decrease of the alkaline dosage flow. The magnitude of the increase of the tuning factor should be proportional to the average of the absolute error over the studied period. In this case, aux is calculated using the following equation, where a ) 200: i)k

| auxk )

∑ ei| i)k)n an

if Dif < 0.2

(12)

The key factor for the success of the control system was that the mixing efficiency of the reactor be as close to ideality as possible, whereas the values of n, a, and b considered in eqs 10-12 were not so critical. In this study, the relative time (T) was used to conduct simulation runs. In most of the trials ∆T ) 0.04. This value was chosen to achieve a regular distribution of the control cycles throughout the process. At any given situation, the value of ∆T was selected to ensure the success of the neutralization process. Results from tests indicated that the larger θ was, the smaller ∆T had to be. Experimental Setup The scheme of the experimental plant designed to directly test the proposed controller is shown in Figure 4. Tap water was mixed in vessel R1 (200 mL) with the acid solution to achieve a defined acid concentration to be neutralized. A peristaltic pump (P1) of manual adjustable speed was used to circulate tap water at a constant flow rate of 2.8 L/min. The dosing pump (P2), with adjustable speed, fed the acid solution. Neither the peristaltic pump P1 nor the pulse pump P2 was perfectly even. The vessel R1 also served to improve the regularity of the flow measurements. The pH and the flow rate of the outgoing acidified water from vessel R1 were continuously recorded. In this study a small neutralization CSTR (reactor R3; 3 L) was the only reactor used for pH control. The pH probe was placed at the reactor outlet. The pH values recorded at this point provided process information to calculate ek and ∆ek values. In the neutralization process the acid-base reaction can be considered instantaneous, but in small reactors, such as R3, the added reagents can leave the reactor without being completely and homogeneously mixed with the acidified water flow. To overcome this problem, a stirred vessel (R2; 400 mL) was placed before reactor R3. The dosing pump (P3), with adjustable speed, fed a NaOH solution into the R2 vessel. This vessel was used to smooth the base pulses of the dosing pump P3 and to ensure a homogeneous distribution of the alkalinity in the acidified water. The introduction of vessel R2 increased the plug-flow effect, which was not desirable from the control point of view as dead time increases. However, this was the only solution to greatly smooth the variations in pH measurements in reactor R3 because of a lack of mixing. Nevertheless, the plug-flow effect on the oscillation trend of the system was negligible. The homogenization stirred vessel R4, with a volume of approximately 1.5 L, was installed to filter and smooth the oscillations of the pH at the outflow. A third pH probe was placed at the vessel R4 outlet, but the controller had no action on this reactor. The homogenization vessel was designed to simply filter the oscillatory

2714 Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999

Figure 4. Experimental plant design.

behavior around the set point and did not have much effect on the large deviations generated when an abrupt change in acid concentration was implemented during a gradual change in acid concentration and also in periods with constant acid concentration. These are the most usual conditions found in industrial effluents due to the presence of equalizers where the different wastewater streams are collected before the neutralization treatment. Results After a disturbance, the neutralization reactor pH was expected to rapidly adjust around the set point, which was fixed at pHsp ) 7. To test the effectiveness of the proposed controller through the pH evolution, the following tests were conducted: (1) examine the effect of changes in the wastewater buffering capacity on the process controller behavior; (2) evaluate the effect of changes in the acid concentration of the wastewater on the process controller behavior; (3) examine the effect of a switch between acid types on the process controller behavior. Test 1: Effect of Changes in the Wastewater Buffering Capacity on the Process Controller Behavior. The effect caused by the presence of acids differing in buffering strength on the process control behavior was tested by conducting runs in the experimental plant. This test evaluates the versatility of the controller. For this reason, the acids used were phosphoric, acetic, sulfuric, and hydrochloric, which cover the full range of pK values. Figure 5 shows the titration curves of phosphoric, acetic, and hydrochloric acids. For this test the experiments were conducted using only one acid type at a time. There is no point in using a mixture of acids because the control is always easier to implement if there is a buffering acid in the solution to be neutralized. The presence of a strong acid is not

Figure 5. Titration curves of phosphoric, acetic, and hydrochloric acids.

important except when the weak acid concentration is very low compared with that of the strong one. In this study, the small alkalinity of the tap water (alkalinity M ) 3.5 mequiv/L) because of the presence of carbonic species (as happens in practically all of the natural waters) adds an additional buffer capacity to the solution and facilitates the control process. This fact is more pronounced if the concentration of the strong acid is low compared to the alkalinity of tap water. On every experimental run two types of changes in acid concentration were introduced during the process: abrupt (step type) and gradual (ramp type). The ramp type consisted of a gradual change in the acid concentration following a linear process. On each experiment the following sequence of changes in acid concentration were defined: a step increment at minute 15, a descending ramp between 30 and 45 min, an ascending

Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999 2715

Figure 6. Evolution of the tuning factor and pH in reactors R3 and R4 vs time. Changes in phosphoric (a, top), acetic (b, middle), and sulfuric (c, bottom) acid concentrations are implemented. All of the graphs begin at minute 13, when the system is stable around neutrality.

ramp from 45 to 60 min, and a final step decrement at 60 min. During each experiment the acid concentration ranged from 80 to 110 mequiv/L. Results from these experiments (Figure 6 and Figure 8b) show that the pK of the acid to be neutralized clearly influences the system. The same step change causes a greater pH deviation from the set point in the neutralization reactor as the pK of the acid decreases. This effect can be seen especially when step change in the acid concentration was introduced. Consequently, during these periods, the tuning factor increases according to the magnitude of the separation from the set point. A sequence of corrections is repeated until the oscillations are damped. Once the pH reaches neutrality, the oscillatory behavior is reduced because of the decrease of the tuning factor. The results also show that as the acid strength increases, the oscillatory behavior around pH ) 7 in the neutralization reactor enlarges. This is a consequence of the process gain increment at neutrality. This is the reason why the tuning factor acquired low values in the sulfuric and hydrochloric experimental runs, while it

remained at a maximum value when the inflow stream contained phosphoric acid. The process gain depends on the solution composition. Therefore, during the process control it is important to account for the value of dpH/dCb vs pH (Cb is the concentration of base added) around the set point. The greater the gain is, the larger the oscillatory tendency of the system is. In this respect, the alkalinity of the tap water improved the control. For instance, the process gain around neutrality for the sulfuric acid acquires low values with the presence of 3.5 of alkalinity M compared to the process gain in the absence of alkalinity M, as shown by results from Figure 7. Test 2: Effect of Changes in the Acid Concentration of the Wastewater on the Process Controller Behavior. This test evaluated the robustness of the controller to be appraised by changing the concentration of the same acid. The test was conducted by means of three experimental runs conducted in the plant with hydrochloric acid. The changes in acid concentration for the three experiments ranged from 150 to 200, 80 to 110, and 30 to 50 mequiv/L. On each run the changes

2716 Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999

Figure 7. dpH/dCb vs pH for sulfuric and acetic acids (110 mequiv/L) in the presence of 3.5 mequiv/L of alkalinity M (a, top) and 0 mequiv/L of alkalinity M (b, bottom).

in acid concentration followed the sequence described in test 1. Comparison of these results in the neutralization reactor from the three runs (Figure 8) shows that water neutralization becomes more difficult as the ratio between the acid concentration and the concentration of carbonic species in the tap water increases. This is supported by results from the run conducted using the highest acid concentration range (Figure 8a), where the oscillatory behavior around neutrality is clearly larger, especially in the descending ramps. The error (ek) during the descending ramp had negative values, whereas during the ascending ramp remained positive. In both cases, the tuning factor increased until the control was great enough to allow the

pH to reach the set point. The oscillatory behavior was not reduced until the pH crossed the set point. During a gradual change in the acid concentration, the measured pH cannot be far away from the set point, but there will always exist a nonzero error value, needed to create a dosage correction action to compensate for the gradual change in the acid solution. The pH in the homogenization vessel was far from the set point after a step change in the acid concentration (especially when using a strong acid) and after some instability that occurred during the ramps (Figure 8). The results show that the deviation of pH in the homogenization vessel intensified as the acid concentration and the ramp slope increased. This after-treatment filtration was achieved with a very small vessel (i.e.,

Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999 2717

Figure 8. Evolution of the tuning factor and pH in treactors R3 and R4 vs time. Changes in the hydrochloric acid concentration are implemented; from 150 to 200 mequiv/L (a, top), from 110 to 80 mequiv/L (b, middle), and from 50 to 30 mequiv/L (c, bottom). All of the graphs begin at minute 13, when the system is stable around neutrality.

2718 Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999

Figure 9. Evolution of the tuning factor and pH in reactors R3 and R4 vs time. Switch between acids with a concentration of 150 mequiv/L; the sequence of the switches of the acids is from acetic to sulfuric to phosphoric. The figure begins at minute 13, when the system is stable around neutrality.

half the neutralization reactor volume). To obtain a constant neutralized output when these deviations occur, a secondary neutralization treatment, with acid and base dosing capacity, or a punctual recycling to the top of the plant should be included. Test 3: Effect of the Switch between Acids on the Process Controller Behavior. In this test the controller was evaluated using a simulation run where the process gain changed throughout the course of the simulation. To simulate the behavior of the pH evolution throughout the experimental runs, a mathematical model was developed based on that proposed by Garrido et al. (1997). This model was refined in order to have the possibility of reproducing the experimental conditions of dead times and specific water compositions. For the two previous tests the experiments were conducted using a fixed type of acid in each run. For this test, an abrupt change between acids was applied at minutes 30 and 45. The concentration of each acid was set at 150 mequiv/L. During the first 30 min, the influent in the simulation run contained acetic acid, which is characterized by a moderate gain at neutrality. At minute 30, the inlet was switched to sulfuric acid, which is characterized by a high gain at neutrality. At minute 45 the inlet was again switched to phosphoric acid, which is characterized by a low gain at neutrality. Figure 9 shows the results of the evolution of the system throughout the simulation run. Results show that the switch between acetic acid and sulfuric acid causes an increase of the oscillatory behavior of the pH in the neutralization reactor around pH ) 7 (Figure 9). This is a consequence of an increment of the process gain at neutrality. To diminish the oscillation when the influent is sulfuric acid, the tuning factor acquired low values. The pH value increased

when the inlet switched from sulfuric acid to phosphoric acid. This is due to the change in the shape of the titration curve at neutrality. In this case, the tuning factor increased until the controller action allowed the system to reach the set point. Conclusions This study revealed that the control of the wastewater neutralization process is effectively performed using a fuzzy logic controller of fixed structure coupled with a tuning factor. Thus, for the determination of the control action, it is not necessary to use a mathematical model to calculate the ionic equilibrium of the solution and the expected process gain in the reactor which has an unknown and nonstationary composition. Moreover, the proposed controller could be applied successfully to a neutralization reactor with a low hydraulic residence time. On the basis of the results from the tests, the proposed control system appears to be a powerful alternative for a treatment of acidic wastewater because of its robustness when dealing with acids of variable buffering capacities and its versatility when dealing with a wide pK range of acids. The controller is also effective in situations where there is a switch between different acids, which produces changes in the process gain at neutrality. Results from this study also indicate that the controller is effective in neutralizing practically nonbuffered water containing strong acids, which are considered to be the most difficult conditions to control, because of the great system gain at neutrality. The only buffering product existing in those cases was the natural alkalinity of the tap water used to produce the acid solution. Nevertheless, the pH deviations and instabili-

Ind. Eng. Chem. Res., Vol. 38, No. 7, 1999 2719

ties increase as the strength of the acid and its concentration increase. Results also show that the system presents a good tolerance to nonstationary process characteristics, step, and ramp upsets. Under the studied conditions the output pH can be maintained around neutrality by means of a small homogenization reactor (with no control), where the instabilities and the oscillatory behavior of the pH in the neutralization reactor are filtered. Nomenclature a ) aux adjustment parameter aux ) tuning factor adjustment variable b ) aux adjustment parameter Cb ) added base concentration Dif ) variable used to calculate aux e ) pH error, FLC input F ) tuning factor n ) number of the last pH errors taken into account pHsp ) set point pH Q ) output total flow from CSTR QAlk ) flow of alkali solution Qacid wat ) total raw water input flow rat ) flow ratio, base flow/total raw water input flow resp ) result of a fuzzy rule applied Resp ) FLC output t ) real time T ) relative time V ) reactor volume ∆e ) change of pH error, FLC input ∆T ) relative time interval between control cycles µ ) membership function value θ ) residence time of the reactor

Acknowledgment This research was supported by CICYT from Spain (Bio96/1229 and Amb97/889) and CIRIT (Grups de recerca consolidats (GASA)). J.A. acknowledges a predoctoral FPI grant. Literature Cited Aoyama, A.; Doyle, F. J., III; Venkatasubramanian, V. A fuzzy neural-network approach for nonlinear process control. Eng. Appl. Artif. Intell. 1995, 8 (5), 483-498.

Chen, C.-L.; Chang, F.-Y. Design and Analysis of Neural/Fuzzy Variable Structural PID Control. Systems. IEE Proc.sControl Theory Appl. 1996, 143 (2), 200-208. Cox, E. The Fuzzy Systems Handbook. A practitioner’s guide to building, using, and maintaining fuzzy systems; AP Professional: London, 1994. Galluzzo, M.; Cappellani, V.; Garofalo, U. Fuzzy Control of pH using NAL. Int. J. Approx. Reasoning 1991, 5, 505-519. Garrido, R.; Adroer, M.; Poch, M. Wastewater neutralization control based in fuzzy logic: simulation results. Ind. Eng. Chem. Res. 1997, 36, 1665-1674. Gaulian, M.; Lane, J. D.; Loparo, K.; Scheid, T. J. Titration-curve estimation for adaptive pH-control. EP Patent 457989, Nov 27, 1991, before U.S. Patent 526416, May 21, 1990. Karr, C. L.; Gentry, E. J. Fuzzy Control of pH Using Genetic Algorithms. IEEE Trans. Fuzzy Syst. 1993, 1 (1), 46-53. Kavsek-Biasizzo, K.; Skrjanc, I.; Matko, D. Fuzzy predictive control of highly nonlinear pH process. Comput. Chem. Eng. 1997, 21, S613-S618. Kelkar, P.; Postlethwaite, B. Fuzzy-model based pH control. Inst. Chem. Eng. Symp. Ser. 1994, 29-31. Kosko, B. Neural networks and fuzzy systems. A dynamical systems approach to machine intelligence; Prentice Hall International Editions: London, 1992. Kurtz, H. Adaptive control of a wastewater neutralization process. IFAC Proc. Serv. 1985, 3257-3261. Menzl, S.; Stu¨hler, M.; Benz, R. A Self Adaptive Computer-Based pH Measurement and Fuzzy-Control System. Water Res. 1996, 30 (4), 981-991. Moore, R. L. Neutralization of wastewater by pH control; Instrument Society of America: Pittsburgh, 1978; pp 10-17, 37-38. Parekh, M.; Desai, M.; Hua, L.; Rhinehart, R. R. In-line control of nonlinear pH neutralization on fuzzy logic. IEEE Trans. Compon., Packag., Manuf Technol. 1994, 17 (2) 192-201. Riggs, J. B.; Rhinehart, R. R. Method for pH-control in wastewater treatment. U.S. Patent 4940551, July 10, 1990. Sing, C. H.; Postlethwaite, B. pH control: handling nonlinearity and deadtime with fuzzy relational model-based control. IEE Proc.sControl Theory Appl. 1997, 144 (3), 263-268. Yle´n, J. P.; Jutila, P. Fuzzy self-organising pH control of an ammonia scrubber. Control Eng. Pract. 1997, 5 (9), 1233-1242.

Received for review April 27, 1998 Revised manuscript received April 9, 1999 Accepted April 12, 1999 IE980268N