Natural gas network optimal energy flow calculation method based on improved piecewise linearization
By improving the piecewise linearization method, using clustering algorithms and least squares to fit the piecewise linear function, and adaptively selecting the segmentation point location, the fitting error and complexity problems in the energy flow calculation of natural gas grids are solved, achieving high-precision and efficient energy flow calculation, and supporting flexible peak shaving and frequency regulation of the power system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ELECTRIC POWER RES INST OF STATE GRID ZHEJIANG ELECTRIC POWER COMAPNY
- Filing Date
- 2022-09-27
- Publication Date
- 2026-06-12
AI Technical Summary
Traditional piecewise linearization techniques cannot adaptively select appropriate segmentation points in the calculation of optimal energy flow in natural gas networks, resulting in large fitting errors, high computational complexity, and difficulty in achieving high-precision and efficient solutions.
An improved piecewise linearization method is adopted, which adaptively selects the optimal segmentation interval through a clustering algorithm and combines the least squares method to fit the piecewise linear function, transforming it into a mixed integer linear programming model for solution.
It improves the accuracy and efficiency of optimal energy flow calculation for natural gas networks, reduces computational complexity, and promotes the absorption of intermittent renewable energy by the power system.
Smart Images

Figure CN116128089B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of integrated energy system optimization operation, specifically to a method for calculating the optimal energy flow of a natural gas network based on improved piecewise linearization. Background Technology
[0002] In recent years, the overexploitation and use of fossil fuels has triggered a significant global energy crisis and environmental problems. Decarbonization of energy systems has become a global consensus. Against this backdrop, integrated energy systems, through multi-energy complementarity and coordinated optimization, improve energy efficiency and promote the consumption of new energy sources, thus providing an effective solution for achieving decarbonization goals.
[0003] As a crucial component of integrated energy systems, natural gas networks play a key role in the low-carbon transformation of energy. On one hand, natural gas is a low-carbon, efficient, and clean energy source, serving as an important transitional energy source in the energy system's shift from coal-fired power to new energy-dominated systems, and acting as a ballast for maintaining the security and stability of the energy system. On the other hand, natural gas generator units have advantages such as small footprint and flexible regulation, providing excellent peak-shaving and frequency regulation auxiliary services for the power system, thereby promoting the absorption of intermittent renewable energy sources. Optimal energy flow calculation for natural gas networks is an important tool for the operation and planning of natural gas networks and has significant implications in practical engineering. However, because the pipeline gas flow equations in a natural gas network are a set of non-convex nonlinear equations, solving the optimal energy flow model for a natural gas network is difficult.
[0004] Existing techniques typically employ piecewise linearization to transform non-convex, nonlinear gas flow equations into linear constraints, thereby converting the optimal energy flow model of a natural gas network into a mixed-integer linear programming model for solution. The accuracy of piecewise linearization is determined by the number of segments and the location of the segmentation points; the error values between the piecewise linearized function obtained at different segmentation points and the original function vary significantly. However, traditional piecewise linearization techniques use simple equidistant segments, failing to adaptively select appropriate segmentation point locations based on the characteristics of the nonlinear equations, resulting in substantial fitting errors. To improve fitting accuracy, it is often necessary to increase the number of segments, introducing a large number of variables and constraints, thus increasing computational complexity. Therefore, there is an urgent need to propose an adaptive piecewise linearization method for calculating the optimal energy flow of a natural gas network. Summary of the Invention
[0005] To overcome the above problems, the present invention aims to provide an optimal energy flow calculation method for natural gas networks based on improved piecewise linearized segmented intervals. This method achieves adaptive optimal selection of suitable segmentation point locations within the linearized segmented intervals, reduces fitting errors, and improves the accuracy and efficiency of energy flow calculation by employing mixed integer linear programming to perform optimal energy flow calculation on the natural gas network.
[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows.
[0007] In a first aspect, the present invention proposes an optimal energy flow calculation method for a natural gas network based on improved piecewise linearization, which, in one embodiment, includes the following steps:
[0008] The gas flow model of the natural gas pipeline is represented by an initial piecewise linear function combination.
[0009] Obtain the initial set of piecewise linear function parameters for the natural gas pipeline gas flow model;
[0010] Based on the initial set of piecewise linear function parameters, the optimal interval for piecewise linearization of the natural gas network pipeline gas flow model is obtained;
[0011] Based on the optimal interval, an improved piecewise linearized model of the natural gas pipeline gas flow model is obtained;
[0012] An improved piecewise linearized model of the natural gas pipeline gas flow model is used to establish an optimal energy flow calculation model for the natural gas network. The optimal energy flow result of the natural gas network is obtained by solving this model.
[0013] In the above technical solution, the gas flow from the natural gas pipeline is represented by a piecewise linear function to simplify computational complexity. By obtaining the optimal segment interval of the piecewise function, fitting errors are reduced, and the computational accuracy of the natural gas pipeline gas flow is improved. This, in turn, provides excellent peak-shaving and frequency regulation auxiliary services for the power system, promoting the absorption of intermittent renewable energy by the power system. Having fully balanced the solution accuracy and computational efficiency of the optimal energy flow calculation for the natural gas network, natural gas network operators can adjust the model's accuracy by adjusting the preset number of segments in the piecewise linearization, providing technical support for the flexible and efficient operation of the natural gas network and the integrated energy system. The improved piecewise linearization model is a piecewise linear function established based on the optimal interval.
[0014] In the above technical solutions, the endpoint gas pressure used to solve for the piecewise linear function parameter set is obtained either through measurement or through calculation using a relevant model. In one embodiment, the endpoint gas pressure is represented by the following nonlinear pipeline gas flow equation, and this nonlinear pipeline gas flow equation is used as the gas flow model for the natural gas pipeline. A piecewise linear function is then established to improve the accuracy of the pipeline gas flow fitting:
[0015]
[0016] Where: p represents the pipe number, C p It is a pipe parameter, L p Represents the set of pipelines; i and j represent the starting and ending nodes of pipeline p, respectively; π i and π j Q represents the squared air pressure values at nodes i and j, respectively;p f(Q) represents the airflow rate transmitted in pipe p; α is a constant determined by the chosen pipe airflow model. p The difference in pressure across the pipe is represented by (). The pipe airflow models include the Weymouth model, Panhandle A model, and Panhandle B model.
[0017] In the above technical solution, one implementation of obtaining the piecewise linear function parameter set of the natural gas pipeline gas flow model includes the following steps:
[0018] The gas flow rate Q transmitted in pipe p p Operating range Divide into M intervals, and These represent the lower and upper limits of the airflow rate transmitted in pipe p, respectively. L p Represents a set of pipes;
[0019] Within any m-th segmented interval, the piecewise linear function can be expressed as:
[0020]
[0021] Wherein: g m (Q p ) represents the function of the squared gas pressure difference in the pipeline for the m-th interval. and The parameters represent the piecewise linear function for the m-th interval;
[0022] Obtain the parameter set of the piecewise function of the gas flow rate transmitted in pipe p. in:
[0023]
[0024] In the formula: These are the squared pressure differences at the endpoints of the m-th interval, obtained either by measurement or by calculation using a relevant model.
[0025] In the above technical solution, the optimal interval for piecewise linearization of the natural gas network pipeline gas flow model is obtained based on the piecewise linear function parameter set. In one implementation, the following steps are included:
[0026] Let the set of parameters of the piecewise linear function be denoted as and The parameter represents the piecewise linear function of the m-th interval, where M is the total number of intervals into which the gas flow rate transmitted in pipe p is divided.
[0027] Using the parameter set Z as the sample point set, and each segmented interval as a sample point, a clustering algorithm is used to divide the M segmented intervals into N clusters, where N is a set value, N < M, thus forming N new segmented intervals. 'a' represents the segmentation point corresponding to the new segmentation interval formed after clustering;
[0028] These N new segmented intervals are taken as the optimal intervals for the segmented linearization of the gas flow in the natural gas network pipeline.
[0029] In the above technical solution, a clustering algorithm is used to adaptively select appropriate segmentation points for segmented intervals, and the gas flow in the natural gas pipeline is fitted with as few piecewise linear functions as possible, thereby reducing the scale of introduced variables and constraints and lowering the solution complexity of the optimal energy flow calculation model. One implementation method includes the following steps:
[0030] The initial iteration count is set to r = 0, the convergence threshold of the clustering loss function is set to ε, and N points are randomly selected from the sample point set Z as initial cluster centers, denoted as .
[0031] Step S: For any sample point zm, m = 1, 2, ..., M, calculate its distances to the N center points: The sample point is then assigned to the cluster containing the cluster center with the smallest distance.
[0032] Calculate each cluster The mean of all sample points in the cluster is used as the updated cluster center;
[0033] Calculate the clustering loss function:
[0034]
[0035] If RSS ≤ ε, obtain the final clustering result; otherwise, return to the step labeled S.
[0036] In the above technical solution, a piecewise linearized model of the natural gas pipeline gas flow model is obtained based on the optimal interval. One implementation includes the following steps:
[0037] Let the nth optimal interval be denoted as ω. n n = 1, 2, ..., N, where N is the total number of optimal intervals;
[0038] The gas flow rate Q transmitted in pipe p p The squared pressure difference in the nth optimal interval can be approximately expressed as the following piecewise linear function h. n (Q p ):
[0039]
[0040] Parameters are obtained using the following least squares model.
[0041]
[0042] in, This represents all segments belonging to the interval ω. n The set of sample points The squared pressure difference at the sampling point;
[0043] This leads to a segmented model of the natural gas pipeline gas flow:
[0044]
[0045] In the formula: and This introduces continuous and discrete variables. The traditional natural gas pipeline gas flow equation f(Q) p The equations are nonconvex and nonlinear, leading to the need to establish a nonlinear optimization model for energy flow calculations in natural gas networks, making solutions difficult. When applied using piecewise linear programming functions... Perform fitting, where the condition is satisfied. By employing a piecewise linearization method, the complex nonlinear gas flow equations are transformed into a series of linear constraint combinations, thereby converting the natural gas energy flow model into a mixed-integer linear programming model. The model can then be solved quickly using common commercial solvers.
[0046] In the above technical solution, a piecewise linearized model of the natural gas pipeline gas flow model is used to establish an optimal energy flow calculation model for the natural gas network, including:
[0047] Establish a model that minimizes the total gas supply cost of the natural gas network:
[0048]
[0049] Where S represents the set of gas sources; G i and c i These represent the gas supply volume and unit gas supply cost of gas source node i, respectively.
[0050] Establish constraints, including pipeline gas flow equation constraints, natural gas pipeline operation constraints, compressor pressure ratio constraints, compressor gas flow transmission limit constraints, gas source operation constraints, node gas flow balance constraints, and node gas pressure limit constraints.
[0051] Among them, the pipeline gas flow equation constraint is obtained by calculating the segmented model of natural gas pipeline gas flow, and is a linear constraint.
[0052] Secondly, the present invention proposes an optimal energy flow calculation device for a natural gas network based on improved piecewise linearization, comprising a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed by any of the methods described above.
[0053] Thirdly, the present invention provides a computer-readable storage medium storing a computer program that can be loaded by a processor and executed by any of the methods described above. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0055] Figure 1 , one A flowchart of the optimal energy flow calculation for a natural gas network based on improved piecewise linearization in one implementation method;
[0056] Figure 2 , one A schematic diagram illustrating the effect of segmented interval optimization in one implementation method;
[0057] Figure 3 , one A flowchart illustrating the improved piecewise linearization of the pipeline airflow equation based on K-means clustering in one implementation method. Detailed Implementation
[0058] In this invention, the operations in the flowchart can be implemented out of order. Instead, the operations can be implemented in reverse order or simultaneously. Furthermore, one or more other operations can be added to the flowchart. One or more operations can be removed from the flowchart. The technical solution of this invention will now be clearly and completely described with reference to the accompanying drawings of the embodiments of this application.
[0059] In one implementation of the optimal energy flow calculation method for natural gas networks based on linearized segmented intervals, such as Figure 1 As shown, it includes the following steps:
[0060] (1) Construct a nonlinear pipeline airflow model for the natural gas network.
[0061] Natural gas can be transported in pipelines primarily because of the pressure difference between adjacent nodes within the pipeline. The direction of gas flow depends mainly on the pressure difference at both ends of the pipeline. A natural gas pipeline gas flow model can be represented as:
[0062]
[0063] Where: p represents the pipe number, C p It is a pipe parameter, L p Represents the set of pipelines; i and j represent the starting and ending nodes of pipeline p, respectively; π i and π j Let f(Q) represent the squared air pressure values at nodes i and j, respectively. p Q represents the square pressure difference in the pipeline; p α represents the air flow rate transmitted in pipe p; α is a constant determined by the selected pipe airflow model.
[0064] When the gas flow model for the natural gas pipeline is the Weymouth model, α = 2; when the gas flow model for the natural gas pipeline is the Panhandle A model, α = 1.8545; and when the gas flow model for the natural gas pipeline is the Panhandle B model, α = 1.9607.
[0065] It can be observed that the pipeline airflow equation (1) is a non-convex nonlinear equation, which poses a significant challenge to solving the optimal energy flow in the natural gas network. In this embodiment, it is constructed for the calculation of piecewise linear function parameters. In other embodiments, the gas pressure values used for calculating the piecewise linear function parameters are obtained through actual measurement.
[0066] (2) The gas flow in the natural gas pipeline is represented by a combination of piecewise linear functions.
[0067] Obtain the initial set of piecewise linear function parameters for the natural gas pipeline gas flow model;
[0068] use and These represent the lower and upper limits of the airflow rate transmitted in pipe p, respectively. The airflow Q in the pipe... p Operating range Divide into M equally spaced intervals, that is Within any m-th segmented interval, the nonlinear term f(Q) of the pipe airflow equation... p The approximate linear function of ) is:
[0069]
[0070] Among them, g m (Q p ) represents the function of the squared gas pressure difference in the pipeline for the m-th interval. and The parameters of the piecewise linear function for the m-th interval are represented by the following formula:
[0071]
[0072]
[0073] In the formula: Let be the squared pressure differences at the endpoints of the m-th interval. Therefore, the approximate linear function for each segmented interval can be obtained by a set of two parameters. This unique representation yields the set of piecewise linear function parameters for the nonlinear terms of the pipeline airflow equation. M represents the total number of intervals into which the gas flow rate transmitted in pipe p is divided.
[0074] (3) Based on the set of piecewise linear function parameters, obtain the optimal interval for piecewise linearization of the gas flow model of the natural gas network pipeline.
[0075] In this embodiment, adaptive optimal selection of linearized segmented intervals is achieved by employing clustering methods. This invention can utilize K-means algorithm, K-centroid algorithm, CLARANS algorithm, and other partitioning and clustering methods.
[0076] The following section uses the K-means algorithm as an example to illustrate how to achieve adaptive segmentation based on K-means clustering in order to obtain the optimal interval for segmented linearization of gas flow in natural gas pipelines.
[0077] Set of parameters of piecewise linear functions As the set of sample points for clustering, each segment interval represents a sample point. The number of clusters is set to N. By ensuring N < M, the gas pipeline gas flow is fitted with the fewest possible piecewise linear functions, thereby reducing the scale of introduced variables and constraints and lowering the solution complexity of the optimal energy flow calculation model. The M segment intervals are divided into these N clusters using the K-means clustering algorithm, forming N new segment intervals. The specific steps are as follows:
[0078] (3.1) Set the initial iteration count r = 0, set the convergence threshold of the clustering loss function to ε, and randomly select N points from the sample point set Z as the initial cluster centers, denoted as ε.
[0079] (3.2) For any sample point Zm, m = 1, 2, ..., M, calculate its distances to the N center points: The sample point is then assigned to the cluster containing the cluster center with the smallest distance.
[0080] (3.3) Calculate each cluster The mean of all sample points in the cluster is used as the updated cluster center;
[0081] (3.4) Calculate the clustering loss function:
[0082]
[0083] If RSS ≤ ε, the final clustering result is obtained; otherwise, repeat steps (3.2) and (3.3).
[0084] Through the above steps, the initial M segmented intervals are clustered into N new segmented intervals, which serve as the optimal intervals for the final piecewise linearization of the segmented pipe airflow equations, denoted as .
[0085] (4) Based on the optimal interval, a piecewise linearized model of natural gas pipeline gas flow is obtained.
[0086] In one implementation, the pipe airflow equation is taken as the Weymouth equation (i.e., α is 2). The initial number of segmented intervals M = 20 is selected, and the final number of segments formed after clustering is set to N = 4. The schematic diagram of the optimized segmented intervals is shown below. Figure 2 As shown. From Figure 2 It can be seen that the width of the improved piecewise linearized interval is not constant, but varies with the nonlinear characteristics of the pipeline airflow equation. It can be observed that the formed piecewise intervals are more concentrated around the square pressure difference f(Q). p In regions with greater variation, fewer segments are set in regions with gentler variation, thereby maximizing the fitting accuracy of the pipeline airflow equation within a limited number of segments.
[0087] An improved piecewise linearized model of the natural gas pipeline gas flow equation is constructed based on the least squares method. For each new piecewise interval ω... n The gas flow rate Q transmitted in pipe p p The squared pressure difference in the nth optimal interval can be approximately expressed as the following piecewise linear function h. n (Q p ):
[0088]
[0089] Among them, the piecewise linearization parameter The following least squares model was obtained:
[0090]
[0091] in, This represents all segments belonging to the interval ω. n The set of sample points The squared pressure difference at the sampling point.
[0092] In each segment interval Introducing continuous variables and discrete variables Discrete variables characterize whether the pipeline gas flow rate falls within the corresponding interval. but otherwise Therefore, the improved piecewise linearized model of the natural gas pipeline gas flow equation can be expressed in the following form:
[0093]
[0094]
[0095]
[0096] In another embodiment, steps (1)-(4) above are as follows: Figure 2 As shown:
[0097] S1. Determine the number of clusters N;
[0098] S2. Divide the operating range of the pipeline airflow Qp into M equidistant intervals to form the initial segmented intervals, where M > N;
[0099] S3. Perform linear fitting on the nonlinear function within each segmented interval to form a set of piecewise linear function parameters Z;
[0100] S4. Using the set of piecewise linear function parameters as the sample point set, the M sample points are divided into N clusters using the K-means distance algorithm, which serves as the optimal interval for the final piecewise linearization of the pipeline airflow equation.
[0101] S5. Use the least squares method to fit and generate piecewise linear functions for each optimal segment interval;
[0102] S6. Form an approximate piecewise linearized model of the nonlinear pipeline airflow equation.
[0103] (5) Using the piecewise linearization model of natural gas pipeline gas flow, establish the optimal energy flow calculation model of natural gas network, and obtain the optimal energy flow result of natural gas network by solving the model.
[0104] Constructing an optimal energy flow model for the natural gas network, specifically including the objective function and constraints. The objective function is to minimize the total gas supply cost of the natural gas network:
[0105]
[0106] Where S represents the set of gas sources; G i and c i These represent the gas supply volume and unit gas supply cost of gas source node i, respectively.
[0107] The model's constraints include natural gas pipeline operation constraints, compressor operation constraints, gas source operation constraints, and network node operation constraints.
[0108] 1) Natural gas pipeline operation constraints
[0109] The constraints on natural gas pipeline operation specifically include piecewise linearized pipeline gas flow equation constraints (11)-(13) and pipeline gas flow transmission restriction constraints (14):
[0110]
[0111]
[0112]
[0113]
[0114] in: and These represent the lower and upper limits of the airflow transmitted in pipe p, respectively.
[0115] 2) Compressor operating constraints
[0116] The compressor operating constraints specifically include compressor pressure ratio constraints (15) and compressor airflow transmission limitation constraints (16):
[0117]
[0118]
[0119] Where c represents the compressor number; L c Indicates a collection of compressors; and Q represents the squared values of the air pressure at the outlet and inlet of compressor c, respectively; c This indicates the air flow rate transmitted in compressor c; and R represents the lower and upper limits of the gas flow rate transmitted in compressor c, respectively. c This indicates the pressure boost ratio of compressor c.
[0120] 3) Gas source operation constraints
[0121]
[0122] in, and These represent the lower and upper limits of the gas supply from gas source i, respectively.
[0123] 4) Network node operation constraints
[0124] Network node operational constraints specifically include node airflow balance constraints and node air pressure limit constraints:
[0125]
[0126]
[0127] Where A represents the pipe-node connection matrix; U represents the compressor-node connection matrix; Ω1 represents the set of pipe network nodes, Ω2 represents the set of compressor network nodes; G i and D i These represent the airflow injection rate and airflow load at node i, respectively. and Let represent the squares of the lower and upper pressure limits of node i, respectively.
[0128] The objective function (10) and constraints (11)-(19) together constitute the optimal energy flow model of the natural gas network. It can be seen from the objective function (10) and constraints (11)-(19) that the nonlinear optimization model of energy flow calculation of the natural gas network is transformed into a mixed integer linear programming model. By using commercial solvers such as Gurobi and Cplex to solve the model, the optimal energy flow results of the natural gas network can be obtained, including the optimal operating cost of the natural gas network, the optimal gas supply of the gas source, the pipeline gas flow rate and the node gas pressure, which improves the efficiency of energy flow calculation.
[0129] The operations in the flowchart of this invention can be implemented out of order, or in reverse order, or simultaneously. Furthermore, one or more additional operations can be added to the flowchart. One or more operations can be removed from the flowchart.
[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that this disclosure can be implemented using software plus necessary general-purpose hardware, or it can be implemented using dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memory, dedicated components, etc. Generally, any function performed by a computer program can be easily implemented using corresponding hardware, and the specific hardware structure used to implement the same function can be diverse, such as analog circuits, digital circuits, or dedicated circuits. However, for this disclosure, software implementation is more often a preferred implementation method.
[0131] In summary, the method of this invention reduces the computational complexity of the pipeline airflow equation by segmenting and linearizing it; it obtains the endpoints of the initial segmented intervals through a nonlinear airflow model to obtain the initial parameters of the linear piecewise function, ensuring that the initial fitted line segment is close to the actual pipeline airflow value; it improves the fitting accuracy of the pipeline energy flow equation by adaptively optimizing the initial segmented intervals through clustering; and it further improves the efficiency of energy flow calculation by employing mixed-integer linear programming for optimal energy flow calculation.
[0132] Although embodiments of the present invention have been described above in conjunction with the accompanying drawings, the present invention is not limited to the specific embodiments and application fields described above. The specific embodiments described above are merely illustrative and instructive, and not restrictive. Those skilled in the art can make many other forms based on the guidance of this specification and without departing from the scope of protection of the claims of the present invention, and all of these are within the scope of protection of the present invention.
Claims
1. A method for calculating optimal energy flow in a natural gas network based on improved piecewise linearization, characterized in that, The method includes the following steps: The gas flow model of the natural gas pipeline is represented by an initial piecewise linear function combination. Obtain the initial set of piecewise linear function parameters for the natural gas pipeline gas flow model; Based on the initial set of piecewise linear function parameters, the optimal interval for piecewise linearization of the natural gas pipeline gas flow model is obtained; Based on the optimal interval, an improved piecewise linearized model of the natural gas pipeline gas flow model is obtained, including the following steps: Let the nth optimal interval be denoted as , N is the total number of optimal intervals; pipe gas flow rate in the middle The squared pressure difference in the nth optimal interval can be approximately expressed as the following piecewise linear function. : Parameters are obtained using the following least squares model. : in, This indicates all segments belonging to the interval. The set of sample points The squared pressure difference at the sampling point; This leads to an improved piecewise linearized model of natural gas pipeline gas flow: In the formula: and For the introduction of continuous and discrete variables, This represents the segmentation point corresponding to the new segmented intervals formed after clustering; An improved piecewise linearized model of the natural gas pipeline gas flow model is used to establish an optimal energy flow calculation model for the natural gas network. Solving this model yields the optimal energy flow results for the natural gas network, including: Establish a model that minimizes the total gas supply cost of the natural gas network: Where S represents the set of gas sources; and Representing gas source nodes Gas supply volume and unit gas supply cost; Establish constraints, including pipeline gas flow equation constraints, natural gas pipeline operation constraints, compressor pressure ratio constraints, compressor gas flow transmission limit constraints, gas source operation constraints, node gas flow balance constraints, and node gas pressure limit constraints. The pipeline gas flow equation constraints were obtained by calculating an improved piecewise linearized model of the natural gas pipeline gas flow model.
2. The method according to claim 1, characterized in that: The initial piecewise linear function is constructed using a nonlinear pipe airflow equation; The nonlinear pipe airflow equation is as follows: , in: Indicates the pipe number. These are pipe parameters. Represents a set of pipes; and They represent pipes The starting and ending nodes; and Representing nodes respectively and The square air pressure value, This indicates the square pressure difference in the pipeline; Indicates pipeline The air flow rate transmitted in the middle; It is a constant determined by the selected duct airflow model.
3. The method according to claim 1, characterized in that, Obtaining the initial piecewise linear function parameter set for the natural gas pipeline gas flow model includes the following steps: pipe gas flow rate in the middle Operating range Divide into M intervals, and They represent pipes The lower and upper limits of the airflow volume in the transmission process. , Represents a set of pipes; Within any m-th segmented interval, the piecewise linear function can be expressed as: in: This represents the function representing the squared gas pressure difference in the pipeline for the m-th interval. and The parameters represent the piecewise linear function for the m-th interval; Obtain Pipeline The parameter set of the piecewise function of gas flow rate in the middle of the transmission ,in: In the formula: , denoted as the squared pressure difference at the endpoints of the m-th interval.
4. The method according to claim 3, characterized in that, Based on the initial set of piecewise linear function parameters, the optimal interval for piecewise linearization of the natural gas pipeline gas flow model is obtained, including: Let the initial set of parameters of the piecewise linear function be denoted as... , and The parameter represents the initial piecewise linear function for the m-th interval. To make the pipeline The total number of intervals divided by the gas flow rate transmitted in the middle; parameter set As a set of sample points, each segmented interval is treated as a sample point. A clustering algorithm is then used to divide the M segmented intervals into N clusters, where N is a predetermined value. This forms N new segmented intervals. , ; These N new segmented intervals are taken as the optimal intervals for the segmented linearization of the gas flow in the natural gas network pipeline.
5. The method according to claim 4, characterized in that, The clustering algorithm includes the following steps: Set the initial iteration count r = 0, and set the convergence threshold of the clustering loss function to [value missing]. In the sample point set Randomly select N points as initial cluster centers, denoted as . , ; The step labeled S: For any sample point , Calculate its distance to N center points: And assign the sample point to the cluster containing the cluster center with the smallest distance; Calculate each cluster The mean of all sample points in the cluster is used as the updated cluster center; Calculate the clustering loss function: if This yields the final clustering results; Otherwise, return to the step marked S.
6. The method according to claim 2, characterized in that, The nonlinear pipe airflow equation is the Weymouth model, the Panhandle A model, or the Panhandle B model.
7. A natural gas network optimal energy flow calculation device based on improved piecewise linearization, characterized in that: It includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The computer program is stored that can be loaded by a processor and executed according to any one of claims 1 to 6.