Energy flow calculation method and system for electricity-gas integrated energy system based on semi-analytical solution
The nonlinear partial differential equations of the electric-gas integrated energy system are converted into linear algebraic equations through a semi-analytical solution method, which solves the contradiction between calculation accuracy and efficiency in the existing technology, realizes efficient and accurate energy flow calculation, and improves the safety and reliability of the system.
Patent Information
- Application Number
- CN202510773047.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-12
AI Technical Summary
The existing energy flow calculation method for the electricity-gas integrated energy system has a contradiction between accuracy and computational efficiency, making it difficult to accurately capture the dynamic changes of the gas grid and posing safety risks.
A method based on semi-analytical solution is adopted to establish an ordinary differential-algebraic model through numerical boundary extrapolation and semi-discrete technology. Combined with differential transformation and block calculation matrix, the time window is adaptively adjusted, and the nonlinear partial differential equation is transformed into a linear algebraic equation for energy flow calculation.
It improves the robustness and accuracy of the calculation, reduces the amount of calculation, avoids the errors of traditional models in complex gas dynamics scenarios, and ensures system safety.
Smart Images

Figure CN120632278A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of integrated energy system modeling and simulation, and mainly relates to a method and system for calculating energy flow of an electric-gas integrated energy system based on a semi-analytical solution. Background Art
[0002] Against the backdrop of continued global energy demand growth and the transition to a low-carbon energy structure, the electricity-gas integrated energy system has become a research focus in the field of coordinated optimization of energy systems. By coupling the power grid with the natural gas grid, this system can achieve multi-energy flow complementarity and coordinated cross-system resource allocation, significantly improving energy efficiency. However, its energy flow calculation faces multi-dimensional technical challenges: the dynamic characteristics of the natural gas system are constrained by complex nonlinear partial differential equations, and the nonlinearity and cross-timescale variations of gas dynamics make accurate energy flow calculation a very challenging task. Existing modeling methods have a significant contradiction between solution accuracy and computational efficiency.
[0003] Traditional energy flow calculation methods often use numerical methods, such as the finite difference method and the characteristic line method, but these methods often suffer from problems such as large computational complexity and poor convergence. Furthermore, some energy flow calculation methods based on linear dynamic gas grid models, such as the average flow velocity method, can simplify the model and speed up calculations to a certain extent. However, when faced with complex and changing real-world systems, the accuracy of the models still needs to be improved. Therefore, how to improve the speed and accuracy of the calculation of the integrated electricity-gas energy model and accurately capture the dynamic changes of the gas grid has become a key issue in energy flow calculation. Summary of the Invention
[0004] To address the deficiencies mentioned in the above-mentioned background technology, the present invention proposes a method and system for calculating the energy flow of an electric-gas integrated energy system based on a semi-analytical solution. First, based on numerical boundary extrapolation and semi-discrete methods, an ordinary differential-algebraic model of the electric-gas network is established; based on the semi-analytical theory of differential transformation, a linearized electric-gas network model is established; then, the matrix is calculated in blocks and the time window is adaptively adjusted; finally, the model is solved to obtain the energy flow calculation result. The method of the present invention can transform the original nonlinear partial differential equation of the gas network into a linear algebraic equation, simplify the complex nonlinear problems in traditional gas network modeling, avoid the errors caused by local linearization and time differentiation, reduce the calculation scale and improve the robustness of the calculation. At the same time, the method of the present invention can not only accurately capture the dynamic behavior of the natural gas system, but also significantly reduce the amount of calculation, improve the calculation reliability, effectively reduce the errors that may be generated by the traditional model in complex gas dynamics scenarios, and avoid system safety hazards caused by inaccurate models.
[0005] To achieve the above-mentioned object, the technical solution adopted by the present invention is: a method for calculating the energy flow of an electric-gas integrated energy system based on a semi-analytical solution, comprising at least the following steps:
[0006] S1. Establishing a nonlinear partial differential-algebraic model of the electric-gas system: The model includes a nonlinear partial differential-algebraic model of the natural gas system, a nonlinear algebraic model of the electric power system, and an algebraic model of the coupled components. The partial differential equations in the natural gas system are discretized into ordinary differential equations using a semi-discrete technique, and the numerical boundaries of the pipeline are constructed to form a nonlinear ordinary differential-algebraic model of the electric-gas system.
[0007] S2. Establishing a linearized electric-gas system model: Derivation of a differential transformation model of the electric-gas system from the nonlinear ordinary differential-algebraic model of the electric-gas system established in step S1 according to differential transformation; the differential transformation model includes a natural gas system differential transformation model, an electric power system differential transformation model, and a coupled component differential transformation model;
[0008] S3. Calculate the matrix by blocks: Based on the differential transformation model derived in step S2, the mathematical expression of the differential transformation model of the electric-gas system is combined, the coefficient matrix is divided into blocks, and the differential transformation coefficients of each part are calculated separately;
[0009] S4. Adaptively adjust the time window: Estimate the truncation error of the lower semi-analytical solution of the current time window based on the highest-order differential transformation coefficient obtained by the block calculation matrix in step S3, calculate the root mean square error based on the set error limit, and update the time window under the change rate limit;
[0010] S5. Result output: Based on the differential transformation coefficients obtained by the block calculation matrix in step S3 and the next time window obtained by the adaptive adjustment time window technology in step S4, the semi-analytical solution of the system is calculated and used as the result of the energy flow calculation of the electric-gas integrated energy system.
[0011] As an improvement of the present invention, the step S1 of establishing the nonlinear partial differential-algebraic model of the electric-gas system specifically includes the following steps:
[0012] S11: Construct nonlinear partial differential-algebraic models of natural gas systems, nonlinear algebraic models of power systems, and algebraic models of coupled components;
[0013] The nonlinear partial differential-algebraic model of the natural gas system includes pipeline equations and equations at nodes. The mathematical expression of the pipeline equation is specifically:
[0014]
[0015] Where j = 1, 2, ..., J is the index of the pipeline number, J is the number of pipelines, S j ,λ j and D j are the cross-sectional area, friction coefficient and diameter of pipe j respectively, c is the speed of sound, and are the gas pressure and mass flow rate of the gas in the pipeline respectively;
[0016] The mathematical expression of the equation at the node is:
[0017] m nd (t) = K out m pl (0,t)-K in m pl (L,t)
[0018]
[0019] Among them, m pl (0, t), m pl (L, t), π pl (0) and π pl (L, t) are the vectors of mass flow and pressure of the gas in the first and last sections of all pipelines at time t, respectively. nd (t) and π nd (t) are the vectors of gas load and pressure at all nodes at time t, K in and K out are matrices describing the relationship between all natural gas pipelines flowing into and out of nodes, K cmp is the vector of all natural gas node pressure ratios;
[0020] S12. Discretize the partial differential equations using semi-discrete technology and convert them into ordinary differential equations:
[0021] Defining variables The mathematical expression of the natural gas pipeline equations is obtained by differentiating the partial derivatives in space:
[0022]
[0023] in, and are the values of the corresponding variables in the nth section of pipeline j, Z j (u j ) is the vector on the right side of the pipeline equation, V j is the coefficient matrix on the left side of the pipeline equation, is the number of segments of pipeline j;
[0024] S13. Construct the numerical boundary of the pipeline to make the mathematical expression of the model closed:
[0025] Defining variables and matrix v j =[c / S j -c / S j; 1 1], for the coefficient matrix V in step S12 j Do the characteristic decomposition, and then construct the extrapolation boundary by the characteristic line method. According to the total differential formula, the slope of the characteristic line is set to c. When ignoring When , the mathematical expression of the linear extrapolation formula is:
[0026]
[0027] Among them, Δt is the set window;
[0028] The mathematical expression of the extrapolated boundary is:
[0029]
[0030] As another improvement of the present invention, in step S11, the nonlinear algebraic model of the power system is specifically:
[0031] p=diag(e)(Ge-Bf)+diag(f)(Be+Gf)
[0032] q=diag(f)(Ge-Bf)-diag(e)(Be+Gf)
[0033] diag(e)e+diag(f)f=diag(U)U
[0034] Where G and B are the conductance and susceptance matrices of the power system, respectively. and are the active and reactive powers injected into the power system, is the PV bus voltage amplitude of the power system, and are the real and imaginary parts of the power system bus voltage, N PQ 、N PV and N bus are the number of PQ buses, PV buses, and total buses in the power system respectively;
[0035] The algebraic model of the coupling component is specifically:
[0036]
[0037]
[0038] in, and are the efficiencies of the power-consuming compressor, gas-fired unit, and P2G equipment, respectively, b is the phase angle of busbar b equipment, p b and q b are the active and reactive power injected into the grid by busbar b equipment, respectively, and vector is the matrix K out The i-th row, S C 、S GT and S P2G It is the set of node and bus numbers of power-consuming compressors, gas units and P2G equipment in the gas grid and power system respectively.
[0039] As another improvement of the present invention, the differential transformation rule in step S2 is specifically:
[0040]
[0041] in, and are the k-th order differential transformation coefficients of variables x(t) and y(t), is an arbitrary constant and δ is a unit step function.
[0042] As another improvement of the present invention, the step S3 of calculating the matrix in blocks specifically includes the following steps:
[0043] S31: Based on the block strategy, the mathematical expressions of the differential transformation model of the electric-pneumatic system are combined and simplified as follows:
[0044]
[0045] in, is the matrix of the partial derivatives of the differential transformation expression of the pipeline equation with respect to the differential transformation coefficients of the internal state of the pipeline, is related to the differential transformation order k, W 21 is the matrix of the node equations at the natural gas node that are independent of the power system balancing bus, the numerical boundaries and the differential transformation expressions of the coupling components with respect to the differential transformation coefficients of the internal state of the pipeline, W 22 is the matrix of the node equations, numerical boundaries and differential transformation expressions of the coupled components at the natural gas node that is not related to the power system balancing busbar, and the partial derivatives of the differential transformation coefficients of the natural gas node that is not related to the power system balancing busbar and the pipeline boundary state corresponding to this node, W 31 is the matrix of the partial derivatives of the differential transformation coefficients of the power system and the gas nodes related to the power system balancing bus, the extrapolated boundaries, the coupled components and the power system equations with respect to the differential transformation coefficients of the pipeline internal state, W 32 is the matrix of the partial derivatives of the differential transformation coefficients of the node equations, numerical boundaries, coupled components and power system equations at the power system and the gas nodes related to the power system balancing busbar with respect to the gas nodes unrelated to the power system balancing busbar and the pipeline boundary states corresponding to these nodes, is the matrix of the partial derivatives of the differential transformation coefficients of the node equations, numerical boundaries, coupled components and power system equations at the power system and the natural gas nodes related to the power system balancing busbar, with respect to the power system, the natural gas nodes related to the power system balancing busbar and the pipeline boundary states corresponding to these nodes, is related to the differential transformation order k, and are the differential transformation coefficients required to be solved in each step of the step-by-step calculation, namely, step 1: the internal state of the pipeline obtained by recursive solution, step 2: the natural gas node and the pipeline boundary state corresponding to this node that are not related to the power system balance bus obtained by direct calculation, step 3: the power system, the natural gas node related to the power system balance bus and the pipeline boundary state corresponding to this node obtained by non-iterative calculation, and They are the differential transformation expressions of pipeline equations, node equations at natural gas nodes unrelated to the power system balancing busbar, differential transformation expressions of extrapolated boundaries and coupling components and the power system and node equations at natural gas nodes related to the power system balancing busbar, differential transformation expressions of extrapolated boundaries, coupling components and power system equations, and the right-hand constant vectors corresponding to them. and It is related to the differential transformation order k;
[0046] S32: Calculate the differential transformation coefficient of the internal state of the pipeline based on the differential transformation expression of the pipeline equation; calculate the differential transformation coefficient of the boundary state of the natural gas node unrelated to the power system balancing bus and this node and the pipeline corresponding to this node based on the differential transformation expression of the natural gas node unrelated to the power system balancing bus and this node equation, extrapolated boundary and coupling component; calculate the differential transformation coefficient of the boundary state of the power system, the natural gas node related to the power system balancing bus and the pipeline corresponding to this node based on the differential transformation expression of the node equation, extrapolated boundary and coupling component equation at the power system and the natural gas node related to the power system balancing bus.
[0047] As a further improvement of the present invention, in the step S31, the first step of the step-by-step calculation recursively solves the internal state of the pipeline. After the relationship between the differential transformation coefficients of the internal state of the pipeline is converted, the mathematical expression in matrix form is specifically:
[0048]
[0049] In the step S31, the second step of the step calculation directly calculates the natural gas node that is not related to the power system balancing bus and the pipeline boundary state corresponding to the node. The specific relationship is:
[0050]
[0051] The third step of the step S31 non-iterative calculation of the power system, the natural gas node related to the power system balancing bus, and the pipeline boundary state corresponding to this node is specifically calculated as follows:
[0052]
[0053] As a further improvement of the present invention, the step S4 of adaptively adjusting the time window specifically includes the following steps:
[0054] S41: Estimate the truncation error of the lower semi-analytical solution in the current time window based on the differential transformation coefficient:
[0055]
[0056] in, The K-order differential transformation coefficients of all substituted variables;
[0057] S42: Calculate the error limits based on the set absolute and relative tolerance limits:
[0058]
[0059] Where Atol and Rtol are the set absolute and relative tolerance limits respectively; N is the number of substitution variables;
[0060] S43: Calculate the root mean square error based on the truncation error estimate obtained in step S42:
[0061]
[0062] S44: Calculate a new time window based on the root mean square error calculated in step S43:
[0063] Δt new =Δt·fac·(1 / err) 1 / K
[0064] Δt=min(fac max ·Δt,max(fac min ·Δt,Δt new ))
[0065] Among them, fac is the conservative factor; fac max and fac min They are the upper and lower limits of the set time window change rate respectively;
[0066] S45: Based on the calculated differential transformation coefficient and the new time window, calculate the semi-analytical solution within the time window:
[0067]
[0068] In order to achieve the above-mentioned purpose, the present invention also adopts the following technical solution: an energy flow calculation system for an electric-gas integrated energy system based on a semi-analytical solution, comprising a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned methods.
[0069] Compared with the existing technology, the present invention has the following beneficial effects: the present invention provides an energy flow calculation method and system for an electric-gas integrated energy system based on a semi-analytical solution, which can convert the original nonlinear partial differential equation of the gas network into a linear algebraic equation, simplifying the complex nonlinear problems in traditional gas network modeling, avoiding errors caused by local linearization and time differentiation, reducing the calculation scale and improving the robustness of the calculation; in addition, the method of the present invention can not only accurately capture the dynamic behavior of the natural gas system, but also significantly reduce the amount of calculation, improve the calculation reliability, effectively reduce the errors that may be generated by traditional models in complex gas dynamics scenarios, and avoid system safety hazards caused by inaccurate models. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 It is a schematic diagram of the structure of the integrated energy system used in the method of the present invention;
[0071] Figure 2 This is a flowchart of the steps of the energy flow calculation method of the electric-gas integrated energy system based on the semi-analytical solution of the present invention;
[0072] Figure 3 is a structural diagram of the power grid and coupling equipment of the integrated energy system in the test example of the present invention;
[0073] Figure 4 is a gas network structure diagram of the integrated energy system in the test example of the present invention;
[0074] Figure 5 This is a comparison chart of typical state quantities in the test case of the present invention and the results of other methods, where
[0075] Figure (a) is a comparison of the results of calculating the natural gas pipeline mass flow rate using the method of the present invention and other methods;
[0076] Figure (b) is a comparison of the results of calculating natural gas node pressure using the method of the present invention and other methods;
[0077] Figure (c) is a comparison of the results of calculating the bus voltage amplitude of the power system using the method of the present invention and other methods;
[0078] Figure (d) is a comparison of the results of calculating the power system bus voltage phase angle using the method of the present invention and other methods. DETAILED DESCRIPTION
[0079] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0080] Example 1
[0081] This embodiment is applied to an integrated energy system, and the structure of the integrated energy system is as follows: Figure 1 As shown, the left side is a simple diagram of the power grid, and the right side is a simple diagram of the gas grid. The gas turbine (GT) consumes natural gas to generate electricity, and the power-to-gas equipment (P2G) can consume electricity to produce natural gas.
[0082] A method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution, such as Figure 2 As shown, the following steps are included:
[0083] Step S1: Establish a nonlinear partial differential-algebraic model of the electric-gas system, including a nonlinear partial differential-algebraic model of the natural gas system, a nonlinear algebraic model of the power system, and an algebraic model of the coupled components. Discrete the partial differential equations into ordinary differential equations through semi-discrete technology, and construct the numerical boundary of the pipeline to form a nonlinear ordinary differential-algebraic model of the electric-gas system.
[0084] S11. Establish a nonlinear partial differential-algebraic model of the electric-gas system, including a nonlinear partial differential-algebraic model of the natural gas system, a nonlinear algebraic model of the power system, and an algebraic model of the coupled components:
[0085] S111. Construct a nonlinear partial differential-algebraic model of the natural gas system, including pipeline equations and node equations:
[0086] The mathematical expression of the pipeline equation is:
[0087]
[0088] Where j = 1, 2, ..., J is the index of the pipeline number, J is the number of pipelines, S j ,λ j and D j are the cross-sectional area, friction coefficient and diameter of pipe j respectively, c is the speed of sound, and are the gas pressure and mass flow rate in the pipeline respectively.
[0089] Furthermore, a matrix describing the relationship between natural gas pipelines and nodes is defined and Its mathematical form is as follows:
[0090]
[0091] Where i=1, 2, ..., I is the index of the pipeline number, I is the number of nodes, is the pressure ratio of the compressor at node i. These matrices are used to establish the equations for flow conservation and pressure consistency at the gas network nodes. The mathematical form is as follows:
[0092] m nd (t) = K out m pl (0,t)-K in m pl (L,t)
[0093]
[0094] in, and are the vectors of mass flow and pressure of the gas in the first and last sections of all pipelines at time t, respectively, m nd (t) and π nd (t) are the vectors of gas load and pressure at all nodes at time t, L J is the length of pipe j, is the set of all pipe lengths.
[0095] S112. Construct a nonlinear algebraic model of the power system:
[0096] p=diag(e)(Ge-Bf)+diag(f)(Be+Gf)
[0097] q=diag(f)(Ge-Bf)-diag(e)(Be+Gf)
[0098] diag(e)e+diag(f)f=diag(U)U
[0099] Where G and B are the conductance and susceptance matrices of the power system, respectively. and are the active and reactive powers injected into the power system, is the PV bus voltage amplitude of the power system, and are the real and imaginary parts of the power system bus voltage respectively; N PQ 、N PV and N bus are the number of PQ buses, PV buses and total buses in the power system respectively.
[0100] S113. Construct an algebraic model of coupled components:
[0101]
[0102] in, and are the efficiencies of the power-consuming compressor, gas-fired unit, and P2G equipment, respectively, b is the phase angle of busbar b equipment, p b and q b are the active and reactive power injected into the grid by busbar b equipment, respectively, and vector is the matrix K out The i-th row, S C 、S GT and S P2G It is the set of node and bus numbers of power-consuming compressors, gas units and P2G equipment in the gas grid and power system respectively.
[0103] S12. Semi-discrete technology discretizes partial differential equations and converts partial differential equations into ordinary differential equations:
[0104] Defining variables The mathematical expression of the natural gas pipeline equations can be written as:
[0105]
[0106] in, V j =[0 c 2 / S j ;S j 0). For the difference of the partial derivatives with respect to space, the mathematical expression can be written as:
[0107]
[0108] S13. Construct the numerical boundary of the pipeline to make the mathematical expression of the model closed:
[0109] S131, coefficient matrix V j Do eigendecomposition:
[0110]
[0111] Among them, v j =[c / S j -c / S j ;1 1]. Definition Furthermore, the mathematical form of the natural gas pipeline can be written as:
[0112]
[0113] S132, characteristic line method to construct extrapolation boundary:
[0114] According to the total differential formula, Set the slope of the characteristic line to c, taking the first pipe equation as an example:
[0115]
[0116] When ignoring the source term When , its mathematical form is as follows:
[0117]
[0118] The mathematical expression of the linear extrapolation formula can be written as:
[0119]
[0120] Furthermore, the mathematical expression of the extrapolated boundary can be written as:
[0121]
[0122] Step S2: deriving differential transformation rules, and deriving differential transformation models of the electric-gas system according to the differential transformation rules, including a natural gas system differential transformation model, a power system differential transformation model, and a coupled component differential transformation model;
[0123] S21. Calculation rules for differential transformation coefficients of variable x(t):
[0124]
[0125] Derive the differential transformation rules:
[0126]
[0127] in, and are the k-th order differential transformation coefficients of variables x(t) and y(t), is an arbitrary constant and δ is a unit step function.
[0128] S22. Derive the differential transformation model of the electric-gas system, including the differential transformation model of the natural gas system, the differential transformation model of the power system, and the differential transformation model of the coupled components:
[0129] S221. Based on the natural gas system model and the differential transformation rules, derive the mathematical expression of the natural gas system differential transformation model:
[0130]
[0131] S222. Based on the nonlinear algebraic equation model of the power system and the differential transformation rules, derive the mathematical expression of the differential transformation model of the power system:
[0132]
[0133] S223. Based on the algebraic equation model of the coupling component and the differential transformation rule, derive the mathematical expression of the differential transformation model of the coupling component:
[0134]
[0135] Step S3: Combine the mathematical expressions of the differential transformation model of the electric-gas system, divide the coefficient matrix into blocks and calculate the differential transformation coefficients of each part respectively.
[0136] S31: Based on the block strategy, the mathematical expressions of the differential transformation model of the electric-pneumatic system are combined and simplified into the following mathematical form:
[0137]
[0138] in It is the various parts of the coefficient matrix of the mathematical expression of the differential transformation model of the electric-gas system. The subscript ij represents the matrix block in the i-th row and j-th column. The superscript k is the order of the differential transformation. Without the superscript k, it means that this matrix block is independent of the order of the differential transformation. and are the differential transformation coefficients that need to be solved in each step of the step-by-step calculation.
[0139] The steps include:
[0140] S311. Based on the differential transformation model of the natural gas system, establish the relationship between the differential transformation coefficients of the internal state of the gas pipeline:
[0141]
[0142] S312. Based on the differential transformation model of the natural gas system, power system, and coupled components, establish a relationship between the differential transformation coefficients of the natural gas node and the corresponding pipeline boundary state when there is no balancing bus gas generator set:
[0143]
[0144] S312. Based on the differential transformation model of the natural gas system, power system, and coupled components, establish the relationship between the differential transformation coefficients of the power system and the natural gas nodes with balancing bus gas generator sets and the corresponding pipeline boundary states:
[0145]
[0146] S32: The block calculation method includes the following steps:
[0147] S321. Further write the relationship in step S311 into the form of differential transformation coefficient matrix solution, and calculate the differential transformation coefficient of the internal state of the pipeline according to the differential transformation expression of the pipeline equation:
[0148]
[0149] in is the recursive relationship of the differential transformation coefficient of the internal state of the pipeline.
[0150] S322. Calculate the differential transformation coefficients of the natural gas node unrelated to the power system balancing bus and the pipeline boundary state corresponding to the node based on the node equation, the extrapolated boundary, and the differential transformation expression of the coupling component at the natural gas node unrelated to the power system balancing bus:
[0151]
[0152] Where W 22 and the differential transformation order k, and only one inversion is required in the entire energy flow calculation process, that is, the subsequent calculation is directly settled to obtain
[0153] S323. Based on the differential transformation expressions of the power system and the node equations, extrapolated boundaries, and coupled component equations at the natural gas nodes related to the power system balancing bus, calculate the differential transformation coefficients of the power system, the natural gas nodes related to the power system balancing bus, and the natural gas nodes with gas generator sets serving as balancing buses at these nodes, and the corresponding pipeline boundary states:
[0154]
[0155] Step S4, estimating the truncation error of the lower semi-analytical solution of the current time window based on the high-order differential transformation coefficient, and calculating the root mean square error based on the set error limit, and further updating the time window under the change rate limit, specifically including the following steps:
[0156] S41. Estimate the truncation error of the lower semi-analytical solution in the current time window based on the calculated differential transformation coefficient:
[0157]
[0158] in, The K-order differential transformation coefficients of all substituted variables;
[0159] S42. Calculate the error limit based on the set absolute and relative tolerance limits:
[0160]
[0161] Where Atol and Rtol are the set absolute and relative tolerance limits respectively; N is the number of substitution variables;
[0162] S43. Calculate the root mean square error based on the calculated truncation error estimate:
[0163]
[0164] S44. Calculate a new time window based on the calculated root mean square error:
[0165] Δt new =Δt·fac·(1 / err) 1 / K
[0166] Δt=min(fac max ·Δt,max(fac min ·Δt,Δt new ))
[0167] Among them, fac is a conservative factor set to be less than 1; fac max and fac min They are the upper and lower limits of the set time window change rate respectively;
[0168] S45. Calculate the semi-analytical solution within the time window based on the calculated differential transformation coefficient and the new time window:
[0169]
[0170] Step S5: Solve the model to obtain energy flow calculation results.
[0171] S51. Based on Python, according to step S31, use SymPy to establish a symbolic model for step-by-step calculation of the electric-gas integrated energy system using the differential transformation method;
[0172] S52. Based on Python, according to step S32, use SymPy to solve the symbolic model of the step-by-step calculation under the differential transformation method of the electricity-gas integrated energy system, and obtain the symbolic expression of the step-by-step calculation of the semi-analytical solution of the electricity-gas integrated energy system;
[0173] S52. Based on Python, the symbolic expression of the step-by-step calculation of the semi-analytical solution of the electricity-gas integrated energy system is converted into a numerical function, and according to step S4, the adaptive time window technology is used to obtain the semi-analytical solution of the electricity-gas integrated energy system step by step.
[0174] Test Case
[0175] The multi-energy flow system of this embodiment is composed of an IEEE 118-node power grid and a modified 133-node gas grid. Figure 3 As shown in Figure 1, it includes 5 gas turbines, 1 P2G and 1 power-consuming compressor. Figure 4 The energy flow calculation time is 6 hours, and the spatial step size is 1 km. The power system and natural gas system are coupled through gas turbines, P2G, and power-consuming compressors.
[0176] The energy flow calculation of the integrated energy system is performed according to the steps of Example 1 of the present invention. The method (M4) of the present invention is compared with the characteristic line method (REL), the finite difference method of the implicit Euler difference format with different time steps (M2-5s, M2-10s, M2-120s) and the finite difference method of the central implicit difference format (M3-10s) of various commonly used methods for calculating the energy flow of the electric-gas combined energy system. Among them, the characteristic line method with high precision is used as the reference result to compare the calculation accuracy of the other methods. In the comparative method, the characteristic line format, the implicit Euler difference format and the central implicit difference format are first used to discretize the partial differential equation of the natural gas pipeline into algebraic equations, and then the Newton method is used to solve the algebraic equations of the electric-gas combined energy system. The finite difference method of the implicit Euler difference format considers three time steps of 5s, 10s and 120s, and the finite difference method of the central implicit difference format considers a time step of 10s. According to the results obtained by the above methods, the mass flow of the natural gas pipelines numbered 0 and 101, the pressure of the natural gas nodes numbered 83 and 88, the voltage amplitude of the power system bus numbered 58 and 113, and the voltage phase angle of the power system bus numbered 58 and 113 are selected to draw the graphs respectively. Figure 5 Subgraphs (a), (b), (c) and (d). Figure 5 As can be seen from the sub-figures (a) and (b), the pipeline mass flow pattern and node pressure of the natural gas system obtained by M4 and the calculations of M2 and M3 with smaller time steps are in good agreement with the results of REL. When the state of the natural gas system changes significantly, the results of M2 and M3 with larger time steps deviate greatly from those of REL. Figure 5 As can be seen in subfigures (c) and (d), the results of M4, M2, and M3 all accurately reflect changes in the power system state. Considering that M4 uses a semi-discrete method to process the partial differential equations of the natural gas pipeline in the natural gas system, the retained time derivatives of the variables in the original partial differential equations can more accurately describe the trajectory when the natural gas system state changes. M4 uses the same algebraic model in the power system, resulting in similar results to M2 and M3.
[0177] According to the results obtained by the above methods, taking REL as the benchmark value, the mass flow rate (mpl ), gas pressure of all nodes (p nd The root mean square error of the solution of the real part (e) and imaginary part (f) of the voltage of all buses in the power system is obtained in Table 1.
[0178] Table 1
[0179] method M2-120s M2-10s M2-5s M3-10s M4 e 1.614e-2 8.222e-3 3.357e-3 8.222e-3 4.242e-3 f 2.741e-2 1.390e-2 5.674e-3 1.390e-2 7.199e-3 <![CDATA[m pl ]]> 3.605e-1 8.950e-2 6.509e-2 1.299e-1 9.317e-2 <![CDATA[p nd ]]> 1.378e3 3.047e2 1.157e2 3.158e2 1.743e2
[0180] As shown in the table above, the computational accuracy of M4 in power systems is comparable to that of M2 and M3. M4 also outperforms M2 and M3 in natural gas calculations when time steps are similar. Furthermore, although M3 utilizes a central implicit difference scheme with second-order accuracy, numerical oscillations occur during the energy flow calculation, resulting in lower mass flow calculation accuracy than M2, which uses a first-order difference scheme.
[0181] In addition, the time cost of the proposed method and other methods in the energy flow calculation process is compared, and Table 2 is obtained.
[0182] Table 2
[0183] method M2-120s M2-10s M2-5s M3-10s M4 Time cost(s) 6.7 63.7 126.6 84.6 56.8 Counting steps 180 2160 4320 2160 2586
[0184] As can be seen from the table above, when using similar time steps, the time costs of M2 and M3 are higher than those of M4 proposed in this invention. This is because M4 linearizes the electrical integrated energy system model, avoids iterative calculations, and uses recursive and step-by-step calculations to reduce the scale and number of matrix inversions.
[0185] Therefore, according to Figure 5 As shown in Tables 1 and 2, the proposed method has higher computational accuracy and lower computational cost than other compared methods. The proposed method can effectively establish a linear model for an integrated electricity-gas energy system and apply it to energy flow calculations. The linear model can be calculated step by step, reducing the computational scale.
[0186] In summary, the method of the present invention first converts the original nonlinear system from a partial differential-algebraic model to an ordinary differential-algebraic model, and establishes a linearized electric-gas system model through differential transformation; secondly, the constructed linearized model is calculated in blocks, and the adaptive adjustment time window technology is introduced to reduce the calculation scale while improving the robustness of the calculation. Through the proposed method, the original nonlinear partial differential equations of the gas grid can be converted into linear algebraic equations, which simplifies the complex nonlinear problems in traditional gas grid modeling, avoids the errors caused by local linearization and time differentiation, reduces the calculation scale and improves the robustness of the calculation. At the same time, the present invention can also significantly reduce the amount of calculation, improve the reliability of calculation, and provide strong technical support for ensuring the stable operation and sustainable development of the energy system.
[0187] It should be noted that the above content merely illustrates the technical idea of the present invention and cannot be used to limit the scope of protection of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications all fall within the scope of protection of the claims of the present invention.
Claims
1. A method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution, characterized by , including at least the following steps: S1. Establishing a nonlinear partial differential-algebraic model of the electric-gas system: The model includes a nonlinear partial differential-algebraic model of the natural gas system, a nonlinear algebraic model of the electric power system, and an algebraic model of the coupled components. The partial differential equations in the natural gas system are discretized into ordinary differential equations using a semi-discrete technique, and the numerical boundaries of the pipeline are constructed to form a nonlinear ordinary differential-algebraic model of the electric-gas system. S2. Establishing a linearized electric-gas system model: Derivation of a differential transformation model of the electric-gas system from the nonlinear ordinary differential-algebraic model of the electric-gas system established in step S1 according to differential transformation rules; the differential transformation model includes a natural gas system differential transformation model, an electric power system differential transformation model, and a coupled component differential transformation model; S3. Calculate the matrix by blocks: Based on the differential transformation model derived in step S2, the mathematical expression of the differential transformation model of the electric-gas system is combined, the coefficient matrix is divided into blocks, and the differential transformation coefficients of each part are calculated separately; S4. Adaptively adjust the time window: Estimate the truncation error of the lower semi-analytical solution of the current time window based on the highest-order differential transformation coefficient obtained by the block calculation matrix in step S3, calculate the root mean square error based on the set error limit, and update the time window under the change rate limit; S5. Result output: Based on the differential transformation coefficients obtained by the block calculation matrix in step S3 and the next time window obtained by the adaptive adjustment time window technology in step S4, the semi-analytical solution of the system is calculated and used as the result of the energy flow calculation of the electric-gas integrated energy system.
2. The method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution according to claim 1, characterized in that: The step S1 of establishing a nonlinear partial differential-algebraic model of the electric-pneumatic system specifically includes the following steps: S11: Construct nonlinear partial differential-algebraic models of natural gas systems, nonlinear algebraic models of power systems, and algebraic models of coupled components; The nonlinear partial differential-algebraic model of the natural gas system includes pipeline equations and equations at nodes. The mathematical expression of the pipeline equation is specifically: Where j = 1, 2, ..., J is the index of the pipeline number, J is the number of pipelines, S j ,λ j and D j are the cross-sectional area, friction coefficient and diameter of pipe j respectively, c is the speed of sound, and are the gas pressure and mass flow rate of the gas in the pipeline respectively; The mathematical expression of the equation at the node is: m nd (t)=K out m pl (0,t)-K in m pl (L,t) Among them, m pl (0, t), m pl (L, t), π pl (0) and π pl (L, t) are the vectors of mass flow and pressure of the gas in the first and last sections of all pipelines at time t, respectively. nd (t) and π nd (t) are the vectors of gas load and pressure at all nodes at time t, K in and K out are matrices describing the relationship between all natural gas pipelines flowing into and out of nodes, K cmp is the vector of all natural gas node pressure ratios; S12. Discretize the partial differential equations using semi-discrete technology and convert them into ordinary differential equations: Defining variables The mathematical expression of the natural gas pipeline equations is obtained by differentiating the partial derivatives in space: in, and are the values of the corresponding variables in the nth section of pipeline j, Z j (u j ) is the vector on the right side of the pipeline equation, V j is the coefficient matrix on the left side of the pipeline equation, is the number of segments of pipeline j; S13. Construct the numerical boundary of the pipeline to make the mathematical expression of the model closed: Defining variables and matrix v j =[c / S j -c / S j ; 1 1], for the coefficient matrix V in step S12 j Do the characteristic decomposition, and then construct the extrapolation boundary by the characteristic line method. According to the total differential formula, the slope of the characteristic line is set to c. When ignoring When , the mathematical expression of the linear extrapolation formula is: Among them, Δt is the set window; The mathematical expression of the extrapolated boundary is:
3. The method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution according to claim 2, characterized in that: In step S11, the nonlinear algebraic model of the power system is specifically: p=diag(e)(Ge-Bf)+diag(f)(Be+Gf0 q=diag(f)(Ge-Bf)-diag(e)(Be+Gf) diag(e)e+diag(f)f=diag(U)U in, G and B are the conductance and susceptance matrices of the power system, respectively. and are the active and reactive powers injected into the power system, is the PV bus voltage amplitude of the power system, and are the real and imaginary parts of the power system bus voltage, N PQ 、N PV and N bus are the number of PQ buses, PV buses, and total buses in the power system respectively; The algebraic model of the coupling component is specifically: in, and are the efficiencies of power-consuming compressors, gas-fired units, and P2G equipment, respectively, b is the phase angle of busbar b equipment, p b and q b are the active and reactive power injected into the grid by busbar b equipment, respectively, and vector is the matrix K out The i-th row, S C 、S GT and S P2G It is the set of node and bus numbers of power-consuming compressors, gas units and P2G equipment in the gas grid and power system respectively.
4. The method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution according to claim 1, characterized in that: The differential transformation rule in step S2 is specifically: (1) (2) (3) (4) (5) (6) (7) (8) in, and are the k-th order differential transformation coefficients of variables x(t) and y(t), is an arbitrary constant and δ is a unit step function.
5. The method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution according to claim 1, characterized in that: The step S3 of calculating the matrix by blocks specifically includes the following steps: S31: Based on the block strategy, the mathematical expressions of the differential transformation model of the electric-pneumatic system are combined and simplified as follows: in, It is the various parts of the coefficient matrix of the mathematical expression of the differential transformation model of the electric-gas system. The subscript ij represents the matrix block in the i-th row and j-th column. The superscript k indicates that this matrix block is related to the order k of the differential transformation. The absence of the superscript k indicates that this matrix block is independent of the order k of the differential transformation. represents the differential transformation coefficient of the required solution in the calculation of the internal state of the natural gas pipeline, It represents the differential transformation coefficient of the required solution in the calculation of the boundary state of the natural gas node and the pipeline corresponding to the node that is not related to the power system balance bus. It represents the differential transformation coefficient of the required solution in the calculation of the power system, the natural gas node related to the power system balance bus and the pipeline boundary state corresponding to this node obtained by non-iterative calculation, and are the right-hand constant vectors corresponding to the expressions consisting of the matrix blocks of the 1st, 2nd and 3rd rows of the coefficient matrix, and It is related to the differential transformation order k; S32: According to the differential transformation expression of the pipeline equation, the differential transformation coefficient of the internal state of the pipeline is recursively calculated; according to the differential transformation expression of the natural gas node unrelated to the power system balancing bus and this node equation, extrapolated boundary and coupling component, the differential transformation coefficient of the boundary state of the natural gas node unrelated to the power system balancing bus and this node and the pipeline corresponding to this node is directly calculated; according to the differential transformation expression of the node equation, extrapolated boundary and coupling component equation at the power system and the natural gas node related to the power system balancing bus, the differential transformation coefficient of the boundary state of the power system, the natural gas node related to the power system balancing bus and the pipeline corresponding to this node is non-iteratively calculated.
6. The method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution according to claim 5, characterized in that: The step S31 includes at least three steps of calculation: (1) recursively solving the internal state of the pipeline; (2) directly calculating the natural gas node that is not related to the power system balancing bus and the pipeline boundary state corresponding to this node; and (3) non-iteratively calculating the power system, the natural gas node that is related to the power system balancing bus and the pipeline boundary state corresponding to this node. In the recursive solution of the internal state of the pipeline, the relationship between the differential transformation coefficients of the internal state of the pipeline is converted into a mathematical expression in matrix form as follows: In the direct calculation of the natural gas node that is not related to the power system balancing bus and the pipeline boundary state corresponding to this node, the specific relationship is: In the non-iterative calculation of the power system, the natural gas node related to the power system balancing bus and the pipeline boundary state corresponding to this node, the specific relationship is:
7. The method for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution according to claim 1, characterized in that: The step S4 of adaptively adjusting the time window specifically includes the following steps: S41: Estimate the truncation error of the lower semi-analytical solution in the current time window based on the differential transformation coefficient: in, The K-order differential transformation coefficients of all substituted variables; S42: Calculate the error limits based on the set absolute and relative tolerance limits: Where Atol and Rtol are the set absolute and relative tolerance limits respectively; N is the number of substitution variables; S43: Calculate the root mean square error based on the truncation error estimate obtained in step S42: S44: Calculate a new time window based on the root mean square error calculated in step S43: Δt new =Δt·fac·(1 / err) 1 / K Δt=min(fac max ·Δt,max(fac min ·Δt,Δt new )) Among them, fac is the conservative factor; fac max and fac min They are the upper and lower limits of the set time window change rate respectively; S45: Based on the calculated differential transformation coefficient and the new time window, calculate the semi-analytical solution within the time window:
8. A system for calculating energy flow in an electric-gas integrated energy system based on a semi-analytical solution, including a computer program, characterized in that: When the computer program is executed by a processor, the steps of any one of the above methods are implemented.
Citation Information
Cited By
Dynamic energy flow calculation semi-analysis method and system for electric-thermal integrated energy system
CN121238562A