Use of Hybrid Models in Wastewater Systems - Industrial

Hybrid models build inasmuch prior knowledge as available and then use ... Neural and Neural Gray-Box Modeling for Entry Temperature Prediction in a H...
0 downloads 0 Views 194KB Size
1694

Ind. Eng. Chem. Res. 2000, 39, 1694-1704

Use of Hybrid Models in Wastewater Systems J. S. Anderson,† T. J. McAvoy,*,† and O. J. Hao‡ Institute for Systems Research, Department of Chemical Engineering, and Department of Civil Engineering, University of Maryland, College Park, Maryland 20742

Incomplete first-principles knowledge of a system can obstruct the development of models for investigating the system’s dynamic behavior. One approach proposed to overcome this problem involves using hybrid models. Hybrid models build inasmuch prior knowledge as available and then use empirical components, such as neural networks, to complete the description. In this paper hybrid modeling techniques are applied to two wastewater systems. The first system involves data from a Danish wastewater plant, and the second involves using a hybrid model for control. Potential problems involving the use of hybrid models are discussed. Introduction Artificial neural networks (ANNs) have in recent years gained widespread acceptance as dynamic modeling tools in both discrete-time and continuous-time applications. The current popularity of these structures may be partially ascribed to theoretical work proving their capability as “universal function approximators”.3,8 Yet, it is usually the case that a model based on first principles is preferred over an empirical model (e.g., ref 12), and it is therefore often desirable to incorporate as much knowledge of the process fundamentals as possible into a system’s mathematical description. Several approaches have been taken in the past for the incorporation of prior knowledge, and a fairly comprehensive overview of these “hybrid modeling” techniques has been provided by Thompson and Kramer.17 In prior work, neural network components have been used to represent head/flow relationships,21 predict diffusion characteristics,11 and adjust parameters in metallurgical and flotation rate expressions,15 all within the context of larger frameworks based on first principles, resulting in hybrid overall model structures. With regard to wastewater treatment and microbial growth systems in particular, neural network-based hybrid modeling approaches have also proven advantageous.1,4,13,22 In this paper we restrict our attention to the methods categorized by Thompson and Kramer as semiparametric design approaches, which are generally divisible into serial and parallel subclassifications. In the first case study, we use a serial semiparametric model configuration to identify rate terms in a macroscopic model of experimentally obtained time series data from a Danish wastewater treatment pilot plant. Macroscopic balances over each of the process units provide a mathematical framework for construction of a basic dynamic model; neural networks trained using experimental data are then inserted in place of unknown rate expressions. Time series predictions obtained from the final model, composed of both first principles and empirical compo* To whom correspondence should be addressed. Phone: (301) 405-1939. Fax: (301) 314-9920. E-mail: mcavoy@ eng.umd.edu. † Institute for Systems Research, Department of Chemical Engineering. ‡ Department of Civil Engineering.

nents, compare favorably to experimental observations. However, when we tried the same methodology on a more complex wastewater system, it failed. This negative result is briefly discussed in the paper. In the second example, we use a parallel semiparametric configuration to model an alternating aerobicanoxic (AAA) wastewater treatment plant for purposes of optimization-based control. In this example a linearized first-principle model is used because the underlying plant model is stiff. A neural network corrector is employed in conjunction with the linearized model. The resulting hybrid model is used to minimize operating costs while maintaining the plant effluent permit constraints. This example is interesting because the hybrid model is more accurate than the linear model, but the hybrid model control results are inferior to those obtained using only the linear model. Why this result occurs is discussed. 1. Hybrid Modeling The specification of dynamic models is an important element in the optimization and control of chemical processes; these models enable us to predict system responses under a variety of test conditions so that informed choices may be made regarding process operation and regulation. However, in every case we do not have sufficient understanding of a given system to synthesize an accurate first-principle model. Another possibility is that a complete model does exist, but its mathematical complexity makes it impractical or inconvenient to use. Therefore, it often becomes necessary to implement some form of empirical or semiempirical modeling to develop a system representation suitable for further analyses. The potential advantages of hybrid modeling approaches relative to a fully empirical approach include a reduced demand on experimental data and more reliable extrapolation; furthermore, a typical hybrid approach avoids the lengthy and expensive research initiative necessary to substantiate a firstprinciple model.18,19 Thompson and Kramer’s taxonomy17 of neural network hybrid modeling techniques contains two main branches: training approaches and design approaches. In the training approaches, the first-principles knowledge enters the modeling problem by tempering the parameter estimation scheme (e.g., by motivating a

10.1021/ie990557r CCC: $19.00 © 2000 American Chemical Society Published on Web 04/27/2000

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000 1695

Figure 1. Serial (a) and parallel (b) hybrid model configurations for incorporating prior knowledge into a data-based model.

particular optimization algorithm or through specification of constraints to be satisfied during training). Design approaches use first-principles knowledge to directly establish elements of the model’s mathematical structure. The design approaches are further divided into modular and semiparametric categories. A modular design approach recognizes a process as the interaction of a number of distinguishable units and each of these units is modeled individually, instead of trying to determine a more complex input/output relationship at a higher level. On the other hand, semiparametric design models typically involve a mathematical superstructure motivated by first principles, which is used in conjunction with one or more neural networks attached in series or parallel. The serial configurations use neural networks to represent poorly defined terms in the first-principle model. For example, material balances on a chemical reactor might yield a set of ordinary differential equations (ODEs) including a number of poorly defined kinetic terms (such as reaction or diffusion rates); in a serial configuration, one or more black boxes would replace these “unknown” expressions. Thus, the neural networks provide intermediate values necessary for time series prediction with the models, depicted schematically in Figure 1a. In parallel arrangements, a dynamic model of the system exists, and the effort is to construct an empirical error model compensating for its fallacies. For prediction of the dynamic behavior, the outputs of the simple dynamic model are biased by the outputs of the error model, as shown in Figure 1b. These semiparametric approaches have applications in modeling and control of wastewater treatment operations and are the central topic of this paper. One of the difficulties in applying a serial approach concerns the training of the networks. To apply the traditional back-propagation procedure (e.g., ref 20), it is necessary to provide training examples coupling desired outputs with network inputs; however, the target outputs may not be directly (or conveniently) measurable, and these must often be estimated from the available time series data. For example, in the neural network modeling of reaction rates in a continuously stirred tank reactor (CSTR), one is more likely to be provided with time series of reactor influent and effluent

Figure 2. Danish wastewater plant flow and aeration schedule. The arrows represent flow between the anaerobic column (AN), and the aeration tanks (T1 and T2) and the settler (SED). Tanks, which are aerated during an operating phase, are shown in black, and those which are not aerated are shown in gray.

concentrations and temperature instead of the actual reaction rates that the network will be used to approximate. One way around this problem is to use the available measurement data to estimate numerically the correct rates (outputs) for each set of inputs to be presented during training, thus permitting the network training to be conducted by the traditional means of back-propagation. Sometimes numerical difficulties prevent such estimations, in which case an alternative solution is to incorporate numerical integration of the serial model directly into the training algorithm and compare the measured outputs of the system (e.g., effluent composition) with the outputs predicted by integrating the model. This second method is slightly more complex than the first, but has been successfully applied in the past (e.g., refs 13 and 16) and may be better suited for training networks used in ODE models of continuous-time systems. The same difficulties described for serial hybrid models also apply to parallel hybrid models in which the neural network provides offset to the right-hand sides of a set of differential equations. 2. Case Studies Case 1: Danish Wastewater Plant. In this section we describe a serial semiparametric modeling approach applied to an activated sludge wastewater treatment process.22 The process consists of four unit operations: an anaerobic column, two aeration tanks, and a settler. The system is operated using two aeration phases to promote different reaction processes: an “air on” phase promotes bacterial nitrification of ammonia and an “air

1696

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000

off” phase allows the bacteria to convert nitrate into gaseous nitrogen. The wastewater treatment process also cycles through different flow configurations, as shown in Figure 2. The plant is operated by continuously and sequentially cycling through phases 1-6. Zhao et al.22 provide a basic model of the aeration tanks using component balances on ammonia and nitrate; because of the different flow patterns, each phase is represented by a separate set of ODEs:

Tank 1, Phase 1, Air On: dCa1 ) -rn dt dCn1 ) rn dt

(12)

Tank 2, Phase 5, Air On: dCa2 Q ) (Ca1 - Ca2) - rn dt V

(13)

dCn2 Q ) (Cn1 - Cn2) + rn dt V

(14)

Tank 2, Phase 6, Air Off: (1)

dCa2 Q ) (Ca1 - Ca2) dt V

(15)

(2)

dCn2 Q ) (Cn1 - Cn2) - rd dt V

(16)

Tank 1, Phase 2, Air On: dCa1 Q ) (Ca2 - Ca1) - rn dt V

(3)

dCn1 Q ) (Cn2 - Cn1) + rn dt V

(4)

Tank 1, Phase 3, Air Off: dCa1 Q ) (Ca2 - Ca1) dt V

(5)

dCn1 Q ) (Cn2 - Cn1) - rd dt V

(6)

Tank 1, Phases 4, 5, and 6, Air Off: dCa1 Q (AN) ) (Ca - Ca1) dt V

(7)

dCn1 Q ) - Cn1 - rd dt V

(8)

Tank 2, Phases 1, 2, and 3, Air Off: dCa2 Q (AN) ) (Ca - Ca2) dt V

(9)

dCn2 Q ) - Cn2 - rd dt V

(10)

Tank 2, Phase 4, Air On: dCa2 ) -rn dt

dCn2 ) rn dt

(11)

In the derivation of eqs 1-16, it is assumed that tanks 1 and 2 are both well mixed and the rates of nitrification (rn) and denitrification (rd) are the same in both tanks. It is also assumed that the time that it takes to switch between different phases is very small, that is, 0, compared to the duration of the phases. In eqs 1-16, Ca and Cn represent concentrations of ammonia and nitrate, with the subscripts 1 and 2 indicating the proper aeration tank. The superscript “AN” refers to effluent from the anaerobic column feeding the tanks, and Q is the flow rate of that stream. The aeration tanks are of the same volume V. Rates of nitrification (rn) and denitrification (rd) in each tank are unspecified and are considered to be unknown for our purposes, although rather simple functional forms for these terms are given in.22 Note that, during any given phase, four ODEs are used to describe the dynamics of the process: one for each of the components, for both tanks. Experimental data obtained from this process, consisting of time series of ammonia and nitrate concentrations for the anaerobic column effluent and one of the aeration tanks, were provided to us. Using the data, a four-layer (2-3-3-2) feedforward neural network with sigmoidal activation functions was trained to predict rates of nitrification and denitrification (rn and rd in the model) as a function of current ammonia and nitrate concentrations in a given tank. To integrate the hybrid model, the same neural network was used in each of the four ODEs for any operating phase.16 Briefly, the training of the neural network was conducted as follows. The initial parameter set for the network was assigned randomly. The model was integrated from an initial condition for five full operating cycles using the same sequence of inputs (influent) as that in the experiment. The time series predicted component concentrations in the first aeration tank were compared to the actual measured values; errors in the predictions (for each measurement in the five cycles) were squared and summed to form a total prediction error measure. A conjugate gradient descent minimization was conducted to reduce this prediction error. Testing for generalization was handled offline by comparing predictions for later (“unseen”) portions of the available experimental time series. Once the network was trained, the resulting hybrid model (the model equations with the neural network component inserted) was capable of accurately predicting the behavior of the plant for long time sequences when the plant’s recorded input measurements were

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000 1697

Figure 3. Experimental time series (circles) vs hybrid model predictions (solid lines) for the ammonia and nitrate concentrations in an aeration tank for the Danish wastewater plant.

provided. A comparison of such predictions against experimentally obtained data is shown in Figure 3. As can be seen in the diagram, the dynamic predictions from the model (solid lines) agree closely with the actual plant measurements (circles). In the middle of the 13th cycle, there are discrepancies between the model prediction for nitrate concentration (bottom, Figure 3) and the experimental measurements. Judging from the general agreement between the model and system, it would appear that some sensor fault may have occurred in the 13th cycle; this seems to motivate the use of the model both as a reference for detecting spurious measurements as well as for interpolation in the event of actual sensor failures. We have also applied hybrid modeling to a more complex wastewater process that involved phosphorus removal, but we had difficulty with the methodology. This study was a simulation study of an activated sludge semibatch reactor whose function was to eliminate both phosphorus and nitrogen. The underlying physical and chemical phenomena in this example are considerably more complex than those in case 1, and the model complexity is similar to that of process systems on which one might like to employ hybrid models. The model used was the ASM2 model5 which incorporates phosphorusaccumulating organisms (PAO) into the kinetics. There is a current lack of understanding of phosphorus kinetics and we studied whether neural networks could be effective in learning phosphorus rates from time series data. There are three PAO rates in the ASM2 model, and we replaced them with neural networks while using the full model to generate the time series data. The PAO rates are more complex than the nitrogen rates modeled from the Danish data. While the nitrogen rates are functions of two variables, the phosphorus rates depend on up to six variables. When the same hybrid modeling approach that worked on the Danish data was tried on simulated phosphorus data, we were not able to achieve

convergence in the neural network training, even after very long simulation times. The results for the phosphorus example raise a question about the general utility of hybrid modeling when complex systems are involved. Additional research on hybrid modeling of such systems is required. Case 2: A Hybrid Model for Control. This example discusses the use a hybrid model for optimization and control of activated sludge operation, specifically for an AAA system. The AAA system has been demonstrated for its capability of removing 60-80% nitrogen,6 simply by switching air on/off. An optimum O2 on/off control strategy, that is, total cycle time (tc) and aeration fraction (fa), for nitrogen removal in an AAA system is essential for meeting the permit nitrogen requirements and saving energy costs. An earlier paper9 gives results for the AAA system when only the first-principles part of a hybrid model is used for calculating control moves. Interestingly, even though the hybrid model discussed here is more accurate than the first-principles model, as measured by the error between predicted and measured variables, for the particular control/optimization approach employed the hybrid model results in poorer control performance than the first-principles model. These results indicate that in addition to a hybrid model being judged by its accuracy, it also needs to be judged on how it will ultimately perform for the task for which it is developed. To date, the most successful model for processes such as the AAA system is the ASM1.7 In this paper a linearized model developed from the ASM1 is used to control/optimize the AAA reactor, and feedback of information from the reactor is used to overcome the problems associated with model inaccuracy. The present study is concerned with only nitrogen removal, and the ASM1 predictions will serve as “real plant data” for comparison of the results of hybrid model simulations.

1698

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000

Figure 4. Hybrid model of AAA reactor.

Linearized Model. The control approach for the AAA system is based on optimization of the predicted performance of the system, given a set of measurements reflecting the current state of the system (or recent history) and influent composition. However, the equations comprising ASM1 are stiff and require a somewhat large computational effort to integrate the full model properly. Therefore, a linear modeling approach is used to develop a simplified process model which captures essential features of the dynamic behavior of ASM1 around the nominal operating conditions of the AAA system. A detailed discussion of how the linearized model was developed and used for control is given by McAvoy et al.9 The hybrid model, discussed below, consists of a discrete-time, linearized version of the ASM1 model of the AAA system with a neural network corrector running in parallel. The “linear system” used consists of two separate linear models (one for each operating phase, “air-on” or “air-off”) which are run alternately to simulate AAA process dynamics. Because the AAA system is cyclic, that is, no steady state is achieved, the linearization of ASM1 is not approached by the traditional means of partial differentiation of the model equations about a steady state; instead, the development of linear models is achieved through simplification of the ASM1 equations. Additional details of how the ASM1 model was linearized as well as parameter values are given in ref 9. Hybrid Model Approach. In our AAA modeling the neural network is trained on a daily basis. The linearized dynamic model is integrated over a fixed air-on/ air-off cycle for 1 day. The approach used is shown schematically in Figure 4. Several points can be noted about Figure 4. First, because the outputs of the linearized model are used as inputs to the neural network, the neural network is used both in parallel with and in series to the linearized model. Montague and Albert10 have recently published a similar hybrid approach where the simplified model outputs are used as inputs to the neural network in a hybrid scheme. If the line in Figure 4 between the linearized model output and the neural network were not present, then the

approach would be a simple parallel approach. Figure 4 shows the process measurements from the plant and the influent that are used as inputs. It is assumed that samples were taken yesterday, and the results of the analysis of the samples are available the next day, today. The 1 day delay is due to the time that it takes to carry out the laboratory analysis. Because the process dynamics are slow, the 1 day delay does not cause major problems. When the model is used for control, it is further assumed that the process measurements do not change from yesterday to today. The goal of the optimization/control scheme is to determine today’s control actions, namely, the cycle time, tc, and the fraction air on fa. The neural network in Figure 4 is trained to predict the error between the actual average daily ammonia, NH+ 4 , and nitrate, NO3 , concentrations, for tomorrow, and those predicted by the linearized model. In Figure 4 the two manipulated variables, tc and fa, are not input to the neural network. The rationale for not inputting these variables is that it is assumed that the historical data used for training the neural network do not contain a great deal of variation in these manipulated variables. If the wastewater plant were operated under a number of different fa and tc policies, then these variables could also be used as additional neural network inputs. Figure 4 shows the neural network in its implementation stage, after it has been trained. Additional details are given in ref 9. The accuracy of the neural network is discussed below. Neural Network Training and Accuracy. To develop training data, a simulation run of 500 consecutive daily operations of the AAA reactor is made using the ASM1 model with varying influent concentrations. Each of the 8 influents, SS, XS, SND, XND, SNH, SNO, SO, and Salk, is perturbed randomly and simultaneously around its mean value which is given in Table 1. The variance of each random perturbation is (5% of its mean. The airon and air-off periods are each fixed to be 1.25 h, and the full ASM1 model is integrated to generate training data. These simulated results from the full ASM1 model are used as actual plant data to test the hybrid modeling approach. The outputs of the ASM1 model that are of

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000 1699 Table 1. Influent Model Parameters variable

mean value

description

SS XS SND XND SNH SO SNO Salk

182 69 6.9 8.8 24 5.4 0.7 215

soluble COD particulate COD soluble organic nitrogen particulate organic nitrogen ammonia nitrogen dissolved oxygen nitrate nitrogen alkalinity

interest are the average daily values of NH+ 4 , NO3 , and average daily organic nitrogen, N h org. In addition, the starting values of NH+ h org at the begin4 , NO3 , and N ning of each day, as generated by ASM1, are used as initial conditions for the linearized model. Using the same random plant influent values, the linearized model is solved to predict its estimates of the daily average NH+ 4 and NO3 . The difference between the average daily values of NH+ 4 and NO3 predicted by both models is used to train the neural network, shown in Figure 4. The first 400 data points are used for training and the last 100 are used for testing. A neural network partial least-squares method13 is used to train the network. Figure 5 shows results for the neural network prediction of the deviations between the actual and predicted average daily values of NH+ 4 (Figure 5a) and NO3 (Figure 5b). The mean absolute error divided by the range of the predictions is 8.9% for NH+ 4 and 7.7% for NO, and these values are reasonably good. When the 3 hybrid model is used for optimization/control, the tc and fa values change. One option to improve the accuracy of the neural network would be to continue to update it using the new data on tc and fa. We did not use this updating approach in calculating the results reported below. When the training was carried out, it was noted that the data did not exhibit a great deal of nonlinearity. Thus, a linear black box would probably produce results comparable to those achieved with the neural network. How the hybrid model can be used for optimizing and controlling the AAA reactor is discussed next. Optimization and Control. A major objective in developing hybrid models is to use them for controlling/ optimizing activated sludge operation. This section describes how such control and optimization can be carried out. The operating aeration parameters of the AAA reactor for today, the aeration cycle length, tc, and the fraction of the cycle when aeration is turned on, fa, have to be determined to control the reactor. The goal is to select the optimal tc and fa values which minimize the energy costs, assumed proportional to fa, while the discharge limits are being met. In practice, the discharge limit is set at a value to be achieved averaged over a month, for example, 10 mg/L. In this paper this limit is specified as a daily limit. The plant operator is assumed to set the current day tc and fa values each morning, on the basis of the previous day’s plant operation results. It is assumed that the plant operator has the analytical laboratory results of yesterday’s operation available today. These are the influent soluble and particulate chemical oxygen demand (COD), soluble and particulate organic nitrogen, and the ammonia. The AAA reactor state is affected by the hydraulic and mean cell residence times (HRT, MCRT), ta and fa. In this study the HRT and MCRT are assumed constant. The available effluent measurements are the COD, ammonia, and organic and nitrate nitrogen.

As discussed above a linearized model is developed to predict 8 plant values for the day ahead, starting from their initial values. These values are the reactor state, as characterized by the soluble and particulate COD, the nitrifying and denitrifying bacteria concentration, the effluent concentrations of the three nitrogen species, and the particulate nitrogen organic compounds. These values are put into a neural network, trained to compensate between the actual plant behavior and the linear model results. The neural network outputs are added to the linear model predictions, giving the hybrid model outputs. How to incorporate the hybrid model into an optimization scheme is discussed next. To control the plant effluent, there are two variables, tc and fa, that can be manipulated to minimize energy costs, subject to the effluent permit restrictions being met. The control/optimization problem that is solved is

min {fa} tc, fa

(17)

subject to h Permit N hO e N + NH+ 4 e NH4,max

fa × tc g 1.0 (1 - fa) × tc g 1.0 where N h Permit is the permit specification on the average daily total nitrogen in the effluent, N h O, and + NH4,max is the maximum value of the average daily ammonia in the effluent, NH+ 4 . In eq 17 the cost of operation that can be minimized is assumed to be associated only with the fraction of time that air is being sparged. The last two constraints deal with the minimum air-on and air-off times. Each time period is constrained to be greater than 1 h because this time is assumed to be the minimum that can be accepted by the plant. If there were no constraints on the air-on time, the optimizer would drive this time toward 0, and this would eventually result in a washout of the nitrifying bacteria. The objective function for eq17 is linear, but the constraints are nonlinear. The function CONSTR in the MATLAB Optimization Toolbox was used for solving the problem. The hybrid model shown in Figure 4 is used to solve the optimization problem given by eq 17. The optimization scheme is illustrated in Figure 6. The predictions of the hybrid model that are used are the average daily ammonia and the sum of the average daily ammonia and nitrate. The exit organic nitrogen is assumed to be equal to the effluent organic nitrogen as measured yesterday, and it is added to the sum to give the predicted average daily total nitrogen in the effluent. hO For the moment assume that the ∆NH+ 4 and ∆N terms are 0. The optimizer is fed both the predicted ammonia and total nitrogen values and the constraint values for these variables. In the simulations below the + constraint for NH+ 4 is NH4,max ) 1.5 mg of N/L and that h Permit ) 10 mg of N/L. The optimizer for N h O is N manipulates fa and tc to solve the optimization problem and to meet these constraints as well as the additional constraints in eq 17. The approach illustrated in Figure 6 will not meet the constraints precisely because there will certainly be some inaccuracy in the predictions of

1700

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000

Figure 5. Neural network training results, predicted and actual deviations. (a) Results for NH+ 4 . (b) Results for NO3 .

the hybrid model due to the assumptions and simplifications involved in its development. This inaccuracy is referred to as plant model mismatch. How to overcome this problem and force the optimizer to exactly h O values is discussed track the actual plant NH+ 4 and N next. An important issue that needs to be considered in using a hybrid model for control is the mismatch that exists between the model and the plant it tries to describe. This mismatch is due to both modeling errors and the effect of unmeasured disturbances. Feedback

of information can be used to deal with this mismatch as follows. Assume that for the initial cycle of the AAA reactor the solution of eq 17 gives the optimum values tc,1 and fa,1. Further assume that when these values are implemented on the actual reactor, the actual NH+ 4 which is measured at the end of the first cycle differs + from that predicted by the hybrid model, NH4,Hyb . Let + + + this difference be ∆NH4 ) NH4 - NH4,Hyb. Then, to overcome plant model mismatch, one can subtract + + ∆NH+ 4 from NH4,max to help bring the actual NH4

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000 1701

Figure 6. Optimization scheme. + closer to the constraint. For example, if NH4,Hyb is 1.5 + mg of N/L and NH+ 4 is 1.7 mg of N/L, then the NH4 constraint can be lowered to 1.5 mg of N/L minus the difference of 0.2 mg of N/L and set at 1.3 mg of N/L. This method of overcoming plant model mismatch is essentially the same as that which has been used in commercially successful dynamic matrix control.2 An identical approach can be used for the total nitrogen constraint. The use of the ∆ corrections to the constraints involves feedback from the plant. To make this feedback robust and to avoid responding too sharply to daily fluctuations, the ∆ corrections are implemented as an exponentially weighted moving average of the current value and yesterday’s value. The equations used are

+ + ∆NH4,new ) 0.5 × ∆NH+ 4 + 0.5 × ∆NH4,yes + ) 0.5 × ∆N h+ h+ ∆N h O,new O + 0.5 × ∆N O,yes

(18) (19)

+ and ∆N+ where ∆NH4,yes O,yes are yesterday’s values. As shown below, this approach will result in no violation h O if the inputs of the desired constraints for NH+ 4 and N to the reactor remain fixed. Results. In this section the results of using the optimization scheme are presented. Figure 7 gives results for the case where the AAA reactor is initially at steady state, and the operating policy being used is air on ) 1.25 h and air off ) 1.25 h. To illustrate how the optimization/control scheme works, no variation in the feed stream is considered. As can be seen in Figure 7a, the operating policy is initially achieving an average NH+ 4 concentration of ≈1.29 mg of N/L and in Figure 7b an average N h O concentration of 9.67 mg of N/L. Because NH+ 4 is less than 1.5, too much air is being sparged, and some energy can be saved. On day 5 the

optimizer is turned on and it brings the AAA reactor to a new steady state in which NH+ 4 ) 1.5 mg of N/L. This new policy reduces the average total effluent nitrogen, N h O, to 6.5 mg of N/L. The new air-on and air-off policies are shown in Figure 7c,d. As can be seen between days 5 and 15, the optimizer forces the air-on period to its minimum of 1 h, and the air-off period is also reduced slightly. The new operating policy results in an energy savings of 10.7% compared to the original policy, and it also reduces total effluent nitrogen. On day 15 a 10% step increase in influent concentration of all 8 species given in Table 1 occurs simultaneously. This forcing corresponds to a +10% step load increase to the plant. At day 45 the 10% step is removed. As can be seen, the optimization/control approach is able to deal effectively with this upset. It is only during the initial transient after day 15 that the air-on period moves off its lower constraint of 1 h. The air-off period is continuously adjusted by the optimizer. Even during this step load upset, there is an energy savings over the original fixed operating policy, but it is smaller, namely, 5.9%. Also shown in Figure 7 are the results produced by using only the linearized model for control. As can be seen, the linearized model produces smaller transient deviations in NH+ 4 than the hybrid model. When the linearized model is first turned on, it reduces energy consumption by 11%, and during the step load upset an energy savings of 6.6% is achieved over that from the original fixed operating policy. Both of these values are slightly better than those produced by the hybrid model. Figure 8 can be used to explain these results. Figure 8 illustrates how the ∆ correction, discussed above allows the optimization/control approach to track desired constraints, even in the face of plant model mismatch. In Figure 8 the ∆ predictions from the

1702

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000

Figure 7. Response of linear (dashed) and hybrid (solid) model-based control systems.

Figure 8. Deviations between actual and predicted concentrations.

lineraized and hybrid models are plotted for the same forcing used for Figure 7. These values of ∆ are not filtered using eqs 18 and 19, but they are the calculated daily deviations. As can be seen, the hybrid model’s ∆ is smaller in magnitude than the linearized model’s ∆. Before day 15 and after day 45 the hybrid model is very accurate, but during the intervening period it is less accurate. By contrast, the accuracy of the linear model is always poorer in absolute terms than the accuracy of

the hybrid model, but it is not affected by the step upsets. Thus, once one learns the ∆ for the linear model, it remains approximately constant, while the ∆ for the hybrid model changes significantly during the step loads. As a result, it takes the hybrid model several days to bring the NH+ 4 back to 1.5 mg of N/L, and this is the reason the hybrid model achieves an inferior response compared to that of the linear model. It should be noted

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000 1703

Figure 9. Constraint value for hybrid model.

that the neural network in the hybrid model was trained on data where tc and fa did not vary, but then used for optimization/control where these variables changed. If the neural network were updated using the new tc and fa values, then the hybrid model should produce better results. For both models there are errors, but despite these errors the NH+ 4 concentration is forced to satisfy its constraint value of 1.5 mg of N/L once transients die out. Figure 9 shows how the NH+ 4 value changes with time because of the subtraction of the ∆NH+ 4 values resulting from eq 18 when the hybrid model is used for control. During the step load period starting at day 15 the NH+ 4 constraint is lowered from 1.5 to ≈1.3 mg of N/L to force the actual NH+ 4 values to 1.5 mg of N/L. This lowering of the constraint overcomes the plant model mismatch. We have also studied the case where the influent has a time varying feed composition and found that the linear model does better in this case as well. The conclusion to be drawn from this example is that even though a hybrid model can be more accurate than a first-principles model, this increased accuracy may not always lead to improved control performance. Conclusions One does not have process knowledge that is complete enough to develop a first-principles dynamic model for many process systems. Hybrid models, which combine available first-principles information with data-based models such as neural networks, have been proposed as a solution to this problem. This paper presents results from two hybrid modeling studies on wastewater reactors. In the first, hybrid models are used to learn rate expressions for nitrification and denitrification from time series data taken from an operating plant. The resulting hybrid model is very accurate and its predictions agree very well when compared with new data not used for its development. The same hybrid modeling

approach that worked very well in this case had difficulty when it was tried on a more complex problem involving phosphorus removal. In the second example a hybrid model is used for controlling the air-on, air-off periods for an alternationg aerobic anoxic reactor. It was found that even though the hybrid model was more accurate that the linear model which it corrected, the control results produced by the hybrid model were inferior to those produced by the linear model. The results presented here indicate that one has to be careful in applying hybrid models and that they do not always produce superior results compared to other methods. Acknowledgment The authors wish to acknowledge the support of the National Science Foundation through Grant BBS9625183. Literature Cited (1) Coˆte´, M.; Grandjean, B. P. A.; Lessard, P.; Thibault, J. Dynamic Modeling of the Activated Sludge Process: Improving Predictions Using Neural Networks. Water Res. 1995, 29 (4), 9951004. (2) Cutler, C.; Ranaker, B. Dynamic Matrix ControlsA Computer Control Algorithm. AIChE National Meeting, Houston, April 1979. (3) Cybenko, G. Approximation by Superpositions of a Sigmoidal Function. Math. Control Signals Syst. 1989, 2, 303-314. (4) Dors, M.; Simutis, R.; Lu¨bbert, A. Advanced Supervision of Mammalian Cell Cultures Using Hybrid Process Models. 6th Int. Conf. Comput. Appl. Biotechnol. 1995, 72-77. (5) Gujer, W.; Henze, M.; Mino, T.; Matsuo, T.; Wentzel, M. C.; Marais, G.v. R. The Activated Sludge Model No. 2: Biological Phosphorous Removal. Water Sci. Technol. 1995, 31 (2), 1-11. (6) Hao, O. J.; Huang, J. Alternating Aerobic-Anoxic Process for Nitrogen Removal: Process Evaluation. Water Environ. Res. 1996, 68 (1), 83-93.

1704

Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000

(7) Henze, M.; Grady, C. P. L.; Gujer, W.; Marais, G. v. R.; Matsuo, T. Activated Sludge Model No. 1; Technical Report 1; IAWPRC: London, England, 1986. (8) Hornik, K.; Stinchcombe, M.; White, H. Multilayer Feedforward Networks Are Universal Approximators. Neural Networks 1989, 2, 359-366. (9) McAvoy, T. J.; Anderson, J. S.; Hao, O. J.; Boger, Z.; Kim, H. Optimization and Control of Alternating Aerobic/Anoxic Activated Sludge Operation. Presented at the 14th World Congress, International Federation of Automatic Control, Beijing, July 1999. (10) Montague, G.; Albert, S. Hybrid Neural Network-First Principles Models Applied to a Food Process. Preprints of IFAC ADCHEM Symposium, Banff, CA, June 9-11, 1997; pp 131-136. (11) Piron, E.; Latrille, E.; Rene´, F. Application of Artificial Neural Networks for Crossflow Microfiltration Modelling: “BlackBox” and Semi-Physical Approaches. Comput. Chem. Eng. 1997, 21 (9), 1021-1030. (12) Ponton, J. W.; Klemes, J. Alternatives to Neural Networks for Inferential Measurement. Comput. Chem. Eng. 1993, 17 (10), 991-1000. (13) Psichogios, D. C.; Ungar, L. H. A Hybrid Neural NetworkFirst Principles Approach to Process Modeling. AIChE J. 1992, 38 (10), 1499-1511. (14) Qin S. J.; McAvoy, T. J. Nonlinear PLS Modeling Using Neural Networks. Comput. Chem. Eng. 1992, 16 (4), 379-391. (15) Reuter, M. A.; van Deventer, J. S. J.; van der Walt, T. J. A Generalized Neural-Net Kinetic Rate Equation. Chem. Eng. Sci. 1993, 48 (7), 1281-1297. (16) Rico-Martı´nez, R.; Anderson, J. S.; Keverekidis, I. G. Continuous-Time Nonlinear Signal Processing: A Neural Network

Based Approach for Gray Box Identification. Proc. IEEE Workshop Neural Networks Signal Process. 1994, 596-605. (17) Thompson, M. L.; Kramer, M. A. Modeling Chemical Processes Using Prior Knowledge and Neural Networks. AIChE J. 1994, 40 (8), 1328-1340. (18) van Can, H. J. L.; Hellinga, C.; Luyben, K. C. A. M.; Heijnen, J. J.; te Braake, H. A. B. Strategy for Dynamic Process Modeling Based on Neural Networks in Macroscopic Balances. AIChE J. 1996, 42 (12), 3403-3418. (19) van Can, H. J. L.; te Braake, H. A. B.; Hellinga, C.; Luyben, K. C. A. M.; Heijnen, J. J. An Efficieint Model Development Strategy for Bioprocesses Based on Neural Networks in Macroscopic Balances. Biotechnol. Bioeng. 1997, 54 (6), 549-566. (20) Werbos, P. J. Beyond Regression: New Tools for Prediction and Analysis in the Behavioral Sciences. Ph.D. Thesis, Harvard University, Cambridge, MA, 1974. (21) Wilson, J. A.; Zorzetto, L. F. M. A Generalised Approach to Process State Estimation Using Hybrid Artificial Neural Network/Mechanistic Models. Comput. Chem. Eng. 1997, 21 (9), 951-963. (22) Zhao, H.; Isaacs, S. H.; Soeberg, H.; Ku¨mmel, M. A Novel Control Strategy for Improved Nitrogen Removal in an Alternating Activated Sludge ProcesssPart I. Process Analysis. Water Res. 1994, 28 (3), 521-534.

Received for review July 28, 1999 Revised manuscript received November 22, 1999 Accepted November 23, 1999 IE990557R