Gas pipe network steady state simulation method and device, electronic device and storage medium
By switching the friction model in stages and using the Newton-Raphson method for iterative solution, the problem of balancing accuracy and speed in large-scale gas pipeline network simulation was solved, achieving efficient and accurate simulation analysis and scheduling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN RUIXUN TECHNOLOGY CO LTD
- Filing Date
- 2025-11-07
- Publication Date
- 2026-04-10
AI Technical Summary
Existing steady-state simulation technology for gas pipeline networks struggles to achieve a dynamic balance between accuracy and speed when dealing with large-scale, complex pipeline networks. Traditional single friction models either sacrifice real-time performance or lose convergence reliability, failing to meet diverse needs.
A phased dynamic switching friction model method is adopted. In the initial stage, a preset high-speed model is used to quickly drive the residual approximation in the early stage of iteration. The model is dynamically selected by the relationship between the residual infinite norm and the threshold, and the model is switched to a high-precision model to ensure final convergence. The simulation accuracy and efficiency are optimized by combining the global convergence tolerance error and the Newton-Raphson method for iterative solution.
While ensuring simulation accuracy, it significantly shortens the calculation time, improves the calculation efficiency of large-scale gas pipeline networks, is suitable for rapid analysis and online scheduling, and meets real-time requirements.
Smart Images

Figure CN121835461A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of pipe network system simulation and optimization, in particular to a gas pipe network steady-state simulation method, device, electronic device and storage medium. BACKGROUND
[0002] With the continuous expansion of the city scale, the gas pipe network system is becoming more and more complex, and its planning, operation and scheduling put forward higher requirements on the calculation accuracy and efficiency of simulation technology. The modern gas pipe network simulation system integrates geographic information system (GIS), supervisory control and data acquisition system (SCADA) and other data to build a digital twin model, and uses a hydraulic calculation engine to solve the key parameters such as pressure and flow in the pipe network, so as to realize the working condition prediction and optimal scheduling.
[0003] The core of hydraulic calculation is to solve a large-scale nonlinear equation set based on Kirchhoff's law, which is usually solved by iterative algorithm. In this process, the calculation of pipe friction coefficient is a key link that affects the simulation accuracy and speed. Currently, two models are mainly used for calculation in engineering: High-precision model: needs to be solved by numerical iteration, with large calculation overhead but high precision (error <0.3%).
[0004] High-speed model: no iteration is needed, with fast calculation speed but relatively low engineering precision (error about 1-3%).
[0005] For a large-scale urban gas pipe network containing tens of thousands to hundreds of thousands of pipe segments, the traditional simulation strategy faces serious challenges: if the high-precision model is used throughout the entire process, each pipe segment needs to perform internal iteration in each global iteration, resulting in a dramatic increase in the time consumption of a single iteration, and the overall simulation speed cannot meet the needs of real-time scheduling or rapid optimization analysis. If the high-speed model is used throughout the entire process, although the calculation speed is fast, the inherent error limits the precision of the final solution. When the set convergence tolerance is less than the model's own error, the solving process may not converge, or the results may not be reliable enough to be applied to high-precision scenarios.
[0006] In summary, the existing steady-state simulation technology for gas pipe networks faces the core contradiction of "high precision and high speed cannot be reconciled" when dealing with large-scale complex pipe networks: the traditional single friction model selection method either sacrifices real-time performance for precision or loses convergence reliability for speed, making it difficult to adapt to the diverse needs of large-scale pipe networks from real-time scheduling to detailed analysis, and an optimization scheme that can dynamically balance precision and speed is urgently needed. SUMMARY
[0007] In order to solve the technical problem that the calculation accuracy and the calculation efficiency are difficult to be considered in the existing large-scale city gas pipe network simulation strategy, the present application provides a gas pipe network steady-state simulation method, equipment, electronic equipment and storage medium, which can significantly shorten the calculation time under the premise of ensuring that the simulation result finally reaches high-precision convergence, effectively solve the convergence problem caused by the precision limitation of the simplified model, and is suitable for rapid analysis, online simulation and optimal scheduling of large-scale gas pipe network system.
[0008] In the first aspect, the present application provides a gas pipe network steady-state simulation method, comprising: According to the topological structure and working condition parameters of the gas pipe network, a nonlinear equation set with node pressure as unknown quantity is constructed, and a global convergence allowable error is set; The equation set is iteratively solved, and the following friction model switching strategy is executed in the iteration process, comprising: In the initialization stage, a preset high-speed model is used to calculate the friction coefficient of each pipeline; The infinite norm of the node flow residual is calculated in the current iteration step; When the infinite norm is greater than the first threshold value, the preset high-speed model is used to calculate the pipeline friction coefficient in the next iteration step; When the infinite norm is less than or equal to the first threshold value for the first time, the preset high-precision model is switched to calculate the friction coefficient, and the preset high-speed model is continuously used in the subsequent iterations without switching back; When the infinite norm is less than the global convergence allowable error, it is determined that the calculation converges, and the pipe network node pressure and pipe segment flow distribution results are output.
[0009] The gas pipe network steady-state simulation method provided by the embodiment of the present application effectively solves the pain point that the accuracy and speed of the traditional single model cannot be considered by dynamically switching the friction model in stages. In the initialization stage, the preset high-speed model is used to quickly drive the residual to approach the convergence direction, greatly shortening the time consumption in the initial iteration stage. The relationship between the residual infinite norm and the threshold value is used as the switching basis to ensure that the model selection adapts to the iteration process, the speed is preserved when the residual is large, and the high-precision model is switched to and continuously used after the first standard is met, avoiding the shock caused by frequent model switching. Finally, the global convergence tolerance is used as the termination standard to ensure the accuracy of the output results. For a large-scale pipe network containing tens of thousands of pipe segments, the simulation accuracy can meet the engineering requirements while improving the calculation efficiency, adapting to real-time scenarios such as online scheduling and multi-working condition analysis.
[0010] In an alternative embodiment, the nonlinear equation set with the node pressure as an unknown quantity is constructed based on the Kirchhoff's law, the sum of the inlet and outlet pipe segment flow rates of each node in the pipe network is equal to the actual flow rate of the node, the actual flow rate of the node is zero, a gas supply flow rate or a gas consumption flow rate, and the node flow rate residual is the difference between the calculated flow rate of the node and the actual flow rate of the node; wherein the calculated flow rate of the node is obtained based on a preset pipe segment flow rate calculation formula, and the preset pipe segment flow rate calculation formula is:
[0011] In the formula, Q represents a standard state flow rate, C represents a flow rate constant, e represents a pipe efficiency, T b represents a reference temperature, P b represents a reference pressure, D represents a pipe inner diameter, P1 represents an inlet absolute pressure, P2 represents an outlet absolute pressure, L represents a pipe length, G represents a gas relative density, T a represents an average gas temperature, Z a represents an average gas compression factor, and f represents a Darcy friction factor, which is calculated through the preset high-precision model and the preset high-speed model.
[0012] The present application provides the construction logic of the nonlinear equation set and the calculation basis of the node flow rate residual, and provides accurate mathematical support for the friction model switching. The equation set is constructed based on the Kirchhoff's law, which ensures that the pipe network flow rate conservation relationship is accurately mapped in the mathematical model, avoids errors caused by the simplification of the topological structure, clearly defines that the calculated flow rate of the node is obtained through the preset pipe segment flow rate formula, and the Darcy friction factor is calculated by the corresponding model, so that the flow rate, the friction factor and the node pressure form a complete logical closed loop. This clear parameter correlation and calculation logic not only makes the simulation process traceable and reproducible, but also avoids calculation deviations caused by ambiguous parameter definitions, further guarantees the stability of subsequent iterative solutions and the reliability of the final results, and provides a rigorous mathematical basis for large-scale pipe network simulation.
[0013] In an alternative embodiment, the global convergence allowable error is determined according to the calculation accuracy; the first threshold value is determined according to the approximate accuracy level that can be reached by the preset high-speed model under typical working conditions of the gas pipe network; the Newton-Raphson method is used to iteratively solve the equation set, and in the iterative process of the Newton-Raphson method, the unknown quantity of the node pressure is linearly corrected by constructing the residual vector and its Jacobian matrix under the current solution, and the true solution is gradually approached.
[0014] The embodiment of the present application further optimizes the balance between the accuracy and efficiency of simulation by explicitly setting the value of the global convergence tolerance and the Newton-Raphson iteration solving logic. The tolerance setting meets the high-precision requirements of gas pipe network pressure calculation and accident condition simulation scenarios, and avoids excessive iteration and waste of resources. The Newton-Raphson method corrects the node pressure by constructing a residual vector and a Jacobian matrix, which has a faster convergence speed than other iteration methods and can reduce the number of iteration steps. At the same time, the linearization correction process can accurately capture the influence of node pressure changes on flow, and combined with the friction model switching strategy, it can greatly shorten the iteration convergence time of large-scale pipe networks while ensuring the stability of convergence, and balance the engineering practicability and calculation efficiency.
[0015] In an optional embodiment, the nodes include flow known nodes and pressure known nodes; for the flow known nodes, the inflow or outflow is given as a condition, and the pressure value of the node is obtained by iteration; for the pressure known nodes, the node pressure is fixed as a boundary condition, and the flow value of the node is obtained by iteration.
[0016] The embodiment of the present application improves the adaptability of the simulation method to complex pipe network boundary conditions by distinguishing node types and explicitly solving the logic. The solving target is set for the flow known nodes and the pressure known nodes respectively, which conforms to the working condition characteristics of the actual gas pipe network, accurately back calculates the unknown quantity without repeated solving of known parameters, and reduces the redundant dimension of the equation set. This differentiated solving logic enables the model to flexibly cope with large-scale pipe networks with mixed boundary conditions, avoids convergence failure or result deviation caused by improper handling of boundary conditions, reduces the complexity of Jacobian matrix construction, further improves the efficiency of iteration solving, and ensures the consistency of simulation results and actual pipe network working conditions.
[0017] In an optional embodiment, the preset high-speed model is Haaland explicit formula, and the preset high-precision model is Colebrook-White implicit equation; the first threshold value is 0.05 m³ / h, which corresponds to the approximate precision level that the Haaland explicit formula can achieve under typical working conditions of the gas pipe network.
[0018] The embodiment of the present application clearly presets the model type and the first threshold value, so that the friction model switching strategy is more operable and targeted. As a high-speed model, the Haaland explicit formula reduces the time consumption of single pipe segment friction coefficient calculation by more than 90% compared with the Colebrook-White model, which can quickly promote the initial iteration residual to decrease; the high-precision characteristic of the Colebrook-White implicit equation can meet the precision requirement when the residual approximation convergence tolerance is met. The first threshold value of 0.05 m3 / h accurately matches the approximate precision upper limit of the Haaland model, ensuring that the switching time is just right, avoiding the efficiency loss caused by early switching, and preventing insufficient precision caused by late switching. This accurate matching of "model-threshold" enables the strategy to achieve optimal efficiency and precision in different scale pipe networks without additional debugging, reducing the cost of engineering application. In an optional embodiment, the method further comprises: setting a hysteresis control interval when switching the friction model, the hysteresis control interval being an interval in which the infinite norm of the node flow residual decreases below the first threshold value, and in the hysteresis control interval, the Colebrook-White implicit equation is solved for the friction coefficient by 3-5 times of Newton method iteration.
[0019] The present application further balances simulation accuracy and efficiency by setting a hysteresis control interval and limiting the number of iterations of the high-precision model. The hysteresis control interval is explicitly defined as an interval in which the residual decreases below the first threshold value, which can avoid repeated switching of the model caused by small fluctuations in the residual, maintain the stability of the iteration process, and reduce computational interference; the Colebrook-White model only needs 3-5 times of Newton method iteration, which can ensure that the calculation error of the friction coefficient is less than 0.3% and meet the accuracy requirement, and can reduce the time consumption of single pipe segment calculation by more than 90% compared with unlimited iteration. This fine design ensures the final simulation accuracy while avoiding the waste of efficiency caused by excessive calculation of the high-precision model, so that large-scale pipe network simulation achieves an optimal balance among stable convergence, accuracy, and high speed.
[0020] In an optional embodiment, the method further comprises: recording parameters and calculation results of each iteration, the parameters including the current friction coefficient calculation model, the node pressure value, and the pipe segment flow value, and the calculation results including the node flow residual and the infinite norm of the residual; If the number of iterations reaches the preset maximum value but does not converge, and the node flow residual continues to decrease, the number of iterations is automatically extended, or when the global convergence tolerance error cannot be reached, the pipe network state result corresponding to the minimum infinite norm of the node flow residual in the record is used.
[0021] The application improves the reliability and fault tolerance of the simulation method through the iteration recording and exception handling mechanism. The iteration parameters and results are recorded, which facilitates subsequent tracing of the simulation process, analysis of the convergence exception reasons, and data support for pipe network simulation optimization. When the iteration reaches the maximum value and does not converge, but the residual error continues to decrease, the number of iterations is automatically extended, which can avoid solution failure caused by insufficient preset iteration number and improve the convergence success rate. When convergence tolerance cannot be reached, the result with the smallest residual error is selected, which can provide a pipe network state closest to the true solution under extreme conditions and avoid simulation interruption.
[0022] In a second aspect, the application provides a gas pipe network steady-state simulation device, the device comprising: An equation set construction module, configured to construct a nonlinear equation set with node pressure as an unknown quantity according to the topological structure and working condition parameters of the gas pipe network, and set a global convergence allowable error; An equation set solving module, configured to iteratively solve the equation set and execute the following friction model switching strategy in the iteration process, comprising: An initialization unit, configured to calculate the friction coefficient of each pipe by using a preset high-speed model in the initialization stage; A flow residual error calculation unit, configured to calculate the infinity norm of the node flow residual error in the current iteration step; A first model switching detection unit, configured to continue to calculate the pipe friction coefficient by using the preset high-speed model in the next iteration step when the infinity norm is greater than a first threshold value; A second model switching detection unit, configured to switch to calculate the friction coefficient by using a preset high-precision model when the infinity norm is less than or equal to the first threshold value for the first time, and continue to use the preset high-speed model in the subsequent iteration without switching back; A simulation result output unit, configured to determine that the calculation converges when the infinity norm is less than the global convergence allowable error, and output the pipe network node pressure and pipe segment flow distribution results.
[0023] In a third aspect, the application provides an electronic device, comprising a memory and a processor, which are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the gas pipe network steady-state simulation method of the first aspect or any of the corresponding embodiments thereof.
[0024] In a fourth aspect, the application provides a computer readable storage medium, which stores computer instructions for causing a computer to execute the gas pipe network steady-state simulation method of the first aspect or any of the corresponding embodiments thereof.
[0025] In a fifth aspect, the present application provides a computer program product comprising computer instructions for causing a computer to perform the steady-state simulation method of a gas pipeline network according to the first aspect or any of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS
[0026] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0027] Figure 1 is a flowchart of the steady-state simulation method of a gas pipeline network according to an embodiment of the present application; Figure 2 is a schematic diagram of solving a nonlinear equation set by the Newton-Raphson method according to an embodiment of the present application; Figure 3 is a structural block diagram of the steady-state simulation device of a gas pipeline network according to an embodiment of the present application; Figure 4 is a hardware structure schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0029] It can be understood that before using the technical solutions disclosed in the embodiments of the present application, the type, use range, use scenario and the like of the personal information involved in the present application should be informed to the user and the authorization of the user should be obtained in a proper manner according to relevant laws and regulations.
[0030] The terms "first", "second" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.
[0031] The existing steady-state simulation technology of a gas pipe network faces a core contradiction between high precision and high speed when processing a large-scale complex pipe network: the selection mode of a traditional single friction model sacrifices real-time performance for precision or loses convergence reliability for speed, and thus cannot adapt to the diversified needs of a large-scale pipe network from real-time scheduling to fine analysis, and an optimized scheme that dynamically balances precision and speed is urgently needed.
[0032] The application provides a steady-state simulation method for a gas pipe network, which can perform hydraulic calculation on a large and complex gas pipe network, guarantee calculation precision and efficiency, and realize efficient and accurate simulation analysis of the gas pipe network. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here. Figure 1 The flowchart of the steady-state simulation method for a gas pipe network according to the embodiment of the application is shown in FIG. 1, which includes the following steps: Figure 1 Step S1: According to the topological structure and working condition parameters of the gas pipe network, a nonlinear equation set with node pressure as an unknown quantity is constructed, and a global convergence tolerance error is set.
[0033] Specifically, the topological structure and working condition parameters of the gas pipe network are derived from a geographic information system (GIS), a computer-aided design (CAD) diagram, a supervisory control and data acquisition system (SCADA), and an Internet of Things system. The working condition parameters include pipe diameter, length, absolute roughness, relative density of gas, average temperature, average compression factor, dynamic viscosity, and gas source supply pressure and user gas consumption. The global convergence tolerance error is determined according to the calculation precision, and the user can customize the setting according to the actual demand, for example, set to 0.001 m³ / s.
[0034] The embodiment of the application constructs a nonlinear equation set with node pressure as an unknown quantity based on the topological structure and working condition parameters of the pipe network, which is the core basis of the steady-state simulation of the gas pipe network, guarantees the consistency of the simulation results and the actual pipe network working conditions from the source, provides a precise mathematical basis for the subsequent friction model switching and iterative solution, and sets the global convergence tolerance error, which provides a clear termination standard for the iterative solution of the nonlinear equation set. In the iterative process, the size relationship between the infinite norm of the node flow residual (the maximum value of the absolute values of all node residuals) and the tolerance can be used to intuitively judge whether the current solution meets the engineering requirements; the problems of “insufficient iteration leading to insufficient precision” or “excessive iteration wasting time” in the traditional fixed iteration number mode are avoided, and the key judgment basis for the subsequent adaptive switching of the friction model is provided, and finally the balance between precision and speed is achieved.
[0035] Step S2 involves iteratively solving the system of equations. During the iteration process, the following friction model switching strategy is implemented: S21, Initialization stage: The friction coefficient of each pipe is calculated using a preset high-speed model; S22, calculate the infinite norm of the node flow residual in the current iteration step; S23, when the infinity norm is greater than the first threshold, the preset high-speed model is used to calculate the pipe friction coefficient in the next iteration step; S24, when the infinite norm is less than or equal to the first threshold for the first time, switch to using the preset high-precision model to calculate the friction coefficient, and continue to use the preset high-speed model in subsequent iterations without switching back; S25, when the infinite norm is less than the global convergence tolerance, the calculation is determined to be converged, and the pressure distribution of the pipeline node and the flow distribution of the pipeline segment are output.
[0036] During the iterative solution phase of the equation system, this embodiment of the invention dynamically selects the friction calculation model in stages. Without sacrificing the final simulation accuracy, it significantly improves the computational efficiency of steady-state simulation of large-scale gas pipeline networks, perfectly solving the technical pain point of traditional single-model simulations that cannot simultaneously achieve both accuracy and speed. Specifically: Step S21 explicitly states that the initialization phase uses a preset high-speed model (e.g., the Haaland explicit formula in this embodiment) to calculate the friction coefficient, which aligns with the initial needs of gas pipeline network simulation iteration: in the initial iteration stage, the initial values of node pressure deviate significantly from the actual solution. At this time, it is not necessary to pursue extremely high accuracy of the friction coefficient, but rather to quickly narrow the residual range to approximate the convergence direction. As an explicit formula that does not require internal iteration, the Haaland explicit formula can reduce the calculation time of the friction coefficient of a single pipe segment by more than 90% compared to the high-precision model (Colebrook-White implicit equation) that requires multiple iterations. For large-scale pipeline networks containing tens of thousands to hundreds of thousands of pipe segments, each iteration can reduce a large amount of repetitive calculation overhead, quickly pushing the infinite norm of the node flow residual closer to the first threshold, significantly shortening the time spent in the rough approximation stage from the initial value to the convergence interval, and laying the foundation for accelerating the overall simulation.
[0037] Steps S22-S23 dynamically determine the model use scenario by comparing the residual infinity norm with the first threshold, ensuring that the friction model is highly matched with the precision requirements of the iteration stage: when the infinity norm is greater than the first threshold, it means that the current solution still has a large deviation from the true solution. At this time, continuing to use the high-speed model can maintain high computational efficiency on the basis of ensuring that the "residual continues to decrease", avoiding inefficient calculation caused by the premature use of a high-precision model. This judgment logic is based on the residual size, a core indicator reflecting the simulation convergence process, rather than a fixed number of iterations, which can adapt to the convergence characteristics of different pipe network sizes (such as small branch pipe networks and large urban ring networks). It does not need to debug the model switching time for different pipe networks, improving the universality and adaptability of the strategy and reducing the parameter debugging cost in engineering applications.
[0038] Step S24 sets the infinity norm to be less than or equal to the first threshold for the first time, switches to the high-precision model, and does not switch back subsequently. This design has two technical advantages: on the one hand, switching at the first time the threshold is met accurately grasps the key node of precision improvement. The first threshold (for example, 0.05 m³ / h) corresponds to the upper limit of the approximate precision of the Haaland high-speed model. When the residual decreases below this threshold, if the high-speed model is continued to be used, its inherent error of 1-2% will cause the residual to be unable to be further reduced to the global convergence tolerance (such as 0.001 m³ / s). At this time, switching to the Colebrook-White high-precision model (error <0.3%) can ensure that the friction coefficient calculation precision meets the fine convergence requirements, ensuring the reliability of the final simulation results. On the other hand, the design of not switching back to the high-speed model subsequently avoids frequent model switching caused by small fluctuations in the residual (such as temporary rebound of individual node residuals in the iteration process). Model switching needs to adapt the friction coefficient calculation logic again. Frequent switching will cause temporary fluctuations in the construction of the Jacobian matrix, increasing the risk of iteration shock. The one-way switching and continuous precision-keeping design can maintain the stability of the iteration process, reduce unnecessary calculation interference, and ensure smooth and efficient convergence.
[0039] Further, the present application takes the nonlinear equation set with the node pressure as the unknown quantity as the node mass conservation equation set of the gas pipe network based on the Kirchhoff's law, that is, the total inflow and outflow of the equipment connected to each node is zero, the above equipment equations are combined, and the node equation is established for each node. If there are n nodes in the pipe network, a node equation set composed of n node equations is formed, and the equation set is solved. The node equation set method requires less calculation storage space and can handle mixed boundary conditions (pressure and flow). The sum of the inflow and outflow pipe section flow of each node in the pipe network is equal to the actual flow of the node, the actual flow of the node is the zero flow, the gas supply flow or the gas consumption flow of the node, and the node flow residual is the difference between the node calculated flow and the actual flow of the node; wherein the node calculated flow is obtained based on a preset pipe section flow calculation formula, and the preset pipe section flow calculation formula is:
[0040] In the formula, Q represents the standard state flow (m³ / day, the volume flow under standard conditions); C represents the flow constant (dimensionless, usually 0.0011493 under the metric system); e represents the pipeline efficiency (dimensionless, 0.8-1.0); T b represents the reference temperature (usually 288.15K (15°C)); P b represents the reference pressure (usually 101.325kPa); D represents the pipe diameter (mm); P1 represents the inlet absolute pressure (kPa); P2 represents the outlet absolute pressure (kPa); L represents the pipe length (km); G represents the gas relative density (dimensionless, generally 0.55-0.7 for natural gas); T a represents the average gas temperature (K); Z a represents the average gas compression factor, dimensionless; f represents the Darcy friction factor, dimensionless, which is calculated by the preset high-precision model and the preset high-speed model. The friction factor f is a function of the Reynolds number Re and the relative roughness of the pipe (i.e., the absolute roughness of the pipe / the pipe diameter), and its accurate calculation is crucial to the calculation accuracy.
[0041] After the equation set is constructed, the Newton-Raphson (N-R) method is used to iteratively solve the node mass conservation equation set of the gas pipe network in the embodiments of the present application. This method constructs the residual vector and its Jacobian matrix (Jacobian Matrix) of the nonlinear equation set in each iteration, linearizes and corrects the unknown variables, and gradually approaches the true solution, such as Figure 2The iterative process starts from a set of initial guess values (e.g. setting initial values of pressure or flow rate of each node), calculates the flow imbalance of each node under the current solution (i.e. residual) in each iteration, and updates the pressure and flow rate variables of each node according to the Jacobian matrix. When the maximum absolute value of the flow residual (i.e. infinity norm) of all nodes is less than the preset convergence tolerance, it is determined that the calculation converges, and the iteration is stopped.
[0042] In the solving process, the physical quantity to be solved is determined according to the type of boundary condition of different nodes: 1. For the flow known node (e.g. user load node), the inflow or outflow flow rate is given as a condition, and the pressure value of the node is obtained by solving; 2. For the pressure known node (e.g. gas source inlet, pressure regulating station outlet), the node pressure is fixed as a boundary condition, and the flow rate value of the node is obtained by solving.
[0043] By distinguishing the node type and explicitly solving the logic, the adaptability of the simulation method to complex pipe network boundary conditions is improved. The solving target is set for the flow known node (such as the user load node) and the pressure known node (such as the gas source node) respectively, which conforms to the working condition characteristics of the actual gas pipe network, avoids repeated solving of known parameters, accurately back calculates unknown quantities, reduces the redundant dimension of the equation set, and improves the iteration solving efficiency.
[0044] In the initial stage of iterative solving, the Haaland explicit formula is used to calculate the pipe friction coefficient in the embodiment of the present application to speed up the convergence speed, which is expressed as:
[0045] The formula is an explicit approximate formula, which does not need iteration, has fast calculation speed, good engineering precision (error about 1~2%), and is suitable for fast estimation. When the infinity norm of the node flow residual (i.e. the maximum absolute value of the flow imbalance of all nodes) calculated is close to 0.05 m³ / h (which is the approximate precision level that the Haaland explicit formula can reach under typical working conditions), the iteration process of the current model is stopped. The node pressure of the pipe network obtained at this time is used as the initial value of the node pressure of the pipe network in the next stage of iterative solving.
[0046] In the transition stage of iterative solving, when the infinity norm of the node flow residual is reduced to 0.05 m³ / h, the system switches to the Colebrook-White implicit equation to calculate the pipe friction coefficient, which is expressed as:
[0047] The equation is an implicit nonlinear equation, which needs to be solved by iteration (such as Newton method), and the calculation overhead is large, but the precision is high (error <0.3%). After switching, it is maintained in subsequent iterations and is not switched back. The design forms a hysteresis control interval to avoid frequent model switching caused by small fluctuations in residual error and improve algorithm stability. The Colebrook-White uses an iterative method to calculate the friction coefficient, and when in the hysteresis control interval, a small number of iterations (such as 3-5 Newton method iterations) are used to solve the friction coefficient to save time. This fine design ensures the final simulation accuracy while avoiding the waste of high-precision model over-computing, making large-scale pipe network simulation achieve an optimal balance among stability convergence, precision standard, and high speed.
[0048] In the above formula, f is the Darcy friction factor, dimensionless; ε is the absolute roughness (m); D is the pipe diameter (m); ε / D represents the relative roughness, dimensionless; Re is the Reynolds number, dimensionless; ρ is the fluid density (kg / m³); v is the flow rate, meters per second (m / s); μ is the dynamic viscosity (Pa·s). Among them, the calculation formula of Reynolds number Re is:
[0049] The embodiment of the application records the parameters and calculation results of each iteration, the parameters including the current friction coefficient calculation model, node pressure value, and pipe segment flow value, and the calculation results including node flow residual error and residual infinite norm; if the number of iterations reaches the preset maximum value but does not converge, and the node flow residual error continuously decreases, the number of iterations is automatically extended, or when the global convergence tolerance error cannot be reached, the pipe network state result corresponding to the minimum node flow residual error in the record is used, thereby avoiding the situation that the solution cannot be obtained due to improper setting of the convergence tolerance error.
[0050] The Newton-Raphson method adopted by the embodiment of the present application has initial value sensitivity. If the tolerance is set to be small, the solution cannot be converged in the case of improper initial value. By adopting the "rough approximation stage" and the "fine convergence stage", the suitable initial value for the "fine convergence stage" can be ensured, and the solution can be successfully obtained. By iteration recording and abnormal processing mechanism, the reliability and fault tolerance of the simulation method are improved. The iteration parameters and results are recorded, which facilitates subsequent tracing of the simulation process, analysis of the convergence abnormal reason, and provides data support for pipe network simulation optimization; when the iteration reaches the maximum value without convergence but the residual continues to decrease, the iteration number is automatically extended, which can avoid the solution failure caused by insufficient preset iteration number, and improve the convergence success rate; when the convergence tolerance cannot be reached, the result with the smallest residual is selected, which can provide the pipe network state closest to the true solution under extreme conditions, and avoid simulation interruption. The complete mechanism of recording-fault tolerance-alternative makes the method still be able to stably output effective results in complex pipe networks (such as pipe networks with multiple gas sources coupling and parameter fluctuation caused by pipe aging), and enhances the engineering practicability.
[0051] In the embodiment, a gas pipe network steady-state simulation device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and contemplated.
[0052] The embodiment provides a gas pipe network steady-state simulation device, as shown in Figure 3 , comprising: An equation set construction module 31 is configured to construct a nonlinear equation set with node pressure as an unknown quantity according to the topological structure and working condition parameters of the gas pipe network, and set a global convergence tolerance error; An equation set solving module 32 is configured to iteratively solve the equation set, and execute the following friction model switching strategy in the iteration process, comprising: An initialization unit is configured to calculate the friction coefficient of each pipe by using a preset high-speed model in the initialization stage; A flow residual calculation unit is configured to calculate the infinity norm of the node flow residual in the current iteration step; A first model switching detection unit is configured to continue to calculate the pipe friction coefficient by using the preset high-speed model in the next iteration step when the infinity norm is greater than a first threshold value; A second model switching detection unit is configured to switch to calculate the friction coefficient by using a preset high-precision model when the infinity norm is less than or equal to the first threshold value for the first time, and continuously use the preset high-speed model in the subsequent iterations without switching back; The simulation result output unit is configured to determine that the calculation converges and output the distribution results of the node pressure and the pipe segment flow rate of the pipe network when the infinite norm is less than the global convergence tolerance error.
[0053] In some optional embodiments, the nonlinear equation set with the node pressure as the unknown quantity in the equation set construction module 31 is constructed based on the Kirchhoff's law, the sum of the inflow and outflow pipe segment flow rates of each node in the pipe network is equal to the actual flow rate of the node, the actual flow rate of the node is zero, gas supply flow rate or gas consumption flow rate, and the node flow rate residual is the difference between the calculated flow rate of the node and the actual flow rate of the node; wherein the calculated flow rate of the node is obtained based on a preset pipe segment flow rate calculation formula, and the preset pipe segment flow rate calculation formula is: In the formula, Q represents the standard state flow rate, C represents the flow rate constant, e represents the pipe efficiency, T b represents the reference temperature, P b represents the reference pressure, D represents the pipe inner diameter, P1 represents the inlet absolute pressure, P2 represents the outlet absolute pressure, L represents the pipe length, G represents the gas relative density, T a represents the average gas temperature, Z a represents the average gas compression factor, and f represents the Darcy friction factor, which is calculated through the preset high-precision model and the preset high-speed model.
[0054] In some optional embodiments, the global convergence tolerance error in the equation set solving module 32 is determined according to the calculation accuracy; the first threshold value is determined according to the approximate accuracy level that can be reached by the preset high-speed model under the typical working condition of the gas pipe network; the Newton-Raphson method is used to iteratively solve the equation set, and in the iteration process of the Newton-Raphson method, the node pressure unknown quantity is linearly corrected by constructing the residual vector and its Jacobian matrix under the current solution, so as to gradually approach the true solution.
[0055] In some optional embodiments, the nodes include flow rate known nodes and pressure known nodes; for the flow rate known nodes, the inflow or outflow flow rate is taken as a given condition, and the pressure value of the node is obtained through iterative solution; for the pressure known nodes, the node pressure is taken as a boundary condition and fixed, and the flow rate value of the node is inversely deduced through iterative solution.
[0056] In some optional embodiments, the preset high-speed model is the Haaland explicit formula, the preset high-precision model is the Colebrook-White implicit equation, and the first threshold value is 0.05 m³ / h, which corresponds to the approximate accuracy level that can be reached by the Haaland explicit formula under the typical working condition of the gas pipe network.
[0057] In some optional embodiments, the method further comprises setting a hysteresis control interval when switching the friction model, the hysteresis control interval being an interval in which an infinity norm of the node flow residual falls below a first threshold, and in the hysteresis control interval, the Colebrook-White implicit equation is solved for the friction factor by 3-5 iterations of Newton's method.
[0058] The device for simulating steady state of gas pipe network provided by the embodiments of the present application can execute the method for simulating steady state of gas pipe network provided by any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method. The further function description of each module and unit is the same as that of the corresponding embodiments, and will not be repeated here.
[0059] Figure 4 A structural schematic diagram of an electronic device is provided.
[0060] Reference will now be made to the following description Figure 4 which shows a structural schematic diagram of an electronic device suitable for implementing the electronic device in the embodiments of the present application. The electronic device can include a processor (such as a central processor, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 402 or loaded from a memory 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for operation of the electronic device are also stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0061] Generally, the following devices can be connected to the I / O interface 405: an input device 405 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a memory 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device with various devices is shown, but it should be understood that it is not required to implement or have all the shown devices, and more or fewer devices can be alternatively implemented or had.
[0062] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program in accordance with embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for carrying out the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication device 409, or installed from the memory 408, or installed from the ROM 402. When the computer program is executed by the processor 401, the above-mentioned functions defined in the steady-state simulation method of a gas pipe network of embodiments of the present application are performed.
[0063] Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functions and use range of embodiments of the present application.
[0064] Embodiments of the present application also provide a computer-readable storage medium, the above-mentioned method according to embodiments of the present application can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented by downloading and originally stored in a remote storage medium or non-transitory machine-readable storage medium and then stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk or a solid state disk, etc.; further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code, which, when accessed and executed by the computer, processor or hardware, implements the steady-state simulation method of the gas pipe network shown in the above embodiments.
[0065] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, the method and / or technical solutions according to the present application can be invoked or provided. Those skilled in the art should understand that the form of computer program instructions in computer-readable medium includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer executes the corresponding compiled program after compiling the instructions, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0066] While embodiments of the application have been described in connection with the preferred embodiments of the various figures, those of ordinary skill in the art will appreciate that various modifications and changes can be made without departing from the spirit and scope of the application, and that such modifications and changes fall within the scope of the appended claims.
Claims
1. A steady-state simulation method for gas pipeline networks, characterized in that, include: Based on the topology and operating parameters of the gas pipeline network, a set of nonlinear equations with node pressure as the unknown is constructed, and a global convergence tolerance is set. The system of equations is solved iteratively, and the following friction model switching strategy is implemented during the iteration process, including: During the initialization phase, the friction coefficient of each pipe is calculated using a pre-set high-speed model; Calculate the infinite norm of the node flow residual in the current iteration step; When the infinity norm is greater than the first threshold, the preset high-speed model is used to calculate the pipe friction coefficient in the next iteration step. When the infinite norm is less than or equal to the first threshold for the first time, the system switches to use a preset high-precision model to calculate the friction coefficient and continues to use the preset high-speed model in subsequent iterations without switching back. When the infinite norm is less than the global convergence tolerance, the calculation is considered converged, and the pressure distribution of the pipeline nodes and the flow distribution of the pipeline segments are output.
2. The method according to claim 1, characterized in that, The nonlinear equations with node pressure as the unknown are constructed based on Kirchhoff's laws. The sum of the inlet and outlet flow rates of each node in the pipeline network equals the actual flow rate of the node. The actual flow rate of the node can be zero, the gas supply flow rate, or the gas consumption flow rate of the node. The node flow residual is the difference between the calculated flow rate of the node and the actual flow rate of the node. The calculated flow rate of the node is obtained based on a preset pipeline flow rate calculation formula, which is: In the formula: Q represents the standard state flow rate; C represents the flow constant; e represents the pipeline efficiency; T b Indicates the reference temperature; P b Indicates the reference pressure; D represents the pipe inner diameter; P1 represents the inlet absolute pressure; P2 represents the outlet absolute pressure; L represents the pipe length; G represents the gas relative density; T a Z represents the average gas temperature. a denoted by , where represents the average gas compressibility factor; f represents the Darcy friction coefficient, calculated using the preset high-precision model and the preset high-speed model.
3. The method according to claim 1, characterized in that, The global convergence tolerance is determined based on the calculation accuracy; the first threshold is determined based on the approximate accuracy level that the preset high-speed model can achieve under typical working conditions of the gas pipeline network; the Newton-Raphson method is used to iteratively solve the equation system. During the iteration process of the Newton-Raphson method, the unknown nodal pressure is linearized and corrected by constructing the residual vector and its Jacobian matrix under the current solution, and gradually approximating the true solution.
4. The method according to claim 3, characterized in that, The nodes include nodes with known flow rate and nodes with known pressure. For nodes with known flow rate, the inflow or outflow rate is used as a given condition, and the pressure value of the node is obtained by iterative solution. For nodes with known pressure, the node pressure is fixed as a boundary condition, and the flow rate value of the node is inferred by iterative solution.
5. The method according to claim 1 or 3, characterized in that, The preset high-speed model is the Haaland explicit formula, and the preset high-precision model is the Colebrook-White implicit equation; the first threshold is 0.05 m³ / h, which corresponds to the approximate accuracy level that the Haaland explicit formula can achieve under typical operating conditions of gas pipeline networks.
6. The method according to claim 5, characterized in that, Also includes: When switching friction models, a hysteresis control interval is set. The hysteresis control interval is the interval where the infinite norm of the node flow residual drops below a first threshold. Within the hysteresis control interval, the Colebrook-White implicit equation is solved for the friction coefficient through 3 to 5 iterations of the Newton method.
7. The method according to claim 1, characterized in that, Also includes: Record the parameters and calculation results for each iteration. The parameters include the current friction coefficient calculation model, node pressure value, and pipe segment flow rate value. The calculation results include node flow residual and residual infinite norm. If the number of iterations reaches the preset maximum value but does not converge, and the node flow residual continues to decrease, the number of iterations will be automatically extended. Alternatively, if the global convergence tolerance cannot be reached, the network state result corresponding to the smallest infinite norm of the node flow residual in the records will be adopted.
8. A steady-state simulation device for a gas pipeline network, characterized in that, The device includes: The equation system construction module is used to construct a nonlinear equation system with node pressure as the unknown quantity based on the topology and operating parameters of the gas pipeline network, and to set the global convergence tolerance error. The equation solving module is used to iteratively solve the equation system. During the iteration process, the following friction model switching strategy is executed, including: The initialization unit is used to calculate the friction coefficient of each pipe using a preset high-speed model during the initialization phase. The flow residual calculation unit is used to calculate the infinite norm of the node flow residual in the current iteration step; The first model switching detection unit is used to continue using the preset high-speed model to calculate the pipeline friction coefficient in the next iteration step when the infinity norm is greater than the first threshold. The second model switching detection unit is used to switch to using a preset high-precision model to calculate the friction coefficient when the infinite norm is less than or equal to the first threshold for the first time, and to continue using the preset high-speed model in subsequent iterations without switching back. The simulation result output unit is used to determine the calculation convergence when the infinity norm is less than the global convergence tolerance, and output the pressure and flow distribution results of the pipeline nodes and the pipeline segments.
9. An electronic device, characterized in that, include: The system includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes the computer instructions to perform the steady-state simulation method for gas pipeline networks as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the gas pipeline steady-state simulation method according to any one of claims 1 to 7.