A river water quality change prediction method and system based on water quality change stage division and physical guidance prediction

By using a method based on water quality change stage segmentation and physical guidance prediction, combined with LSTM network and physically constrained neural network, the problem of weak multi-source data fusion capability of traditional river water quality monitoring models is solved. This enables efficient prediction of river water quality and calculation of recovery time, reduces treatment costs, and improves pollution prevention and control efficiency.

CN121958908BActive Publication Date: 2026-06-26SHANGHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610433304.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-03
Publication Date
2026-06-26
Estimated Expiration
2046-04-03

AI Technical Summary

Technical Problem

Traditional river water quality monitoring models have weak multi-source data fusion capabilities, cannot provide intuitive pollution levels and recovery times, and are costly, failing to achieve source control and dynamic regulation.

Method used

A method based on water quality change stage division and physical guidance prediction is adopted. By combining LSTM network and physical constraint neural network, dissolved oxygen is predicted and recovery time is calculated. River water quality is predicted by combining rainfall data.

Benefits of technology

It has improved the interpretability and predictive ability of river water quality forecasting, reduced treatment costs, realized the transformation from end-of-pipe treatment to source control, and improved the efficiency of pollution prevention and control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121958908B_ABST
    Figure CN121958908B_ABST
Patent Text Reader

Abstract

The application discloses a river water quality change prediction method and system based on water quality change stage division and physical guidance prediction, and belongs to the technical field of water environment monitoring and pollution prevention and control. The method comprises the following steps: time segmentation is performed on historical data of a single river section; dimension reduction and clustering are performed on the change amount of water quality data in a period of time; different water quality stage types suitable for the current river are divided; a LSTM network is used to predict pollutant indexes; a physical guidance neural network is used to accurately predict dissolved oxygen; and finally, recovery time is calculated according to the predicted water quality. The application realizes accurate prediction of dissolved oxygen in the river, and provides data support for future aeration control of river water quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water environment monitoring and pollution control technology, and is a method and system for predicting river water quality changes based on the division of water quality change stages and physical guidance prediction. Background Technology

[0002] The deterioration of water quality impacts urban aquatic ecosystems and the aquatic environment. Traditional end-of-pipe treatment methods have limited effectiveness and high costs for treating mixed pollution sources. River water quality is significantly affected by factors such as rainfall. While ordinary data-driven models have strong modeling capabilities for nonlinear data relationships, they are weak in fusing multi-source data, including rainfall data, and their interpretability is low, failing to provide intuitive data and offering limited guidance for river management. Furthermore, river management requires more intuitive suggestions; traditional models can only perform predictive tasks and cannot provide intuitive information on pollution levels and recovery times. Summary of the Invention

[0003] To address the above problems, this invention proposes a method and system for predicting river water quality changes based on water quality change stage segmentation and physical-guided prediction. By incorporating rainfall data and physical knowledge of dissolved oxygen changes, it enhances prediction capabilities and model interpretability across different time spans. Furthermore, it can accurately answer the river recovery time using a framework, enabling a shift from "end-of-pipe treatment" to "source control + dynamic regulation," reducing treatment costs and improving pollution control efficiency. The method includes: segmenting historical data from a single river section over time; performing dimensionality reduction and clustering on the changes in water quality data over a period of time to classify different water quality stage types suitable for the current river; using an LSTM network to predict pollutant indicators; and using a physical-guided neural network for accurate prediction of dissolved oxygen. This method can calculate the recovery time based on predicted water quality and achieve accurate prediction of river dissolved oxygen, providing data support for future aeration control of river water quality.

[0004] The following is the technical solution of the present invention:

[0005] This invention provides a method for predicting river water quality changes based on water quality change stage division and physical guidance prediction, comprising the following steps:

[0006] S1, Water Quality Change Stage Classification: The original water quality monitoring data and precipitation data are co-processed to extract the differential features of water quality parameters and perform water temperature collinearity compensation to form a standardized differential feature sequence. Based on the differential feature sequence, multiple water quality state categories are obtained by principal component analysis and clustering. The multiple water quality state categories are arranged in chronological order to construct a state transition matrix. The state transition matrix is ​​analyzed to identify water quality change patterns driven by precipitation, and the water quality evolution process is divided into multiple water quality stage classification models from pollution to recovery.

[0007] S2, Dual-branch prediction: Based on a preset prediction step size, data segments that meet the requirements of continuous monitoring are divided. Wavelet denoising is performed on the time series of different water quality indicators to construct the input features required for the prediction model. The denoised data is then input into the prediction model to achieve multi-variable, multi-step joint prediction of river water quality. Specifically, a physical mechanism-guided prediction model is used for dissolved oxygen (DO). The Streeter-Phelps type reoxygenation-oxygen consumption kinetic equation is embedded in a neural network structure to output the reoxygenation coefficient and the oxygen consumption coefficient of various pollutants, and the DO concentration at the next time step is calculated accordingly. For other water quality indicators besides DO, a Long Short-Term Memory (LSTM) network is used for multi-step collaborative prediction.

[0008] S3 combines the joint prediction results of river water quality with precipitation data and inputs them into the water quality stage classification model divided in step S1 to determine the water quality stage classification to which each prediction time step belongs.

[0009] Furthermore, after determining the water quality stage classification to which each predicted time step belongs, the time required for the water quality to move from the current or predicted pollution stage to the recovery stage is calculated.

[0010] Furthermore, the collaborative preprocessing includes: dividing the data into segments based on rainfall events; within each segment, using a sliding window for data cleaning; combining box plots and the 3σ criterion within the window to detect and remove outliers; and restoring data integrity through a closed-loop mechanism of "interpolation → detection → re-interpolation".

[0011] Furthermore, the water quality stages include: initial pollution stage, pollution diffusion stage, water quality recovery stage, and natural fluctuation stage. Each water quality stage category is significantly correlated with precipitation events (p value < 0.05).

[0012] Furthermore, in the prediction model guided by the physical mechanism, ΔDO is expressed as:

[0013]

[0014] Where ΔDO is the change in dissolved oxygen concentration from time t to time t+1, L2 is the reoxygenation coefficient, and DO sat DO is the saturated dissolved oxygen concentration. current K is the dissolved oxygen concentration at time t. i Let C be the oxygen consumption coefficient of the i-th pollutant. i The current concentration of the i-th pollutant, which includes at least permanganate index, ammonia nitrogen, total phosphorus, and total nitrogen; Oxygen consumption for non-target pollutants represents the net change in dissolved oxygen caused by the transformation process of non-target pollutants.

[0015] During the neural network training phase, a physical consistency loss function is introduced to constrain the physical parameters of its output (L2 and various K-type parameters). i This conforms to the laws of water quality dynamics. The loss function constrains the physical parameters output by the neural network to conform to the basic laws of water quality dynamics, thereby ensuring that the dissolved oxygen model not only performs well in data fitting, but also has a clear physical interpretability in its internal mechanism, thus improving the robustness and long-term extrapolation ability of the prediction results.

[0016] Furthermore, the clustering is hierarchical clustering and / or spectral clustering.

[0017] The present invention also provides a river water quality change prediction system for implementing the aforementioned method, comprising:

[0018] a. Water quality stage classification module, including:

[0019] - Multivariate data preprocessing submodule, used for imputation of missing values, outlier detection, difference processing, water temperature collinearity compensation and standardization of water quality and precipitation data;

[0020] - Dimensionality reduction and clustering submodule, used to perform dimensionality reduction and clustering, and adapt to the water quality change stage labels and state transition matrices of different river channels;

[0021] b. A two-branch prediction module, including:

[0022] - A physically constrained dissolved oxygen prediction submodule, which embeds the Streeter-Phelps dynamics mechanism, outputs multi-step DO prediction values;

[0023] - The LSTM multivariate prediction submodule is used to collaboratively predict pollution indicators such as ammonia nitrogen, permanganate index, total phosphorus, and total nitrogen, and is used in the dissolved oxygen prediction submodule mentioned above;

[0024] c. Prediction fusion and output module, which integrates the two-branch prediction results to generate a complete water quality index sequence for multiple future time steps;

[0025] d. Water quality stage determination module, which combines the joint prediction results of river water quality with precipitation data and inputs them into the water quality stage classification model constructed by the water quality stage division module to determine the water quality stage classification to which each future prediction time step belongs.

[0026] Furthermore, the system also includes a water quality recovery time calculation module, which receives and calculates the time required for the water quality to move from the current or predicted pollution stage and stabilize in the recovery stage based on the judgment result of the water quality stage determination module.

[0027] Furthermore, the multivariate data preprocessing submodule further integrates a sliding window anomaly detection submodule and an iterative data repair submodule, which are used to realize data segmentation, outlier removal and data interpolation based on precipitation events.

[0028] Furthermore, the dimensionality reduction and clustering submodule includes a testing unit for calculating the significance of the correlation between water quality stages and precipitation events, ensuring that the classified categories are statistically significant with respect to precipitation drivers.

[0029] This invention has the following technical advantages:

[0030] 1. The water quality stage segmentation process can identify several major water quality change stages in the modeled river. By using the water quality change stage segmentation, the pollution stage and recovery stage of the target river can be defined, and the analysis of water quality recovery time can be provided in the subsequent prediction framework.

[0031] 2. The dissolved oxygen prediction adopts a physical constraint method, which uses the dissolved oxygen and pollutant concentration at time t to calculate the dissolved oxygen concentration at time t+1. This method can accelerate the convergence speed of the model during training and improve the interpretability and robustness of the prediction model. Attached Figure Description

[0032] Figure 1 This is a flowchart illustrating the method of the present invention.

[0033] Figure 2 This is a flowchart of the prediction process for a two-branch neural network. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are for illustrative purposes only and do not constitute a limitation thereof.

[0035] like Figure 1 This is a flowchart illustrating the method of the present invention, which specifically includes the following steps:

[0036] 1. Multivariate data preprocessing:

[0037] a) Missing value handling and data splitting:

[0038] In the algorithm implementation process of this invention, it is necessary to first perform missing value analysis and preprocessing on the original water quality monitoring data, specifically including the following steps:

[0039] Missing Pattern Recognition and Preliminary Segmentation:

[0040] The number of missing values ​​for each feature in the statistical time series and the duration of consecutive missing values ​​are determined. If the consecutive missing time exceeds 8 hours, the missing window is used as a data segmentation point to divide the original time series data into multiple consecutive valid data segments; if the consecutive missing time does not exceed 8 hours, the missing window is imputed using time linear interpolation.

[0041] Outlier detection and iterative imputation:

[0042] Outlier detection was performed on each segment of the interpolated time-series data. To accommodate the inherent seasonal fluctuations in river water quality data (such as increased dissolved oxygen due to low winter temperatures and ammonia nitrogen changes caused by algal growth in summer), this invention employs a dynamic sliding window based on precipitation event cycles for local outlier identification, rather than applying a uniform threshold to all data. Specifically, precipitation event cycles are defined according to the standard for precipitation events—that is, any two rainfall events with an interval exceeding 8 hours are considered different precipitation events. Statistical analysis shows that the average duration of a single precipitation event and its subsequent drought event is 8 days (corresponding to 48 4-hour sampling points), therefore, a sliding window size of 48 samples is set. Within this window, outliers that significantly deviate from the normal range are identified and removed using a combination of box plots and the 3σ criterion.

[0043] Data integrity restoration:

[0044] After removing outliers, the above interpolation process is repeated for newly generated missing positions, forming a closed-loop processing mechanism of "segmentation → detection → interpolation → detection → re-interpolation" to ensure that the final output data segment has high integrity and reliability.

[0045] b) Data deperiodicity and standardization:

[0046] After obtaining complete and clean segmented time series data, perform the following feature engineering steps:

[0047] De-periodic processing:

[0048] Because water quality data exhibits significant periodicity in both the long and short term, it is necessary to avoid errors in the model caused by large differences in data across different time periods. To address this, this invention employs a differential method to remove data differences caused by long and short periods. For each valid data segment, the 4-hour variation of each water quality characteristic (such as COD, NH3-N, DO, etc.) between adjacent time points is calculated, generating a differential feature sequence to capture the short-term dynamic trends of water quality parameters.

[0049] Eliminating the effects of temperature collinearity:

[0050] Because some water quality indicators (such as dissolved oxygen and total phosphorus) are significantly affected by water temperature and exhibit a certain linear correlation, this invention performs water temperature collinearity compensation processing on the relevant features to further eliminate the influence of collinearity. Specifically, the method involves establishing an empirical fitting relationship (such as a multinomial regression model) between the target features and water temperature based on historical observation data. This model is then used to predict the expected value at the current water temperature, and the water temperature contribution term is subtracted from the measured values ​​to obtain the water temperature-de-differential features. This eliminates the interference of water temperature on the data and improves the comparability and causal explanatory power of the features.

[0051] Data standardization processing:

[0052] All difference features (including those after temperature correction) are standardized using z-scores to remove the influence of dimensions and distribution, ensuring the effectiveness of subsequent clustering and other operations.

[0053] 2. Dimensionality reduction and unsupervised clustering:

[0054] a) Perform principal component analysis (PCA) on the pre-processed water quality change matrix to reduce data dimensionality and extract highly identifiable latent feature structures.

[0055] Specifically, the standardized difference feature data are used to construct an N×M matrix. The eigenvectors corresponding to the two principal components with the highest variance explanation are selected as the projection basis, mapping the original high-dimensional feature space to a two-dimensional principal component space, resulting in a dimensionality-reduced sequence of principal component eigenvectors. This significantly reduces computational complexity while preserving the dominant change patterns in the dynamic evolution of water quality.

[0056] b) Based on the principal component feature vectors, hierarchical clustering is used to initially group the time series samples. Ward's minimum variance method is selected as the distance metric, and clusters that minimize the increase in the sum of squared deviations within each cluster are merged stepwise to achieve a sensitive partitioning of the data distribution structure.

[0057] During the clustering process, the cluster structure formed by each merging operation is recorded. To avoid category redundancy that reduces physical interpretability, ANOVA tests are performed on the rainfall characteristics among the clustering results while keeping the number of clusters as small as possible. When the number of clusters is 7, the differences in rainfall characteristics between clusters are significant (p < 0.05), and the differences in water quality characteristics between each cluster are also very significant (p < 0.01), with each cluster corresponding to a unique water quality state category.

[0058] c) Definition of Water Quality Evolution Process Categories

[0059] This invention arranges the water quality state categories, which have no physical meaning, obtained from unsupervised clustering in chronological order, and obtains a state transition matrix between seven categories. By carefully analyzing the specific changes in water quality in each stage, including the relationship between dissolved oxygen and pollutants and the changes in pollutant concentrations themselves, it can be seen that these categories cover the entire process of river water quality changes: from initial water pollution caused by precipitation or human sewage discharge to pollution diffusion, water quality recovery, and natural fluctuations.

[0060] The above sections outline the framework for classifying river water quality change stages. The following section presents the framework for a two-branch water quality prediction model, including data preprocessing and model building.

[0061] 3. Preprocessing of the prediction dataset:

[0062] a) Dataset partitioning for prediction. Based on the rainfall-river water quality change characteristics of a certain city, it was determined that river pollution after rainfall lags approximately 24-72 hours after precipitation. Therefore, based on the data frequency of 4 hours per instance, the model was input with 18 data points, and the 19th data point (72 hours of data) was used to predict the data at the 76th hour for training. Data was partitioned based on missing data points; data segments with fewer than 19 consecutive monitoring points were removed, retaining only segments with 19 or more consecutive monitoring points to ensure data quality.

[0063] b) By performing wavelet denoising analysis on the time series data of different water quality indicators, the most suitable wavelet basis for each water quality indicator is found. Based on the wavelet basis, the most suitable number of decomposition levels is determined, and the water quality indicators are then decomposed and recombined using discrete wavelet decomposition to achieve denoising. Finally, rainfall data is synchronously stitched into the water quality indicator matrix to provide additional data features.

[0064] 4. Downstream multivariate water quality prediction model

[0065] In river water quality prediction, simply predicting the water quality status at the next moment is often insufficient to meet actual management needs; therefore, multi-step (multi-time-step) prediction is necessary. Considering that dissolved oxygen (DO) is a key indicator reflecting river water quality, and its concentration level has a significant impact on water environment management and decision-making, it is urgent to adopt modeling methods with higher prediction accuracy and stronger robustness for its dedicated prediction. Simultaneously, multi-step prediction requires the coordinated prediction of multiple water quality indicators, including dissolved oxygen. To balance model performance and modeling efficiency, this paper divides the overall water quality prediction model into two parts:

[0066] a) Physically guided dissolved oxygen prediction model

[0067] In constructing the dissolved oxygen prediction model, this invention introduces the reoxygenation-oxygen consumption dynamics mechanism of dissolved oxygen in water as a physical constraint. This mechanism is based on the basic principles of water quality dynamics and believes that the change in dissolved oxygen concentration in the river is mainly determined by two types of processes: one is the oxygen consumption process, including dissolved oxygen consumption caused by organic matter degradation, sediment oxygen consumption, and biological respiration; the other is the reoxygenation process, namely, atmospheric oxygen diffuses into the water through the gas-liquid interface and oxygen is replenished by the photosynthesis of aquatic plants.

[0068] The above process can be described by classic Streeter-Phelps equations or their improved forms, the core of which is expressed as:

[0069]

[0070] in Let be the dissolved oxygen concentration at time t; Let be the dissolved oxygen concentration at time t+1; Let be the change in dissolved oxygen concentration from time t to time t+1. This can be divided into three parts: reoxygenation, pollutant oxygen consumption, and other oxygen-producing and consuming components (including biological oxygen production and consumption, sediment, and other difficult-to-quantify components). The specific expression is as follows:

[0071]

[0072] in This is the saturated dissolved oxygen concentration, which can be calculated using the water temperature. The fitting was performed, and the fitting result is as follows:

[0073]

[0074] In the above formula, the unit of water temperature is ℃, the unit of saturated dissolved oxygen concentration is mg / L, and the coefficients in the formula have implicitly included unit conversions. The unit of the calculation result is uniformly mg / L.

[0075] Furthermore, The oxygen-consuming portion needs to be determined based on the pollutant concentration in the river, therefore Some parts can be further disassembled, as detailed below:

[0076]

[0077] Finally, the prediction formula of the neural network is:

[0078]

[0079] The final actual output parameters of the neural network:

[0080]

[0081] Where: DO next Dissolved oxygen concentration at time t+1, DO current L2: Dissolved oxygen concentration at time t; L2: Reoxygenation coefficient. Permanganate index, oxygen consumption coefficient Ammonia nitrogen oxygen consumption coefficient, Total phosphorus oxygen demand coefficient Total nitrogen oxygen demand coefficient Permanganate index concentration Ammonia nitrogen concentration Total phosphorus concentration Total nitrogen concentration; Other factors contribute to oxygen production and consumption, representing the increase or decrease in oxygen levels excluding pollutants. The net change in dissolved oxygen is calculated by integrating the effects of non-target pollutant transformation processes such as photosynthesis (oxygen production from chlorophyll, etc.), respiration, and sediment interactions. When the overall effect of these processes is oxygen production in the water body, It is a positive value; when the overall effect is oxygen consumption from the water body, It is a negative value. The oxygen consumption coefficient of potassium permanganate corresponds to the oxygen consumption rate of the permanganate index. It represents the rate at which organic matter easily oxidized by potassium permanganate (mainly some soluble organic matter, ferrous salts, nitrites, etc.) consumes dissolved oxygen. The total phosphorus oxygen consumption coefficient and the total nitrogen oxygen consumption coefficient are the comprehensive influence coefficients of total phosphorus and total nitrogen on the change of dissolved oxygen, respectively.

[0082] In this invention, the aforementioned reoxygenation-oxygen consumption mechanism is embedded in the structural design of the data-driven model, serving as prior physical knowledge to constrain the model output. For example, by constructing a physical consistency loss term or designing a neural network module with a differential equation structure, the model follows the physical laws governing the dynamic changes of dissolved oxygen during training and prediction, thereby significantly improving the physical interpretability, robustness, and long-term multi-step prediction accuracy of the prediction results.

[0083] b) Prediction models for indicators other than dissolved oxygen

[0084] For water quality indicators other than dissolved oxygen (such as ammonia nitrogen, permanganate index, and total phosphorus), this invention employs a Long Short-Term Memory (LSTM) network as its multi-step prediction model. LSTM has excellent temporal modeling capabilities, effectively capturing short-term dynamic changes and historical dependencies in water quality data. Furthermore, its training process converges quickly, and its parameter optimization is highly efficient, making it suitable for auxiliary indicator prediction tasks that require moderate prediction accuracy while also considering computational efficiency. This model runs in parallel with the aforementioned physics-guided dissolved oxygen prediction model, together forming a complete multivariate, multi-step water quality prediction system. A typical two-branch neural network prediction flowchart is shown below. Figure 2As shown in the figure, this diagram illustrates a two-branch neural network architecture that integrates data-driven modeling and physical mechanism constraints to achieve multi-step collaborative prediction of dissolved oxygen (DO) and other pollutants in river water. Its core innovation lies in embedding a Streeter-Phelps type reoxygenation-oxygen consumption kinetic equation into the prediction model, and learning and outputting key physical parameters—the reoxygenation coefficient and the oxygen consumption coefficients of various pollutants—through the neural network structure. This ensures that the prediction accuracy conforms to the laws of water quality dynamics. The input is a sequence of multivariate water quality indicators at the current time t, including total phosphorus (TP), total nitrogen (TN), ammonia nitrogen (NH3), and other key pollutant indicators (represented by yellow squares). These indicators constitute a representation vector of the water pollution state, serving as the initial input to the neural network to capture the fundamental characteristics of dynamic changes in water quality. The first branch is an LSTM multivariate prediction branch. The input data is processed by a Long Short-Term Memory (LSTM) network to learn the evolution pattern of water quality indicators over time. The LSTM output is the hidden state feature vector at the next time step T=t+1, containing the time dependence information of each pollutant concentration, which serves as the basis for subsequent physical formulas. (Pollutant concentration) Input. The second branch is the physically constrained dissolved oxygen prediction branch, which takes the current DO value as input and processes it through a multilayer perceptron structure: including a linear layer for feature transformation, batch normalization to accelerate convergence and improve robustness, and a ReLU+Dropout+Sigmoid combined activation function (where ReLU is a modified linear activation function, Dropout is random deactivation, and Sigmoid is a sigmoid activation function) to introduce nonlinearity and prevent overfitting. Subsequently, the output of this branch, together with the temporal features of the LSTM branch, is substituted into the physical formula:

[0085]

[0086] During the training phase, this branch outputs the reoxygenation coefficient and the oxygen consumption coefficients of various pollutants. These coefficients are not preset constants, but are jointly learned by the neural network through backpropagation, and their learning process is constrained by physical formulas. During the prediction phase, these coefficients, as learned fixed parameters, are substituted into the physical formula along with the pollutant concentrations output by the LSTM, and the final output is the predicted dissolved oxygen value for the next time step.

[0087] As described above, this invention provides a water quality stage segmentation framework that integrates rainfall data. This framework considers the periodic temporal characteristics of the water quality data itself, the correlation between water quality indicators, and the integrity and continuity of the data. It uses mathematical methods for deperiodicization, dimensionality reduction, and clustering, and obtains water quality stages reflecting the characteristics of the river itself through the relationship between rainfall and river water quality. Furthermore, this framework can reflect the regular characteristics of river water quality changes. These characteristics can be used to predict river pollution and recovery time. This invention also provides a two-branch, multi-step prediction method for river water quality, the core of which lies in employing a high-precision modeling strategy guided by physical mechanisms for the key water quality indicator—dissolved oxygen (DO). Specifically, when constructing the dissolved oxygen prediction model, for the first time, based on the Streeter-Phelps type equation, the reoxygenation-oxygen consumption kinetic mechanism of dissolved oxygen in water is introduced as a physical constraint to enhance the interpretability and predictive robustness of the model.

[0088] Example 1: A Method for Classifying and Predicting Water Quality Changes Based on Time-Series Data

[0089] This embodiment uses water quality monitoring data from a river section in a certain city from April 2022 to July 2024 as a sample to specifically illustrate the water quality change process classification and prediction method of the present invention.

[0090] First, raw time-series water quality data from the river cross-section were acquired. Data features included basic water quality parameters (water temperature, pH, dissolved oxygen), pollutant indicators (permanganate index, ammonia nitrogen, total phosphorus, total nitrogen), physical indicators (conductivity, turbidity), environmental factors (rainfall), and monitoring timestamps, constructing a multidimensional time-series data matrix. Temporal continuity segmentation was performed on the data matrix: when the time interval between adjacent monitoring points exceeded 8 hours, the data was segmented into independent data segments. Missing value processing was performed on each data segment, using linear interpolation to fill single missing values; when consecutive missing values ​​exceeded 8 hours, data segmentation was performed. First-order temporal differencing was performed on the segmented data segments to obtain the time-difference sequence of water quality parameters. Principal component analysis (PCA) was performed on the difference sequences for dimensionality reduction, calculating the covariance matrix and extracting principal components with a cumulative variance contribution rate ≥80%, generating a dimensionality-reduced feature matrix. Hierarchical clustering analysis was performed based on the feature matrix. A classification scheme was output when there were significant differences in rainfall between categories, combined with rainfall data. Cluster labels and intra-cluster centers were output, resulting in a label sequence containing seven water quality processes. A state transition matrix was established based on the temporal relationship between categories. Data analysis was used to determine which stage of "initial water pollution - pollution diffusion - water quality recovery - natural fluctuation" these categories belonged to, for subsequent prediction of whether water quality would recover. Wavelet decomposition analysis was performed on indicators including dissolved oxygen, COD, manganese, ammonia nitrogen, total nitrogen, and total phosphorus. "Bior1.5" was found to be the most suitable wavelet basis function, and the optimal decomposition level was three layers. After noise reduction, the 4-hour rainfall data at the corresponding time points were synchronously stitched below the water quality feature matrix. The final model input data was fed into a 6-layer neural network with the following neuron counts: [512, 256, 128, 64, 32]. Each layer was followed by a BatchNormalization layer, a ReLU activation function, and a Dropout layer (Dropout rate 0.2). The mean squared error (MSE) loss function was used, and the Adam optimizer (initial learning rate 0.001) was employed. A plateauing strategy based on the validation loss was used to dynamically adjust the learning rate. The number of iterations was set to 80, the test set ratio to 0.4, and an early stopping mechanism was implemented (training terminated if the validation loss showed no improvement after 5 consecutive iterations). This constructed the dissolved oxygen prediction model. For other water quality indicators, an LSTM encoder scheme was used for prediction: the LSTM network contained 5 hidden layers with 64 hidden units per layer, a batch processing strategy, and a Dropout rate of 0.2. The output layer contained two linear layers and a ReLU activation layer, enabling simultaneous prediction of multiple indicators. The model was trained using the Adam optimizer (initial learning rate 0.001). A multi-step prediction method is adopted, which involves concatenating the single-step output of the model into the original input data as a new input to the model in order to obtain the output of the next step.Finally, the multi-step output results are spliced ​​together with the rainfall data and input into the water quality stage classification framework to determine whether the river has entered the steady-state fluctuation stage, and finally output the river water quality recovery time.

[0091] Experimental results show that the average absolute error of dissolved oxygen prediction in this embodiment is 0.2612 mg / L, the root mean square error is 0.3986, and the average relative error of other water quality indicators is 9.88%, verifying the effectiveness and accuracy of the method of the present invention in the classification and prediction of water quality change processes. Furthermore, it can accurately output the river water quality recovery time.

Claims

1. A method for predicting river water quality changes based on water quality change stage division and physical guidance prediction, characterized in that, Includes the following steps: S1, Water quality change stage division: The original water quality monitoring data and precipitation data are preprocessed together to extract the differential features of water quality parameters and perform water temperature collinearity compensation to form a standardized differential feature sequence. Based on the differential feature sequence, multiple water quality state categories are obtained by dimensionality reduction through principal component analysis and clustering. The multiple water quality state categories are arranged in chronological order to construct a state transition matrix. The state transition matrix is ​​analyzed to identify water quality change patterns driven by precipitation, and the water quality evolution process is divided into multiple water quality stage classification models from pollution to restoration. S2, Dual-branch prediction: Based on a preset prediction step size, data segments that meet the requirements of continuous monitoring are divided. Wavelet denoising is performed on the time series of different water quality indicators to construct the input features required for the prediction model. The denoised data is then input into the prediction model to achieve multi-variable, multi-step joint prediction of river water quality. Specifically, a physical mechanism-guided prediction model is used for dissolved oxygen, embedding the Streeter-Phelps type reoxygenation-oxygen consumption kinetic equation into a neural network structure to output the reoxygenation coefficient and the oxygen consumption coefficient of various pollutants, and to calculate the dissolved oxygen concentration at the next moment. For other water quality indicators besides dissolved oxygen, a long short-term memory network is used for multi-step collaborative prediction. S3. Combine the joint prediction results of river water quality with precipitation data and input them into the water quality stage classification model divided in step S1 to determine the water quality stage classification to which each prediction time step belongs.

2. The method according to claim 1, characterized in that, After determining the water quality stage category to which each predicted time step belongs, the time required for the water quality to move from the current or predicted pollution stage to the recovery stage is calculated.

3. The method according to claim 1, characterized in that, The collaborative preprocessing includes: dividing the data into segments based on rainfall events; using a sliding window for data cleaning within each segment; combining box plots and the 3σ criterion to detect and remove outliers within the window; and restoring data integrity through a closed-loop mechanism of "interpolation → detection → re-interpolation".

4. The method according to claim 1, characterized in that, The water quality stages include: initial pollution stage, pollution diffusion stage, water quality recovery stage, and natural fluctuation stage. Each water quality stage category is significantly correlated with precipitation events.

5. The method according to claim 1, characterized in that, In the prediction model guided by the physical mechanism, ΔDO is expressed as: Where ΔDO is the change in dissolved oxygen concentration from time t to time t+1, L2 is the reoxygenation coefficient, and DO sat DO is the saturated dissolved oxygen concentration. current K is the dissolved oxygen concentration at time t. i Let C be the oxygen consumption coefficient of the i-th pollutant. i The current concentration of the i-th pollutant, which includes at least permanganate index, ammonia nitrogen, total phosphorus, and total nitrogen; Oxygen consumption for non-target pollutants represents the net change in dissolved oxygen caused by the conversion process of non-target pollutants. During the training phase of the neural network, a physical consistency loss function is introduced to constrain the physical parameters of its output to conform to the laws of water quality dynamics.

6. The method according to claim 1, characterized in that, The clustering is hierarchical clustering and / or spectral clustering.

7. A river water quality change prediction system for implementing the method according to any one of claims 1-6, characterized in that, include: a. Water quality stage classification module, including: - Multivariate data preprocessing submodule, used for imputation of missing values, outlier detection, difference processing, water temperature collinearity compensation and standardization of water quality and precipitation data; - Dimensionality reduction and clustering submodule, used to perform dimensionality reduction and clustering, and adapt to the water quality change stage labels and state transition matrices of different river channels; b. A two-branch prediction module, including: - A physically constrained dissolved oxygen prediction submodule, which embeds the Streeter-Phelps dynamics mechanism, outputs multi-step dissolved oxygen prediction values; - The LSTM multivariate prediction submodule is used to synergistically predict pollution indicators such as ammonia nitrogen, permanganate index, total phosphorus, and total nitrogen, and is used in the above-mentioned dissolved oxygen prediction submodule; c. Prediction fusion and output module, which integrates the prediction results of the two branches to generate a complete water quality index sequence for multiple future time steps; d. Water quality stage determination module, which combines the joint prediction results of river water quality with precipitation data and inputs them into the water quality stage classification model constructed by the water quality stage division module to determine the water quality stage classification to which each future prediction time step belongs.

8. The system according to claim 7, characterized in that, The system also includes a water quality recovery time calculation module, which receives and calculates the time required for the water quality to move from the current or predicted pollution stage and stabilize in the recovery stage based on the judgment result of the water quality stage determination module.

9. The system according to claim 7, characterized in that, The multivariate data preprocessing submodule further integrates a sliding window anomaly detection submodule and an iterative data repair submodule, which are used to realize data segmentation, outlier removal and data interpolation based on precipitation events.

10. The system according to claim 7, characterized in that, The dimensionality reduction and clustering submodule includes a test unit for calculating the significance of the correlation between water quality stages and precipitation events, ensuring that the classified categories are statistically significant with respect to precipitation drivers.

Citation Information

Patent Citations

  • Drainage basin pollution load distribution bilevel decision optimization method based on pollution tax

    CN104899668A

  • Multi-source data fusion and analysis method for remote sensing monitoring of rivers and lakes

    CN119848780A