Nonlinear modeling of activated sludge process using the Hammerstein-Wiener structure

The paper regards to physical model of the Activated Sludge Process, which is a part of the wastewater treatment. The aim of the study was to describe nitrogen transformation process and the demand of chemical fractions, involved in the ASP process. Moreover, the non-linear relationship between the flow of wastewater and the consumed electrical energy, used by the blowers, was determined. Such analyses are important from the economical and environmental point of view. Assuming that the total power does not change the blower is charging during a year an energy amount of approx. 613 MW. This illustrates in particular the scale of the demand for energy consumption in the biological aeration unit. The aim is to minimize the energy consumption through first building a model of ASP and then through optimization of the overall process by modifying chosen parameter in numerical simulations. In this paper example measurement and analysis results of nitrite and ammonium nitrogen concentrations in the aeration reactor and the active power consumed by blowers for the aeration process were presented. Further the ASP modeling procedure, which uses the Hammerstein-Wiener structure and example verification results were presented. Based on the achieved results it was stated that the developed set of methodologies may be used to improve and expand the overriding control system for system for wastewater treatment plant.


The Activated Sludge Process
The Activated Sludge Process (ASP) is a method used for biological wastewater treatment and is widely used in sewage treatment plants, for example [1].Basic ASP process flow diagram is shown in Figure 1.The wastewater is brought into the biological reactor.The activation of wastewater process is based on providing oxygen to increase the number of microorganisms, responsible for contaminants reduction in the aeration tank.The activated sludge is then formed; it consists of flocks, mixes with new incoming wastewater and finally takes form of slurry.The flocks contain bacteria but also ciliates, flagellates, protozoa, nematodes, rotifers, larvae of insects, arachnids and mushrooms.Typical flock size varies from 50 µm to 100 µm.The sludge from the biological reactor is then transported to secondary settling tank (also called clarifier), in which the activated sludge is separated.A considerable part of the sludge is returned back to the reaction chamber (biological reactor) and the excessive part of the sludge is removed.The advantage of this method is its significant performance of harmful chemicals reduction.The main disadvantage is connected with high costs of electrical energy, which supply is needed for to assure a suitable amount of oxygen bowing into the aeration tank.Bacteria's growth requires a continuous supply of energy.The heterotrophic bacteria require oxygen and organic carbon as a substrate.The autotrophic bacteria grow in oxygen environment using inorganic carbon substrate.

Biological removal of nitrogen compounds
Nitrogen is present in the wastewater in various forms, e.g.free form of ammonia, nitrates, nitrites, and different kinds of organic compounds.The total content of nitrogen is a sum of its particular components.Nitrogen is essential for biological growth, but in certain forms it is toxic and therefore, its reduction is desirable.Ammonia is toxic for aquatic organisms, among others, for fish.Nitrate presence causes excessive demand for oxygen.Nitrogen, as a nutrient, causes excessive growth of aquatic plants.
There are two basic nitrogen transformation processes in the wastewater treatment plants: the nitrification and the denitrification.Both processes result in the removal of nitrogen from wastewater.Nitrification is the oxidation of ammonia and ammonium salts into nitrites and nitrates.This process is driven by nitrifying bacteria.Autotrophic nitrification takes place in the presence of oxygen at a concentration of at least 2 mg O2/dm 3 .Nitrification reaction consists of two phases.In the first stage bacteria oxidize ammonium to nitrite: In the second stage nitrite ions are oxidized to nitrate by bacteria: The condition of autotrophic nitrification occurrence is, beside the oxygen presence, the presence of coal, as an energy source for autotrophic bacteria (e.g.carbon dioxide) and the appropriate pH value (around 7.5).
Denitrification is a reduction of nitrite to nitrogen.This process takes place under anaerobic conditions.Oxygen is present in the nitrite.Bacteria use it instead of dissolved oxygen.A simplified description of the denitrification reaction is as follows:

Modeling of the Activated Sludge Process
The practical aim of our work is to develop a set of methodologies that will be used to improve and expand the precedent control system for wastewater treatment plant.The overriding control system provides measurement data to the subordinating control systems of the plant and replaces in this way human service for sewage treatment plants.Conducted works aim to determine the nature of changes, dependencies, trends and to make other observations of the wastewater parameter values, which characterize the treatment process.The study uses empirically acquired and digitally processed data in order to identify develop and verify a non-linear simulation model of the wastewater treatment plant.The hypothesis relates to confirmation the possibility of use of a physical model of wastewater treatment plant, based on Hammerstein-Wiener structure, to optimize the treatment process.According to the latest global trends, mathematical modeling has become an integral part of the design and operation of wastewater treatment systems, particularly those using the ASP [2].Simulation of the activated sludge systems (experiment carried out on the model) proved to be an extremely useful tool for operators, designers and consultants, as well as for the scientific community.The use of mathematical models allows one for to examine in a short time and with low financial outlay of many technological solutions, and for simulation of events from outside the range of typical real system conditions.The most common physical model is the ASM1 (Activated Sludge Model No.1), which was the first bio kinetic model of activated sludge.Implementations of the ASM1 in several popular simulation programs were compared in an exhaustive manner [3].Examples of modified, supplemented or improved models of ASM1, known respectively as ASM2, ASM2d and ASM3 are described in detail in [1].In addition to the ASM family models, in which the mass balance is based on the COD, there are also models that use the mass balance of the BOD, for example the ASAL models [4].Models describing in detail the metabolism of organisms involved in the pollutants decomposition, which include, among others, TUDP model are described in [5][6].The activated sludge system model is composed not only from the activated sludge (biochemical model, e.g.ASM), but also it includes models of other processes, in particular: he sedimentation model (settler model) and the mass transfer model (hydraulic model, aeration system model).Most of the simulation models, described in the literature, were carried out for the biological purification stage and thus the system consisted of the activated sludge reactor and the secondary sedimentation/settling tank [7].The newest trends in modeling of wastewater treatment processes, however, seek to include also other system parts/processes, instead of only the specified area, in the multiphysical model.In such as a manner the whole wastewater treatment plant constitutes the object under study and the designed model includes additionally the sewage, sewage treatment plant and the receiver [8].A factor impeding modeling of the technological sequence of the entire wastewater treatment plant lies in the fact that not all models of wastewater or sludge treatment processes have a common set of variables.For example one may consider a combination of the ASM1 model with a settler model.Such a hybrid model, however, involves the concentration of slurries from the settler as state variable, but this value is not present in the activate sludge process.This problem might be solved by using a complex variable, corresponding to the concentration calculated from the respective ASM1variables, which is, however, not a state variable.Another example of biochemical transformations model, which uses a different set of variables, is the ASM model and the methane fermentation -ADM1 (Anaerobic Digestion Model No.1) model.
The most important part prior modeling is collection of measurement data, which allows the model to be accurately calibrated and validated for all conditions.The modern modeling approaches and algorithms are relatively easy to understand for engineering application purposes.They enable to model the wastewater treatment facilities and to calibrate them, which provide then accurate predictions of the system behavior under different operational conditions.Nowadays in every facility there are specialized measurement and SCADA devices installed for registering and collection of hydraulic and technological parameters.Given sufficient data, a modeler can accurately model the activated-sludge process using different models.
Developments in the field of modeling of sludge treatment processes, including both dynamic and steadystate conditions, are well presented in [9].Based on a literature review Author enhances the importance of computer modeling of activated-sludge process during design of new and optimization of existing wastewater plants.Readers who are interested in other interesting research results dealing with modeling of activated sludge tanks are referred [10][11][12][13][14].
In this paper chosen analysis result of nitrate and ammonium nitrogen and blower active power values, measured in experiments, are presented.Furthermore, the ASP modeling procedure and results of this model verification are described.2 Experimental results analysis

Analysis results of nitrate nitrogen concentration
Nitrate nitrogen NO3-N is next to nitrite nitrogen NO2-N the main product of decomposition of ammonium NH4-N.This value was registered during measurements by using an ion-selective probe from Hach-Lange.The measuring sensor was placed inside the oxygen reactor.Under normal operational conditions, the gathered data should indicate significantly lower values in the effluent as compared to these in the influent of the reactor.In Figure 3 probability density function calculated over the nitrate nitrogen concentration gathered during the measurement campaign is presented.The probability density function depicts no uniform mode.Variability in the entire interval is relatively equal.
In Figure 4 power spectrum density calculated over the nitrate nitrogen concentration gathered during the measurement campaign is presented.Power spectrum depicts several periodicity components of the sludge what is indicated by picks in the spectrum.The most significant value is the fundamental frequency component equal to 1*10e-5, the conversion of 24 hours.
In Figure 5 the auto covariance function calculated over the nitrate nitrogen concentration gathered during the measurement campaign is presented.It indicates a stochastic component and significant own variances for time delays, which are multiples of 24h day.Correspondent result was obtained by examining variation of the frequency structures over time, what is illustrated in Figure 6.The scale graph depicts no significant harmonics in the gathered data.

Analysis results of ammonia nitrogen concentration
The concentration of ammonium nitrogen NH4-N was measured using two probes: the Hach-Lange and the Endress-Hauser sensors.Both sensors were placed inside the oxygen reactor.In Figure time  in the afternoons and at nights and lower at mornings.Values measured by the Hach-Lange probe were slightly lower as compared with data registered by the Endress-Hauser probe.The ammonia nitrogen concentration varies in the range from 0.8 to 19.5 mg/dm 3 .The average values µ=8 mg/dm 3 for the Hach-Lange and µ=9 mg/dm 3 for the Endress-Hauser probes.The standard deviation equals 4.09 for the Hach-Lange probe, and it is approx.16% higher for the Endress-Hauser probe.In further studies the Hach-Lange probe was applied.In Figure 8 probability density function calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe is presented.The highest probability occurred for the concentration equal to about 14 mg/dm 3 .The distribution has a fuzzy character and values are within the range from 0 to 16 mg/dm 3 .In Figure 9 power spectrum density calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe is presented.The spectrum depicts periodicity of the sludge what is indicated by a pick near the 1*10e-5 frequency value.Certain importance is give also to the second harmonic component.
In Figure 10 auto covariance function calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe.Here a high value of the covariance of time delay, which is equal to 24 h, and for the subsequent multiples, is depicted.In Figure 11 scale graph calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe is presented.One can recognize similar periodic components as compared to the nitrate nitrogen concentration.For the entire duration of measurement the 24h daily component does not change its energy.Wavelet coefficients for the scale corresponding to the 1/(12h) frequency occur sporadically.

Analysis results of the blower active power
The next parameter analyzed was the active power applied for three different blowers that are installed in the reactor.The time courses for the various blowers are shown in Figure 12.The total value of blowers active power is presented in Figure 13.The average value of active power µ was equal to approx.70 kW.
Additional the probability density function was calculated over the active power values (Figure 14), which was approximated by using normal distribution function achieving very high fit (Pearson determination coefficient R 2 =0,89).Calculated standard deviation value depicts that during the entire measurement campaign the blowers have had relatively small active power, which was equal to 70 kW.The momentary power reaches the maximum value of 120 kW.Assuming that the total power does not change during the year blowers charge an energy amount of approx.613 MW.This illustrates in particular the scale of the demand for energy consumption in the biological aeration unit.

Non-linear modeling of chosen processes involved in the ASP
The study was carried out to identify certain processes related to waste water treatment.The purpose of these studies is an alternative description of the treatment of nitrogen and chemical fractions of demand.Moreover, the aim of research is to determine the non-linear relation between the flow of sewage and electric energy consumed.The process is treated as a Single Input Single Output (SISO).The identification was carried out using Hammerstein-Wiener model.The study was conducted using MATLAB Toolbox System Identification Toolbox.In the studies two sets of data were applied: one for identification and one for validation.Weekly measurement data were used for the modeling process.The available waveforms were divided in two half: one half -3.5 day, was used for identification of the model, as the learning sequence (LS); the remaining 3.5 days was used for testing purposes, as a test sequence (TS).All data sets applied in the study consisted of 336 measuring points, i.e. 84 hours with four samples per hour.In a series of simulations an optimal nonlinearity on the input and output of the model were determined.Also an appropriate structure of the linear dynamic member was selected.For the estimation of non-linear members a piecewise-linear model was applied.Three different criteria for evaluation of the model quality were used: 1. C1: Best fit for learning sequence FIT(LS), 2. C2: Best fit for test sequence FIT(TS), 3. C3: Best fit for the sum over the learning and test sequences FIT(LS) + FIT(TS).

Non-linear process identification of nitrate nitrogen SNO production in the aerobic reactor
In the first step the model for nitrate nitrogen (SNO) was identified and verified.The input of the SISO model was the outflow of sewage.The output variable was the course of SNO.The sampling period for both variables was 15 min.Both variables were changing over time.
A genetic algorithm was used for to determine five parameter values, which were as follows:  number of zeros (plus 1) -P1,  number of poles -P2,  input delay -P3,  number of piecewise-linear estimators of the input nonlinearity (plus 1) -P4,  number of piecewise-linear estimators of the output non-linearity (plus 1) -P5.
For model goodness indication, the following equation was applied: Where: Y is the model response, C is the measured data.This value is given in percent, therefore the higher the result, the better the fit.
The summary results of studies, which aimed determination of the best structure for the different criteria analyzed, are listed in Table 1.All the structures were found to have the same number of zeros P1=3, the same number poles P2=7 in the dynamic part and the same delay, which was equal to one step P3=1.Differences were calculated for the number of piecewise-linear estimators of the input and output nonlinearities.When used as criterion the best fit of learning sequence (no.1), the optimal structure consisted of 5 piecewiselinear (P4x=4+1)in both nonlinearity estimators.
An example time course of nitrate nitrogen model identified using the learning sequence is shown in Figure 15.The model relatively properly reproduces the measured nitrate nitrogen values adjusting to changes in the following days.Negligible mismatches occur only at the hourly/minutely variability level of the data.The residuals time course of the Hammerstein-Wiener model in response to learning sequence, when identification considered the criterion C1, is presented in Figure 16.The values are in the range from -0.8 to 1mg/dm 3 .The stochastic nature of the residuals within time course, confirms that the model has been selected properly.

Non-linear process identification of ammonium nitrogen NH4-N production in the aerobic reactor
We then consider the process, in which the wastewater outflow was given as the input of the SISO system, and the discharged ammonium nitrogen concentration (NH4-N) was assumed as output.The sampling period for both datasets was equal to 15 min.Just as for the nitrate nitrogen identification, during these studies it were used two datasets: one for the identification and second for the validation.Also the same genetic algorithm, the same number of parameters of the objective function, the same goodness indicator and the same criteria were applied.The summary of the results obtained are listed in Table 2.
The optimal model structure, for which the best matching value was calculated, occurred for identification with the LS (criterion C1).It had a significant number of zeros P1=7 and poles P2=7.It had respectively 2 (P4) and 6 (P5) points of inflection of the input and output nonlinearity estimators.It was found that criteria C2 and C3 meet the same structure with two zeros and three poles in the dynamic part.The static nonlinearity input estimator had 6 piecewise-linear (P5=5+1), while the output nonlinearity estimator included four piecewise-linear.An example time course of ammonium nitrogen model identified using the LS is shown in Figure 17.The residuals (Figure 18) are in the range of from -2.7 to 1.5 mg/dm 3 .Stochastic nature of the residuals time course confirms that the model has been selected properly.

Non-linear process identification of active power AP used for in the aeration
Then, an attempt to determine the non-linear relationship between the amount of effluent and environmental parameters: temperature, pressure and active power consumption was made.The model inputs were: sludge outflow, with sampling period equal to 15 min, temperature and pressure, with sampling period equal to 60 min.The model output was the total active power, which constitutes the sum of active power values measured on three blower devices mounted for aeration in the biological reactor.All datasets were interpolated in order to obtain a uniform sampling rate (1/4 h -15 min).As in the previous studies, two sets of data, 84 hoursmeasuring period, were used for the model identification and validation.A genetic algorithm was used for to determine 11 variables: P1 for sewage outflow: P1S, P1 for Temperature: P1T, P1 for Pressure: P1P, P2 for sewage outflow: P2S, P2 for Temperature: P2T, P2 for Pressure: P2P, P3 for sewage outflow: P3S, P3 for Temperature: P3T, P3 for Pressure: P3P, P4 and P5.
For estimation of model goodness eq. ( 4) was applied.Three different criteria were used for evaluation of the model quality, when checking for the best fit within the learning, testing and the total sum of this both values.The final results of studies aiming determination of the best structure for the different criteria are listed in Table 3.The best fitted structure was meet for the learning sequence (criterion C1).An example time course of active power model identified using the test sequence is shown in Figure 19  Summing up the results it is to conclude that the developed ASP process model using the Hammerstein-Wiener structure allows conducting simulation studies, which concern determination of the amount of energy consumption.The electrical energy is used by the blower in the aerobic reactor of a wastewater treatment plant for aeration.Presented results confirm the efficacy of the developed methodology for application to carry out simulation studies aimed at optimization of the ASP process.

Conclusions
Modeling results of three selected processes occurring in the aeration reactor of wastewater treatment plant are presented in this paper.The Hammerstein-Wiener structure was applied for identification of the process of nitrate nitrogen SNO production, the process of ammonium nitrogen N-NH4production and the process of active power supply AP during aeration.For each of the models identified three criteria were applied: C1: Best fit for the learning sequence FIT(LS), C2: Best fit for the test sequence FIT(TS), C3: Best fit for the sum of the learning and test sequences FIT (LS)+FIT(TS).Analysis of the results allowed for to define the following conclusions: 1.All the models received reproduce relatively correctly the actual measurements.The best fit for the SNO model was found using the criterion C1 for the LS, which was equal to 87.55%.The best fit for the N-NH4 model was found for the criterion C1 for the LS, which was equal to 85.46%.The best fit for the AP model was found by using the criterion C1 within the LS, and which equaled 87.55%.The best fit for the TS was obtained for criterion C2, for all identified models.2. Residuals were differently for each of the models.
For criterion C1, residuals were stochastic and were not correlated with the time courses, by which it can be concluded that the chosen models are appropriate.For other criteria residual values ranged from -4 to 5 mg/dm 3 for both nitrogen models and from -15 to +12 kW for the active power model.3. The achieved results confirmed the hypothesis that it is possible to use a physical model of the ASP based on Hammerstein-Wiener structure for to optimize the wastewater treatment process.

Figure 1 .
Figure 1.The basic principle of Activated Sludge Process.

Figure 2 .
Figure 2. Time course of the nitrate nitrogen NO3-N concentration.In Figure2example time course of the nitrate nitrogen measured within a week is presented.A periodical pattern can be recognized: the values are generally lower at night and higher at mornings.The nitrate nitrogen concentration varies in the range from 4 to 12.5 mg/dm 3 .The average value µ equals 8 mg/dm 3 .

Figure 3 .
Figure 3. Probability density function calculated over the nitrate nitrogen concentration gathered during the measurement campaign.

Figure 4 .
Figure 4. Power spectrum density calculated over the nitrate nitrogen concentration gathered during the measurement campaign.

Figure. 5 .
Figure. 5. Autocovariance function calculated over the nitrate nitrogen concentration gathered during the measurement campaign.

Figure 6 .
Figure 6.Scalegraph calculated over the nitrate nitrogen concentration gathered during the measurement campaign.
course of the ammonium nitrogen concentration measured with two different probes is presented.A periodical pattern can be recognized.But in contrast to the nitrate concentration, ammonium nitrogen indicates higher values

Figure. 7 .
Figure. 7. Time course of the ammonium nitrogen NH 4 -N concentration measured with two different probes.

Figure 8 .
Figure 8. Probability density function calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe.

Figure 9 .
Figure 9. Power spectrum density calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe.

Figure 10 .
Figure 10.Autocovariance function calculated over the ammonium nitrogen concentration gathered during the measurement campaign by the Hach-Lange probe.

Figure 12 .
Figure 12.Time course of the active power applied for particular blowers.

Figure 13 .
Figure 13.Time course of the total blower active power.

Figure 14 .
Figure 14.Probability density function calculated over the active power values.The solid line corresponds to approximation estimated by means of normal distribution.

Figure 15 .
Figure 15.Timing charts of the Hammerstein-Wiener model in response to nitrate nitrogen data contained in the LS (first 84 hours); Identification according to the criterion C1.

Figure 16 .
Figure 16.The residuals of the Hammerstein-Wiener model in response to LS; Identification according to the criterion C1.

Figure 17 .
Figure 17.Time course of the Hammerstein-Wiener model in response to ammonium nitrogen data contained in the LS (first 84 hours); Identification according to the criterion C3.

Figure 18 .
Figure 18.The residuals of the Hammerstein-Wiener model in response to LS; Identification according to the criterion C3.
. The model relatively correctly provides the active power values when based on the given input data.The residuals (Figure 20) are in the range of from -8 to 10 kW.They indicate a single error in the measurement data around the 50th hour of measurement.

Figure 19 .
Figure 19.Timing charts of the Hammerstein-Wiener model in response to active power data contained in the LS (first 84 hours); Identification according to the criterion C2.

Figure 20 .
Figure 20.The residuals of the Hammerstein-Wiener model in response to LS; Identification according to the criterion C2.

Table 1 .
Comparison of the best fit Hammerstein-Wiener structures found for the three considered criteria; output -the nitrate nitrogen S NO concentration, input -sludge flow.

Table 2 .
Comparison of the best fit Hammerstein-Wiener structures found for the three considered criteria; output -the ammonium nitrogen concentration N-NH 4 , input -sludge flow.

Table 3 .
Comparison of the best fit Hammerstein-Wiener structures found for the three considered criteria; output -the active power consumed by the blower.