A natural gas pipeline network transient state simulation method, device, equipment and medium

By employing quadratic programming and constant coefficient correlation matrix transformation, the problem of slow simulation speed in natural gas pipeline networks was solved, enabling fast and accurate steady-state and transient simulations, thus meeting the simulation requirements after the coupling of natural gas systems and power systems.

CN117371354BActive Publication Date: 2026-06-19CHINA UNIV OF PETROLEUM (BEIJING)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA UNIV OF PETROLEUM (BEIJING)
Filing Date
2023-10-25
Publication Date
2026-06-19

Smart Images

  • Figure CN117371354B_ABST
    Figure CN117371354B_ABST
Patent Text Reader

Abstract

This application relates to the field of natural gas pipeline technology, and discloses a method, apparatus, equipment, and medium for transient and steady-state simulation of natural gas pipelines. The method includes: determining pipeline characteristic parameters and gas characteristic parameters according to simulation requirements; performing steady-state simulation of the natural gas pipeline using quadratic programming based on the pipeline and gas characteristic parameters; transforming the hyperbolic partial differential equations of transient natural gas flow into a transient flow calculation model of the natural gas pipeline based on a constant coefficient correlation matrix and a node-pipeline correlation matrix; and performing transient simulation of the natural gas pipeline using this model. This enables rapid and accurate modeling, steady-state simulation, and transient simulation of complex natural gas pipelines. The steady-state simulation employs optimization techniques, improving the accuracy and efficiency of steady-state solutions. In the transient simulation, the partial differential equations describing transient natural gas flow are transformed into the aforementioned transient flow calculation model, ensuring efficient modeling and improving computational speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural gas pipeline technology, and in particular to a method, apparatus, equipment and medium for transient steady-state simulation of natural gas pipelines. Background Technology

[0002] Natural gas flow simulation can be divided into steady-state simulation and transient simulation based on whether the simulation results change over time. Existing distributed parameter methods for transient natural gas flow mainly utilize spatiotemporal grids to discretize the partial differential equations describing the pipeline flow state, followed by iterative calculations, which results in slow computation speed.

[0003] Currently, natural gas pipeline systems face two major transformations: First, digital twins are increasingly being integrated into the operation and management of natural gas systems. Online simulation modules are a crucial component of these digital twins, and real-time online simulation places stringent demands on simulation algorithms, requiring not only high accuracy but also speed and efficiency. However, the computational efficiency of current simulation software cannot meet these demands. Second, with the changing energy structure in recent years, natural gas systems are gradually being integrated into the power system. The combined operation of gas and electricity systems presents significant challenges to natural gas systems. To meet the demands of the power grid, the operating points of coupled equipment such as gas turbines and energy converters are constantly changing. Natural gas system carriers need to promptly detect these changes in operating conditions at the coupled points. However, traditional simulation algorithms, due to their low computational efficiency, cause significant inconvenience to the operation and management of natural gas systems.

[0004] Therefore, how to design a fast transient steady-state simulation method for natural gas that combines both solution accuracy and speed is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a method, apparatus, equipment, and medium for transient and steady-state simulation of natural gas pipeline networks, which can achieve rapid and accurate modeling, steady-state simulation, and transient simulation of complex natural gas pipeline networks. The specific solution is as follows:

[0006] A method for simulating the transient steady state of a natural gas pipeline network includes:

[0007] Determine the characteristic parameters of the pipeline network and the gas characteristic parameters according to the simulation requirements;

[0008] Based on the pipeline characteristic parameters and the gas characteristic parameters, a steady-state simulation of the natural gas pipeline network is performed using the quadratic programming method.

[0009] The hyperbolic partial differential equation for transient natural gas flow is transformed into a calculation model for transient natural gas pipeline network flow based on constant coefficient correlation matrix and node-pipeline correlation matrix.

[0010] The transient flow calculation model of the natural gas pipeline network is used to perform transient simulation of the natural gas pipeline network.

[0011] Preferably, in the above-described instantaneous steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, determining the gas characteristic parameters includes:

[0012] The extended virial equation of the AGA8 algorithm is used to calculate the compressibility factor at the point of minimum pipeline pressure and the compressibility factor at the point of maximum pipeline pressure in the gas characteristic parameters.

[0013] The target compressibility factor is determined based on the average of the compressibility factor at the point of minimum pipeline pressure and the compressibility factor at the point of maximum pipeline pressure.

[0014] Preferably, in the above-described instantaneous steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, steady-state simulation of the natural gas pipeline network is performed using a quadratic programming method based on the pipeline network characteristic parameters and the gas characteristic parameters, including:

[0015] Based on the pipeline characteristic parameters and the gas characteristic parameters, the optimization decision variables, objective function, and constraints corresponding to the steady-state simulation of the natural gas pipeline network are determined; the objective function satisfies the node flow balance; the hydraulic characteristics in the constraints satisfy the steady-state formula for horizontal pipelines; the steady-state formula for horizontal pipelines includes the target compressibility factor;

[0016] Under the given constraints, the optimization decision variables are optimized to obtain the globally optimal decision variables, so that the objective function reaches its minimum value.

[0017] Preferably, in the above-mentioned transient steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, the hyperbolic partial differential equation of transient natural gas flow is transformed into a transient flow calculation model for natural gas pipeline networks based on a constant coefficient correlation matrix and a node-pipeline correlation matrix, including:

[0018] The node-pipeline correlation matrix is ​​obtained based on the hyperbolic partial differential equation of the transient flow of natural gas; the node-pipeline correlation matrix is ​​used to represent the topology of the natural gas pipeline network.

[0019] The hyperbolic partial differential equation of the transient flow of natural gas is transformed into a linear ordinary differential equation with time-varying parameters using the Laplace transform.

[0020] Boundary conditions are set for the linear ordinary differential equations to construct a transient flow transfer function model for natural gas.

[0021] Based on the transient flow transfer function model of natural gas, the constant coefficient correlation matrix is ​​obtained;

[0022] A transient flow calculation model for natural gas pipeline networks is constructed based on the constant coefficient correlation matrix and the node-pipeline correlation matrix.

[0023] Preferably, in the above-described transient steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, the node-pipeline correlation matrix is ​​obtained based on the hyperbolic partial differential equation of the transient flow of natural gas, including:

[0024] Based on the hyperbolic partial differential equations of the transient flow of natural gas, a compressor model and a gas turbine model are established.

[0025] Based on the compressor model and the gas turbine model, the node-pipeline correlation matrix is ​​obtained.

[0026] Preferably, in the above-described transient steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, the constant coefficient correlation matrix is ​​obtained based on the transient flow transfer function model of natural gas, including:

[0027] The transient flow transfer function model of natural gas is converted into a discrete transfer function model using the bilinear transformation method.

[0028] The discrete transfer function model is transformed from the frequency domain to a difference form in the time domain using the hysteresis theorem, and then discretized in the time domain to obtain the constant coefficient correlation matrix.

[0029] Preferably, in the above-described transient steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, the equations of the transient flow calculation model for the natural gas pipeline network are as follows:

[0030]

[0031] Where j is the number of pipe segments constituting the natural gas pipeline network; P inj M is the inlet pressure of the j-th segment of the pipeline; inj Let P be the inlet mass flow rate of the j-th pipe segment; outj M is the outlet pressure of the j-th pipe segment; outj Let be the outlet mass flow rate of the j-th pipe segment; B1 and B2 are the historical column vectors during the simulation; α and β are the boundary conditions used for the simulation, and q is the number of boundary conditions; CCCM j The constant coefficient correlation matrix describing the physical properties of the j-th pipeline; NPIM j The node-pipe correlation matrix describes the pressure and mass flow rate at the nodes of the j-th pipe and its connected pipes.

[0032] This invention also provides a natural gas pipeline network transient steady-state simulation device, comprising:

[0033] The parameter determination module is used to determine the characteristic parameters of the pipeline network and the gas characteristic parameters according to the simulation requirements.

[0034] The steady-state simulation module is used to perform steady-state simulation of the natural gas pipeline network using quadratic programming based on the pipeline network characteristic parameters and the gas characteristic parameters.

[0035] The model transformation module is used to transform the hyperbolic partial differential equation of transient natural gas flow into a calculation model of transient natural gas pipeline network flow based on constant coefficient correlation matrix and node-pipeline correlation matrix.

[0036] The transient simulation module is used to perform transient simulation of the natural gas pipeline network using the transient flow calculation model of the natural gas pipeline network.

[0037] This invention also provides an electronic device, including a processor and a memory, wherein the processor executes a computer program stored in the memory to implement the above-described natural gas pipeline transient steady-state simulation method provided in this invention.

[0038] This invention also provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the above-described transient steady-state simulation method for natural gas pipeline networks provided in this invention.

[0039] As can be seen from the above technical solution, the transient steady-state simulation method for natural gas pipeline networks provided by the present invention includes: determining pipeline characteristic parameters and gas characteristic parameters according to simulation requirements; performing steady-state simulation of the natural gas pipeline network using quadratic programming based on the pipeline characteristic parameters and gas characteristic parameters; transforming the hyperbolic partial differential equation of transient natural gas flow into a transient flow calculation model of the natural gas pipeline network based on a constant coefficient correlation matrix and a node-pipeline correlation matrix; and performing transient simulation of the natural gas pipeline network using the transient flow calculation model of the natural gas pipeline network.

[0040] The above-mentioned instantaneous and steady-state simulation method for natural gas pipeline networks provided by this invention adopts the idea of ​​optimization in the steady-state simulation part, abandoning the method of solving multiple quadratic equations, and instead uses the quadratic programming method to perform steady-state simulation of natural gas pipeline networks, which greatly improves the accuracy and efficiency of steady-state solution. In the transient simulation part, the partial differential equations describing the transient flow of natural gas are transformed into a calculation model of the transient flow of natural gas pipeline networks based on constant coefficient correlation matrices and node-pipeline correlation matrices. This not only ensures the efficiency of modeling, but also greatly improves the calculation speed. In this way, it is possible to perform fast and accurate modeling, steady-state simulation and transient simulation of complex natural gas pipeline networks, making up for the shortcomings of traditional simulation methods in terms of solution speed.

[0041] Furthermore, this invention also provides corresponding devices, equipment, and computer-readable storage media for the transient steady-state simulation method of natural gas pipeline networks, further making the above method more practical. The devices, equipment, and computer-readable storage media have corresponding advantages. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0043] Figure 1 A flowchart of the instantaneous steady-state simulation method for natural gas pipeline networks provided in an embodiment of the present invention;

[0044] Figure 2 This is a schematic diagram of the structure of the instantaneous steady-state simulation device for natural gas pipeline networks provided in an embodiment of the present invention. Detailed Implementation

[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0046] This invention provides a method for simulating the transient steady state of a natural gas pipeline network, such as... Figure 1 As shown, it includes the following steps:

[0047] S101. Determine the pipeline characteristic parameters and gas characteristic parameters according to the simulation requirements.

[0048] In practical applications, natural gas pipeline systems typically include gas sources, pipelines, compressor stations, gas storage facilities, and users. Natural gas enters the pipeline from the gas source station, is pressurized by the compressor station, and is finally transported to the user.

[0049] This invention can determine the characteristic parameters of the natural gas pipeline network (including pipeline characteristic parameters) and the gas characteristic parameters according to the simulation requirements of the natural gas pipeline network, so as to meet the requirements for establishing the steady-state equation.

[0050] S102. Based on the pipeline characteristic parameters and gas characteristic parameters, a steady-state simulation of the natural gas pipeline network is performed using the quadratic programming method.

[0051] In practical applications, steady-state simulation, based on the assumption of steady-state natural gas flow, calculates the hydraulic and thermodynamic parameters of each node in the natural gas pipeline network from the steady-state flow equations. Specifically, this invention employs an optimization approach, first transforming the complex nonlinear relationships of the natural gas pipeline network into simple quadratic relationships—that is, forms involving at most two unknowns multiplied together—essentially converting it into a quadratic programming problem (a method from optimization theory). Then, this quadratic programming solution algorithm is used to perform rapid steady-state simulation of the natural gas pipeline network. Compared to conventional steady-state simulation, this quadratic programming solution algorithm significantly improves computational accuracy and efficiency.

[0052] S103. The hyperbolic partial differential equation of transient natural gas flow is transformed into a calculation model of transient natural gas pipeline network flow based on constant coefficient correlation matrix and node-pipeline correlation matrix.

[0053] It should be noted that the Constant Coefficient Correlation Matrix (CCCM) and the Node-Pipe Incidence Matrix (NPIM) are used for transient simulations of natural gas pipeline networks. The coefficients of the CCCM and NPIM do not change over time, thus ensuring high efficiency in transient solutions.

[0054] S104. Use the transient flow calculation model of natural gas pipeline network to perform transient simulation of natural gas pipeline network.

[0055] In existing technologies, transient simulation of natural gas pipeline networks starts from the partial differential equations of natural gas flow and employs different solution methods, such as distributed parameter methods based on the method of characteristics, finite volume method, and finite difference method, and lumped parameter methods based on quasi-circuit and state-space model methods, to ultimately realize the changes in hydraulic and thermal parameters of the natural gas pipeline network over time. This calculation method is relatively slow. In contrast, this invention utilizes a transient flow calculation model of natural gas pipeline networks based on constant coefficient correlation matrices and node-pipeline correlation matrices to perform transient simulation of natural gas pipeline networks, which can significantly improve the calculation speed.

[0056] In the above-mentioned transient and steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, in the steady-state simulation part, the optimization idea is adopted, abandoning the method of solving multiple quadratic equations, and instead using the quadratic programming method to perform steady-state simulation of the natural gas pipeline network, which greatly improves the accuracy and efficiency of steady-state solution; in the transient simulation part, the partial differential equations describing the transient flow of natural gas are transformed into a calculation model of the transient flow of natural gas pipeline network based on the constant coefficient correlation matrix and the node-pipeline correlation matrix, which not only ensures the efficiency of modeling, but also greatly improves the calculation speed. In this way, it is possible to perform fast and accurate modeling, steady-state simulation and transient simulation of complex natural gas pipeline networks, making up for the shortcomings of traditional simulation methods in terms of solution speed.

[0057] Furthermore, in a specific implementation, in the above-mentioned instantaneous steady-state simulation method for natural gas pipeline networks provided in the embodiments of the present invention, step S101, determining the gas characteristic parameters, may specifically include: firstly, using the extended virial equation of the AGA8 algorithm to calculate the compressibility factor at the point of minimum pipeline pressure and the compressibility factor at the point of maximum pipeline pressure in the gas characteristic parameters; then, determining the target compressibility factor based on the average value of the determined compressibility factor at the point of minimum pipeline pressure and the compressibility factor at the point of maximum pipeline pressure.

[0058] It should be noted that the main gas characteristic parameters include relative density, dynamic viscosity, and compressibility factor. Relative density and dynamic viscosity are only related to the gas composition, while the compressibility factor is related not only to the gas composition but also to the gas's pressure and temperature. To determine these gas characteristic parameters, this invention can use the AGA8-92DC algorithm to analyze and calculate the natural gas, obtaining various physical properties. The AGA8 algorithm provides a reliable method for calculating the compressibility factor, helping to simulate and predict the fluid behavior, heat transfer characteristics, and dynamic response in natural gas systems. This is of great significance for process optimization, equipment selection, and system design.

[0059] Specifically, the extended virial equation for the AGA8 algorithm used to calculate the compression factor is as follows:

[0060]

[0061] In the formula, Z is the compressibility factor; B is the second virial number, and m 3 / kmol;ρ m Molar density, kmol / m 3 ;ρ r For contrast density; b n c n k n C is a constant; * n This is a coefficient related to temperature and composition.

[0062] When performing the calculations, the known quantities are temperature T, absolute pressure P, gas composition N, and mole fraction x of each component. i Once these basic parameters are known, the state equation constant 'a' required for the calculation can be further determined by referring to Appendix B of GB / T 17747.2. n b n c n k n u n g n q n f n s n w n and characteristic energy parameters, G i G j E i E j Q i Q j F i F j S i S j W i W j Binary energy interaction coefficient E ij * G ij * K ij U ij It can also be obtained by looking up a table.

[0063] Among them, the contrast density ρ r It needs to be based on the molar density ρ m To determine the relationship between the two, the formula is as follows:

[0064] ρ r =K 3 ρ m (2)

[0065] In the formula, K is the average volume of the mixture.

[0066] The value of K is related to the mole fraction of each component in the gas, and is calculated according to equation (3):

[0067]

[0068] In the formula, K i K j K represents the volume parameters of components i and j; ij x represents the binary energy interaction coefficients of different components; i x j denoted as mole fractions of components i and j; N is the number of components in the mixture.

[0069] The second virial number B is related to the initial temperature T and the mole fraction of the gas components. These two are input as known quantities during the calculation and are calculated according to equation (4):

[0070]

[0071] In the formula, T is the thermodynamic temperature, K; B * nij a is the interaction coefficient of the mixed components; n u n All are constants in the equation of state; E ij These are binary coefficients.

[0072] coefficient B * nij The calculation formula is as follows:

[0073]

[0074] In the formula, G ij For bivariate coefficients; g n q n f n s n w n All are constants in the equation of state; Q i Q j F i F j S i S j W i W j All of these are characteristic energy parameters.

[0075]

[0076] In the formula, E ij For bivariate coefficients; G * ij E is the coefficient of binary energy interaction; i E j Characteristic energy parameters;

[0077]

[0078] In the formula, G i G j The characteristic energy parameter is denoted as .

[0079] In equation (1), parameter C * n The calculation formula is as follows:

[0080]

[0081] The parameters U, G, Q, and F in equation (8) can be calculated using known quantities obtained from a table after knowing the composition of natural gas. The calculation formula is as follows:

[0082]

[0083]

[0084]

[0085]

[0086] All C * n After calculation, the contrast density ρ is also calculated. r molar density ρ m In this case, the right-hand side of the AGA8 equation has only one unknown, ρ. m That is, the compressibility factor Z is ρ m A univariate function.

[0087] When the gas composition of natural gas is unknown, the simulation assumes that natural gas consists of 95% methane and 5% ethane. Using AGA8, the relative density of the natural gas at this point is calculated to be 0.7, and the dynamic viscosity is 1e⁻⁵. Since the compressibility factor is affected by pressure and temperature, the natural gas pressure continuously decreases during the flow process in the steady-state simulation. To simplify the calculation, it is assumed that the compressibility factor of natural gas remains constant throughout the pipeline network. The calculation method is as follows:

[0088]

[0089] Z min Z is the compressibility factor at the point of minimum pipeline pressure. max This is the compressibility factor at the point of maximum pressure in the pipeline network.

[0090] It should be noted that Z in formula (13) max and Z min All of them are calculated using formula (1). Since formula (1) is complex, Z is preprocessed before performing the secondary rule.

[0091] Furthermore, in a specific implementation, in the above-mentioned instantaneous steady-state simulation method for natural gas pipeline networks provided in this embodiment of the invention, step S102, based on the pipeline network characteristic parameters and gas characteristic parameters, uses a quadratic programming method to perform steady-state simulation of the natural gas pipeline network. Specifically, this may include: determining the optimization decision variables, objective function, and constraints corresponding to the steady-state simulation of the natural gas pipeline network based on the pipeline network characteristic parameters and gas characteristic parameters; the objective function satisfies node flow balance, that is: using node flow balance as the objective function for optimization; the hydraulic characteristics in the constraints satisfy the steady-state formula for horizontal pipelines; the steady-state formula for horizontal pipelines includes the target compressibility factor calculated in the previous steps; and optimizing the decision variables under the constraints to obtain the globally optimal decision variables so that the objective function reaches its minimum value.

[0092] In implementation, steady-state simulation is performed using boundary conditions of constant inlet pressure and constant outlet flow. Considering the general case, it is assumed that there are x pipe segments, y nodes, and z boundaries in the pipeline network (among which a are pressure boundaries and b are flow boundaries). Then, there are x+y sets of unknown parameters in the pipeline network, namely the gas flow rate in the x pipe segments and the pressure at the y nodes.

[0093] For each section of the pipeline, the relationship between the flow rate and the pressure at the inlet and outlet nodes is as follows:

[0094]

[0095] In the formula, P in P is the pressure at the pipeline inlet node. out The pressure at the pipeline outlet node is denoted by k; k is a constant, and Q is the pipeline flow rate.

[0096] For each node, its inflow and outflow flows should satisfy the continuity equation:

[0097] ∑Q out =∑Q in (15)

[0098] In the formula, Q in For node inbound traffic; Q out This refers to the node's outbound traffic.

[0099] The aforementioned system of equations, x+y, contains x+y unknown parameters. Assuming all parameters are greater than 0, the x+y parameters can be obtained numerically. However, this system not only includes difficult-to-solve quadratic parameters, but also the inlet and outlet points of the nodes are uncertain. Without knowing the pipeline flow direction, continuity equations cannot be written, making solution difficult. Therefore, this invention proposes a steady-state simulation algorithm for natural gas pipeline networks based on optimization methods, using the flow balance of each node as the objective function for optimization design.

[0100] Table 1 below shows the optimization decision variables corresponding to the steady-state simulation of the natural gas pipeline network determined by this invention.

[0101] Table 1

[0102] i,j Node numbers indicate the nodes connecting pipes to pipes and pipes to boundaries. m,n Unknown boundary numbers, where m represents the flow boundary and n represents the pressure boundary. <![CDATA[Q i,j ]]> The natural gas flow from node i to node j is 0 during reverse transport. <![CDATA[Q m ]]> Flow at boundary m <![CDATA[P i ]]> Pressure on node i <![CDATA[P n ]]> Pressure at boundary n <![CDATA[Re i,j ]]> Reynolds number of the pipe segment from node i to node j <![CDATA[λ i,j ]]> Friction coefficient of the pipe segment from node i to node j

[0103] Furthermore, the objective function is selected based on node considerations. According to the characteristics of the nodes, the inflow and outflow at each node should be equal. The objective is to minimize the difference between the inflow and outflow, i.e., to satisfy the following for each node:

[0104]

[0105] To minimize the interpolation of inlet and outlet flows at all nodes, the objective function is as follows:

[0106]

[0107] In addition, the determined constraints include:

[0108] For the pipe segment from node i to node j, its hydraulic characteristics satisfy the steady-state formula for a horizontal pipe:

[0109]

[0110] In the formula, λ is the friction coefficient along the pipeline; Δ is the relative density of natural gas; T is the average temperature of the pipeline, K; L is the length of the pipeline section, m; C0 is the equation constant; and D is the inner diameter of the pipeline.

[0111] For a given pipeline, one of its forward and reverse flow rates is 0:

[0112] Q i,j Q j,i =0; (19)

[0113] The frictional resistance along a natural gas pipeline is calculated using the explicit Aritsuri formula:

[0114]

[0115] In the formula: Re is the Reynolds number of natural gas; e is the roughness of the inner wall of the pipeline, in meters.

[0116] The formula for calculating the Reynolds number is as follows:

[0117]

[0118] Where μ is the dynamic viscosity of natural gas, Pa·s.

[0119] For the inlet boundary pressure, we have:

[0120] P n =P in,n; (twenty two)

[0121] For the flow at the export boundary, we have:

[0122] Q m =Q out,m . (twenty three)

[0123] It should be noted that decision variables, objective functions, and constraints are the necessary elements of an optimization problem. Solving an optimization problem involves finding the optimal decision variables under constraints to minimize the objective function.

[0124] In addition, based on the extended virial equation of the AGA8 algorithm for calculating the compressibility factor, this invention has developed a formula for calculating the pipe inventory (i.e., the amount of gas actually contained in the pipe at a certain moment) under steady-state conditions, which can realize the calculation of the pipe inventory under steady-state conditions.

[0125] In practical implementation, the method for calculating the pipeline inventory of natural gas pipelines mainly includes the following steps:

[0126] The first step is to collect basic pipeline data: collect the pipeline's geometric parameters, such as pipe diameter, wall thickness, and length, as well as the basic parameters of the natural gas transported by the pipeline, such as pressure, temperature, and composition.

[0127] The second step is to calculate the natural gas flow parameters: Based on the principles of pipeline fluid mechanics, calculate the flow velocity, density, dynamic viscosity, and other parameters of natural gas in the pipeline. These parameters can be calculated based on fluid properties, pipeline geometry, and flow conditions.

[0128] The third step is to determine the boundary conditions: Based on measured data or design requirements, determine the measured pressure, temperature, and flow rate at both ends of the pipeline. These data are used as the starting and ending points for pipeline storage calculations.

[0129] Step 4: Perform pipe inventory calculation: Using the pipe fluid dynamics equations and mass conservation equations, combined with boundary conditions and pipe parameters, perform pipe inventory calculation. The calculation results include parameters such as pressure, flow rate, and temperature at various locations along the pipeline, and determine the pipe inventory based on the calculation results.

[0130] Step 5: Verification and Adjustment: Verify the calculation results based on the measured data and make adjustments as needed. If there is a significant deviation between the calculation results and the measured data, it may be necessary to adjust the model parameters or boundary conditions to improve the accuracy of the calculation.

[0131] The national standard calculation method uses average pressure and average temperature as indicators of the current state of the gas inside the pipeline and calculates pipeline inventory based on these indicators. This method is essentially a steady-state pipeline inventory calculation method. However, by employing a timed update approach, the national standard calculation method, based on steady-state pipeline inventory calculations, makes the calculation results closer to reality through time-based corrections. In this way, the pipeline inventory calculation can better adapt to changes in the gas state inside the pipeline, achieving a quasi-steady-state effect, thereby improving the reliability of the calculation results and providing a more reliable basis for relevant decision-making and management.

[0132] The calculation method for the gas storage V0 of a single pipeline in a gas transmission network is as follows:

[0133]

[0134]

[0135]

[0136] Where: V0 is the pipe stock in the pipe section under standard conditions, m 3 V represents the design capacity of the pipe section, in meters. 3 ;P avg T0 is the average gas pressure within the pipe section, in MPa; T0 is the temperature under standard reference conditions, 293.15 K; Z0 is the compressibility factor under standard reference conditions, 0.9980; P0 is the pressure under standard reference conditions, 0.101325 MPa; T0 avg Z represents the average gas temperature within the pipe section, in K; avg T is the average compressibility factor under operating conditions. in The gas temperature at the starting point of the pipe section is K; T out The gas temperature at the end of the pipe section is K; P in P represents the gas pressure at the starting point of the pipeline section, in MPa. out The pressure is the gas pressure at the end of the pipe section, in MPa.

[0137] Furthermore, in specific implementation, in the above-mentioned transient steady-state simulation method for natural gas pipeline networks provided in the embodiments of the present invention, step S103 transforms the hyperbolic partial differential equation of transient natural gas flow into a transient flow calculation model of natural gas pipeline networks based on constant coefficient correlation matrix and node-pipeline correlation matrix, which may specifically include the following steps:

[0138] Step 1: Obtain the node-pipeline correlation matrix based on the hyperbolic partial differential equation of transient natural gas flow.

[0139] In practical implementation, the above steps involve obtaining the node-pipeline correlation matrix based on the hyperbolic partial differential equation of transient natural gas flow. Specifically, this may include: establishing a compressor model and a gas turbine model based on the hyperbolic partial differential equation of transient natural gas flow; obtaining the node-pipeline correlation matrix based on the compressor model and the gas turbine model; and using this node-pipeline correlation matrix to represent the topology of the natural gas pipeline network.

[0140] A set of one-dimensional hyperbolic partial differential equations, consisting of the mass conservation equation, momentum conservation equation, and energy conservation equation, along with the state equation, is used to describe the transient changes of natural gas in the pipeline network. For transient modeling of natural gas flow, temperature changes can be ignored; therefore, the above set of one-dimensional hyperbolic partial differential equations only needs to consider the mass conservation equation, momentum conservation equation, and state equation. The third term in equation (27) is the convection term. When the gas velocity is much less than the speed of sound, this term is close to 0, so in engineering practice, the convection term can be ignored.

[0141]

[0142]

[0143] P=ZρR g T; (29)

[0144] In the formula, D and θ are the inner diameter and inclination of the pipe; T, P, u, and ρ are the temperature, pressure, velocity, and density of the natural gas; λ is the friction coefficient; R g It is the gas constant.

[0145] The friction coefficient can be obtained from the implicit Colebrook-White formula:

[0146]

[0147] Furthermore, considering the calculation of the compression coefficient Z, it is not difficult to transform equations (27) to (28) into the following form:

[0148]

[0149]

[0150]

[0151] Next, compressor and gas turbine models are established sequentially. Based on these models, the node-pipeline correlation matrix is ​​obtained. It is understandable that, due to the speed of sound limitation on pressure propagation in natural gas pipelines, the inlet and outlet flow rates are not consistent in transient situations. However, the law of mass conservation still applies to each node. Therefore, this invention uses the node-pipeline correlation matrix NPIM to represent the topology of the Natural Gas Pipeline Network (NPGN).

[0152]

[0153] Step 2: Transform the hyperbolic partial differential equation of transient natural gas flow into a linear ordinary differential equation with time-varying parameters using the Laplace transform.

[0154] In practice, to further obtain the transient flow model of natural gas, the hyperbolic partial differential equation was linearized using reference values ​​of P0, T0, A0, and ρ0. Simultaneously, under the premise that the gas velocity is much lower than the speed of sound, the equation was simplified and then further transformed into a linear ordinary differential equation (ODE) with time-varying parameters through Laplace transformation (34)~(35):

[0155]

[0156]

[0157] Step 3: Set boundary conditions for the linear ordinary differential equations and construct a transient flow transfer function model for natural gas.

[0158] For the aforementioned ODE system, various types of boundary conditions can be solved. When the specified boundary conditions are inlet pressure and outlet flow rate, the system equations of the aforementioned ODE system are the natural gas transient flow transfer function model (TFM):

[0159]

[0160]

[0161] When the specified boundary conditions are inlet pressure and outlet pressure, the system equations for the above ODE system are:

[0162]

[0163]

[0164] Step 4: Obtain the constant coefficient correlation matrix based on the transient flow transfer function model of natural gas.

[0165] In specific implementation, the above steps, based on the transient flow transfer function model of natural gas, obtain the constant coefficient correlation matrix. Specifically, this may include: using the bilinear transformation method to convert the transient flow transfer function model of natural gas into a discrete transfer function model; using the hysteresis theorem to transform the discrete transfer function model from the frequency domain into a difference form in the time domain, and then discretizing it in the time domain to obtain the constant coefficient correlation matrix.

[0166] In practice, this invention can use the bilinear transformation method to convert the above-mentioned transient natural gas flow transfer function model (TFM) into a discrete transfer function model (DTFM). The discretization formula of the bilinear transformation method is as follows:

[0167]

[0168]

[0169]

[0170]

[0171]

[0172] In the formula, T V The sampling time is consistent with the actual sampling time of the SCADA system on site. V =60s.

[0173]

[0174]

[0175]

[0176]

[0177] The above DTFM (41)~(42) is further transformed from the frequency domain to the time domain differential form using the hysteresis theorem (41). (42)~(43) is further discretized in the time domain and then reorganized as follows: The form (46) is given, where matrix A is a constant coefficient incidence matrix CCCM:

[0178]

[0179]

[0180]

[0181]

[0182]

[0183]

[0184] Furthermore, let:

[0185]

[0186]

[0187] To solve the above equation, further boundary conditions need to be added to close the equation. Taking the inlet pressure and outlet flow rate as boundary conditions as an example, the final transient solution model of the natural gas pipeline is shown in equation (47). In practice, the present invention can drive the operation of the model through real-time SCADA data.

[0188]

[0189] If you want to further model complex pipe networks based on the above simple pipe model, you only need to clarify the relationship between mass flow rate and pressure in the boundary conditions of the pipe network.

[0190] Step 5: Construct a transient flow calculation model for natural gas pipeline networks based on constant coefficient correlation matrices and node-pipeline correlation matrices.

[0191] Specifically, the present invention can transform equation (39) into (40) by using CCCM and NIPM, and further represent the variables to be solved separately to form a transient solution model (41) for natural gas pipeline network. The model consists of three parts: the solution vector of NGPN, the inverse matrix of CCCM & NIPM, and the historical matrix composed of the historical values ​​of the solution vector.

[0192] For an NGPN consisting of j pipes, the solution vector contains 4*j variables, namely the inlet pressure, inlet mass flow rate, outlet pressure, and outlet mass flow rate of the j-th pipe. The history matrix consists of the historical values ​​of the solution vector with dimension 2*j, a zero vector with dimension i*1, and the boundary condition vector at time t with dimension q*1.

[0193] The transient solution model for natural gas pipeline networks does not separate the known variables and the variables to be solved on both sides of the equation. That is, there is no need to transform CCCM & NIPM during the solution process. At the same time, when the pipeline network topology is fixed, NIPM will not change with each iteration. Therefore, CCCM & NIPM are constant coefficient matrices. Both of these points can ensure efficient transient calculation of the pipeline network.

[0194] Based on this, the equations for the transient flow calculation model of the natural gas pipeline network mentioned above can be:

[0195]

[0196]

[0197] In the formula, j represents the number of pipe segments constituting the natural gas pipeline network; P inj M is the inlet pressure of the j-th segment of the pipeline; inj Let P be the inlet mass flow rate of the j-th pipe segment; outj M is the outlet pressure of the j-th pipe segment; outj Let be the outlet mass flow rate of the j-th pipe segment; B1 and B2 are the historical column vectors during the simulation; α and β are the boundary conditions used for the simulation, and q is the number of boundary conditions; CCCM j NPIM is a constant coefficient correlation matrix describing the physical properties of the j-th pipeline. j This is a node-pipe correlation matrix describing the pressure and mass flow rate at the nodes of the j-th pipe and its connected pipes.

[0198] It should be noted that in the steady-state simulation of the natural gas pipeline network, this invention adopts the optimization concept, transforming the traditional method of solving multiple quadratic equations into an optimization problem based on quadratic programming. This eliminates the need for solving multiple quadratic equations, comprehensively considering natural gas flow constraints, pipeline node constraints, and pipe segment constraints, and performing overall optimization to obtain a globally optimal solution, significantly improving the steady-state solution speed. In the transient simulation of natural gas, this invention uses control theory to transform the partial differential equations describing the transient flow of natural gas into linear algebraic equations based on the constant coefficient correlation matrix (CCCM) and the node-pipeline correlation matrix (NPIM) through Laplace transform and hysteresis theorem. This ensures efficient modeling and significantly improves computational speed. Simultaneously, this method can couple common equipment such as compressors and valves with the pipeline transient flow model through the constant coefficient correlation matrix, enabling full-element modeling of the natural gas pipeline network. Compared to traditional steady-state and transient simulation algorithms, the fast simulation method proposed in this invention can meet the speed and accuracy requirements of current online simulation and pipeline digital twin construction.

[0199] Based on the same inventive concept, this invention also provides a natural gas pipeline network transient steady-state simulation device. Since the principle of this device in solving the problem is similar to that of the aforementioned natural gas pipeline network transient steady-state simulation method, the implementation of this device can refer to the implementation of the natural gas pipeline network transient steady-state simulation method, and the repeated parts will not be described again.

[0200] In specific implementation, the natural gas pipeline network transient steady-state simulation device provided in this embodiment of the invention, such as... Figure 2 As shown, it specifically includes:

[0201] Parameter determination module 11 is used to determine pipeline characteristic parameters and gas characteristic parameters according to simulation requirements;

[0202] Steady-state simulation module 12 is used to perform steady-state simulation of natural gas pipeline network based on pipeline characteristic parameters and gas characteristic parameters using quadratic programming method;

[0203] Model transformation module 13 is used to transform the hyperbolic partial differential equation of transient natural gas flow into a calculation model of transient natural gas pipeline network flow based on constant coefficient correlation matrix and node-pipeline correlation matrix.

[0204] The transient simulation module 14 is used to perform transient simulation of the natural gas pipeline network using a transient flow calculation model of the natural gas pipeline network.

[0205] In the above-mentioned transient and steady-state simulation device for natural gas pipeline networks provided in this embodiment of the invention, the steady-state simulation part adopts the idea of ​​optimization and abandons the method of solving multiple quadratic equations, which greatly improves the accuracy and efficiency of steady-state solution. In the transient simulation part, the partial differential equations describing the transient flow of natural gas are transformed into a calculation model of transient flow of natural gas pipeline network based on constant coefficient correlation matrix and node-pipeline correlation matrix using the model transformation module. This not only ensures the efficiency of modeling, but also greatly improves the calculation speed. This enables fast and accurate modeling, steady-state simulation and transient simulation of complex natural gas pipeline networks, making up for the shortcomings of traditional simulation methods in terms of solution speed.

[0206] For more detailed information on the working process of each of the above modules, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0207] Accordingly, this invention also discloses an electronic device, including a processor and a memory; wherein, when the processor executes the computer program stored in the memory, it implements the natural gas pipeline transient steady-state simulation method disclosed in the foregoing embodiments. For more specific details of the above method, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0208] Furthermore, the present invention also discloses a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, it implements the aforementioned disclosed method for transient steady-state simulation of natural gas pipeline networks. For more detailed information on the above method, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0209] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, and storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0210] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0211] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0212] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0213] The above provides a detailed description of the instantaneous steady-state simulation method for natural gas pipeline networks provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for simulating the transient steady state of a natural gas pipeline network, characterized in that, include: Determine the characteristic parameters of the pipeline network and the gas characteristic parameters according to the simulation requirements; Based on the pipeline characteristic parameters and the gas characteristic parameters, a steady-state simulation of the natural gas pipeline network is performed using the quadratic programming method. Based on the hyperbolic partial differential equation of transient natural gas flow, the node-pipeline correlation matrix is ​​obtained; the node-pipeline correlation matrix is ​​used to represent the topology of the natural gas pipeline network. The hyperbolic partial differential equation of the transient flow of natural gas is transformed into a linear ordinary differential equation with time-varying parameters using the Laplace transform. Boundary conditions are set for the linear ordinary differential equations to construct a transient flow transfer function model for natural gas. Based on the transient flow transfer function model of natural gas, the constant coefficient correlation matrix is ​​obtained; A transient flow calculation model for the natural gas pipeline network is constructed based on the constant coefficient correlation matrix and the node-pipeline correlation matrix; the equations of the transient flow calculation model for the natural gas pipeline network are as follows: ; in, j The number of pipe segments that make up the natural gas pipeline network; P inj For the first j The inlet pressure of the pipeline section; M inj For the first j The inlet mass flow rate of the pipeline segment; P outj For the first j The outlet pressure of the pipeline section; M outj For the first j The outlet mass flow rate of the pipeline segment; B 1, B 2 represents the historical column vector during the simulation process; These are the boundary conditions used for simulation. q The number of boundary conditions; CCCM j To describe the first j The constant coefficient correlation matrix of the physical properties of the pipeline; NPIM j To describe the first j The node-pipe correlation matrix for pressure and mass flow rate at nodes of a single pipeline and its connected nodes; The transient flow calculation model of the natural gas pipeline network is used to perform transient simulation of the natural gas pipeline network.

2. The instantaneous steady-state simulation method for natural gas pipeline networks according to claim 1, characterized in that, Determine the gas characteristic parameters, including: The extended virial equation of the AGA8 algorithm is used to calculate the compressibility factor at the point of minimum pipeline pressure and the compressibility factor at the point of maximum pipeline pressure in the gas characteristic parameters. The target compressibility factor is determined based on the average of the compressibility factor at the point of minimum pipeline pressure and the compressibility factor at the point of maximum pipeline pressure.

3. The instantaneous steady-state simulation method for natural gas pipeline networks according to claim 2, characterized in that, Based on the pipeline network characteristic parameters and the gas characteristic parameters, a steady-state simulation of the natural gas pipeline network is performed using quadratic programming, including: Based on the pipeline characteristic parameters and the gas characteristic parameters, the optimization decision variables, objective function, and constraints corresponding to the steady-state simulation of the natural gas pipeline network are determined; the objective function satisfies the node flow balance; the hydraulic characteristics in the constraints satisfy the steady-state formula for horizontal pipelines; the steady-state formula for horizontal pipelines includes the target compressibility factor; Under the given constraints, the optimization decision variables are optimized to obtain the globally optimal decision variables, so that the objective function reaches its minimum value.

4. The instantaneous steady-state simulation method for natural gas pipeline networks according to claim 3, characterized in that, Based on the hyperbolic partial differential equation of the transient natural gas flow, the node-pipeline correlation matrix is ​​obtained, including: Based on the hyperbolic partial differential equations of the transient flow of natural gas, a compressor model and a gas turbine model are established. Based on the compressor model and the gas turbine model, the node-pipeline correlation matrix is ​​obtained.

5. The instantaneous steady-state simulation method for natural gas pipeline networks according to claim 4, characterized in that, Based on the aforementioned transient flow transfer function model of natural gas, the constant coefficient correlation matrix is ​​obtained, including: The transient flow transfer function model of natural gas is converted into a discrete transfer function model using the bilinear transformation method. The discrete transfer function model is transformed from the frequency domain to a difference form in the time domain using the hysteresis theorem, and then discretized in the time domain to obtain the constant coefficient correlation matrix.

6. A natural gas pipeline network transient steady-state simulation device, characterized in that, include: The parameter determination module is used to determine the characteristic parameters of the pipeline network and the gas characteristic parameters according to the simulation requirements. The steady-state simulation module is used to perform steady-state simulation of the natural gas pipeline network using quadratic programming based on the pipeline network characteristic parameters and the gas characteristic parameters. The model transformation module is used to obtain the node-pipeline correlation matrix based on the hyperbolic partial differential equation of transient natural gas flow; the node-pipeline correlation matrix is ​​used to represent the topology of the natural gas pipeline network; the hyperbolic partial differential equation of transient natural gas flow is transformed into a linear ordinary differential equation with time-varying parameters through Laplace transform; boundary conditions are set for the linear ordinary differential equation to construct a transient natural gas flow transfer function model; a constant coefficient correlation matrix is ​​obtained based on the transient natural gas flow transfer function model; a transient natural gas pipeline network calculation model is constructed based on the constant coefficient correlation matrix and the node-pipeline correlation matrix; the equations of the transient natural gas pipeline network calculation model are: ; in, j The number of pipe segments that make up the natural gas pipeline network; P inj For the first j The inlet pressure of the pipeline section; M inj For the first j The inlet mass flow rate of the pipeline segment; P outj For the first j The outlet pressure of the pipeline section; M outj For the first j The outlet mass flow rate of the pipeline segment; B 1, B 2 represents the historical column vector during the simulation process; These are the boundary conditions used for simulation. q The number of boundary conditions; CCCM j To describe the first j The constant coefficient correlation matrix of the physical properties of the pipeline; NPIM j To describe the first j The node-pipe correlation matrix for pressure and mass flow rate at nodes of a single pipeline and its connected nodes; The transient simulation module is used to perform transient simulation of the natural gas pipeline network using the transient flow calculation model of the natural gas pipeline network.

7. An electronic device, characterized in that, It includes a processor and a memory, wherein the processor executes a computer program stored in the memory to implement the transient steady-state simulation method for natural gas pipeline networks as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the instantaneous steady-state simulation method for natural gas pipeline networks as described in any one of claims 1 to 5.