A sewage treatment water quality prediction method and system based on physical information constraint and deep learning fusion

CN123012567APending Publication Date: 2026-10-30DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611101875.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0006]根据上述提出现有数据驱动模型过度依赖历史数据、缺乏机理约束、物理一致性差、可解释性不足以及在跨工况扰动和数据稀疏条件下泛化能力较弱的技术问题,提供一种基于物理信息约束与深度学习融合的污水处理水质预测方法及系统

Benefits of technology

1、本发明提供的基于物理信息约束与深度学习融合的污水处理水质预测方法,通过将目标水质预测误差、质量平衡约束、动力学残差约束及弱监督约束统一到同一联合损失函数中,实现了深度学习网络训练同时满足数据拟合与机理一致性要求,显著提高了预测结果的物理一致性与可解释性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012567A_ABST
    Figure CN123012567A_ABST
Patent Text Reader

Abstract

The present application provides a kind of based on physical information constraint and deep learning fusion sewage treatment water quality prediction method and system, belong to sewage treatment process modeling and water quality prediction technical field, this method includes: collecting inlet and outlet water quality, operating set value, key process parameters and process design parameters, the data collected are preprocessed and construct time series sample;Build including shared time series feature extraction main network, target water quality prediction output head and activated sludge model ASM mechanism state parameter prediction output head deep learning model;Based on the mass balance constraint of target pollutant mass conservation relationship, based on the kinetic residual constraint of ASM state dynamics equation, and based on the weak supervision constraint of monitorable operating data;Use target prediction error and the above constraint term to form joint loss function for training, output target time water quality prediction result.The present application can improve the physical consistency, explainability and applicability under complex conditions of water quality prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wastewater treatment process modeling and water quality prediction technology, and more specifically, to a wastewater treatment water quality prediction method and system based on the fusion of physical information constraints and deep learning. More specifically, this invention relates to a method for predicting key water quality indicators in wastewater treatment by embedding wastewater treatment mechanism equations, activated sludge model state dynamics equations, and empirical weakly supervised information into the deep learning network training process. This method is applicable to the prediction of effluent water quality indicators such as chemical oxygen demand (COD) and total nitrogen. Background Technology

[0002] Wastewater treatment is a typical multivariable, strongly coupled, highly nonlinear, and time-varying dynamic system. Factors such as influent quality, flow rate, aeration intensity, internal and external recirculation, sludge concentration, and temperature collectively influence organic matter degradation, nitrification and denitrification, biomass growth, and dissolved oxygen changes, ultimately determining effluent quality levels. Accurate prediction of key water quality indicators in the future is crucial for achieving refined operation, stable compliance with standards, and energy conservation in wastewater treatment processes.

[0003] In existing technologies, wastewater quality prediction methods based on deep learning models such as Long Short-Term Memory (LSTM) networks, gated recurrent unit (GRU) networks, and temporal convolutional networks can learn the nonlinear mapping relationship between input and output from historical operational data, exhibiting good fitting capabilities in several scenarios. However, these models typically only aim to minimize errors in historical data, lacking explicit constraints on the conservation relationships of wastewater treatment materials, biochemical reaction mechanisms, and state evolution laws. Therefore, they suffer from the following problems: (1) The prediction process is not interpretable enough, making it difficult to explain the relationship between the model output and the wastewater treatment mechanism; (2) The prediction results may violate the law of mass conservation or state evolution, and the physical consistency is poor; (3) When the training samples are limited, the working conditions change, or there is a cross-working condition extrapolation task, the generalization ability decreases significantly. (4) The implicit activated sludge state variables cannot be effectively characterized, which means that although the model can provide water quality output, it is difficult to use it for further process analysis and decision support.

[0004] On the other hand, mechanistic models based on ASM-type activated sludge models can effectively characterize the dynamic relationships between state variables such as soluble substrates, granular substrates, heterotrophic bacteria, autotrophic bacteria, ammonia nitrogen, nitrate nitrogen, organic nitrogen, and dissolved oxygen, exhibiting strong mechanistic interpretability. However, traditional mechanistic models have numerous parameters, complex model calibration, and low online prediction efficiency, relying heavily on sensor deployment, parameter identification, and process knowledge. Existing mechanistic-data fusion patents often adopt approaches such as "fusion of mechanistic simulation results and measured data," "mechanistic model output as enhancement features," or "mechanistic model residual correction." While these methods improve prediction performance to some extent, they mostly still rely on independent mechanistic models for initial modeling and calibration, followed by externalizing the results into a data-driven model. A unified method has yet to be developed that directly embeds mechanistic constraints into the deep learning training process, simultaneously predicting target water quality indicators and mechanistic state trajectories.

[0005] Therefore, there is an urgent need for a new method for predicting wastewater quality. While retaining the efficient modeling capabilities of deep learning models, this method should introduce mass balance constraints, state dynamic constraints, and weakly supervised information driven by monitorable data. This would enable the model to not only output the target water quality prediction results but also provide the evolution trajectory of the activated sludge mechanism state parameters, thereby improving the model's prediction accuracy, physical consistency, interpretability, and applicability under complex operating conditions. Summary of the Invention

[0006] To address the aforementioned technical problems of existing data-driven models, such as over-reliance on historical data, lack of mechanistic constraints, poor physical consistency, insufficient interpretability, and weak generalization ability under cross-condition disturbances and data sparsity, this invention provides a wastewater treatment water quality prediction method and system based on the fusion of physical information constraints and deep learning. This invention primarily utilizes a shared temporal feature extraction backbone network to simultaneously drive the target water quality prediction output head and the activated sludge model ASM mechanistic state parameter prediction output head. Furthermore, mass balance constraints, kinetic residual constraints, and weak supervision constraints are embedded into the joint loss function of the deep learning network. This ensures that model training simultaneously meets the requirements of data fitting and mechanistic consistency, thereby improving the physical consistency, interpretability, and applicability of water quality prediction results under complex conditions. Simultaneously, it outputs the target time-time water quality prediction result and the future evolution trajectory of activated sludge mechanistic state parameters.

[0007] The technical means employed in this invention are as follows: A wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning includes: S1. Collect influent and effluent water quality data, operating setpoints, and key process parameter data during the wastewater treatment process; S2. Preprocess the collected data and construct training samples according to the preset time window length and prediction step size; S3. Construct a deep learning network model that includes a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head; S4. Construct the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error term respectively, and then sum the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error by weighting them to obtain the joint loss function; S5. Input the preprocessed training samples into the deep learning network model, train it based on the joint loss function, and obtain the water quality prediction results at the target time and the prediction results of the activated sludge model ASM mechanism state parameters at several future times.

[0008] Further, step S1 includes: S11. Collect water quality data of influent and effluent during the wastewater treatment process, including one or more of the following: chemical oxygen demand (COD), biochemical oxygen demand (BOD), ammonia nitrogen, total nitrogen, and total phosphorus. S12. Collect operating settings, including one or more of the following: aeration settings, dissolved oxygen settings, oxygen transfer coefficient settings, sludge return settings, internal return settings, sludge discharge settings, and chemical dosing settings. S13. Collect one or more of the following key process parameters: influent and effluent flow rate, dissolved oxygen in the reaction tank, temperature, sludge age, hydraulic retention time, suspended solids concentration, mixed liquor suspended solids concentration, and pH. S14. Collect process design parameters, including the volume, area, and water depth parameters of one or more structures in the anoxic tank, anaerobic tank, aerobic tank, and secondary sedimentation tank.

[0009] Further, step S2 includes: S21. Perform missing value completion, outlier handling, and normalization on the collected raw data; S22. After completing the preprocessing, follow the preset time window length. and prediction step size The time series data is subjected to sliding partitioning to construct training samples for the model. Each training sample includes: a length of... Historical input sequence and corresponding target time The target water quality label and the information required for the implicit state constraints at the current moment and several future moments.

[0010] Further, step S3 includes: S31. Construct a shared temporal feature extraction backbone network to extract features from the input multivariate time series of the wastewater treatment process. The shared temporal feature extraction backbone network is represented as follows:

[0011] in, Indicates length is Historical input time series; Indicates shared temporal characteristics; This represents the parameterized mapping function corresponding to the shared feature extraction backbone network; S32. Set a target water quality prediction output head at the output end of the shared temporal feature extraction backbone network to output the predicted value of the target water quality index at the target prediction time. The target water quality prediction output head is represented as follows:

[0012] in, This represents the predicted water quality value at the target time. This represents the parameterized mapping function corresponding to the target water quality prediction head; S33. Set a predicted output head for the activated sludge model ASM mechanism state parameters at the output end of the shared temporal feature extraction backbone network. This head is used to output the predicted values ​​of the activated sludge model ASM mechanism state parameters at the target time and several future prediction times. The predicted output head for the activated sludge model ASM mechanism state parameters is represented as follows:

[0013] in, Indicates the time from the present moment to the future. Predicted trajectory of ASM mechanism state parameters of activated sludge model at each time step; This represents the parameterized mapping function corresponding to the state parameter prediction head.

[0014] Furthermore, the target water quality prediction output head and the activated sludge model ASM mechanism state parameter prediction output head share the feature representation of the shared temporal feature extraction backbone network, and are jointly trained through a joint loss function.

[0015] Furthermore, the mechanistic state parameters of the activated sludge model ASM include one or more of the following: soluble biodegradable substrate, particulate biodegradable substrate, soluble inert organic matter, particulate inert organic matter, heterotrophic bacteria, autotrophic bacteria, decay products, ammonia nitrogen, nitrate nitrogen, soluble organic nitrogen, particulate organic nitrogen, and dissolved oxygen.

[0016] Further, step S4 includes: S41. Constructing quality balance constraints based on the conservation relationship of target water quality indicators, specifically including: When the target water quality indicator is chemical oxygen demand, establish The law of conservation of mass is as follows:

[0017] in, and These represent the effluent chemical oxygen demand at the current time and the target time, respectively. Indicates the influent chemical oxygen demand. Indicates the inflow rate. Indicates the volume of the reaction tank. This indicates the organic matter removal term. Indicates the time step; When the target water quality indicator is total nitrogen, establish The law of conservation of mass is as follows:

[0018] in, and These represent the total nitrogen in the effluent at the current time and the target time, respectively. Indicates total nitrogen in the influent. This indicates the reaction terms related to total nitrogen removal; The deviation between the predicted value and the mechanism conservation relationship is calculated based on the mass conservation law and used as a mass balance constraint term. The mass balance constraint term is expressed as follows:

[0019] in, Indicates the first The quality balance residuals corresponding to each sample Indicates the number of samples; S42. Constructing kinetic residual constraints based on the state-kinetic equations of the activated sludge model, specifically including: The state-kinetic equations for the activated sludge model ASM are constructed as follows:

[0020] in, This represents the state parameter vector of the ASM mechanism in the activated sludge model. Indicates the runtime control variable. Indicates mechanism parameters, This represents the right-hand side function of the state-kinetic equation for the activated sludge model; The changes in the mechanistic state parameters of the activated sludge model (ASM) between adjacent prediction times were calculated, and these changes were compared with the right-hand side of the state-kinetic equation to obtain the kinetic residuals as follows:

[0021] in, Indicates the first The activated sludge model ASM mechanism state parameter vector predicted at each time point Indicates the first The operational control variables at each moment; The dynamic residual is used as a dynamic residual constraint term, which is expressed as follows:

[0022] S43. Construct weakly supervised constraints based on monitorable operational data and empirical estimation formulas, specifically including: Based on one or more of the following: influent and effluent water quality data, dissolved oxygen, mixed liquor suspended solids concentration, flow rate, temperature, oxygen transfer coefficient, and sludge age, the estimated values ​​of the mechanistic state parameters of the activated sludge model (ASM) are obtained through one or more of the following: pollutant component distribution relationships, biomass estimation relationships, nitrogen component estimation relationships, and dissolved oxygen approximation relationships. ; The estimated values ​​are compared with the corresponding state parameters output by the ASM mechanism state parameter prediction output head of the activated sludge model to obtain the weakly supervised constraint term, as shown below:

[0023] in, Indicates the state parameter prediction head at the 1st Predicted values ​​of state parameters output at each time step; The first term is estimated by the empirical formula. Reference state parameter values ​​at each moment; S44. Construct the target water quality prediction error term as follows:

[0024] in, Represents the regression loss function. This represents the predicted water quality value at the target time. This represents the actual water quality value at the target time. S45. The joint loss function is obtained by weighted summing of the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error, as shown below:

[0025] in, This represents the error term in the target water quality prediction. This represents the mass balance constraint term. Represents the dynamic residual constraint term. This indicates a weakly supervised constraint. , , , These represent the corresponding loss weight coefficients.

[0026] Further, step S5 includes: S51. Input the constructed training samples into the deep learning network model for forward propagation to obtain the target water quality prediction value at the target time output by the target water quality prediction output head and the state parameter prediction value output by the activated sludge model ASM mechanism state parameter prediction output head. S52. Based on the joint loss function, the parameters of the deep learning network model are updated using gradient backpropagation. The training is repeated iteratively until the preset stopping condition is met, and the trained deep learning network model is obtained. S53. Input the sample to be predicted into the trained deep learning network model and output the water quality prediction result at the target time.

[0027] This invention also provides a wastewater treatment water quality prediction system based on the above-mentioned wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning, comprising: a data acquisition module, a data preprocessing module, a network construction module, a constraint construction module, and a model training and prediction output module, wherein: The data acquisition module is used to collect influent and effluent water quality data, operating setpoints, and key process parameter data during the wastewater treatment process. The data preprocessing module is used to preprocess the collected data and construct training samples according to the preset time window length and prediction step size. The network construction module is used to construct a deep learning network model including a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head. The constraint construction module is used to construct the mass balance constraint, dynamic residual constraint, weak supervision constraint and target water quality prediction error term respectively, and to perform a weighted summation of the mass balance constraint, dynamic residual constraint, weak supervision constraint and target water quality prediction error to obtain the joint loss function; The model training and prediction output module is used to input the preprocessed training samples into the deep learning network model, train it based on the joint loss function, and obtain the water quality prediction results at the target time and the prediction results of the activated sludge model ASM mechanism state parameters at several future times.

[0028] Compared with the prior art, the present invention has the following advantages: 1. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning provided by this invention unifies the target water quality prediction error, mass balance constraints, dynamic residual constraints and weak supervision constraints into the same joint loss function, so as to realize that the training of deep learning network can simultaneously meet the requirements of data fitting and mechanism consistency, and significantly improve the physical consistency and interpretability of prediction results.

[0029] 2. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning provided by this invention adopts a dual-head deep learning network model. By setting a target water quality prediction output head and an activated sludge model ASM mechanism state parameter prediction output head, it realizes dual-task collaborative learning of target water quality output and mechanism state trajectory output, and can simultaneously provide the water quality prediction result at the target time and future state evolution information.

[0030] 3. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning provided by this invention adopts a physical information constraint embedding mechanism. By introducing mechanistic constraints in prediction scenarios with few samples, changing operating conditions, or cross-operating conditions, it achieves better generalization ability and robustness than traditional deep learning models that rely solely on data fitting.

[0031] 4. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning provided by this invention adopts a weakly supervised constraint construction method. It obtains reference values ​​of the ASM mechanism state parameters of the activated sludge model based on monitorable operational data and empirical estimation formulas, thereby realizing the effective characterization of the implicit activated sludge state variables and enabling the model output to be further used for process analysis and auxiliary decision-making.

[0032] 5. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning provided by this invention adopts a joint mechanism of mass balance constraints and dynamic residual constraints. By applying explicit constraints to the prediction results based on the wastewater treatment mechanism equation and the state dynamic equation of the activated sludge model, the prediction results do not violate the law of mass conservation or state evolution, thus avoiding the problem of poor physical consistency of traditional data-driven models.

[0033] In summary, by applying the technical solution of this invention, existing data-driven models suffer from problems such as excessive reliance on historical data, lack of mechanistic constraints, poor physical consistency, insufficient interpretability, and weak generalization ability under cross-condition disturbances and data sparsity. This is addressed by directly embedding mass balance constraints, state dynamics constraints, and weakly supervised information driven by monitorable data into the deep learning training process, thereby simultaneously predicting target water quality indicators and mechanistic state trajectories. Therefore, the technical solution of this invention solves the problems of insufficient interpretability in the prediction process, potential violations of mass conservation or state evolution laws in prediction results, significant decrease in generalization ability when training samples are limited or operating conditions change, and the inability to effectively characterize implicit activated sludge state variables in existing technologies.

[0034] Based on the above reasons, this invention can be widely applied in fields such as wastewater treatment process modeling, water quality prediction, refined operation control, stable compliance monitoring, and energy conservation and consumption reduction optimization. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is an overall flowchart of a wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning, according to the present invention.

[0037] Figure 2 This is a schematic diagram of the deep learning network model structure of the present invention.

[0038] Figure 3 This is a schematic diagram illustrating the construction of the joint loss function of this invention.

[0039] Figure 4 This is a schematic diagram of the model structure and training process for an embodiment of the chemical oxygen demand and total nitrogen prediction of the present invention. Detailed Implementation

[0040] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0041] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product or device.

[0042] like Figure 1 As shown, this invention provides a wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning, comprising: S1. Collect influent and effluent water quality data, operating setpoints, and key process parameter data during the wastewater treatment process; S2. Preprocess the collected data and construct training samples according to the preset time window length and prediction step size; S3. Construct a deep learning network model that includes a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head; S4. Construct the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error term respectively, and then sum the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error by weighting them to obtain the joint loss function; S5. Input the preprocessed training samples into the deep learning network model, train it based on the joint loss function, and obtain the water quality prediction results at the target time and the prediction results of the activated sludge model ASM mechanism state parameters at several future times.

[0043] In a specific implementation, as a preferred embodiment of the present invention, step S1 includes: S11. Collect water quality data of influent and effluent during the wastewater treatment process, including one or more of the following: chemical oxygen demand (COD), biochemical oxygen demand (BOD), ammonia nitrogen, total nitrogen, and total phosphorus. S12. Collect operating settings, including one or more of the following: aeration settings, dissolved oxygen settings, oxygen transfer coefficient settings, sludge return settings, internal return settings, sludge discharge settings, and chemical dosing settings. S13. Collect one or more of the following key process parameters: influent and effluent flow rate, dissolved oxygen in the reaction tank, temperature, sludge age, hydraulic retention time, suspended solids concentration, mixed liquor suspended solids concentration, and pH. S14. Collect process design parameters, including the volume, area, and water depth parameters of one or more structures in the anoxic tank, anaerobic tank, aerobic tank, and secondary sedimentation tank, to support subsequent mass balance modeling.

[0044] In a specific implementation, as a preferred embodiment of the present invention, step S2 includes: S21. Perform missing value completion, outlier processing, and normalization on the collected raw data. In this embodiment, it is preferable to use forward filling, backward filling, or linear interpolation for missing values, and to use statistical thresholds or quantile rules to identify and correct outliers.

[0045] S22. After completing the preprocessing, follow the preset time window length. and prediction step size The time series data is subjected to sliding partitioning to construct training samples for the model. Each training sample includes: a length of... Historical input sequence and corresponding target time The target water quality label and the information required for the implicit state constraints at the current moment and several future moments.

[0046] In this embodiment, the data is preferably divided into a training set, a validation set, and a test set.

[0047] In a specific implementation, as a preferred embodiment of the present invention, step S3 is as follows: Figure 2 As shown, a deep learning network model is constructed with a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head, including: S31. Construct a shared temporal feature extraction backbone network to extract features from the input multivariate time series of the wastewater treatment process. The shared temporal feature extraction backbone network is represented as follows:

[0048] in, Indicates length is Historical input time series; Indicates shared temporal characteristics; This represents the parameterized mapping function corresponding to the shared feature extraction backbone network; in this embodiment, the shared temporal feature extraction backbone network is preferably a temporal convolutional network.

[0049] S32. Set a target water quality prediction output head at the output end of the shared temporal feature extraction backbone network to output the predicted value of the target water quality index at the target prediction time. The target water quality prediction output head is represented as follows:

[0050] in, This represents the predicted water quality value at the target time. This represents the parameterized mapping function corresponding to the target water quality prediction head; S33. Set a predicted output head for the activated sludge model ASM mechanism state parameters at the output end of the shared temporal feature extraction backbone network. This head is used to output the predicted values ​​of the activated sludge model ASM mechanism state parameters at the target time and several future prediction times. The predicted output head for the activated sludge model ASM mechanism state parameters is represented as follows:

[0051] in, Indicates the time from the present moment to the future. Predicted trajectory of ASM mechanism state parameters of activated sludge model at each time step; This represents the parameterized mapping function corresponding to the state parameter prediction head. In this embodiment, the state parameter prediction output head preferably adopts a non-negative output constraint to ensure the physical rationality of concentration-type state parameters.

[0052] In a specific implementation, as a preferred embodiment of the present invention, the target water quality prediction output head and the activated sludge model ASM mechanism state parameter prediction output head share the feature representation of the shared temporal feature extraction backbone network, and are jointly trained through a joint loss function.

[0053] In a specific implementation, as a preferred embodiment of the present invention, the activated sludge model ASM mechanism state parameters include one or more of the following: soluble biodegradable substrate, granular biodegradable substrate, soluble inert organic matter, granular inert organic matter, heterotrophic bacteria, autotrophic bacteria, decay products, ammonia nitrogen, nitrate nitrogen, soluble organic nitrogen, granular organic nitrogen, and dissolved oxygen. In this embodiment, it is preferable to use several activated sludge model state parameters as prediction objects. The state parameter prediction head outputs future... The state trajectory at each time step.

[0054] In specific implementation, as a preferred embodiment of the present invention, such as Figure 3 As shown, step S4 includes: S41. Constructing quality balance constraints based on the conservation relationship of target water quality indicators, specifically including: When the target water quality indicator is chemical oxygen demand, establish The law of conservation of mass is as follows:

[0055] in, and These represent the effluent chemical oxygen demand at the current time and the target time, respectively. Indicates the influent chemical oxygen demand. Indicates the inflow rate. Indicates the volume of the reaction tank. This indicates the organic matter removal term. The preferred value can be approximated by the aerobic / anaerobic growth-related rate term of heterotrophic bacteria. Indicates the time step; When the target water quality indicator is total nitrogen, establish The law of conservation of mass is as follows:

[0056] in, and These represent the total nitrogen in the effluent at the current time and the target time, respectively. Indicates total nitrogen in the influent. This represents the reaction terms related to total nitrogen removal, preferably the net removal term via anoxic denitrification. In a preferred embodiment, the net removal term via denitrification can be approximated by the rate of anoxic heterotrophic reactions.

[0057] The deviation between the predicted value and the mechanism conservation relationship is calculated based on the mass conservation law and used as a mass balance constraint term. The mass balance constraint term is expressed as follows:

[0058] in, Indicates the first The quality balance residuals corresponding to each sample This indicates the sample size; in this embodiment, the mass balance constraint term is used to ensure that the prediction results satisfy the material conservation relationship in the wastewater treatment process.

[0059] S42. Constructing kinetic residual constraints based on the state-kinetic equations of the activated sludge model, specifically including: The state-kinetic equations for the activated sludge model ASM are constructed as follows:

[0060] in, This represents the state parameter vector of the ASM mechanism in the activated sludge model. Indicates the runtime control variable. Indicates mechanism parameters, This represents the right-hand side function of the state-kinetic equation for the activated sludge model; The changes in the mechanistic state parameters of the activated sludge model (ASM) between adjacent prediction times were calculated, and these changes were compared with the right-hand side of the state-kinetic equation to obtain the kinetic residuals as follows:

[0061] in, Indicates the first The activated sludge model ASM mechanism state parameter vector predicted at each time point Indicates the first The operational control variables at each moment; The dynamic residual is used as a dynamic residual constraint term, which is expressed as follows:

[0062] In this embodiment, kinetic residual constraints are used to ensure that the predicted trajectory of state parameters satisfies the state-kinetic equations of the activated sludge model (ASM). For the COD prediction embodiment, a soluble and biodegradable substrate is preferred. and heterotrophic bacteria Kinetic residual constraints are applied to the relevant states; for the TN prediction embodiment, it is preferable to further apply kinetic residual constraints to the relevant states of autotrophic bacteria, ammonia nitrogen, nitrate nitrogen, soluble organic nitrogen, particulate organic nitrogen and dissolved oxygen.

[0063] S43. Since the state variables of activated sludge models are usually not directly measurable, this embodiment constructs weakly supervised constraints based on monitorable operational data and empirical estimation formulas, specifically including: Based on one or more of the following: influent and effluent water quality data, dissolved oxygen, mixed liquor suspended solids concentration, flow rate, temperature, oxygen transfer coefficient, and sludge age, the estimated values ​​of the mechanistic state parameters of the activated sludge model (ASM) are obtained through one or more of the following: pollutant component distribution relationships, biomass estimation relationships, nitrogen component estimation relationships, and dissolved oxygen approximation relationships. In this embodiment, the estimated value It is estimated based on empirical formulas using data such as influent and effluent COD, TN, NH4-N, DO, MLSS, flow rate, temperature, and KLa.

[0064] The estimated values ​​are compared with the corresponding state parameters output by the ASM mechanism state parameter prediction output head of the activated sludge model to obtain the weakly supervised constraint term, as shown below:

[0065] in, Indicates the state parameter prediction head at the 1st Predicted values ​​of state parameters output at each time step; The first term is estimated by the empirical formula. Reference state parameter values ​​at each moment; S44. Construct the target water quality prediction error term as follows:

[0066] in, Represents the regression loss function. This represents the predicted water quality value at the target time. This represents the actual water quality value at the target time; in this embodiment, the target water quality prediction error term is used to measure the predicted value at the target time. Compared with the true value The difference can be expressed using mean square error and smoothing. Loss or other forms of regression loss.

[0067] S45. The joint loss function is obtained by weighted summing of the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error, as shown below:

[0068] in, This represents the error term in the target water quality prediction. This represents the mass balance constraint term. Represents the dynamic residual constraint term. This indicates a weakly supervised constraint. , , , These represent the corresponding loss weight coefficients.

[0069] In a specific implementation, as a preferred embodiment of the present invention, step S5 includes: S51. Input the constructed training samples into the deep learning network model for forward propagation to obtain the target water quality prediction value at the target time output by the target water quality prediction output head and the state parameter prediction value output by the activated sludge model ASM mechanism state parameter prediction output head. S52. Based on the joint loss function, the parameters of the deep learning network model are updated using gradient backpropagation. The training is repeated iteratively until the preset stopping condition is met, and the trained deep learning network model is obtained. S53. Input the sample to be predicted into the trained deep learning network model and output the water quality prediction result at the target time.

[0070] This invention also provides a wastewater treatment water quality prediction system based on the above-mentioned wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning, comprising: a data acquisition module, a data preprocessing module, a network construction module, a constraint construction module, and a model training and prediction output module, wherein: The data acquisition module is used to collect influent and effluent water quality data, operating setpoints, and key process parameter data during the wastewater treatment process. The data preprocessing module is used to preprocess the collected data and construct training samples according to the preset time window length and prediction step size. The network construction module is used to construct a deep learning network model including a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head. The constraint construction module is used to construct the mass balance constraint, dynamic residual constraint, weak supervision constraint and target water quality prediction error term respectively, and to perform a weighted summation of the mass balance constraint, dynamic residual constraint, weak supervision constraint and target water quality prediction error to obtain the joint loss function; The model training and prediction output module is used to input the preprocessed training samples into the deep learning network model, train it based on the joint loss function, and obtain the water quality prediction results at the target time and the prediction results of the activated sludge model ASM mechanism state parameters at several future times.

[0071] Example of chemical oxygen demand prediction: In this embodiment, the target water quality indicator is the effluent chemical oxygen demand (COD). Input features include: influent COD, influent TN, influent NH4-N, historical effluent COD, dissolved oxygen, mixed liquor suspended solids concentration, influent flow rate, influent temperature, and influent suspended solids concentration.

[0072] Let the input feature sequence be denoted as:

[0073] The network extracts temporal features through a shared temporal feature extraction backbone network. The target water quality prediction head outputs the COD prediction value at the target time, and the state parameter prediction head outputs the future... The trajectory of several activated sludge state parameters at a given time point. The mass balance constraint uses the COD conservation relationship, and the kinetic residual constraint is preferably applied at... and The state, with weak supervision constraints, estimates the COD-related state at the current moment using routine data.

[0074] Example of total nitrogen prediction: In this embodiment, the target water quality indicator is total nitrogen in the effluent. Input features include: influent COD, influent TN, influent NH4-N, historical effluent COD, historical effluent TN, historical effluent NH4-N, dissolved oxygen, mixed liquor suspended solids concentration, influent flow rate, influent temperature, influent and effluent suspended solids concentration, and oxygen transfer coefficient KLa. KLa can also be indirectly solved using aeration rate, blower power, etc.

[0075] Let the input feature sequence be denoted as:

[0076] The network extracts temporal features through a shared temporal feature extraction backbone network. The target water quality prediction head outputs the TN prediction value at the target time, and the state parameter prediction head outputs the future... The trajectory of 13 activated sludge state parameters at each time point. Mass balance constraints employ the TN conservation relationship, with the reaction term preferably using the net denitrification removal term; kinetic residual constraints are used for... , In addition, it can be expanded to , , , , , Equal state; weak supervision constraints estimate the reference state using data such as TN, NH4-N, DO, MLSS, flow rate, temperature, and KLa.

[0077] Simulation verification example: In this embodiment, wastewater treatment process simulation data is used to verify the wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning described in this invention. The simulation data is continuous time series data, including at least one or more of the following: influent chemical oxygen demand (COD), influent total nitrogen (TN), influent ammonia nitrogen (AM), effluent COD, effluent TN, effluent AM, dissolved oxygen in the reaction tank, mixed liquor suspended solids concentration, influent flow rate, influent temperature, influent and effluent suspended solids concentrations, and oxygen transfer coefficient.

[0078] In one specific embodiment, the simulation data can be generated by a wastewater treatment process simulation model. The wastewater treatment process simulation model can be a BSM2 simulation model, an ASM-type simulation model, or other simulation models capable of simulating the dynamic changes in water quality during wastewater treatment. It should be noted that the simulation model is only used to verify the feasibility and predictive effectiveness of the method of the present invention and does not constitute a limitation on the data source of the present invention.

[0079] After processing the simulation data for missing values, outliers, and normalization, training samples are constructed according to a preset time window length and prediction step size. These training samples are then input into the deep learning network model described in this invention for training. The deep learning network model includes a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head.

[0080] During training, the target water quality prediction error term, mass balance constraint term, kinetic residual constraint term, and weak supervision constraint term are calculated separately, and a joint loss function is constructed according to preset weights:

[0081] in, This represents the error term in the target water quality prediction. This represents the mass balance constraint term. Represents the dynamic residual constraint term. This indicates a weakly supervised constraint. , , , This represents the weighting coefficient corresponding to each loss term.

[0082] After training, test samples are input into the trained model, which outputs the water quality prediction results for the target time. The prediction performance is evaluated using one or more of the following metrics: coefficient of determination, mean absolute error, root mean square error, and mean absolute percentage error. The coefficient of determination, mean absolute error, root mean square error, and mean absolute percentage error are respectively expressed as:

[0083]

[0084]

[0085]

[0086] in, Indicates the first The actual water quality value of each sample Indicates the first Predicted water quality values ​​for each sample This represents the average value of the actual water quality. Indicates the number of samples.

[0087] In the overall prediction performance verification, a deep learning prediction model without physical information constraints was used as the benchmark model. The method of this invention was compared with the benchmark model under the same training, validation, and test set partitioning conditions. The verification results show that when the target water quality indicator is chemical oxygen demand (COD), the coefficient of determination of the benchmark model is 0.8610, and the coefficient of determination of the method of this invention is 0.9031. Compared with the benchmark model, the mean absolute error of the method of this invention decreased by 14.31%, the root mean square error decreased by 16.49%, and the mean absolute percentage error decreased by 14.31%. When the target water quality indicator is total nitrogen (TN), the coefficient of determination of the benchmark model is 0.9768, and the coefficient of determination of the method of this invention is 0.9854. Compared with the benchmark model, the mean absolute error of the method of this invention decreased by 18.04%, the root mean square error decreased by 20.77%, and the mean absolute percentage error decreased by 18.51%.

[0088] The overall prediction performance comparison is shown in Table 1.

[0089] Table 1 Overall Predictive Performance Comparison

[0090] In the small-sample validation, 30 days of simulation data were selected to construct training samples, and training and testing were conducted based on different time segments. The validation results show that in the chemical oxygen demand and total nitrogen prediction tasks, the average determination coefficient of the method of this invention in the small sample is improved by 22%-26% compared with the baseline model; compared with the baseline model, the average absolute error of the method of this invention is reduced by 26.93%-34.85%.

[0091] In the cross-condition validation, dry condition data was used for training and validation, and rain and storm condition data were used for testing respectively. Under 60-day simulation data conditions, when using rain condition data for testing, in the chemical oxygen demand (COD) prediction task, compared with the baseline model, the determination coefficient of the method of this invention was improved by about 4%, and the error index was reduced by 16.21%-22.06%. In the total nitrogen (TN) prediction task, compared with the baseline model, the determination coefficient of the method of this invention was improved by about 1%, and the error index was reduced by 10.48%-13.58%.

[0092] When using Storm operating data for testing, in the chemical oxygen demand (COD) prediction task, compared to the baseline model, the determination coefficient of the method of this invention is improved by about 4%, and the error index is reduced by 15.03%-23.75%. In the total nitrogen prediction task, compared to the baseline model, the determination coefficient of the method of this invention is improved by about 2%, and the error index is reduced by 10.12%-15.08%.

[0093] To verify the effects of mass balance constraints, kinetic residual constraints, and weak supervision constraints on model training, ablation models were constructed under the same data conditions, removing individual constraint terms. These ablation models included models removing mass balance constraints, kinetic residual constraints, and weak supervision constraints. Validation results show that removing mass balance constraints, kinetic residual constraints, or weak supervision constraints all resulted in varying degrees of performance degradation in the models.

[0094] In the chemical oxygen demand (COD) prediction task, the complete model improved the coefficient of determination by approximately 2.69% to 3.42% compared to the model without a single constraint, with varying degrees of reduction in mean absolute error, root mean square error, and mean absolute percentage error. In the total nitrogen (TN) prediction task, the complete model improved the coefficient of determination by approximately 0.15% to 0.67% compared to the model without a single constraint, with improvements in most error metrics. These results demonstrate that mass balance constraints, kinetic residual constraints, and weak supervision constraints can provide effective physical information constraints for deep learning network models, contributing to improved physical consistency and predictive stability of the model's predictions.

[0095] In summary, simulation results demonstrate that the method of this invention can improve prediction accuracy in chemical oxygen demand (COD) and total nitrogen (TN) prediction tasks, and maintains good applicability under small sample sizes and across different operating conditions. Furthermore, the method of this invention can output the predicted trajectory of the ASM mechanism state parameters of the activated sludge model, ensuring that the prediction results not only depend on data fitting but are also constrained by the mass balance relationship, state dynamics equations, and weakly supervised state estimation, thereby enhancing the model's interpretability and physical consistency.

[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning, characterized in that, include: S1. Collect influent and effluent water quality data, operating setpoints, and key process parameter data during the wastewater treatment process; S2. Preprocess the collected data and construct training samples according to the preset time window length and prediction step size; S3. Construct a deep learning network model that includes a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head; S4. Construct the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error term respectively, and then sum the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error by weighting them to obtain the joint loss function; S5. Input the preprocessed training samples into the deep learning network model, train it based on the joint loss function, and obtain the water quality prediction results at the target time and the prediction results of the activated sludge model ASM mechanism state parameters at several future times.

2. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 1, characterized in that, Step S1 includes: S11. Collect water quality data of influent and effluent during the wastewater treatment process, including one or more of the following: chemical oxygen demand (COD), biochemical oxygen demand (BOD), ammonia nitrogen, total nitrogen, and total phosphorus. S12. Collect operating settings, including one or more of the following: aeration settings, dissolved oxygen settings, oxygen transfer coefficient settings, sludge return settings, internal return settings, sludge discharge settings, and chemical dosing settings. S13. Collect one or more of the following key process parameters: influent and effluent flow rate, dissolved oxygen in the reaction tank, temperature, sludge age, hydraulic retention time, suspended solids concentration, mixed liquor suspended solids concentration, and pH. S14. Collect process design parameters, including the volume, area, and water depth parameters of one or more structures in the anoxic tank, anaerobic tank, aerobic tank, and secondary sedimentation tank.

3. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 1, characterized in that, Step S2 includes: S21. Perform missing value completion, outlier handling, and normalization on the collected raw data; S22. After completing the preprocessing, follow the preset time window length. and prediction step size The time series data is subjected to sliding partitioning to construct training samples for the model. Each training sample includes: a length of... Historical input sequence and corresponding target time The target water quality label and the information required for the implicit state constraints at the current moment and several future moments.

4. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 1, characterized in that, Step S3 includes: S31. Construct a shared temporal feature extraction backbone network to extract features from the input multivariate time series of the wastewater treatment process. The shared temporal feature extraction backbone network is represented as follows: in, Indicates length is Historical input time series; Indicates shared temporal characteristics; This represents the parameterized mapping function corresponding to the shared feature extraction backbone network; S32. Set a target water quality prediction output head at the output end of the shared temporal feature extraction backbone network to output the predicted value of the target water quality index at the target prediction time. The target water quality prediction output head is represented as follows: in, This represents the predicted water quality value at the target time. This represents the parameterized mapping function corresponding to the target water quality prediction head; S33. Set a predicted output head for the activated sludge model ASM mechanism state parameters at the output end of the shared temporal feature extraction backbone network. This head is used to output the predicted values ​​of the activated sludge model ASM mechanism state parameters at the target time and several future prediction times. The predicted output head for the activated sludge model ASM mechanism state parameters is represented as follows: in, Indicates the time from the present moment to the future. Predicted trajectory of ASM mechanism state parameters of activated sludge model at each time step; This represents the parameterized mapping function corresponding to the state parameter prediction head.

5. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 4, characterized in that, The target water quality prediction output head and the activated sludge model ASM mechanism state parameter prediction output head share the feature representation of the shared temporal feature extraction backbone network and are jointly trained through a joint loss function.

6. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 4, characterized in that, The mechanistic state parameters of the activated sludge model ASM include one or more of the following: soluble biodegradable substrate, particulate biodegradable substrate, soluble inert organic matter, particulate inert organic matter, heterotrophic bacteria, autotrophic bacteria, decay products, ammonia nitrogen, nitrate nitrogen, soluble organic nitrogen, particulate organic nitrogen, and dissolved oxygen.

7. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 1, characterized in that, Step S4 includes: S41. Constructing quality balance constraints based on the conservation relationship of target water quality indicators, specifically including: When the target water quality indicator is chemical oxygen demand, establish The law of conservation of mass is as follows: in, and These represent the effluent chemical oxygen demand at the current time and the target time, respectively. Indicates the influent chemical oxygen demand. Indicates the inflow rate. Indicates the volume of the reaction tank. This indicates the organic matter removal term. Indicates the time step; When the target water quality indicator is total nitrogen, establish The law of conservation of mass is as follows: in, and These represent the total nitrogen in the effluent at the current time and the target time, respectively. Indicates total nitrogen in the influent. This indicates the reaction terms related to total nitrogen removal; The deviation between the predicted value and the mechanism conservation relationship is calculated based on the mass conservation law and used as a mass balance constraint term. The mass balance constraint term is expressed as follows: in, Indicates the first The quality balance residuals corresponding to each sample Indicates the number of samples; S42. Constructing kinetic residual constraints based on the state-kinetic equations of the activated sludge model, specifically including: The state-kinetic equations for the activated sludge model (ASM) are constructed as follows: in, This represents the state parameter vector of the ASM mechanism in the activated sludge model. Indicates the runtime control variable. Indicates mechanism parameters, This represents the right-hand side function of the state-kinetic equation for the activated sludge model; The changes in the state parameters of the activated sludge model ASM mechanism between adjacent prediction times were calculated, and these changes were compared with the right-hand side of the state dynamics equation to obtain the kinetic residuals as follows: in, Indicates the first The activated sludge model ASM mechanism state parameter vector predicted at each time point Indicates the first The operational control variables at each moment; The dynamic residual is used as a dynamic residual constraint term, which is expressed as follows: S43. Construct weakly supervised constraints based on monitorable operational data and empirical estimation formulas, specifically including: Based on one or more of the following: influent and effluent water quality data, dissolved oxygen, mixed liquor suspended solids concentration, flow rate, temperature, oxygen transfer coefficient, and sludge age, the estimated values ​​of the mechanistic state parameters of the activated sludge model (ASM) are obtained through one or more of the following: pollutant component distribution relationships, biomass estimation relationships, nitrogen component estimation relationships, and dissolved oxygen approximation relationships. ; The estimated values ​​are compared with the corresponding state parameters output by the ASM mechanism state parameter prediction output head of the activated sludge model to obtain the weakly supervised constraint term, as shown below: in, Indicates the state parameter prediction head at the 1st Predicted values ​​of state parameters output at each time step; The first term is estimated by the empirical formula. Reference state parameter values ​​at each moment; S44. Construct the target water quality prediction error term as follows: in, Represents the regression loss function. This represents the predicted water quality value at the target time. This represents the actual water quality value at the target time. S45. The joint loss function is obtained by weighted summing of the mass balance constraint, dynamic residual constraint, weak supervision constraint, and target water quality prediction error, as shown below: in, This represents the error term in the target water quality prediction. This represents the mass balance constraint term. Represents the dynamic residual constraint term. This indicates a weakly supervised constraint. , , , These represent the corresponding loss weight coefficients.

8. The wastewater treatment water quality prediction method based on the fusion of physical information constraints and deep learning according to claim 1, characterized in that, Step S5 includes: S51. Input the constructed training samples into the deep learning network model for forward propagation to obtain the target water quality prediction value at the target time output by the target water quality prediction output head and the state parameter prediction value output by the activated sludge model ASM mechanism state parameter prediction output head. S52. Based on the joint loss function, the parameters of the deep learning network model are updated using gradient backpropagation. The training is repeated iteratively until the preset stopping condition is met, and the trained deep learning network model is obtained. S53. Input the sample to be predicted into the trained deep learning network model and output the water quality prediction result at the target time.

9. A wastewater treatment water quality prediction system based on the fusion of physical information constraints and deep learning, implemented according to any one of claims 1-8, characterized in that, include: The system comprises a data acquisition module, a data preprocessing module, a network construction module, a constraint construction module, and a model training and prediction output module, among which: The data acquisition module is used to collect influent and effluent water quality data, operating setpoints, and key process parameter data during the wastewater treatment process. The data preprocessing module is used to preprocess the collected data and construct training samples according to the preset time window length and prediction step size. The network construction module is used to construct a deep learning network model including a shared temporal feature extraction backbone network, a target water quality prediction output head, and an activated sludge model ASM mechanism state parameter prediction output head. The constraint construction module is used to construct the mass balance constraint, dynamic residual constraint, weak supervision constraint and target water quality prediction error term respectively, and to perform a weighted summation of the mass balance constraint, dynamic residual constraint, weak supervision constraint and target water quality prediction error to obtain the joint loss function; The model training and prediction output module is used to input the preprocessed training samples into the deep learning network model, train it based on the joint loss function, and obtain the water quality prediction results at the target time and the prediction results of the activated sludge model ASM mechanism state parameters at several future times.