Gas distribution method for medium-pressure pipe network in cities and towns
The gas pipeline network flow distribution method implemented through data structure design and computer solves the problem of insufficient leakage monitoring of the gas pipeline network, improves energy utilization efficiency and supply stability, and reduces energy waste and environmental burden.
Patent Information
- Application Number
- CN202410732867.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-07
AI Technical Summary
The existing gas pipeline network leakage monitoring and diagnosis technology is insufficient, resulting in leakage during gas transportation that may cause serious consequences, and the energy utilization efficiency is low and waste is serious.
Through the design of data structure and computer implementation, the pipeline network data is collected, the adjacency matrix and the flow distribution matrix are constructed, the directed acyclic path is found, the gas flow distribution is optimized, the calculation correctness is verified, and the stable distribution of the gas pipeline network is achieved.
It improves energy utilization efficiency, ensures stable supply, reduces energy waste, reduces gas loss and environmental burden, and improves energy utilization.
Smart Images

Figure CN118313100B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gas pipe network simulation, and in particular to a method for distributing gas in a medium-pressure pipe network in a town. Background Art
[0002] Natural gas is becoming one of the most widely used energy sources in the world due to its environmentally friendly characteristics. In many countries, the transportation and distribution of natural gas is usually completed through gas pipeline networks. Gas pipeline networks are an important part of urban infrastructure and an important bridge connecting natural gas resources and market demand. Their safety and reliability are related to the reliable supply of natural gas. With the continuous development of urban urbanization, the coverage of urban gas pipeline networks continues to expand, the use of natural gas will increase significantly, and the natural gas consumption and transmission industry will also be further developed.
[0003] Leak detection and diagnosis have always been key factors in the safety of natural gas pipelines. While these pressure pipelines that transport flammable and explosive substances bring convenience to industrial production and people's lives, they also bring many hidden dangers to public safety. Research on gas flow distribution can assist in pipeline network detection and diagnosis and reduce the occurrence of hidden dangers. Therefore, research on gas flow distribution is of great significance. Summary of the invention
[0004] In view of the technical problem that gas leakage will cause serious consequences when it is transported in urban pipelines, and that the current gas pipeline leakage monitoring and diagnosis technology needs to be improved, the present invention provides a method for distributing gas in urban medium-pressure pipelines, which is computer-implemented through data structure design and example feasibility verification, improves energy utilization efficiency, ensures stable supply and reduces energy waste.
[0005] To this end, the technical solution of the present invention is a method for distributing gas in a medium-pressure pipe network in a town, the specific steps of which are:
[0006] Step 1: Collect or calculate pipeline network data information;
[0007] Step 2: Number all nodes and pipe sections in the pipe network;
[0008] Step 3: Describe the data structure of the pipe network and pipe segment number;
[0009] Step 4: Construct the adjacency matrix P;
[0010] Step 5: Define the data structure of nodes, pipe segments, and paths, and find the directed acyclic path of the pipe segment;
[0011] Step 6: Construct the flow distribution matrix Q according to the directed acyclic path of the pipe section;
[0012] Step 7: Verify the correctness of the calculation through the traffic distribution matrix Q.
[0013] Preferably, step 1 specifically includes: collecting or calculating the pipeline gas flow, obtaining the topology map and length, inner diameter and absolute roughness information of the pipeline network.
[0014] Preferably, step 2 is specifically as follows: assuming that the number of nodes in the pipe network is n, and the node numbers are Continuously numbered, the number of source points is s, and the source points are from Continuously numbered, the number of sinks is c, and the sinks start from Continuously numbered, the number of pipe sections is b, and the pipe section numbers start from Consecutive numbering.
[0015] Preferably, step 3 is specifically as follows: let the starting node of pipe segment k be i, the ending node be j, the pipe segment parameters include pipe segment number k, pipe length L, inner diameter D of the pipe segment, absolute roughness K of the pipe segment, starting node number nf, and ending node number nt.
[0016] Preferably, step 4 is specifically as follows: define the adjacency matrix P and the traffic distribution matrix Q and clear them to zero:
[0017]
[0018]
[0019] in, , and n are the number of source nodes, sink nodes and other nodes respectively; If the pipe segment from node i to j is k, then =k; otherwise =0; Source Flow direction of traffic.
[0020] Preferably, step 5 is specifically as follows: construct an adjacency matrix P according to the connection relationship between each node, and define a data structure to find a forward path from the source point to the sink point:
[0021] (1) Pipeline node type Type enumeration: In, Std, Out, i.e. source node, ordinary node, sink node;
[0022] (2) Pipeline node data structure Node{index, type, List <section>sections},
[0023] Where index is the node number, type is the node type, List <section>Sections are all pipe sections starting from this node;
[0024] (3) Pipe segment data structure Section{Node from, Node to, flow}, where Node from and Node to are the starting node and the ending node respectively, and flow is the flow rate, which must be a positive value, that is, the gas always flows from the from node to the to node; if the predefined pipe segment flow rate in the actual calculation result is negative, the original from and to nodes of the pipe segment need to be swapped;
[0025] (4) Path data structure consisting of multiple connected pipe sections Path{Section firstSection, SectionlastSection, List <section>sections}, where Section firstSection is the first section, SectionlastSection is the last section, List <section>Sections are the middle pipe sections.
[0026] Preferably, step 6 is to construct a flow distribution matrix when the adjacency matrix P and the flow of each pipe section are known. The specific steps are as follows:
[0027] (1) Let s = 1, from 1 to Traverse the source point number, set m= +n, the number of nodes traversed except the sink;
[0028] (2) Find the only non-zero element in row s of the P matrix = k, indicating that the source point has only one output pipe segment, let u = , that is, the flow from source s to node j;
[0029] (3) Let i = j, and search for the node that flows from row j;
[0030] (4) Find the sum of the flow rates of the pipe sections corresponding to all non-zero elements in row i of the P matrix , let v = u, traverse i rows, and find a non-zero element each time = k, find u = v*( / ); if j>m, it means j is a sink, and the Q matrix is updated, that is, = +u, otherwise j and the corresponding u are pushed into the stack at the same time;
[0031] (5) If the stack is not empty, take out the top j and the corresponding u, and go to (3). If the stack is empty and s< , then s=s+1 turn to (2);
[0032] (6) Until s = , we get the flow distribution matrix Q, that is, we get the flow distribution from each source point to each sink point.
[0033] Preferably, step 7 is specifically: by calculating the flow distribution matrix Q , compared with the incoming traffic of the source node to verify the correctness of the calculation.
[0034] The beneficial effects of the present invention are:
[0035] (1) The gas distribution implementation method of the present invention improves energy utilization efficiency, ensures stable supply, and reduces energy waste;
[0036] (2) Optimizing the distribution of gas pipelines can improve energy utilization, reduce losses, and lower usage costs. At the same time, effective distribution methods can reduce emissions, reduce environmental burdens, and contribute to sustainable energy utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of a method for implementing gas distribution according to an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of pipe segment numbering in an embodiment of the present invention;
[0039] Figure 3 is a schematic diagram of a pipe network example of an embodiment of the present invention;
[0040] Figure 4 is a schematic diagram of a forward path of a pipe network source S1 according to an embodiment of the present invention;
[0041] Figure 5 It is a schematic diagram of the forward path of the pipe network source S2 according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The present invention will be further described below in conjunction with embodiments.
[0043] like Figure 1 As shown, a method for implementing gas distribution in a medium-pressure pipe network in a town, the method comprising the following steps:
[0044] Step 1: Based on the gas pipeline network data in a certain area, directly collect or calculate the gas flow of each pipeline, obtain the topology map and information such as length, inner diameter and absolute roughness of the pipeline network, and lay the foundation for calculation;
[0045] Step 2: Number all nodes and pipe sections in the pipe network. Specifically, let the number of nodes in the pipe network be n, the number of source points be s, the number of sink points be c, and the number of pipe sections be b. For the convenience of programming, the following numbering method is designed:
[0046] (1) Node numbering from Consecutive numbering;
[0047] (2) Source point Consecutive numbering;
[0048] (3) The meeting point is Consecutive numbering;
[0049] (4) Pipe section number from Consecutive numbering;
[0050] Step 3: Describe the data structure of the pipe network / pipe segment. Specifically, let the starting node of pipe segment k be i and the ending node be j, such as Figure 2 As shown, the pipe segment parameters include the pipe segment number k, pipe length L, pipe segment inner diameter D, pipe segment absolute roughness K, start node number , terminal node number ;
[0051] Step 4: First define the adjacency matrix P and the traffic distribution matrix Q and clear them to zero:
[0052]
[0053]
[0054] in, , and n are the number of source nodes, sink nodes and other nodes respectively; If the pipe segment from node i to j is k, then =k; otherwise =0; Source Flow direction Traffic volume;
[0055] Step 5: Construct the adjacency matrix P according to the connection relationship between each node. To find the forward path from the source point to the sink point, define the data structure:
[0056] (1) Pipeline node type Type enumeration: In, Std, Out, i.e. source node, ordinary node, sink node;
[0057] (2) Pipeline node data structure Node{index, type, List <section>sections},
[0058] Where index is the node number, type is the node type, List <section>Sections are all pipe sections starting from this node;
[0059] (3) Pipe segment data structure Section{Node from, Node to, flow}, where Node from and Node to are the starting node and the ending node respectively, and flow is the flow rate, which must be a positive value, that is, the gas always flows from the from node to the to node. If the predefined pipe segment flow rate in the actual calculation result is negative, the original from / to nodes of the pipe segment need to be swapped;
[0060] (4) Path data structure consisting of multiple connected pipe sections Path{Section firstSection, SectionlastSection, List <section>sections}, where Section firstSection is the first section, SectionlastSection is the last section, List <section>Sections are the middle pipe sections;
[0061] Step 6: When the adjacency matrix P and the flow of each pipe section are known, construct the flow distribution matrix. The specific steps are as follows:
[0062] (1) Let s = 1, from 1 to Traverse the source point number, set m= +n, the number of nodes traversed except the sink;
[0063] (2) Find the only non-zero element in row s of the P matrix = k, indicating that the source point has only one output pipe segment, let u = , that is, the flow from source s to node j;
[0064] (3) Let i = j, and search for the node that flows from row j;
[0065] (4) Find the sum of the flow rates of the pipe sections corresponding to all non-zero elements in row i of the P matrix , let v = u, traverse i rows, and find a non-zero element each time = k, find u = v*( / ); if j>m, it means j is a sink, and the Q matrix is updated, that is, = +u, otherwise j and the corresponding u are pushed into the stack at the same time;
[0066] (5) If the stack is not empty, take out the top j and the corresponding u, and go to (3). If the stack is empty and s< , then s=s+1 turn to (2);
[0067] (6) Until s = , we get the flow distribution matrix Q, that is, we get the flow distribution from each source point to each sink point;
[0068] Step 7: By calculating the flow distribution matrix Q , compared with the incoming traffic of the source node to verify the correctness of the calculation.
[0069] The specific application principle of the present invention is described as follows:
[0070] A pipe network with 2 source points and 2 sink points, such as Figure 3 As shown in the figure, the arrows in the figure indicate the actual flow direction of the pipe section. Through real-time analysis and calculation of the pipe network, the flow of all pipe sections is shown in Table 1.
[0071] The data of nodes and pipe sections are known information of the gas pipeline network. According to the adjacency matrix P, the forward paths from all source nodes to sink nodes are calculated using the breadth-first traversal method.
[0072] Table 1
[0073]
[0074] Through the analysis of the pipe network topology, we can know that the pipe segment adjacency matrix is as follows:
[0075]
[0076] All forward paths can be searched from the pipe segment adjacency matrix, and the flow distribution can be obtained through the forward paths.
[0077] i= 1 ~n s (here n s = 2), that is, to find the forward path from each source point in sequence.
[0078] Step 1: i= 1 o'clock, at P The matrix 1 Find non-zero elements in the row p 13 = 1, indicating that source point 1 reaches node 3 through pipe segment 1;
[0079] Then find the non-zero elements from row 3 p 34 = 2 ,p 35 = 4, indicating that node 3 reaches node 4 through pipe segment 2, and node 5 (Note the node 5 , first process the node 4 );
[0080] Then find the non-zero elements from row 4 p 46 =5, p 47 =3, indicating that node 4 reaches node 5 through pipe segment 6 , and reach the node through pipe segment 3 7 (Has reached the meeting point and obtained a forward path);
[0081] From the 6 Find non-zero elements in the row p 68 =8, indicating that node 6 reaches node 8 through pipe segment 8 8 (Has reached the meeting point and obtained a forward path);
[0082] Go back to the noted node 5 and find the non-zero element from row 5 p 56 =7, indicating that node 5 reaches node 6 through pipe segment 7;
[0083] Then find the non-zero elements from row 6 p 68 =8, indicating the node 6 Reach node 8 through pipe segment 8 (reached the confluence point, obtained a forward path);
[0084] Get all forward paths starting from source point 1, a total of 3.
[0085] Step 2: i= At 2 o'clock, P Find the non-zero elements in row 2 of the matrix p 25 =6, indicating that source point 2 reaches node 5 through pipe segment 6;
[0086] Then find the non-zero elements from row 5 p 56 =7, indicating that node 5 reaches node 6 through pipe segment 7;
[0087] Then find the non-zero elements from row 6 p 68 =8, indicating that node 6 reaches node 8 through pipe segment 8 (reaching the confluence point and obtaining a forward path);
[0088] Get all the forward paths from source point 1, a total of 1;
[0089] Summarizing the previous steps, we can get a tree diagram, such as Figure 4-5 As shown, from Figure 4-5 It can be seen that there are 4 forward paths:
[0090] There is one forward path: ①→③→④→⑦;
[0091] There are two forward paths: ①→③→④→⑥→⑧; ①→③→⑤→⑥→⑧;
[0092] There are 0 forward paths;
[0093] There is one forward path: ②→⑤→⑥→⑧;
[0094] Then there is
[0095]
[0096] get
[0097]
[0098] Matters not covered by the present invention are known technologies.
[0099] However, what is described above is only a specific embodiment of the present invention and should not be used to limit the scope of implementation of the present invention. Therefore, the replacement of equivalent components, or equivalent changes and modifications made according to the scope of protection of the present invention should still fall within the scope covered by the claims of the present invention.< / section> < / section> < / section> < / section> < / section> < / section> < / section> < / section>
Claims
1. A method for distributing gas in a medium-pressure urban network, characterized in that: The specific steps are: Step 1: Collect or calculate pipeline network data information, specifically: collect or calculate pipeline gas flow, obtain the pipeline network topology and length, inner diameter and absolute roughness information; Step 2: Number all nodes and pipe sections in the pipe network. Specifically, let the number of nodes in the pipe network be n, and the node numbers start from Continuously numbered, the number of source points is s, the source points are from Continuously numbered, the number of sinks is c, and the sinks are from Continuously numbered, the number of pipe sections is b, and the pipe section numbers start from consecutive numbering; Step 3: Describe the data structure of the pipe network and pipe segment number. Specifically, let the starting node of pipe segment k be i and the ending node be j. The pipe segment parameters include pipe segment number k, pipe length L, pipe segment inner diameter D, pipe segment absolute roughness K, starting node number nf, and ending node number nt. Step 4: Construct the adjacency matrix P. Specifically, define the adjacency matrix P and the traffic distribution matrix Q and clear them to zero: in, 、 and n are the number of source nodes, sink nodes and other nodes respectively; for If the pipe segment from node i to j is k, then =k; otherwise =0; Source Flow direction Traffic volume; Step 5: Define the data structure of nodes, pipe segments, and paths, and find the directed acyclic path of the pipe segment; Step 6: Construct the flow distribution matrix Q based on the directed acyclic path of the pipe section; Step 6 is to construct a flow distribution matrix when the adjacency matrix P and the flow of each pipe section are known. The specific steps are as follows: (1) Let s = 1, from 1 to Traverse the source point number, set m= +n, the number of nodes traversed except the sink; (2) Find the only non-zero element in row s of the P matrix =k, indicating that the source point has only one output pipe segment, let u= , that is, the flow from source s to node j; (3) Let i = j, and search for the node that flows from row j; (4) Find the sum of the flow rates of the pipe sections corresponding to all non-zero elements in row i of the P matrix , let v = u, traverse i rows, and find a non-zero element each time =k,find u=v*( / ); If j>m, it means j is a sink, and the Q matrix is updated, that is, = +u, otherwise j and the corresponding u are pushed onto the stack at the same time; (5) If the stack is not empty, take out the top j and the corresponding u, and go to (3). If the stack is empty and s< , then s=s+1 turns to (2); (6) Until s = , we get the flow distribution matrix Q, that is, we get the flow distribution from each source point to each sink point; Step 7: Verify the correctness of the calculation through the traffic distribution matrix Q.
2. The urban medium-pressure pipeline network gas distribution method according to claim 1, characterized in that: The step 5 is specifically as follows: constructing an adjacency matrix P according to the connection relationship between each node, and defining a data structure to find the forward path from the source to the sink: (1) Pipeline node type Type enumeration: In, Std, Out, i.e. source node, ordinary node, sink node; (2) Pipeline node data structure Node{index, type, List <section> sections},< / section> Where index is the node number, type is the node type, List <section> Sections are all pipe sections starting from this node;< / section> (3) Pipeline data structure Section{Node from, Node to, flow}, where Node from Node to represents the starting and ending nodes, respectively. Flow represents the flow rate, which must be a positive value, meaning that gas always flows from the from node to the to node. If the predefined flow rate of a pipe segment is negative in the actual calculation result, the original from and to nodes of the pipe segment need to be swapped. (4) Path data structure composed of multiple connected pipe segments Path{Section firstSection, Section lastSection,List <section>sections}, where Section firstSection is the first pipe section, Section lastSection is the last pipe section, List <section> Sections are intermediate pipe sections.< / section> < / section> 3. The urban medium-pressure pipeline network gas distribution method according to claim 1 or 2, characterized in that: The step 7 is specifically as follows: by calculating the flow distribution matrix Q , compared with the source node inflow flow to verify the correctness of the calculation.
Citation Information
Patent Citations
Simulation calculation method and system for urban gas pipe network
CN112417632A
