Abstract: This paper introduces the application of BP artificial neural networks in wastewater treatment. A brief overview of the BP algorithm is provided, along with a detailed explanation of the network's creation and implementation process. Simulation results are analyzed in detail. The simulation results demonstrate that the self-learning capability of the BP network is well-suited for modeling wastewater treatment processes and effectively predicts the COD content of the effluent.
Keywords: BP network; wastewater treatment; modeling
Modeling Study of Activated Sludge Process Based on BP Neural Network
CHI Ming-jie, QI Xing-guang
(School of Electronic Information and Control Engineering, Shandong Institute of Light Industry, Jinan 250353,China)
Abstract: This paper introduced the application of BP artificial neural network in the wastewater treatment and give a detailed description of the realization progress. The simulation results showed that: the BP network, self-learning function is very suitable for sewage treatment process modeling and the quality of COD was predicted very well.
Key words: BP network; Wastewater treatment; modeling;
I. Introduction
Wastewater treatment process models are mathematical models that simulate the main dynamic behaviors and system technological characteristics of various microorganisms and organic nutrients during treatment. Due to the nonlinear, large time-lag, time-varying, and stochastic characteristics of wastewater treatment processes, it is difficult to establish accurate mathematical models. Furthermore, wastewater treatment systems are coupled systems with multiple interacting variables, requiring simultaneous control of multiple variables. Therefore, mechanism-based mathematical models involve numerous parameters, some of which are difficult or impossible to measure directly, making it very challenging to describe the dynamic characteristics of biological wastewater treatment through kinetic models. This paper introduces a highly adaptive and self-learning BP neural network to predict the effluent COD of a wastewater treatment system. Simulation results show that the established model predicts the effluent COD content quite well.
Part Two: Algorithm Introduction
The back-propagation (BP) algorithm consists of two parts [3]: forward propagation of information and backward propagation of error. In the forward propagation process, the signal of the BP network propagates from the input layer through the hidden layer to the output layer, and the neurons in the output layer obtain the input response of the network. The state of each layer of neurons only affects the state of the next layer of neurons. The feedforward information processing method when the BP network is working is a characteristic of the feedforward network. If the expected output is not obtained in the output layer, the error change value of the output layer is calculated, and it is reversed from the output layer through each intermediate layer back to the input layer, thereby correcting each connection weight layer by layer until the expected target value is reached.
Part 3: Design and Training of BP Networks
1. Establishment of the BP neural network model structure
(1) Determination of hidden layers
When training a neural network model, the first step is to determine the number of layers, most importantly the number of hidden layers. Theoretically, a network with biased, sigmoid hidden layers and a linear output layer can approximate any rational function. This indicates that increasing the number of hidden layers can reduce error, but it leads to excessively long training times and large errors for backpropagation (BP) networks. Therefore, we can also consider increasing the number of neurons in the hidden layers to improve training accuracy, and the training effect is more intuitive. Based on the above, we choose one hidden layer in this model.
(2) Determining the number of neurons in the hidden layer
The COD concentration in wastewater treatment plant effluent is affected by multiple factors, primarily including pH value, influent COD concentration, mixed liquor suspended solids (SS) concentration, and ammonia nitrogen. Therefore, the neural network selects four input neurons and one output neuron representing the effluent COD concentration from the wastewater treatment plant.
To date, there is no mature theoretical guidance for determining the number of neurons in the hidden layer of a BP network [2]. The Trial-and-error method is generally used, which involves starting with a smaller number of neurons and gradually increasing the number, repeatedly testing to select the optimal number of neurons. This paper uses some empirical formulas to select the optimal number of neurons in the hidden layer [1]. The formulas are as follows:
Where n is the number of hidden layer neurons; m is the number of input layer neurons; n is the number of output units; and a is a constant between 0 and 10. In this paper, there are 4 input layer neurons and 1 output neuron, and a is chosen to be 4. Therefore, the number of hidden layer neurons in this paper is selected to be 6.
(3) Randomly change the initial weights of the network
If the initial connection weights of the network are the same, the same extreme points can only be searched in each training session, making it difficult to find the neighborhood of the global minimum. Since there are many local minima in the error function, the program must have the ability to randomly change the initial connection weights of the network. The weights and thresholds can be modified according to the following formula [1]:
a: Use the generalized error of each unit in the output layer and the output bj of each unit in the intermediate layer to correct the connection weight vjt and the threshold yi [2].
t=1,2…,q j=1,2…,P, 0 b: Use the generalized error e k j of each unit in the intermediate layer and the input Pk=(a 1 ,a 2 ,..., an ) of each unit in the input layer to correct the connection weight w ij and the threshold.
i=1,2…,q j=1,2…,P, 0<<1
2. Experimental Data Preprocessing
This paper selects 150 sets of data from a sewage treatment plant in Chengde, Hebei Province (Table 1 shows some of the experimental data). In order to improve the learning speed and generalization ability of the network, the input data is first randomly sorted. This is conducive to the network obtaining better generalization ability and can also effectively avoid the danger of the network getting stuck in local minima.
Table 1 Partial Experimental Data
Because the input sample data is relatively scattered, it is not conducive to error adjustment and may cause saturation of weights and thresholds between layers. Therefore, in order to improve the accuracy and training speed of the prediction model, we first standardize the data to normalize the input data to the range [0.1, 0.9]. There are many methods for data normalization; in this paper, we use the following formula to process the data:
L <sub>min </sub> is the minimum value among all input samples, and L <sub>max</sub> is the maximum value among all input samples. After this conversion, the input values of the network are close to a normal distribution.
4. Simulation Result Analysis
This paper selects 150 sets of data, of which 134 sets are used as sample data for training the network. In order to verify the effectiveness of the network, the remaining 16 sets are used as detection data for the network model to analyze the goodness of fit between the actual values and the model predictions.
Figure 1. Error variation curve of COD
(1) As shown in Figure 1, although the BP network has a large error when the number of iterations is small, the network error tends to stabilize after 6500 iterations. Although the training speed is relatively slow, the mean square error of the network at the end of training is 0.00999982, which meets the preset value. After multiple experiments, it was found that the overall performance of the constructed network is relatively stable, and the minimum network error can reach the preset value of 0.01.
Figure 2 Actual and predicted output values of COD
Figure 3. Error curves of the network
(2) As shown in Figure 2, we used a well-trained neural network to test 16 sets of unlearned data. The output curve shows that the model's predicted values and actual values have a relatively ideal fit. In addition, as shown in Figure 3, the relative error is within 3%, indicating that the BP network model has good nonlinear approximation and generalization capabilities. Therefore, in summary, the BP network established after learning is quite successful, and the wastewater treatment model based on the BP neural network is effective and feasible.
IV. Summary
Modeling highly nonlinear wastewater treatment processes with unclear working mechanisms can theoretically achieve good results using neural network technology, which is suitable for modeling nonlinear and black-box systems. It is also convenient to use the established neural network model to predict the quality of effluent, which has high research value and good practical significance.
References
[1] Ge Zhexue, Sun Zhiqiang. Neural Network Theory and MATLAB R2007 Implementation [M]. Electronic Industry Press.
[2] Dong Changhong. MATLAB Neural Networks and Applications [M]. National Defense Industry Press.
[3] Lou Wengao, Liu Suiqing. Modeling and control of activated sludge system based on neural network [J]. Environmental Pollution Control Technology and Equipment, 2006, (8)
[4] Cui Yuli. Research on modeling and simulation of sewage treatment process based on neural network [J]. Master's thesis of Shandong University of Science and Technology.
About the author: Chi Mingjie, male, is a master's student at Shandong University of Light Industry, specializing in intelligent detection and instruments.
Contact information: Phone: 13969159761; Email: [email protected]