CN117034808A - Natural gas pipe network pressure estimation method based on graph attention network - Google Patents

Natural gas pipe network pressure estimation method based on graph attention network Download PDF

Info

Publication number
CN117034808A
CN117034808A CN202311056741.7A CN202311056741A CN117034808A CN 117034808 A CN117034808 A CN 117034808A CN 202311056741 A CN202311056741 A CN 202311056741A CN 117034808 A CN117034808 A CN 117034808A
Authority
CN
China
Prior art keywords
network
natural gas
node
pipeline
pressure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311056741.7A
Other languages
Chinese (zh)
Inventor
马鹏岳
吕海舟
赵阳
吴昀
鲁洁
周凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Jiaxing Research Institute of Zhejiang University
Original Assignee
Zhejiang University ZJU
Jiaxing Research Institute of Zhejiang University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU, Jiaxing Research Institute of Zhejiang University filed Critical Zhejiang University ZJU
Priority to CN202311056741.7A priority Critical patent/CN117034808A/en
Publication of CN117034808A publication Critical patent/CN117034808A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/28Design optimisation, verification or simulation using fluid dynamics, e.g. using Navier-Stokes equations or computational fluid dynamics [CFD]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2113/00Details relating to the application field
    • G06F2113/08Fluids
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2119/00Details relating to the type or aim of the analysis or the optimisation
    • G06F2119/14Force analysis or force optimisation, e.g. static or dynamic forces

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Pure & Applied Mathematics (AREA)
  • Algebra (AREA)
  • Geometry (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Software Systems (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Biomedical Technology (AREA)
  • Pipeline Systems (AREA)
  • Fluid Mechanics (AREA)

Abstract

The invention provides a natural gas pipeline network pressure estimation method based on a graph attention network. The method comprises three steps of training data generation, model off-line training and model on-line testing. The training data generation is to collect pipe network simulation data and perform data processing operations such as data preprocessing, graph structure conversion and the like; the model offline training is to train a natural gas pipeline network pressure estimation model based on a graph attention network by using the data; the model online test refers to the application of the trained model in a test pipe network. The method adopts the attention layer to extract and calculate the graph characteristics, adopts the full-connection layer to strengthen the nonlinear fitting capability, and has the advantages of high precision, high calculation efficiency and strong generalization capability.

Description

Natural gas pipe network pressure estimation method based on graph attention network
Technical Field
The invention belongs to the field of natural gas hydraulic calculation, relates to a natural gas pipe network pressure calculation technology based on a graph neural network, and particularly relates to a natural gas pipe network pressure estimation technology based on a graph attention network.
Background
The natural gas pipe network hydraulic calculation method can be divided into a knowledge driving method and a data driving method, wherein the knowledge driving method can be classified into three types: graphic, analytical and numerical methods. In this case, the numerical solution achieves a better accuracy. According to the method, firstly, a natural gas flow differential equation is written, then the natural gas flow differential equation is converted into a differential equation, and the differential equation is solved in an iteration mode, so that an accurate solution of each differential point is obtained. However, such knowledge driven natural gas hydraulic calculation methods require an iterative solution process, and when facing complex natural gas network calculation tasks, the calculation overhead requirements are very high. While the simplified knowledge-driven approach reduces computational overhead, it loses information about the actual model itself. Therefore, how to improve the solving speed under the condition of meeting the requirement of calculation precision has important scientific value and engineering significance.
The data driving method based on the neural network has the advantages of high solving speed and high precision in solving complex physical problems. In the hydraulic calculation field of natural gas pipe networks, partial researchers replace natural gas pipes with feedforward neural networks, and the neural networks are mutually spliced to construct a model of the whole pipe network, so that simulation calculation is performed. However, this method has a problem of error accumulation between pipes, and the model is applicable to only a single object. The graph neural network is used as a calculation and classification model for graph structures, has good calculation precision and generalization capability, and has great potential in solving the problem. Therefore, developing a graph neural network calculation model suitable for a natural gas pipe network is a promising invention direction.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a natural gas pipeline network pressure estimation method based on a graph attention network, which has high performance and generalization.
The technical scheme adopted by the invention is as follows:
a natural gas pipeline network pressure estimation method based on a graph attention network comprises the following steps:
s1, constructing pipe network models aiming at different natural gas pipe networks, and respectively performing computational fluid dynamics simulation based on node pressure and standard condition instantaneous flow actually recorded by each natural gas pipe network end metering sensor to obtain a pipe network simulation data set corresponding to each natural gas pipe network;
s2, each natural gas pipe network is respectively converted into a graph structure, nodes of the graph are pipeline ends and tee joints in the pipe network, the node where the metering sensor is located is used as a known node, the other nodes are unknown nodes, and edges of the graph are pipelines between the nodes; for each graph structure, carrying out initial assignment on nodes and edges based on a corresponding pipe network simulation data set to form a first training sample, wherein node data of known nodes are pressure and standard instantaneous flow at the nodes in the pipe network simulation data set, the pressure of each unknown node is the average value of the pressures of all known nodes, the standard instantaneous flow of each unknown node is set to be 0, the edge data of each edge is the length and the inner diameter of a normalized pipeline, and each graph constructs a connection matrix according to the direct connection relation between the nodes in a natural gas pipe network;
s3, constructing a pipeline model of a single natural gas pipeline, and carrying out computational fluid dynamics simulation on the flow condition in the pipeline by setting different working condition information comprising pipeline parameters and pressures at two ends of the pipeline to obtain pipeline simulation data sets under different working conditions; extracting working condition information as sample input and extracting pipeline flow value as sample output aiming at the simulation data under each working condition in the pipeline simulation data set, thereby constructing a second training sample;
s4, training a natural gas pipeline flow estimation model based on a back propagation neural network by using a second training sample, and further training a natural gas pipeline pressure estimation model based on a graph attention network by using a first training sample; the total loss function during the training of the natural gas pipe network pressure estimation model is a weighted sum of the pressure loss of an unknown node, the flow loss of the known node and the physical limit loss of the pressure difference at two ends of the known pipeline, wherein the flow loss of the known node calculates a flow predicted value by the trained natural gas pipe network flow estimation model and provides a supervision signal by the flow known value of the same node;
s5, converting the target natural gas pipe network into a graph structure, carrying out initial assignment on nodes and edges in the graph structure by using pressure detected by existing metering sensors in the pipe network and standard condition instantaneous flow data, inputting the assigned graph into the trained natural gas pipe network pressure estimation model, and predicting to obtain the in-pipe pressure values of all unknown nodes in the target natural gas pipe network.
Preferably, the pipe network simulation data set and the pipeline simulation data set are required to cover different working conditions in the actual running process, and normalization processing is required to be carried out on the data when training samples are constructed according to the two data sets so as to meet the requirement of model input.
Preferably, the connection matrix is used for recording a direct connection relation between nodes in the natural gas pipe network, the number of rows of the matrix is 2, and the number of columns is twice the number of edges in the graph structure; when the connection matrix is constructed, the nodes contained in the graph structure are firstly ordered and numbered, and then two adjacent columns in the connection matrix are utilized to record the starting node and the ending node corresponding to two different flow directions of each pipeline.
Preferably, the graph attention network used as the natural gas network pressure estimation model consists of a plurality of graph attention layers and fully connected layers; in each layer of graph annotation force layer, each node updates node information by the following formula:
wherein: x is x i '、x i Representing node data after and before updating of the node i,e is a set of adjacent nodes of node i ij To connect node i and node j's edge data, W 1 、W 2 、W 3 The sigma is a sigmoid activation function for a parameter matrix to be trained; alpha ij The calculation formula is as follows:
wherein: w (W) 4 、W 5 、W 6 Is a parameter matrix to be trained.
The fully connected layer annotates node data x output by the force layer with the last layer of drawing i ' as input, the node output is obtained by:
y i =σ(W 7 x i '+b)
wherein: w (W) 7 And b is a bias term for a parameter matrix to be trained.
Preferably, in the back propagation neural network used as the natural gas pipeline flow estimation model, the flow Q of the pipeline between two known nodes is calculated by the following formula:
Q=σ(W 8 p+b)
wherein: w (W) 8 For the parameter matrix to be trained, p is normalized working condition information corresponding to the current calculation pipeline, and comprises initial node pressure, end node pressure, differential pressure at two ends of the current calculation pipeline, evolution of differential pressure at two ends of the current calculation pipeline and current calculationThe pipe length and the current calculated pipe inner diameter.
Preferably, the total loss function form of the natural gas pipe network pressure estimation model during training is as follows:
wherein: y is i A pressure simulation value for a single unknown node determined by computational fluid dynamics simulation;a pressure predicted value of a single unknown node output by the natural gas pipeline network pressure estimation model; n is the number of unknown nodes in the natural gas network; q (Q) j The actual flow of a single known node is obtained by the standard condition instantaneous flow actually recorded by a measuring sensor at the tail end of the natural gas pipeline network; />The predicted flow of a single known node is obtained by predicting a trained natural gas pipeline flow estimation model according to the working condition information of pipelines connected with the known node; m is the number of known nodes in the natural gas network; p is p k Pressure simulation values for a single known node determined by computational fluid dynamics simulation; p's' k The pressure prediction value of the node which is directly connected with the known node is output for the natural gas pipeline network pressure estimation model; reLU is a ReLU activation function; alpha is a weight super parameter.
Preferably, the super parameters in the back propagation neural network and the graph annotation meaning network are optimized in advance, the training set and the verification set are divided in advance, the model is trained on the training set, and the super parameters of the model are optimized with the aim of minimum total loss function value of the verification set, so that a group of optimal super parameters are obtained.
Preferably, the super-parameters of the back propagation neural network include hidden layer number, neuron number, learning rate and learning round.
Preferably, a Bayesian optimization algorithm is used for optimizing the super-parameters of the model to obtain the optimal super-parameters.
Preferably, the node pressure and the standard condition instantaneous flow actually recorded by the end metering sensor in the natural gas pipe network are acquired by a data acquisition and monitoring control System (SCADA).
Compared with the prior art, the natural gas pipe network pressure estimation method based on the graph attention network has the advantages that:
compared with the traditional knowledge driving method, the method has the advantage that the calculation performance is improved on the premise of keeping the calculation precision. Compared with the traditional data driving method, the method does not adopt each pipeline to calculate independently and sequentially, so that the phenomenon of error accumulation in the calculation process is avoided; the graphic neural network layer of the method can extract graphic structural features, has stronger generalization capability, and can calculate without retraining when the structures of the test object and the training object are different; the method designs a loss function more in accordance with a physical rule aiming at the hydraulic calculation characteristics of the natural gas pipe network, so that the model has higher convergence rate and calculation accuracy.
Drawings
Fig. 1 is a flowchart of an estimation method according to the present invention.
FIG. 2 is a schematic diagram of a training network and a test network according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a pressure estimation model of a natural gas pipe network according to an embodiment of the present invention.
Detailed Description
The following describes embodiments of the present invention in detail with reference to the accompanying drawings, and the embodiments and specific operation procedures are given in the present invention on the premise of the technical solution of the present invention, but the scope of protection of the present invention is not limited to the following embodiments.
As shown in FIG. 1, the natural gas pipe network pressure estimation method based on the graph attention network provided by the invention comprises three steps of training data generation, model offline training, model online testing or application.
The training data generation means that a simulation data set containing a large number of pipe network and pipeline simulation results is obtained by changing the working condition of a simulation model, and the scale difference among different variables of the data set is large and normalization processing is needed. And a graph structure data set of the pipe network and a table structure data set of the pipe are constructed through data structure conversion, wherein the data sets are the basis of model training.
Model offline training refers to building a pressure estimation method that includes a graph attention layer and a fully connected layer. The graph attention layer realizes feature extraction on the network graph by a variable-weight data aggregation method, and the full-connection layer further strengthens the nonlinear fitting capability of the method by full-connection operation of a current value and a target value. The training set and the verification set are randomly divided according to a certain proportion, and the estimation accuracy of the method is optimized by adjusting the super parameters.
The model online test or application refers to online calculation of unknown node pressure by using a trained pressure estimation model after carrying out data processing and graph structure conversion which are the same as training data on a test pipe network or an actual pipe network to be estimated. Because the method learns the information aggregation relation among the nodes, the method is still applicable under the condition that the structures and dimensions of the test pipe network and the training pipe network are inconsistent.
The following describes the specific implementation manner of three steps of training data generation, model offline training and model online testing of the natural gas pipeline network pressure estimation method based on the graph attention network according to a preferred embodiment of the present invention.
Step 1, training data generation
1.1, constructing pipe network models aiming at different natural gas pipe networks, and respectively performing Computational Fluid Dynamics (CFD) simulation based on node pressure and standard condition instantaneous flow actually recorded by each natural gas pipe network end metering sensor to obtain a pipe network simulation data set corresponding to each natural gas pipe network.
1.2, respectively converting each natural gas pipe network into a graph structure, wherein nodes of the graph are pipeline ends and tee joints in the pipe network, the node where the metering sensor is located is used as a known node, the other nodes are unknown nodes, and edges of the graph are pipelines between the nodes; and carrying out initial assignment on nodes and edges on the basis of a corresponding pipe network simulation data set for each graph structure to form a first training sample, wherein the node data of known nodes are the pressure and the standard condition instantaneous flow at the node in the pipe network simulation data set, the pressure of each unknown node is the average value of the pressures of all known nodes, the standard condition instantaneous flow of each unknown node is set to be 0, the edge data of each edge is the length and the inner diameter of a normalized pipeline, and each graph constructs a connection matrix according to the direct connection relation between the nodes in the natural gas pipe network.
It should be noted that, the above connection matrix is used for recording the direct connection relationship between nodes in the natural gas pipe network, the number of rows of the matrix is 2, and the number of columns is twice the number of edges in the graph structure. When the connection matrix is constructed, the nodes contained in the graph structure are firstly ordered and numbered, and then two adjacent columns in the connection matrix are utilized to record the starting node and the ending node corresponding to two different flow directions of each pipeline. The connection matrix is also entered into the model as part of the graph data.
1.3, constructing a pipeline model of a single natural gas pipeline, and carrying out computational fluid dynamics simulation on the flow condition in the pipeline by setting different working condition information comprising pipeline parameters and pressures at two ends of the pipeline to obtain a pipeline simulation data set under different working conditions; and extracting working condition information as sample input and extracting pipeline flow value as sample output aiming at the simulation data under each working condition in the pipeline simulation data set, thereby constructing a second training sample.
It should be noted that, in order to expand the representativeness of the training samples as much as possible, the pipe network simulation data set and the pipe simulation data set need to cover different working conditions in the actual running process. Taking a pipe network simulation data set as an example, the same natural gas pipe network can adjust different working condition parameters of the same natural gas pipe network, then respectively carry out computational fluid dynamics simulation, the corresponding obtained pipe network simulation data set can be used for assigning values to a graph structure to form different first training samples, and the pipeline simulation data are identical. In addition, in order to ensure that the difference of the data value ranges of the model input is not excessive, normalization processing is needed to be carried out on the data when training samples are constructed according to two simulation data sets so as to meet the requirement of the model input, and the method is preferably realized in a maximum and minimum normalization mode.
Therefore, as an implementation manner of the embodiment of the present invention, the specific sub-steps of generating the training data in the step 1 are shown in S11 to S111:
s11, acquiring gas data and design data for the natural gas pipe network from a natural gas data acquisition and monitoring control System (SCADA) system, and constructing a natural gas pipe network model in simulation software.
S12, generating simulation cases under different working conditions according to the actual natural gas pipe network operation conditions, wherein each simulation case corresponds to an actual natural gas pipe network and an operation condition. In each simulation case, corresponding simulation is required to be carried out on the basis of the node pressure and the standard condition instantaneous flow actually recorded by each metering sensor in the gas data of the natural gas pipe network, so that the simulation values of the pressure and the standard condition instantaneous flow at the nodes are ensured to be consistent with the actual values. In the present invention, the metering sensors for monitoring pressure and instantaneous flow of the standard condition are both located at the end of the natural gas network. And extracting the pressure and standard instantaneous flow data of each node in the pipe network from the simulation results of different simulation cases, thereby obtaining a pipe network simulation data set.
S13, respectively carrying out normalization processing on each variable parameter in the pipe network simulation data set to obtain a pipe network simulation data set after normalization processing, wherein the normalization mode is carried out according to the following formula;
wherein z is i Z is the parameter value before normalization i ' is the normalized parameter value. z min 、z max Is the minimum and maximum value of the variable.
S14, carrying out graph structure conversion on each actual natural gas pipe network, enabling the tee joint of the pipeline and the tail end of the pipeline to be nodes of a graph, enabling the pipeline to be edges of the graph, and converting the actual pipe network into a graph structure consisting of the nodes and the edges.
And S15, defining node data of the graph, enabling points with metering sensors to serve as known nodes, enabling other points to serve as unknown nodes, enabling the node data of the known nodes to serve as pressure and standard condition instantaneous flow at the nodes in the pipe network simulation data, enabling the node data of each unknown node to also comprise two dimensions of the pressure and the standard condition instantaneous flow, setting the pressure of each unknown node to be the average value of the pressures of all the known nodes, and setting the standard condition instantaneous flow of each unknown node to be 0. Thus, for each graph structure, initial assignment is performed on the nodes and edges according to the definition based on the corresponding pipe network simulation data set, so as to form a first training sample. Different first training samples may be generated from the simulation data sets of different pipe networks and different conditions. Thus, in each first training sample, the graph structure is consistent with the actual natural gas network, and the node data with the known nodes with metering sensors is consistent with the actual monitoring values, and the unknown nodes are directly initialized so as to be conveniently predicted by the model. The simulation data set of the pipe network is simulated and also has node data of the unknown nodes, so that simulation values of pressure and standard instantaneous flow can be used as truth labels in model training.
S16, in each first training sample, besides the graph structure and the node data, edge data of the graph are required to be defined, the edge data comprise normalized pipeline length and inner diameter, and the two parameters can be determined according to design parameters of a pipe network.
S17, in each first training sample, a connection matrix is also required to be constructed to record the direct connection relation between nodes in the natural gas pipe network, and the construction mode is as follows: the nodes of the graph are sequenced and numbered, a connection matrix with the number of rows being 2 and the number of columns being twice the number of edges in the graph is constructed according to the connection condition, the first row of the matrix serves as the starting node of each edge, and the second row of the matrix serves as the ending node;
and S18, establishing a pipeline model of a single natural gas pipeline in simulation software, and generating simulation data of the pipeline.
S19, forming different working condition information by changing the length, the pipe diameter parameters and the pressure at two ends of the pipeline according to the running condition of an actual pipe network based on the constructed pipeline model, performing CFD simulation on the pipeline model under different working condition information, generating simulation cases under different working conditions, recording the pipeline flow, the pressure at two ends and other data, and obtaining a pipeline simulation data set. And extracting working condition information as sample input aiming at simulation data under each working condition in the pipeline simulation data set, wherein the working condition information comprises starting node pressure, ending node pressure, differential pressure of two ends of a current calculation pipeline, evolution of differential pressure of two ends of the current calculation pipeline, length of the current calculation pipeline and inner diameter of the current calculation pipeline, and extracting pipeline flow value as sample output at the same time, so as to construct a second training sample. Note that when constructing the second training sample based on the pipeline simulation dataset, normalization processing is also required to meet the input requirements of the model.
S111, randomly dividing the normalized first training sample set and the normalized second training sample set into a training set and a verification set according to the ratio of 8:2, and using the training set and the verification set for subsequent model offline training.
Step 2, offline training of model
The natural gas pipeline flow estimation model based on the Back Propagation (BP) neural network is trained by using the second training sample, and then the natural gas pipeline pressure estimation model based on the graph attention network is further trained by using the first training sample. The total loss function during the training of the natural gas pipeline network pressure estimation model is a weighted sum of the pressure loss of an unknown node, the flow loss of the known node and the physical limit loss of the pressure difference at two ends of the known pipeline, wherein the flow loss of the known node calculates a flow predicted value by the trained natural gas pipeline flow estimation model and provides a supervision signal by the known flow value of the same node.
It should be noted that, the loss of physical limitation of the differential pressure across the known pipe is that the pressure across the pipe is physically limited by the pointer to the pipe where each known node is located, i.e., the pressure at the inlet end of the pipe must be higher than the pressure at the outlet end. In the case of forward estimation of the neural network model, it is possible to predict the situation where the inlet-outlet pressure is lower than or equal to the outlet-outlet pressure, which is not in line with the actual physical constraint, and thus it is necessary to construct a loss term for this situation to guide the model to predict the actual outcome.
Therefore, as an implementation manner of the embodiment of the present invention, the specific sub-steps of the model offline training described in the above step 2 are shown in S21 to S24:
s21, constructing a natural gas pipeline network pressure estimation model based on the graph attention network.
The drawing attention network consists of a plurality of drawing attention layers and full connection layers, wherein the number of layers of a specific drawing attention layer belongs to an optimizable super parameter. In each layer of graph annotation force layer, each node updates node information by the following formula:
wherein: x is x i '、x i Respectively representing node data after and before updating of node i, x i The upper right corner mark represents the parameter of the next time step;e is a set of adjacent nodes of node i ij To connect node i and node j's edge data, W 1 、W 2 、W 3 For the parameter matrix to be trained, σ is the sigmoid activation function, the formula is +.>
α ij The calculation formula is as follows:
wherein: w (W) 4 、W 5 、W 6 Is a parameter matrix to be trained.
S22, node data x output by the full-connection layer through the last layer of graph annotation force layer i ' as input, byOutput to node:
y i =σ(W 7 x i '+b)
wherein: w (W) 7 For the parameter matrix to be trained, b is the bias term, y i Representing the predicted value of the pressure output by node i.
S23, constructing a natural gas pipeline flow estimation model based on a back propagation neural network, wherein the model carries out pipeline flow calculation connected with known points through the following formula;
Q=σ(W 8 p+b)
wherein W is 8 And p is an input vector of a pipeline flow calculation model for a parameter matrix to be trained, namely normalized working condition information corresponding to the current calculation pipeline, and comprises a start node pressure, an end node pressure, differential pressure at two ends of the current calculation pipeline, an evolution of differential pressure at two ends of the current calculation pipeline, the length of the current calculation pipeline and the inner diameter of the current calculation pipeline. It should be noted that the above-mentioned several parameter variables are selected as input vectors, which are determined according to the flow theoretical calculation equation of the pipeline, and the characteristics related to the pipeline flow are selected as model inputs, and the flow values are output as models.
S24, training the natural gas pipeline flow estimation model based on the back propagation neural network by using a training set of the second training sample, wherein a loss function in training adopts MSE loss. And updating each optimizable parameter matrix and bias to be trained of the model by a gradient descent algorithm according to the total loss function value in the direction of maximum gradient.
S24, providing a supervision signal by using the trained natural gas pipeline flow estimation model, and further training the natural gas pipeline network pressure estimation model based on the graph attention network constructed in S21 by using the training set of the first training sample. During training, a total loss function of an output value and a true value of the pressure estimation model is required to be calculated, and according to the total loss function value, each optimizable parameter to be trained of the model is updated through a gradient descent algorithm in the direction of maximum gradient, wherein the calculation formula of the total loss function is as follows;
wherein y is i A pressure simulation value for a single unknown node determined by computational fluid dynamics simulation;a pressure predicted value of a single unknown node output by the natural gas pipeline network pressure estimation model; n is the number of unknown nodes in the natural gas network; q (Q) j The actual flow of a single known node is obtained by the standard condition instantaneous flow actually recorded by a measuring sensor at the tail end of the natural gas pipeline network; />The method comprises the steps that the predicted flow of a single known node is obtained by predicting a trained natural gas pipeline flow estimation model according to working condition information of pipelines connected with the known node, wherein the pipeline connected with the known node is a section of pipeline directly connected with the known node, the known node is an end node of a pipe network, so that the pipeline directly connected with the known node is only 1 section, and node pressure information in the working condition information of the pipeline can be obtained from a prediction result of the natural gas pipeline network pressure estimation model; m is the number of known nodes in the natural gas network; p is p k Pressure simulation values for a single known node determined by computational fluid dynamics simulation; p's' k The pressure prediction value of the node which is directly connected with the known node is output for the natural gas pipeline network pressure estimation model; reLU is a ReLU activation function; alpha is a weight super parameter.
In addition, because a large number of super parameters exist in the back propagation neural network and the graph attention network, when the method is actually applied, a training set and a verification set can be divided in advance, a model is trained on the training set, and the super parameters of the model are optimized with the aim of minimum total loss function value of the verification set, so that a group of optimal super parameters are obtained. The super parameters of different models are different, and take a back propagation neural network as an example, and the super parameters comprise the number of hidden layers, the number of neurons, the learning rate and the learning rounds. The super-parameter optimization algorithm can use a Bayesian optimization algorithm, namely, a model is trained on a training set, the minimum loss of a verification set is used as a target, and the super-parameters of the network layer number, the neuron number, the learning rate and the learning rounds of the natural gas pipeline pressure estimation model and the natural gas pipeline flow estimation model are optimized by using a leaf optimization algorithm, so that a group of optimal super-parameters is finally obtained.
Step 3, model on-line test or application
After the natural gas pipe network pressure estimation model is obtained through training, a target natural gas pipe network in practical application or a natural gas pipe network in test concentration can be converted into a graph structure, initial assignment is carried out on nodes and edges in the graph structure by using pressure detected by existing metering sensors in the pipe network and standard condition instantaneous flow data, the assigned graph is input into the natural gas pipe network pressure estimation model through training, and the intra-pipe pressure values of all unknown nodes in the target natural gas pipe network are predicted.
It should be noted that, in this step, the specific graph structure and the initial assignment manner of the nodes and edges in the graph structure are consistent with the foregoing training sample, and will not be described again.
Therefore, taking a test set as an example as an implementation manner of the embodiment of the present invention, the specific sub-steps of the model online test described in the above step 3 are shown in S31 to S34:
s31, acquiring gas consumption data and design data of a natural gas test pipe network.
S11, S32, carrying out normalization processing on the test pipe network simulation data set to obtain a normalized test pipe network data set; and carrying out the graph structure conversion processing on the test tube network data set, defining node data, edge data and a connection matrix, and constructing a natural gas pipe network test data set, wherein each test sample is identical to the first training sample in form.
S33, testing the trained natural gas pipeline network pressure estimation model on a natural gas pipeline network test data set to obtain the pressure of an unknown node in the test model, and further evaluating the estimation performance of the natural gas pipeline network pressure estimation model.
It should be noted that if the above step 3 of the present invention is directed to a network to be estimated, which is not a test sample, but is actually an actual network to be estimated, the known node data of the network is derived from the node pressure and the standard instantaneous flow actually recorded by the end metering sensor in the natural gas network, and the node pressure and the standard instantaneous flow are obtained by the data acquisition and monitoring control System (SCADA), but the input form of the finally constructed model is also required to be consistent with the first training sample.
To further demonstrate the advantages of the above-described natural gas pipeline network pressure estimation method based on graph attention network of the present invention, it is applied to a specific scenario example below to demonstrate the technical effects thereof.
Examples
In this embodiment, aspen HYSYS software is used to build a training pipe network and a test pipe network, where the training pipe network includes three structures, 19, 17, and 5 nodes, and the test pipe network includes 15 nodes, as shown in fig. 2. Where node i is a known point as model input and the remaining points are unknown points as model outputs. The training pipe network adopts various structures, so that the computational model can be effectively prevented from being fitted in the training process, the testing pipe network adopts a new structure, and the generalization and the precision of the trained model can be tested.
And collecting simulation data, preprocessing the data and converting the graph structure by utilizing MATLAB software and Aspen HYSYS joint debugging according to the step of generating the S1 training data, so as to obtain a plurality of training graphs and test graphs. The training diagram data is divided into a training set and a verification set according to the proportion of 8:2. The training set is used for training the model, and the verification set is used for checking the model precision performance. The test set does not belong to the training set and the verification set and is used for checking the actual precision and generalization capability of the model.
In this embodiment, the pressure estimation model adopted in the natural gas pipe network pressure estimation method based on the graph attention network is a mixed model formed by cascade connection of 3 layers of graph attention layers and 1 layer of full-connection layers, and the structure of the pressure estimation model is shown in fig. 3. The graph attention layer is used for extracting graph features, and the full connection layer is used for enhancing the nonlinear fitting capability of the model. The calculation loss of the method comprises three parts, namely, the pressure loss of an unknown node (namely, the mean square error of a pressure calculation value and a true value), the flow loss of a known node (namely, the mean square error of a pipeline flow calculation value and a true value) and the physical limit loss of the pressure difference between two ends of a known pipeline (namely, the pressure drop ReLU error of the end pipeline). The pressure loss of the unknown point represents the calculation precision of the model, and the flow loss of the known node and the physical limit loss of the pressure difference at two ends of the known pipeline represent the degree that the model accords with the physical rule.
The model superparameter is adjusted based on the principle of minimum loss of the verification set to obtain a group of optimal superparameters as shown in table 1
TABLE 1 super parameter optimizing results
In evaluating the index, mean absolute error (Mean Absolute Error, MAE), root mean square error (Root Mean Squared Error, RMSE), decision coefficient (coefficient of determination, R 2 ) Four common precision assessment indices are averaged absolute percentage errors (Mean Absolute Percentage Error, MAPE). Wherein the closer the indexes MAE, RMSE and MAPE are to 0, R 2 The closer to 1, the better the model prediction effect is represented, and the smaller the error value is.
In this embodiment, the method for estimating the pressure of the natural gas pipe network based on the graph attention network is performed according to the steps 1 to 3, and after the steps are completed, the test data of the test pipe network are shown in the following table 2. Meanwhile, in this embodiment, in order to compare the advantages of a specific total loss function form, a conventional graph attention network without changing the loss function is also set as a control test. In this control, the total loss function has only the pressure loss at the unknown node, in the form:
as can be obtained from table 2, the natural gas pipe network pressure estimation method based on the graph attention network provided by the invention has higher calculation accuracy, the percentage error is about 1%, and compared with the traditional graph attention network error without changing the loss function, the method has the advantages of low calculation accuracy, low calculation cost and the like. At this time, the traditional data driving method cannot be used when the dimension of the network is changed, and the method overcomes the defect by introducing a graph annotation network layer capable of extracting the structural characteristics of the graph, so that the method has certain generalization and wider application prospect.
Table 2 super parameter optimizing results
The above embodiment is only a preferred embodiment of the present invention, but it is not intended to limit the present invention. Various changes and modifications may be made by one of ordinary skill in the pertinent art without departing from the spirit and scope of the present invention. Therefore, all the technical schemes obtained by adopting the equivalent substitution or equivalent transformation are within the protection scope of the invention.

Claims (10)

1. The natural gas pipeline network pressure estimation method based on the graph attention network is characterized by comprising the following steps of:
s1, constructing pipe network models aiming at different natural gas pipe networks, and respectively performing computational fluid dynamics simulation based on node pressure and standard condition instantaneous flow actually recorded by each natural gas pipe network end metering sensor to obtain a pipe network simulation data set corresponding to each natural gas pipe network;
s2, each natural gas pipe network is respectively converted into a graph structure, nodes of the graph are pipeline ends and tee joints in the pipe network, the node where the metering sensor is located is used as a known node, the other nodes are unknown nodes, and edges of the graph are pipelines between the nodes; for each graph structure, carrying out initial assignment on nodes and edges based on a corresponding pipe network simulation data set to form a first training sample, wherein node data of known nodes are pressure and standard instantaneous flow at the nodes in the pipe network simulation data set, the pressure of each unknown node is the average value of the pressures of all known nodes, the standard instantaneous flow of each unknown node is set to be 0, the edge data of each edge is the length and the inner diameter of a normalized pipeline, and each graph constructs a connection matrix according to the direct connection relation between the nodes in a natural gas pipe network;
s3, constructing a pipeline model of a single natural gas pipeline, and carrying out computational fluid dynamics simulation on the flow condition in the pipeline by setting different working condition information comprising pipeline parameters and pressures at two ends of the pipeline to obtain pipeline simulation data sets under different working conditions; extracting working condition information as sample input and extracting pipeline flow value as sample output aiming at the simulation data under each working condition in the pipeline simulation data set, thereby constructing a second training sample;
s4, training a natural gas pipeline flow estimation model based on a back propagation neural network by using a second training sample, and further training a natural gas pipeline pressure estimation model based on a graph attention network by using a first training sample; the total loss function during the training of the natural gas pipe network pressure estimation model is a weighted sum of the pressure loss of an unknown node, the flow loss of the known node and the physical limit loss of the pressure difference at two ends of the known pipeline, wherein the flow loss of the known node calculates a flow predicted value by the trained natural gas pipe network flow estimation model and provides a supervision signal by the flow known value of the same node;
s5, converting the target natural gas pipe network into a graph structure, carrying out initial assignment on nodes and edges in the graph structure by using pressure detected by existing metering sensors in the pipe network and standard condition instantaneous flow data, inputting the assigned graph into the trained natural gas pipe network pressure estimation model, and predicting to obtain the in-pipe pressure values of all unknown nodes in the target natural gas pipe network.
2. The natural gas pipeline network pressure estimation method based on the graph attention network according to claim 1, wherein the pipeline network simulation data set and the pipeline simulation data set are required to cover different working conditions in the actual operation process, and normalization processing is required to be carried out on data when training samples are constructed according to the two data sets so as to meet the requirement of model input.
3. The natural gas pipeline network pressure estimation method based on the graph attention network according to claim 1, wherein the connection matrix is used for recording the direct connection relation between nodes in the natural gas pipeline network, the number of rows of the matrix is 2, and the number of columns is twice the number of edges in the graph structure; when the connection matrix is constructed, the nodes contained in the graph structure are firstly ordered and numbered, and then two adjacent columns in the connection matrix are utilized to record the starting node and the ending node corresponding to two different flow directions of each pipeline.
4. A natural gas pipeline network pressure estimation method based on a graph attention network as recited in claim 1, wherein a graph attention network used as the natural gas pipeline network pressure estimation model is composed of a plurality of graph attention layers and full connection layers; in each layer of graph annotation force layer, each node updates node information by the following formula:
wherein: x's' i 、x i Representing node data after and before updating of the node i,e is a set of adjacent nodes of node i ij To connect node i and node j's edge data, W 1 、W 2 、W 3 The sigma is a sigmoid activation function for a parameter matrix to be trained; alpha ij The calculation formula is as follows:
wherein: w (W) 4 、W 5 、W 6 The parameter matrix to be trained;
the full-connection layer annotates node data x 'output by the force layer with the last layer of drawing' i As input, the node output is obtained by:
y i =σ(W 7 x′ x +b)
wherein: w (W) 7 And b is a bias term for a parameter matrix to be trained.
5. A natural gas pipeline network pressure estimation method based on graph attention network as recited in claim 4, wherein the flow Q of the pipeline between two known nodes in the back propagation neural network used as the natural gas pipeline flow estimation model is calculated by the following formula:
wherein: w (W) 8 And p is normalized working condition information corresponding to the current calculation pipeline for the parameter matrix to be trained, and comprises starting node pressure, ending node pressure, differential pressure at two ends of the current calculation pipeline, evolution of differential pressure at two ends of the current calculation pipeline, the length of the current calculation pipeline and the inner diameter of the current calculation pipeline.
6. The natural gas pipeline network pressure estimation method based on the graph attention network of claim 5, wherein the total loss function form of the natural gas pipeline network pressure estimation model during training is as follows:
wherein: y is i A pressure simulation value for a single unknown node determined by computational fluid dynamics simulation;a pressure predicted value of a single unknown node output by the natural gas pipeline network pressure estimation model; n is the number of unknown nodes in the natural gas network; q (Q) j The actual flow of a single known node is obtained by the standard condition instantaneous flow actually recorded by a measuring sensor at the tail end of the natural gas pipeline network; />The predicted flow of a single known node is obtained by predicting a trained natural gas pipeline flow estimation model according to the working condition information of pipelines connected with the known node; m is the number of known nodes in the natural gas network; p is p k Pressure simulation values for a single known node determined by computational fluid dynamics simulation; p's' k The pressure prediction value of the node which is directly connected with the known node is output for the natural gas pipeline network pressure estimation model; reLU is a ReLU activation function; alpha is a weight super parameter.
7. The method for estimating the pressure of a natural gas pipeline network based on a graph attention network according to claim 1, wherein the super parameters in the back propagation neural network and the graph attention network are optimized in advance, the model is trained on the training set by dividing the training set and the verification set in advance, and the super parameters of the model are optimized with the aim of minimizing the total loss function value of the verification set, so that a set of optimal super parameters is obtained.
8. The graph-attention-network-based natural gas pipeline network pressure estimation method of claim 7, wherein the super-parameters of the counter-propagating neural network include hidden layer number, neuron number, learning rate, learning turn.
9. The graph-attention-network-based natural gas pipeline network pressure estimation method of claim 7, wherein the super-parameters of the model are optimized by using a Bayesian optimization algorithm to obtain optimal super-parameters.
10. The method for estimating the pressure of the natural gas network based on the graph attention network according to claim 1, wherein the node pressure and the standard instantaneous flow actually recorded by the end metering sensor in the natural gas network are acquired by a data acquisition and monitoring control System (SCADA).
CN202311056741.7A 2023-08-21 2023-08-21 Natural gas pipe network pressure estimation method based on graph attention network Pending CN117034808A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311056741.7A CN117034808A (en) 2023-08-21 2023-08-21 Natural gas pipe network pressure estimation method based on graph attention network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311056741.7A CN117034808A (en) 2023-08-21 2023-08-21 Natural gas pipe network pressure estimation method based on graph attention network

Publications (1)

Publication Number Publication Date
CN117034808A true CN117034808A (en) 2023-11-10

Family

ID=88635216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311056741.7A Pending CN117034808A (en) 2023-08-21 2023-08-21 Natural gas pipe network pressure estimation method based on graph attention network

Country Status (1)

Country Link
CN (1) CN117034808A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117850491A (en) * 2024-03-06 2024-04-09 韵京厦(四川)能源科技研究院(有限合伙) Automatic pressure regulating control method and system for fuel gas transmission and distribution

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117850491A (en) * 2024-03-06 2024-04-09 韵京厦(四川)能源科技研究院(有限合伙) Automatic pressure regulating control method and system for fuel gas transmission and distribution
CN117850491B (en) * 2024-03-06 2024-05-10 韵京厦(四川)能源科技研究院(有限合伙) Automatic pressure regulating control method and system for fuel gas transmission and distribution

Similar Documents

Publication Publication Date Title
CN111860982A (en) Wind power plant short-term wind power prediction method based on VMD-FCM-GRU
CN110807554B (en) Generation method and system based on wind power/photovoltaic classical scene set
CN110689171A (en) Turbine health state prediction method based on E-LSTM
CN112101480A (en) Multivariate clustering and fused time sequence combined prediction method
CN116448419A (en) Zero sample bearing fault diagnosis method based on depth model high-dimensional parameter multi-target efficient optimization
CN112084727A (en) Transition prediction method based on neural network
CN105260786A (en) Comprehensive optimization method of simulation credibility evaluation model of electric propulsion system
CN114492211B (en) Residual oil distribution prediction method based on autoregressive network model
CN117034808A (en) Natural gas pipe network pressure estimation method based on graph attention network
Li et al. Evolutionary deep learning with extended Kalman filter for effective prediction modeling and efficient data assimilation
CN111311577A (en) Intelligent water seepage detection method based on generation of confrontation network and reinforcement learning
CN114239397A (en) Soft measurement modeling method based on dynamic feature extraction and local weighted deep learning
CN114912364A (en) Natural gas well flow prediction method, device, equipment and computer readable medium
CN114777192A (en) Secondary network heat supply autonomous optimization regulation and control method based on data association and deep learning
CN113051828B (en) Online prediction method for natural gas water dew point driven by technological parameters
CN105894014B (en) Abnormal behavior sequential detection method based on multi-factor inconsistency measurement
CN113836783A (en) Digital regression model modeling method for main beam temperature-induced deflection monitoring reference value of cable-stayed bridge
CN112862063A (en) Complex pipe network leakage positioning method based on deep belief network
Preis et al. Online hydraulic state prediction for water distribution systems
CN116432359A (en) Variable topology network tide calculation method based on meta transfer learning
CN116303786A (en) Block chain financial big data management system based on multidimensional data fusion algorithm
CN110705186B (en) Real-time online instrument checksum diagnosis method through RBF particle swarm optimization algorithm
CN113887026A (en) Oil pipeline hydraulic prediction method based on ensemble learning
CN110750756B (en) Real-time on-line instrument checksum diagnosis method through optimal support vector machine algorithm
CN110705187B (en) Instant on-line instrument checksum diagnosis method through least square algorithm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination