A city bay water quality prediction method based on a heterogeneous spatio-temporal graph neural network
By constructing watershed subgraphs and river bend subgraphs using heterogeneous spatiotemporal graph neural networks, and combining multi-source data with spatiotemporal representation learning, the accuracy and reliability issues of urban river bend water quality prediction in existing technologies have been resolved, achieving efficient water quality prediction and risk warning.
Patent Information
- Application Number
- CN202611570573.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-12
- Publication Date
- 2026-11-20
AI Technical Summary
Existing methods for predicting water quality in urban river bends are insufficient in terms of accuracy and reliability, making it difficult to meet the needs of risk warning. In particular, they are time-consuming to calculate when performing long-term, full-area, and multi-scenario simulations, and they are difficult to effectively model spatiotemporal coupling and complex inter-site dependencies.
A heterogeneous spatiotemporal graph neural network-based approach is adopted. By constructing watershed subgraphs and river bend subgraphs, multi-source spatiotemporal data is preprocessed, and spatiotemporal representation learning is performed by combining gated temporal convolutional networks and graph convolutional networks to achieve the prediction of urban river bend water quality.
It improves the timeliness and accuracy of urban river bend water quality forecasting, enabling rolling simulations of multiple spatial nodes and longer forecast periods in a short time, thus meeting the needs of risk warning.
Smart Images

Figure CN123138680A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of urban environmental monitoring technology, specifically to a method for predicting urban river bend water quality based on heterogeneous spatiotemporal graph neural networks. Background Technology
[0002] Urban river bends are complex aquatic environments comprised of urban catchments, drainage networks, rivers, and bays. Their hydrodynamics and water quality changes are simultaneously influenced by multiple factors, including rainfall runoff, drainage system overflows, wastewater treatment plant discharges, tributary inflows, tidal exchange, offshore boundaries, and sediment release. To identify water quality exceeding risks in advance, it is necessary to simultaneously describe the processes of land-based pollution generation, drainage system transport, river transport, and bay diffusion within a unified technical framework, and to complete rolling simulations of multiple spatial nodes and longer forecast periods within a short timeframe.
[0003] The following two methods are mainly used for predicting the hydrodynamics and water quality of urban river bends:
[0004] 1. Mechanism model.
[0005] Based on water balance, momentum conservation, pollutant migration and diffusion, and biochemical reaction equations, continuous simulations are performed on runoff generation and collection in catchment areas, drainage network transport, river and bay hydrodynamics, sedimentation, and water quality changes. For example, stormwater flood management models can be used to construct urban rainfall runoff and overflow models of river interception and drainage systems, while environmental fluid dynamics models can be used to construct river and bay hydrodynamics, sedimentation, and water quality models. This type of method has strong process interpretation capabilities and can generate simulation results that span the entire space and are continuous over time.
[0006] 2. Artificial intelligence model.
[0007] By utilizing traditional machine learning and temporal deep learning methods, combined with historical water quality, rainfall, flow, water level, and meteorological data, models such as random forests, support vector machines, long short-term memory networks, or temporal convolutional networks are trained to predict the future state of a single monitoring point or a small number of monitoring points. These methods can automatically extract complex features through multi-layered neural networks, making them particularly suitable for highly coupled and dynamically changing river bend systems. Furthermore, the AI models offer fast computation speeds, meeting the needs of river bend water quality management.
[0008] However, mechanistic models require a large number of topographic, pipeline, boundary, and water quality parameters, resulting in high model calibration and maintenance costs, and lengthy computation times when conducting long-term, full-region, and multi-scenario simulations. For artificial intelligence models, firstly, there is a lack of integrated AI models covering the entire process of catchment areas, pipelines, rivers, and bays, making it difficult to learn the complete chain of pollution generation from land to bay response within the same network; secondly, different types of hydraulic units have different physical effects, and structures such as weirs and orifices have threshold opening and closing, directional control, and nonlinear flow characteristics, which ordinary homogeneous models tend to average with the response patterns of ordinary drainage nodes; thirdly, pipeline topology is relatively fixed, while effective spatial connections in bays vary with rainfall, runoff, and tidal conditions, making it difficult to characterize non-local and time-varying propagation relationships using only fixed distances or fixed topologies. Furthermore, the suitable temporal resolution differs between watersheds and bays, and using a uniform step size can lead to excessive computational load or loss of key process information. All of these factors contribute to the relatively poor performance of existing deep learning-based water quality forecasting models for bays, making it difficult to meet the needs of risk warning.
[0009] Furthermore, given the significant spatiotemporal coupling of watershed water quality, upstream pollutants propagate downstream with the water flow, and the water quality of adjacent water bodies exhibits spatial correlation. The aforementioned methods struggle to effectively model such complex inter-site dependencies, resulting in predictions that fail to reflect the overall dynamic changes of the watershed system, thus limiting their effectiveness in practical applications such as pollution source tracing and early warning dissemination. Summary of the Invention
[0010] The main technical problem addressed in this application is how to improve the accuracy and reliability of water quality prediction for urban river bends.
[0011] According to the first aspect, one embodiment provides a method for predicting urban river bend water quality based on heterogeneous spatiotemporal graph neural networks, including:
[0012] Real-time acquisition of multi-source spatiotemporal data of urban river bends; the multi-source spatiotemporal data includes meteorological data, drainage system data, historical status data, exogenous driving forces and pollution source data;
[0013] The multi-source spatiotemporal data is preprocessed; the preprocessing includes resampling, time alignment, unifying units and / or unifying dimensions of the multi-source spatiotemporal data at different time frequencies, and marking or correcting missing values, outliers, sensor drift and elevation benchmark deviation;
[0014] Watershed sub-maps and river bend sub-maps are constructed based on the drainage system topology, river-bay spatial relationships, and pollution source input locations of urban river bends. The watershed sub-map uses the water flow confluence points of the drainage system and different hydraulic structures as nodes. The river bend sub-map uses river confluence points, bay confluence points, open boundary confluence points, and sewage treatment plant confluence points as nodes. The watershed sub-map connects nodes according to the drainage system network relationship, with each node having a unique unidirectional water flow convergence relationship. The river bend sub-map connects nodes according to their proximity, with each node having a bidirectional water flow convergence relationship. The nodes at the final water flow outlet in the watershed sub-map correspond to the nodes in the river bend sub-map that flow into a river or river bend.
[0015] The multi-source spatiotemporal data is matched to the nodes in the watershed subgraph and the river bend subgraph to obtain the node matching data for each node.
[0016] The node identifiers and corresponding node matching data of each node are input into a preset watershed spatiotemporal graph neural network prediction module, and the watershed prediction sub-graph for any future time is obtained from the preset future time output by the watershed spatiotemporal graph neural network prediction module; each node of the watershed prediction sub-graph corresponds to the watershed sub-graph according to the node identifier, and the node prediction data of each node of the watershed prediction sub-graph is generated by the watershed spatiotemporal graph neural network prediction module based on the historical state data, which is used to identify the estimated value of the node matching data of each node of the watershed sub-graph at a future time;
[0017] By using a cross-scale mapping operator, the node prediction data of the nodes at the final outlet of the water flow in the watershed prediction sub-map are aggregated in time and projected in space. The results of the time aggregation and spatial projection are written into the corresponding receiving nodes of the river bend sub-map to obtain the river bend prediction sub-map for the corresponding preset future time.
[0018] The predicted river bend sub-map is input into a preset river bend spatiotemporal map neural network prediction module, and the urban river bend water quality prediction data, which identifies the hydrodynamic and water quality states of each river and / or bay, is obtained from the output of the river bend spatiotemporal map neural network prediction module. The river bend spatiotemporal map neural network prediction module applies a spatiotemporal representation learning model for the river bend sub-map to predict the hydrodynamic and water quality states of the rivers and / or bays. This spatiotemporal representation learning model transforms the original input into a high-dimensional vector representation capable of expressing spatiotemporal coupling characteristics by simultaneously learning the spatial dependencies and temporal evolution patterns in the data through a neural network.
[0019] In one embodiment of the urban river bend water quality prediction data, the meteorological data includes rainfall, temperature, wind speed and / or humidity; the drainage system data includes drainage node elevation, catchment area, pipe network connection, hydraulic structure type and / or outlet location; the exogenous driving and pollution source data includes surface runoff, pipe network overflow, sewage treatment plant effluent, tributary inflow, atmospheric deposition, sediment release, open boundary tide level and / or boundary water quality; and the historical status data includes historical flow, water level, water depth, flow velocity, total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, salinity and / or sediment content data.
[0020] In one embodiment, the types of nodes in the watershed submap and river bend submap include drainage system nodes, hydraulic structure nodes, open boundary nodes, pipeline network nodes, river nodes, and bay nodes; wherein, the open boundary node refers to the interface node between the river bend watershed and the surrounding large water body, the drainage system node includes water catchment nodes, pipeline network nodes, and / or outlet nodes, and the hydraulic structure node includes weir nodes, orifice nodes, and pumping station nodes.
[0021] In one embodiment, the watershed spatiotemporal graph neural network prediction module and the river bend spatiotemporal graph neural network prediction module are constructed based on a heterogeneous spatiotemporal graph neural network. The heterogeneous spatiotemporal graph neural network includes a temporal modeling part and a spatial modeling part. The temporal modeling part adopts a gated temporal convolutional network, and the spatial modeling part adopts a graph convolutional network based on the superposition of adjacency matrices with topological priors and gated adaptive adjacency matrices. The heterogeneous spatiotemporal graph neural network learns multi-level spatiotemporal representations of interactions between different types of environmental subjects to achieve integrated construction of hydrology, hydrodynamics, and water quality of catchment areas, drainage networks, tributaries, main streams, bays, and related water environment areas.
[0022] In one embodiment, the training of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module adopts multi-step autoregressive rolling training, which performs multi-step autoregressive rolling within the sample window and adopts a planned sampling strategy to gradually reduce the ground truth feedback ratio as the training progresses; in the planned sampling strategy, the ground truth feedback probability decreases linearly with the number of training rounds.
[0023] And / or, both the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module are equipped with a hydrodynamic regression head and a water quality regression head. The hydrodynamic regression head is used to predict hydrodynamic variables, and the water quality regression head is used to predict water quality variables. The output of the hydrodynamic regression head serves as the conditional input of the water quality regression head. The hydrodynamic variables include at least one of flow rate and water level, and the water quality variables include at least one of total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, and chemical oxygen demand.
[0024] And / or, the watershed spatiotemporal map neural network prediction module and / or the river bend spatiotemporal map neural network prediction module further include a gated residual network, which is used to adaptively correct the residual characteristics after the master forecast, output a correction term and add it to the master forecast residual.
[0025] In one embodiment, the training of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module includes a pre-training stage and a fine-tuning stage; the pre-training stage uses the output of the mechanistic model as a supervision signal; the fine-tuning stage introduces measured data to add observation supervision terms, while retaining mechanistic supervision and physical constraints; the fine-tuning stage uses a learning rate smaller than that of the pre-training stage, or freezes some spatiotemporal backbone parameters;
[0026] And / or, the training loss function of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module includes concentration non-negativity constraint loss and / or node water quality anomaly rate weighted loss; the concentration non-negativity constraint loss is the sum of squares of the negative values of the predicted concentration; the node water quality anomaly rate weighted loss is weighted according to the water quality anomaly rate of each node to increase the loss weight of water quality anomaly nodes.
[0027] In one embodiment, the river bend spatiotemporal map neural network prediction module includes a water area map model. The water area map model is used to characterize the water flow movement and pollutant transport, diffusion, exchange and reaction processes in the river and / or bay system under the influence of land runoff pollution, sewage treatment plant pollution and open-boundary external pollution in the river bend sub-map, so as to realize the integrated modeling of the urban river bend water system.
[0028] The watershed spatiotemporal graph neural network prediction module includes a watershed graph model, which is used to characterize the water volume and pollutant transport processes from runoff generation and confluence in the catchment area to drainage system nodes and between drainage system nodes under the driving force of land rainfall in the watershed subgraph. In the expression of the watershed graph model, the runoff generation in the catchment area is implicitly represented by the drainage system nodes connected to it, so as to directly predict the runoff generation and confluence in the catchment area and its pollutant input process at these connected nodes using exogenous drivers such as rainfall.
[0029] In one embodiment, the urban river bend water quality prediction method further includes:
[0030] The predicted water quality data of the urban river bend is fed back to the input of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module to perform the prediction for the next time step.
[0031] According to a second aspect, one embodiment provides a computer program product including a program that can be executed by a processor to implement the urban river bend water quality prediction method as described in any embodiment of this application.
[0032] According to a third aspect, one embodiment provides a computer-readable storage medium including a program that can be executed by a processor to implement the urban river bend water quality prediction method as described in any of the embodiments herein.
[0033] The urban river bend water quality prediction method according to the above embodiments greatly improves the timeliness and accuracy of urban river bend water quality prediction by dividing the urban river bend watershed into watershed sub-maps and river bend sub-maps, and using cross-scale mapping operators to perform temporal aggregation and spatial projection of outlet flow, concentration or pollution load for urban river bend water quality prediction. Attached Figure Description
[0034] Figure 1 This is a flowchart illustrating a method for predicting water quality in urban river bends in one embodiment.
[0035] Figure 2 This is a schematic diagram of the structure of the watershed subgraph and the river bend subgraph in one embodiment;
[0036] Figure 3 This is a schematic diagram of a heterogeneous spatiotemporal graph neural network prediction model in one embodiment;
[0037] Figure 4 This is a schematic diagram of the watershed spatiotemporal representation learning layer of a heterogeneous spatiotemporal graph neural network.
[0038] Figure 5 This is a schematic diagram of the river bend spatiotemporal representation learning layer in a heterogeneous spatiotemporal graph neural network;
[0039] Figure 6 This is a diagram illustrating the autoregressive and planned sampling training paradigm in one embodiment.
[0040] Figure 7 This is a functional block diagram of a water quality prediction system in one embodiment. Detailed Implementation
[0041] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of the invention. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, certain operations related to the present invention are not shown or described in the specification. This is to avoid obscuring the core parts of the invention with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0042] Furthermore, the features, operations, or characteristics described in the specification can be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can be rearranged or adjusted in a manner obvious to those skilled in the art. Therefore, the various orders in the specification and drawings are only for the clear description of a particular embodiment and do not imply a necessary order, unless otherwise stated that a particular order must be followed.
[0043] The serial numbers assigned to components in this document, such as "first" and "second," are used only to distinguish the described objects and have no sequential or technical meaning. The terms "connection" and "linkage" used in this invention, unless otherwise specified, include both direct and indirect connections (linkages).
[0044] This application proposes an urban river bend water quality prediction method based on a watershed-river bend cascade and a heterogeneous spatiotemporal graph neural network (EstuarySTGNN model). The method divides the urban river bend watershed into a watershed subgraph and a river bend subgraph. A directed watershed graph is constructed based on the actual connectivity of the drainage system, and a river bend graph is constructed based on spatial proximity, hydrodynamic connectivity, or grid adjacency relationships between rivers and bays. Node type encoding distinguishes drainage system nodes, hydraulic structure nodes, river nodes, bay nodes, wastewater treatment plant input nodes, and open boundary nodes. In one embodiment, the watershed subgraph and river bend subgraph each employ spatiotemporal representation learning modules adapted to their respective process timescales. The watershed subgraph first predicts the future state of the outlet nodes based on historical flow, water quality, and rainfall information. Then, a cross-scale mapping operator is used to perform temporal aggregation and spatial projection of the outlet flow, concentration, or pollution load, writing it into the exogenous driving channel of the corresponding receiving node in the river bend subgraph. The river bend subgraph then combines historical states, tidal boundaries, wastewater treatment plant discharge, and watershed mapping results to predict future hydrodynamic and water quality states.
[0045] Please refer to Figure 1This is a flowchart illustrating a method for predicting urban river bend water quality in one embodiment. The method in this embodiment is based on a heterogeneous spatiotemporal graph neural network and includes:
[0046] Step 101: Obtain multi-source spatiotemporal data.
[0047] Real-time acquisition of multi-source spatiotemporal data of urban river bends, including meteorological data, drainage system data, historical status data, exogenous driving forces, and pollution source data. Meteorological data includes rainfall, temperature, wind speed, and / or humidity; drainage system data includes drainage node elevation, catchment area, pipe network connections, hydraulic structure types, and / or outlet locations; exogenous driving forces and pollution source data include surface runoff, pipe network overflow, wastewater treatment plant effluent, tributary inflow, atmospheric deposition, sediment release, open boundary tide level, and / or boundary water quality; historical status data includes historical flow rate, water level, water depth, flow velocity, total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, salinity, and / or sediment content. In one embodiment, exogenous driving forces and pollution source data include surface runoff, pipe network overflow, wastewater treatment plant effluent, tributary inflow, atmospheric deposition, sediment release, open boundary tide level, and / or boundary water quality.
[0048] Step 102, data preprocessing.
[0049] Multi-source spatiotemporal data undergoes preprocessing, including resampling, time alignment, and unification of units and / or dimensions for data from different time frequencies. Missing values, outliers, sensor drift, and elevation benchmark deviations are then marked or corrected. In one embodiment, coordinates and projections are unified for data from different sources, establishing mapping relationships between monitoring stations, mechanistic model units, and graph nodes. These relationships are determined through actual monitoring data, long-term historical statistical characteristics, or mechanistic model operation and are used as label data for training the heterogeneous spatiotemporal graph neural network and as data required for model operation.
[0050] Step 103: Construct the watershed subgraph and the river bend subgraph.
[0051] Watershed submaps and river bend submaps are constructed based on the drainage system topology, spatial relationships between rivers and bays, and the locations of pollution source inputs in urban river bends. The watershed submap uses the confluence points of drainage system flows and the confluence points of flows from different hydraulic structures as nodes. The river bend submap uses river confluence points, bay confluence points, open boundary confluence points, and sewage treatment plant confluence points as nodes. The watershed submap connects nodes according to the drainage system network relationships, with each node having a unique unidirectional flow convergence relationship. The river bend submap connects nodes based on their proximity, with each node having a bidirectional flow convergence relationship. The nodes at the final water outlet in the watershed submap correspond to the nodes in the river bend submap that flow into a river or river bend.
[0052] Because urban river basin water systems are complex network systems composed of various components such as drainage system nodes (e.g., catchment nodes, pipe network nodes, and outlet nodes), hydraulic structures (e.g., weirs, orifices, and pumping stations), pipe networks, rivers, and bays, the heterogeneous spatiotemporal graph neural network proposed in one embodiment of this application needs to be able to adapt to the characteristics of multiple heterogeneous units coexisting, complex spatial relationships, and significant process non-stationarity in urban river basins. It must be able to uniformly model different types of components and effectively represent their connectivity, attribute differences, and differences in controlling processes. To fully capture the diversity and interactions of different components in urban river basins, the heterogeneous spatiotemporal graph neural network designed in this embodiment combines heterogeneous node modeling techniques and designs a heterogeneous graph structure suitable for urban river basins.
[0053] Please refer to Figure 2 This is a schematic diagram of the structure of a watershed subgraph and a bend subgraph in one embodiment. First, the bend watershed is divided into a watershed subgraph and a bend subgraph. The types of nodes in the watershed subgraph and bend subgraph include drainage system nodes, hydraulic structure nodes, open boundary nodes, pipe network nodes, river nodes, and bay nodes. Open boundary nodes refer to the interface nodes between the bend watershed and the surrounding large water bodies. Drainage system nodes include catchment nodes, pipe network nodes, and / or outlet nodes. Hydraulic structure nodes include weir nodes, orifice nodes, and pump station nodes. The edges of the watershed subgraph and bend subgraph include connection edges between watershed nodes based on drainage system pipe network relationships. Bend nodes are connected by proximity edges. To consider the tidal flow state of the bend, the edges of the bend subgraph are set as bidirectional edges, while the edges of the watershed subgraph are set as unidirectional edges due to limitations such as flap valves and check valves in the pipe network. The graph structure features are divided into target features for simulation and forecasting and exogenous features given by external input or heterogeneous spatiotemporal graph neural networks. The target features of the watershed subgraph include flow rate and concentration of key water quality indicators, while exogenous features include node elevation and rainfall. The target features of the meander subgraph include water depth and concentration of key water quality indicators, while exogenous features include the flow rate and load input from point and area sources corresponding to the nodes, the open boundary tidal level and pollutant concentration corresponding to the nodes, bed elevation, rainfall, atmospheric deposition, and endogenous release. Key water quality indicators refer to commonly used indicators in meander water quality assessment, such as ammonia nitrogen, inorganic nitrogen, reactive phosphate, total phosphorus, chemical oxygen demand, and dissolved oxygen, used to characterize nutrient levels, organic pollution levels, and reoxygenation status of the water body. To distinguish different types of nodes, node type encoding (one-heat encoding) is introduced in the exogenous feature layer to provide conditional information for the nodes, enabling the heterogeneous spatiotemporal graph neural network to learn the differences in responses of different types.
[0054] Step 104: Obtain node matching data.
[0055] Multi-source spatiotemporal data are matched to nodes in the watershed subgraph and river bend subgraph to obtain node matching data for each node.
[0056] Step 105: Obtain the watershed prediction sub-map.
[0057] The node identifiers and corresponding node matching data of each node are input into a preset watershed spatiotemporal graph neural network prediction module, and the watershed prediction sub-graph for any future time is obtained from the output of the watershed spatiotemporal graph neural network prediction module. Each node in the watershed prediction sub-graph corresponds to the watershed sub-graph according to its node identifier. The node prediction data of each node in the watershed prediction sub-graph is generated by the watershed spatiotemporal graph neural network prediction module based on historical state data, and is used to identify the estimated value of the node matching data of each node in the watershed sub-graph at a future time. In one embodiment, the watershed spatiotemporal graph neural network prediction module is constructed based on a heterogeneous spatiotemporal graph neural network. The heterogeneous spatiotemporal graph neural network achieves the integrated construction of hydrology, hydrodynamics and water quality of catchment areas, drainage networks, tributaries, main streams, bays and related water environment areas through multi-level spatiotemporal representation learning of the interactions between different types of environmental subjects.
[0058] Please refer to Figure 3 This is a schematic diagram of a heterogeneous spatiotemporal graph neural network prediction model in one embodiment. In one embodiment, the heterogeneous spatiotemporal graph neural network receives each frame of the watershed prediction subgraph in the form of a time-series snapshot. The instantaneous state of the system at time t is represented as follows:
[0059] Gt=(V,E,Xt);
[0060] Where V represents a node in the graph, E represents an edge in the graph, and Xt contains the node's state variables (such as hydrodynamics and water quality) and exogenous drivers (such as rainfall, boundaries, and point source loads). The watershed subgraph uses rainfall information and information from the past Tin time window to predict the state of the watershed subgraph at the next moment.
[0061] Step 106: Obtain the predicted river bend sub-map.
[0062] A cross-scale mapping operator is used to perform temporal aggregation and spatial projection on the node prediction data of the final outlet node in the watershed prediction submap. The results of temporal aggregation and spatial projection are then written into the corresponding receiving node in the bend submap to obtain the bend prediction submap for the corresponding preset future time. In one embodiment, a cross-scale mapping operator is used to downscale and project the features of the outlet node in the watershed submap onto the driving feature channel of the corresponding node in the bend submap, forming a cascaded coupling. The driving feature channel is described as follows:
[0063] Z = Φ(H; M, A);
[0064] Where Φ(•) represents the cross-scale mapping operator, M represents the summation and aggregation operation on the time scale, and A represents the spatial mapping matrix from the outlet node of the watershed into the bend to the corresponding node of the bend.
[0065] The river bend submap uses open boundary information, point source information, information from the past T'in time window, and information received from the watershed submap to predict the state of the river bend submap at the next moment. This cascaded coupling method can ensure the consistency and interoperability of information at different time granularities, thereby explicitly expressing runoff pollution source terms and characterizing the driving effect of upstream runoff generation and confluence on downstream river bend processes. It should be noted that the watershed submap is mainly used to characterize the water volume and pollutant transport processes from runoff generation and confluence in the catchment area to drainage system nodes and between drainage system nodes under the driving force of land-based rainfall. In the model representation, the catchment area is not explicitly mapped as an independent node, but is implicitly represented through the drainage system nodes connected to it. That is, the runoff generation and confluence processes and pollutant input processes in the catchment area are directly predicted at these connected nodes using exogenous drivers such as rainfall. The river bend submap is mainly used to characterize the water flow movement and pollutant transport, diffusion, exchange, and reaction processes in the river-bay system under the influence of land-based runoff pollution, sewage treatment plant pollution, and open boundary exogenous pollution, thereby realizing the integrated modeling of urban river bend watershed water systems.
[0066] Step 107, Water Quality Prediction.
[0067] The predicted river bend submap is input into a pre-defined river bend spatiotemporal neural network prediction module, and the module outputs urban river bend water quality prediction data identifying the hydrodynamic and water quality states of each river and / or bay. The river bend spatiotemporal neural network prediction module applies a spatiotemporal representation learning model specific to the river bend submap to predict the hydrodynamic and water quality states of rivers and / or bays. This model transforms the original input into a high-dimensional vector representation capable of expressing spatiotemporal coupling characteristics by simultaneously learning spatial dependencies and temporal evolution patterns in the data through a neural network. In one embodiment, the river bend spatiotemporal neural network prediction module is constructed based on a heterogeneous spatiotemporal neural network to explicitly represent runoff pollution source terms in the river bend area, adapting to the multi-task framework of river bend water quality forecasting, source apportionment, and decision support.
[0068] In one embodiment of this application, the river bend watershed is divided into a watershed subgraph Gt and a river bend subgraph G't, and different subgraph learning layers are used to convey the interaction relationships between nodes in different regions. In the watershed subgraph, runoff generation and confluence and pipeline transportation have stronger rapid response characteristics, so they are set to higher temporal resolution spatiotemporal representation learning; in the river bend subgraph, due to the longer propagation path and lag effect of water exchange and transport, they are set to lower temporal resolution representation learning. The purpose of using a heterogeneous spatiotemporal graph neural network is to use information from past watershed and river bend subgraphs, as well as future rainfall-driven, open-boundary-driven, and wastewater treatment plant-driven information, to predict future watershed and river bend subgraph information.
[0069] Step 108: Output the prediction results.
[0070] Output predicted water quality data for urban river bends.
[0071] Step 109, predict state feedback.
[0072] The water quality prediction data of urban river bends is fed back to the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module to perform the prediction of the next time step and complete the multi-step rolling.
[0073] In one embodiment, the heterogeneous spatiotemporal graph neural network includes a temporal modeling part and a spatial modeling part. The temporal modeling part employs a gated temporal convolutional network, while the spatial modeling part employs a graph convolutional network based on a priori adjacency matrix and a gated adaptive adjacency matrix. The heterogeneous spatiotemporal graph neural network learns multi-level spatiotemporal representations of interactions between different types of environmental entities to achieve integrated construction of hydrological, hydrodynamic, and water quality data for catchment areas, drainage networks, tributaries, main streams, bays, and related water environments. In one embodiment, the training of the watershed spatiotemporal graph neural network prediction module and the river bend spatiotemporal graph neural network prediction module employs multi-step autoregressive rolling training. Multi-step autoregressive rolling is performed within a sample window, and a planned sampling strategy is adopted, gradually reducing the ground truth feedback ratio as the training progresses. In the planned sampling strategy, the ground truth feedback probability decreases linearly with the number of training rounds. In one embodiment, both the watershed spatiotemporal map neural network prediction module and the bend spatiotemporal map neural network prediction module are equipped with a hydrodynamic regression head and a water quality regression head. The hydrodynamic regression head is used to predict hydrodynamic variables, and the water quality regression head is used to predict water quality variables. The output of the hydrodynamic regression head serves as the conditional input of the water quality regression head. The hydrodynamic variables include at least one of flow rate and water level, and the water quality variables include at least one of total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, and chemical oxygen demand. In one embodiment, the watershed spatiotemporal map neural network prediction module and / or the bend spatiotemporal map neural network prediction module further include a gated residual network. The gated residual network is used to adaptively correct the residual characteristics after the master forecast, outputting a correction term and adding it to the master forecast residual. In one embodiment, the training of the watershed spatiotemporal map neural network prediction module and the bend spatiotemporal map neural network prediction module includes a pre-training stage and a fine-tuning stage. The pre-training stage uses the output of the mechanistic model as a supervision signal. The fine-tuning stage introduces measured data to add observation supervision terms, while retaining mechanistic supervision and physical constraints. The fine-tuning phase uses a learning rate lower than that used in the pre-training phase, or freezes some of the spatiotemporal backbone parameters. In one embodiment, the training loss function of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module includes a concentration non-negativity constraint loss and / or a node water quality anomaly rate weighted loss. The concentration non-negativity constraint loss is the sum of squares of the negative values of the predicted concentration. The node water quality anomaly rate weighted loss weights the regression loss according to the water quality anomaly rate of each node, increasing the loss weight of nodes with water quality anomalies. In one embodiment, the river bend spatiotemporal map neural network prediction module includes a water area map model. The water area map model is used to characterize the water flow movement and pollutant transport, diffusion, exchange, and reaction processes in the river and / or bay system under the influence of land runoff pollution, sewage treatment plant pollution, and open-boundary external pollution in the river and / or bay submap, so as to achieve integrated modeling of the urban river bend watershed water system.In one embodiment, the watershed spatiotemporal graph neural network prediction module includes a watershed graph model. This model characterizes the water volume and pollutant transport processes driven by land-based rainfall within the watershed subgraph, from runoff generation in the catchment area, to runoff in the drainage system nodes, and between these nodes. Specifically, in the watershed graph model, runoff generation in the catchment area is implicitly represented by the drainage system nodes connected to it, allowing for direct prediction of runoff generation and runoff in the catchment area and its pollutant input processes at these connected nodes using exogenous drivers such as rainfall.
[0074] Please refer to Figure 4 and Figure 5 These figures illustrate the spatiotemporal representation learning layers for watersheds and river bends, respectively, within a heterogeneous spatiotemporal graph neural network. The spatiotemporal representation learning layers in the heterogeneous spatiotemporal graph neural network incorporate techniques such as gated adaptive adjacency matrices, water quality anomaly rate branch weighting, and hydrodynamic regression head driving. The spatiotemporal representation learning layers of the heterogeneous spatiotemporal graph neural network are based on an improvement upon the Graph WaveNet (GWN) spatiotemporal graph neural network. Different spatiotemporal representation learning layers are used for river bends and watersheds to enhance its ability to represent spatiotemporal information of hydrodynamic and water quality processes in river bends. GWN combines temporally dilated causal convolution and spatially graph convolution, demonstrating good performance on various time-series forecasting problems.
[0075] The spatiotemporal representation learning layer for river bends is based on the spatiotemporal map forecasting paradigm of GWN. It introduces a gated weight allocation oriented towards node spatial differences to address the differences in contributions between exogenous drivers (rainfall, tides, etc.) and state variables (such as hydrodynamics and water quality), improving the ability to identify key triggering factors and robustness to river bend signal fluctuation scenarios. Hydrodynamic regression heads are set in both the watershed and river bend submap spatiotemporal representation learning layers, and their output is used as a conditional input for water quality forecasting, explicitly injecting transport capacity information. Simultaneously, residual information is input into a gated residual network (GRN) for correction, enhancing the ability to compensate for nonlinear transformations and local errors. Furthermore, a water quality anomaly rate loss function is designed for the spatiotemporal representation learning layer of the river bend submap to improve the model's learning effect on water quality exceedances, etc.
[0076] Specifically, the temporal modeling part in the spatiotemporal representation learning layer adopts the gated temporal convolutional network (Gated TCN) in GWN, represented as:
[0077] H=g(Θ1X+b1)⊙δ(Θ2X+b2);
[0078] Here, Θ1, b1, Θ2, and b1 correspond to model parameters, the function g(•) is the output activation function, δ(•) represents the output sigmoid function, which is used to determine the proportion of information passed to the next layer, and ⊙ represents element-wise multiplication.
[0079] By introducing a gating mechanism on top of the traditional TCN, long-term dependent information is captured while controlling the transmission of redundant information, thus improving the model's response to sudden events (such as heavy rain and emission fluctuations). Compared to RNN-like structures, TCN has advantages such as strong parallelism and good stability, making it more suitable for multi-source environmental time-series data. By stacking multiple spatiotemporal representation learning layers, the model's ability to represent complex spatiotemporal coupling relationships can be further enhanced, strengthening its ability to capture multi-scale pollution dynamics.
[0080] The spatial modeling part in the spatiotemporal representation learning layer is an improvement on the Adaptive Adjacency Graph Convolutional Network (GCN) in GWN. It adopts a graph convolutional network that superimposes an adjacency matrix based on topological relationship priors and a gated adaptive adjacency matrix, as follows:
[0081] ;
[0082] ;
[0083] Where P = A / rowsum(A) captures the existing spatial dependencies through the adjacency matrix A, while P f and P b are the transition matrices for forward and backward diffusion, respectively. X serves as the input to the GCN layer, and k is the diffusion convolution parameter, representing the number of diffusion steps in the convolution process. It is an adaptive adjacency matrix with two learnable parameters E1 and E2, α, used to capture hidden spatial dependencies. r =σ(g(Rain, Tide)) represents the rainfall and tide-related weights corresponding to the gated adaptive adjacency matrix, W k1 W k2 and W k3 It is the model parameter matrix.
[0084] Topological priors provide structural constraints and interpretability, making them particularly suitable for features with obvious topological structures, such as stormwater outlets and pipe networks, in watershed subgraphs. Gated adaptive adjacency, through end-to-end learning, obtains implicit dependency weights between nodes to characterize the nonlocal influences and asymmetric propagation that may occur in river bends under different hydrodynamic scenarios. This weighting is achieved by using gating coefficients obtained from temporal aggregation of rainfall and tidal sequences. For river bend systems, interactions between nodes may arise from nearest-neighbor exchanges or manifest as runoff transport or tidal-driven long-range associations. These interactions vary with tidal and rainfall conditions; therefore, introducing gated adaptive spatial dependency helps improve the model's ability to characterize complex diffusion paths. After the master forecast, GRN is further introduced to adaptively correct the residual features, outputting a correction term added to the master forecast residual to suppress error accumulation during multi-step rolling extrapolation and enhance the ability to characterize local nonlinearities.
[0085] Please refer to Figure 6 This is an example of an autoregressive and planned sampling training paradigm graph. At the training and application levels, the training objective of the heterogeneous spatiotemporal graph neural network is to learn how to accurately infer the hydrological, hydrodynamic, and water quality status of all nodes in the entire urban river bend area at future times, given known exogenous driving features such as rainfall, point sources, and open boundaries. During the model training phase, to closely resemble the actual extrapolation method in the extrapolation phase, training is performed within each sample window. The self-regressive rolling of the steps. Specifically, it includes:
[0086] Training samples are generated using a sliding window, with the initial state being the historical window. ;
[0087] No. The next step is predicted based on the current window. Among them, X t This includes the target features at time t and the exogenous features at time t+1, while The target characteristics at time t+1.
[0088] The predicted state variables are concatenated with the known exogenous drivers to form the next input frame, and the window is updated by scrolling until completion. step;
[0089] The losses at each step within the window are summed, averaged, and then a backpropagation is performed.
[0090] Because multi-step rolling training can lead to exposure bias due to seeing the true value during training but relying on predictions during rolling inference, planned sampling is introduced to address this issue.
[0091] In the When constructing the next frame input, with probability p ssr Replace the prediction feedback input with the true value to mitigate the rapid accumulation of errors in the early stages of training and enhance robustness.
[0092] p ssr As the number of training rounds decreases, the model gradually transitions from training with stable ground values to actual simulations without ground values.
[0093] During model training, the hydrodynamic subtask is trained first to optimize its multi-step rolling forecasting capability. In water quality forecasting, the hydrodynamic regression head is explicitly used as one of the important inputs, working together with exogenous features such as rainfall, point sources, and open boundaries to drive the model, thereby improving the generalization ability and stability of water quality forecasts under different scenarios. The reason for introducing this mechanism is that changes in river bend water quality are not only determined by pollution load input, but are also strongly regulated by hydrodynamic transport processes. By explicitly introducing the hydrodynamic regression head, the model can first learn relatively stable hydrodynamic evolution patterns, and then use this hydrodynamic background to characterize the transport, dilution, and diffusion processes of pollutants in water quality forecasting, thereby reducing the dependence of data-driven models on correlation features.
[0094] To leverage the process priors of the mechanistic model and the real feedback from monitoring data, a two-stage, multi-source supervision strategy is employed during training. The first training stage aims to endow the heterogeneous spatiotemporal graph neural network with the proxy capability of the mechanistic model; that is, to use the output of the mechanistic model as a global supervision signal, enabling the model to learn the spatiotemporal evolution laws driven by physical mechanisms and develop stable inference capabilities. Mean squared error is used as the loss function for fitting the mechanistic model, expressed as:
[0095] ;
[0096] In addition, to improve the physical consistency and stability of the model, a concentration nonnegativity loss is introduced, defined as:
[0097] ;
[0098] Therefore, the total loss can be expressed as:
[0099] L=L sim +λ bound L bound ;
[0100] Where V is the set of nodes and T is the forecast duration. and y v,t These represent the predicted value and the simulated value of node v at time t, respectively, and λ. bound The weights are the weights of the non-negativity constraints.
[0101] Considering that urban river bend management focuses more on exceeding standards and abnormal conditions, an abnormal water quality classification branch is set up in the river bend water quality simulation to weight samples with high abnormal water quality rates, thereby enhancing the model's ability to identify and predict high-risk scenarios. Therefore, the water quality simulation task includes:
[0102] ;
[0103] ;
[0104] ;
[0105] Among them, C v,t Let C represent the water concentration value of node v at time t, and C... nor,v τ is the average concentration value of node v under normal conditions (drought period), τ is the coefficient for judging abnormal water quality, and α is the control weighting intensity.
[0106] In one embodiment of this application, the heterogeneous spatiotemporal graph neural network, pre-trained using a mechanistic model simulation sample, is used for deduction. However, its performance depends on the performance of the calibrated mechanistic model. Even after calibration, the mechanistic model inevitably contains certain errors, but the data it provides still has strong process consistency and scenario scalability. Furthermore, it can also be fine-tuned using measured data.
[0107] In one embodiment, based on the pre-trained weights of the mechanistic model simulation samples, measured station data is introduced. An observation supervision term is added to the nodes and times with measured data (weak supervision of the mechanistic model labels is applied to the remaining missing locations), thereby correcting for biases in the real system. The observation supervision term is represented as follows:
[0108] ;
[0109] Therefore, the total loss can be expressed as:
[0110] L=λ sim L sim +λ bound L bound +λ obs L obs ;
[0111] in, and Let λ be the predicted value and the actual observed value of node v at time t, respectively. sim and λ obs These are the weights for the mechanistic model fitting loss and the observation fitting loss, respectively.
[0112] It should be noted that the fine-tuning phase involves adjusting the pre-trained parameter weights of the mechanistic model simulation samples, rather than relearning the overall hydrodynamic and water quality patterns of the river bend system. To avoid excessive fine-tuning that could weaken the physical consistency and inference stability established during the pre-training phase, the fine-tuning phase retains mechanistic supervision and physical constraints, and uses small updates with a limited number of rounds, without alternating iterative training.
[0113] In one specific implementation, a mechanistic model can be used to generate samples for training the model. This implementation allows for the replacement of the mechanistic model with a heterogeneous spatiotemporal graphical neural network model, enabling rapid deduction of the mechanistic model of urbanized river bend hydrodynamics and water quality. Specifically, the heterogeneous spatiotemporal graphical neural network model first relies on high-quality simulation data generated by the mechanistic model as label data for support. This mechanistic model needs to be able to cover the entire process of the catchment area, drainage network, river and bay, continuously depicting the evolutionary characteristics of hydrology, hydrodynamics and water quality in all time and space, thus providing a sample foundation with physical consistency and process continuity for the heterogeneous spatiotemporal graphical neural network model, enabling it to learn the main evolutionary laws under complex driving forces, complex boundaries and complex spatial connectivity relationships. Taking a river bend basin in a certain city as the research object, a model of urban rainfall runoff pollution and overflow of the river interception and drainage system was constructed using the SWMM mechanism model. The model includes 452 sub-catchments, 844 drainage system nodes, 916 pipes and canals, 115 weirs, 40 orifices, 29 outlets, and 15 water systems. The city's river, city bend, and part of the Lingdingyang area were generalized into 5382 two-dimensional depth-averaged structured grids using EFDC, and modules for hydrodynamics, sediment, eutrophication, and bottom sediment were configured. Based on the above mechanism model, a heterogeneous spatiotemporal graph neural network model of the city's river bend graph structure was constructed. The watershed subgraph includes 844 drainage system nodes, 115 weir nodes, 40 orifice nodes, and 1094 connecting edges. The river bend subgraph includes 195 river bend nodes, 3 open boundary nodes, 9 sewage treatment plant input nodes, and 306 connecting edges. The watershed submap predicts flow, total nitrogen concentration, and total phosphorus concentration, while the river bend submap predicts water level, total nitrogen concentration, and total phosphorus concentration.
[0114] In this implementation, the watershed submap uses a first temporal resolution for spatiotemporal representation learning, while the river bend submap uses a second temporal resolution, with the first temporal resolution being higher than the second. Specifically, the original temporal resolution of the watershed model's output is 5 minutes, which is then consolidated into a 20-minute step size; the original temporal resolution of the river bend model's output is 1 hour, which is then consolidated into a 3-hour step size. The 20-minute prediction results for the watershed are mapped to the 3-hour driving channel for the river bend after time aggregation. The model's historical input window can be selected from 1.5 to 9 days or more, with a target rolling prediction duration of 7 days, corresponding to 56 3-hour prediction steps for the river bend. Training employs mechanistic label pre-training, multi-step autoregressive rolling, and linear decay plan sampling with an initial probability of 0.5. The code implementation parameters can be set to 32 hidden channels, a learning rate of 0.001, and a random inactivation rate of 0.1; specific parameters can be adjusted according to the region size and prediction task.
[0115] Test results show that the urban river bend simulation can achieve continuous rolling simulation over 7 days. Among nearly a thousand drainage nodes in the watershed, approximately 75% of the nodes have a flow determination coefficient R² higher than 0.70, and approximately 50% of the nodes have an R² higher than 0.90. The average R² of the river bend hydrodynamic test set reaches approximately 0.99, and the median R² of the total nitrogen and total phosphorus water quality test sets is higher than 0.80. Compared with the mechanistic model, the proposed heterogeneous spatiotemporal graph neural network model achieves approximately 142 times and 102 times speedup in hydrodynamic and water quality simulations, respectively. The results of the ablation experiments show that after explicitly representing the weir and orifice and identifying them with the characteristic layer node type, the median R² of total nitrogen and total phosphorus in the watershed increased to about 0.83, and the average R² of total nitrogen and total phosphorus in the bend reached about 0.90 and 0.83, respectively. The hybrid graph convolution that integrates topological priors and scenario-conditional dynamic adaptive adjacency is better than using only a single fixed topology or a single adaptive graph structure. The node water quality anomaly rate weighting can improve the detection and discrimination of exceedance events, while the overall R² decrease is relatively small.
[0116] In another implementation, this application can fine-tune the model using actual monitoring data after pre-training the mechanistic model with full-space data. For nodes and times with observed data, the supervised loss between predicted and observed values is calculated. For locations without observations, weak supervision with mechanistic labels and physical constraints are retained. A smaller learning rate, fewer training rounds, or freezing of some spatiotemporal backbone parameters are used to avoid excessively disrupting the process consistency and long-term rolling stability formed during the pre-training phase. This implementation is suitable for river bends where the mechanistic model has certain systematic biases but some monitoring data has been accumulated in the region. Taking a river bend in a city as the research object, after pre-training the mechanistic model with training samples, supervised fine-tuning using measured water quality data resulted in a decrease in the MAPE of total nitrogen and total phosphorus at the river mouth of a city from 15.7% and 23.3% to 10.5% and 18.3%, respectively, compared to before fine-tuning. Simultaneously, the fluctuation amplitude and local undulation characterization more closely resembled the measured sequence. In the extrapolation test of unsupervised bay locations, supervising only high-frequency estuary locations can constrain short-term fluctuations but still has cross-regional mean bias; supervising only multiple weekly river locations can improve the mean level but is prone to mean-averaging and is difficult to constrain high-frequency peaks; while joint supervision of high-frequency estuary locations and weekly river locations can simultaneously supplement temporal resolution and spatial coverage, reducing the total phosphorus MAPE of multiple bay locations to 16%.
[0117] As described above, the heterogeneous spatiotemporal graph neural network disclosed in this application, in terms of spatial modeling, simultaneously uses a topological prior adjacency matrix constructed based on real topology or spatial proximity relationships, and an adaptive adjacency matrix generated by learnable node embeddings. It also utilizes tidal and rainfall scenarios to generate a node-by-node gating matrix and dynamically recalibrates the adaptive adjacency matrix. This allows the model to learn non-local and asymmetric spatial connections that may occur under different rainfall, tidal, and runoff conditions while preserving physical connections and propagation directions. In terms of temporal modeling, it employs gated dilated causal convolution to extract multi-scale historical information and uses a gated residual structure to fuse update branches and residual branches in each spatiotemporal representation learning layer to suppress noise propagation and improve the stability of deep training.
[0118] The heterogeneous spatiotemporal graph neural network disclosed in this application sets up a hydrodynamic regression head and a water quality regression head in terms of output and training. It first predicts hydrodynamic variables such as flow rate and water level, and then passes the hydrodynamic prediction results as conditional input to the water quality regression head, enabling water quality prediction to explicitly utilize the transport, dilution, and diffusion capabilities of pollutants. The model is pre-trained using continuous spatiotemporal data generated by a calibrated and validated mechanistic model. It performs multi-step autoregressive rolling within a sample window, feeding back the predicted state together with the known exogenous drivers for the next time step. Planned sampling, which gradually reduces the proportion of truth feedback as training progresses, is used to reduce the difference between the training and deployment phases. Simultaneously, the model incorporates concentration non-negativity constraints and node water quality anomaly rate weighting on the regression loss, improving long-term rolling stability and the ability to identify abnormal and exceeding processes.
[0119] The urban river bend water quality prediction method disclosed in this application, based on heterogeneous spatiotemporal graph neural networks, significantly improves the timeliness and accuracy of urban river bend water quality prediction by dividing the urban river bend watershed into watershed subgraphs and river bend subgraphs, and utilizing cross-scale mapping operators to perform temporal aggregation and spatial projection of outlet flow, concentration, or pollution load for urban river bend water quality prediction. Furthermore, it enables integrated and rapid extrapolation of hydrodynamic and water quality processes in catchment areas, pipe networks, rivers, and bays within a unified artificial intelligence model, and significantly reduces the time cost of conducting long-term, multi-node, and multi-scenario simulations.
[0120] Please refer to Figure 7The diagram below illustrates the functional structure of a water quality prediction system in one embodiment. This application also provides a water quality prediction system based on a heterogeneous spatiotemporal graph neural network. This system includes a graph construction module 1, an encoding module 2, a watershed spatiotemporal graph neural network prediction module 3, a cross-scale mapping module 4, a river bend spatiotemporal graph neural network prediction module 5, and a gating module 6. The graph construction module 1 is used to construct watershed subgraphs and river bend subgraphs. The watershed subgraph contains a first type of node, and the river bend subgraph contains a second type of node. The first and second types of nodes have different node types. The first type of nodes includes drainage system nodes and hydraulic structure nodes, with hydraulic structure nodes including weir nodes and orifice nodes. The second type of nodes includes river nodes, bay nodes, open boundary nodes, and pollution source input nodes, with pollution source input nodes including wastewater treatment plant input nodes. The encoding module 2 is used to set node type identifiers for each node, fusing the node type identifiers with the node state and exogenous drivers as model input. The node type identifiers can be one-hot encoded or learned type embedding. The watershed spatiotemporal graph neural network prediction module 3 is used to predict the future state of nodes in the watershed subgraph based on historical data, and uses a first time resolution for spatiotemporal representation learning. The river bend spatiotemporal graph neural network prediction module 5 is used to predict the future state of nodes in the river bend subgraph based on historical data, exogenous drivers, and mapping results from the watershed subgraph, and uses a second time resolution for spatiotemporal representation learning. The first time resolution is higher than the second time resolution. Edges in the watershed subgraph are set as unidirectional edges, and edges in the river bend subgraph are set as bidirectional edges. The cross-scale mapping module 4 includes a temporal aggregation unit and a spatial mapping unit. The temporal aggregation unit is used to perform summation and aggregation operations on the time scale, and the spatial mapping unit is used to realize the spatial mapping from the watershed exit node to the corresponding node in the river bend. The watershed spatiotemporal graph neural network prediction module and the river bend spatiotemporal graph neural network prediction module each contain a spatial modeling unit and a temporal modeling unit. The spatial modeling unit uses a combination of topological prior adjacency matrix and adaptive adjacency matrix for graph convolution, and the temporal modeling unit uses a gated temporal convolutional network to control the transmission of redundant information through a gating mechanism. Gating module 6 is used to generate gating coefficients based on external scenario conditions to dynamically recalibrate the adaptive adjacency matrix. These external scenario conditions include rainfall and tidal data, and the gating coefficients are obtained by time aggregation of rainfall and tidal sequences. The topological prior adjacency matrix of the watershed subgraph is constructed based on the drainage system network connections; the topological prior adjacency matrix of the river bend subgraph is constructed based on spatial proximity or hydrodynamic connectivity. The watershed spatiotemporal graph neural network prediction module and the river bend spatiotemporal graph neural network prediction module each have a hydrodynamic regression head and a water quality regression head. The output of the hydrodynamic regression head serves as the conditional input for the water quality regression head. The hydrodynamic regression head predicts hydrodynamic variables, including at least one of flow rate and water level; the water quality regression head predicts water quality variables, including at least one of total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, and chemical oxygen demand.The system also includes a training module, a loss calculation module, a pre-training module, and a fine-tuning module. The training module performs multi-step autoregressive rolling training on the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module. It executes multi-step autoregressive rolling within a sample window and employs a planned sampling strategy, gradually reducing the ground truth feedback ratio as the training progresses. The loss calculation module calculates the training loss, which includes regression loss, concentration non-negativity constraint loss, and node water quality anomaly rate weighted loss. The pre-training module uses the mechanistic model output as a supervision signal to pre-train the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module. The fine-tuning module introduces measured data to add observation supervision terms while retaining mechanistic supervision and physical constraints, fine-tuning the pre-trained watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module. Each of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module also includes a gated residual network for adaptive correction of the residual characteristics after the main intervention.
[0121] The water quality prediction system disclosed in this application divides urban river bends into watershed subgraphs and river bend subgraphs with different time resolutions. Based on the correspondence between watershed outlet nodes and river bend receiving nodes, it performs temporal aggregation and spatial projection on the predicted flow, pollutant concentration, or pollution load of the watershed, and writes the mapping results into the exogenous driving channel of the river bend node. Heterogeneous hydraulic units such as drainage system nodes, weirs, orifices, river nodes, bay nodes, sewage treatment plant input nodes, and open boundary nodes are explicitly represented as graph nodes, and the node type encoding is integrated with node status, exogenous driving force, and static attributes. The method combines a physical topology prior adjacency matrix and an adaptive adjacency matrix generated by node embedding, and generates a node-by-node gating matrix based on tidal and rainfall scenarios to dynamically recalibrate the adaptive adjacency relationships. It sets up a hydrodynamic regression head and a water quality regression head, using the hydrodynamic prediction results as input conditions for water quality prediction. It adopts multi-step autoregressive rolling and planned sampling that decays with the training process to make the training process gradually approach the prediction feedback process of actual deployment. It combines gating residuals, concentration non-negativity constraints, and node water quality anomaly rate weighting to improve long-term rolling stability and the ability to identify abnormal water quality processes.
[0122] In the above embodiments, implementation can be achieved, in whole or in part, by software, hardware, firmware, or any combination thereof. Furthermore, as those skilled in the art will understand, the principles herein can be reflected in a computer program product on a computer-readable storage medium pre-loaded with computer-readable program code. Any tangible, non-transitory computer-readable storage medium may be used, including magnetic storage devices (hard disks, floppy disks, etc.), optical storage devices (CDs, DVDs, Blu-ray discs, etc.), flash memory, and / or the like. These computer program instructions can be loaded onto a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to form a machine, such that instructions executing on the computer or other programmable data processing apparatus can generate means for performing a specified function. These computer program instructions can also be stored in a computer-readable storage medium that can instruct the computer or other programmable data processing apparatus to operate in a particular manner, such that instructions stored in the computer-readable storage medium can form an article of manufacture, including means for implementing the specified function. The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to perform a series of operational steps on the computer or other programmable apparatus to produce a computer-implemented process, such that instructions executing on the computer or other programmable apparatus can provide steps for implementing the specified function.
[0123] This document describes various exemplary embodiments with reference to them. However, those skilled in the art will recognize that changes and modifications can be made to the exemplary embodiments without departing from the scope of this document. For example, various operational steps and components for performing operational steps can be implemented in different ways depending on the specific application or considering any number of cost functions associated with the operation of the system (e.g., one or more steps can be deleted, modified, or combined with other steps).
[0124] While the principles herein have been illustrated in various embodiments, numerous modifications to the structures, arrangements, proportions, elements, materials, and components, particularly suited to specific environments and operational requirements, may be used without departing from the principles and scope of this disclosure. These modifications and other alterations or alterations will be included within the scope of this document. Those skilled in the art will recognize that many changes can be made to the details of the above embodiments without departing from the fundamental principles of the invention.
Claims
1. A method for predicting urban river bend water quality based on heterogeneous spatiotemporal graph neural networks, characterized in that, include: Real-time acquisition of multi-source spatiotemporal data of urban river bends; the multi-source spatiotemporal data includes meteorological data, drainage system data, historical status data, exogenous driving forces and pollution source data; The multi-source spatiotemporal data is preprocessed; the preprocessing includes resampling, time alignment, unifying units and / or unifying dimensions of the multi-source spatiotemporal data at different time frequencies, and marking or correcting missing values, outliers, sensor drift and elevation benchmark deviation; Watershed sub-maps and river bend sub-maps are constructed based on the drainage system topology, river-bay spatial relationships, and pollution source input locations of urban river bends. The watershed sub-map uses the water flow confluence points of the drainage system and different hydraulic structures as nodes. The river bend sub-map uses river confluence points, bay confluence points, open boundary confluence points, and sewage treatment plant confluence points as nodes. The watershed sub-map connects nodes according to the drainage system network relationship, with each node having a unique unidirectional water flow convergence relationship. The river bend sub-map connects nodes according to their proximity, with each node having a bidirectional water flow convergence relationship. The nodes at the final water flow outlet in the watershed sub-map correspond to the nodes in the river bend sub-map that flow into a river or river bend. The multi-source spatiotemporal data is matched to the nodes in the watershed subgraph and the river bend subgraph to obtain the node matching data for each node. The node identifiers and corresponding node matching data of each node are input into a preset watershed spatiotemporal graph neural network prediction module, and the watershed prediction sub-graph for any future time is obtained from the preset future time output by the watershed spatiotemporal graph neural network prediction module; each node of the watershed prediction sub-graph corresponds to the watershed sub-graph according to the node identifier, and the node prediction data of each node of the watershed prediction sub-graph is generated by the watershed spatiotemporal graph neural network prediction module based on the historical state data, which is used to identify the estimated value of the node matching data of each node of the watershed sub-graph at a future time; By using a cross-scale mapping operator, the node prediction data of the nodes at the final outlet of the water flow in the watershed prediction sub-map are aggregated in time and projected in space. The results of the time aggregation and spatial projection are written into the corresponding receiving nodes of the river bend sub-map to obtain the river bend prediction sub-map for the corresponding preset future time. The predicted river bend sub-map is input into a preset river bend spatiotemporal map neural network prediction module, and the urban river bend water quality prediction data, which identifies the hydrodynamic and water quality states of each river and / or bay, is obtained from the output of the river bend spatiotemporal map neural network prediction module. The river bend spatiotemporal map neural network prediction module applies a spatiotemporal representation learning model for the river bend sub-map to predict the hydrodynamic and water quality states of the rivers and / or bays. This spatiotemporal representation learning model transforms the original input into a high-dimensional vector representation capable of expressing spatiotemporal coupling characteristics by simultaneously learning the spatial dependencies and temporal evolution patterns in the data through a neural network. Output the predicted water quality data for the urban river bends.
2. The method for predicting urban river bend water quality as described in claim 1, characterized in that, The meteorological data includes rainfall, temperature, wind speed and / or humidity; the drainage system data includes drainage node elevation, catchment area, pipe network connection, hydraulic structure type and / or outlet location; the exogenous driving and pollution source data includes surface runoff, pipe network overflow, sewage treatment plant effluent, tributary inflow, atmospheric deposition, sediment release, open boundary tide level and / or boundary water quality; the historical status data includes historical flow, water level, water depth, flow velocity, total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, salinity and / or sediment content data.
3. The method for predicting urban river bend water quality as described in claim 1, characterized in that, The types of nodes in the watershed submap and river bend submap include drainage system nodes, hydraulic structure nodes, open boundary nodes, pipeline network nodes, river nodes, and bay nodes; wherein, the open boundary node refers to the interface node between the river bend watershed and the surrounding large water body, the drainage system node includes water catchment nodes, pipeline network nodes and / or outlet nodes, and the hydraulic structure node includes weir nodes, orifice nodes, and pumping station nodes.
4. The method for predicting urban river bend water quality as described in claim 1, characterized in that, The watershed spatiotemporal graph neural network prediction module and the river bend spatiotemporal graph neural network prediction module are constructed based on heterogeneous spatiotemporal graph neural networks. The heterogeneous spatiotemporal graph neural network includes a temporal modeling part and a spatial modeling part. The temporal modeling part adopts a gated temporal convolutional network, and the spatial modeling part adopts a graph convolutional network based on the superposition of adjacency matrices with topological priors and gated adaptive adjacency matrices. The heterogeneous spatiotemporal graph neural network learns multi-level spatiotemporal representations of interactions between different types of environmental subjects to achieve integrated construction of hydrology, hydrodynamics, and water quality of catchment areas, drainage networks, tributaries, main streams, bays, and related water environment areas.
5. The method for predicting urban river bend water quality as described in claim 4, characterized in that, The training of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module adopts multi-step autoregressive rolling training, which performs multi-step autoregressive rolling within the sample window and adopts a planned sampling strategy, gradually reducing the ground truth feedback ratio as the training progresses; in the planned sampling strategy, the ground truth feedback probability decreases linearly with the number of training rounds. And / or, both the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module are equipped with a hydrodynamic regression head and a water quality regression head. The hydrodynamic regression head is used to predict hydrodynamic variables, and the water quality regression head is used to predict water quality variables. The output of the hydrodynamic regression head serves as the conditional input of the water quality regression head. The hydrodynamic variables include at least one of flow rate and water level, and the water quality variables include at least one of total nitrogen, total phosphorus, ammonia nitrogen, dissolved oxygen, and chemical oxygen demand. And / or, the watershed spatiotemporal map neural network prediction module and / or the river bend spatiotemporal map neural network prediction module further include a gated residual network, which is used to adaptively correct the residual characteristics after the master forecast, output a correction term and add it to the master forecast residual.
6. The method for predicting urban river bend water quality as described in claim 5, characterized in that, The training of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module includes a pre-training stage and a fine-tuning stage; the pre-training stage uses the output of the mechanistic model as a supervision signal; the fine-tuning stage introduces measured data to add observation supervision terms, while retaining mechanistic supervision and physical constraints; the fine-tuning stage uses a learning rate smaller than that of the pre-training stage, or freezes some spatiotemporal backbone parameters; And / or, the training loss function of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module includes concentration non-negativity constraint loss and / or node water quality anomaly rate weighted loss; the concentration non-negativity constraint loss is the sum of squares of the negative values of the predicted concentration; the node water quality anomaly rate weighted loss is weighted according to the water quality anomaly rate of each node to increase the loss weight of water quality anomaly nodes.
7. The method for predicting urban river bend water quality as described in claim 4, characterized in that, The river bend spatiotemporal map neural network prediction module includes a water area map model, which is used to characterize the water flow movement and pollutant transport, diffusion, exchange and reaction processes in the river and / or bay system under the influence of land runoff pollution, sewage treatment plant pollution and open-boundary external pollution in the river bend sub-map, so as to realize the integrated modeling of the urban river bend water system. The watershed spatiotemporal graph neural network prediction module includes a watershed graph model, which is used to characterize the water volume and pollutant transport processes from runoff generation and confluence in the catchment area to drainage system nodes and between drainage system nodes under the driving force of land rainfall in the watershed subgraph. In the expression of the watershed graph model, the runoff generation in the catchment area is implicitly represented by the drainage system nodes connected to it, so as to directly predict the runoff generation and confluence in the catchment area and its pollutant input process at these connected nodes using exogenous drivers such as rainfall.
8. The method for predicting urban river bend water quality as described in claim 1, characterized in that, Also includes: The predicted water quality data of the urban river bend is fed back to the input of the watershed spatiotemporal map neural network prediction module and the river bend spatiotemporal map neural network prediction module to perform the prediction for the next time step.
9. A computer-readable storage medium, characterized in that, The method includes a program that can be executed by a processor to implement the urban river bend water quality prediction method as described in any one of claims 1 to 8.
10. A computer program product, characterized in that, The method includes a program that can be executed by a processor to implement the urban river bend water quality prediction method as described in any one of claims 1 to 8.
