Complex river network water quality real-time prediction and early warning method for upstream pollution burst event

By using a dynamic bidirectional graph neural network model to model the water quality of river networks in a spatiotemporal manner, the problems of high data requirements and low prediction accuracy of traditional models in complex river network systems are solved, and efficient and accurate prediction and early warning of pollutant migration and diffusion are achieved.

CN122333941APending Publication Date: 2026-07-03GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG UNIV OF TECH
Filing Date
2026-01-09
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Traditional water quality prediction models are difficult to accurately reflect the nonlinear migration and instantaneous diffusion of pollutants in complex river network systems, and they have high data requirements, making it difficult to meet the needs of rapid prediction and early warning.

Method used

A dynamic bidirectional graph neural network model is adopted, which combines water quality time series and structural data from river network monitoring points. Spatiotemporal modeling is performed using self-attention layers, LSTM modules, and bidirectional graph convolutional layers to predict the migration and diffusion of pollutants in the river network.

Benefits of technology

It enables efficient and accurate water quality prediction and early warning for complex river network systems, reduces reliance on basic data, and is applicable to diverse river network scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122333941A_ABST
    Figure CN122333941A_ABST
Patent Text Reader

Abstract

This invention relates to the field of water environment monitoring, early warning, and management technology, and discloses a method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events. The method includes the following steps: acquiring and preprocessing time-series water quality data for the river network area; analyzing the spatial structure of the river network and constructing input data for a graph neural network; training a dynamic bidirectional graph neural network model; generating predicted water quality results based on the trained dynamic bidirectional graph neural network model; and determining the prediction results and establishing an early warning mechanism. By transforming river network monitoring points into graph nodes and river connectivity into graph edges, and combining this with a dynamic bidirectional graph neural network to perform spatiotemporal modeling of river network water quality, this method can systematically depict the migration and diffusion patterns of pollutants in complex river networks, accurately reflect the evolution of water quality across the entire network after a pollution event, thereby improving the comprehensiveness and accuracy of water quality prediction in complex river networks and solving the problem that traditional models struggle to cover multi-node and multi-tributary collaborative prediction.
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, early warning and management technology, specifically to a method for real-time prediction and early warning of water quality in complex river networks in response to sudden upstream pollution events. Background Technology

[0002] Currently, water quality monitoring and prediction in water environment management typically rely on data from fixed monitoring points and manual analysis for long-term analysis of water conditions or development of management plans. However, when sudden pollution events occur upstream (such as industrial leaks, accidental discharges, or pollution input due to natural disasters), pollutants can rapidly spread through the river network. Influenced by factors such as tributary confluence, complex river network structure, and hydrodynamic changes, water quality at multiple nodes and tributaries in the middle and lower reaches can fluctuate drastically within a short period. Traditional water quality prediction models based on single monitoring stations lack a systematic consideration of the entire river network structure and hydraulic connectivity, and therefore struggle to accurately reflect the overall water quality diffusion and evolution process of the river network after a pollution event.

[0003] To more comprehensively simulate the migration, diffusion, and transformation processes of pollutants, traditional research often employs process models to simulate and predict water quality in rivers or watersheds. These models are theoretically based on physical mechanisms and can simultaneously consider hydrodynamic, hydrochemical, pollutant migration, mixing, and decomposition processes. However, in practical applications, these models have significant limitations: Firstly, they require extremely high-quality input data—detailed information on river network topography, hydrodynamics, hydrology, pollution source emissions, and water quality response parameters. For river network systems with complex structures, diverse pollution sources, or sudden pollution events, this data is often difficult to obtain comprehensively or maintain continuously. Secondly, when river network structures are complex, hydrodynamics are unstable, water quality processes are diverse, and influenced by tides or sudden inputs, process models struggle to accurately depict the nonlinear migration and instantaneous diffusion of pollutants, significantly reducing their simulation accuracy and stability. Furthermore, these models are typically computationally complex and time-consuming, especially when applied to large-scale complex river network systems, thus failing to meet the need for rapid prediction and early warning of the entire river network after a pollution outbreak.

[0004] Therefore, for river network systems with complex network structures, numerous tributaries, intricate hydrodynamics and connectivity, and the potential for sudden pollution inputs, traditional monitoring and process modeling methods struggle to reliably and timely provide comprehensive river network water quality early warnings and short-term forecasts. Consequently, a new method is urgently needed that can achieve short-term water quality forecasts and early warnings for the entire river network after a pollution event, relying solely on existing monitoring point water quality time series and river network structure data, to meet emergency response and management needs. Summary of the Invention

[0005] This invention provides the following technical solution: a method for real-time prediction and early warning of water quality in complex river networks facing sudden upstream pollution events, comprising the following steps:

[0006] S1. Obtain and preprocess water quality time series data for the river network area.

[0007] S2. Analysis of River Network Spatial Structure and Construction of Input Data for Graph Neural Network.

[0008] S3, Training of Dynamic Bidirectional Graph Neural Network Model.

[0009] S4. Generate predicted water quality results based on the trained dynamic bidirectional graph neural network model.

[0010] S5. Prediction result judgment and early warning mechanism.

[0011] Preferably, step S1 specifically includes:

[0012] S11. Collect water quality data from various water quality monitoring stations within the river network. The water quality data includes, but is not limited to, conventional online monitoring indicators such as water temperature, pH value, dissolved oxygen, permanganate, ammonia nitrogen, total phosphorus, and total nitrogen.

[0013] S12. Use the standardized score Z-score method to identify missing values ​​and outliers in the monitoring data. The Z-score method subtracts the mean and divides by the standard deviation to make the data conform to a standard normal distribution. Missing values ​​include cases where the data collected by the monitoring station is empty, and outliers include cases where the data collected by the monitoring station is not numerical.

[0014] Preferably, step S2 specifically includes:

[0015] S21. Analysis of the spatial structure of the river network.

[0016] S211. Node identification and geolocation: Mark the latitude and longitude coordinates of each water quality monitoring point obtained in step S1 on the digital river network map, and use these points as "nodes" in the graph model.

[0017] S212. Edge connection relationship judgment: Based on the actual waterway connection structure of the river network, determine whether there is a direct river connection between any two monitoring points. If the two monitoring points are hydraulically interconnected through the river, then establish an "edge" for them in the graph model.

[0018] S213. Edge weight setting: For each graph edge, the edge weight is set according to the actual attributes of the river. The edge weight can be determined based on the geographical straight-line distance of the monitoring point, the width of the river, the slope, the actual length of the river, and the hydrodynamic connectivity.

[0019] S22. Construction of graph neural network input data: After obtaining the topology of the river network and the time series data of the monitoring points in step S21, the input of the graph neural network model is constructed, including node features, edge features and adjacency matrix.

[0020] Preferably, step S22 specifically includes:

[0021] S221. Determining the Node Set: Based on the river network topology constructed in step S2, all monitoring points and necessary topological nodes in the river network are included in the node set. If only monitoring points are modeled in the river network structure, the node set consists of all water quality monitoring points. Each node is assigned a unique number to form a node index table, which serves as the node identifier for the graph model.

[0022] S222. Based on the node set obtained in step S221 and the water quality time series data corresponding to each node, construct a node feature matrix for dynamic graph neural network.

[0023] Preferably, step S3 specifically includes:

[0024] S31. Model input preparation: The model input includes the water quality sequence features and adjacency matrix of each node within the sliding time window.

[0025] S32, Training of dynamic bidirectional graph neural network model.

[0026] Preferably, step S32 specifically includes:

[0027] S321. Spatial and temporal feature extraction: Node features are first processed through a self-attention layer. The self-attention mechanism realizes information interaction between nodes by calculating the similarity matrix between nodes.

[0028] S322. Prediction Generation: Spatial Features H of Bidirectional Convolution Output space Through linear mapping Y=H space ·W p +b p Mapping to the target water quality parameter dimension generates the predicted water quality value for the next time step.

[0029] S323. Loss function calculation: The deviation between the model prediction and the actual observation is calculated using mean square error (MSE) or root mean square error (RMSE).

[0030] S324. During training, each batch of training samples is input into the model, which then passes through the self-attention layer, LSTM module, and bidirectional graph convolutional layer to generate the prediction output. The loss is then calculated and the gradient is backpropagated and the parameters are updated through the optimizer.

[0031] Preferably, step S4 specifically includes:

[0032] S41. Construction of input data after a sudden pollution incident: Immediately after the incident, obtain the latest water quality observation value from all existing monitoring points and splice it with the time series data of the previous time period to form 20 time steps, forming new node feature inputs.

[0033] S42. Use the trained model to perform prediction. Feed the above input data into the trained dynamic graph neural network model and perform forward inference operation.

[0034] S43. Save the water quality prediction results and organize the prediction results output by the model into a three-dimensional data table or array format of "node - water quality parameter - prediction time".

[0035] Preferably, step S5 specifically includes:

[0036] S51. Set water quality early warning thresholds, set corresponding safety limits based on the water quality standards of the target pollutant indicators, and further set early warning thresholds.

[0037] S52. Determine the threshold for the predicted sequence by comparing the predicted water quality sequence for multiple future time steps obtained in step S4 with the warning threshold point by point.

[0038] S53. Analyze changes in pollution trends and conduct trend analysis on predicted sequences, including patterns of rapid concentration increases, continuous deterioration, high-level exceedances, or short-term peaks.

[0039] S54. Generate early warning information: Based on risk assessment and trend analysis results, automatically generate early warning content for each monitoring point.

[0040] Compared with existing technologies, this invention provides a method for real-time prediction and early warning of water quality in complex river networks in response to sudden upstream pollution events, and has the following beneficial effects:

[0041] 1. This method for real-time prediction and early warning of water quality in complex river networks in response to sudden upstream pollution events transforms river network monitoring points into graph nodes and river connectivity into graph edges. By combining dynamic bidirectional graph neural networks to perform spatiotemporal modeling of river network water quality, it can systematically depict the migration and diffusion patterns of pollutants in complex river networks and accurately reflect the evolution of water quality across the entire network after a pollution event. This improves the comprehensiveness and accuracy of water quality prediction in complex river networks and solves the problem that traditional models are unable to cover multi-node and multi-tributary collaborative prediction.

[0042] 2. This method for real-time prediction and early warning of water quality in complex river networks facing sudden upstream pollution events can achieve efficient prediction by relying on existing water quality time series data and river network structure data from existing monitoring points. It does not require the collection of additional complex physical parameters, thus solving the pain point of difficulty in obtaining or continuously maintaining basic data in complex river network systems. This not only lowers the application threshold of the method, but also makes it suitable for various river network scenarios with complex structures and diverse pollution sources.

[0043] 3. This method for real-time prediction and early warning of water quality in complex river networks facing sudden upstream pollution events uses a dynamic bidirectional graph neural network architecture consisting of a self-attention layer, an LSTM module, and a bidirectional graph convolutional layer. The self-attention layer can accurately capture the global dependencies between nodes, the LSTM module can effectively mine the temporal evolution of water quality, and the bidirectional graph convolutional layer can simultaneously characterize the node dependencies in the bidirectional water flow directions such as high tide and low tide. The three work together to achieve deep fusion of spatiotemporal features. Attached Figure Description

[0044] Figure 1 This is a schematic diagram of the process structure of the present invention;

[0045] Figure 2 This is a schematic diagram of the river network topology of the present invention;

[0046] Figure 3 This is a schematic diagram of the node feature matrix construction process of the present invention;

[0047] Figure 4 This is a schematic diagram of the framework structure of the dynamic bidirectional graph neural network model of the present invention;

[0048] Figure 5 This is a diagram showing the predicted effect of water quality at the nodes in this invention.

[0049] Figure 6 This is a comparison diagram of the results of each node in this invention under the conditions of no sudden pollution event and with a sudden pollution event. Detailed Implementation

[0050] 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.

[0051] Please see Figure 1-6 This invention provides a technical solution: a method for real-time prediction and early warning of water quality in complex river networks facing sudden upstream pollution events, comprising the following steps:

[0052] S1. Obtain and preprocess water quality time series data for the river network area.

[0053] S11. Collect water quality data from various water quality monitoring stations within the river network. The water quality data are conventional online monitoring indicators, including water temperature, pH value, dissolved oxygen, permanganate, ammonia nitrogen, total phosphorus, and total nitrogen. In this embodiment, daily total phosphorus and total nitrogen data at 1014 time steps from 22 online monitoring nodes were collected.

[0054] S12. The Z-score method is used to identify missing and outlier values ​​in the monitoring data. The Z-score method involves subtracting the mean and dividing by the standard deviation to ensure the data conforms to a standard normal distribution. Missing values ​​include cases where the data collected by the monitoring station is empty, and outliers include cases where the data collected by the monitoring station is not numerical. The Z-score formula is as follows:

[0055]

[0056] Where X represents the data value of a certain indicator in the water quality data at a certain time, μ represents the average value of the indicator, σ represents the standard deviation of the dataset, and Z represents the degree of difference between the data at a certain time and the overall dataset. In this embodiment, Z is 3.5. Z values ​​higher than 3.5 are considered outliers and are processed using linear interpolation. Based on this, the water quality time series data (all monitoring indicators) of each monitoring point are preprocessed: First, each water quality monitoring indicator is standardized and normalized to eliminate the differences in dimensions and magnitudes between different indicators, ensuring that the indicators are comparable during subsequent graph neural network training and that training is not unstable or biased towards a particular indicator due to scale differences. Common practices include linearly scaling all sample values ​​of a certain indicator to the [0,1] interval using Min–Max, or standardizing it with Z-score to have a mean and unit standard deviation.

[0057] S2. Analysis of River Network Spatial Structure and Construction of Input Data for Graph Neural Network.

[0058] Each water quality monitoring point is considered as a node in the graph, and the edges between nodes are determined based on the connectivity of the river channels in the river network. For any two monitoring points that are directly connected hydraulically in the river channel, a corresponding graph edge is established, and a weight is assigned to this edge.

[0059] Edge weights can be set based on the actual attributes of the river channel, including but not limited to indicators such as the geographical straight-line distance between monitoring stations, river width, river slope, and river length. In a preferred example of this implementation, to simplify the model construction process, the geographical straight-line distance between two connected monitoring points is used as the edge weight.

[0060] S21. Analysis of the spatial structure of the river network.

[0061] S211. Node identification and geolocation: Mark the latitude and longitude coordinates of each water quality monitoring point obtained in step S1 on the digital river network map, and use these points as "nodes" in the graph model.

[0062] S212. Edge connection relationship judgment: Based on the actual waterway connection structure of the river network, determine whether there is a direct river connection between any two monitoring points. If the two monitoring points are hydraulically interconnected through the river, then establish an "edge" for them in the graph model.

[0063] S213. Edge weight setting: For each graph edge, an edge weight is set according to the actual attributes of the river channel. The edge weight can be determined based on the geographical straight-line distance between monitoring points, river channel width, slope, actual river channel length, and hydrodynamic connectivity. In this embodiment, the geographical straight-line distance between two connected monitoring points is used as the edge weight.

[0064] like Figure 2 As shown, the topological relationships and corresponding edge features are used as input features to construct a graph topology network that preserves the original spatial distribution features of the watershed stations.

[0065] S22. Construction of graph neural network input data: After obtaining the topology of the river network and the time series data of the monitoring points in step S21, the input of the graph neural network model is constructed, including node features, edge features and adjacency matrix.

[0066] S221. Determining the Node Set: Based on the river network topology constructed in step S2, all monitoring points and necessary topological nodes in the river network are included in the node set. If only monitoring points are modeled in the river network structure, the node set consists of all water quality monitoring points. Each node is assigned a unique number to form a node index table, which serves as the node identifier for the graph model.

[0067] If it is necessary to represent the river structure, key locations in the river (such as river mouths, bifurcation points, and tidal influence boundaries) can be selected as topological nodes.

[0068] S222. Based on the node set obtained in step S221 and the water quality time series data corresponding to each node, construct a node feature matrix for dynamic graph neural network.

[0069] This step uses a sliding time window to segment the original time series to form the model input sequence, see... Figure 3 As shown.

[0070] S2221. Raw Time Series Data Processing: For node i, read the time series of water quality parameters obtained from continuous monitoring:

[0071]

[0072] Where T represents the total time series length; x i,t This represents the water quality observation value of node i at time t (which may include multiple water quality features); the feature dimension is defined as F (e.g., temperature, pH, TN, TP).

[0073] S2222. Sliding Time Window Dividing of Time Series Data: To enable the graph neural network to simultaneously learn the temporal dependence of water quality, the time series of each node is divided using a sliding window with a fixed length of 20 time steps, and the window step size is 1. Each window is defined as W. i,k :

[0074]

[0075] Where k=1,2,…,T-20, each window contains water quality characteristic data for 20 consecutive time steps.

[0076] S2223, Prediction Target Alignment (20→1 Prediction Method): For each window W i,k The corresponding prediction target is defined as the water quality parameter at the 21st time step following the window (i.e., the next time step):

[0077]

[0078] Thus, a standard 20→1 time series prediction task is formed, with 20 steps of historical water quality data as the input sequence and 21 steps of future water quality data as the output sequence.

[0079] S2224. Organizing the Node Feature Matrix: Stack all the node input sequences after sliding window processing according to the node dimension to form the node feature tensor of the graph neural network.

[0080]

[0081] Where N represents the number of nodes, 20 is the length of the input time window (in this embodiment), and F is the water quality feature dimension for each time step.

[0082] The corresponding prediction target tensor is:

[0083]

[0084] Used to perform supervised learning in step S3.

[0085] S223, Adjacency matrix construction.

[0086] Based on the river network topology and node numbers obtained in S31, an adjacency matrix is ​​constructed that preserves the original spatial distribution characteristics of the stations. In this embodiment, the mathematical expression of the adjacency matrix can be represented as:

[0087]

[0088] Where A represents the adjacency matrix, in the embodiment d i,j This represents the straight-line distance between nodes.

[0089] S3, Training of Dynamic Bidirectional Graph Neural Network Model.

[0090] Based on the node feature matrix and graph structure obtained in step S2, a dynamic graph neural network model is constructed to perform spatiotemporal modeling of river network water quality, enabling the model to simultaneously learn the propagation patterns of water quality parameters in the time dimension and river network topology.

[0091] S31. Model Input Preparation: The model input includes the water quality sequence features and adjacency matrix of each node within the sliding time window. The node feature matrix is ​​derived from the sliding time window data constructed in step S2224. Each node contains water quality parameters for 20 consecutive time steps, forming the input tensor. Graph topology information includes the adjacency matrix or edge index, as well as edge weight information such as channel length, width, slope, or geographical distance between nodes, to enhance the physical rationality of spatial modeling. Training data is divided into training, validation, and test sets in chronological order to ensure temporal non-overlap for subsequent model training and evaluation.

[0092] S32, Training of the Dynamic Bidirectional Graph Neural Network Model. See the overall model framework for details. Figure 4 As shown.

[0093] S321. Spatial and Temporal Feature Extraction: Node features are first processed through a self-attention layer to characterize the global dependencies between nodes. The self-attention mechanism realizes information exchange between nodes by calculating the similarity matrix between nodes. Its calculation expression can be represented as:

[0094]

[0095] Where, q i =W Q x i k j =W K x j These are the query vector and the key vector, α. ij This represents the attention weight between node i and node j, enabling the model to effectively capture key pollution sources and their potential associations with the affected nodes.

[0096] Subsequently, the node features output from the self-attention module are input into the LSTM module to capture the dynamic evolution of node water quality parameters over time, generating the temporal hidden state of each node. Finally, the hidden state of the last time step output by the LSTM is combined with the adjacency matrix to perform bidirectional graph convolution. The forward convolution is used to characterize the node dependencies in the downstream (ebb tide) direction, and the backward convolution is used to characterize the node dependencies in the upstream (bump tide) direction. The forward and backward features output by the bidirectional graph convolution are concatenated along the feature dimension to form the final spatial feature representation. In specific implementations, the concatenation method can be a simple connection, or a gating mechanism or other fusion method can be used to weight / dynamically fuse the features in both directions, thereby enhancing the model's adaptability and expressive ability to tidal-driven bidirectional propagation. This representation includes temporal evolution information. In this embodiment, a simple concatenation method is used for merging.

[0097] S322. Prediction Generation: Spatial Features H of Bidirectional Convolution Output space Through linear mapping Y=H space ·W p +b p Mapping to the target water quality parameter dimension generates the predicted water quality value for the next time step. Since the concentrations of total phosphorus and total nitrogen are to be predicted in this example, the water quality parameter dimension in this embodiment is 2. Simultaneously, the self-attention weight α... ij It can be output for subsequent pollution source tracing analysis to provide interpretive information on key nodes and pollution propagation paths within the river network.

[0098] S323. Loss Function Calculation: The deviation between the model's predicted values ​​and the actual observed values ​​is calculated using the mean squared error (MSE) or root mean square error (RMSE). Taking MSE as an example, its formula is as follows:

[0099]

[0100] At the same time, regularization strategies, including Dropout and L2 weight decay, can be introduced to prevent model overfitting and improve training robustness.

[0101] S324. During training, each batch of training samples is input into the model, which then passes through the self-attention layer, LSTM module, and bidirectional graph convolutional layer to generate the prediction output. The loss is then calculated and the gradient is backpropagated and the parameters are updated through the optimizer.

[0102] Gradient clipping and learning rate schedulers can be used during training to improve training stability.

[0103] The loss is evaluated on the validation set. If the error fails to improve after several consecutive validation rounds, an early stopping strategy is implemented, and the model parameters from the last round are saved for subsequent water quality prediction and early warning. The prediction performance of the trained model on the water quality of a node in the river network is shown in [link to relevant documentation]. Figure 5 As shown.

[0104] S4. Generate predicted water quality results based on the trained dynamic bidirectional graph neural network model.

[0105] After completing the training phase, i.e., obtaining the weights of the trained dynamic graph neural network model, the following operations can be performed to generate future river network water quality predictions. Assume that a sudden upstream pollution event occurs at time t0, meaning there is a significant input of pollutants at several upstream monitoring points or pollution sources. To quickly assess its impact on the future water quality of all monitoring points in the entire river network, the following operations should be performed.

[0106] S41. Construction of input data after a sudden pollution incident: Immediately after the incident, obtain the latest water quality observation value from all existing monitoring points and splice it with the time series data of the previous time period to form 20 time steps, forming new node feature inputs.

[0107] Immediately after the event, the most recent (water quality) observations are obtained from all existing monitoring points and concatenated with the time series data from the previous time period (e.g., the most recent 19 observation time steps) to form a new 20-time-step input, creating node feature inputs. Node features include the pre-pollution state and the latest post-pollution observations to ensure that the model input reflects the immediate impact of the sudden pollution input on the system. Meanwhile, the graph structure (nodes / edges / edge weights) remains unchanged, still using the previously constructed river network topology.

[0108] S42. Use the trained model to perform prediction. Feed the above input data into the trained dynamic graph neural network model and perform forward inference operation.

[0109] The model sequentially performs spatiotemporal fusion and propagation of features from each node through a self-attention module, a time-series module, and a bidirectional graph convolution module. Finally, the model outputs the estimated water quality index for each node at the first predicted time step t0+δ (and optionally, the next k−1 steps). , where i is the node index. t0 is the last time point of the input, and δ represents the prediction time interval. In this embodiment, δ=1, then the next time step is predicted (next hour, next day, next month, depending on the data time scale).

[0110] S43. Save the water quality prediction results. Organize the model output prediction results into a three-dimensional data table or array format of "node - water quality parameter - prediction time". This facilitates further analysis and early warning judgment. For multi-step predictions, the prediction results of each time step can be arranged in chronological order to form a future water quality evolution trend curve.

[0111] In practical applications, the prediction results can be provided to water environment management departments or emergency response systems to determine the water quality change trends at various monitoring points in the river network over a future period, thereby enabling the implementation of preventive, monitoring, or water intake control measures in advance. If the model is designed for batch inference, it can also perform parallel predictions for multiple pollution scenarios (such as different upstream pollution input intensities, different tidal conditions, different boundary weight settings, etc.) to assist in risk assessment and decision support.

[0112] In this embodiment, it is assumed that... Figure 2 A sudden pollution event occurred at node 1, causing its TN concentration to increase to 200% of its original level. The comparison results for each node under conditions of no sudden pollution event and with a sudden pollution event are shown below. Figure 6 As shown.

[0113] S5. Prediction result judgment and early warning mechanism.

[0114] This step, based on the water quality prediction results obtained in step S4 for multiple future time steps, determines the risk status of each monitoring point in the river network and establishes an automated early warning mechanism, including the following sub-steps:

[0115] S51. Set water quality early warning thresholds, set corresponding safety limits based on the water quality standards of the target pollutant indicators, and further set early warning thresholds.

[0116] The safety threshold can be derived from the limits for various pollution indicators (such as pH, dissolved oxygen, ammonia nitrogen, COD, total phosphorus / total nitrogen, etc.) in relevant national or local water environmental quality standards (e.g., Surface Water Environmental Quality Standard (GB 3838-2002)). It can also be set with stricter or more lenient thresholds based on factors such as the regional water body's ecological carrying capacity, water body usage function, water intake or protection needs.

[0117] S52. Determine the threshold for the predicted sequence by comparing the predicted water quality sequence for multiple future time steps obtained in step S4 with the warning threshold point by point.

[0118] When the concentration value at any predicted time point exceeds the safety limit or approaches the early warning threshold, the corresponding monitoring point is determined to have a short-term pollution risk. For multiple consecutive times the concentration value approaches or exceeds the threshold, it is further marked as a sustained pollution risk.

[0119] S53. Analyze changes in pollution trends and conduct trend analysis on predicted sequences, including patterns of rapid concentration increases, continuous deterioration, high-level exceedances, or short-term peaks.

[0120] If a significant upward trend or abnormal linkage of multiple parameters is detected, the risk level of the monitoring point will be further increased to enhance the sensitivity and timeliness of the early warning.

[0121] S54. Generate early warning information: Based on risk assessment and trend analysis results, automatically generate early warning content for each monitoring point, including: predicted time of exceeding the standard, magnitude of exceeding the standard, risk level, possible scope of impact, and corresponding response suggestions. This early warning information can be classified according to preset rules, such as general early warning, key attention early warning, or emergency early warning.

[0122] 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 real-time prediction and early warning of water quality in complex river networks in response to sudden upstream pollution events, characterized in that: Includes the following steps: S1. Acquire and preprocess time-series water quality data for the river network area; S2. Analysis of river network spatial structure and construction of graph neural network input data; S3, Dynamic Bidirectional Graph Neural Network Model Training; S4. Generate predicted water quality results based on the trained dynamic bidirectional graph neural network model; S5. Prediction result judgment and early warning mechanism.

2. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 1, characterized in that, Step S1 specifically includes: S11. Collect water quality data from various water quality monitoring stations within the river network. The water quality data are conventional online monitoring indicators, including water temperature, pH value, dissolved oxygen, permanganate, ammonia nitrogen, total phosphorus, and total nitrogen. S12. Use the standardized score Z-score method to identify missing values ​​and outliers in the monitoring data. The Z-score method subtracts the mean and divides by the standard deviation to make the data conform to a standard normal distribution. Missing values ​​include cases where the data collected by the monitoring station is empty, and outliers include cases where the data collected by the monitoring station is not numerical.

3. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 1, characterized in that, Step S2 specifically includes: S21. Analysis of the spatial structure of the river network; S211, Node identification and geolocation: Mark the latitude and longitude coordinates of each water quality monitoring point obtained in step S1 on the digital river network map, and use these points as "nodes" in the graph model; S212. Edge connection relationship judgment: Based on the actual waterway connection structure of the river network, determine whether there is a direct river connection between any two monitoring points. If the two monitoring points are hydraulically interconnected through the river, then create an "edge" for them in the graph model. S213. Edge weight setting: For each graph edge, the edge weight is set according to the actual attributes of the river. The edge weight can be determined based on the geographical straight-line distance of the monitoring point, the width of the river, the slope, the actual length of the river, and the hydrodynamic connectivity. S22. Construction of graph neural network input data: After obtaining the topology of the river network and the time series data of the monitoring points in step S21, the input of the graph neural network model is constructed, including node features, edge features and adjacency matrix.

4. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 3, characterized in that, Step S22 specifically includes: S221. Determining the Node Set: Based on the river network topology constructed in step S2, all monitoring points and necessary topological nodes in the river network are included in the node set. If only monitoring points are modeled in the river network structure, the node set consists of all water quality monitoring points. A unique number is assigned to each node to form a node index table, which serves as the node identifier for the graph model. S222. Based on the node set obtained in step S221 and the water quality time series data corresponding to each node, construct a node feature matrix for dynamic graph neural network.

5. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 1, characterized in that, Step S3 specifically includes: S31. Model input preparation: The model input includes the water quality sequence features and adjacency matrix of each node within the sliding time window. S32, Training of dynamic bidirectional graph neural network model.

6. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 5, characterized in that, Step S32 specifically includes: S321. Spatial and temporal feature extraction: Node features are first processed through a self-attention layer. The self-attention mechanism realizes information interaction between nodes by calculating the similarity matrix between nodes. S322. Prediction Generation: Spatial Features H of Bidirectional Convolution Output space Through linear mapping Y=H space ·W p +b p Mapping to the target water quality parameter dimension generates the predicted water quality value for the next time step; S323. Loss function calculation: The deviation between the model prediction and the actual observation is calculated using mean square error (MSE) or root mean square error (RMSE). S324. During training, each batch of training samples is input into the model, which then passes through the self-attention layer, LSTM module, and bidirectional graph convolutional layer to generate the prediction output. The loss is then calculated and the gradient is backpropagated and the parameters are updated through the optimizer.

7. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 1, characterized in that, Step S4 specifically includes: S41. Construction of input data after a sudden pollution incident: Immediately after the incident, obtain the latest water quality observation value from all existing monitoring points and splice it with the time series data of the previous time period to form 20 time steps, forming new node feature inputs. S42. Use the trained model to perform prediction. Feed the above input data into the trained dynamic graph neural network model and perform forward inference operation. S43. Save the water quality prediction results and organize the prediction results output by the model into a three-dimensional data table or array format of "node - water quality parameter - prediction time".

8. The method for real-time prediction and early warning of water quality in complex river networks for upstream sudden pollution events as described in claim 1, characterized in that, Step S5 specifically includes: S51. Set water quality early warning thresholds, set corresponding safety limits based on the water quality standards of the target pollutant indicators, and further set early warning thresholds. S52. Determine the threshold for the predicted sequence by comparing the predicted water quality sequence for multiple future time steps obtained in step S4 with the warning threshold point by point. S53. Analyze changes in pollution trends and conduct trend analysis on predicted sequences, including patterns of rapid concentration increases, continuous deterioration, high-level exceedances, or short-term peaks. S54. Generate early warning information: Based on risk assessment and trend analysis results, automatically generate early warning content for each monitoring point.