A method for predicting overflow in drainage pipe networks based on the Phy-STNN model
By using the Phy-STNN model, combined with GNN and LSTM, and introducing physical constraints, the problems of high computational complexity and poor accuracy of extreme rainfall prediction in existing drainage network hydrodynamic models are solved. This enables high-precision prediction of water depth at key nodes in the drainage network, thereby improving the city's ability to cope with urban flooding disasters.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2025-06-05
- Publication Date
- 2026-04-21
AI Technical Summary
Existing hydrodynamic models for drainage networks have high computational complexity, which cannot meet the operation and maintenance needs of smart drainage facilities. Furthermore, they have poor prediction accuracy under extreme rainfall conditions and lack interpretability and physical constraints.
The Phy-STNN model is adopted, which combines graph neural networks (GNN) and long short-term memory networks (LSTM). Physical constraints are introduced, and high-precision and refined prediction of drainage network overflow is achieved through dataset preprocessing, graph structure construction, spatiotemporal neural network architecture construction and physical information constraint fusion.
While enabling rapid computation, it improves the model's generalization ability and physical consistency, achieves high-precision prediction of water depth at key nodes in drainage networks, reduces prediction errors in extreme scenarios, and enhances the drainage system's ability to cope with urban flooding disasters.
Smart Images

Figure CN120873424B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent operation and maintenance technology for drainage systems, specifically to a method for predicting overflows in drainage networks based on the Phy-STNN model. Background Technology
[0002] Against the backdrop of global climate change, extreme rainfall events are becoming more frequent, causing significant damage to urban drainage networks. Inadequate design standards for drainage systems lead to insufficient drainage capacity, making them prone to overflow during heavy rainstorms, resulting in surface flooding and urban waterlogging. Hydrodynamic models of drainage systems are an effective means of addressing the risk of urban waterlogging.
[0003] Conventional hydraulic models, such as the Sven-Venant equations, construct hydrodynamic models of pipe networks. Although they have clear physical meaning, their solution complexity increases exponentially with the scale of the pipe network and the computation time is long. They cannot meet the construction needs of intelligent drainage facility operation and maintenance systems in the process of iterating from "water management" to "intelligent water". In recent years, with the rapid development of AI (artificial intelligence) algorithms such as machine learning and deep learning, data-driven hydrodynamic models of drainage systems have emerged continuously.
[0004] However, these models are highly dependent on data quality and are difficult to accurately predict extreme rainfall conditions with limited data; most are black-box models, lacking interpretability; and they are prone to problems such as prediction results violating basic physical laws such as mass conservation, which seriously restricts their reliability in practical applications. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a drainage network overflow prediction method based on the Phy-STNN model. This method incorporates the Phy-STNN model, which introduces physical constraints into the deep learning framework of GNN and LSTM. While enabling rapid computation, it improves the model's generalization ability and physical consistency, providing strong technical support for drainage network overflow prediction. This overcomes the problems of low accuracy and lack of spatiotemporal feature coupling in existing drainage network hydrodynamic models, achieving high-precision and refined prediction of water depth at key nodes in the drainage network.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for predicting overflow in drainage pipe networks based on the Phy-STNN model, comprising the following steps:
[0007] S1: Dataset Preprocessing and Construction
[0008] The calibrated and verified SWMM model and the Chicago rain pattern generator are used to jointly construct the training dataset of the Phy-STNN model. The training dataset is the simulation of the hydraulic state of the drainage network by the verified SWMM model on the data of the Chicago rain pattern generator. The output data is normalized to form a spatiotemporal sequence training sample.
[0009] S2: Neural Network Modeling of Drainage Pipe Network
[0010] ① Graph structure construction:
[0011] The urban drainage network is abstracted as an undirected graph G = (V, E), where V represents the set of nodes, each node represents a key inspection well in the urban drainage system; E represents the set of edges, each edge represents the pipe connection between key inspection wells and is considered an undirected edge.
[0012] ② Construction of PyG format dataset
[0013] Historical water depth and rainfall intensity characteristics of each node, and inflow and outflow physical parameters of each pipe segment are extracted and organized into x, edge_index, edge_attr and y in PyTorch Geometric data format.
[0014] S3: Building a Spatiotemporal Neural Network Architecture
[0015] By cascading the graph neural network (GNN) and the long short-term memory neural network (LSTM), the GNN extracts spatial features at each time step, and then feeds these features into the LSTM model to capture time-dependent features. Finally, a fully connected layer is added to output the predicted water depth for each node.
[0016] S4: Physical Information Constraint Fusion
[0017] Deep coupling between the water balance law and the spatiotemporal neural network Phy-STNN is achieved through mechanism embedding regularization and differentiable physical layers;
[0018] S5: Phy-STNN Model Training and Optimization
[0019] S6: Phy-STNN Model Evaluation and Experimental Design
[0020] S7: Overflow Forecast
[0021] Based on the trained Phy-STNN model, the model predicts the water depth change process of manholes in the drainage network over a period of time by inputting the rainfall intensity sequence for future periods and the initial water depth of the manholes.
[0022] Furthermore, in step S1, the SWMM model is calibrated and verified based on historical rainfall data, and the Nash-Sutcliffe efficiency coefficient (NSE) is used as the accuracy evaluation index until NSE≥0.6; the Chicago rainfall pattern generator is used to generate a multi-scenario dataset according to the rainfall peak coefficient, return period and rainfall duration parameters. The multi-scenario dataset includes regular and extreme rainstorm scenarios.
[0023] Furthermore, in step S2, a PyG format dataset is constructed, organizing x, edge_index, edge_attr, and y specifically in the PyTorch Geometric data format:
[0024] X: Node feature matrix Where N represents the total number of nodes, and F represents the feature dimension of each node; the feature vector of each node i (i = 1, 2, …, N) is represented as:
[0025]
[0026] Among them, h i Indicates historical water depth, in meters (m); intensity i Indicates rainfall intensity, in mm / min;
[0027] edge_index: Edge connection matrix Where M represents the number of edges; each column of the matrix This indicates that there is an undirected edge between node i and node j;
[0028] edge_attr: Edge feature matrix Where M represents the number of edges, and D represents the feature dimension of each edge; each edge m (m = 1, 2, …, M), whose eigenvectors are represented as:
[0029]
[0030] in, q in Indicates the inflow rate of the pipe section. q out Indicates the outflow rate of the pipe section. m 3 / s ;
[0031] y represents the target predicted value, which is the water depth at each node in the pipeline network.
[0032] Furthermore, step S3 specifically includes the following:
[0033] ① The GNN model uses a normalized Laplacian matrix to achieve spatial feature aggregation:
[0034]
[0035] in, Let be the feature matrix of the l-th layer nodes, and let be the initial input. ;
[0036] The adjacency matrix after adding self-loops, Defined as:
[0037]
[0038] for The degree matrix, diagonal elements ;
[0039] Let L be the learnable weight matrix of the l-th layer;
[0040] For activation functions;
[0041] ② The LSTM time module includes a forget gate, input gate, candidate states, output gate, and cell states. It uses a unidirectional LSTM to capture time series features, and its gating mechanism is as follows:
[0042] Forget Gate: Decides whether to retain information from the previous time step;
[0043]
[0044] Input gate: Determines the importance of the input at the current time step for updating new memories;
[0045]
[0046] Candidate state: Candidate memory information generated based on the current input and the hidden state of the previous time step;
[0047]
[0048] Updating memory units: The state of a unit is composed of the previous memory (controlled by the forgetting gate) and the current candidate memory (controlled by the input gate);
[0049]
[0050] Output gate: Determines the final output content at the current time step;
[0051]
[0052] Update hidden state: Activate the current cell state with tanh and gate it with the output gate to obtain the hidden state at the current moment;
[0053]
[0054] Furthermore, step S4 specifically includes the following:
[0055] The differentiable physical layer design embeds a physical verification layer at the output to ensure that the prediction results strictly meet the following requirements:
[0056]
[0057] Ensure that the nodes satisfy the continuity equation:
[0058]
[0059] Among them, h v The water depth at node v is represented in meters (m); A v The cross-sectional area of the inspection well is represented in m. 2 ;q in The inflow rate of the pipe section is expressed in m. 3 / s;q out The outflow rate of the pipe section is expressed in m. 3 / s;
[0060] The time derivative of water depth is discretized using the central difference method:
[0061]
[0062] in Δt is a time step of 1 minute;
[0063] Construct a physical data hybrid loss function, with the total loss function being:
[0064]
[0065] Among them, data loss is
[0066]
[0067] Physical loss is
[0068]
[0069] Boundary constraint loss is
[0070]
[0071] Furthermore, λ1 = 0.5, λ2 = 0.3, λ3 = 0.2.
[0072] Furthermore, in step S5, the configuration for training the Phy-STNN model includes a GNN. The GNN part includes a node embedding layer, a message passing layer, and a graph readout layer. The node embedding layer is used to perform high-dimensional representation of the original input features. It is implemented using a graph attention mechanism. The node embedding layer has three independent attention heads, each of which outputs 64-dimensional features. Finally, they are concatenated to form a 192-dimensional node embedding representation.
[0073] The information transmission layer adopts the GraphSAGE (Mean Aggregator) structure to aggregate spatial adjacency information. The information transmission layer compresses the node features output by the node embedding layer to 32 dimensions.
[0074] The graph readout layer further reduces and integrates the local embedded representations of each node, outputting a 16-dimensional feature representation, and employs a residual connection mechanism.
[0075] Furthermore, it also includes an LSTM module for capturing dynamic features in time series. It adopts a two-layer stacked LSTM network with a Dropout layer introduced between the two LSTM networks. The dropout rate is set to 0.2. The output of the second LSTM layer is fed into a fully connected layer for water depth prediction output. Combined with the spatial embedding information of each node in the graph structure, spatiotemporal joint modeling and prediction are realized. The input of the first LSTM layer is the node embedding sequence of each time step output by the graph readout layer. The hidden layer dimension is set to 64. The first LSTM layer performs preliminary temporal feature extraction on the node embedding sequence to generate intermediate state representation.
[0076] The second LSTM layer is used to further refine and compress the time dimension information. It receives the output of the first LSTM layer and the hidden layer dimension is set to 32.
[0077] Furthermore, step S5 specifically includes the following:
[0078] ① During the pre-training phase, the basic feature extraction capability of the model is initialized;
[0079] Cold junction physical constraint layer, λ1=0, λ3=0, using Adam optimizer with a learning rate of 3×10⁻ 4 Batch size 64, training for 100 epochs;
[0080] ② Fine-tuning stage: Balancing data-driven approaches with physical laws;
[0081] Unfreeze the physical constraint layer, initial weights λ1:λ2:λ3=5:3:2, learning rate 1×10⁻ 4 Batch size 64, training for 50 epochs, with the λ2 weights increased by 0.1 every 5 epochs.
[0082] ③ Enhanced robustness: Simulating scenarios with missing monitoring data;
[0083] Throughout the training process, 30% of the pipeline connections were randomly masked and 15% of the node features were randomly discarded to simulate missing monitoring data.
[0084] Furthermore, in step S6, the trained Phy-stnn model is compared with the physical model SWMM, the data-driven model GNN, and LSTM using the coefficient of determination R²≥0.85, mean absolute percentage error (MAPE), and root mean square error (RMSE) as evaluation metrics. The test scenarios include regular rainfall, extreme rainstorms, local pipeline failures, and data loss.
[0085] Beneficial effects: 1. The prediction method in this application constructs a Phy-STNN model, which adopts a GNN-LSTM cascade architecture. GNN realizes the aggregation of local features of the pipeline network through the normalized Laplacian matrix, and LSTM captures long-term temporal dependencies through the gating mechanism. Physical constraints are introduced on the deep learning framework of GNN and LSTM, which improves the generalization ability and physical consistency of the model while achieving fast computation. This provides strong technical support for the prediction of overflow of drainage pipeline networks and solves the problems of poor interpretability and high violation rate of physical laws in existing conventional data-driven models.
[0086] 2. This application employs a phased, progressive optimization strategy and physical-guided regularization technique for training and tuning the Phy-STNN model to achieve efficient convergence and improve generalization capabilities. During model training, 30% of pipe connections are randomly masked to simulate local faults in the actual pipe network, forcing the model to learn the hydraulic state of redundant paths, thus reducing the prediction error of abnormal scenarios by 25%. Additionally, 15% of node features are randomly masked to simulate scenarios where sensor data is reliable, thereby enhancing the model's generalization capabilities through data augmentation.
[0087] 3. By integrating physical laws such as water balance with the spatiotemporal correlation capabilities of spatiotemporal neural networks through the Phy-STNN model, and combining multi-source historical data such as manhole water depth, pipeline flow, and rainfall, high-precision and refined prediction of water depth at key nodes in the drainage network can be achieved, providing important assistance for drainage system construction and improving the city's ability to cope with urban flooding disasters. Attached Figure Description
[0088] Figure 1 This is a flowchart illustrating the method for predicting overflows in drainage networks based on the Phy-STNN model.
[0089] Figure 2 A schematic diagram of the SWMM model;
[0090] Figure 3This is a diagram of the Phy-STNN model framework.
[0091] Figure 4 This is a schematic diagram of the physical constraint fusion mechanism. Detailed Implementation
[0092] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structure, features and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0093] For reference Figures 1-4 As shown, this application provides a method for predicting drainage network overflows based on the Phy-STNN model, including the following steps:
[0094] S1: Dataset Preprocessing and Construction
[0095] The calibrated and verified SWMM model and the Chicago Rain Pattern Generator jointly construct the training dataset for the Phy-STNN model. The training dataset simulates the hydraulic state of the drainage network using data from the Chicago Rain Pattern Generator, with the output data normalized to form spatiotemporal sequence training samples. The specific SWMM model is based on historical rainfall data, using the Nash-Sutcliffe efficiency coefficient (NSE) as the accuracy evaluation index. Sensitive parameters such as the Manning coefficient and infiltration rate are optimized manually or algorithmically until NSE ≥ 0.6 to ensure the reliability of the physical model. The Chicago Rain Pattern Generator's rainfall process line method generates multiple rainfall scenarios. Based on the rainfall intensity-duration-frequency curve, diverse rainstorm datasets are generated by adjusting the peak rainfall coefficient, return period, and rainfall duration parameters. Furthermore, local rainstorm formulas are combined to generate rainstorm datasets covering different extreme conditions. In this embodiment, the rainstorm intensity formula for Shenzhen, China, is used. In the formula, P is the design return period (years), and t is the rainfall duration (minutes). In practical implementation, 36 sets of rainstorm events are generated according to the following parameter combinations: peak rainfall coefficients: 0.25, 0.5, 0.75; return periods: 10 years, 50 years, 100 years; rainfall duration: 60 minutes, 90 minutes, 120 minutes, 180 minutes. The generated dataset is then used to simulate the hydraulic state of the drainage network through a validated SWMM model, outputting data such as water depth at each node and flow rate in each pipe section. After normalization, this data forms training samples for the spatiotemporal sequence.
[0096] S2: Neural Network Modeling of Drainage Pipe Network
[0097] This includes graph structure construction and PyG format dataset construction. Specifically, the graph structure construction treats each key manhole in the urban drainage system as a node in the graph. The location and liquid level of each node reflect the spatial and hydraulic characteristics of the actual drainage network. Considering potential backflow, blockage, and flooding phenomena in the actual operation of the drainage network, to ensure the model can cover bidirectional flow, the physical connections between nodes in the drainage network are considered as undirected edges, thus forming an undirected graph G = (V, E), where V represents the set of nodes, each node representing a key manhole in the urban drainage system; E represents the set of edges, each edge representing the pipe connection between key manholes, considered as an undirected edge.
[0098] The PyG format dataset is constructed using PyG (PyTorch Geometric), a data processing framework specifically designed for graph neural networks. Its core is a graph-based data format, facilitating efficient execution of operations such as graph convolution on GPUs. Data structures in PyG are typically represented as graph samples using the `torch_geometric.data.Data` class. This extracts historical water depth and rainfall intensity features for each node, as well as the inflow and outflow physical parameters for each pipe segment, and organizes x, edge_index, edge_attr, and y in the PyTorchGeometric data format.
[0099] x represents the node feature matrix, which integrates the attributes of all nodes in the drainage network into a node feature matrix. Where N represents the total number of nodes, and F represents the feature dimension of each node; the feature vector of each node i (i = 1, 2, …, N) is represented as:
[0100]
[0101] Among them, h i Indicates historical water depth, in meters (m); intensity i Indicates rainfall intensity, in mm / min;
[0102] edge_index represents the edge connection matrix. Where M represents the number of edges; each column of the matrix This indicates that there is an undirected edge between node i and node j;
[0103] edge_attr represents the edge feature matrix, which is constructed by extracting the corresponding physical parameters for each edge. Where M represents the number of edges, and D represents the feature dimension of each edge; each edge m(m = 1, 2, ..., M), whose eigenvectors are represented as:
[0104]
[0105] in, q in Indicates the inflow rate of the pipe section. q out Indicates the outflow rate of the pipe section. m 3 / s。
[0106] y represents the target predicted value, which is the water depth at each node in the pipeline network.
[0107] As a further example, this implementation defines the drainage network diagram as G = (V, E, X, R), where: V = { v 1 , v 2 ,…, v n} represents the set of inspection well nodes (total) n (number of nodes) E = { e 1 , e 2 , …, e m} represents the set of pipe segment edges connecting nodes (total... m (edge) For the node feature matrix ( T For time step, F (for feature dimensions) This is time-series data on rainfall intensity at nodes.
[0108] The topology of the drainage network is represented by the following matrix:
[0109] 1. Adjacency Matrix A = (a ij ) n×n :
[0110]
[0111] 2. Correlation Matrix M = (b ip ) n×m :
[0112]
[0113] 3. Degree Matrix D = (dii ) n×n :
[0114]
[0115] 4. Traffic Matrix Record the flow rate of each pipe segment at time step t, which is used to calculate the flow balance constraint of the nodes.
[0116] S3: Building a Spatiotemporal Neural Network Architecture
[0117] By cascading the graph neural network (GNN) and the long short-term memory neural network (LSTM), the GNN extracts spatial features at each time step, and then feeds these features into the LSTM model to capture time-dependent features. Finally, a fully connected layer is added to output the predicted water depth for each node.
[0118] The GNN model uses a normalized Laplacian matrix to achieve spatial feature aggregation.
[0119]
[0120] in, Let be the feature matrix of the l-th layer nodes, and let be the initial input. ;
[0121] The adjacency matrix after adding self-loops, Defined as:
[0122]
[0123] for The degree matrix, diagonal elements ;
[0124] Let L be the learnable weight matrix of the l-th layer;
[0125] For activation functions;
[0126] The LSTM time module mainly consists of four gates and one memory unit: forget gate, input gate, candidate state, output gate, and unit state. The unit state is the "memory band" that runs through the entire sequence, allowing information to be transferred over time. The gating mechanism determines which information is "written," "retained," and "read." A unidirectional LSTM is used to capture time series features, and its gating mechanism is as follows:
[0127] Forget Gate: Decides whether to retain information from the previous time step;
[0128]
[0129] Input gate: Determines the importance of the input at the current time step for updating new memories;
[0130]
[0131] Candidate state: Candidate memory information generated based on the current input and the hidden state of the previous time step;
[0132]
[0133] Updating memory units: The state of a unit is composed of the previous memory (controlled by the forgetting gate) and the current candidate memory (controlled by the input gate);
[0134]
[0135] Output gate: Determines the final output content at the current time step;
[0136]
[0137] Update hidden state: Activate the current cell state with tanh and gate it with the output gate to obtain the hidden state at the current moment;
[0138]
[0139] In the formula, ⊙ represents element-wise product.
[0140] Table 1 shows the data structure from inputting data into the GNN to outputting data into the LSTM.
[0141] Table 1 Data Structure for GNN and LSTM Coupling
[0142]
[0143] S4: Physical Information Constraint Fusion
[0144] Deep coupling of the water balance law and the spatiotemporal neural network Phy-STNN is achieved through mechanism embedding regularization and differentiable physical layers. Specifically, this includes:
[0145] ① Embed a differentiable physical verification layer at the network output to ensure that the prediction results strictly meet the following requirements:
[0146]
[0147] Ensure that the nodal water continuity equation is satisfied Among them, h v The water depth at node v is represented in meters (m); A v The cross-sectional area of the inspection well is represented in m. 2;q in The inflow rate of the pipe section is expressed in m. 3 / s;q out The outflow rate of the pipe section is expressed in m. 3 / s;
[0148] ② Discretize the time derivative of water depth using the central difference method.
[0149] in, Δt is a time step of 1 minute;
[0150] (3) Construct a physical data hybrid loss function, including data loss, physical constraint loss, and boundary constraint loss, weighted according to weights λ1:λ2:λ3=0.5:0.3:0.2; specifically: the total loss function is:
[0151]
[0152] Among them, data loss is
[0153]
[0154] Physical loss is
[0155]
[0156] Boundary constraint loss is
[0157]
[0158] S5: Phy-STNN Model Training and Optimization
[0159] The model achieves efficient convergence and improved generalization capabilities through a phased, progressive optimization strategy and physically guided regularization techniques. The specific technical solution is as follows:
[0160] The Phy-STNN model training configuration consists of a three-layer GNN structure: a node embedding layer, a message passing layer, and a graph readout layer. The functions and structures of each layer are as follows: The first layer, the node embedding layer, performs high-dimensional representation of the original input features using a graph attention mechanism. It has three independent attention heads, each outputting 64-dimensional features, which are then concatenated to form a 192-dimensional node embedding representation. This layer calculates node representations with differentiated weights based on the features of neighboring nodes and their association strength, improving feature representation capabilities. The second layer, the message passing layer, uses a GraphSAGE (Mean Aggregator) structure to aggregate spatial adjacency information. This layer compresses the node features output from the first layer to 32 dimensions and collects neighbor information through mean aggregation, improving the model's generalization ability in heterogeneous network structures. This layer also supports batch processing and parameter sharing to improve computational efficiency. The third layer, the graph readout layer, further reduces and integrates the local embedding representations of each node, outputting a 16-dimensional feature representation, and uses a residual connection mechanism to alleviate the gradient vanishing problem during deep network training. The node embeddings output by this layer will be used as input to the LSTM temporal modeling module and passed to the next stage.
[0161] The LSTM module is used to capture dynamic features in time series data. Its structure employs a two-layer stacked LSTM network, specifically designed as follows: The first LSTM layer receives the node embedding sequence from the GNN output at each time step, with a hidden layer dimension of 64. This layer is responsible for preliminary temporal feature extraction from the input sequence, generating intermediate state representations. The second LSTM layer receives the output sequence from the first LSTM layer, with a hidden layer dimension of 32. This layer further refines and compresses temporal information, enhancing the model's ability to model medium- to long-term dependencies. A Dropout layer with a dropout rate of 0.2 is introduced between the two LSTM layers to alleviate overfitting and enhance the model's generalization ability. Finally, the output of the second LSTM layer is fed into a fully connected layer for water depth prediction. Combined with the spatial embedding information of each node in the graph structure, spatiotemporal joint modeling and prediction are achieved.
[0162] The following training will be performed using the model configuration described above:
[0163] ① During the pre-training phase, the basic feature extraction capability of the model is initialized;
[0164] Cold junction physical constraint layer, λ1=0, λ3=0, using Adam optimizer with a learning rate of 3×10⁻ 4 Batch size 64, training for 100 epochs;
[0165] ② Fine-tuning stage: Balancing data-driven approaches with physical laws;
[0166] Unfreeze the physical constraint layer, initial weights λ1:λ2:λ3=5:3:2, learning rate 1×10⁻ 4 Batch size 64, training for 50 epochs, with the λ2 weights increased by 0.1 every 5 epochs.
[0167] ③ Enhanced robustness: Simulating scenarios with missing monitoring data:
[0168] Throughout the training process, including the pre-training and fine-tuning phases, the following mechanisms are employed to enhance the model's generalization and robustness:
[0169] Randomly disable 30% of pipe connections, formula:
[0170] Randomly discard 15% of node features to simulate missing monitoring data.
[0171] S6: Model Evaluation and Experimental Design
[0172] The evaluation metrics include the coefficient of determination R²≥0.85, mean absolute percentage error (MAPE), and root mean square error (RMSE). The trained phy-stnn model is compared with the physical model SWMM, the data-driven model GNN, and LSTM. The test scenarios include regular rainfall, extreme rainstorms, local pipeline failures, and missing data.
[0173] Specifically, ① the coefficient of determination R², with a target value ≥ 0.85.
[0174]
[0175] ② Mean Absolute Percentage Error (MAPE)
[0176]
[0177] ③ Root Mean Square Error (RMSE)
[0178]
[0179] Experimental Design Scheme
[0180] The physical model SWMM, the data-driven models GNN and LSTM, and the trained Phy-STNN model were used to test the performance of the models in different test scenarios, as shown in Table 2.
[0181] Table 2 Test Content
[0182] Scene type describe Test objective Regular rainfall Return period ≤ 10 years, different peak rainfall coefficients Basic accuracy verification Extreme rainstorm Return period > 10 years, different peak rainfall coefficients Generalization ability test Local fault in pipeline network Random blockage of 15% of pipes Robustness assessment Data missing Hiding 30% of node water level data Physical constraint validity verification
[0183] In a specific embodiment, three models, GNN, LSTM, and Phy-STNN, with nodes 20-29, were tested and evaluated. The evaluation results are shown in Table 3.
[0184]
[0185] S7: Overflow Forecast
[0186] Based on the trained Phy-STNN model, the model predicts the water depth change process of manholes in the drainage network over a period of time by inputting the rainfall intensity sequence for future periods and the initial water depth of the manholes.
[0187] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for predicting overflow in drainage pipe networks based on the Phy-STNN model, characterized in that: Includes the following steps: S1: Dataset Preprocessing and Construction The calibrated and verified SWMM model and the Chicago rain pattern generator are used to jointly construct the training dataset of the Phy-STNN model. The training dataset is the simulation of the hydraulic state of the drainage network by the verified SWMM model on the data of the Chicago rain pattern generator. The output data is normalized to form a spatiotemporal sequence training sample. S2: Neural Network Modeling of Drainage Pipe Network ① Graph structure construction: The urban drainage network is abstracted as an undirected graph G = (V, E), where V represents the set of nodes, each node represents a key inspection well in the urban drainage system; E represents the set of edges, each edge represents the pipe connection between key inspection wells and is considered an undirected edge. ② Construction of PyG format dataset Historical water depth and rainfall intensity characteristics of each node, and inflow and outflow physical parameters of each pipe segment are extracted and organized into x, edge_index, edge_attr, and y in PyTorch Geometric data format; S3: Building a Spatiotemporal Neural Network Architecture By cascading the graph neural network (GNN) and the long short-term memory neural network (LSTM), the GNN extracts spatial features at each time step, and then feeds these features into the LSTM model to capture time-dependent features. Finally, a fully connected layer is added to output the predicted water depth for each node. S4: Physical Information Constraint Fusion Deep coupling between the water balance law and the spatiotemporal neural network Phy-STNN is achieved through mechanism embedding regularization and differentiable physical layers; The differentiable physical layer design embeds a physical verification layer at the output to ensure that the prediction results strictly meet the following requirements: Ensure that the nodes satisfy the continuity equation: Among them, h v The water depth at node v is represented in meters (m); A v The cross-sectional area of the inspection well is represented in m. 2 ;q in The inflow rate of the pipe section is expressed in m. 3 / s;q out The outflow rate of the pipe section is expressed in m. 3 / s; The time derivative of water depth is discretized using the central difference method: in, Δt is a time step of 1 minute; Construct a physical data hybrid loss function, with the total loss function being: Among them, data loss is Physical loss is Boundary constraint loss is S5: Phy-STNN Model Training and Optimization S6: Phy-STNN Model Evaluation and Experimental Design S7: Overflow Forecast Based on the trained Phy-STNN model, the model predicts the water depth change process of manholes in the drainage network over a period of time by inputting the rainfall intensity sequence for future periods and the initial water depth of the manholes.
2. The drainage network overflow prediction method based on the Phy-STNN model according to claim 1, characterized in that: In step S1, the SWMM model is calibrated and verified based on historical rainfall data, and the Nash-Sutcliffe efficiency coefficient (NSE) is used as the accuracy evaluation index until NSE ≥ 0.
6. The Chicago rainfall pattern generator is used to generate a multi-scenario dataset according to the rainfall peak coefficient, return period and rainfall duration parameters. The multi-scenario dataset includes regular and extreme rainstorm scenarios.
3. The drainage network overflow prediction method based on the Phy-STNN model according to claim 2, characterized in that: In step S2, the PyG format dataset is constructed, organizing x, edge_index, edge_attr, and y in the PyTorch Geometric data format. Specifically: X: Node feature matrix Where N represents the total number of nodes, and F represents the feature dimension of each node; For each node i, i = 1, 2, …, N, its feature vector is represented as: Among them, h i Indicates historical water depth, measured in meters (m); intensity i Indicates rainfall intensity, in mm / min; edge_index: Edge connection matrix Where M represents the number of edges; each column of the matrix This indicates that there is an undirected edge between node i and node j; edge_attr: Edge feature matrix Where M represents the number of edges, and D represents the feature dimension of each edge; each edge m, m = 1, 2, …, M, has its feature vector represented as: Where, q in q represents the inflow rate of the pipe section. out The outflow rate of the pipe section is expressed in m. 3 / s; y represents the target predicted value, which is the water depth at each node in the pipeline network.
4. The drainage network overflow prediction method based on the Phy-STNN model according to claim 3, characterized in that: Step S3 specifically includes the following: ① The GNN model uses a normalized Laplacian matrix to achieve spatial feature aggregation: in, Let H be the feature matrix of the l-th layer nodes, and let H be the initial input. (0) =X; The adjacency matrix after adding self-loops, Defined as: for The degree matrix, diagonal elements ; W ( l ) Let L be the learnable weight matrix of the l-th layer; For activation functions; ② The LSTM time module includes a forget gate, input gate, candidate states, output gate, and cell states. It uses a unidirectional LSTM to capture time series features, and its gating mechanism is as follows: Forget Gate: Decides whether to retain information from the previous time step; Input gate: Determines the importance of the input at the current time step for updating new memories; Candidate state: Candidate memory information generated based on the current input and the hidden state of the previous time step; Updating a memory unit: The state of a unit is jointly determined by the previous memory through the forgetting gate and the current candidate memory through the input gate; Output gate: Determines the final output content at the current time step; Update hidden state: Activate the current cell state with tanh and gate it with the output gate to obtain the hidden state at the current moment; 。 5. The drainage network overflow prediction method based on the Phy-STNN model according to claim 4, characterized in that: λ1=0.5, λ2=0.3, λ3=0.
2.
6. The drainage network overflow prediction method based on the Phy-STNN model according to claim 5, characterized in that: In step S5, the configuration for training the Phy-STNN model includes a GNN. The GNN part includes a node embedding layer, a message passing layer, and a graph readout layer. The node embedding layer is used to perform high-dimensional representation of the original input features. It is implemented using a graph attention mechanism. The node embedding layer has three independent attention heads, each of which outputs 64-dimensional features. Finally, they are concatenated to form a 192-dimensional node embedding representation. The message passing layer adopts the GraphSAGE, Mean Aggregator structure to aggregate spatial adjacency information. The message passing layer compresses the node features output by the node embedding layer to 32 dimensions. The graph readout layer further reduces and integrates the local embedded representations of each node, outputting a 16-dimensional feature representation, and employs a residual connection mechanism.
7. The drainage network overflow prediction method based on the Phy-STNN model according to claim 6, characterized in that: It also includes an LSTM module for capturing dynamic features in time series, which uses a two-layer stacked dual-layer LSTM network with a Dropout layer introduced between the two layers. The dropout rate is set to 0.
2. The output of the second layer LSTM network is fed into a fully connected layer for water depth prediction output. Combined with the spatial embedding information of each node in the graph structure, spatiotemporal joint modeling and prediction are realized. The input to the first LSTM layer is the node embedding sequence of each time step output by the graph readout layer. The hidden layer dimension is set to 64. The first LSTM layer performs preliminary temporal feature extraction on the node embedding sequence to generate intermediate state representation. The second LSTM layer is used to further refine and compress the time dimension information. It receives the output of the first LSTM layer and the hidden layer dimension is set to 32.
8. The drainage network overflow prediction method based on the Phy-STNN model according to claim 7, characterized in that: Step S5 specifically includes the following: ① During the pre-training phase, the basic feature extraction capability of the model is initialized; Cold junction physical constraint layer, λ1=0, λ3=0, using Adam optimizer with a learning rate of 3×10⁻⁶. -4 Batch size 64, training for 100 epochs; ② Fine-tuning stage: Balancing data-driven approaches with physical laws; Unfreeze the physical constraint layer, initial weights λ1:λ2:λ3=5:3:2, learning rate 1×10 -4 Batch size 64, training for 50 epochs, with the λ2 weights increased by 0.1 every 5 epochs. ③ Enhanced robustness: Simulating scenarios with missing monitoring data; Throughout the training process, 30% of the pipeline connections were randomly masked and 15% of the node features were randomly discarded to simulate missing monitoring data.
9. The drainage network overflow prediction method based on the Phy-STNN model according to claim 8, characterized in that: Step S6 includes using the coefficient of determination R²≥0.85, mean absolute percentage error (MAPE), and root mean square error (RMSE) as evaluation metrics to compare the trained phy-stnn model with the physical model SWMM, the data-driven model GNN, and LSTM. The test scenarios include regular rainfall, extreme rainstorms, local pipeline network failures, and data loss.
Citation Information
Patent Citations
Municipal drainage pipe network state prediction method based on graph and deep learning
CN116227362A
Method for predicting urban drainage pipe network flow based on improved Transform neural network model
CN119783564A