A two-stage water supply network hydraulic model parameter checking method based on graph neural network

By employing a two-stage parameter verification method for the hydraulic model of the water supply network using graph neural networks, the contradiction between traditional optimization methods and real-time performance, as well as the parameter coupling problem, are resolved. This method achieves efficient and accurate calibration of the water supply network model and constructs a long-term robust and short-term adaptive digital twin model, supporting refined management and intelligent decision-making for the water supply network.

CN121118324BActive Publication Date: 2026-02-17TONGJI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511677657.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-17
Estimated Expiration
2045-11-17

AI Technical Summary

Technical Problem

Existing calibration techniques for hydraulic models of water supply networks suffer from several problems, including the contradiction between traditional optimization methods and real-time requirements, parameter coupling leading to an unsteady and inefficient calibration process, and the immature integration and application of data-driven methods. In particular, it is difficult to achieve the optimal values ​​simultaneously when optimizing quasi-static parameters and highly dynamic parameters at the same time.

Method used

A two-stage hydraulic model parameter verification method based on graph neural networks is adopted, including offline calibration of quasi-static parameters and online calibration of dynamic parameters. The pipeline roughness coefficient and user water demand are processed by graph attention network (GAT) and spatiotemporal graph attention network (STGAT) respectively. A collaborative calibration framework is constructed, and the data sparsity is simulated and dimensionality is reduced by using a masking mechanism.

Benefits of technology

It improves the efficiency and accuracy of real-time hydraulic model verification for water supply networks, establishes a unified model with long-term robustness and short-term adaptability, and can provide reliable digital twin model support under various operating conditions, meeting the needs of refined management and intelligent decision-making for water supply networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121118324B_ABST
    Figure CN121118324B_ABST
Patent Text Reader

Abstract

The application discloses a two-stage water supply pipe network hydraulic model parameter checking method based on a graph nerve, and belongs to the technical field of water supply pipe network model modeling and machine learning. The method is calibrated through "offline-online" cooperation. In the offline stage, the pipes are grouped according to the pipe material and pipe age, a parameter set is generated by sampling, monitoring data are obtained by EPANET simulation, a graph structure containing a masking mechanism (simulated data sparsity) is constructed, a GAT model is trained to invert the pipe roughness coefficient, and a benchmark is established. In the online stage, a weighted undirected graph is constructed based on topology, a community discovery algorithm is used to group nodes and generate a composite water demand mode, the node water demand is redefined as "daily demand x composite mode x scaling factor" for dimension reduction, an effective graph of the monitoring point is constructed, an STGAT model of "GAT+GRU" is trained, the sliding time window monitoring data are input to output the scaling factor, and dynamic calibration is completed. The application solves the problems of poor real-time performance and low parameter coupling efficiency of traditional calibration, and supports pipe network digital twinning and intelligent operation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of water supply network model modeling and machine learning, and particularly relates to a two-stage water supply network hydraulic model parameter checking method based on graph neural network. BACKGROUND

[0002] The water supply network is a key infrastructure to ensure the normal operation of the city, and the safety and reliability of its operation are crucial to public health and social and economic stability. The hydraulic model is an indispensable tool for realizing the fine planning and management of the pipe network, such as pipe network expansion evaluation, leakage detection, water quality monitoring and emergency scheduling. However, the prediction accuracy of the hydraulic model is highly dependent on the accuracy of its parameters. These parameters are mainly divided into two categories: one is the quasi-static parameter reflecting the long-term hydraulic characteristics of the pipe network, such as the pipe roughness coefficient; the other is the dynamic parameter reflecting the user water behavior, such as the node water demand, which will fluctuate dramatically with the day and night, season and user behavior.

[0003] At present, the calibration technology of the water supply network hydraulic model is in the transition period from traditional optimization to data-driven deep integration. On the one hand, the traditional optimization method represented by genetic algorithm and other meta-heuristic algorithms, combined with dimensionality reduction strategies such as parameter grouping and sensitivity analysis, has accumulated mature experience in improving the calibration efficiency of large-scale pipe networks. On the other hand, with the development of Internet of Things and sensor technology, the monitoring capability of the pipe network has been significantly enhanced, and the high-frequency real-time data of pressure, flow and other parameters provide a rich data basis for model calibration. Under this background, the data-driven method represented by machine learning and deep learning has become a new research frontier. In particular, the graph neural network has attracted much attention because it can naturally handle the topological graph structure of the water supply network.

[0004] Although the above-mentioned technology has made some progress, there are still several core problems that are difficult to overcome in practical application, mainly as follows: (1) There is a fundamental contradiction between traditional optimization methods and real-time requirements. Such methods are essentially computationally intensive offline optimization processes, and a single calibration can take several hours or even several days, which cannot meet the real-time calibration requirements of modern pipe network dynamic operation conditions. (2) Parameter coupling leads to ill-posed and low-efficiency calibration process. Most existing technologies try to simultaneously optimize the quasi-static parameters and high-dynamic parameters with different properties in the same framework, which not only increases the dimension and complexity of the optimization problem, making the model difficult to converge, but also makes the optimization process difficult to achieve the best due to the huge difference in time scale between the two parameters. (3) The integrated application of data-driven methods is not mature. Although graph neural networks perform well in single tasks, how to effectively combine them with traditional physical models and build a calibration framework that can handle parameters at different time scales simultaneously is still a technical challenge. Specifically, it is still necessary to continue to explore how to efficiently integrate models for learning long-term physical characteristics of pipe networks with models for capturing short-term operation rules and ensure smooth connection between data flow and logical flow. SUMMARY

[0005] The purpose of the present application is to provide a two-stage water supply pipe network hydraulic model parameter checking method based on graph neural network, to improve the efficiency and accuracy of real-time hydraulic model checking of water supply pipe network, and to be widely applied to various pipe networks.

[0006] To achieve the above-mentioned purpose, the present application provides a two-stage water supply pipe network hydraulic model parameter checking method based on graph neural network, including offline calibration of quasi-static parameters and online calibration of dynamic parameters, and the two stages form a cooperative calibration relationship through "offline output-online input". The specific steps are as follows:

[0007] S1: Generate simulation data set and graph structure: group the pipes of the water supply pipe network according to physical properties, systematically sample to generate parameter set, and obtain monitoring point data through hydraulic simulation; represent the simulation samples as a graph structure containing node features and edge features, and introduce a masking mechanism to simulate data sparsity;

[0008] S2: Train GAT model for parameter inversion: build a cascade network containing input module, GAT propagation module, graph-level representation module and parameter regression module, input the sparse graph data of S1, train the model through supervised learning, output the rough coefficient calibration value of the pipe, and use it as the initial benchmark for online calibration;

[0009] S3: Calibration variable dimension reduction and redefinition: based on the pipe network topology, a weighted undirected graph is constructed, the nodes are grouped and the composite water demand mode of each group is generated; the instantaneous water demand of the nodes is redefined as the daily average water demand, the product of the composite water demand mode and the scaling factor to be calibrated, and the calibration target is reduced to a low-dimensional scaling factor vector;

[0010] S4: Constructing an online calibration dedicated effective graph structure: compressing the full-size pipe network graph, the node set is limited to physical monitoring points, the edge set is limited to the hydraulic transmission path between monitoring points in the same connected component, and an effective graph is formed;

[0011] S5: Constructing STGAT model to realize dynamic calibration: constructing a STGAT model with "GAT layer + GRU layer" cascade, running on the effective graph in S4, inputting the monitoring data sequence in the sliding time window, extracting the spatiotemporal features and outputting the scaling factor calibration value at the current time, and calculating the instantaneous water demand of all nodes according to the formula in S3.

[0012] Preferably, step S1 specifically comprises:

[0013] S11: Grouping pipes according to pipe material and pipe age, setting the roughness coefficient of each group of pipes and the value range of large user water demand based on engineering experience, and combining sampling to generate tens of thousands of parameter sets;

[0014] S12: Inputting each parameter set into EPANET for hydraulic simulation to obtain pressure and flow data of each monitoring point, and each "parameter set + simulation data" constitutes a sample;

[0015] S13: Representing the sample as a graph structure , wherein is the node set, is the edge set, is the node feature matrix containing node elevation and demand type, is the edge feature matrix containing pipe length and diameter;

[0016] S14: Masking mechanism: only retaining the dynamic data of the pre-set monitoring points in the sample, and shielding the non-monitoring point data to simulate the sparsity of real monitoring data.

[0017] Preferably, the GAT model architecture of step S2 is specifically:

[0018] The input module receives the masked sparse graph data of S14;

[0019] The GAT propagation module adopts GATv2 convolution layer to capture the hydraulic correlation features between nodes;

[0020] The graph-level representation module adopts global average pooling to aggregate all node features into a graph-level feature vector representing the overall state of the pipe network;

[0021] The parameter regression module is an MLP, which inputs the graph-level feature vector and outputs the rough coefficient check value of the corresponding pipeline group.

[0022] Preferably, the attention coefficient calculation method of the GATv2 convolution layer is as follows:

[0023] For any node and neighbor nodes , the original attention coefficient is:

[0024] ;

[0025] Wherein: are the feature vectors of nodes respectively; are the independent learnable weight matrices of the query node and the key value node respectively; is the transpose weight vector for calculating the attention score; is a leaky rectified linear unit activation function, and the slope value is .

[0026] Preferably, the GAT propagation module further comprises multi-head attention and residual connection, specifically as follows:

[0027] Multi-head attention: 3-5 independent attention heads are used for parallel learning, and the outputs of each head are spliced and mapped to a unified dimension feature through a linear layer;

[0028] Residual connection: at the first layer of the GAT propagation module, according to the formula:

[0029] ;

[0030] to realize the residual fusion of the input feature and the feature after convolution, wherein is the input feature of the first l-1 layer, is the GATv2 convolution operation, is batch normalization;

[0031] After the residual connection, the ReLU activation function and the Dropout operation are used to prevent overfitting, and the output feature of the first l layer is obtained.

[0032] Preferably, the model training of step S2 adopts a hybrid loss function, specifically as follows:

[0033] Hybrid loss function ;

[0034] Wherein: is the mean square error loss of the predicted value and the true value; is the mean square error loss of the predicted value and the true value on the intra-sample variance; , For predicted values Compared with the true value The Pearson correlation coefficient;

[0035] These are non-negative weighting coefficients, and The range of values ​​is .

[0036] Preferably, step S3 specifically includes:

[0037] S31: Initial parameter setting: Use the pipe roughness coefficient output in step S2 as the initial reference value for online calibration;

[0038] S32: Node Grouping: Based on the pipeline network topology and physical attributes, a weighted undirected graph is constructed. Community discovery and monitoring point coverage correction are performed on non-water source nodes to obtain several end-user groups containing monitoring points.

[0039] S33: Composite Water Demand Pattern Generation: For each user group, based on the proportion of different types of users within the group, the baseline water demand pattern curves of each type of user are weighted and averaged to generate the 24-hour composite water demand pattern for that group. ;

[0040] S34: Redefining Calibration Variables: Reducing the online calibration target from the instantaneous water demand of all nodes to a "scaling factor" vector for each user group. ,node exist Instantaneous water demand at any given moment:

[0041] ;

[0042] in For nodes The average daily water demand, For user groups exist Scaling factor for time.

[0043] Preferably, the node grouping in step S32 is as follows:

[0044] S321: Construct a weighted undirected graph with edge weights. ;

[0045] For connecting nodes and The length of the pipe, This is the normalized diameter of the pipeline;

[0046] S322: Remove the water source nodes in the pipeline network, apply the Louvain community discovery algorithm to the subgraph formed by the remaining non-water source nodes, and obtain the initial user group;

[0047] S323: Identify “no-monitoring-point groups” within the network and merge each group into the nearest user group containing monitoring points based on the shortest path distance of the pipeline topology to form the final user group.

[0048] Preferably, the effective graph structure in step S4 is as follows:

[0049] The node set of the effective graph is strictly limited to all physical monitoring points in the original pipeline network model;

[0050] Construction of edge set of effective graph: Based on the topological connectivity of the original pipeline network, if there is at least one hydraulic path in the original pipeline network connecting two monitoring points, then an undirected edge is established between the two monitoring points.

[0051] Preferably, the STGAT model in step S5 specifically includes:

[0052] S51: Model Architecture: STGAT consists of a cascaded GAT layer and a GRU layer. The GAT layer is used to extract the spatial features of the monitoring data, and the GRU layer is used to integrate the time series features.

[0053] S52: Input Construction: The input is a continuous monitoring data sequence within a sliding time window, and the data shape is... B is the batch size, T is the time window length, and N is the number of monitoring points;

[0054] S53: Spatiotemporal feature extraction: On the effective graph, the monitoring data at each time step is used as node features and input into the GAT layer to obtain the spatial features of each time step; the spatial features of all time steps are stacked in chronological order and input into the GRU layer. The time dynamics are captured through the update gate and reset gate of the GRU, and the hidden state of the last time step is output as the spatiotemporal comprehensive feature.

[0055] S54: Parameter Verification: Input the spatiotemporal integrated features into the fully connected decoder, and output the scaling factor verification values ​​for each user group at the current time. .

[0056] Therefore, the present invention provides a parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks, which employs the above-described structure and has the following beneficial effects:

[0057] (1) This invention proposes an offline-online two-stage calibration framework, which effectively solves the fundamental contradiction between accuracy and efficiency in traditional methods. In the offline stage, this invention uses a graph attention network (GAT) to accurately calibrate quasi-static parameters (pipe roughness coefficient). By introducing a masking training mechanism, it can still accurately infer the parameters of the entire network under the condition of sparse monitoring data, thereby establishing a high-fidelity benchmark hydraulic model. This offline calibration process provides a guarantee for the long-term robustness of the model.

[0058] (2) This invention utilizes a Spatiotemporal Graph Attention Network (STGAT) to construct an online real-time calibration module, endowing the model with dynamic adaptive capabilities. This module significantly reduces the complexity of online computation by introducing dimensionality reduction strategies such as user clustering and effective graphs, enabling it to efficiently and accurately track and estimate the dynamic changes in user water demand in real time. This online calibration process ensures that the model can continuously adapt to real-world operating conditions, solving the problem of the disconnect between traditional static calibration models and actual operation.

[0059] (3) This invention achieves a balance between long-term robustness and short-term adaptability of the model by systematically integrating the advantages of physical mechanisms and data-driven approaches. The high-precision benchmark model established offline is combined with the dynamic adaptive capability achieved online to construct a digital twin model that can serve both long-term planning and design and support short-term emergency scheduling. This method not only improves the reliability and generalization ability of the model under various operating conditions but also provides key technical support for the refined management and intelligent decision-making of water supply networks.

[0060] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0061] Figure 1 This is a flowchart of a two-stage data-driven parameter verification method for hydraulic models of water supply networks based on graph neural networks;

[0062] Figure 2 This is a scatter plot of the pipeline roughness coefficient verification error during the offline verification stage in a specific implementation method.

[0063] Figure 3 This is a diagram illustrating the water demand verification effect of a representative node during the online verification phase in a specific implementation method.

[0064] Figure 4 This is a comparison chart of the verification effects of the specific implementation method and other verification methods. Detailed Implementation

[0065] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0066] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0067] Example

[0068] like Figure 1 As shown, this invention provides a parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks, comprising the following steps:

[0069] Step S1: Generate simulation dataset and graph structure. Systematically sample pipeline parameters to generate a large-scale parameter set and perform hydraulic simulation. Represent each simulation sample as graph structure data and apply a masking mechanism to simulate the sparsity of real monitoring data.

[0070] Step S2: Train the GAT model for parameter inversion. Construct and train a parameter inversion model based on a graph attention network. The model takes sparse monitoring point graph data as input, is trained through supervised learning, and outputs a check value for the pipeline coarsening coefficient.

[0071] Step S3: Dimensionality reduction and redefinition of calibration variables. Cluster the network nodes and generate composite water demand patterns for each cluster. The instantaneous water demand of each node is redefined as the product of the average daily demand, the composite pattern, and the scaling factor to be calibrated.

[0072] Step S4: Construct an effective graph structure specifically for online calibration. To meet real-time requirements, the full-size network diagram is compressed into an effective graph consisting only of monitoring points, focusing on the hydraulic conduction relationships between observable data.

[0073] Step S5: Construct a spatiotemporal graph attention network. The model runs on the effective graph, taking the monitoring data sequence within the sliding time window as input and outputting the "scaling factor" check value at the current moment.

[0074] Step S1 is as follows:

[0075] Step S11: Group the pipes according to pipe material and age, and set reasonable ranges for the roughness coefficient and water demand of large users for each group based on engineering experience. Tens of thousands of independent input parameter sets are generated by combining and sampling the parameter space.

[0076] Step S12: Input each generated parameter set into EPANET for hydraulic simulation to obtain the pressure and flow rates corresponding to each monitoring point. Each set of input parameters and its simulation output constitutes an independent sample.

[0077] Step S13: Represent the samples as a graph structure ,in For a set of nodes, For edge set, This is a node feature matrix containing node elevation and demand type. It is an edge feature matrix containing pipe length and diameter, including static attributes such as pipe length and diameter.

[0078] Step S14: To simulate the sparse characteristics of real monitoring points, a masking mechanism is introduced. That is, in model training, for each sample, only the simulated value of the preset monitoring point location is retained as a valid input, and the information of other non-monitoring point locations is masked, so that the model can learn to perform parameter inversion under the condition of data sparsity.

[0079] Step S2 is as follows:

[0080] Step S21: Design the model architecture. Construct a deep neural network as the parameter inversion model, consisting of an input module, a GAT propagation module, a graph-level representation module, and a parameter regression module cascaded together; wherein, the GAT propagation module uses GATv2 convolutional layers to enhance the model's expressive power.

[0081] Step S22: Feature Transformation and Attention Calculation. After inputting into the model, the original features of nodes and edges are mapped to a unified high-dimensional hidden space through independent linear projection layers; in the GATv2 convolutional layer, dynamic attention weights between nodes are calculated through a self-attention mechanism.

[0082] Step S23: Multi-head attention feature aggregation. A multi-head attention mechanism is adopted to learn and aggregate the feature information of neighboring nodes in parallel from multiple independent representation subspaces. Residual connections and batch normalization are combined to promote information flow and stabilize the training process, generating updated node feature representations.

[0083] Step S24: Graph-level representation generation and parameter regression. Using a global average pooling layer as the readout module, the features of all nodes are aggregated into a graph-level feature vector representing the overall state of the pipeline network. This vector is then input into an MLP regression head, whose output layer is a linear layer, which directly regresses and predicts the coarsening coefficient value for each pipeline group.

[0084] Step S25: Standardize the target values. To eliminate the impact of differences in the units of different parameters on model training, before training begins, the mean and standard deviation of all target parameters are calculated based on the training set, and a target value scaler is constructed to standardize the model's predicted and true values ​​before calculating the loss function.

[0085] Step S26: Model Training and Optimization. Supervised learning is adopted, and the model parameters are optimized by minimizing the mixture loss function, which combines the mean squared error, variance loss, and correlation loss between the predicted and true values. The AdamW optimizer, dynamic learning rate adjustment strategy, and gradient clipping are used to ensure the stability and convergence of training.

[0086] Step S22 is as follows:

[0087] GATv2 convolutional layers at computation nodes For nodes Original attention coefficient At that time, the transformations of the query vector and the key vector are separated.

[0088] ;

[0089] in These are nodes and eigenvectors, These are the independent learnable weight matrices for the query node and the key-value node, respectively. It is the transpose of the weight vector used to calculate the final attention score. This is a linear unit activation function with leakage correction.

[0090] Step S23 is as follows:

[0091] Step S231: In the GAT propagation module... Layer, the input features of this layer Residual connections are made with the new features after GATv2 convolution and batch normalization.

[0092] ;

[0093] Step S232: After residual connection, ReLU activation function and Dropout operation are used to introduce nonlinearity and prevent model overfitting, obtaining the final output features of this layer.

[0094] ;

[0095] Step S26 is as follows:

[0096] The hybrid loss function The calculation method is as follows:

[0097] ;

[0098] in It is the mean squared error loss between the predicted value and the actual value; It is the mean squared error loss of the predicted value versus the true value in terms of the in-sample variance; It is the correlation loss calculated based on the Pearson correlation coefficient, and its form is: This is to ensure that the model can correctly capture the changing trends of the target parameters; , which represents the non-negative weighting coefficients for each loss.

[0099] Step S3 is as follows:

[0100] Step S31: Initial parameter setting. The pipe group roughness coefficient obtained from the graph neural network model inversion in step S2 is used as the initial reference value for optimization calibration.

[0101] Step S32: Node Grouping. A weighted undirected graph is constructed based on the pipeline network topology and physical attributes. Community discovery and monitoring point coverage correction are performed on non-water source nodes, and all nodes are divided into several end-user groups with monitoring data coverage.

[0102] Step S33: Generate composite water demand pattern. For each user group identified in step S32, a single, comprehensive 24-hour composite water demand pattern curve is generated for that user group by weighted averaging of the baseline water demand pattern curves of different types of users within the group.

[0103] Step S34: Redefine the calibration variable. Reduce the dimensionality of the target variable for online calibration from the instantaneous water demand of all nodes and redefine it as a low-dimensional "scaling factor" vector. .

[0104] Step S32 is as follows:

[0105] Step S321: Abstract the pipeline network into a weighted undirected graph, where the weight of the edge connecting any two nodes is... It is set to be inversely proportional to the length of the connecting pipe and directly proportional to the pipe diameter.

[0106] ;

[0107] in It is the length of the connecting pipe. This is the normalized diameter of the pipeline;

[0108] Step S322: Temporarily remove all water source nodes from the graph, and apply the Louvain community discovery algorithm to partition only the subgraph composed of the remaining non-water source nodes to obtain the initial user group.

[0109] Step S323: Identify all “no-monitoring-point groups” that do not contain any pressure monitoring points, and merge each such user group into the nearest user group that contains monitoring points based on the shortest path distance on the pipeline topology to form the final user group.

[0110] Step S34 is as follows:

[0111] Instantaneous water demand of any node n at any time t Defined as:

[0112]

[0113] in It is the average daily water demand of node n. It is the value of user group g, to which node n belongs, on the composite water demand pattern curve at time t. It is the scaling factor that user group g needs to estimate in real time at time t, and it is the core objective of online model calibration.

[0114] Step S4 is as follows:

[0115] Step S41: Node set definition. The node set of the effective graph is strictly limited to the set of all physical monitoring points in the original pipeline network model.

[0116] Step S42: Definition of hydraulic conduction path and edge set. Based on the topological connectivity of the original pipeline network, an undirected edge is established between any two monitoring point nodes in the effective graph. The necessary and sufficient condition for establishing the edge is that the two monitoring point nodes have at least one hydraulic path consisting of pipes in the original pipeline network topology, that is, they belong to the same connected component.

[0117] Step S5 is as follows:

[0118] Step S51: Construct the model architecture. Construct a spatiotemporal graph neural network (STGNN) as an online real-time calibration model. This model uses cascaded graph attention network (GAT) layers and gated recurrent unit (GRU) layers to capture the spatiotemporal dynamics of the pipeline network hydraulic state.

[0119] Step S52: Model Input Construction. The continuous monitoring data sequence within the sliding time window is used as the model input, and the shape of the input data is... ,in, For batch size, The time window length, This represents the number of monitoring points.

[0120] Step S53: Spatiotemporal Feature Extraction. On the effective graph constructed in Step S4, the input data is processed by the STGNN model. At each time step, spatial features are extracted using the GAT layer, and then the time series information is integrated using the GRU layer to finally generate a comprehensive spatiotemporal feature vector.

[0121] Step S54: Real-time parameter verification. The spatiotemporal feature vector is input into a fully connected decoder, which directly outputs the scaling factor vector of the water demand pattern of each user group at the current time. The verification value.

[0122] Step S53 is as follows:

[0123] Step S531: Time-step spatial feature extraction. At each time step t within the time window T, extract the observation data of all monitoring points N at that moment. As the initial features of the nodes, and processed using the GAT layer,

[0124] Step S532: Time series information integration; output the GAT layer results for all time steps t. The hidden states are stacked sequentially to form a temporal feature tensor, which is then fed into the GRU layer. The GRU layer learns and captures the dynamic evolution pattern of this time series through its internal update and reset gates, ultimately outputting the hidden state of the last time step of the sequence. As a comprehensive representation of the entire spatiotemporal window.

[0125] This embodiment takes the MD town water supply network in Jiangsu, China as an example to further illustrate the implementation process of the two-stage data-driven hydraulic model parameter verification method based on graph neural networks.

[0126] Step S1: Generate Simulation Dataset and Graph Structure. Systematic sampling of pipeline network parameters generates a large-scale parameter set for hydraulic simulation. Each simulation sample is represented as graph-structured data, and a masking mechanism is applied to simulate the sparsity of real monitoring data. First, the parameters to be calibrated in the pipeline network model are systematically sampled to construct a large-scale parameter set. Specifically, based on the pipe material and age, 567 pipes are divided into 8 parameter groups to be calibrated. For each group of pipes, the roughness coefficient is set with 3 to 4 discrete values ​​within its physical range, with a step size of 5. Simultaneously, to simulate demand uncertainty, the baseline demand coefficients of major user nodes are randomly perturbed and sampled within the range [0.8, 1.2]. Subsequently, the above parameter combinations are input into EPANET for hydraulic simulation, generating a total of 57,600 samples. Each simulation sample is constructed as a graph-structured data set, where node features include elevation, pressure value, demand pattern category, etc., and edge features include pipe length, diameter, flow rate, etc. To simulate the sparsity of a limited number of monitoring points in the real world, a masking mechanism is applied to each graph sample, retaining only dynamic readings such as pressure and flow rate at preset monitoring point locations, while setting the corresponding dynamic feature values ​​of all non-monitoring points to 0. The final dataset takes the masked sparse graph as input and labels the roughness coefficient and water demand corresponding to that sample.

[0127] Step S2: Training the GAT model for parameter inversion. A parameter inversion model based on a graph attention network is constructed and trained. The model takes sparse monitoring point graph data as input and is trained through supervised learning, outputting the verification value of the pipe roughness coefficient. A deep neural network containing three GAT layers is constructed, with batch normalization, ReLU activation function, and Dropout added between layers to prevent overfitting. This model takes the sparse graph data generated in step S1 as input and is trained through supervised learning, outputting the roughness coefficient values ​​of all pipes. The model training uses a hybrid loss function including mean squared error and a penalty term, employing an early stopping strategy during training, automatically determining the optimal training epochs based on the loss changes on the validation set. In this embodiment, the model reaches optimal performance in the 63rd epoch, obtaining the final model for offline calibration. Testing shows that the roughness coefficient error of all pipes is less than 10, with 424 pipes (74.8%) having an error less than 5.0. The overall MAE for all pipes is 3.31 (e.g., ...). Figure 2 (As shown).

[0128] Step S3: Dimensionality Reduction and Redefinition of Calibration Variables. The network nodes are clustered, and a composite water demand pattern is generated for each cluster. The instantaneous water demand of each node is redefined as the product of the average daily demand, the composite pattern, and a scaling factor to be verified. First, the Louvain community detection algorithm is used to cluster all user nodes in the network, dividing the 480 nodes into 18 user partitions with similar hydraulic characteristics. Then, the demand patterns of all nodes within each partition are weighted and averaged to generate a composite water demand pattern curve representing that partition. Based on this, the instantaneous water demand of any node at any time is redefined as the product of three components: the node's average daily water demand, the value of the composite water demand pattern of its partition at that time, and a scaling factor representing the real-time demand fluctuation of that partition, to be verified online. Through this method, the goal of online calibration is simplified from estimating the independent demand of hundreds of nodes to estimating the scaling factor of 18 partitions, achieving a significant dimensionality reduction of the parameter space.

[0129] Step S4: Construct an effective graph structure specifically for online calibration. To meet real-time requirements, the full-size network diagram is compressed into an effective graph consisting only of monitoring points, focusing on the hydraulic conduction relationships between observable data. This effective graph is much smaller than the original network diagram (the number of nodes is reduced from 480 to 22 in this embodiment). It focuses on describing the spatiotemporal correlations between observable data, significantly reducing the computational complexity of subsequent models, which is key to achieving efficient online calibration.

[0130] Step S5: Construct a spatiotemporal graph attention network. The model runs on the effective graph, taking the monitoring data sequence within the sliding time window as input and outputting the "scaling factor" verification value at the current moment. The STGAT model runs on the effective graph constructed in step S4, taking the pressure, flow, and other data sequences uploaded by all monitoring points within the sliding time window (the past hour in this example) as input. The model captures the evolution of monitoring data in the time dimension and the mutual influence in the pipeline network topology space through its internal spatiotemporal attention mechanism. The model output is the verification value of the demand scaling factor for all user partitions at the current moment. Multiplying these verification values ​​by the daily average demand and composite pattern defined in step S3 allows for the real-time inference of the instantaneous water demand of all nodes in the entire network, thus completing the online dynamic calibration of the model. Tests are conducted under various typical operating conditions such as normal, winter, and summer, and the R-value between the water demand predicted by the model and the actual value is measured. 2 All remained above 0.90 (e.g. Figure 3 As shown in the figure, its high accuracy and strong robustness under different operating conditions are demonstrated. Furthermore, the model completes a calibration in only about 2.2 seconds, far less than the 5-minute data acquisition interval, fully meeting the requirements for real-time operation.

[0131] like Figure 4As shown, to verify the superiority of the method of this invention, a comparative analysis was conducted with existing calibration techniques using the same pipeline network topology under more stringent monitoring conditions. The comparative example employed a scheme based on sensitivity clustering combined with the Levenberg-Marquardt algorithm (SOC-LM). In the comparative example, even with parameters optimized to their best performance state (10 clusters), the MAE was still as high as 7.04, and only 69.0% of the pipeline calibration errors were below 10. In contrast, the method of this invention, with fewer monitoring points, achieved an MAE of only 3.31, far lower than the best result of the comparative example, and achieved excellent performance by controlling the calibration errors of all pipelines within 10, demonstrating higher calibration accuracy and error concentration. This result strongly demonstrates that even under conditions of sparser monitoring data, the method of this invention can still more accurately invert the physical parameters of the pipeline network, providing a more reliable technical means for constructing high-precision digital twin models, especially in complex scenarios simulating real engineering challenges, where its technical superiority is even more prominent.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks, characterized in that, The calibration process includes two stages: offline calibration of quasi-static parameters and online calibration of dynamic parameters. These two stages form a collaborative calibration relationship through "offline output - online input." The specific steps are as follows: S1: Generating simulation datasets and graph structures: Grouping water supply network pipelines according to physical attributes, systematically sampling to generate parameter sets, and obtaining monitoring point data through hydraulic simulation; representing simulation samples as graph structures containing node features and edge features, and introducing a masking mechanism to simulate data sparsity; S2: Training parameter inversion GAT model: Construct a cascaded network containing an input module, a GAT propagation module, a graph-level representation module and a parameter regression module. Input the sparse graph data of S1, train the model through supervised learning, and output the pipeline roughness coefficient check value as the initial benchmark for online calibration. S3: Calibration variable dimensionality reduction and redefinition: Based on the pipeline network topology, a weighted undirected graph is constructed, nodes are grouped and a composite water demand pattern is generated for each group; the instantaneous water demand of the nodes is redefined as the product of the average daily water demand, the composite water demand pattern and the scaling factor to be calibrated, and the calibration target is reduced to a low-dimensional scaling factor vector. S4: Construct a dedicated effective graph structure for online calibration: Compress the full-size network diagram, limit the node set to physical monitoring points, and limit the edge set to the hydraulic conduction paths between monitoring points within the same connected component to form an effective graph; S5: Constructing the STGAT model to achieve dynamic calibration: Constructing a cascaded STGAT model of "GAT layer + GRU layer", running on the effective graph of S4, inputting the monitoring data sequence within the sliding time window, extracting the spatiotemporal features and outputting the scaling factor verification value at the current moment, and calculating the instantaneous water demand of all nodes in combination with the formula of S3.

2. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 1, characterized in that, Step S1 specifically includes: S11: Group the pipes according to pipe material and pipe age, set the range of values ​​for the roughness coefficient and water demand of large users for each group of pipes based on engineering experience, and generate tens of thousands of parameter sets by combining sampling. S12: Input each set of parameters into EPANET for hydraulic simulation, and obtain pressure and flow data at each monitoring point. Each set of "parameter set + simulation data" constitutes one sample. S13: Represent the samples as a graph structure ,in For a set of nodes, For edge set, This is a node feature matrix containing node elevation and demand type. It is the edge feature matrix containing the pipe length and diameter; S14: Masking mechanism: Only retain the dynamic data of the preset monitoring points in the sample, and mask the data of non-monitoring points to simulate the sparsity of real monitoring data.

3. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 1, characterized in that, The specific architecture of the GAT model in step S2 is as follows: The input module receives the masked sparse graph data from S14; The GAT propagation module uses GATv2 convolutional layers to capture hydraulic correlation features between nodes; The graph-level representation module uses global average pooling to aggregate all node features into a graph-level feature vector that represents the overall state of the pipeline network. The parametric regression module is an MLP, which takes graph-level feature vectors as input and outputs roughness coefficient check values ​​for the corresponding pipeline groups.

4. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 3, characterized in that, The attention coefficients of GATv2 convolutional layers are calculated as follows: For any node with neighboring nodes Original attention coefficient: ; in: They are nodes eigenvectors; These are the independent learnable weight matrices for query nodes and key-value nodes, respectively. This is the transpose weight vector used to calculate the attention score; This is a linear unit activation function with leakage correction.

5. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 3, characterized in that, The GAT propagation module also includes multi-head attention and residual connections, specifically: Multi-head attention: 3-5 independent attention heads are used for parallel learning. The outputs of each head are concatenated and mapped to a feature of a unified dimension through a linear layer. Residual connection: in the GAT propagation module Layers, according to the formula: ; To achieve residual fusion of input features and convolutional features, where The input features are for the (l-1)th layer. For GATv2 convolution operations, For batch normalization; After residual connection, overfitting is prevented by ReLU activation function and Dropout operation to obtain the output features of the l-th layer.

6. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 1, characterized in that, The model training in step S2 uses a hybrid loss function, specifically: Hybrid loss function ; in: The mean squared error loss between the predicted and actual values; This represents the mean squared error loss between the predicted and actual values ​​on the in-sample variance. , For predicted values Compared with the true value The Pearson correlation coefficient; These are non-negative weighting coefficients, and .

7. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 1, characterized in that, Step S3 specifically includes: S31: Initial parameter setting: Use the pipe roughness coefficient output in step S2 as the initial reference value for online calibration; S32: Node Grouping: Based on the pipeline network topology and physical attributes, a weighted undirected graph is constructed. Community discovery and monitoring point coverage correction are performed on non-water source nodes to obtain several end-user groups containing monitoring points. S33: Composite Water Demand Pattern Generation: For each user group, based on the proportion of different types of users within the group, the baseline water demand pattern curves of each type of user are weighted and averaged to generate the 24-hour composite water demand pattern for that group. ; S34: Redefining Calibration Variables: Reducing the online calibration target from the instantaneous water demand of all nodes to a "scaling factor" vector for each user group. ,node exist Instantaneous water demand at any given moment: ; in For nodes The average daily water demand, For user groups exist Scaling factor for time.

8. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 7, characterized in that, The node grouping in step S32 is as follows: S321: Construct a weighted undirected graph with edge weights. ; For connecting nodes and The length of the pipe, This is the normalized diameter of the pipeline; S322: Remove the water source nodes in the pipeline network, apply the Louvain community discovery algorithm to the subgraph formed by the remaining non-water source nodes, and obtain the initial user group; S323: Identify "no-monitoring-point groups" within the network that have no monitoring points. Based on the shortest path distance in the pipeline topology, merge each no-monitoring-point group into the nearest user group containing monitoring points to form the final user group.

9. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 1, characterized in that, The effective graph structure in step S4 is as follows: The node set of the effective graph is strictly limited to all physical monitoring points in the original pipeline network model; Construction of edge set of effective graph: Based on the topological connectivity of the original pipeline network, if there is at least one hydraulic path in the original pipeline network connecting two monitoring points, then an undirected edge is established between the two monitoring points.

10. The parameter verification method for a two-stage water supply network hydraulic model based on graph neural networks according to claim 1, characterized in that, The STGAT model in step S5 specifically includes: S51: Model Architecture: STGAT consists of a cascaded GAT layer and a GRU layer. The GAT layer is used to extract the spatial features of the monitoring data, and the GRU layer is used to integrate the time series features. S52: Input Construction: The input is a continuous monitoring data sequence within a sliding time window, and the data shape is... B is the batch size, T is the time window length, and N is the number of monitoring points; S53: Spatiotemporal feature extraction: On the effective graph, the monitoring data at each time step is used as node features and input into the GAT layer to obtain the spatial features of each time step; the spatial features of all time steps are stacked in chronological order and input into the GRU layer. The time dynamics are captured through the update gate and reset gate of the GRU, and the hidden state of the last time step is output as the spatiotemporal comprehensive feature. S54: Parameter Verification: Input the spatiotemporal integrated features into the fully connected decoder, and output the scaling factor verification values ​​for each user group at the current time. .

Citation Information

Patent Citations

  • Gas pipe network fault positioning method based on space-time diagram neural network

    CN120332686A

  • Two-stage checking method for node water demand and pipe section friction resistance coefficient of water supply network

    CN120373197A