A method and system for predicting parameters of sewage treatment plants based on machine learning

By combining the Kalman filtering algorithm and the sewage plant parameter prediction method of the selective state space model Mamba, the limitations of the prior art in dealing with nonlinear relationships and multivariable interactions are solved, and high-precision and stable sewage plant operation parameter prediction is achieved.

CN119294612BActive Publication Date: 2025-03-14BEIJING ZHIYU TIANCHENG DESIGN CONSULTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411807885.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-14
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

Existing wastewater treatment parameter prediction methods have limitations in dealing with nonlinear relationships and multivariable interactions, making them difficult to adapt to complex and changeable operating environments and emerging models, and ordinary machine learning models are inefficient in computing when processing long sequence data.

Method used

The sewage plant parameter prediction method based on machine learning is adopted, combined with the Kalman filtering algorithm to process abnormal data, and the selective state space model Mamba is used for timing prediction, which improves the operational processing efficiency.

Benefits of technology

It realizes high-precision prediction of key operating parameters of sewage plants, can effectively capture peaks and valleys in the data, has good stability and adaptability, and improves the operation control capabilities of sewage treatment plants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294612B_ABST
    Figure CN119294612B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for predicting parameters of a sewage treatment plant based on machine learning, and belongs to the technical field of sewage treatment plant production management. The method comprises the following steps: reading historical sewage data in a time series stored in a database, and importing it into a selective state space model Mamba for training; collecting real-time sewage data in a time series of a previous stage; reading real-time sewage data, and performing parameter prediction by the trained selective state space model Mamba to obtain predicted sewage data for sewage treatment plant operation control in a time series of a later stage; and storing. The system comprises an acquisition module, a storage database module, and a prediction module. The present invention combines the abnormal data processing technology based on the Kalman filter algorithm and the innovative time series prediction technology based on the selective state space model Mamba, and has significant advantages in predicting key operating parameters of sewage treatment plants.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sewage treatment plant production management, and in particular to a sewage treatment plant parameter prediction method and system based on machine learning. Background Art

[0002] Early sewage treatment parameter prediction mainly relied on statistical models (such as the Box-Jenkins method, the autoregressive integrated moving average ARIMA model and the multivariate autoregressive model VAR) and expert systems. Statistical models and expert systems are based on the statistical characteristics of historical data and can capture the linear relationship and seasonal patterns of time series. However, they have limitations in nonlinear relationships and multivariate interactions in sewage treatment, and are difficult to adapt to complex and changing operating environments and emerging patterns.

[0003] With the development of machine learning technology, methods such as support vector machine (SVM), random forest (RF) and artificial neural network (ANN) have been introduced into the field of sewage treatment parameter prediction. However, ordinary machine learning models still face challenges such as low computational efficiency when processing long sequence data, which reduces their usability in actual production. Summary of the invention

[0004] The present invention aims to provide a method and system for predicting parameters of sewage treatment plants based on machine learning, which combines abnormal data processing technology based on Kalman filtering algorithm and innovative time series prediction technology based on selective state space model Mamba, has high computational processing efficiency and has significant advantages in predicting key operating parameters of sewage treatment plants.

[0005] The technical solution adopted by the present invention is:

[0006] A method for predicting parameters of a sewage treatment plant based on machine learning comprises the following steps:

[0007] Step S1, reading the historical sewage data in the time series stored in the database, and importing the historical sewage data into the selective state space model Mamba for training;

[0008] Step S2, collecting real-time sewage data in the previous stage time series, and storing the real-time sewage data in a database;

[0009] Step S3, read the real-time sewage data stored in the database regularly according to the demand, and use the trained selective state space model Mamba to predict the parameters, so as to obtain the predicted sewage data for the operation control of the sewage treatment plant in the next stage of time series; at the same time, synchronously collect the real-time sewage data in the next stage of time series;

[0010] Step S4, storing the predicted sewage data and the real-time sewage data of the next stage into a database.

[0011] Furthermore, after reading the historical sewage data stored in the database in step S1, the historical sewage data is first filtered using a Kalman filter algorithm to identify whether there is abnormal data;

[0012] If abnormal data is identified, the calculated value obtained by the Kalman filter algorithm is used to replace the corresponding abnormal data.

[0013] Furthermore, when the Kalman filter algorithm is used to filter the historical sewage data in step S1, the following process is specifically included:

[0014] Step S101, setting the historical sewage plant observation data set of historical sewage data ; Among them, Z k Represents the historical sewage data at the kth moment in the time series;

[0015] Step S102, inputting the initial state estimate X0 and its covariance matrix P0 at the initial moment, and then using the Kalman filter algorithm to calculate the state estimate X1 and its covariance matrix P1 at the first moment based on the historical sewage plant observation data set Z, the initial state estimate X0 and the covariance matrix P0;

[0016] Step S103: based on the historical sewage treatment plant observation data set Z and the state estimation X at the k-1th moment k-1 and its covariance matrix P k-1 , use the Kalman filter algorithm to calculate the state estimate X at the kth moment k and its covariance matrix P k ;

[0017] Step S104, repeat step S103 until the state estimate X at the Nth moment is calculated using the Kalman filter algorithm. N and its covariance matrix P N ;

[0018] Step S105, one by one, the historical sewage data Z1 from the first moment to the historical sewage data Z at the Nth moment N , and the corresponding state estimate X1 at the first moment to the state estimate X at the Nth moment N Make comparisons;

[0019] If the absolute value of the difference between the historical sewage data and the corresponding state estimation exceeds the corresponding first preset threshold, the historical sewage data at the corresponding moment is regarded as abnormal data.

[0020] Furthermore, when the calculated value obtained by the Kalman filter algorithm is used to replace the abnormal data in step S1, the following process is specifically included:

[0021] Step S106A, setting the historical sewage plant observation data set of historical sewage data ; Among them, Z k It represents the historical sewage data at the kth moment in the time series, and it is abnormal data;

[0022] Step S107A: input the state estimate X at the k-1th moment k-1 and its covariance matrix P k-1 , then based on the historical sewage plant observation data set Z, state estimation X k-1 and its covariance matrix P k-1 , calculate the state estimate X at the kth moment according to the Kalman filter algorithm k ;

[0023] Step S108A, using the state estimate X at the kth moment k Replace historical sewage data Z k Perform subsequent processing.

[0024] Furthermore, when the calculated value obtained by the Kalman filter algorithm is used to replace the abnormal data in step S1, the following process is specifically included:

[0025] Step S106B, setting the historical sewage plant observation data set of historical sewage data ;in, It represents the set of historical sewage data from the k+1th moment to the k+n-1th moment in the time series, and is a set of abnormal data;

[0026] Step S107B: input the state estimate X at the k+1th moment k+1 and its covariance matrix P k+1 , then based on the historical sewage plant observation data set Z, state estimation X k+1 and its covariance matrix P k+1 , use the Kalman filter algorithm to calculate the state estimate X at the k+2th moment k+2 ;

[0027] Step S108B, based on the historical sewage plant observation data set Z and the state estimation X k+n-2 And the covariance matrix P k+n-2 , use the Kalman filter algorithm to calculate the state estimate X at the k+n-2th moment k+n-2 ;

[0028] Step S109B, repeat step S108B until the state estimate X at the k+n-1th moment is calculated using the Kalman filter algorithm. k+n-1 and its cosquare matrix difference P k+n-1 ; Among them, P k+1 =P k+2 =···=P k+n-2 ;

[0029] Step S120B, based on the historical sewage plant observation data set Z and the state estimation X k+n-1 and its cosquare matrix difference P k+n-1 , calculate the state estimate X at the k+nth moment k+n and its cosquare matrix difference P k+n ;

[0030] Step S121B, the historical sewage data Z at the k+nth moment k+n With the state estimate X k+n Make comparisons;

[0031] If the historical sewage data Z k+n With the state estimate X k+n If the absolute value of the difference is less than or equal to the corresponding second preset threshold, then directly adopt Instead of the corresponding Carry out subsequent processing;

[0032] Otherwise, proceed to the next step;

[0033] Step S122B, P k+1 Reset to the value of P calculated in step S120B k+n If the same, repeat steps S107 to S121B until the historical sewage data Z at the k+nth moment is k+n With the state estimate X k+n The absolute value of the difference is less than or equal to the corresponding second preset threshold, and then adopt Instead of the corresponding Perform subsequent processing.

[0034] Furthermore, when the historical sewage data is imported into the selective state space model Mamba for training in step S1, the historical sewage data set is first divided into a training set, a validation set and a test set according to a preset ratio, and then imported into the selective state space model Mamba for training; at the same time, the selective state space model Mamba uses the mean square error MSE as the loss function to minimize the difference L between the predicted value and the actual value, which is expressed as: ;

[0035] In the formula, N is the number of samples;

[0036] is the predicted sewage data predicted by the selective state space model Mamba;

[0037] y n It is the sewage data actually detected at the same time.

[0038] Furthermore, when the selective state space model Mamba is trained in step S1, the specific operation process includes the following process:

[0039] Step S122, normalize the historical sewage data in the read time series to obtain ;

[0040] In the formula, L represents the length of historical sewage data, and M represents the dimension of historical sewage data;

[0041] Represents a real number of dimension M×L;

[0042] Step S123, the input X0 is processed by embedding layer E1 and embedding layer E2 to obtain: ; ;

[0043] Where, DO represents the dropout operation;

[0044] The embedding layer E1 and the embedding layer E2 implement the embedding operation by using the multi-layer perceptron P1 and the multi-layer perceptron P2 respectively;

[0045] Step S123, integrating four Mamba modules based on the state space model, and organizing two Mamba modules into pairs to form an external Mamba pair and an internal Mamba pair; the external Mamba pair and the internal Mamba pair process X1 and X2; wherein the external Mamba pair processes the high-resolution representation, and the internal Mamba pair processes the low-resolution representation;

[0046] Step S124, using the multilayer perceptron P3 to map the output of the internal Mamba pair to the same dimension as the external Mamba pair; and using the multilayer perceptron P4 to combine the outputs of all Mamba modules and map them to the state estimation under the final time series.

[0047] Furthermore, in step S124, residual connections are introduced before the input and after the output of the multilayer perceptron P3.

[0048] Furthermore, after the selective state space model Mamba trained in step S3 is used for operation for more than a preset time, the historical sewage data in the time series stored in the database is re-read with reference to step S1 for updating and optimization.

[0049] Based on the same inventive concept, the present invention also provides a sewage treatment plant parameter prediction system based on machine learning to implement the aforementioned sewage treatment plant parameter prediction method based on machine learning, comprising:

[0050] A collection module, the collection module is used to obtain real-time sewage data in the time series of the previous stage and the next stage;

[0051] A storage database module, the storage database module is used to receive the historical sewage data and real-time sewage data collected by the collection module and store them;

[0052] A prediction module, wherein the prediction module has a built-in selective state space model Mamba; the prediction module reads the historical sewage data stored in the storage database module, and trains the selective state space model Mamba, and then performs parameter prediction based on the real-time sewage data in the previous stage time series collected by the acquisition module, using the trained selective state space model Mamba to obtain predicted sewage data for the operation control of the sewage plant in the next stage, and then sends the predicted sewage data to the storage database module for storage.

[0053] The beneficial effects of the present invention are:

[0054] The present invention provides a method and system for predicting parameters of a sewage treatment plant based on machine learning, which combines the abnormal data processing technology based on the Kalman filter algorithm and the innovative time series prediction technology based on the selective state space model Mamba, has high computing efficiency and has significant advantages in predicting key operating parameters of sewage treatment plants, mainly reflected in:

[0055] High accuracy: The predicted values ​​are highly consistent with the actual values, indicating that the model is robust in dealing with both stable states and dynamic fluctuations;

[0056] Peak and valley capture: The model successfully captures most of the peaks and valleys in the data and performs well even during rapid changes;

[0057] Stability: During stable operation, the predicted values ​​and actual values ​​almost completely coincide, showing the excellent performance of the model in a stable state;

[0058] Adaptability: The model can adapt to fluctuations of different magnitudes and can follow fluctuations from small to large magnitudes well. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0060] Figure 1 These are the actual value curve and predicted value curve of PAC addition acceleration in the high-density pool. DETAILED DESCRIPTION

[0061] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.

[0062] The disclosure below provides many different embodiments or examples to realize different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention.

[0063] The embodiments of the invention are described in detail below with reference to the accompanying drawings.

[0064] Example 1

[0065] This embodiment provides a method for predicting parameters of a sewage treatment plant based on machine learning, comprising the following steps:

[0066] Step S1, reading the historical sewage data in the time series stored in the database, and importing the historical sewage data into the selective state space model Mamba for training;

[0067] Step S2, collecting real-time sewage data in the previous stage time series, and storing the real-time sewage data in a database;

[0068] Step S3, read the real-time sewage data stored in the database regularly according to the demand, and use the trained selective state space model Mamba to predict the parameters, so as to obtain the predicted sewage data for the operation control of the sewage treatment plant in the next stage of time series; at the same time, synchronously collect the real-time sewage data in the next stage of time series;

[0069] Step S4, storing the predicted sewage data and the real-time sewage data of the next stage into a database.

[0070] The historical sewage data and the implementation sewage data mentioned in this embodiment are composed of a series of different analog data, which may include inlet and outlet water data and dosing system data. The inlet and outlet water data include inlet instantaneous flow rate, outlet instantaneous flow rate, inlet COD, outlet COD, inlet ammonia nitrogen, outlet ammonia nitrogen, inlet TP, outlet TP, inlet TN, outlet TN, inlet PH, outlet PH, inlet SS, outlet SS, etc.; the dosing system data include dosing pump operation frequency, drug instantaneous flow rate, drug cumulative flow rate, drug liquid level, etc.

[0071] A sewage treatment plant parameter prediction method based on machine learning provided in this embodiment, which is an innovative time series prediction technology based on the selective state space model Mamba, has significant advantages in the prediction of key operating parameters of sewage treatment plants, and exhibits good high precision, peak and valley capture, stability and adaptability.

[0072] In actual operation, sensors in sewage treatment plants are limited by equipment accuracy, collection environment, etc., and often generate abnormal sensor data, which interferes with the model training process. However, such abnormal time series data should not be removed directly, otherwise it will destroy the integrity and granularity of the data in time and reduce the accuracy of the model. Therefore, for the abnormal sensor data of the sewage treatment plant, this embodiment further combines the abnormal data regeneration method based on the Kalman filter algorithm, and uses the calculated value calculated by the Kalman filter algorithm to replace the abnormal data. Under the premise of not directly removing the abnormal sensor data, the impact of the abnormal sensor data is minimized as much as possible.

[0073] Specifically, after reading the historical sewage data stored in the database in step S1 of this embodiment, the Kalman filter algorithm is first used to filter the historical sewage data to identify whether there is abnormal data; if abnormal data is identified, the calculated value obtained by the Kalman filter algorithm is used to replace the corresponding abnormal data; otherwise, it is regarded as normal data and can be used directly.

[0074] Furthermore, when the Kalman filter algorithm is used to filter the historical sewage data in step S1 of this embodiment, the following process is specifically included:

[0075] Step S101, setting the historical sewage plant observation data set of historical sewage data ; Among them, Z kRepresents the historical sewage data at the kth moment in the time series, which is a set of data, including inlet instantaneous flow rate, outlet instantaneous flow rate, inlet COD, outlet COD, inlet ammonia nitrogen, outlet ammonia nitrogen, inlet TP, outlet TP, inlet TN, outlet TN, inlet PH, outlet PH, inlet SS, outlet SS, dosing pump operation frequency, drug instantaneous flow rate, drug cumulative flow rate and drug liquid level, etc.;

[0076] Step S102, inputting the initial state estimate X0 and its covariance matrix P0 at the initial moment, and then using the Kalman filter algorithm to calculate the state estimate X1 and its covariance matrix P1 at the first moment based on the historical sewage plant observation data set Z, the initial state estimate X0 and the covariance matrix P0;

[0077] Step S103: based on the historical sewage treatment plant observation data set Z and the state estimation X at the k-1th moment k-1 and its covariance matrix P k-1 , use the Kalman filter algorithm to calculate the state estimate X at the kth moment k and its covariance matrix P k ;

[0078] Step S104, repeat step S103 until the state estimate X at the Nth moment is calculated using the Kalman filter algorithm. N and its covariance matrix P N ;

[0079] Step S105, one by one, the historical sewage data Z1 from the first moment to the historical sewage data Z at the Nth moment N , and the corresponding state estimate X1 at the first moment to the state estimate X at the Nth moment N Make comparisons;

[0080] If the absolute value of the difference between the historical sewage data and the corresponding state estimation exceeds the corresponding first preset threshold, the historical sewage data at the corresponding moment is regarded as abnormal data.

[0081] It should be noted that, since historical sewage data usually consists of a series of data of different categories, when comparing historical sewage data with corresponding state estimates, data of the same category are compared. For example, the historical detection value of the instantaneous inlet flow rate is compared with the estimated value, the historical detection value of the instantaneous outlet flow rate is compared with the estimated value, the historical detection value of the inlet COD is compared with the estimated value, and the historical detection value of the outlet COD is compared with the estimated value. If there is an abnormality in any one or more categories of data in a set of historical sewage data, that is, the absolute value of the difference between the historical detection value and the estimated value exceeds the corresponding first preset threshold, the entire set of historical sewage data is regarded as abnormal data, and the corresponding abnormal category of data needs to be processed subsequently.

[0082] For abnormal data at a certain moment, when the calculated value obtained by the Kalman filter algorithm is used to replace the abnormal data in step S1 of this embodiment, the following process is specifically included:

[0083] Step S106A, setting the historical sewage plant observation data set of historical sewage data ; Among them, Z k It represents the historical sewage data at the kth moment in the time series, and it is abnormal data;

[0084] Step S107A: input the state estimate X at the k-1th moment k-1 and its covariance matrix P k-1 , then based on the historical sewage plant observation data set Z, state estimation X k-1 and its covariance matrix P k-1 , calculate the state estimate X at the kth moment according to the Kalman filter algorithm k ;

[0085] Step S108A, using the state estimate X at the kth moment k Replace historical sewage data Z k Perform subsequent processing.

[0086] For abnormal data over a continuous period of time, when the calculated value obtained by the Kalman filter algorithm is used to replace the abnormal data in step S1 of this embodiment, the following process is specifically included:

[0087] Step S106B, setting the historical sewage plant observation data set of historical sewage data ;in, It represents the set of historical sewage data from the k+1th moment to the k+n-1th moment in the time series, and is a set of abnormal data;

[0088] Step S107B: input the state estimate X at the k+1th moment k+1 and its covariance matrix P k+1 , then based on the historical sewage plant observation data set Z, state estimation X k+1 and its covariance matrix P k+1 , use the Kalman filter algorithm to calculate the state estimate X at the k+2th moment k+2 ;

[0089] Step S108B, based on the historical sewage plant observation data set Z and the state estimation X k+n-2 And the covariance matrix P k+n-2 , use the Kalman filter algorithm to calculate the state estimate X at the k+n-2th moment k+n-2 ;

[0090] Step S109B, repeat step S108B until the state estimate X at the k+n-1th moment is calculated using the Kalman filter algorithm. k+n-1 and its cosquare matrix difference P k+n-1 ; Among them, P k+1 =P k+2 =···=P k+n-2 ;

[0091] Step S120B, based on the historical sewage plant observation data set Z and the state estimation X k+n-1 and its cosquare matrix difference P k+n-1 , calculate the state estimate X at the k+nth moment k+n and its cosquare matrix difference P k+n ;

[0092] Step S121B, the historical sewage data Z at the k+nth moment k+n With the state estimate X k+n Make comparisons;

[0093] If the historical sewage data Z k+n With the state estimate X k+n If the absolute value of the difference is less than or equal to the corresponding second preset threshold, then directly adopt Instead of the corresponding Carry out subsequent processing;

[0094] Otherwise, proceed to the next step;

[0095] Step S122B, P k+1 Reset to the value of P calculated in step S120B k+n If the same, repeat steps S107 to S121B until the historical sewage data Z at the k+nth moment is k+n With the state estimate X k+n The absolute value of the difference is less than or equal to the corresponding second preset threshold, and then adopt Instead of the corresponding Perform subsequent processing.

[0096] In this embodiment, after filtering the historical sewage data through the Kalman filter algorithm, the abnormal data is replaced, thereby ensuring the integrity and time granularity of the historical sewage data, which is beneficial to improving the prediction accuracy of the selective state space model Mamba.

[0097] When the historical sewage data is imported into the selective state space model Mamba for training in step S1 of this embodiment, the historical sewage data set is first divided into a training set, a validation set and a test set according to a preset ratio (for example, 7:1:2), and then imported into the selective state space model Mamba for training; at the same time, the selective state space model Mamba uses the mean square error MSE as the loss function to minimize the difference L between the predicted value and the actual value, which is expressed as: ;

[0098] In the formula, N is the number of samples;

[0099] is the predicted sewage data predicted by the selective state space model Mamba;

[0100] y n It is the sewage data actually detected at the same time.

[0101] When the selective state space model Mamba is trained in step S1 of this embodiment, the specific operation process includes the following process:

[0102] Step S122, normalize the historical sewage data in the read time series to obtain ;

[0103] In the formula, L represents the length of historical sewage data, and M represents the dimension of historical sewage data;

[0104] Represents a real number of dimension M×L;

[0105] Step S123, the input X0 is processed by embedding layer E1 and embedding layer E2 to obtain: ; ;

[0106] Where, DO represents the dropout operation;

[0107] The embedding layer E1 and the embedding layer E2 implement the embedding operation by using the multi-layer perceptron P1 and the multi-layer perceptron P2 respectively;

[0108] Step S123, integrating four Mamba modules based on the state space model, and organizing two Mamba modules into pairs to form an external Mamba pair and an internal Mamba pair; the external Mamba pair and the internal Mamba pair process X1 and X2; wherein the external Mamba pair processes the high-resolution representation, and the internal Mamba pair processes the low-resolution representation;

[0109] Step S124, use the multilayer perceptron P3 to map the output of the internal Mamba pair to the same dimension as the external Mamba pair; and use the multilayer perceptron P4 to combine the outputs of all Mamba modules and map them to the state estimation under the final time series. At the same time, in this step, residual connections are introduced before the input and after the output of the multilayer perceptron P3 to promote gradient flow and improve training stability.

[0110] Due to the influence of factors such as water quality fluctuations in sewage treatment plants, the selective state space model Mamba may have a problem of decreased prediction accuracy after running for a period of time. Therefore, after the selective state space model Mamba trained in step S3 of this embodiment has been running for more than a preset time (for example, 7 days), refer to step S1 to re-read the historical sewage data in the time series stored in the database for updating and optimization.

[0111] It should be noted that in this embodiment, the real-time sewage data is regarded as historical sewage data after being stored in the database, and can be used for updating and optimizing the selective state space model Mamba. At the same time, when updating and optimizing the selective state space model Mamba, all historical sewage data can be selected, or part of the historical sewage data newly stored before performing the update optimization can be selected.

[0112] The following is a more specific example:

[0113] The operating data of a sewage treatment plant includes the PAC dosing rate of the high-density pool, as well as the pH, temperature, suspended solids SS, total phosphorus, total nitrogen, and ammonia nitrogen NH4 of the inlet and outlet water. + -N, chemical oxygen demand COD and flow rate and other parameters. The original data sampling frequency is once a minute, and it is resampled in the database to once every two hours. After the abnormal data is identified and replaced, the data set is divided into training set, validation set and test set in a ratio of 7:1:2. Use the data of the first 12 time points (24 hours) to predict the operating parameters of the next 1 time point (2 hours later). Use the Adam optimizer for model training, the learning rate is set to 0.0001, and the batch size is 64. To prevent overfitting, dropout=0.5 and early stopping technology are used. After multiple model trainings, a better hyperparameter configuration is found. After deploying the selective state space model Mamba, use a scheduled task to predict data once a minute. For example, the real-time monitoring of the PMC addition acceleration of the high-density pool A and the prediction of the PMC addition acceleration of the high-density pool A using the selective state space model Mamba, the results of the predicted value curve (orange line) and the monitored true value curve (cyan line) are shown in the following figure. Figure 1 As shown in the figure, it can be seen that the predicted value is highly consistent with the actual value.

[0114] Example 2

[0115] This embodiment provides a sewage treatment plant parameter prediction system based on machine learning to implement the sewage treatment plant parameter prediction method based on machine learning as disclosed in Example 1. The sewage treatment plant parameter prediction system based on machine learning includes: a collection module, a storage database module and a prediction module.

[0116] Among them, the acquisition module is used to obtain real-time sewage data in the time series of the previous stage and the next stage. The storage database module is used to receive and store the historical sewage data and real-time sewage data collected by the acquisition module. The prediction module is built with a selective state space model Mamba; the prediction module reads the historical sewage data stored in the storage database module, and trains the selective state space model Mamba, and then based on the real-time sewage data in the time series of the previous stage collected by the acquisition module, the trained selective state space model Mamba performs parameter prediction to obtain the predicted sewage data for the operation control of the sewage plant in the next stage, and then sends the predicted sewage data to the storage database module for storage.

[0117] A sewage treatment plant parameter prediction system based on machine learning provided in this embodiment has significant advantages in predicting key operating parameters of sewage treatment plants, and exhibits good high precision, peak and valley capture, stability and adaptability, based on the innovative time series prediction technology of the selective state space model Mamba.

Claims

1. A method for predicting parameters of a sewage treatment plant based on machine learning, characterized in that: The following steps are involved: Step S1, reading the historical sewage data in the time series stored in the database, and importing the historical sewage data into the selective state space model Mamba for training; Step S2, collecting real-time sewage data in the previous stage time series, and storing the real-time sewage data in a database; Step S3, read the real-time sewage data stored in the database regularly according to the demand, and use the trained selective state space model Mamba to predict the parameters, so as to obtain the predicted sewage data for the operation control of the sewage treatment plant in the next stage of time series; at the same time, synchronously collect the real-time sewage data in the next stage of time series; Step S4, storing the predicted sewage data and the real-time sewage data of the next stage in a database; In step S1, after reading the historical sewage data in the time series stored in the database, the Kalman filter algorithm is first used to filter the historical sewage data to identify whether there is abnormal data; If abnormal data is identified, the calculated value obtained by the Kalman filter algorithm is used to replace the corresponding abnormal data; When the historical sewage data is imported into the selective state space model Mamba for training in step S1, the specific operation process includes the following process: Step S122, normalize the historical sewage data in the read time series to obtain ; In the formula, L represents the length of historical sewage data, and M represents the dimension of historical sewage data; Represents a real number of dimension M×L; Step S123, the input X0 is processed by embedding layer E1 and embedding layer E2 to obtain: ; ; Where, DO represents the dropout operation; The embedding layer E1 and the embedding layer E2 implement the embedding operation by using the multi-layer perceptron P1 and the multi-layer perceptron P2 respectively; Step S123, integrating four Mamba modules based on the state space model, and organizing two Mamba modules into pairs to form an external Mamba pair and an internal Mamba pair; the external Mamba pair and the internal Mamba pair process X1 and X2; wherein the external Mamba pair processes the high-resolution representation, and the internal Mamba pair processes the low-resolution representation; Step S124, using the multilayer perceptron P3 to map the output of the internal Mamba pair to the same dimension as the external Mamba pair; and using the multilayer perceptron P4 to combine the outputs of all Mamba modules and map them to the state estimation under the final time series.

2. The method for predicting parameters of a sewage treatment plant based on machine learning according to claim 1, characterized in that: When the Kalman filter algorithm is used to filter the historical sewage data in step S1, the specific process includes the following: Step S101, setting the historical sewage plant observation data set of historical sewage data ; Among them, Z k Represents the historical sewage data at the kth moment in the time series; Step S102, inputting the initial state estimate X0 and its covariance matrix P0 at the initial moment, and then using the Kalman filter algorithm to calculate the state estimate X1 and its covariance matrix P1 at the first moment based on the historical sewage plant observation data set Z, the initial state estimate X0 and the covariance matrix P0; Step S103: based on the historical sewage treatment plant observation data set Z and the state estimation X at the k-1th moment k-1 and its covariance matrix P k-1 , use the Kalman filter algorithm to calculate the state estimate X at the kth moment k and its covariance matrix P k ; Step S104, repeat step S103 until the state estimate X at the Nth moment is calculated using the Kalman filter algorithm. N and its covariance matrix P N ; Step S105, one by one, the historical sewage data Z1 from the first moment to the historical sewage data Z at the Nth moment N , and the corresponding state estimate X1 at the first moment to the state estimate X at the Nth moment N Make comparisons; If the absolute value of the difference between the historical sewage data and the corresponding state estimation exceeds the corresponding first preset threshold, the historical sewage data at the corresponding moment is regarded as abnormal data.

3. The method for predicting parameters of a sewage treatment plant based on machine learning according to claim 2 is characterized in that: When the calculated value obtained by the Kalman filter algorithm is used to replace the corresponding abnormal data in step S1, the specific process includes the following: Step S106A, setting the historical sewage plant observation data set of historical sewage data ; Among them, Z k It represents the historical sewage data at the kth moment in the time series, and it is abnormal data; Step S107A: input the state estimate X at the k-1th moment k-1 and its covariance matrix P k-1 , then based on the historical sewage plant observation data set Z, state estimation X k-1 and its covariance matrix P k-1 , calculate the state estimate X at the kth moment according to the Kalman filter algorithm k ; Step S108A, using the state estimate X at the kth moment k Replace historical sewage data Z k Perform subsequent processing.

4. The method for predicting parameters of a sewage treatment plant based on machine learning according to claim 2, characterized in that: When the calculated value obtained by the Kalman filter algorithm is used to replace the corresponding abnormal data in step S1, the specific process includes the following: Step S106B, setting the historical sewage plant observation data set of historical sewage data ;in, It represents the set of historical sewage data from the k+1th moment to the k+n-1th moment in the time series, and is a set of abnormal data; Step S107B: input the state estimate X at the k+1th moment k+1 and its covariance matrix P k+1 , then based on the historical sewage plant observation data set Z, state estimation X k+1 and its covariance matrix P k+1 , use the Kalman filter algorithm to calculate the state estimate X at the k+2th moment k+2 ; Step S108B, based on the historical sewage plant observation data set Z and the state estimation X k+n-2 And the covariance matrix P k+n-2 , use the Kalman filter algorithm to calculate the state estimate X at the k+n-2th moment k+n-2 ; Step S109B, repeat step S108B until the state estimate X at the k+n-1th moment is calculated using the Kalman filter algorithm. k+n-1 and its cosquare matrix difference P k+n-1 ; Among them, P k+1 =P k+2 =···=P k+n-2 ; Step S120B, based on the historical sewage plant observation data set Z and the state estimation X k+n-1 and its cosquare matrix difference P k+n-1 , calculate the state estimate X at the k+nth moment k+n and its cosquare matrix difference P k+n ; Step S121B, the historical sewage data Z at the k+nth moment k+n With the state estimate X k+n Make comparisons; If the historical sewage data Z k+n With the state estimate X k+n If the absolute value of the difference is less than or equal to the corresponding second preset threshold, then directly adopt Instead of the corresponding Carry out subsequent processing; Otherwise, proceed to the next step; Step S122B, P k+1 Reset to the value of P calculated in step S120B k+n If the same, repeat steps S107 to S121B until the historical sewage data Z at the k+nth moment is k+n With the state estimate X k+n The absolute value of the difference is less than or equal to the corresponding second preset threshold, and then adopt Instead of the corresponding Perform subsequent processing.

5. The method for predicting parameters of a sewage treatment plant based on machine learning according to claim 1, characterized in that: When the historical sewage data is imported into the selective state space model Mamba for training in step S1, the historical sewage data set is first divided into a training set, a validation set, and a test set according to a preset ratio, and then imported into the selective state space model Mamba for training; at the same time, the selective state space model Mamba uses the mean square error MSE as the loss function to minimize the difference L between the predicted value and the actual value, which is expressed as: ; In the formula, N is the number of samples; is the predicted sewage data predicted by the selective state space model Mamba; y n It is the sewage data actually detected at the same time.

6. The method for predicting parameters of a sewage treatment plant based on machine learning according to claim 1, characterized in that: In step S124, residual connections are introduced before the input and after the output of the multilayer perceptron P3.

7. The method for predicting parameters of a sewage treatment plant based on machine learning according to any one of claims 1 to 6, characterized in that: After the selective state space model Mamba trained in step S3 is used for more than a preset time, the historical sewage data in the time series stored in the database is re-read with reference to step S1 for updating and optimization.

8. A sewage treatment plant parameter prediction system based on machine learning, for implementing the sewage treatment plant parameter prediction method based on machine learning as described in any one of claims 1 to 7, characterized in that: include: A collection module, the collection module is used to obtain real-time sewage data in the time series of the previous stage and the next stage; A storage database module, the storage database module is used to receive the historical sewage data and real-time sewage data collected by the collection module and store them; A prediction module, wherein the prediction module has a built-in selective state space model Mamba; the prediction module reads the historical sewage data stored in the storage database module, and trains the selective state space model Mamba, and then performs parameter prediction based on the real-time sewage data in the previous stage time series collected by the acquisition module, using the trained selective state space model Mamba to obtain predicted sewage data for the operation control of the sewage plant in the next stage, and then sends the predicted sewage data to the storage database module for storage.

Citation Information

Patent Citations

  • Method for predicting industrial sewage inflow based on ARIMA model

    CN108564229A

  • Method for accurately predicting effluent quality of sewage treatment plant

    CN111553468A