Modelling and Advanced Control of a Biological Wastewater Treatment Plant Goal After completing this exercise you should know how to model the sedimentation process and how to simulate it using Matlab and its built-in numerical solvers. Furthermore, you should have some experiences of controlling the sludge recycle flow rate (Q r ), the nitrate (internal) recirculation flow rate (Q intr ) and the excess sludge flow rate (Q w ). Introduction This exercise is divided into two steps: the implementation of a rather realistic settling model and the control of the sludge concentration in the bioreactors together with the sludge blanket level in the settler. In the earlier exercises you have used the IAWQ Activated Sludge Model No.1 together with an ideal settler model. The IAWQ No.1 model only describes the biological mechanisms in an activated sludge plant and nothing with regard to the sedimentation process. In order to have a more realistic description of the entire plant, the ideal settling process must be replaced with a more complex settler model. Plant Configuration A real plant often has a principal outline according to Figure 1, with one flow into the settler (Q f ) and two flows leaving the settler (Q e and Q u ). At the plant where we have gathered the data, the biological part (including sedimentation) is not the only one, instead it is followed by a polishing step with chemical precipitation, flocculation and flotation. Consequently, the volume (and area) of the settler is not dimensioned to remove all suspended solids (SS) and therefore you may sense that the effluent suspended solids concentration is rather high. However, this is a common configuration and may often be an efficient solution, which reduces the total volume requirement. Q intr Q in Q f Q e Anox Aerob Aerob Aerob Q u Q r Q w Figure 1: Principal layout of the modelled WWTP. 1
Modelling Sedimentation A fairly simple and well functioning model of the settling process is the multi-layer model. In this one-dimensional model (only dynamics in one dimension is modelled) the settler is divided into a number of layers, usually between 10 and 50. The transport of sludge between each layer depends on bulk flow, which is related to the water flow (upwards or downwards), and gravitational flow, which depends on the influence of gravity on the sludge flocs and is always directed downwards. Above the layer which receives the influent flow (Q f ) of sludge (i.e. the feed layer), the bulk flow is always directed upwards and below the feed layer the bulk flow is directed downwards. This means that the flow upwards (Q e ) is equal to the the effluent flow, while the flow downwards (Q u ) is equal to the sum of the recycled flow (Q r ) and the excess sludge flow (Q w ) (see Figure 2). Top layer Bulk movement Q e X e /A 1 Gravity settling Layers above the feed layer J up,2 = Q e X 2 / A J up,3 = Q e X 3 /A 2 J s,1 = min (v s,1 X 1, v 2 X 2 ) J s,2 = min (v s,2 X 2, v 3 X 3 ) J up,m = Q e X m /A J s,m-1 = min (v s,m-1 X m-1, v s,m X m ) Feed layer Layers below the feed layer Q f X f /A J dn,m = Q u X m /A J dn,m1 = Q u X m1 /A m m1 J s,m = min (v s,m X m, v s,m1 X m1 ) J s,m1 = min (v s,m1 X m1, v s,m2 X m2 ) J dn,n-1 = Q u X n-1 /A J s,n-1 = min (v s,n-1 X n-1, v s,n X n ) Bottom layer n Q u X u /A Figure 2: The principle for the multi-layer model describing the settling process. The changes in concentration within each layer above layer m can be expressed as: dx i = J up,i1 J s,i 1 J up,i J s,i (1) dt z i where z i is the height of layer i. Equivalently, the changes in concentration within all other layers are described (simple mass balances according to 2
Figure 2). The relations between the different flows are, in accordance with Figure 1, given as: Q f = Q in Q r (2) Q e = Q in Q w (3) Q u = Q r Q w (4) Different alternatives exist to describe the particulate material (X): either let X denote a composite variable of all different particulate components in the biological model or use a separate state variable, X I, to describe each particulate fraction. The first alternative gives a small error of how the proportions between the different fractions propagate through the settler during dynamic conditions but requires significantly fewer state variables (in a 10-layer model 10 state variables are needed for alternative 1 and 40 state variables for alternative 2). In steady state both alternatives will produce identical results. Furthermore, in our settler model the suspended solids are given in the unit mg SS/l and not, as in the biological model, in mg COD/l and consequently the units must be transformed. In this exercise, alternative 1 will be used and the different particulate fractions will be added together and transformed according to: X f = 0.75(X S X IP ) 0.9(X BA X BH ) (5) where X f is the SS-concentration entering the settler and the other variables describes the concentrations in the last biological reactor. X ND is treated in a special way. The reason for this is that X ND is actually a part of X BA and X BH, but is described as a separate variable in the biological model for special technical reasons. When the sludge is returned to the anoxic reactor, X u (the SS-concentration in the sludge recirculation stream) must again be divided into the different fraction using the same principle as above. This means that for example X S in the sludge recycle flow is calculated as (X S,r is the concentration of the X S which is reintroduced into the anoxic reactor and X S,f is the concentration of X S which enters the settler with the flow Q f ): X S,r = X u X f X S,f (6) Using the same method the concentrations for each particulate fraction is calculated, including X ND although it is not a part of X f. However, it is reasonable to assume that also this fraction is concentrated in the settler in the same proportion as the other fractions. An important parameter for the sedimentation is the settling velocity, v s. It is not constant instead it depends on the SS-concentration. In the literature many different functions can be found, which are considered to describe the settling velocity as a function of the SS-concentration. One commonly used function is the double-exponential function: ( ( v s = 0, min (v ))) 0, v 0 e r h(x X min ) e r p(x X min ) (7) 3
This function takes into account that the settling velocity does not increase exponentially when the concentration is lower than a limit value, instead it decreases (see Figure 3). In this exercise we will use a simplified version of the double-exponential function, i.e.: v s = max ( 0, v 0 ( e r h X e rp X )) (8) This simplification implies that the settling velocity is zero when the concentration is equal to zero and immediately increases when the concentration increases and it does not have the flat top given by v 0 (compare Figure 3). Suggested parameter values are: v 0 =150 m/d, r h =0.00042 m 3 /g and r p =0.005 m 3 /g. settling velocity v 0 x min suspended solids concentration Figure 3: The principal behaviour of the double-exponential function. To simplify the model we assume that the dissolved fractions are not affected by the sedimentation, i.e. all soluble concentrations in the effluent water (Q e ) and in Q u are identical to the concentrations in the settler feed flow (Q f ). More information about settler models can be found in the course textbook Wastewater Treatment Systems, pages 87-95. The Controllers and Their Default Values In the earlier exercises, two different controllers for oxygen have been developed. To make sure that you are using reasonable values for the controller parameters we provide a set of parameters together with the complete code for the controllers (see below). If you use the parameter set presented below you should achieve identical results as we present as the correct solution (for verification purposes). 1) Traditional PI-oxygen control exemplified for reactor 2, i.e. the first aerobic reactor (use the same set of parameters for the other reactors but use the different offset values presented in Exercise 3). 4
K2=1; Ti2=0.1; Soref2=2; e2=(soref2-so2); dipart2 = K2/Ti2*e2; u2 = K2*e2ipart20.27; u2 = max(min(1,u2),0); qair2=u2*7; 2) Cascade control of oxygen level. The controller below calculates a reference value for a traditional PI-controller according to (1). The control is based on measurements of the ammonia concentration in the actual reactor (in the example below reactor 4, i.e. the last aerobic reactor). Tasks Kkaskad=0.25; Snhref = 1.0; Soref4 = Kkaskad*(Snh4-Snhref); Soref4 = max(min(5,soref4),0.5); 1) Extend your model from Exercise 3 (i.e. four biological reactors in series, use the same physical dimensions in this exercise) with a multi-layer settler model. Use ten layers with equal height and assume that the cross-sectional area of the settler is 600 m 2 and the total height is 4 m. The settler feed flow, Q f, enters into layer 5 from the top. (NOTE! min is available as a predefined function in Matlab for determining min-values). 2) To be able to test the model you must define a value for the excess sludge flow rate, i.e. Q w. A reasonable value is 280 m 3 /d, which corresponds to a sludge age of approximately 7 days if the model is correctly implemented. Assume constant characteristics of the influent wastewater as given in Table 1, Exercise 2. Test your model by simulating until steady state is reached and determine the exact sludge age of the system. Report how you did the calculations. NOTE! X ND shall not be considered to be part of the SS-concentration and the sludge age calculations shall be based on the SS-concentration and not the COD-concentration. You can verify that your model is working correctly by comparing your results with the steady state results provided in Table 1. 3) When the amount of sludge in the settler increases it creates a rising sludge blanket level, i.e. the interface between high and low sludge concentration, often defined as the uppermost layer where the sludge concentration is higher than 3000 mg SS/l. If the sludge blanket rises too much then the concentration of suspended solids in the effluent water will increase, which should naturally be avoided. To compensate for the sludge increase the excess sludge must be removed from the system. Normally this is done in specific time intervals during the work day, since the plant operators want to monitor the operation. Implement an on-off control for removing excess sludge, which starts when the SS-concentration in layer 6 (the fifth layer from the bottom) surpasses 3000 mg/l and stops when the SS-concentration in layer 8 is below 3000 mg/l. One possible algorithm to use is: 5
Reaktor 1 Reaktor 3 Q u S I 20 20 20 S S 8.6 2.7 2.0 X IP 1553 1558 4501 X S 75.7 24.2 52.3 X BH 1442 1461 4201 X BA 51.1 52.1 150.7 S O 0.0 2.0 0.0 S NO 0.5 6.3 7.3 S NH 9.6 3.1 2.0 S ND 0.7 0.9 0.8 X ND 4.1 1.7 4.2 Table 1: Steady state-values with Q w =280 m 3 /d, SO2 ref = SO3 ref = 2 mg/l (PI control), SNH4 ref = 1 mg N/l (cascade control). global qw if X6>3000 qw=2000; elseif X8<3000 qw=0; end; Note that Q w must be defined as a global variable. In the m-file that calls ode15s Q w must also be defined as a global variable and given an initial value (Q w =0). A global variable is created with the command global variable_name prior to its use. How is the sludge concentration in the bioreactors affected by the intermittent excess sludge pumping? Assume constant influent characteristics according to Table 1, Exercise 2 and control the rest of the plant according to task 2. Start the simulation in the steady state that was calculated in task 2 and test the new controller by simulating the system 10 days forward. 4) To avoid the large variations of the SS-concentration in the reactors caused by the step wise on-off control of the excess sludge, it is beneficial to control the return sludge flow rate so that the problem is compensated for. By measuring the SS-concentration in the first reactor and then calculate the difference between the true and the wanted SS-concentration, a simple proportional controller can be implemented. Add a controller, which controls the SS-concentration in reactor 1 (anoxic) to a reference value of 3000 mg SS/l by manipulating Q r (a suitable gain is 100 and a good offset value is 10000 m 3 /d). Allow Q r to vary between 0 and 30 000 m 3 /d. Do you achieve a more stable SS-concentration? Assume constant influent characteristics according to Table 1, Exercise 2 and control the rest of the plant according to task 3. Start the simulation in the steady state that was calculated in task 2 and test the new controller by simulating the system 10 days forward. 6
5) The internal recirculation (Q intr ) has until now been controlled proportional to the influent flow rate (qintr=2*qin). This is not always the optimum choice. The purpose of the internal recirculation is to make sure that nitrate is returned to the anoxic reactor. If the nitrate concentration in the last aerobic reactor is too high then this can be compensated for by increasing the internal recirculation flow rate. Such an action is only relevant if there is denitrification capacity left in the anoxic reactor. Add a controller for the internal recirculation, which uses measurements of the nitrate concentration in the last aerobic reactor and calculates the difference between the true and the wanted nitrate concentration. A simple proportional controller is enough (a suitable gain is 10000 and a good offset value is 40000 m 3 /d). Try the controller with nitrate reference values of 5 and 10 mg (NO 3 -N)/l. Is it possible to achieve 5 and 10 mg (NO 3 -N)/l, respectively? Assume constant influent characteristics according to Table 1, Exercise 2 and control the rest of the plant according to task 4. Start the simulation in the steady state that was calculated in task 2 and test the new controller by simulating the system 10 days forward. 6) Simulate the plant with a varying influent flow according to task 4, Exercise 2 (apply the variation of influent S NH and Q in simultaneously) and use all the controllers you have implemented until now (use a reference value for the nitrate concentration of 8 mg (NO 3 -N)/l). Start the simulation in the steady state that was calculated in task 2 and test all the controllers by simulating the system 5 days forward. How well do all the control actions work together? Comment the results and provide a suitable selection of graphs to illustrate your comments. Reporting The results of the exercise may be reported either by e-mail or handing in a traditional hard copy report. If the report is submitted by e-mail (as an attached file) it should be in MS Word, pdf or PostScript format. The report should contain listings of all your m-files (commented code), a reasonable selection of Matlab plots and describing comments and discussion of the results. As the reports of the five exercises are the basis for passing the course, they should be carried out individually and every student should hand in individual reports. The deadline for submitting the report is Friday 14 February 2003. Reports by e-mail are sent to: jon.bolmstedt@iea.lth.se Jon Bolmstedt will be available for questions with regard to the exercise on Thursdays between 10.30 and 12.30. If you require assistance at other times you may visit Jon (but there is no guarantee that he will be available). A better way is to send your questions by e-mail and they will be answered as soon as possible. 7