A biochemical oxygen demand online prediction method for power plant sewage treatment
By constructing a multi-source heterogeneous dataset, a dual-branch fusion prediction model, and an online self-correction mechanism, the problem of real-time control of biochemical oxygen demand (BOD5) in power plant wastewater treatment was solved, achieving efficient and stable BOD5 prediction and control, ensuring effluent compliance and reducing operation and maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WEIHAI THERMAL POWER GRP CO LTD
- Filing Date
- 2026-04-15
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies cannot achieve real-time control of biochemical oxygen demand (BOD) in power plant wastewater treatment. Furthermore, commercial online BOD5 monitors suffer from response lag and are susceptible to interference from complex water quality factors such as high salinity, high suspended solids, heavy metals, and difficult-to-degrade corrosion and scale inhibitors in power plant wastewater. This results in high operation and maintenance costs and poor long-term operational stability. Moreover, existing prediction technologies do not fully integrate the strong correlation variables specific to power plants, thus failing to provide decision confidence.
A multi-source heterogeneous dataset was constructed. Through time-series alignment, anomaly detection, and missing value imputation, combined with the activated sludge mechanism model and feature engineering, a dual-branch fusion prediction base model was built. Transfer learning and Bayesian inference were used for operating condition adaptation, and an online self-correction mechanism was designed to quantify uncertainty. Combined with closed-loop control, the biochemical treatment process was optimized.
It enables online prediction and real-time control of biochemical oxygen demand (BOD) in power plant wastewater treatment, provides a clear reliability boundary, ensures stable compliance of effluent BOD5, reduces operation and maintenance costs, adapts to various operating conditions of power plants, and optimizes energy and chemical consumption.
Smart Images

Figure CN122494039A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data intelligent prediction technology, specifically a method for online prediction of biochemical oxygen demand in power plant wastewater treatment. Background Technology
[0002] Biochemical oxygen demand (BOD) is a core parameter characterizing the concentration of biodegradable organic matter in wastewater, directly determining the operational efficiency, effluent compliance rate, and energy and chemical consumption of biological treatment units. Currently, the detection and prediction of BOD5 in power plant wastewater treatment faces the following technical challenges: The national standard five-day biochemical culture method has a long testing cycle, which cannot provide a basis for real-time control of biochemical treatment processes. Commercial online BOD5 monitors generally have problems such as slow response, susceptibility to interference from complex water quality such as high salt, high suspended solids, heavy metals, and difficult-to-degrade corrosion and scale inhibitors in power plant wastewater, easy electrode contamination and clogging, high operation and maintenance costs, and poor long-term operational stability.
[0003] Existing BOD5 prediction technologies are mostly designed for urban domestic sewage or general industrial wastewater. A few solutions for power plant wastewater only use general data dimensionality reduction and case-based reasoning methods. They do not fully integrate unique and strongly correlated variables such as power plant unit load, desulfurization system operating status, circulating water concentration ratio, and wastewater treatment process operating parameters. They also do not consider the characteristics of power plant wastewater, which has multiple sources and fluctuates drastically in terms of water quality. The model input features lack scenario specificity.
[0004] The existing solution only outputs a single-point predicted value of BOD5, without quantifying the prediction uncertainty caused by noise in the input data and fluctuations in model parameters, and cannot provide operators with a reference for decision confidence; the existing technology only stays at the prediction level and does not link the prediction results with the operation optimization of the biochemical treatment process. Summary of the Invention
[0005] The purpose of this invention is to provide an online prediction method for biochemical oxygen demand in power plant wastewater treatment, so as to solve one or more problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: an online prediction method for biochemical oxygen demand (BOD) in power plant wastewater treatment, comprising the following specific steps: In the data preprocessing stage, a multi-source heterogeneous dataset of power plant wastewater treatment is constructed. Spatiotemporal dimension matching is achieved through time-series alignment. Data anomalies are handled by anomaly detection and missing value imputation methods, forming a standardized model training and validation dataset. In the feature engineering stage, based on the standardized dataset, the kinetic equations are calibrated using the activated sludge mechanism model. Through feature selection, redundancy removal, and feature enhancement, a subset of input features that incorporate the mechanism prior is obtained. In the base model construction stage, a dual-branch fusion prediction base model is constructed based on the input feature subset. The mechanism branch provides engineering mechanism constraints through the calibrated dynamic equations, and the data branch captures multi-timescale working condition features. Weights are allocated through an adaptive gating fusion mechanism to complete the offline training and validation of the base model. During the operating condition adaptation phase, based on the offline-trained dual-branch prediction base model, the typical operating condition domain of the power plant is divided by unsupervised clustering. The base model is fine-tuned by the transfer learning algorithm and a weight library of operating condition sub-models is constructed. During online operation, the optimal operating condition domain is matched by the Bayesian inference model, and the corresponding sub-model weights are automatically called. During the model calibration phase, an online self-calibration mechanism is designed to update the sub-model weights by triggering the prediction error threshold and incremental learning through a sliding window, while also introducing a model forgetting mechanism. In the uncertainty quantification stage, based on the corrected online prediction model, a combination of numerical simulation and neural network is used to quantify the prediction uncertainty and output prediction results with confidence intervals. In the closed-loop control stage, based on the prediction results and confidence intervals, and combined with the effluent BOD5 compliance requirements, a process parameter optimization model is constructed. The optimal control parameters are solved and sent to the power plant wastewater treatment PLC control system. The algorithm is optimized through the control effect feedback mechanism.
[0007] Furthermore, the data preprocessing stage constructs a multi-source heterogeneous dataset that integrates unit operating condition data, wastewater treatment process parameters, online water quality monitoring data, and offline laboratory BOD5 calibration data; based on the hydraulic retention time of each unit in the power plant's wastewater treatment, and combined with a time-series alignment algorithm, a multivariate spatiotemporal alignment model is constructed to achieve spatiotemporal matching of operating condition disturbances, influent water quality changes, and BOD5 of the effluent from the biological treatment tank. To address the issue of abnormal instrument data in power plant water with high salinity and high suspended solids, a hybrid anomaly detection algorithm combining isolated forest and gradient boosting tree is adopted to automatically identify abnormal operating conditions such as unit start-up and shutdown, equipment maintenance, and instrument failure. At the same time, a missing value imputation method based on kernel density estimation combined with attention mechanism is used to complete the data, and finally a standardized model training and validation dataset is formed.
[0008] The hybrid anomaly detection algorithm adopts a two-level progressive detection structure. The first level performs unsupervised rapid initial detection through an isolated forest, traversing all monitoring data points and calculating anomaly scores to mark anomaly candidate points that deviate from the normal data distribution. The second level combines the candidate points with information such as unit operating status, instrument calibration records, and process protection thresholds, and inputs them into a gradient boosting tree model for supervised classification, clearly distinguishing between real operating condition anomalies such as unit start-up and shutdown, instrument failure anomalies such as sensor drift, and data acquisition anomalies such as data packet loss.
[0009] Anomaly detection is set with tiered thresholds. Slight deviations are marked as anomalies to be verified, while significant deviations are marked as invalid anomaly data. Invalid anomaly data is directly removed and the interpolation process is initiated. Anomalies to be verified are manually reviewed in conjunction with on-site operation logs before being classified and processed.
[0010] Furthermore, the feature engineering stage is based on the standardized model training and validation dataset obtained in the data preprocessing stage. Based on the activated sludge mechanism model and combined with the inhibitory effect of power plant wastewater-specific components on BOD5 degradation, a BOD5 degradation kinetic numerical model for power plant wastewater is calibrated and constructed. The core mechanism feature set affecting BOD5 degradation is derived. The core mechanism feature set includes organic matter degradation rate constant, microbial growth rate, oxygen transfer coefficient, and inhibitory factor, injecting interpretable engineering prior constraints into the model. A two-layer feature screening model combining the maximum mutual information coefficient and the Pearson correlation coefficient is adopted, along with a feature redundancy removal algorithm based on L1 regularization, to sort the correlation between the mechanistic feature set and online measurable variables, remove redundancy, and evaluate feature importance. By generating derived features through feature crossover and polynomial expansion, a subset of input features that provides a priori fusion mechanism is finally obtained.
[0011] Furthermore, in the base model construction stage, a dual-branch fusion prediction base model is constructed based on the input feature subset of the fusion mechanism prior obtained in the feature engineering stage. The mechanism prior branch adopts the BOD5 degradation kinetics numerical model calibrated in the feature engineering stage and outputs the BOD5 prior prediction value based on the engineering mechanism, providing physical boundary constraints for the model. The data-driven branch adopts an improved multi-scale temporal attention network and introduces the Transformer attention mechanism to capture the characteristic dynamic change patterns of three time scales: daily unit load cycle, hourly influent flow fluctuation, and minute-level water quality parameter change. At the same time, residual connection and layer normalization technology are added to adapt to the operating condition fluctuation characteristics of power plants at multiple time scales. The adaptive gating fusion mechanism trains fusion weights based on a logistic regression model. It can adaptively allocate the output weights of the mechanism branch and the data branch according to the complexity of real-time operating conditions and data quality, and complete the offline training and validation of the base model.
[0012] Furthermore, the operating condition adaptation stage is based on the dual-branch fusion prediction base model that has been trained and validated offline in the base model construction stage. A Gaussian mixture model is used to perform unsupervised clustering on the historical full-condition dataset. A Bayesian information criterion is introduced to automatically optimize the number of clusters, resulting in five typical power plant-specific operating condition domains: full-load stable operating condition, low-load peak-shaving operating condition, unit start-up and shutdown operating condition, rainy season impact operating condition, and large-flow desulfurization wastewater discharge operating condition. For each operating condition domain, a transfer learning algorithm based on a domain adaptive network is used, combined with a domain difference metric of power plant operating condition characteristics, to fine-tune and optimize the base model, constructing a weight library for operating condition sub-models. During online operation, current operating condition characteristics are collected in real time, and the optimal operating condition domain is matched through a Bayesian inference model, automatically calling the corresponding sub-model weights.
[0013] Furthermore, the model calibration stage is based on the working condition-specific sub-model weight parameter library and full working condition adaptive adaptation mechanism built in the working condition adaptation stage. It designs an online self-calibration mechanism that triggers the prediction error threshold and uses sliding window incremental learning. It sets a relative error threshold between the model prediction value and the offline laboratory BOD5 calibration value, and adopts an error trend prediction model to predict the error change trend in advance. When the error between the prediction value and the offline laboratory BOD5 calibration value exceeds the threshold for three consecutive times or the error trend shows a continuous increase, the model update is automatically triggered. The effective working conditions and calibration data within the sliding window before the current time are extracted. An improved incremental learning algorithm is used for online incremental training based on stochastic gradient descent to update the weights of the sub-models corresponding to the current working condition. At the same time, a model forgetting mechanism is introduced to retain the model's historical learning ability.
[0014] The Bayesian inference model takes real-time collected operating condition features as input, calculates the probability value of the current operating condition belonging to each typical operating condition domain based on historical operating condition clustering results and prior probability distribution, and selects the operating condition domain with the highest probability as the optimal matching result; the Bayesian inference model will continuously update the prior probability as the operating data accumulates, adapting to the dynamic changes in power plant operating conditions.
[0015] If the current working condition matches two types of working condition domains with similar probabilities, and the difference between the probabilities of the two types of working conditions is less than 5%, it is determined that the probabilities are similar. The hybrid weight calling mode is automatically activated, and the weights of the two types of sub-models are merged according to the probability ratio to avoid abnormal model calling caused by blurred working condition boundaries.
[0016] Furthermore, the uncertainty quantification stage is based on the online prediction model of the model calibration stage. It uses Monte Carlo numerical simulation combined with Bayesian neural network to randomly sample the instrument measurement noise of the model input parameters and the uncertainty of the model weight parameters, and performs thousands of forward numerical calculations of the model to obtain the probability density distribution of the BOD5 predicted value. Based on the probability distribution, the prediction interval at a 95% confidence level is calculated and output to quantify the reliability boundary of the prediction result. The sampling efficiency is optimized through machine learning algorithms.
[0017] Each time offline BOD5 calibration data is entered in the laboratory, the system automatically compares the latest calibration value with the predicted value for the corresponding period, updates the model error compensation parameters synchronously, and continuously reduces the deviation between the predicted value and the actual value.
[0018] After the prediction interval is generated, a reasonableness check is performed to remove abnormal interval results that exceed the actual range of the project; if abnormal intervals are output multiple times in a row, the sampling and inference calculations are automatically re-executed.
[0019] Furthermore, the closed-loop control stage, based on the BOD5 prediction value output from the uncertainty quantification stage and the prediction interval at a 95% confidence level, combined with the effluent BOD5 compliance threshold of the biochemical treatment unit, constructs a constrained process parameter optimization numerical model. With effluent compliance as the constraint and minimum energy and chemical consumption as the objective function, an improved sequential quadratic programming algorithm is used, combined with a particle swarm optimization algorithm to initialize the optimal solution. The optimal process control parameters such as aeration volume, sludge return ratio, sludge discharge volume, influent distribution ratio, and carbon source dosage are obtained. Standardized protocol instructions are generated and directly sent to the power plant wastewater treatment PLC control system. The control effect feedback mechanism collects the process parameters and BOD5 detection values after control in real time, inputs the data into the model for self-learning, and dynamically optimizes the control parameter solution algorithm.
[0020] The instructions use the Modbus standard communication protocol and include a four-segment structure: parameter encoding, value, execution time limit, and check code. Data verification is performed before the instructions are sent, and the PLC returns an execution confirmation signal after receiving the instructions.
[0021] The beneficial effects of this invention are as follows: 1. This invention constructs a multi-source heterogeneous dataset that integrates unit operating conditions, process parameters, online water quality monitoring, and offline BOD5 calibration data. It achieves time-series alignment by combining hydraulic residence time and uses hybrid anomaly detection and intelligent interpolation technology to generate a standardized dataset. The dual-branch fusion base model combines the calibrated mechanistic dynamic constraints with multi-scale time-series data-driven approaches. Through an adaptive gating fusion mechanism, it both injects engineering priors to avoid predictions deviating from reality and captures fluctuations in operating conditions at multiple time scales.
[0022] 2. This invention uses Gaussian mixture model unsupervised clustering to classify five typical power plant operating conditions, including full load and unit start-up and shutdown. It combines domain adaptive transfer learning to fine-tune the base model and constructs a weight library for sub-models of operating conditions. The optimal operating condition weights are matched online through Bayesian inference, enabling the model to adapt to various sudden and stable operating conditions. An error threshold triggering and sliding window incremental learning mechanism is designed, along with a model forgetting mechanism, which can dynamically correct the model in real time based on offline calibration data.
[0023] 3. This invention uses Monte Carlo simulation combined with Bayesian neural network to quantify the uncertainty of input noise and model parameters, and outputs a prediction interval with a 95% confidence level, providing operators with a clear reliability boundary. Based on the prediction results, a process optimization model is constructed with the constraint of achieving effluent standards and the goal of minimizing energy and chemical consumption. The optimal parameters such as aeration, reflux, and carbon source addition are solved and distributed to the PLC. Combined with the control effect feedback mechanism, the algorithm is continuously iterated to ensure that the effluent BOD5 stably meets the standards. Attached Figure Description
[0024] Figure 1 This is a flowchart of the online prediction process for biochemical oxygen demand in power plant wastewater treatment according to the present invention. Figure 2 This is a flowchart of the dual-branch model fusion and online self-calibration process of the present invention; Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.
[0026] like Figures 1 to 2 As shown, this embodiment of the invention provides an online prediction method for biochemical oxygen demand in power plant wastewater treatment, including the following specific steps; In this embodiment of the invention, the data preprocessing stage constructs a multi-source heterogeneous dataset that integrates unit operating condition data, wastewater treatment process parameters, online water quality monitoring data, and offline laboratory BOD5 calibration data. Based on the hydraulic retention time of each unit in the power plant's wastewater treatment, and combined with a time-series alignment algorithm (which employs a dynamic time warping algorithm), a multivariate spatiotemporal alignment model is constructed to achieve time dimension matching between operating condition disturbances, influent water quality changes, and the BOD5 of the effluent from the biological treatment tank. All types of data are accessed through a unified acquisition interface. Unit operating data is read from the power plant's SCADA system, process parameters are collected from the wastewater treatment DCS system, online water quality data is uploaded in real time by field instruments, and offline BOD5 calibration data is manually entered into the system by laboratory personnel. All data are assigned a unified timestamp and location code. After the unified access and standardization of multi-source data are completed, time alignment is performed based on a dynamic time warping algorithm.
[0027] The dynamic time warping algorithm uses the hydraulic residence time of each processing unit as the core alignment basis, and performs flexible time matching on multiple time series such as unit operating conditions, influent water quality, process parameters, and effluent BOD5. It automatically corrects the acquisition delay, data transmission delay and biochemical reaction lag deviation of different monitoring equipment, and binds the disturbance changes at the influent end with the response results at the effluent end to eliminate model training errors caused by time sequence misalignment.
[0028] The timing matching is set with a precision judgment standard. When the overall matching degree of the multivariate sequence reaches the preset requirement, the alignment is judged to be complete and the regularization calculation is automatically terminated. Abnormal timing segments that fail to match are marked separately, and the hydraulic residence time is corrected again before alignment.
[0029] To address the issue of abnormal instrument data in power plant water with high salinity and high suspended solids, a hybrid anomaly detection algorithm combining isolated forest and gradient boosting tree is adopted to automatically identify abnormal operating conditions such as unit start-up and shutdown, equipment maintenance, and instrument failure. At the same time, a missing value imputation method based on kernel density estimation combined with attention mechanism is used to complete the data, and finally a standardized model training and validation dataset is formed. The standardized rules set the data sampling frequency to 1 minute per data entry, performed interval normalization on numerical parameters, added special labels to outlier and imputed data, and divided the training and validation sets in a 7:3 ratio.
[0030] The missing value imputation method first uses kernel density estimation to fit the historical distribution patterns of various water quality and operating condition parameters to determine the normal fluctuation range and typical value characteristics of the parameters. Then, a time-series attention module is introduced to automatically weight and focus on the effective data segments adjacent to the missing position, and prioritizes matching the complete data sequence under the same type of operating condition for fitting and imputation. Corresponding imputation strategies are adopted for single-point missing, short continuous missing, and long continuous missing.
[0031] In this embodiment of the invention, the feature engineering stage is based on the standardized model training and validation dataset obtained in the data preprocessing stage. Based on the activated sludge mechanism model, combined with the inhibitory effect of power plant wastewater-specific components on BOD5 degradation, a numerical model of BOD5 degradation kinetics for power plant wastewater is calibrated and constructed. The core mechanism feature set affecting BOD5 degradation is derived. The core mechanism feature set includes organic matter degradation rate constant, microbial growth rate, oxygen transfer coefficient, and inhibitory factor, injecting interpretable engineering prior constraints into the model. The core mechanism characteristics need to be verified by on-site variable operating condition test. The BOD5 degradation response effect is observed by adjusting the corresponding parameters, and invalid parameters with low sensitivity and no practical effect are eliminated.
[0032] The calibration process begins with a full-component analysis of the power plant wastewater to identify key inhibitory substances such as high salt content, heavy metals, and corrosion and scale inhibitors. The inhibition intensity at different concentrations is then determined through a static degradation experiment in the laboratory. The kinetic parameters are then fitted and corrected by combining the on-site biochemical tank operation data. Finally, the calibration accuracy is verified by multiple sets of offline BOD5 calibration data.
[0033] A two-layer feature screening model combining maximum mutual information coefficient and Pearson correlation coefficient is adopted, along with a feature redundancy elimination algorithm based on L1 regularization. The correlation between the mechanism feature set and online measurable variables is ranked, redundancy is eliminated, and feature importance is evaluated. Derived features are generated through feature cross and polynomial expansion, and finally, the input feature subset that integrates the mechanism prior is obtained. The feature cross-selection mechanism features are combined with online measurable variables in pairs to generate interactive features. The multinomial expansion adopts a second-order expansion method to generate nonlinear derived features. After expansion, invalid derived features with low contribution are eliminated by ranking the feature importance to avoid the model overfitting due to excessive feature dimension.
[0034] The dual-layer feature selection model first uses the Pearson correlation coefficient to screen for linear correlation, eliminating invalid features that have no obvious linear correlation with BOD5; then it uses the maximum mutual information coefficient to evaluate nonlinear correlation, retaining key features that have a significant impact on changes in BOD5; and finally, it uses an L1 regularized redundancy elimination algorithm to check for collinearity of the selected features, merging redundant features with highly overlapping information, ultimately obtaining model input features with low redundancy, high sensitivity, and strong discriminative power.
[0035] In this embodiment of the invention, the base model construction stage is based on the fusion mechanism prior, low redundancy, high sensitivity, and high discriminativeness of the input feature subset obtained in the feature engineering stage, and constructs a dual-branch fusion prediction base model. The mechanism prior branch adopts the BOD5 degradation kinetics numerical model calibrated in the feature engineering stage, and outputs the BOD5 prior prediction value based on the engineering mechanism, providing physical boundary constraints for the model and avoiding the model output prediction results that deviate from the engineering reality.
[0036] The mechanism prior branch only inputs calibrated core mechanism features, while the data-driven branch only inputs online measurable multi-scale time-series features. The input features of the two branches are independent of each other and do not overlap or reuse, thus achieving decoupling from the input layer.
[0037] The data-driven branch adopts an improved multi-scale temporal attention network and introduces the Transformer attention mechanism to capture the characteristic dynamic change patterns of three time scales: daily unit load cycle, hourly influent flow fluctuation, and minute-level water quality parameter change. At the same time, residual connection and layer normalization technology are added to adapt to the operating condition fluctuation characteristics of power plants at multiple time scales. The improved multi-scale temporal attention network has a modular hierarchical structure, consisting of an input adaptation layer, a multi-scale time series splitting layer, a parallel feature extraction layer, a Transformer encoder layer, a residual fusion layer, a feature compression layer, and an output mapping layer. The input layer receives a 1×36-dimensional temporal feature vector, which is split into three parallel branches at three scales: 1 minute, 60 minutes, and 1440 minutes. Each branch has a convolutional feature extraction layer with ReLU activation function to extract local temporally dependent features. The Transformer encoder layer has two layers, eight multi-head attention heads, a hidden layer dimension of 256, and a feedforward network dimension of 512, used to capture global temporally correlated features. Each encoder layer is followed by a residual connection and a layer normalization unit to prevent gradient vanishing and accelerate model convergence. The three multi-scale features are concatenated and fused to output a high-dimensional temporal feature vector of 1×256.
[0038] The adaptive gating fusion mechanism trains fusion weights based on a logistic regression model, and can adaptively allocate the output weights of the mechanism branch and the data branch according to the complexity of real-time working conditions and data quality, so as to complete the offline training and validation of the base model. The adaptive gated fusion unit is a dual-input single-output structure. The input data includes the BOD5 prior prediction value Y1 from the mechanism branch output, the time-series prediction value Y2 from the data-driven branch output, and a 1×8 dimension operating condition complexity feature vector X, which includes data completeness, operating condition fluctuation amplitude, instrument signal-to-noise ratio, water quality anomaly degree, etc. The fusion weights are calculated and generated by the logistic regression model, and the core calculation formula is W=σ(θ·X+b), where σ is the Sigmoid activation function; θ is the model weight coefficient, with an initial value uniformly set to 0.5; b is the bias term, with an initial value set to 0; the final fusion prediction result Y=W×Y1+(1-W)×Y2; the model offline training adopts a mini-batch gradient descent optimizer, with a batch size of 32, an initial learning rate of 0.001, a maximum number of iterations of 100 rounds, and the mean squared error as the loss function. Training is stopped early when the validation set loss does not decrease for 10 consecutive rounds.
[0039] In this embodiment of the invention, the operating condition adaptation stage is based on the dual-branch fusion prediction base model that has been trained and validated offline in the base model construction stage. A Gaussian mixture model is used to perform unsupervised clustering on the historical full-condition dataset. A Bayesian information criterion is introduced to automatically optimize the number of clusters, resulting in five typical operating condition domains specific to power plants: full-load stable operating condition, low-load peak-shaving operating condition, unit start-up and shutdown operating condition, rainy season impact operating condition, and large-flow desulfurization wastewater discharge operating condition. For each operating condition domain, a transfer learning algorithm based on a domain adaptive network is used, combined with a domain difference metric of power plant operating condition characteristics, to fine-tune and optimize the base model, constructing a weight library for operating condition sub-models. During online operation, current operating condition characteristics are collected in real time, and the optimal operating condition domain is matched using a Bayesian inference model, automatically calling the corresponding sub-model weights. The domain adaptive network uses a base model as the backbone network and adopts the maximum mean difference (MMD) as the domain difference metric to quantify the feature distribution difference between the source domain full-condition data and the target domain single-condition data. The total loss function of transfer learning is composed of the prediction loss and the domain adaptation loss weighted together. The calculation formula is: total loss = prediction mean square error loss + 0.2 × MMD domain difference loss. The model fine-tuning adopts a layered freezing strategy, freezing the first 80% of the feature extraction layers of the base model, and only updating the parameters of the fully connected layers and adaptive gating units. The fine-tuning optimizer adopts the Adam algorithm, with a learning rate of 0.0001, a batch size of 16, and 30 iterations. This minimizes domain differences while preserving the general predictive ability of the base model, and finally generates weights for specific sub-models for each working condition.
[0040] The model fine-tuning is set with convergence criteria. Fine-tuning stops when the prediction accuracy remains stable for multiple consecutive rounds and no longer improves. Sub-model weight files are saved separately according to the working condition category, and the corresponding working condition type and accuracy index are labeled for easy online quick access and management.
[0041] The input features for Gaussian mixture model clustering are a standard operating condition vector of dimension 1×12, which specifically includes core operating condition parameters such as unit load rate, influent flow rate, salinity, suspended solids concentration, water temperature, pH value, sludge concentration, and aeration volume. The model presets the initial range of the number of clusters K to 3-8, uses the K-means algorithm to initialize the cluster centers, sets the covariance matrix type to full covariance, and uses Mahalanobis distance as the distance metric to adapt to the high-dimensional operating condition feature distribution. The goodness of fit of each cluster number was calculated using the Bayesian information criterion. When the BIC value dropped below 1000 and tended to stabilize, the optimal cluster number K=5 was determined. The division of five typical power plant operating conditions was completed. The clustering results were verified by on-site operating conditions and used as the standard for dividing the operating condition domain.
[0042] In this embodiment of the invention, the model calibration stage is based on the working condition-specific sub-model weight parameter library and the full working condition adaptive adaptation mechanism built in the working condition adaptation stage. An online self-calibration mechanism of prediction error threshold triggering and sliding window incremental learning is designed. The relative error threshold between the model prediction value and the offline laboratory BOD5 calibration value is set. An error trend prediction model is used to predict the error change trend. When the detection value exceeds the threshold for three consecutive times or the error trend shows a continuous increase, the model update is automatically triggered. The error trend prediction model is based on historical prediction errors to construct a time-series trend fitting logic, extracts features such as the rate of change of error, fluctuation amplitude, and direction of continuity, and determines whether the error is in a stable, rising, or falling state; it is further verified by combining the current water quality fluctuation intensity and the change amplitude of operating conditions.
[0043] The effective working conditions and calibration data within the sliding window before the current time are extracted. An improved incremental learning algorithm is used for online incremental training based on stochastic gradient descent to update the weights of the sub-models corresponding to the current working condition. At the same time, a model forgetting mechanism is introduced to retain the model's historical learning ability.
[0044] The model forgetting mechanism exponentially decays the weights of historical data based on their time proximity, prioritizing the retention of valid operating data from the last 72 hours and gradually reducing the parameter impact of outdated data. This approach avoids old data interfering with the model's real-time performance while preserving long-term learning experience from typical operating conditions.
[0045] The sliding window time span for online calibration is set to 72 hours, and only valid working condition data without anomalies or missing data and offline BOD5 calibration data are retained within the window. The model forgetting mechanism adopts an exponential decay strategy with a forgetting rate of 0.1. Each round of incremental training automatically decays the weight of historical old data by 10% to reduce the interference of outdated data on the model. Incremental training uses a stochastic gradient descent optimizer with a learning rate of 0.0005 and a momentum parameter of 0.9. The prediction error trigger threshold is set to ±8% relative error. Incremental updates are automatically triggered when the model's predicted value exceeds the error threshold for three consecutive times or when the error trend continues to rise for five consecutive time steps.
[0046] If the accuracy drops below a preset threshold, a rollback is triggered, restoring the sub-model weights to the stable weights of the previous version. At the same time, the updated data is marked as abnormal, subsequent automatic updates are paused, and manual verification is prompted.
[0047] Before incremental training, the data within the window is screened a second time to remove abnormal data that has not been calibrated and data with insufficient interpolation accuracy, and only high-quality data that is real, valid and fully labeled is retained for training.
[0048] In this embodiment of the invention, the uncertainty quantification stage is based on the online prediction model of the model calibration stage. The method of Monte Carlo numerical simulation combined with Bayesian neural network is used to randomly sample the instrument measurement noise of the model input parameters and the uncertainty of the model weight parameters, and to carry out thousands of forward numerical calculations of the model to obtain the probability density distribution of the BOD5 predicted value. Based on probability distribution, the prediction interval at a 95% confidence level is calculated and output, the reliability boundary of the prediction results is quantified, and the sampling efficiency is optimized through machine learning algorithms to reduce computational complexity, providing operators with a confidence-based decision-making basis. The sampling optimization employs an importance sampling strategy to screen high-contribution samples, eliminates duplicate and invalid sampled data, and combines parallel computing technology to execute multiple sets of forward inference simultaneously, thereby shortening the computation time for uncertainty quantification.
[0049] The Bayesian neural network employs a dual-hidden-layer structure, with the first hidden layer having a dimension of 128 and the second hidden layer having a dimension of 64. The activation function for both layers is Tanh. The prior distribution of the model weights and biases is set to a standard normal distribution N(0, 1), while the instrument measurement noise of the input parameters follows a Gaussian distribution N(0, 0.05), simulating measurement errors under actual working conditions. The Monte Carlo numerical simulation is set to 1000 sampling times, randomly sampling the model weights and input noise and performing forward inference, statistically analyzing the probability density distribution of all sampling results. Based on the distribution characteristics, the upper and lower bounds of the prediction at a 95% confidence level are calculated, and the BOD5 prediction result with confidence intervals is output, clearly defining the reliability boundary of the prediction result.
[0050] In this embodiment of the invention, the closed-loop control stage is based on the predicted BOD5 value output from the uncertainty quantification stage and the prediction interval at a 95% confidence level. Combined with the effluent BOD5 compliance threshold of the biochemical treatment unit, a constrained process parameter optimization numerical model is constructed. With effluent compliance as the constraint and minimum energy and chemical consumption as the objective function, an improved sequential quadratic programming algorithm is used, combined with a particle swarm optimization algorithm to initialize the optimal solution. The optimal aeration air volume, sludge return ratio, sludge discharge volume, influent distribution ratio, carbon source dosage, and other process control parameters are obtained. Standardized protocol instructions are generated and directly sent to the power plant wastewater treatment PLC control system. The control effect feedback mechanism collects the process parameters and BOD5 detection values after control in real time, inputs them into the model for self-learning, and dynamically optimizes the control parameter solution algorithm. The aforementioned control effect feedback mechanism establishes a closed-loop evaluation system for the execution effect of control commands. It collects process operation data, effluent water quality data, and energy and chemical consumption data in real time within a fixed period after the control is completed, and evaluates the compliance effect and economy of the control parameters. The evaluation results are used as learning samples to input into the optimization algorithm, and the algorithm's solution rules and parameter weights are iteratively adjusted.
[0051] The process parameter optimization model uses achieving effluent BOD5 compliance as the core constraint and minimizing the total energy and chemical costs of the wastewater treatment system as the optimization objective function. A particle swarm optimization algorithm is used for initializing the global optimum, with parameters set to 30 particles, a maximum of 50 iterations, learning factors c1=c2=2, and inertia weights linearly decaying to 0.7. A sequential quadratic programming algorithm is used for locally accurate solutions, with a convergence accuracy set to 10. -6 The constraints limit the effluent BOD5 to ≤10mg / L, and the process parameters such as aeration volume and sludge return ratio to be within the rated operating range of the equipment. The optimization results are then standardized to generate PLC control instructions.
[0052] After the optimal control parameters are generated, the equipment operating boundary is first checked to ensure that the parameters are within the rated adjustable range of the aeration, reflux, and dosing equipment. The parameters are then issued for execution only after the check is passed to avoid the parameters exceeding the equipment capacity and causing control failure.
[0053] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0054] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for online prediction of biochemical oxygen demand (BOD) in power plant wastewater treatment, characterized in that, The specific steps include the following: In the data preprocessing stage, a multi-source heterogeneous dataset of power plant wastewater treatment is constructed. Spatiotemporal dimension matching is achieved through time-series alignment. Data anomalies are handled by anomaly detection and missing value imputation methods, forming a standardized model training and validation dataset. In the feature engineering stage, based on the standardized dataset, the kinetic equations are calibrated using the activated sludge mechanism model. Through feature selection, redundancy removal, and feature enhancement, a subset of input features that incorporate the mechanism prior is obtained. In the base model construction stage, a dual-branch fusion prediction base model is constructed based on the input feature subset. The mechanism branch provides engineering mechanism constraints through the calibrated dynamic equations, and the data branch captures multi-timescale working condition features. Weights are allocated through an adaptive gating fusion mechanism to complete the offline training and validation of the base model. During the operating condition adaptation phase, based on the offline-trained dual-branch prediction base model, the typical operating condition domain of the power plant is divided by unsupervised clustering. The base model is fine-tuned by the transfer learning algorithm and a weight library of operating condition sub-models is constructed. During online operation, the optimal operating condition domain is matched by the Bayesian inference model, and the corresponding sub-model weights are automatically called. During the model calibration phase, an online self-calibration mechanism is designed to update the sub-model weights by triggering the prediction error threshold and incremental learning through a sliding window, while also introducing a model forgetting mechanism. In the uncertainty quantification stage, based on the corrected online prediction model, a combination of numerical simulation and neural network is used to quantify the prediction uncertainty and output prediction results with confidence intervals. In the closed-loop control stage, based on the prediction results and confidence intervals, and combined with the effluent BOD5 compliance requirements, a process parameter optimization model is constructed. The optimal control parameters are solved and sent to the power plant wastewater treatment PLC control system. The algorithm is optimized through the control effect feedback mechanism.
2. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 1, characterized in that, The multi-source heterogeneous dataset constructed in the data preprocessing stage integrates unit operating condition data, wastewater treatment process parameters, online water quality monitoring data, and offline laboratory BOD5 calibration data.
3. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 2, characterized in that, In the data preprocessing stage, based on the hydraulic retention time of each unit in the power plant's wastewater treatment, a time-series alignment algorithm is used to match the time dimension of operating condition disturbances, changes in influent water quality, and BOD5 of the effluent from the biological treatment tank; a hybrid anomaly detection algorithm is used to identify abnormal operating condition data, and an intelligent missing value imputation method is used to complete the data.
4. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 1, characterized in that, In the feature engineering stage, based on the activated sludge mechanism model and combined with the inhibitory effect of power plant wastewater components on BOD5 degradation, a numerical model of BOD5 degradation kinetics specifically for power plant wastewater is calibrated and constructed, and the core mechanism feature set affecting BOD5 degradation is derived.
5. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 4, characterized in that, In the feature engineering stage, a feature selection model and a redundancy removal algorithm are used to sort the correlation between the mechanism feature set and the online measurable variables, remove redundancy, and evaluate feature importance. Derivative features are generated through feature crossover and polynomial expansion to obtain the input feature subset that integrates the mechanism prior.
6. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 1, characterized in that, In the base model construction phase, the mechanism prior branch adopts the calibrated numerical model of BOD5 degradation kinetics to output the prior prediction value of BOD5 based on the engineering mechanism; the data-driven branch adopts an improved multi-scale temporal attention network to capture the dynamic change law of features at multiple time scales.
7. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 6, characterized in that, In the base model construction phase, the adaptive gating fusion mechanism trains and determines the fusion weights based on the logistic regression model, and adaptively allocates the output weights of the mechanism branch and the data branch according to the real-time operating complexity and data quality to complete the offline training and verification of the base model.
8. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 1, characterized in that, In the operating condition adaptation stage, the Gaussian mixture model unsupervised clustering algorithm is used to cluster the historical full operating condition dataset. After automatically optimizing the number of clusters, the typical operating condition domains for power plants are divided. For each operating condition domain, the transfer learning algorithm is used to fine-tune the base model and construct the operating condition sub-model weight library.
9. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 8, characterized in that, During the online operation phase of the working condition adaptation phase, the current working condition characteristics are collected in real time, the optimal working condition domain is matched through the Bayesian inference model, and the corresponding sub-model weights are automatically called. In the model calibration phase, the relative error threshold between the predicted value and the offline laboratory BOD5 calibration value is set, and the model update is automatically triggered by predicting the error trend. The sub-model weights are updated using an incremental learning algorithm and a model forgetting mechanism is introduced.
10. The method for online prediction of biochemical oxygen demand in power plant wastewater treatment according to claim 1, characterized in that, In the uncertainty quantification stage, a method combining Monte Carlo numerical simulation and Bayesian neural network is used to sample the uncertainty of input parameter noise and model weight parameters, and calculate and output the prediction interval at a specified confidence level. In the closed-loop control stage, with the effluent BOD5 meeting the standard as a constraint and the minimum energy and chemical consumption as the goal, the optimal process control parameters are solved and sent to the power plant wastewater treatment PLC control system. The algorithm for solving the control parameters is optimized through feedback of the control effect.