Sewage treatment plant water quality prediction method based on improved transformer deep learning model

By using an improved transformer deep learning model and wavelet transform technology, a water quality prediction model for wastewater treatment plants was constructed. This solved the problem of applying traditional models in complex wastewater treatment scenarios, achieving efficient and intelligent water quality prediction and improving wastewater treatment efficiency and water management effectiveness.

CN119272926AInactive Publication Date: 2025-01-07HUBEI ENVIRONMENTAL REMEDIATION & TREATMENT TECH RES CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411334036.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional biochemical reaction mechanism models are difficult to apply effectively in wastewater treatment plants, mainly because drainage pipelines are large in scale, transport time is long, drainage routes are long, hydraulic retention time is sufficient, pollutant concentration is high, water quality is complex, and various types of wastewater have their own unique stoichiometric coefficients and kinetic parameters, which makes parameter measurement complicated.

Method used

An improved transformer deep learning model is used, combined with wavelet transform noise removal technology and LSTM decoding layer, to construct a water quality prediction model for wastewater treatment plants. Through the collection, cleaning, preprocessing and training of data, accurate prediction of future water quality is achieved.

Benefits of technology

It has improved the accuracy and intelligence of water quality prediction in wastewater treatment plants, reduced the cost of water quality prediction, and provided efficient and energy-saving support for urban water protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272926A_ABST
    Figure CN119272926A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of deep learning, and relates to a sewage treatment plant water quality prediction method based on an improved transformer deep learning model, which comprises the steps of collecting sewage water quality monitoring data including chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow of a sewage treatment plant at different moments, performing data cleaning, and performing noise removal based on wavelet transform. The method comprises the following steps: preprocessing sewage water quality monitoring data to obtain processed sewage water quality monitoring data to establish a data set, constructing a water quality prediction model of a sewage treatment plant based on an improved transformer deep learning model, inputting parameters in the preprocessed sewage water quality monitoring data set training model, and predicting the water quality of the sewage treatment plant based on the trained improved transformer sewage water quality prediction model. According to the invention, through improving the transformer deep learning model, modeling is carried out on sewage quality monitoring data and other long time sequence data with strong time sequence characteristics based on the attention mechanism, the prediction precision of the sewage quality can be improved, intelligent water quality prediction of a sewage treatment plant is realized, and the water quality prediction cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning, and in particular relates to a method for predicting water quality in a sewage treatment plant based on an improved transformer deep learning model. Background Art

[0002] With the gradual acceleration of urbanization, the rapid development of cities has led to a sharp increase in sewage discharge, which has had a serious impact on urban water environment and water ecology. In order to protect urban water bodies, sewage treatment plants have become necessary infrastructure for the healthy development of cities. By predicting sewage quality, it can provide data support for sewage treatment in the plant, dynamically adjust each link of sewage treatment according to the predicted water quality, and achieve efficient and energy-saving sewage treatment. At the same time, it is also helpful to study the movement laws and water quality transformation processes of urban sewage through the prediction of sewage quality. Therefore, it is extremely necessary to establish a water quality prediction model for sewage treatment plants and realize the prediction of sewage quality.

[0003] Although the International Water Association has developed an activated sludge model that can describe the metabolic process of pollutants in sewage under the action of microorganisms, and use it as a traditional biochemical reaction mechanism model to predict sewage quality, due to the large scale of drainage pipes in sewage treatment plants, long transfer time, long drainage routes, sufficient hydraulic retention time, high pollutant concentration, complex water quality conditions, and each type of sewage has its own unique stoichiometric coefficients and kinetic parameters, the complex parameter measurement method makes it difficult to use the traditional biochemical reaction mechanism model in reality, and there are many limitations.

[0004] Therefore, in view of the shortcomings of the above-mentioned scheme in actual production and implementation, it was revised and improved. At the same time, in the spirit and concept of seeking excellence, with the assistance of professional knowledge and experience, and after many ingenuity and experiments, the present invention was created to provide a water quality prediction method for a sewage treatment plant based on an improved transformer deep learning model to solve the problem. Summary of the invention

[0005] The present invention proposes a method for predicting water quality in sewage treatment plants based on an improved transformer deep learning model, which solves the problems in the prior art that the drainage pipes in sewage treatment plants are large in scale, the transfer time is long, the drainage routes are long, the hydraulic retention time is sufficient, the pollutant concentration is high, the water quality is complex, and each type of sewage has its own unique stoichiometric coefficient and kinetic parameters. The complex parameter measurement method makes it difficult to use traditional biochemical reaction mechanism models in reality.

[0006] The technical solution of the present invention is implemented as follows: a method for predicting water quality in a sewage treatment plant based on an improved transformer deep learning model, characterized in that it includes the following processes:

[0007] S1. Collect sewage water quality monitoring data including chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow at different times of the sewage treatment plant and perform data cleaning;

[0008] S2. Preprocess the sewage water quality monitoring data based on the noise removal technology of wavelet transform to obtain the processed sewage water quality monitoring data to establish a data set;

[0009] S3. Build a water quality prediction model for sewage treatment plants based on the improved transformer deep learning model;

[0010] S4, inputting the parameters of the pre-treated sewage water quality detection data set training model to optimize the accuracy of model prediction;

[0011] S5. Based on the trained improved transformer sewage quality prediction model, the water quality of the sewage treatment plant in the future is predicted according to the real-time collected water quality monitoring data.

[0012] As a preferred implementation, the collecting of sewage quality monitoring data at different times of the sewage treatment plant and data cleaning in S1 include:

[0013] The water quality monitoring data of sewage treatment plants at different times are collected by using water quality sensors and installed at the downstream position of the intersection of sewage pipes to ensure the accuracy of water quality monitoring. Sewage flows to the node in the pipeline, intersects at the node, and continues to flow downstream along the pipeline. The sensor is fixed at the node. In order to avoid the influence of water turbulence caused by water flow convergence on the pipeline, the probe should be fixed in the pipeline leading to the downstream and penetrated a certain distance to ensure that the sewage flow state is stable before data collection and transmission;

[0014] The sewage water quality monitoring data collected at different times of the sewage treatment plant includes five data items, including COD, ammonia nitrogen, pH, temperature and flow, through the deployed sensors. It is assumed that each set of sewage water quality monitoring data is f(t), which includes five data parameters of each sensor monitoring point, and the data is recorded every 2 hours and continuously recorded for 474 days. A total of 5688 sets of sewage water quality monitoring data are obtained, and the data set is divided into a training set: test set ratio of 7:3;

[0015] The data cleaning of sewage water quality monitoring data is because the accuracy of the data set is crucial for the training of the water quality prediction model of the sewage treatment plant. In the data collection process, it is very easy to have data missing, data anomalies and other problems caused by uncontrollable factors such as equipment failure and improper human operation. When collecting and testing data, data cleaning is required, which mainly fills in missing data and removes abnormal data, and uses the mean smoothing method to complete the missing data:

[0016] For the chemical nitrogen demand (COD) data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0017]

[0018] Among them, x_COD a is the missing data of chemical nitrogen demand (COD) in the sewage quality monitoring data at time a, x_COD a-1 is the normal data of chemical nitrogen demand COD in the sewage quality monitoring data at time a-1, x_COD a+1 It is the normal data of chemical nitrogen demand COD in the sewage quality monitoring data at time a+1;

[0019] For the ammonia nitrogen data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0020]

[0021] Among them, x_NH a is the missing data of ammonia nitrogen in the sewage quality monitoring data at time a, x_NH a-1 is the normal data of ammonia nitrogen in the sewage water quality monitoring data at time a-1, x_NH a+1 It is the normal data of ammonia nitrogen in the sewage water quality monitoring data at time a+1;

[0022] For the pH data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0023]

[0024] Among them, x_pH a is the missing pH data in the sewage quality monitoring data at time a, x_pH a-1 is the normal pH data in the sewage quality monitoring data at time a-1, x_pH a+1 It is the normal pH data in the sewage quality monitoring data at time a+1;

[0025] For the temperature data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0026]

[0027] Among them, x_temp a is the missing temperature data in the sewage quality monitoring data at time a, x_temp a-1 is the normal temperature data in the sewage quality monitoring data at time a-1, x_temp a+1 It is the normal temperature data in the sewage quality monitoring data at time a+1;

[0028] For the flow data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0029]

[0030] Among them, x_flow a is the missing flow data in the sewage quality monitoring data at time a, x_flow a-1 is the normal flow data in the sewage quality monitoring data at time a-1, x_flow a+1 It is the normal flow data in the sewage quality monitoring data at time a+1;

[0031] After the data cleaning process, each group of sewage water quality monitoring data is obtained as F(t). Each group of sewage water quality monitoring data contains five data items: chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow rate, which are used as input for denoising using noise removal technology based on wavelet change in the subsequent present invention.

[0032] As a preferred implementation, the noise removal technology based on wavelet transform in S2 pre-processes the sewage quality monitoring data, and the process includes:

[0033] The wavelet transform-based noise removal technology is used to pre-process the sewage quality monitoring data to deal with the situation that although the quality of the sewage quality monitoring data has been improved after data cleaning, there is still a situation where excessive sewage is not detected. In addition, pollutants in the sewage may also adhere to the probe, causing unreasonable fluctuations in the monitoring data, which in turn leads to noise pollution in the sewage quality monitoring data.

[0034] The main process of the noise removal technology based on wavelet transform is as follows: Figure 1 As shown in the figure, it uses a finite-length wavelet basis that decays over time to decompose the sewage quality monitoring data into two-dimensional time-frequency information. When extracting local information in the time domain, it can also extract frequency domain information, and can quickly process non-stationary mutation signals that are difficult to fit.

[0035] The noise removal technology based on wavelet transform is mainly used to pre-process the sewage water quality monitoring data by discrete wavelet transform, and its calculation formula is as follows:

[0036]

[0037] Among them, W f (j, k) represents the coefficient of discrete wavelet, f(t) represents the sewage quality monitoring data after data cleaning, a represents the scale factor, Represents ψ j,k The conjugate function of (t), ψ j,k (t) represents the wavelet basis function, and its calculation formula is as follows:

[0038]

[0039] Among them, a0 represents the discretization form of the scale factor, and b0 represents the discretization form of the translation factor;

[0040] After data cleaning, each sewage water quality monitoring data is decomposed by discrete wavelet transform into a low-frequency approximate signal and a series of high-frequency detail signals, among which the low-frequency signal can be further decomposed until the maximum number of decompositions is reached. The data decomposition process is carried out using low-pass filters and high-pass filters;

[0041] Since the number of sample points in the decomposed sequence obtained based on wavelet transform is less than that in the original sequence, and the prediction model preferably has an input of uniform length, the result after wavelet transform decomposition is used as the input of the wavelet reconstruction process, and the data of the dimension of chemical nitrogen demand COD is converted into a new low-frequency signal rA_COD n and a series of new high frequency signals [rD_COD1, rD_COD2, ···, rD_COD n ], converting the data of ammonia nitrogen into a new low-frequency signal rA_NH n and a series of new high-frequency signals [rD_NH1, rD_NH2, ···, rD_NH n ], converting the pH dimension data into a new low-frequency signal rA_pH n and a series of new high-frequency signals [rD_pH1, rD_pH2, ···, rD_pH n ], converting the temperature dimension data into a new low-frequency signal rA_temp n and a series of new high-frequency signals [rD_temp1, rD_temp2, ···, rD_temp n ], converting the data of flow dimension into a new low-frequency signal rA_flow n and a series of new high-frequency signals [rD_flow1,rD_flow2,···,rD_flow n ]. And finally make the sequence length consistent with the original sequence.

[0042] The result after wavelet transform decomposition is used as the input of the wavelet reconstruction process to reconstruct the sewage water quality monitoring data after data denoising treatment with the same length as the original sequence. The calculation formula is:

[0043]

[0044] Among them, C ψ represents the permissible condition of discrete wavelet transform, that is ψ(ω) represents the Fourier transform form of the wavelet basis function, ω represents the frequency, R represents the range of the discretized form of the scale factor and the translation factor, and the range of the scale factor a is a=1,2,4,...,2 n-1 , the value range of the translation factor b is b=1,2,3...,n;

[0045] Finally, based on the noise removal technology of wavelet transform, the present invention realizes noise reduction processing by inputting each sewage water quality monitoring data after data cleaning, and obtains the sewage water quality monitoring data F(t) after data preprocessing;

[0046] As a preferred implementation, the water quality prediction model of the sewage treatment plant is constructed based on the improved transformer deep learning model in S3, and the process includes:

[0047] The sewage treatment plant water quality prediction model based on the improved transformer is mainly composed of a position encoding layer, a transformer encoding layer and an LSTM decoding layer.

[0048] The position encoding layer is located before the transformer encoding layer. It takes the sewage water quality monitoring data F(t) after data preprocessing as input, provides corresponding data position information for model operation, and outputs the result intermediate_positionlayer that provides corresponding data position information for model operation.

[0049] In the position encoding process, the data is separated according to the odd-even arrangement and the corresponding data position information is assigned respectively. The calculation formula is:

[0050]

[0051] Among them, i represents the time step of the sewage monitoring data F(t), s represents the dimension corresponding to the sewage monitoring data F(t), which includes chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow, d represents the data encoding of the corresponding position, and the sewage water quality monitoring data through position encoding is given a sequential encoding. At the end of the position encoding, the local position feature extraction result is expressed. The calculation formula is:

[0052] y i =e i +p i (11)

[0053] Among them, e i represents the local position feature extraction result, p i Represents the position encoding information, through the position encoding and local feature extraction data y i It can have both data location information and feature information, and provide input for the transformer encoding layer;

[0054] The transformer encoding layer takes the intermediate result intermediate_positionlayer output by the position encoding layer as input, and outputs the intermediate_transformerlayer which can provide the data result with attention for the sewage treatment plant water quality prediction model based on the improved transformer of the present invention.

[0055] The data processed by the transformer coding layer can provide more features when predicting the water quality of the sewage treatment plant. The sewage water quality monitoring data generates attention to the data through the dot product operation of the transformer coding layer, and is processed in parallel through multiple transformer coding layers. The main structure of the transformer coding layer is the multi-head attention mechanism and the feedforward layer. After each multi-head attention mechanism and feedforward layer, a layer normalization operation is added. The sewage water quality monitoring data processed by layer normalization can reduce problems such as gradient explosion and improve network stability. Finally, the characteristics of the sewage water quality monitoring data are retained to a certain extent during the data processing process. Two linear addition layers are added to the coding layer to achieve the effect of improving the model feature learning;

[0056] The core part of the transformer encoding layer is the multi-head attention mechanism, which is the key part of the improved transformer-based sewage treatment plant water quality prediction model to achieve accurate prediction. The multi-head attention mechanism is composed of multiple heads with self-attention. The self-attention process in the multi-head attention mechanism can be described as a process solved by a query vector and a set of key-value vector matrices, where the query vector Q, the key vector K and the weight vector V are converted from the output;

[0057] The output calculation result is a weighted value, which is obtained by the compatibility operation between the query vector and the key vector. As the input of the multi-head self-attention module, the key vector, weight vector and query vector are calculated as follows:

[0058]

[0059]

[0060] in, For the trainable projection matrix, the derived result is used to calculate the proportional dot product attention. The calculation formula is as follows:

[0061]

[0062] In order to jointly focus on information from different representation subspaces at different positions, further optimization is required, using H parallel attention calculations. In this case, the calculation process of the multi-head attention mechanism is as follows:

[0063]

[0064] in, Concat() represents the concatenation function, which is used to concatenate the results of each set of self-attention and finally output the intermediate result intermediate_transformerlayer as the input of the LSTM decoding layer;

[0065] The transformer encoding layer also implements the function through the feed-forward layer. The feed-forward network consists of two linear transformations connected by a ReLU activation function, which is applied separately and identically to each time step.

[0066] The LSTM decoding layer is mainly used to reconstruct the decoding layer of the original transformer in the sewage treatment plant water quality prediction model based on the improved transformer of the present invention;

[0067] The linear rectification of the LSTM decoding layer can convert the result data of the transformer encoding layer into a format that matches the LSTM hidden layer, thereby providing input data for the LSTM;

[0068] The LSTM decoding layer is composed of an LSTM operation layer input gate, a forget gate, an output gate, and a cell state. The LSTM decoding layer takes the transformer encoding layer data intermediate_transformerlayer, the hidden layer data at the previous moment, and the cell state output at the previous moment as common inputs, processes the data serially through a gating mechanism, realizes data processing, and finally outputs the hidden layer data at the current moment and the cell state output at the current moment, which is the prediction result of sewage quality monitoring.

[0069] As a preferred embodiment, the parameters in the training model of the pre-treated sewage water quality detection data set are input in S4 to optimize the accuracy of model prediction. The process includes:

[0070] The data processing process is divided into intra-unit data processing and inter-unit data processing. The data is transmitted in two ways to achieve the prediction of sewage quality. The intra-unit processing is responsible for parallel data processing, and the inter-unit processing is responsible for serial data processing. The specific process is as follows: Figure 6 As shown;

[0071] The data processing within the unit relies on the mutually independent position encoding layer, transformer encoding layer and LSTM decoding layer within the unit. The new sewage water quality monitoring data at each moment of input is position encoded and transformer encoded. The encoded data can retain more features to ensure that the signal attenuation degree is reduced during the sewage water quality prediction process. The data processing between units is realized by the LSTM decoding layer. The output result of the previous LSTM decoding layer is used as the input of the subsequent LSTM decoding layer to realize the serial data processing capability of the network and improve the prediction ability of the network.

[0072] The training model process uses the sewage water quality detection data after noise reduction as input, including chemical nitrogen demand COD, ammonia nitrogen, temperature, pH and flow rate obtained by the monitoring point sensors. During the model training process, the Adam optimizer is used as the optimization method, the mean square error is selected as the loss function, and the hyperparameters in the model such as learning rate, momentum and weight decay are adjusted to achieve the purpose of improving the model performance. At the same time, the test set is used to evaluate the model, and the final trained sewage treatment plant water quality prediction model based on the improved transformer is obtained.

[0073] As a preferred implementation, the improved transformer sewage water quality prediction model after training in S5 predicts the water quality of the sewage treatment plant for a period of time in the future according to the real-time collected water quality monitoring data. The process includes:

[0074] (1) Collect sewage water quality monitoring data from sewage treatment plants and perform data cleaning to obtain sewage water quality monitoring data sets;

[0075] (2) Using wavelet transform to pre-process the raw sewage quality monitoring data for noise reduction;

[0076] (3) Build a sewage treatment plant water quality prediction model based on the improved transformer deep learning model;

[0077] (4) Inputting the sewage quality monitoring data after noise reduction to train the model;

[0078] (5) Use the trained and tested model to predict the sewage quality of the sewage treatment plant in the future.

[0079] After adopting the above technical solution, the beneficial effect of the present invention is: by improving the transformer deep learning model, modeling is performed based on the attention mechanism for long time series data such as sewage water quality monitoring data with strong time series characteristics, which helps to improve the prediction accuracy of sewage water quality, realize intelligent water quality prediction of sewage treatment plants, reduce the cost of water quality prediction, and provide guarantee for the long-term efficient, energy-saving and stable operation of the process of protecting urban water bodies. This will bring more efficient and intelligent application solutions to sewage treatment plants in the field of sewage water quality prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0081] Figure 1 It is a flow chart of wavelet transform denoising of the present invention;

[0082] Figure 2 It is a structural diagram of the position coding layer of the present invention;

[0083] Figure 3 The transformer coding layer structure diagram of the present invention;

[0084] Figure 4 This is a structural diagram of the LSTM decoding layer of the present invention;

[0085] Figure 5 This is a structural diagram of a sewage treatment plant water quality prediction model based on an improved transformer according to the present invention;

[0086] Figure 6 It is a schematic diagram of data transmission of the present invention; DETAILED DESCRIPTION

[0087] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0088] A method for predicting water quality in a sewage treatment plant based on an improved transformer deep learning model, characterized in that it includes the following processes:

[0089] S1. Collect sewage water quality monitoring data including chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow at different times of the sewage treatment plant and perform data cleaning;

[0090] S2. Preprocess the sewage water quality monitoring data based on the noise removal technology of wavelet transform to obtain the processed sewage water quality monitoring data to establish a data set;

[0091] S3. Build a water quality prediction model for sewage treatment plants based on the improved transformer deep learning model;

[0092] S4, inputting the parameters of the pre-treated sewage water quality detection data set training model to optimize the accuracy of model prediction;

[0093] S5. Based on the trained improved transformer sewage quality prediction model, the water quality of the sewage treatment plant in the future is predicted according to the real-time collected water quality monitoring data.

[0094] Furthermore, the collecting of sewage quality monitoring data at different times of the sewage treatment plant and data cleaning in S1 include:

[0095] The water quality monitoring data of sewage treatment plants at different times are collected by using water quality sensors and installed at the downstream position of the intersection of sewage pipes to ensure the accuracy of water quality monitoring. Sewage flows to the node in the pipeline, intersects at the node, and continues to flow downstream along the pipeline. The sensor is fixed at the node. In order to avoid the influence of water turbulence caused by water flow convergence on the pipeline, the probe should be fixed in the pipeline leading to the downstream and penetrated a certain distance to ensure that the sewage flow state is stable before data collection and transmission;

[0096] The sewage water quality monitoring data collected at different times of the sewage treatment plant includes five data items, including COD, ammonia nitrogen, pH, temperature and flow, through the deployed sensors. It is assumed that each set of sewage water quality monitoring data is f(t), which includes five data parameters of each sensor monitoring point, and the data is recorded every 2 hours and continuously recorded for 474 days. A total of 5688 sets of sewage water quality monitoring data are obtained, and the data set is divided into a training set: test set ratio of 7:3;

[0097] The data cleaning of sewage water quality monitoring data is because the accuracy of the data set is crucial for the training of the water quality prediction model of the sewage treatment plant. In the data collection process, it is very easy to have data missing, data anomalies and other problems caused by uncontrollable factors such as equipment failure and improper human operation. When collecting and testing data, data cleaning is required, which mainly fills in missing data and removes abnormal data, and uses the mean smoothing method to complete the missing data:

[0098] For the chemical nitrogen demand (COD) data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0099]

[0100] Among them, x_COD a is the missing data of chemical nitrogen demand (COD) in the sewage quality monitoring data at time a, x_COD a-1 is the normal data of chemical nitrogen demand COD in the sewage quality monitoring data at time a-1, x_COD a+1 It is the normal data of chemical nitrogen demand COD in the sewage quality monitoring data at time a+1;

[0101] For the ammonia nitrogen data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0102]

[0103] Among them, x_NH a is the missing data of ammonia nitrogen in the sewage quality monitoring data at time a, x_NH a-1 is the normal data of ammonia nitrogen in the sewage water quality monitoring data at time a-1, x_NH a+1 It is the normal data of ammonia nitrogen in the sewage water quality monitoring data at time a+1;

[0104] For the pH data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0105]

[0106] Among them, x_pH a is the missing pH data in the sewage quality monitoring data at time a, x_pH a-1 is the normal pH data in the sewage quality monitoring data at time a-1, x_pH a+1 It is the normal pH data in the sewage quality monitoring data at time a+1;

[0107] For the temperature data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0108]

[0109] Among them, x_temp a is the missing temperature data in the sewage quality monitoring data at time a, x_temp a-1 is the normal temperature data in the sewage quality monitoring data at time a-1, x_temp a+1 It is the normal temperature data in the sewage quality monitoring data at time a+1;

[0110] For the flow data in the sewage quality monitoring data, the calculation formula for data completion is as follows:

[0111]

[0112] Among them, x_flow a is the missing flow data in the sewage quality monitoring data at time a, x_flow a-1 is the normal flow data in the sewage quality monitoring data at time a-1, x_flow a+1 It is the normal flow data in the sewage quality monitoring data at time a+1;

[0113] After the data cleaning process, each group of sewage water quality monitoring data is obtained as F(t). Each group of sewage water quality monitoring data contains five data items: chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow rate, which are used as input for denoising using noise removal technology based on wavelet change in the subsequent present invention.

[0114] Furthermore, the noise removal technology based on wavelet transform in S2 pre-processes the sewage quality monitoring data, and the process includes:

[0115] The wavelet transform-based noise removal technology is used to pre-process the sewage quality monitoring data to deal with the situation that although the quality of the sewage quality monitoring data has been improved after data cleaning, there is still a situation where excessive sewage is not detected. In addition, pollutants in the sewage may also adhere to the probe, causing unreasonable fluctuations in the monitoring data, which in turn leads to noise pollution in the sewage quality monitoring data.

[0116] The main process of the noise removal technology based on wavelet transform is as follows: Figure 1 As shown in the figure, it uses a finite-length wavelet basis that decays over time to decompose the sewage quality monitoring data into two-dimensional time-frequency information. When extracting local information in the time domain, it can also extract frequency domain information, and can quickly process non-stationary mutation signals that are difficult to fit.

[0117] The noise removal technology based on wavelet transform is mainly used to pre-process the sewage water quality monitoring data by discrete wavelet transform, and its calculation formula is as follows:

[0118]

[0119] Among them, W f (j, k) represents the coefficient of discrete wavelet, f(t) represents the sewage quality monitoring data after data cleaning, a represents the scale factor, Represents ψ j,k The conjugate function of (t), ψ j,k (t) represents the wavelet basis function, and its calculation formula is as follows:

[0120]

[0121] Among them, a0 represents the discretization form of the scale factor, and b0 represents the discretization form of the translation factor;

[0122] After data cleaning, each sewage water quality monitoring data is decomposed by discrete wavelet transform into a low-frequency approximate signal and a series of high-frequency detail signals, among which the low-frequency signal can be further decomposed until the maximum number of decompositions is reached. The data decomposition process is carried out using low-pass filters and high-pass filters;

[0123] Since the number of sample points in the decomposed sequence obtained based on wavelet transform is less than that in the original sequence, and the prediction model preferably has an input of uniform length, the result after wavelet transform decomposition is used as the input of the wavelet reconstruction process, and the data of the dimension of chemical nitrogen demand COD is converted into a new low-frequency signal rA_COD n and a series of new high frequency signals [rD_COD1, rD_COD2, ···, rD_COD n ], converting the data of ammonia nitrogen into a new low-frequency signal rA_NH n and a series of new high-frequency signals [rD_NH1, rD_NH2, ···, rD_NH n ], converting the pH dimension data into a new low-frequency signal rA_pH n and a series of new high-frequency signals [rD_pH1, rD_pH2, ···, rD_pH n ], converting the temperature dimension data into a new low-frequency signal rA_temp n and a series of new high-frequency signals [rD_temp1, rD_temp2, ···, rD_temp n ], converting the data of flow dimension into a new low-frequency signal rA_flow n and a series of new high-frequency signals [rD_flow1,rD_flow2,···,rD_flow n ]. And finally make the sequence length consistent with the original sequence.

[0124] The result after wavelet transform decomposition is used as the input of the wavelet reconstruction process to reconstruct the sewage water quality monitoring data after data denoising treatment with the same length as the original sequence. The calculation formula is:

[0125]

[0126] Among them, C ψ represents the permissible condition of discrete wavelet transform, that is ψ(ω) represents the Fourier transform form of the wavelet basis function, ω represents the frequency, R represents the range of the discretized form of the scale factor and the translation factor, and the range of the scale factor a is a=1,2,4,...,2 n-1 , the value range of the translation factor b is b=1,2,3...,n;

[0127] Finally, based on the noise removal technology of wavelet transform, the present invention realizes noise reduction processing by inputting each sewage water quality monitoring data after data cleaning, and obtains the sewage water quality monitoring data F(t) after data preprocessing;

[0128] Furthermore, in S3, a water quality prediction model for a sewage treatment plant is constructed based on an improved transformer deep learning model, and the process includes:

[0129] The sewage treatment plant water quality prediction model based on the improved transformer is mainly composed of a position encoding layer, a transformer encoding layer and an LSTM decoding layer.

[0130] The position encoding layer is located before the transformer encoding layer. It takes the sewage water quality monitoring data F(t) after data preprocessing as input, provides corresponding data position information for model operation, and outputs the result intermediate_positionlayer that provides corresponding data position information for model operation.

[0131] In the position encoding process, the data is separated according to the odd-even arrangement and the corresponding data position information is assigned respectively. The calculation formula is:

[0132]

[0133] Among them, i represents the time step of the sewage monitoring data F(t), s represents the dimension corresponding to the sewage monitoring data F(t), which includes chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow, d represents the data encoding of the corresponding position, and the sewage water quality monitoring data through position encoding is given a sequential encoding. At the end of the position encoding, the local position feature extraction result is expressed. The calculation formula is:

[0134] y i =e i +p i (11)

[0135] Among them, e i represents the local position feature extraction result, p i Represents the position encoding information, through the position encoding and local feature extraction data y i It can have both data location information and feature information, and provide input for the transformer encoding layer;

[0136] The transformer encoding layer takes the intermediate result intermediate_positionlayer output by the position encoding layer as input, and outputs the intermediate_transformerlayer which can provide the data result with attention for the sewage treatment plant water quality prediction model based on the improved transformer of the present invention.

[0137] The data processed by the transformer coding layer can provide more features when predicting the water quality of the sewage treatment plant. The sewage water quality monitoring data generates attention to the data through the dot product operation of the transformer coding layer, and is processed in parallel through multiple transformer coding layers. The main structure of the transformer coding layer is the multi-head attention mechanism and the feedforward layer. After each multi-head attention mechanism and feedforward layer, a layer normalization operation is added. The sewage water quality monitoring data processed by layer normalization can reduce problems such as gradient explosion and improve network stability. Finally, the characteristics of the sewage water quality monitoring data are retained to a certain extent during the data processing process. Two linear addition layers are added to the coding layer to achieve the effect of improving the model feature learning;

[0138] The core part of the transformer encoding layer is the multi-head attention mechanism, which is the key part of the improved transformer-based sewage treatment plant water quality prediction model to achieve accurate prediction. The multi-head attention mechanism is composed of multiple heads with self-attention. The self-attention process in the multi-head attention mechanism can be described as a process solved by a query vector and a set of key-value vector matrices, where the query vector Q, the key vector K and the weight vector V are converted from the output;

[0139] The output calculation result is a weighted value, which is obtained by the compatibility operation between the query vector and the key vector. As the input of the multi-head self-attention module, the key vector, weight vector and query vector are calculated as follows:

[0140]

[0141] in, For the trainable projection matrix, the derived result is used to calculate the proportional dot product attention. The calculation formula is as follows:

[0142]

[0143] In order to jointly focus on information from different representation subspaces at different positions, further optimization is required, using H parallel attention calculations. In this case, the calculation process of the multi-head attention mechanism is as follows:

[0144]

[0145] in, Concat() represents the concatenation function, which is used to concatenate the results of each set of self-attention and finally output the intermediate result intermediate_transformerlayer as the input of the LSTM decoding layer;

[0146] The transformer encoding layer also implements the function through the feed-forward layer. The feed-forward network consists of two linear transformations connected by a ReLU activation function, which is applied separately and identically to each time step.

[0147] The LSTM decoding layer is mainly used to reconstruct the decoding layer of the original transformer in the sewage treatment plant water quality prediction model based on the improved transformer of the present invention;

[0148] The linear rectification of the LSTM decoding layer can convert the result data of the transformer encoding layer into a format that matches the LSTM hidden layer, thereby providing input data for the LSTM;

[0149] The LSTM decoding layer is composed of an LSTM operation layer input gate, a forget gate, an output gate, and a cell state. The LSTM decoding layer takes the transformer encoding layer data intermediate_transformerlayer, the hidden layer data at the previous moment, and the cell state output at the previous moment as common inputs, processes the data serially through a gating mechanism, realizes data processing, and finally outputs the hidden layer data at the current moment and the cell state output at the current moment, which is the prediction result of sewage quality monitoring.

[0150] Furthermore, the parameters in the training model of the pre-treated sewage water quality detection data set are input in S4 to optimize the accuracy of model prediction. The process includes:

[0151] The data processing process is divided into intra-unit data processing and inter-unit data processing. The data is transmitted in two ways to achieve the prediction of sewage quality. The intra-unit processing is responsible for parallel data processing, and the inter-unit processing is responsible for serial data processing. The specific process is as follows: Figure 6 As shown;

[0152] The data processing within the unit relies on the mutually independent position encoding layer, transformer encoding layer and LSTM decoding layer within the unit. The new sewage water quality monitoring data at each moment of input is position encoded and transformer encoded. The encoded data can retain more features to ensure that the signal attenuation degree is reduced during the sewage water quality prediction process. The data processing between units is realized by the LSTM decoding layer. The output result of the previous LSTM decoding layer is used as the input of the subsequent LSTM decoding layer to realize the serial data processing capability of the network and improve the prediction ability of the network.

[0153] The training model process uses the sewage water quality detection data after noise reduction as input, including chemical nitrogen demand COD, ammonia nitrogen, temperature, pH and flow rate obtained by the monitoring point sensors. During the model training process, the Adam optimizer is used as the optimization method, the mean square error is selected as the loss function, and the hyperparameters in the model such as learning rate, momentum and weight decay are adjusted to achieve the purpose of improving the model performance. At the same time, the test set is used to evaluate the model, and the final trained sewage treatment plant water quality prediction model based on the improved transformer is obtained.

[0154] Furthermore, in S5, based on the trained improved transformer sewage water quality prediction model, the water quality of the sewage treatment plant in the future is predicted according to the real-time collected water quality monitoring data. The process includes:

[0155] (1) Collect sewage water quality monitoring data from sewage treatment plants and perform data cleaning to obtain sewage water quality monitoring data sets;

[0156] (2) Using wavelet transform to pre-process the raw sewage quality monitoring data for noise reduction;

[0157] (3) Build a sewage treatment plant water quality prediction model based on the improved transformer deep learning model;

[0158] (4) Inputting the sewage quality monitoring data after noise reduction to train the model;

[0159] (5) Use the trained and tested model to predict the sewage quality of the sewage treatment plant in the future.

[0160] The present invention uses deep learning as a new research direction in the field of machine learning to create a complex interconnected neuronal structure, which gives it certain advantages in the complex structure of high-dimensional data. Therefore, applying deep learning to the field of sewage quality prediction and establishing a data-driven model has promising value. Although deep learning still has some challenges and problems in sewage quality prediction, through reasonable data preprocessing, feature extraction, model selection and optimization, a more accurate sewage treatment plant water quality prediction model is established, which can provide strong support for improving sewage treatment efficiency and enhancing water management effectiveness.

[0161] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A sewage treatment plant water quality prediction method based on an improved transformer deep learning model, characterized in that: The process includes: S1. Collect sewage water quality monitoring data including chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow at different times of the sewage treatment plant and perform data cleaning; S2. Preprocess the sewage water quality monitoring data based on the noise removal technology of wavelet transform to obtain the processed sewage water quality monitoring data to establish a data set; S3. Build a water quality prediction model for sewage treatment plants based on the improved transformer deep learning model; S4, inputting the parameters of the pre-treated sewage water quality detection data set training model to optimize the accuracy of model prediction; S5. Based on the trained improved transformer sewage quality prediction model, the water quality of the sewage treatment plant in the future is predicted according to the real-time collected water quality monitoring data.

2. According to claim 1, a method for predicting water quality in a sewage treatment plant based on an improved transformer deep learning model is characterized in that: The S1 collects the sewage quality monitoring data of the sewage treatment plant at different times and performs data cleaning, including: The water quality monitoring data of sewage treatment plants at different times are collected by using water quality sensors and installed at the downstream position of the intersection of sewage pipes. Sewage flows to the node in the pipe, intersects at the node, and continues to flow downstream along the pipe. The sensor is fixed at the node, and the probe should be fixed in the pipe leading to the downstream and penetrate a certain distance; The sewage water quality monitoring data collected at different times in the sewage treatment plant includes five data items including COD, ammonia nitrogen, pH, temperature and flow rate through the deployed sensors; The data cleaning of sewage water quality monitoring data is because the accuracy of the data set is crucial for the training of the water quality prediction model of the sewage treatment plant. In the data collection process, it is very easy to have data missing, data anomalies and other problems caused by uncontrollable factors such as equipment failure and improper human operation. When collecting and testing data, data cleaning is required, which mainly fills in missing data and removes abnormal data, and uses the mean smoothing method to complete the missing data: For the chemical nitrogen demand (COD) data in the sewage quality monitoring data, the calculation formula for data completion is as follows: Among them, x_COD a is the missing data of chemical nitrogen demand (COD) in the sewage quality monitoring data at time a, x_COD a-1 is the normal data of chemical nitrogen demand COD in the sewage quality monitoring data at time a-1, x_COD a+1 It is the normal data of chemical nitrogen demand COD in the sewage quality monitoring data at time a+1; For the ammonia nitrogen data in the sewage quality monitoring data, the calculation formula for data completion is as follows: Among them, x_NH a is the missing data of ammonia nitrogen in the sewage quality monitoring data at time a, x_NH a-1 is the normal data of ammonia nitrogen in the sewage water quality monitoring data at time a-1, x_NH a+1 It is the normal data of ammonia nitrogen in the sewage water quality monitoring data at time a+1; For the pH data in the sewage quality monitoring data, the calculation formula for data completion is as follows: Among them, x_pH a is the missing pH data in the sewage quality monitoring data at time a, x_pH a-1 is the normal pH data in the sewage quality monitoring data at time a-1, x_pH a+1 It is the normal pH data in the sewage quality monitoring data at time a+1; For the temperature data in the sewage quality monitoring data, the calculation formula for data completion is as follows: Among them, x_temp a is the missing temperature data in the sewage quality monitoring data at time a, x_temp a-1 is the normal temperature data in the sewage quality monitoring data at time a-1, x_temp a+1 It is the normal temperature data in the sewage quality monitoring data at time a+1; For the flow data in the sewage quality monitoring data, the calculation formula for data completion is as follows: Among them, x_flow a is the missing flow data in the sewage quality monitoring data at time a, x_flow a-1 is the normal flow data in the sewage quality monitoring data at time a-1, x_flow a+1 It is the normal flow data in the sewage quality monitoring data at time a+1; After the data cleaning process, each group of sewage water quality monitoring data is obtained as F(t). Each group of sewage water quality monitoring data contains five data items: chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow rate, which are used as input for denoising using noise removal technology based on wavelet change in the subsequent present invention.

3. The method for predicting water quality of a sewage treatment plant based on an improved transformer deep learning model according to claim 1, characterized in that: The noise removal technology based on wavelet transform in S2 pre-processes the sewage quality monitoring data, and the process includes: The wavelet transform-based noise removal technology is used to pre-process the sewage quality monitoring data to deal with the situation that although the quality of the sewage quality monitoring data has been improved after data cleaning, there is still a situation where excessive sewage is not detected. In addition, pollutants in the sewage may also adhere to the probe, causing unreasonable fluctuations in the monitoring data, which in turn leads to noise pollution in the sewage quality monitoring data. The main process of the noise removal technology based on wavelet transform uses a finite-length wavelet basis that decays over time to decompose the sewage quality monitoring data into two-dimensional time-frequency information, and can also extract frequency domain information when extracting local information in the time domain; The noise removal technology based on wavelet transform is mainly used to pre-process the sewage water quality monitoring data by discrete wavelet transform, and its calculation formula is as follows: Among them, W f (j, k) represents the coefficient of discrete wavelet, f(t) represents the sewage quality monitoring data after data cleaning, a represents the scale factor, Represents ψ j,k The conjugate function of (t), ψ j,k (t) represents the wavelet basis function, and its calculation formula is as follows: Among them, a0 represents the discretization form of the scale factor, and b0 represents the discretization form of the translation factor; After data cleaning, each sewage water quality monitoring data is decomposed by discrete wavelet transform into a low-frequency approximate signal and a series of high-frequency detail signals, among which the low-frequency signal can be further decomposed until the maximum number of decompositions is reached. The data decomposition process is carried out using low-pass filters and high-pass filters; Since the number of sample points in the decomposed sequence obtained based on wavelet transform is less than that in the original sequence, and the prediction model preferably has an input of uniform length, the result after wavelet transform decomposition is used as the input of the wavelet reconstruction process, and the data of the dimension of chemical nitrogen demand COD is converted into a new low-frequency signal rA_COD n and a series of new high frequency signals [rD_COD1, rD_COD2, ···, rD_COD n ], converting the data of ammonia nitrogen into a new low-frequency signal rA_NH n and a series of new high-frequency signals [rD_NH1, rD_NH2, ···, rD_NH n ], converting the pH dimension data into a new low-frequency signal rA_pH n and a series of new high-frequency signals [rD_pH1, rD_pH2, ···, rD_pH n ], converting the temperature dimension data into a new low-frequency signal rA_temp n and a series of new high-frequency signals [rD_temp1, rD_temp2, ···, rD_temp n ], converting the data of flow dimension into a new low-frequency signal rA_flow n and a series of new high-frequency signals [rD_flow1,rD_flow2,···,rD_flow n ]. And finally make the sequence length consistent with the original sequence. The result after wavelet transform decomposition is used as the input of the wavelet reconstruction process to reconstruct the sewage water quality monitoring data after data denoising treatment with the same length as the original sequence. The calculation formula is: Among them, C ψ represents the permissible condition of discrete wavelet transform, that is ψ(ω) represents the Fourier transform form of the wavelet basis function, ω represents the frequency, R represents the range of the discretized form of the scale factor and the translation factor, and the range of the scale factor a is a=1,2,4,...,2 n-1 , the value range of the translation factor b is b=1,2,3...,n; Finally, based on the noise removal technology of wavelet transform, the present invention realizes noise reduction processing by inputting each sewage water quality monitoring data after data cleaning, and obtains the sewage water quality monitoring data F(t) after data preprocessing.

4. The method for predicting water quality of a sewage treatment plant based on an improved transformer deep learning model according to claim 1, characterized in that: In S3, a water quality prediction model for a sewage treatment plant is constructed based on an improved transformer deep learning model. The process includes: The sewage treatment plant water quality prediction model based on the improved transformer is mainly composed of a position encoding layer, a transformer encoding layer and an LSTM decoding layer; The position encoding layer is located before the transformer encoding layer. It takes the sewage water quality monitoring data F(t) after data preprocessing as input, provides corresponding data position information for model operation, and outputs the result intermediate_positionlayer that provides corresponding data position information for model operation. In the position encoding process, the data is separated according to the odd-even arrangement and the corresponding data position information is assigned respectively. The calculation formula is: Among them, i represents the time step of the sewage monitoring data F(t), s represents the dimension corresponding to the sewage monitoring data F(t), which includes chemical nitrogen demand COD, ammonia nitrogen, pH, temperature and flow, d represents the data encoding of the corresponding position, and the sewage water quality monitoring data through position encoding is given a sequential encoding. At the end of the position encoding, the local position feature extraction result is expressed. The calculation formula is: and i =e i +p i (11) Among them, e i represents the local position feature extraction result, p i Represents the position encoding information, through the position encoding and local feature extraction data y i It can have both data location information and feature information, and provide input for the transformer encoding layer; The transformer encoding layer takes the intermediate result intermediate_positionlayer output by the position encoding layer as input, and outputs the intermediate_transformerlayer which can provide the data result with attention for the sewage treatment plant water quality prediction model based on the improved transformer of the present invention. The data processed by the transformer coding layer can provide more features when predicting the water quality of the sewage treatment plant. The sewage water quality monitoring data generates attention to the data through the dot product operation of the transformer coding layer, and is processed in parallel through multiple transformer coding layers. The main structure of the transformer coding layer is the multi-head attention mechanism and the feedforward layer. After each multi-head attention mechanism and feedforward layer, a layer normalization operation is added. The sewage water quality monitoring data processed by layer normalization can reduce problems such as gradient explosion and improve network stability. Finally, the characteristics of the sewage water quality monitoring data are retained to a certain extent during the data processing process. Two linear addition layers are added to the coding layer to achieve the effect of improving the model feature learning; The core part of the transformer encoding layer is the multi-head attention mechanism, which is the key part of the improved transformer-based sewage treatment plant water quality prediction model to achieve accurate prediction. The multi-head attention mechanism is composed of multiple heads with self-attention. The self-attention process in the multi-head attention mechanism can be described as a process solved by a query vector and a set of key-value vector matrices, where the query vector Q, the key vector K and the weight vector V are converted from the output; The output calculation result is a weighted value, which is obtained by the compatibility operation between the query vector and the key vector. As the input of the multi-head self-attention module, the key vector, weight vector and query vector are calculated as follows: in, For the trainable projection matrix, the derived result is used to calculate the proportional dot product attention. The calculation formula is as follows: In order to jointly focus on information from different representation subspaces at different positions, further optimization is required, using H parallel attention calculations. In this case, the calculation process of the multi-head attention mechanism is as follows: in, Concat() represents the concatenation function, which is used to concatenate the results of each set of self-attention and finally output the intermediate result intermediate_transformerlayer as the input of the LSTM decoding layer; The transformer encoding layer also implements the function through the feed-forward layer. The feed-forward network consists of two linear transformations connected by a ReLU activation function, which is applied separately and identically to each time step. The LSTM decoding layer is mainly used to reconstruct the decoding layer of the original transformer in the sewage treatment plant water quality prediction model based on the improved transformer of the present invention; The linear rectification of the LSTM decoding layer can convert the result data of the transformer encoding layer into a format that matches the LSTM hidden layer, thereby providing input data for the LSTM; The LSTM decoding layer is composed of an LSTM operation layer input gate, a forget gate, an output gate, and a cell state. The LSTM decoding layer takes the transformer encoding layer data intermediate_transformerlayer, the hidden layer data at the previous moment, and the cell state output at the previous moment as common inputs, processes the data serially through a gating mechanism, realizes data processing, and finally outputs the hidden layer data at the current moment and the cell state output at the current moment, which is the prediction result of sewage quality monitoring.

5. The method for predicting water quality in a sewage treatment plant based on an improved transformer deep learning model according to claim 1, characterized in that: In S4, the parameters of the pre-treated sewage water quality detection data set training model are input to optimize the accuracy of model prediction. The process includes: The data processing process is divided into intra-unit data processing and inter-unit data processing. The data is transmitted in two ways to achieve the prediction of sewage quality, where the intra-unit processing is responsible for data parallel processing and the inter-unit processing is responsible for data serial processing. The data processing within the unit relies on the mutually independent position encoding layer, transformer encoding layer and LSTM decoding layer within the unit. The new sewage water quality monitoring data at each moment of input is position encoded and transformer encoded. The encoded data can retain more features to ensure that the signal attenuation degree is reduced during the sewage water quality prediction process. The data processing between units is realized by the LSTM decoding layer. The output result of the previous LSTM decoding layer is used as the input of the subsequent LSTM decoding layer to realize the serial data processing capability of the network and improve the prediction ability of the network. The training model process uses the sewage water quality detection data after noise reduction as input, including chemical nitrogen demand COD, ammonia nitrogen, temperature, pH and flow rate obtained by the monitoring point sensors. During the model training process, the Adam optimizer is used as the optimization method, the mean square error is selected as the loss function, and the hyperparameters in the model such as learning rate, momentum and weight decay are adjusted.

6. The method for predicting water quality in a sewage treatment plant based on an improved transformer deep learning model according to claim 1, characterized in that: In S5, based on the trained improved transformer sewage water quality prediction model, the water quality of the sewage treatment plant in the future is predicted according to the real-time collected water quality monitoring data. The process includes: (1) Collect sewage water quality monitoring data from sewage treatment plants and perform data cleaning to obtain sewage water quality monitoring data sets; (2) Using wavelet transform to pre-process the raw sewage quality monitoring data for noise reduction; (3) Build a sewage treatment plant water quality prediction model based on the improved transformer deep learning model; (4) Inputting the sewage quality monitoring data after noise reduction to train the model; (5) Use the trained and tested model to predict the sewage quality of the sewage treatment plant in the future.

Citation Information

Cited By

  • Rural sewage treatment result prediction method and system

    CN119647701A

  • Whole-process cooperative control system of AO sewage treatment process

    CN120335399A

  • Industrial sewage water quality real-time prediction and early warning method and system

    CN121122465A

  • An industrial wastewater quality real-time prediction and early warning method and system

    CN121122465B