CNN-BiGRU model-based sewage treatment dissolved oxygen concentration prediction method

By applying the CNN-BiGRU model in the field of sewage treatment, combined with iForest and BLSA technology, the efficiency and accuracy problems of existing sewage treatment dissolved oxygen concentration prediction methods have been solved, and more efficient and accurate prediction effects have been achieved.

CN119807746APending Publication Date: 2025-04-11CHONGQING UNIV
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202411892235.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The existing wastewater treatment dissolved oxygen concentration prediction methods have problems such as low computational efficiency, insufficient feature extraction ability, lack of adaptability to environmental changes and overfitting risks, and are difficult to meet actual engineering requirements.

Method used

The wastewater treatment dissolved oxygen concentration prediction method based on the CNN-BiGRU model was adopted, and abnormal data were identified and eliminated through iForest. BLSA filled the missing data, CNN extracted the spatial correlation of water quality parameters, and BiGRU used the time dependence in historical data to make predictions.

Benefits of technology

It improves the computing efficiency and feature extraction ability, enhances the robustness and prediction accuracy of the model, can better adapt to environmental changes, and reduces the risk of overfitting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807746A_ABST
    Figure CN119807746A_ABST
Patent Text Reader

Abstract

The invention discloses a sewage treatment dissolved oxygen concentration prediction method based on a CNN-BiGRU model, and the method comprises the steps: obtaining water quality data and time data of a sewage treatment plant, and forming a water quality data set; based on the water quality data set, using iForest to identify abnormal data and removing the abnormal data; based on the vacant data of the water quality data set, performing prediction filling on the vacant data by using BLSA; based on the filled water quality data set, performing normalization processing, and dividing the processed water quality data set into a training set and a test set; constructing a CNN model based on the training set, and extracting effective sequence features in the training set; taking the extracted effective sequence features as input variables and transmitting the input variables to a BiGRU model so as to construct a CNN-BiGRU sewage dissolved oxygen prediction model; testing the CNN-BiGRU sewage dissolved oxygen prediction model by using the test set to obtain a dissolved oxygen prediction value; and the accuracy of the CNN-BiGRU sewage dissolved oxygen prediction model is verified. The method can improve the calculation efficiency and the feature extraction capability, and improves the prediction precision of the dissolved oxygen concentration in sewage treatment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of sewage treatment and artificial intelligence technology, relates to the prediction of dissolved oxygen concentration in sewage treatment, and particularly relates to a method for predicting dissolved oxygen concentration in sewage treatment based on a CNN-BiGRU model. Background Art

[0002] In the field of urban sewage treatment, dissolved oxygen (DO) is a crucial parameter that directly affects the effect of sewage treatment and the quality of effluent. Insufficient dissolved oxygen content will inhibit nitrification, thereby affecting the removal of nitrogen; while excessive dissolved oxygen may cause sludge loosening and increase energy consumption. Therefore, reasonable control of dissolved oxygen content is crucial to the sewage treatment process.

[0003] However, due to the highly nonlinear characteristics of the urban sewage treatment process, the prediction and control of the optimal dissolved oxygen content becomes particularly difficult. Traditional prediction methods are often based on empirical formulas or simple statistical models. These methods are unable to cope with complex and variable water quality data, and the prediction accuracy is difficult to meet the actual engineering requirements.

[0004] In recent years, with the rapid development of machine learning technology, researchers have begun to try to apply it to the prediction of dissolved oxygen in sewage treatment. However, existing machine learning models still face many challenges in the prediction of dissolved oxygen in sewage treatment, such as low computational efficiency, insufficient feature extraction capabilities, lack of adaptability to environmental changes, and high risk of overfitting. These problems limit the practical application of machine learning models in the prediction of dissolved oxygen in sewage treatment. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a method for predicting dissolved oxygen concentration in sewage treatment based on the CNN-BiGRU model. The present invention can effectively improve the computational efficiency and feature extraction capability, improve the robustness, and thus improve the prediction accuracy of dissolved oxygen concentration in sewage treatment.

[0006] The technical solution of the present invention is achieved in this way:

[0007] A method for predicting dissolved oxygen concentration in sewage treatment based on a CNN-BiGRU model comprises the following steps:

[0008] Step 1: Obtain the water quality data of the sewage treatment plant and the time data corresponding to the water quality data to form a water quality data set in which the water quality data and the time data correspond one to one;

[0009] Step 2: Based on the water quality data set, use iForest to identify abnormal data and remove them;

[0010] Step 3: Based on the original missing data and the missing data after elimination of the water quality data set, BLSA is used to predict and fill the missing data;

[0011] Step 4: Based on the filled water quality data set, normalize it and divide the processed water quality data set into a training set and a test set;

[0012] Step 5: Build a CNN model based on the training set obtained in step 4 and extract effective sequence features in the training set;

[0013] Step 6: The effective sequence features extracted in step 5 are passed as input variables to the BiGRU model to construct a CNN-BiGRU sewage dissolved oxygen prediction model;

[0014] Step 7: Use the test set obtained in step 4 to test the CNN-BiGRU sewage dissolved oxygen prediction model. Import the features in the test set except dissolved oxygen as input variables into the CNN-BiGRU sewage dissolved oxygen prediction model to obtain the predicted dissolved oxygen value; and calculate the mean absolute error, mean absolute percentage error, root mean square error and determination coefficient to verify the accuracy of the CNN-BiGRU sewage dissolved oxygen prediction model.

[0015] Furthermore, the water quality data includes inlet and outlet water COD, inlet and outlet water BOD, inlet and outlet water SS, inlet and outlet water TN, inlet and outlet water AN, outlet water TP, oxidation-reduction potential, aerobic pool DO, MLSS, and SV30.

[0016] Furthermore, in step 2, using iForest to identify abnormal data and remove it specifically includes the following steps:

[0017] Step 2.1: Use PCA to reduce the data in the water quality dataset to two dimensions;

[0018] Step 2.2: Construct multiple isolation trees based on two-dimensional data;

[0019] Step 2.3: For each sample in the water quality dataset, calculate its path length in each isolated tree;

[0020] Step 2.4: Calculate the anomaly score based on the average path length of each sample in all isolated trees;

[0021] Step 2.5: Samples with anomaly scores exceeding the set threshold are identified as abnormal data and then removed from the water quality dataset.

[0022] Furthermore, in step 3, using BLSA to predict and fill in the missing data specifically includes the following steps:

[0023] Step 3.1: Construct BLSA model;

[0024] Step 3.2: Select a variable with missing data as the target variable and the remaining variables as predictor variables;

[0025] Step 3.3: Construct the input vector in a sliding window manner;

[0026] Step 3.4: Use the input vector to train the BLSA model and use the trained BLSA model to predict and fill in the missing data.

[0027] Furthermore, in step 6, the specific steps of constructing the CNN-BiGRU sewage dissolved oxygen prediction model include:

[0028] Step 6.1: Model the extracted valid sequence features based on the BiGRU encoder and convert them into feature vectors;

[0029] Step 6.2: Introduce the temporal attention mechanism into the BiGRU network, assign different weights to different feature variables at the same time step, so as to obtain the dependency relationship between different feature variables at different time steps and realize the extraction of the intrinsic connection of the time series;

[0030] Step 6.3: Input the weighted feature vector into the BiGRU decoder for calculation;

[0031] Step 6.4: The feature vector is sequentially decoded through the BiGRU network in the BiGRU decoder. After the output of the BiGRU network passes through the output activation layer, continuous prediction results are generated at prediction time steps of indefinite length to obtain the predicted value of sewage operation data.

[0032] Compared with the prior art, the present invention has the following beneficial effects:

[0033] 1. The present invention uses the iForest model to identify and remove abnormal data in the data preprocessing stage, which can effectively reduce the impact of abnormal data on model training and improve the reliability and accuracy of data. At the same time, for missing data, the present invention uses the BLSA model for prediction and filling, which can effectively avoid prediction errors caused by missing data. The BLSA model is constructed into an input vector through a sliding window, and combined with structures such as the Bi-LSTM layer and the Self-attention layer, it can make full use of context information to accurately predict missing values, thereby ensuring the integrity and consistency of the data.

[0034] 2. The present invention adopts the method of fusing CNN and BiGRU neural networks to predict the dissolved oxygen content. The local feature extraction capability of CNN can effectively capture the spatial correlation and local characteristics of water quality parameters, while the time series prediction advantage of BiGRU can make full use of the time dependence in historical data. The combination of the two can more comprehensively capture the law of changes in water quality parameters over time, thereby improving the accuracy and robustness of the prediction.

[0035] 3. The method for predicting dissolved oxygen concentration in sewage treatment of the present invention can monitor and predict dissolved oxygen concentration in real time, thereby helping sewage treatment plants to optimize operating parameters, improve treatment efficiency, and reduce energy consumption and costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 - Flowchart of the present invention. DETAILED DESCRIPTION

[0037] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0038] See also Figure 1 , a method for predicting dissolved oxygen concentration in sewage treatment based on CNN-BiGRU model, comprising the following steps:

[0039] Step 1: Use sensors to obtain water quality data of the sewage treatment plant and the time data corresponding to the water quality data, forming a water quality data set in which the water quality data and the time data correspond one to one; the water quality data includes but is not limited to inlet and outlet water COD, inlet and outlet water BOD, inlet and outlet water SS, inlet and outlet water TN, inlet and outlet water AN, outlet water TP, redox potential, aerobic pool DO, MLSS, and SV30.

[0040] Water quality data such as inlet and outlet COD, inlet and outlet BOD, inlet and outlet SS, inlet and outlet TN, inlet and outlet AN, outlet TP, redox potential, aerobic tank DO, MLSS, and SV30 are what need to be monitored in the daily operation of sewage treatment plants. They are easy to obtain and have a high correlation with dissolved oxygen. By obtaining these data, the accuracy of dissolved oxygen concentration prediction in sewage treatment can be effectively improved.

[0041] Dissolved oxygen concentration is usually time-dependent, that is, the current dissolved oxygen concentration may be affected by the concentration at past time points, environmental conditions or other factors. Here, obtaining the corresponding time data while obtaining water quality data is conducive to improving the accuracy of subsequent solubility concentration predictions.

[0042] Step 2: Based on the water quality data set, use iForest to identify abnormal data and remove them. The specific implementation includes the following steps:

[0043] Step 2.1: Use PCA to reduce the data in the water quality dataset to two dimensions;

[0044] Step 2.2: Construct multiple isolation trees based on two-dimensional data;

[0045] Step 2.3: For each sample in the water quality dataset, calculate its path length in each isolated tree;

[0046] Step 2.4: Calculate the anomaly score based on the average path length of each sample in all isolated trees;

[0047] Step 2.5: Samples with anomaly scores exceeding the set threshold are identified as abnormal data and then removed from the water quality dataset.

[0048] In specific applications, the dissolved oxygen concentration is used as the main characteristic variable, and other water quality indicators are other characteristic variables. PCA is used to reduce the data to two dimensions; multiple isolated trees are generated based on the data, and each isolated tree is independently constructed by randomly selecting features and split points to form a forest structure of the model; then the model parameters are set, the sample path length is calculated, and the anomaly score of each sample is calculated based on the average path length of all isolated trees; the higher the anomaly score, the more likely the sample is an abnormal data, and samples with anomaly scores exceeding the set threshold are identified as abnormal data and removed from the water quality data set. This process can be achieved by setting a reasonable threshold to ensure the accurate identification and removal of abnormal data. The threshold is set using the pollution rate in specific implementation.

[0049] In terms of iForest parameter settings, the number of trees is set to 100, the number of samples is 300, the contamination rate is 0.05, and the random seed is 42 to ensure the repeatability of the results. The contamination rate refers to the expected proportion of outliers in the data set. In this model, the contamination rate is 0.05, that is, the data ranked in the top 5% of the anomaly scores from large to small are judged as abnormal data.

[0050] Step 3: Based on the missing data in the water quality dataset and the missing data after removal, use BLSA to predict and fill the missing data. The specific implementation includes the following steps:

[0051] Step 3.1: Construct BLSA model;

[0052] Step 3.2: Select a variable with missing data as the target variable and the remaining variables as predictor variables;

[0053] Step 3.3: Construct the input vector in a sliding window manner;

[0054] Step 3.4: Use the input vector to train the BLSA model and use the trained BLSA model to predict and fill in the missing data.

[0055] During operation, a BLSA model is constructed with an input layer, a Bi-LSTM layer, a Self-attention layer, a fully connected layer, and an output layer; a variable containing missing data is selected as the target variable, and the remaining variables are used as predictor variables; an input vector is constructed in a sliding window manner, and the size and step size of the sliding window can be set according to the characteristics of the data and the requirements of the model, so as to extract continuous and overlapping segments from time series data or related variables as input vectors; the BLSA model is trained using the input vector. During the training process, the input vector is input into the Bi-LSTM layer through the input layer for feature extraction, and then passes through the Self-attention layer for feature weighting, and finally obtains the predicted missing value through the fully connected layer and the output layer.

[0056] The operation process of urban sewage treatment is prone to data anomaly, high data outlier, and serious data missing. According to research, due to the complex operation environment of sewage treatment and large process interference, about 10% of the data collected by sensors is lost, and 3%-35% of the data is classified as suspicious data. For example, the collection of traditional sewage treatment plant operation data relies on manual labor, which is inefficient and prone to data errors. Power outages can cause data missing, internal sensor failures can cause data transmission or storage errors, and severe weather conditions usually cause data to deviate from the true value. However, data quality is a key factor affecting model reliability, and abnormal data can hardly provide reliable information for state estimation and performance analysis of urban sewage treatment processes. Here, detecting abnormal data and processing the abnormal and missing parts of the data set are important prerequisites for reliably predicting the dissolved oxygen concentration required for aeration tanks.

[0057] Step 4: Based on the filled water quality dataset, normalize it and divide the processed water quality dataset into training set and test set.

[0058] In the specific implementation, the Z-score Normalization method is used to perform dimensionless processing on the complete data set. The formula is: Where w i is the data after variable normalization, x i is the sample sequence, is the sample mean, and s is the sample standard deviation. A sample sequence is composed of a series of data arranged in chronological order. For example, all the influent BOD in the water quality data set belongs to a set of sample sequences. The processed water quality data set is divided into a training set and a test set in a ratio of 8:2.

[0059] Step 5: Build a CNN model based on the training set obtained in step 4 to extract effective sequence features in the training set. The specific implementation includes the following steps:

[0060] Step 5.1: Build a CNN model, use the training set to train the CNN model, select different numbers of convolutional layers to build the model and train it, and determine the optimal number of convolutional layers;

[0061] Step 5.2: Select the ReLU function as the activation function. The ReLU function can effectively solve the gradient vanishing problem, and the gradient of ReLU will not tend to zero, so that the gradient maintains a large value during the back propagation process, thereby accelerating the convergence of the model. And due to its sparse activation characteristics, it can also improve the generalization ability and classification performance of the model;

[0062] Step 5.3: Select Adam as the optimizer. Adam function is more prominent in improving adaptive learning rate and finding the global optimal point.

[0063] Step 5.4: Select same padding as the feature edge processing method to ensure that edge pixels can also be fully processed by the convolution kernel, thereby retaining the edge information of the image. At the same time, it can keep the input and output feature map sizes consistent, simplifying the model design and layer connection.

[0064] Step 6: Based on the effective sequence features extracted in step 5, they are passed as input variables to the BiGRU model to construct a CNN-BiGRU sewage dissolved oxygen prediction model. The specific implementation includes the following steps:

[0065] Step 6.1: Model the extracted valid sequence features based on the BiGRU encoder and convert them into feature vectors;

[0066] Step 6.2: Introduce the temporal attention mechanism into the BiGRU network, assign different weights to different feature variables at the same time step, so as to obtain the dependency relationship between different feature variables at different time steps and realize the extraction of the intrinsic connection of the time series;

[0067] Step 6.3: Input the weighted feature vector into the BiGRU decoder for calculation;

[0068] Step 6.4: The feature vector is sequentially decoded through the BiGRU network in the BiGRU decoder. After the output of the BiGRU network passes through the output activation layer, continuous prediction results are generated at prediction time steps of indefinite length to obtain the predicted value of sewage operation data.

[0069] Step 7: Use the test set obtained in step 4 to test the CNN-BiGRU sewage dissolved oxygen prediction model. Import the features in the test set except dissolved oxygen as input variables into the CNN-BiGRU sewage dissolved oxygen prediction model to obtain the predicted dissolved oxygen value; and calculate the mean absolute error, mean absolute percentage error, root mean square error and determination coefficient to verify the accuracy of the CNN-BiGRU sewage dissolved oxygen prediction model.

[0070] The specific calculation formula of mean absolute error (MAE) is as follows:

[0071]

[0072] The specific calculation formula for the mean absolute percentage error (MAPE) is as follows:

[0073]

[0074] The specific calculation formula of the root mean square error (RMSE) is as follows:

[0075]

[0076] Coefficient of determination (R 2 ) is calculated as follows:

[0077]

[0078] In formula (1) to formula (4), y′ i is the predicted value of dissolved oxygen, y i is the true value of dissolved oxygen, is the mean value of dissolved oxygen samples.

[0079] The evaluation index results of the CNN-BiGRU sewage dissolved oxygen prediction model are as follows:

[0080]

[0081] As can be seen from the table above, the mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean square error (RMSE) are all low, while the coefficient of determination (R 2 ) is higher, which shows that the prediction accuracy of the CNN-BiGRU sewage dissolved oxygen prediction model is higher and can better meet the actual engineering needs. At the same time, according to the mean absolute percentage error, the prediction accuracy of the test set data AR = 1-MAPE = 93.2%, which has good prediction accuracy.

[0082] Finally, it should be noted that the above embodiments of the present invention are only examples for illustrating the present invention, and are not intended to limit the implementation methods of the present invention. For those skilled in the art, other different forms of changes and modifications can be made based on the above description. It is impossible to list all implementation methods here. Any obvious changes or modifications derived from the technical solution of the present invention are still within the scope of protection of the present invention.

Claims

1. A method for predicting dissolved oxygen concentration in sewage treatment based on CNN-BiGRU model, characterized in that: The following steps are involved: Step 1: Obtain the water quality data of the sewage treatment plant and the time data corresponding to the water quality data to form a water quality data set in which the water quality data and the time data correspond one to one; Step 2: Based on the water quality data set, use iForest to identify abnormal data and remove them; Step 3: Based on the original missing data and the missing data after elimination of the water quality data set, BLSA is used to predict and fill the missing data; Step 4: Based on the filled water quality data set, normalize it and divide the processed water quality data set into a training set and a test set; Step 5: Build a CNN model based on the training set obtained in step 4 and extract effective sequence features in the training set; Step 6: The effective sequence features extracted in step 5 are passed as input variables to the BiGRU model to construct a CNN-BiGRU sewage dissolved oxygen prediction model; Step 7: Use the test set obtained in step 4 to test the CNN-BiGRU sewage dissolved oxygen prediction model. Import the features in the test set except dissolved oxygen as input variables into the CNN-BiGRU sewage dissolved oxygen prediction model to obtain the predicted dissolved oxygen value; and calculate the mean absolute error, mean absolute percentage error, root mean square error and determination coefficient to verify the accuracy of the CNN-BiGRU sewage dissolved oxygen prediction model.

2. The method for predicting dissolved oxygen concentration in sewage treatment based on the CNN-BiGRU model according to claim 1, characterized in that: The water quality data include inlet and outlet water COD, inlet and outlet water BOD, inlet and outlet water SS, inlet and outlet water TN, inlet and outlet water AN, outlet water TP, redox potential, aerobic pool DO, MLSS, and SV30.

3. The method for predicting dissolved oxygen concentration in sewage treatment based on the CNN-BiGRU model according to claim 1, characterized in that: In step 2, using iForest to identify abnormal data and remove it specifically includes the following steps: Step 2.1: Use PCA to reduce the data in the water quality dataset to two dimensions; Step 2.2: Construct multiple isolation trees based on two-dimensional data; Step 2.3: For each sample in the water quality dataset, calculate its path length in each isolated tree; Step 2.4: Calculate the anomaly score based on the average path length of each sample in all isolated trees; Step 2.5: Samples with anomaly scores exceeding the set threshold are identified as abnormal data and then removed from the water quality dataset.

4. A method for predicting dissolved oxygen concentration in sewage treatment based on a CNN-BiGRU model according to claim 1 or 3, characterized in that: In step 3, using BLSA to predict and fill in the missing data specifically includes the following steps: Step 3.1: Construct BLSA model; Step 3.2: Select a variable with missing data as the target variable and the remaining variables as predictor variables; Step 3.3: Construct the input vector in a sliding window manner; Step 3.4: Use the input vector to train the BLSA model and use the trained BLSA model to predict and fill in the missing data.

5. The method for predicting dissolved oxygen concentration in sewage treatment based on the CNN-BiGRU model according to claim 1, characterized in that: In step 6, the specific steps of constructing the CNN-BiGRU sewage dissolved oxygen prediction model include: Step 6.1: Model the extracted valid sequence features based on the BiGRU encoder and convert them into feature vectors; Step 6.2: Introduce the temporal attention mechanism into the BiGRU network, assign different weights to different feature variables at the same time step, so as to obtain the dependency relationship between different feature variables at different time steps and realize the extraction of the intrinsic connection of the time series; Step 6.3: Input the weighted feature vector into the BiGRU decoder for calculation; Step 6.4: The feature vector is sequentially decoded through the BiGRU network in the BiGRU decoder. After the output of the BiGRU network passes through the output activation layer, continuous prediction results are generated at prediction time steps of indefinite length to obtain the predicted value of sewage operation data.

Citation Information

Patent Citations

  • Mutual inductor abnormity monitoring method and system based on edge computing

    CN113391239A

  • River total nitrogen concentration prediction method based on hybrid neural network

    CN113408799A

  • Water quality prediction method and device

    CN114169638A

  • Water pollution time series data continuous missing value filling method

    CN115809947A

  • Short-term traffic flow prediction method based on CLA-BLSA model

    CN116453335A