A Machine Learning-Based Method for Optimizing Phosphorus Removal Agent Dosing in Wastewater Treatment

By integrating mechanistic and data-driven models using machine learning methods, and combining clustering algorithms and custom loss functions, the dosage of phosphorus removal agents in wastewater treatment is optimized. This solves the problems of phosphorus removal efficiency versus cost balance, influent water quality fluctuations, and insufficient real-time optimization capabilities in existing technologies, and achieves efficient and economical phosphorus removal agent dosage control.

CN120122575BActive Publication Date: 2026-01-30SHANGHAI MUNICIPAL ENG DESIGN INST (GRP) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510145935.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2026-01-30
Estimated Expiration
2045-02-10

AI Technical Summary

Technical Problem

Existing wastewater treatment technologies have shortcomings in balancing phosphorus removal efficiency and cost, influent water quality fluctuations, lack of real-time optimization capabilities, and insufficient model prediction accuracy, making it difficult to meet the needs of efficient, economical, and real-time control.

Method used

By employing a machine learning-based approach, a wastewater control feedforward table is established, an efficient optimization interval is defined, a mechanistic model and a data-driven model are integrated, and a clustering algorithm and a custom loss function are combined to optimize the dosage of phosphorus removal agent and achieve real-time control.

Benefits of technology

It improves the accuracy of phosphorus removal agent dosage prediction, enhances phosphorus removal efficiency, reduces reagent costs, and achieves real-time optimized control and effluent water quality compliance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120122575B_ABST
    Figure CN120122575B_ABST
Patent Text Reader

Abstract

This invention discloses an optimization method for phosphorus removal agent dosing in wastewater treatment based on machine learning, comprising the following steps: S1; establishing a wastewater control feedforward table as a baseline value for phosphorus removal agent dosing flow rate; S2: defining an efficient optimization interval based on the baseline value; S3: using a clustering algorithm to screen for efficient optimization intervals; S4: using a machine learning algorithm to fit the relationship between the data and the efficient optimization intervals; S5: calculating the optimized value for the new data. This invention, through its innovative technical solution, can improve the accuracy of phosphorus removal agent dosing prediction, increase the phosphorus removal efficiency of wastewater treatment plants, and reduce reagent costs, possessing significant practical application value and promotional significance.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of sewage treatment, and particularly relates to a method for optimizing dosing of a phosphorus removal agent for sewage treatment based on machine learning. BACKGROUND

[0002] With the rapid development of industrialization and urbanization, the amount of sewage discharge is increasing. If the phosphorus element in sewage is not removed in time, it will lead to water eutrophication and cause serious damage to the ecological environment. Therefore, how to efficiently and economically remove phosphorus from sewage has become an important problem in the wastewater treatment industry. There are four main points: 1. Balance between phosphorus removal efficiency and cost: In actual operation, wastewater treatment plants need to ensure that the total phosphorus (TP) concentration of the effluent meets environmental standards, which often requires precise control of the dosage of phosphorus removal agents. Excessive dosage of phosphorus removal agents can improve phosphorus removal efficiency, but will lead to an increase in reagent costs and increase operating costs. Insufficient dosage may result in non-compliance of the effluent and face environmental penalties. 2. Large fluctuations in influent water quality: The quality and quantity of wastewater have a high degree of uncertainty, influenced by factors such as season, weather, and industrial emissions. The TP concentration and flow of the influent fluctuate greatly, posing challenges to the dosing control of phosphorus removal agents. 3. Lack of real-time optimization capability: Traditional phosphorus removal agent dosing control methods have slow response speed and cannot quickly adjust to real-time changes in influent water quality, resulting in unstable phosphorus removal efficiency. 4. Insufficient model prediction accuracy: Existing dosing quantity prediction models are limited by model structure or data quality and cannot accurately reflect the complex wastewater treatment process, resulting in low dosing control accuracy. In the face of these challenges, the industry has proposed some methods and technical means for phosphorus removal agent dosing control, attempting to improve phosphorus removal efficiency and reduce operating costs. However, these existing technologies still have many shortcomings in practical application and are difficult to fully meet the needs of wastewater treatment plants for efficient, economic, and real-time control.The existing methods still have a lot of room for improvement in adapting to complex working conditions, improving model accuracy and real-time optimization capability, etc. Among them: 1. Many sewage treatment plants still use fixed dosage or simple proportional dosing methods, and the dosage of phosphorus removal agent is set according to experience or simple rules. This method cannot adapt to the dynamic changes of influent water quality and flow, and is prone to waste of chemicals or poor phosphorus removal effect; 2. Mechanism models based on chemical reaction principles can provide some guidance, but due to the complexity of sewage composition and numerous influencing factors, mechanism models are difficult to accurately describe actual working conditions, model parameters are difficult to obtain and calibrate, resulting in limited prediction accuracy and application limitations of single models; 3. Machine learning models (data-driven models such as traditional LSTM models) that rely on historical data can capture nonlinear relationships between data to some extent, but lack of integration of professional knowledge of sewage treatment process, the model has poor generalization ability and insufficient interpretability, making it difficult to maintain high accuracy in complex working conditions; 4. Existing machine learning models usually do not fully consider professional knowledge in the field of sewage treatment, such as chemical reaction kinetics and environmental factors, lack of professional knowledge integration, resulting in poor performance of the model in handling abnormal situations or extreme working conditions; 5. Some advanced control methods, such as reinforcement learning algorithms based on intelligent agents, have high training and calculation complexity, making it difficult to achieve real-time optimization in actual operation, and lack of real-time optimization capability, in addition, these methods may rely on simulated environments, and have limited adaptability to actual applications. SUMMARY

[0003] Therefore, the purpose of the present application is to provide a method for optimizing the dosage of phosphorus removal agent in sewage treatment based on machine learning to solve the problems in the prior art.

[0004] In order to achieve the above purpose, the present application is realized by the following technical scheme:

[0005] The present application provides a method for optimizing the dosage of phosphorus removal agent in sewage treatment based on machine learning, which comprises the following steps:

[0006] S1. Establish a sewage control feedforward table as a reference value for the dosage of phosphorus removal agent;

[0007] S2. Define an efficient optimization interval based on the reference value;

[0008] S3. Use a clustering algorithm to screen the efficient optimization interval;

[0009] S4. Use a machine learning algorithm to fit the relationship between data and the efficient optimization interval;

[0010] S5. Calculate the optimization value for new data.

[0011] The method for optimizing the dosage of phosphorus removal agent in sewage treatment based on machine learning, wherein step S1 comprises:

[0012] S11. Data collection: Collect historical operating data of the wastewater treatment plant for one year. The collected data includes influent water quality parameters, influent flow rate, control parameters, actual dosage of chemicals, and effluent parameters.

[0013] S12. Data preprocessing, including data cleaning, data standardization, feature derivation, and feature selection, among which:

[0014] Data cleaning refers to handling missing and outlier values, using interpolation to fill in missing data, and removing obviously abnormal data points.

[0015] Data standardization refers to the standardization process of characteristic data of different dimensions so that their mean is 0 and their variance is 1.

[0016] Derived features refer to the processing and calculation of collected influent water quality parameters, influent flow rate, control parameters, and effluent parameters based on the maximum, minimum, average, first-order and second-order differences within a fixed time window, thereby increasing the feature dimensions.

[0017] Feature selection refers to using correlation analysis and principal component analysis to screen out derived features that have a significant impact on phosphorus removal efficiency, thereby improving the training efficiency and prediction accuracy of the model.

[0018] S13. Establishment of the fusion model and generation of the feedforward table. The fusion model consists of two parts: mechanism model construction and data-driven model construction. The fused model is obtained through model fusion, and finally the feedforward control table is obtained.

[0019] As described in the method for optimizing phosphorus removal agent dosing in wastewater treatment based on machine learning, step S13 includes:

[0020] S131. Mechanism Model Construction: Based on the reaction principle of chemical phosphorus removal, a quantitative relationship model is established between PAC dosage and influent TP concentration and influent flow rate. The following mechanism model is established:

[0021] Q PAC =k×C TP-in ×Q in +b

[0022] Among them, Q PAC For PAC dosage, C TP-in Q represents the influent TP concentration. in The influent flow rate is given, and k and b are model parameters determined by fitting historical data.

[0023] S132, data-driven model construction, a long short-term memory network model is constructed, the input is the water quality parameter and the derived feature of the previous several hours, and the output is the PAC dosage at the corresponding time. The preprocessed data is used to train the LSTM model on the training set, the mean square error is used as the loss function, and the Adam optimizer is used for iterative optimization. The model performance is evaluated on the validation set, and the mean square error and mean absolute error indicators are calculated to ensure that the model has good generalization ability;

[0024] S133, fusion strategy design, including but not limited to two model fusion methods: cascade fusion and weighted fusion. Cascade fusion refers to taking the output of the mechanism model as one of the input features of the LSTM model, so that the LSTM model learns the information of the mechanism model during the learning process, and improves the prediction accuracy. Weighted fusion refers to weighting and averaging the prediction results of the mechanism model and the LSTM model during the model output stage. The weight coefficient is determined according to the performance of the model on the validation set.

[0025] S134, fusion model training and verification, the fusion model is trained and optimized, the weight coefficient in the fusion strategy and the hyperparameters of the LSTM model are adjusted to improve the prediction performance of the model. The performance of the fusion model is evaluated on the validation set, and compared with the single model to verify the superiority of the fusion model.

[0026] S135, generation of wastewater control feedforward table, including two steps of multi-dimensional parameter mapping and benchmark value determination. Multi-dimensional parameter mapping refers to using the trained fusion model to input different combinations of influent water quality parameters and flow to predict the corresponding PAC dosage flow, and generating a feedforward control table covering various operating conditions. The PAC dosage flow in the feedforward control table is the benchmark value for reference in actual operation.

[0027] As described in the method for optimizing the dosage of phosphorus removal agent in wastewater treatment based on machine learning, wherein step S2 comprises:

[0028] S21, define an efficient optimization interval based on the benchmark value. The efficient optimization interval definition method includes but is not limited to the following methods: an optimization method based on phosphorus removal efficiency, an optimization method based on agent utilization rate, and an optimization method based on cost-effectiveness.

[0029] S22, data set division based on the efficient optimization interval, including data screening and training set and validation set division. Data screening refers to selecting the corresponding efficient interval data according to the definition method selected in S21 to form a new data set. Training set and validation set division refers to dividing the efficient interval data into training set and validation set according to the ratio of 5:1.

[0030] As described in the method for optimizing the dosage of phosphorus removal agent in wastewater treatment based on machine learning, wherein in step S21:

[0031] The optimization method based on phosphorus removal efficiency is: for each data point, the phosphorus removal efficiency Set the phosphorus removal efficiency threshold to 85%, and select the data higher than the threshold as the high-efficiency interval;

[0032] The optimization interval screening method based on the utilization rate of the agent is: calculate the ratio of the actual dosage to the theoretical dosage Set the data with a utilization rate of the agent in the range of 95% to 100% as the high-efficiency interval;

[0033] The optimization method based on cost benefit is: calculate the cost of the agent per unit of phosphorus removal Where P PAC is the price of PAC, and a multi-objective optimization method is used to select data with high phosphorus removal efficiency and low cost as the high-efficiency interval.

[0034] The method for optimizing the dosage of a phosphorus removal agent in wastewater treatment based on machine learning, wherein step S3 comprises:

[0035] S31, feature selection, which refers to selecting the influent parameters and optimization values as clustering features;

[0036] S32, perform clustering, use the K-means clustering algorithm, use the elbow method to determine the optimal number of clusters K, and cluster the training set data in the high-efficiency optimization interval to obtain K cluster centers, i.e. representative optimization values;

[0037] S33, establish an optimization value library, record the optimization values of the cluster centers and their corresponding feature ranges to form an optimization value library, which facilitates subsequent model learning and matching of new data.

[0038] The method for optimizing the dosage of a phosphorus removal agent in wastewater treatment based on machine learning, wherein step S4 comprises:

[0039] S41, design an improved algorithm model that integrates domain expertise, including custom loss function design and optimization model architecture, and the custom loss function is as follows:

[0040] L = α·MSE(ΔQ PAC ) + β·P(C TP-out ) + γ·Cost(Q PAC-final )

[0041] Where: MSE(ΔQ PAC ) is the mean square error of the optimization value, P(C TP-out ) is a penalty term for the effluent TP concentration, and when the predicted dosage leads to an effluent TP concentration that exceeds the standard, a larger penalty is given; Cost(Q PAC-final) the cost of reagent addition, the model encourages to reduce the reagent usage under the premise of meeting the effluent quality requirements;

[0042] The optimization model architecture refers to introducing a chemical reaction kinetics mechanism on the basis of a long short-term memory neural network to simulate the reaction kinetics of phosphate and PAC.

[0043] S42, model training and verification, as a feasible implementation process of the model training process, a self-defined loss function L is used, an Adam optimizer is used for training, and the effectiveness of the model is determined by evaluating the performance evaluation indicators of the output and the prediction target.

[0044] As the method for optimizing the reagent addition of phosphorus removal in sewage treatment based on machine learning, wherein the model architecture is composed of an input layer, a reaction kinetics module, a neural network layer and an output layer, the input layer includes but is not limited to influent water quality parameters, influent flow, environmental parameters, historical effluent parameters and derived features thereof; the reaction kinetics module calculates the current reaction rate constant related mechanism operating parameters based on the above parameters; the neural network layer inputs the reaction kinetics module output and the remaining features into the neural network together for deep feature extraction and prediction; and the output layer is used to predict the optimized ΔQ PAC , ΔQ PAC is the difference between the actual PAC addition amount and the reference value of the feedforward control addition table.

[0045] As the method for optimizing the reagent addition of phosphorus removal in sewage treatment based on machine learning, wherein step S5 comprises:

[0046] S51, new data acquisition and preprocessing, the influent water quality parameters, influent flow and related derived features at the current time are acquired in real time through online monitoring equipment;

[0047] S52, data matching and calculation, the features of the new data are input into the clustering model in step S3 to determine whether they fall within a certain clustering radius, if the matching is successful, the optimized addition value corresponding to the clustering is directly used; if the matching fails, the improved machine learning model in step S4 is used to input the new data and predict the corresponding optimized addition value ΔQ PAC-opt , and the final optimized addition amount is Q PAC-final = Q PAC-baseline + ΔQ PAC-opt , wherein Q PAC-baseline is the reference addition amount provided by the feedforward table, and ΔQ PAC-opt is the optimized addition value.

[0048] The beneficial effects of the technical scheme of the present application are:

[0049] The professional knowledge in the field of sewage treatment is introduced, the machine learning algorithm is improved, and the generalization ability and actual application effect of the model are improved, which is specifically embodied in:

[0050] 1. Construction of a fusion model: effectively fuse the mechanism model and the data-driven model, utilize the physical interpretability of the mechanism model and the high-precision prediction ability of the data-driven model, and construct a reliable dosage benchmark value model;

[0051] 2. Definition and simplification of efficient optimization interval: propose multiple definition methods of efficient optimization interval, simplify the optimization value by combining clustering algorithm, reduce the complexity of the model, and enhance the flexibility and applicability of the method;

[0052] 3. Professional knowledge into machine learning algorithm: through the design of a self-defined loss function and the improvement of the model structure, the water quality requirements, the cost of reagent and other professional knowledge are integrated into the training process of the machine learning model, so that the prediction accuracy and the actual benefit of the model are improved;

[0053] 4. Real-time optimization control: design a model and algorithm that avoids relying on future data, realize real-time optimization control of the phosphorus removal agent dosage, and ensure that the effluent water quality meets the standard while reducing the operating cost.

[0054] In summary, the present application can improve the accuracy of phosphorus removal agent dosage prediction, improve the phosphorus removal efficiency of the sewage treatment plant, and reduce the cost of reagents, and has important practical application value and popularization significance. BRIEF DESCRIPTION OF DRAWINGS

[0055] In order to further illustrate the above-mentioned purposes, structural characteristics and effects of the present application, the present application will be described in detail below in conjunction with the drawings.

[0056] Figure 1 It is a flow chart of the method of the preferred embodiment of the present application. DETAILED DESCRIPTION

[0057] The terms "invention" and "the present invention" used in the present specification are intended to refer broadly to all of the subject matter of this specification and any patent claims below. Statements containing these terms should be understood not to limit the subject matter described herein or to limit the meaning or scope of any patent claims below. Furthermore, this specification does not intend to describe or limit the subject matter covered by any claims in their specific form and is intended to cover in their full scope all such subject matter. The present invention can have other embodiments and be practiced or implemented in other ways. Moreover, it should be understood that the language and terminology used herein are for the purpose of description and should not be considered as limiting.

[0058] The details of the present application will now be discussed with reference to the accompanying drawings, which illustrate the present application by way of example only. In the drawings, like features or components can be denoted by the same reference signs.

[0059] The use of "including", "has", "having" and "includes" and variations thereof herein is meant to encompass the items listed thereafter and equivalents and additional items. Although the above description refers to directional terms such as above, below, up, down, front, back, top, bottom, rear, etc., with reference to the orientation of the figure, the direction terms are used for the convenience of the reader and are not intended to be limiting as to the orientation of the application. Additionally, terms such as "first", "second", "third", etc. are used herein for purposes of description and are not intended to indicate or imply importance or significance.

[0060] Referring to Figure 1 The present application is used for the method of sewage treatment phosphorus removal agent dosing optimization, wherein, comprising the following steps:

[0061] S1; Establish sewage control feedforward table, as the benchmark value of phosphorus removal agent dosing flow;

[0062] S2: Based on the benchmark value, define the efficient optimization interval;

[0063] S3: The clustering algorithm is used to screen the efficient optimization interval;

[0064] S4: The machine learning algorithm is used to fit the relationship between data and efficient optimization interval;

[0065] S5: The new data is optimized for value calculation.

[0066] In the preferred embodiment, a sewage treatment plant with a daily treatment capacity of 100,000 tons is used as the object, which uses chemical phosphorus removal process, and 10% concentration of polyaluminum chloride (PAC) is added to the sedimentation tank through the dosing flow pump to realize efficient phosphorus removal. The dosing system is controlled by a remote programmable logic controller (PLC), which can realize frequency regulation of the dosing pump and has fast response speed.

[0067] The following is a description of the specific implementation process in the order of S1-S5, as follows:

[0068] S1; Establish sewage control feedforward table, as the benchmark value of phosphorus removal agent dosing flow.

[0069] S2: Based on the benchmark value, define the efficient optimization interval;

[0070] S3: The clustering algorithm is used to screen the efficient optimization interval;

[0071] S4: The machine learning algorithm is used to fit the relationship between data and efficient optimization interval;

[0072] S5: The new data is optimized for value calculation.

[0073] In this embodiment, the specific implementation process of S1 is as follows:

[0074] S11: Data collection, where the data collection refers to collecting the historical operation data of the sewage treatment plant for one year, and the data collection interval is 1 hour. The collected data includes: influent water quality parameters: total nitrogen (TN), ammonia nitrogen (NH3-N), chemical oxygen demand (COD), five-day biochemical oxygen demand (BOD5), total phosphorus (TP, concentration range 5-20 mg / L), phosphate (PO4 3- ), pH value, temperature; influent flow: standard influent flow, fluctuation range ± 20%; control parameters: dosing pump flow, reagent concentration (10% concentration of PAC), actual dosing amount; effluent parameters: effluent total phosphorus (TP) concentration.

[0075] S12: Data preprocessing, including data cleaning, data standardization, derived features, and feature selection. Data cleaning refers to handling missing values and outliers, using interpolation method to fill in missing data, and excluding obviously abnormal data points; data standardization refers to standardizing different dimensional feature data, making the mean value 0 and the variance 1; derived features refer to processing and operating the collected influent water quality parameters, influent flow, control parameters, and effluent parameters based on fixed time window (such as 3 hours) maximum, minimum, average, first and second order difference, etc., to increase feature dimension; feature selection refers to using correlation analysis and principal component analysis (PCA) to screen out derived features that significantly affect phosphorus removal effect, to improve the training efficiency and prediction accuracy of the model.

[0076] S13: Establishment of fusion model and generation of feedforward table. The fusion model includes mechanism model construction and data-driven model construction, and the final feedforward control table is obtained by model fusion. The specific implementation process is as follows:

[0077] S131: Mechanism model construction. Based on the reaction principle of chemical phosphorus removal, a quantitative relationship model between PAC dosage and influent TP concentration, influent flow is established. Considering the stoichiometric ratio of PAC dosing and phosphate in wastewater to form precipitate, and the influence of environmental factors such as pH value and temperature in the reaction process, the following mechanism model is established:

[0078] Q PAC = k x C TP-in x Q in + b

[0079] Where Q PAC is the PAC dosage, C TP-in is the influent TP concentration, Q in is the influent flow, k and b are model parameters determined by historical data fitting.

[0080] S132: Data-driven model construction. A long short-term memory network (LSTM) model is constructed, with the input being the water quality parameters and derived features of the previous several hours, and the output being the PAC dosage at the corresponding time. Using the preprocessed data, the LSTM model is trained on the training set, with mean squared error (MSE) as the loss function and Adam optimizer for iterative optimization. The model performance is evaluated on the validation set, with indicators such as mean squared error (MSE) and mean absolute error (MAE) calculated to ensure good generalization ability of the model.

[0081] S133: Fusion strategy design. Including but not limited to two model fusion methods: cascade fusion, weighted fusion. The cascade fusion refers to taking the output of the mechanism model as one of the input features of the LSTM model, so that the LSTM model learns the information of the mechanism model during the learning process, and improves the prediction accuracy; the weighted fusion refers to weighting and averaging the prediction results of the mechanism model and the LSTM model in the model output stage, and the weight coefficient is determined according to the performance of the model on the validation set.

[0082] S134: Fusion model training and verification. The fusion model is trained and optimized, the weight coefficient in the fusion strategy and the hyperparameters of the LSTM model are adjusted to improve the prediction performance of the model. The performance of the fusion model is evaluated on the validation set, compared with single model, and the superiority of the fusion model is verified.

[0083] S135: Generation of wastewater control feedforward table. It contains two steps of multi-dimensional parameter mapping and benchmark value determination. The multi-dimensional parameter mapping refers to using the trained fusion model to input different combinations of influent water quality parameters and flow, to predict the corresponding PAC dosage, and to generate a feedforward control table covering various operating conditions; the benchmark value determination refers to the PAC dosage in the feedforward control table as the benchmark value for reference in actual operation.

[0084] In this embodiment, the specific implementation process of S2 is as follows:

[0085] S21: Define the efficient optimization interval based on the benchmark value. The efficient optimization interval definition method includes but is not limited to the following methods: optimization method based on phosphorus removal efficiency; optimization method based on reagent utilization rate; optimization method based on cost-effectiveness. Specifically, the optimization method based on phosphorus removal efficiency steps are: for each data point, calculate the phosphorus removal efficiency Set the phosphorus removal efficiency threshold to 85%, and select the data higher than the threshold as the efficient interval; the optimization interval selection method based on reagent utilization rate is to calculate the ratio of actual dosage to theoretical dosage A pesticide utilization rate within the range of 95% to 100% is defined as the high-efficiency range; the cost-effectiveness-based optimization method calculates the pesticide cost per unit of phosphorus removal. in PPAC To determine the price of PAC, a multi-objective optimization method was used to select data with high phosphorus removal efficiency and low cost as the high-efficiency range.

[0086] S22: Dataset partitioning based on efficient optimization intervals. This includes two steps: data filtering and training / validation set partitioning. Data filtering refers to selecting the corresponding efficient interval data according to the definition method chosen in S02-1 to form a new dataset; training / validation set partitioning refers to dividing the efficient interval data into a training set and a validation set at a ratio of 5:1.

[0087] In this embodiment, to simplify the complexity of optimized values ​​in subsequent machine learning algorithm training, a clustering algorithm is used to cluster the optimized values ​​in the efficient optimization interval, grouping similar optimized values ​​into one category, and extracting representative optimized values ​​as unselected objects. The specific implementation process of S03 is as follows:

[0088] S31: Feature selection. Feature selection refers to selecting influent parameters, optimized values, etc., as clustering features.

[0089] S32: Perform clustering. Use the K-means clustering algorithm and the elbow method to determine the optimal number of clusters K. Cluster the training data in the efficient optimization interval to obtain K cluster centers, which represent the optimal values.

[0090] S33: Establish an optimized value library. Record the optimized values ​​of cluster centers and their corresponding feature ranges to form an optimized value library, which will facilitate subsequent model learning and matching with new data.

[0091] In this embodiment, to make the training of the machine learning model more in line with the actual needs of the phosphorus removal process, an improved algorithm model that integrates domain expertise was designed. The specific implementation process of S4 is as follows:

[0092] S41: Design an improved algorithm model that integrates domain expertise. This includes the following improvements: custom loss function design and optimized model architecture. The custom loss function is as follows:

[0093] L=α·MSE(ΔQ PAC )+β·P(C TP-out )+γ·Cost(Q PAC-final )

[0094] Where: MSE(ΔQ) PAC P(C) represents the mean square error of the optimized value; TP-out) is a penalty term for effluent TP concentration. When the predicted dosage leads to effluent TP concentration exceeding the standard, a larger penalty is given; Cost(Q PAC-final ) is the cost of reagent dosage, which encourages the model to reduce the amount of reagent used on the premise of meeting the effluent water quality requirements.

[0095] The optimization model architecture refers to introducing a chemical reaction kinetics mechanism based on the long short-term memory neural network to simulate the reaction kinetics of phosphate and PAC. Preferably, it can be embodied as a module to calculate the reaction rate and phosphorus removal efficiency under different conditions.

[0096] One schematic of the model architecture can be composed of an input layer, a reaction kinetics module, a neural network layer, and an output layer. Specifically, the input layer includes but is not limited to influent water quality parameters, influent flow, environmental parameters (such as temperature, pH value), historical effluent parameters, and derived features thereof; the reaction kinetics module can calculate the current reaction rate constant and other related mechanism operating parameters based on the above parameters; the neural network layer inputs the reaction kinetics module output and other features into the neural network for deep feature extraction and prediction; and the output layer is used to predict the optimized ΔQ PAC . The ΔQ PAC is the difference between the actual PAC dosage and the reference value of the feedforward control dosage table.

[0097] S42: Model training and verification. As a feasible implementation process of the model training process, a self-defined loss function L is used, and the Adam optimizer is used for training. The effectiveness of the model is determined by evaluating the performance evaluation indicators of the output and the predicted target.

[0098] In this embodiment, the actual application in the production environment is as follows:

[0099] S51: New data acquisition and preprocessing. The influent water quality parameters, influent flow, and related derived features at the current time are obtained in real time through online monitoring equipment.

[0100] S52: Data matching and calculation. The features of the new data are input into the S03 clustering model to determine whether they fall within a certain clustering radius. If the matching is successful, the optimized dosage value corresponding to the cluster is directly used; if the matching fails, the S04 improved machine learning model is used to input the new data and predict the corresponding optimized dosage value ΔQ PAC-opt The final optimized dosage is: Q PAC-final = Q PAC-baseline + ΔQ PAC-opt , wherein Q PAC-baseline is the reference dosage provided by the feedforward table, and ΔQ PAC-opt is the optimized dosage value.

[0101] The above merely provides the preferred embodiment of the present application, and is not intended to limit the implementation and protection scope of the present application. It should be noted by those skilled in the art that any equivalent substitution and obvious change made according to the present application description and drawings should be included in the protection scope of the present application.

Claims

1. A method for optimizing dosing of a phosphorus removal agent in sewage treatment based on machine learning, characterized in that, Comprise the following steps: S1; Establish sewage control feedforward table as the benchmark value of phosphorus removal agent dosage flow, including: Mechanism model construction, based on the reaction principle of chemical phosphorus removal, a quantitative relationship model between polyaluminum chloride (PAC) dosage and influent total phosphorus (TP) concentration, influent flow is established; Data-driven model construction, a long short-term memory network model is constructed, the input is the influent water quality parameters and derived features in the previous hours, and the output is the PAC dosage at the corresponding time; Get fusion model; The generation of sewage control feedforward table contains two steps of multi-dimensional parameter mapping and benchmark value determination, multi-dimensional parameter mapping refers to using the trained fusion model to input different combinations of influent water quality parameters and flow to predict the corresponding PAC dosage flow, and a feedforward control table covering various working conditions is generated; The benchmark value determination is that the PAC dosage flow in the feedforward control table is the benchmark value for reference in actual operation; S2: Based on the benchmark value, define the efficient optimization interval; S3: Adopt clustering algorithm to screen the efficient optimization interval; S4: Adopt machine learning algorithm to fit the relationship between data and efficient optimization interval, including: Design an improved algorithm model that integrates domain expertise, including optimizing model architecture, which means introducing chemical reaction kinetics mechanism to simulate the reaction kinetics of phosphate and PAC based on long short-term memory neural network; Model training and verification; S5: Calculate the optimization value of new data, including: Data matching and calculation, input the characteristics of new data into the clustering model in step S3 to determine whether it falls within a certain clustering radius, if the matching is successful, the optimization dosage value corresponding to the clustering is directly adopted.

2. The method for optimization of dosing of phosphorus removal agent in sewage treatment based on machine learning according to claim 1, characterized in that, Step S1 includes: S11, data collection, collect the historical operation data of sewage treatment plant for one year, the collected data includes influent water quality parameters, influent flow, control parameters, actual dosage and effluent parameters; S12, data preprocessing, including data cleaning, data standardization, derived features and feature selection, wherein: Data cleaning refers to handling missing values and outliers, using interpolation method to fill in missing data and eliminating obviously abnormal data points; Data standardization refers to standardizing the feature data of different dimensions to make the mean value 0 and the variance 1; Derived features refer to the maximum value, minimum value, average value, first and second order difference based on fixed time window, which are used to process and operate the collected influent water quality parameters, influent flow, control parameters and effluent parameters to increase the feature dimension; Feature selection refers to using correlation analysis and principal component analysis to select the derived features that have significant influence on phosphorus removal effect, so as to improve the training efficiency and prediction accuracy of the model; S13, establishment of fusion model and generation of feedforward table, the fusion model includes mechanism model construction and data-driven model construction, the fused model is obtained through model fusion, and finally the feedforward control table is obtained. 3.The method of claim 2, wherein the method comprises: determining the optimal dosage of the phosphorus removal agent based on the machine learning model. Step S13 includes: S131, in the mechanism model construction, the following mechanism model is established: wherein, is the PAC dosage, is the influent TP concentration, is the influent flow rate, and are model parameters determined by fitting historical data; In S132, the pre-processed data is used to train the LSTM model on the training set, the mean square error is used as the loss function, and the Adam optimizer is used for iterative optimization. The model performance is evaluated on the validation set, and the mean square error and mean absolute error indicators are calculated to ensure that the model has good generalization ability. In S133, the fusion strategy design includes but is not limited to two model fusion methods: cascade fusion and weighted fusion. Cascade fusion refers to using the output of the mechanism model as one of the input features of the LSTM model, so that the LSTM model can learn the information of the mechanism model during the learning process and improve the prediction accuracy. Weighted fusion refers to weighting the prediction results of the mechanism model and the LSTM model during the model output stage, and the weight coefficient is determined according to the performance of the model on the validation set. In S134, the fusion model is trained and optimized, the weight coefficient in the fusion strategy and the hyperparameters of the LSTM model are adjusted to improve the prediction performance of the model. The performance of the fusion model is evaluated on the validation set and compared with single models to verify the superiority of the fusion model. In S135, the feedforward table for sewage control is generated.

4. The method for optimization of dosing of phosphorus removal agent in sewage treatment based on machine learning according to claim 1, characterized in that, Step S2 includes: S21, define the efficient optimization interval based on the reference value. The efficient optimization interval definition method includes but is not limited to the following methods: optimization method based on phosphorus removal efficiency, optimization method based on reagent utilization rate, and optimization method based on cost benefit; S22, data set division based on efficient optimization interval, including data screening and training set validation set division. Data screening refers to selecting the corresponding efficient interval data according to the definition method selected in S21 to form a new data set. Training set validation set division refers to dividing the efficient interval data into training set and validation set according to the ratio of 5:

1. 5.The method for optimizing dosing of phosphorus removal agent in sewage treatment based on machine learning according to claim 1, characterized in that, In step S21: The optimization method based on phosphorus removal efficiency is: for each data point, calculate the phosphorus removal efficiency, set the phosphorus removal efficiency threshold to 85%, and select the data higher than the threshold as the efficient interval; The optimization interval selection method based on reagent utilization rate is: calculate the ratio of actual dosage to theoretical dosage, and set the data with reagent utilization rate in the range of 95%~100% as the efficient interval; The optimization method based on cost benefit is: calculate the reagent cost per unit of phosphorus removal, use multi-objective optimization method, select the data with high phosphorus removal efficiency and low cost as the efficient interval.

6. The method for optimization of dosing of phosphorus removal agent in sewage treatment based on machine learning according to claim 1, characterized in that, Step S3 includes: S31, feature selection, which refers to selecting the influent parameters and optimization values as clustering features; S32, execute clustering, use K-means clustering algorithm, use elbow method to determine the optimal number of clusters K, cluster the training set data of the efficient optimization interval, and get K cluster centers, which are representative optimization values; S33, establish optimization value library, record the optimization values of the cluster centers and their corresponding feature ranges to form the optimization value library, which is convenient for subsequent model learning and new data matching.

7. The method for optimization of dosing of phosphorus removal agent in sewage treatment based on machine learning according to claim 1, characterized in that, Step S4 includes: S41, design an improved algorithm model based on domain expertise, which also includes self-defined loss function design. The self-defined loss function is as follows: wherein: is the mean square error of the optimized value, is a penalty term for the effluent TP concentration, which gives a larger penalty when the predicted dosage leads to an effluent TP concentration exceeding the standard; is the cost of reagent dosage, which encourages the model to reduce the amount of reagent used under the premise of meeting the effluent water quality requirements; S42, model training and verification, as a feasible implementation process of model training process, using self-defined loss function L, using Adam optimizer for training, through performance evaluation index of evaluation output and prediction target, to determine the effectiveness of the model.

8. The method for optimization of dosing of phosphorus removal agent in sewage treatment based on machine learning according to claim 7, characterized in that, The model architecture is composed of an input layer, a reaction kinetics module, a neural network layer, and an output layer. The input layer includes but is not limited to influent water quality parameters, influent flow, environmental parameters, historical effluent parameters, and derived features thereof. The reaction kinetics module calculates the current reaction rate constant related mechanism operating parameters based on the above parameters. The neural network layer inputs the reaction kinetics module output and the remaining features into the neural network for deep feature extraction and prediction. The output layer is used to predict the optimization , is the difference between the actual PAC dosage and the reference value of the feedforward control dosage table. 9.The method of claim 1, wherein the method comprises: determining a phosphorus removal rate of the wastewater treatment plant; and determining a phosphorus removal rate of the wastewater treatment plant based on the determined phosphorus removal rate and the determined phosphorus removal rate of the wastewater treatment plant. Step S5 includes: S51, new data acquisition and preprocessing, the current water quality parameters, water flow and related derived characteristics are obtained in real time through online monitoring equipment; S52, data matching and calculation, if matching fails, using the improved machine learning model of step S4, inputting new data, and predicting the corresponding optimized dosing value The final optimized dosing amount is Wherein, The reference dosing amount provided for the feedforward table, The optimized dosing value.

Citation Information

Patent Citations

  • Intelligent control method for dosing of chemical phosphorus removal agent in domestic sewage treatment plant

    CN117850330A

  • Generation method and control system for aeration and dosing strategy of sewage plant

    CN118969138A