Next Article in Journal
Temperature Effect on Service Life of Reinforced Concrete (RC) Structure Under Chemical Erosion: Deterministic and Probabilistic Approach
Previous Article in Journal
Color Simulation of Multilayered Thin Films Using Python
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Energy Flow Calculation Method for Multi-Energy Systems: A Matrix Approach Considering Alternative Gas Injection and Dynamic Flow Direction

1
School of Electrical Engineering, Southeast University, Nanjing 210096, China
2
College of Energy and Electrical Engineering, Hohai University, Nanjing 211100, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(9), 4815; https://doi.org/10.3390/app15094815
Submission received: 13 March 2025 / Revised: 17 April 2025 / Accepted: 22 April 2025 / Published: 26 April 2025
(This article belongs to the Section Energy Science and Technology)

Abstract

:
The steady-state energy flow calculation (EFC) of multi-energy systems (MESs) is a fundamental foundation for MES planning and operation. However, most of the existing MES models are designed case-specifically, making them incapable of modelling diverse scenarios. Moreover, since it involves initial value setting, the convergence of the Newton–Raphson (NR) method to solve the EFC problem of MESs is often unsatisfactory. To tackle these problems, a matrix-based EFC method of MESs is proposed in this paper. The universal matrix formulations of heat and gas subnetworks are first constructed, where the injection of alternative gas sources and the effect of gas compressibility factor on the MES state are both considered. Due to the uncertainty of gas flow direction during the NR iteration process, the gas composition tracking equations are modified to avoid ill conditions. The Jacobian matrices for the constructed subnetwork models are then derived and expressed in matrix form. On this basis, the unified NR strategy is adopted to solve the constructed models. Finally, the performance of the proposed method is verified through case studies. The results demonstrate that the proposed models can accurately capture the MES operating state and achieve significant improvements in convergence and computational efficiency compared to traditional models.

1. Introduction

Since the Industrial Revolution, human society has entered a period of rapid development, and the reliance on high-quality energy has increased significantly. However, traditional fossil energy sources have been facing challenges such as over-exploitation and inefficient utilization. Meanwhile, the environmental crises triggered by unreasonable energy structures have become increasingly severe. In the context of Carbon Neutrality, sustainable development technologies have emerged as a central focus for countries worldwide [1]. Multi-energy systems (MESs), integrating electricity, heat, and gas, enable the hierarchical utilization and flexible regulation of heterogeneous energy sources, breaking the barriers of traditionally independent energy supply systems [2,3]. This provides new pathways for promoting low-carbon emissions and improving energy efficiency. With continuous breakthroughs in clean energy technologies, an increasing number of coupling devices, such as power-to-gas (P2G), have been applied in MESs, making the coupling relationships among subsystems more complex [4]. Therefore, collaborative analysis of MESs from a holistic perspective has become a research hotspot in recent years.
Energy flow calculation (EFC) is an essential tool for steady-state analysis of MESs. By utilizing network parameter information and specified boundary conditions, it calculates the operating state variables of subnetworks and coupling devices within the MES. As such, it serves as a critical foundation for various MES studies, including the exploration of multi-energy interaction characteristics, optimization of scheduling, collaborative planning, and static security assessment [5,6]. Currently, research on multi-energy flow calculation in MESs primarily focuses on model development and solution strategies.
In terms of multi-energy flow modeling, research on the modeling of the district electricity network (DEN) has become highly advanced, with the classical alternative current (AC) power flow model being widely adopted [7]. For the electricity–gas coupled system, an energy flow model for this type of MES was developed in [8], which highlighted the impact of temperature on the operating state of the MES. By introducing P2G devices and considering the per-unit normalization of heterogeneous state variables, a bidirectional energy flow model for electricity–gas MESs was proposed in [9]. Due to the physical property differences between various gas sources, such as synthetic natural gas (SNG), hydrogen, etc., an energy flow model for electricity–gas MESs that is suitable for multiple slack buses and alternative gas source injections was established in [10], reflecting the impact of gas quality differences on the operating state of the district gas network (DGN). In the research on the district heat network (DHN), the hydraulic and thermal models for DHN were constructed in [11]; based on this, an energy flow model for the electricity-heat MES was designed. Building upon [11], studies [12,13,14] further developed MES models encompassing the electricity, heat, and gas subnetworks. Subsequently, energy flow models for electricity–heat–gas MESs, which consider the diversity of compressor operation modes [15] and nodal pressure-based DHN models [16], were proposed, further enriching MES modeling theories. However, due to the varying focuses, the aforementioned models are evidently not interchangeable. Additionally, the formulation of these models followed the traditional recursive approach, which is not conducive to efficient implementation in engineering applications. In response, matrix-based energy flow modeling methods for DHNs were explored in [17,18,19,20], providing insights for the practical modeling of MESs. Overall, achieving a matrix-based and concise expression of the MES energy flow model while ensuring accuracy and universality remains a critical challenge for further research.
The EFC in MESs can be divided into two categories based on solution formats: the decomposition format and the unified format. In the former, each subsystem is treated as a decoupled independent unit, and the model of each subnetwork is solved sequentially until the state variables at the decoupling points meet the convergence conditions of the iteration. Relying on the decomposition solution format, numerous solution algorithms, such as the Newton–Raphson (NR) method [21], holomorphic embedded method [22], graph method [22], and topological decomposition method [23], have been successfully applied to solve the EFC problem. In contrast, the unified format considers the components of MESs as a tightly coupled whole, avoiding the potential issues of insufficient computational accuracy or indivisibility that may arise in the decomposition format. The NR-based method is the primary solution technique under this format, with studies [9,15,24] providing typical cases of using it to assess the operating state of MESs. However, the NR-based method is sensitive to the selection of initial values, and improper initial values can lead to a singular Jacobian matrix, which, in turn, causes iteration divergence. Furthermore, as the coupling degree of the MES increases or the system scale expands, the solvable domain of the EFC problem shrinks, making it harder to generate appropriate initial guesses. To address these issues, an initial value guessing strategy for MESs was proposed in [25] from the perspective of the convergence theorem. In [26], a fast decoupled EFC solution algorithm was proposed, in which the Jacobian matrix was replaced with a diagonal constant matrix to enhance the convergence of the NR iteration. In [27], a damping technique was incorporated to regulate the iteration step size and convergence direction of the NR-based EFC solution process. Additionally, some studies applied data-driven methods to handle EFC in MESs [28,29]. Despite the satisfactory performance in case studies, these methods are constrained by the quality of sample data, which limits their solution stability and applicability. Therefore, the NR method is still the mainstream solution algorithm for EFC in MESs.
The above studies indicate that the development bottleneck of the NR-based EFC solution method lies in its fragile convergence. In MESs, the initial values for the DEN and DHN are typically set using a flat start approach [12], which is the most widely adopted method and yields satisfactory results. For the DGN, determining appropriate initial gas pressure values has always been a challenging task. To avoid singularity in the Jacobian matrix caused by the flat start approach, the most common method for gas pressure initialization is to set the balance node pressure as a reference value and apply a 5–10% pressure difference along the gas flow direction between the starting and ending points of the pipeline [8]. However, in most MES scenarios, the direction of gas flow in the DGN cannot be determined in advance, and when loops exist in the DGN topology, the gas flow direction becomes even more complex. Moreover, considering that the model scale of the DGN further increases when alternative gas injections are accounted for, the convergence of the NR method becomes even harder to guarantee.
In view of this, this paper aims to develop a matrix-based MES energy flow model with strong universality that is applicable to most scenarios. Unlike previous studies that primarily focus on enhancing EFC solution algorithms, this paper begins from the physical meaning inherent in the model itself and improves the parts of the MES model involving gas composition tracking, thereby expanding its solvable domain. The main contributions of this paper are as follows:
  • A matrix-based MES energy flow model is constructed, which considers the diversity of compressor operating modes and gas compositions in the DGN. In addition, the impact of the gas compressibility factor under non-ideal gas conditions on the MES operating state is also quantified.
  • To address the shortcomings of existing DGN models that consider alternative gas injections, a modified DGN model is proposed. This model fully incorporates the dynamic nature of gas flow direction during the NR iteration process, effectively expanding its solvable domain.
  • The Jacobian matrices for the proposed DHN model, DGN model, and modified DGN model are derived. These Jacobian matrices are also expressed in matrix form and align with the gradient descent direction, further improving the convergence performance of the proposed NR-based EFC method.
The rest of this paper is arranged as follows. Section 2 formulates the matrix-based energy flow model of the MES. Section 3 derives the Jacobian matrix with the gradient descent direction. Section 4 presents the details of the NR-based EFC solution process. Section 5 analyses the effectiveness of the proposed models through case studies. Finally, Section 6 concludes this paper.

2. Matrix-Based Model Formulation for MES

The overall structure of the MES is depicted in Figure 1. As can be seen, the DEN, DHN, and DGN, along with gas turbine generator (GTG), gas boiler (GB), heat pump (HP), electric boiler (EB), combined heat and power (CHP) unit, P2G unit, moto-compressor (MC), turbo-compressor (TC), and circulation pump (CP), are considered to constitute the complete MES. On this basis, the proposed matrix-based modeling approach is outlined as follows.

2.1. District Electricity Network

Herein, the traditional AC model is considered for the power flow calculation of the DEN. In this model, buses are divided into three types, i.e., PQ bus, PV bus, and θV bus. For bus i, its inflow and outflow active/reactive power should be conserved, which can be expressed as
P S , i P L , i V i j = 1 N e V i G i j cos θ i j + B i j sin θ i j = 0          i E PQ E PV Q S , i Q L , i V i j = 1 N e V i G i j sin θ i j B i j cos θ i j = 0          i E PQ
where PS,i/PL,i is the active source/load power of bus i; QS,i/QL,i is the reactive source/load power of bus i; |Vi| is the voltage magnitude of bus i; θij = θiθj is the voltage angle difference between bus i and bus j; Ne is the total bus number; Gij/Bij is the conductance/susceptance of branch ij; E PQ / E PV is the set of PQ/PV buses. As can be seen, Equation (1) is essentially a set of nonlinear algebraic equations (AEs), which is neither convenient for writing nor for programming implementation. Hence, the matrix form of the AC model is introduced:
P S P L Real V · Y V = 0 Q S Q L Imag V · Y V = 0
where PS, PL, QS, and QL are the vector forms of PS, PL, QS, and QL, respectively; V is the voltage vector; Y is the nodal admittance matrix; Real〈·〉/Imag〈·〉 denotes the real/imaginary part; and ‘·’/‘*’ indicates the Hadamard product operation/conjugate operation.

2.2. District Heating Network

A DHN is typically composed of two symmetrical networks, known as the supply network and the return network, as shown in Figure 2. Based on their connectivity in the network, DHN nodes are classified into three categories: (1) hTS nodes connected to slack heat sources; (2) ΦTS nodes connected to non-slack heat sources; (3) ΦTR nodes not connected to any heat sources. Referring to the classic recursive DHN model presented in [11], this subsection derives a matrix-based formulation to quantify the hydraulic and thermal distribution throughout the DHN.

2.2.1. Hydraulic Model

Analogous to Kirchhoff’s current and voltage laws, the sum of the mass flow passing through a DHN node and the sum of pressure drops along a closed loop within the DHN should both be zero. On this basis, the hydraulic model of the supply network can be written in matrix form:
A h m m q = 0 B h K h · m · m = 0
where Ah is the node–branch incidence matrix; m and mq are the pipeline mass flow vector and the nodal mass flow vector, respectively; Bh is the loop-branch incidence matrix; and Kh is the pipeline resistance coefficient vector. Due to their symmetry, the supply and return networks share the same mass flow values but with opposite signs.

2.2.2. Thermal Model

The hydraulic model depicts the distribution of the transmission medium, while the thermal model focuses on the thermal energy exchange. The transferred heat power and the transmission medium temperature are linked via
Φ n = C p m q · T n S T sp R Φ s = C p m q · T sp S T s R
where Φn/Φs is the consumed heat power vector of non-source/source nodes; Cp is the specific heat capacity of water; the superscript S/R denotes the supply/return network; T n S / T s R is the outflow temperature vector of non-source/source nodes; and T s p S / T s p R is the specified inflow temperature vector of supply/return nodes.
Due to the existence of heat loss, the transmission medium temperature decreases exponentially along the mass flow direction within the pipeline:
T out , k P = T in , k P T a , k e λ h , k L h , k C p m k 1 + T a , k T out , k P = T in , k P e λ h , k L h , k C p m k 1             k pipe
where T o u t , k P / T i n , k P is the outlet/inlet temperature of pipeline k; Ta,k, λh,k, Lh,k, and mk are the ambient temperature, heat transfer coefficient, length, and mass flow of pipeline k, respectively; and pipe is a set of heat pipelines. In Equation (5), we use T o u t , k P and T i n , k P to substitute T o u t , k P Ta,k and T i n , k P Ta,k for brevity. For the pipeline k where the mass flow leaves at node i and enters at node j, its outlet temperature corresponds to the inflow temperature of node i, and its inlet temperature is equal to the outflow temperature of node j. Thus, Equation (5) can be reformulated as
T in , i , k N = T out , j N e λ h , k L h , k C p m k 1             k pipe
where T in , i , k N / T o u t , j N is the inflow/outflow temperature of node i/j. In this way, the temperature profile of the DHN can be characterized solely by the node temperature. By introducing the directional node–branch incidence matrix Ahd, as defined in Equation (7), the relationship between each node temperature can be represented in a compact matrix form, as shown in Equation (8).
A hd = A h S h S h = diag m · m 1
T in N = R 1 ± A hd ¯ T T out N R 1 = diag e λ h · L h · C p m 1
where Sh is the directional factor vector of heat pipelines; −Ahd/+Ahd is applied for the supply/return network; diag(·) denotes the diagonal matrix transformation; and ‘ · ¯ ’ represents a newly defined matrix operator that sets all negative elements of the matrix to zero. For instance, when applied to ±Ahd, ‘ · ¯ ’ is defined as−
A hd ¯ = A hd + A hd 2 A hd ¯ = A hd + A hd 2
When mass flows with different temperatures mix at node i, the mixture temperature equation is adopted to calculate the nodal outflow temperature:
l out , i m out , l T out , i N = k in , i m in , k T in , i , k N             i node
where mout/min is the mass flow leaving/entering a node; and node / out , i / in , i is the set of DHN nodes/pipelines with node i as the inlet/pipeline and node i as the outlet. By substituting Equation (8) into the matrix form of Equation (10), T i n N can be eliminated, thereby expressing the thermal process of the DHN merely through T out N . Before rewriting Equation (10), a set of multipliers, D 1 S ~ D 3 S and D 1 R ~ D 3 R , is first defined for simplicity:
D 1 S = diag A hd ¯ m D 1 R = diag A hd ¯ m D 2 S = diag m q D 2 R = diag m q D 3 S = A hd ¯ diag m R 1 A hd ¯ T D 3 R = A hd ¯ diag m R 1 A hd ¯ T
Considering that the mass flow of non-source nodes may either leave into pipelines or loads and can solely enter from pipelines in the supply network, the nodal temperature equation for supply non-source nodes is derived as Equation (12), where D 1 , n n S , D 2 , n n S , and D 3 , n S denote the weighted mass flow leaving into pipelines, leaving into loads, and entering from pipelines, respectively:
D 1 , nn S + D 2 , nn S T n S = D 3 , n S T S = D 3 , ns S D 3 , nn S T s S T n S T
where T S refers to the outflow temperature vector of supply nodes. The single subscript ‘n’ indicates that the matrix consists of rows corresponding to non-source nodes, while the double subscript ‘nn’ means the matrix comprises both rows and columns corresponding to non-source nodes. The rest of the subscripts, ‘s’/‘ns’/‘ss’/‘sn’, can be interpreted in the same manner. Likewise, the mass flow of supply source nodes can only leave into pipelines, and may either enter from pipelines or sources. Thereby, Equation (10), for the supply source nodes, is represented as
D 1 , ss S T s S = D 2 , ss S T sp S + D 3 , s S T S = D 2 , ss S T sp S + D 3 , ss S D 3 , sn S T s S T n S T
By combining Equations (12) and (13), the matrix-based nodal temperature equation for the entire supply network can be written as
D 1 , nn S + D 2 , nn S D 3 , nn S T n S = D 3 , ns S T s S D 1 , ss S D 3 , ss S T s S = D 2 , ss S T sp S + D 3 , sn S T n S
It is worthwhile noting that, unlike existing models [17,18,19,20], the outflow supply temperature of source nodes is no longer predefined. Instead, it is calculated based on the real-time mass flow direction, thereby enhancing the reliability of the proposed DHN model.
Furthermore, the nodal temperature equations for return non-source and source nodes can be described as Equations (15) and (16), respectively:
D 1 , nn R T n R = D 2 , nn R T sp R + D 3 , n R T R = D 2 , nn R T sp R + D 3 , ns R D 3 , nn R T s R T n R T
D 1 , ss R D 2 , ss R T s R = D 3 , s R T R = D 3 , ss R D 3 , sn R T s R T n R T
where T R denotes the outflow temperature vector of return nodes. Similarly, the nodal temperature equation for the entire return network is expressed as
D 1 , nn R D 4 , nn R T n R = D 2 , nn R T sp R + D 3 , ns R T s R D 1 , ss R D 2 , ss R D 3 , ss R T s R = D 3 , sn R T n R
Finally, the proposed matrix formulation of the thermal model consists of Equations (4), (14) and (17).

2.3. District Gas Network

Several common components are all considered to constitute the DGN, including natural gas and alternative gas sources, loads, pipelines, and compressors. In addition, two types of DGN nodes are then classified: π nodes with a given pressure and f nodes with a given injection. The operating conditions of the DGN are highly complex, particularly due to the diversity of compressor operating modes and gas source compositions, leading to the limited universality of existing DGN models. To address this, a universal matrix model for the DGN is first presented, building upon existing recursive models. Subsequently, the proposed model is refined by incorporating the variability of gas flow direction, thus enhancing its applicability.

2.3.1. Matrix-Based Universal DGN Model

Prior to the derivation of the mathematical model, several assumptions for the steady-state gas flow calculation are made as the foundational basis of this work [30]: (1) no storage effect, leakage, or any form of energy loss exists during gas transmission; (2) the pipeline is fully rough, and the friction factor remains constant throughout the pipeline; (3) a perfect mixture is assumed after the alternative gas source is injected; (4) gas volume flow rates mentioned are measured under standard temperature and pressure (STP) conditions.
According to Bernoulli’s equation, the gas flow within the pipeline can be generalized in matrix form as Equation (18), whose detailed parameters are defined by Equation (19):
f P = S g K P · 1 Π s Π e 1 χ
S g = diag Π s Π e · Π s Π e 1 K P = diag M P · Z P A gd ¯ ρ μ M P = C P T g φ P · L P · D P κ A gd = A g S g
where fP is the gas pipeline flow vector; Sg is the directional factor vector of gas pipelines; KP is the pipeline coefficient vector; Πs/Πe is the squared pressure vector of the start/end node; MP represents the constant part in KP; ZP is the pipeline compressibility factor vector; ρ is the specific gravity vector; φP/LP/DP is the friction factor/length/diameter vector of the pipeline; Cp/Tg/χ/κ/μ is the constant parameter/gas temperature/flow exponent/diameter exponent/specific gravity exponent; Ag is the node–pipeline incidence matrix of the DGN; and Agd is the directional node–pipeline incidence matrix.
Compressors are installed to regulate the pressure level of the DGN. The adiabatic horsepower HC of the compressor can be calculated by
H C = B C · f C · π o · π i 1 θ C 1 B C = C C P st T st T g , in 1 Z C , in · θ C 1 θ C = ω 1 · ω 1
where BC/fC/θC is the power coefficient/compressor gas flow/compression exponent vector of the compressor; πi/πo is the inlet/outlet pressure vector of the compressor; CC is the compressor characteristic constant; Pst/Tst is the standard temperature/pressure; Tg,in is the gas temperature at the compressor inlet; ZC,in is the gas compressibility factor vector at the compressor inlet; and ω is the gas polytropic coefficient vector. Once the compressor is driven by the gas turbine, the consumed gas flow τC that can be extracted from any gas node is given by
τ C = τ C , st · q C = 1 α C + β C · H C + γ C · H C 2 · q C 1
where τC,st is the equivalent energy consumption vector of the extracted gas under standard gross calorific value (GCV); qC is the GCV vector at the extraction node; and αC, βC, and γC are the efficiency coefficient vectors.
Since the sum of the gas volume flow at each node is zero, the nodal volume flow balance equation of the DGN is expressed as
A g f P + B g f E + f L + T C τ C = 0
where Bg = [ B g S   B g C ] is the node–equipment incidence matrix; B g S and B g C are the node–slack source incidence matrix and the node-compressor incidence matrix, respectively; fE = [fS; fC] is the equipment gas flow vector; fS is the slack source flow vector; fL = fDfI is the net load flow vector; fD = ED·q−1 is the load volume demand vector; ED and q are the load energy demand vector and the nodal GCV vector, respectively; fI is the non-slack source flow vector; and TC is the node-extraction incidence matrix.
In this paper, five compressor modes are considered: (1) Mode I: the squared boost ratio R C 0 is specified; (2) Mode II: the boost squared difference D C 0 is specified; (3) Mode III: the compressor flow rate f C 0 is specified; (4) Mode IV: the squared inlet pressure Π I 0 is specified; (5) Mode V: the squared outlet pressure Π O 0 is specified. To accommodate the diverse operating conditions of the compressor, the equipment control equation is formulated. For the k-th equipment, its control expression can be written as
w N , k s Π s + w N , k i Π i + w N , k o Π o + w E , k f E , k = d k             k G equ
where k/s/i/o is the index of the equipment/slack source node/compressor inlet node/compressor outlet node; wN,ks/wN,ki/wN,ko/wE,k/dk is the control parameter of slack source node pressure/compressor inlet node pressure/compressor outlet node pressure/equipment flow/compressor, whose value for different equipment is shown in Table 1; Πs/Πi/Πo is the squared pressure of slack source node s/compressor inlet node i/compressor outlet node o; fE,k is the gas flow of the k-th equipment; and G equ is the equipment set of the DGN. Equation (23) can be rewritten into matrix form as
W N Π + W E f E d = 0
where the nonzero element in the k-th row and s-th/i-th/o-th column of WN is wN,ks/wN,k/wN,ko; WE is the diagonal matrix of wE,k; and d is the vector of dk.
According to the aforementioned assumptions of the steady-state gas flow, the injection of heterogeneous gas sources will significantly alter the gas composition within the DGN, primarily affecting gas density and GCV. Hence, referring to the existing DGN models [27,31], the deviation equations that follow the nodal mass and energy conservation laws are constructed to track the gas quality across the network:
ρ i out f D , i + j G C tap , i τ C , j + k G C out , i f C , k out + l G P out , i f P , l out ρ S , i f S , i l G type ρ l f I , i l m G C in , i ρ i , m in f C , m in n G P in , i ρ i , n in f P , n in = 0 q i out f D , i + j G C tap , i τ C , j + k G C out , i f C , k out + l G P out , i f P , l out q S , i f S , i l G type q l f I , i l m G C in , i q i , m in f C , m in n G P in , i q i , n in f P , n in = 0        i G node
where G C t a p , i / G C i n , i / G C o u t , i is the set of compressors extracting from/entering/leaving node i; G type is the set of gas source types; G P i n , i / G P o u t , i is the set of pipelines entering/leaving node i; G node is the set of DGN nodes; f C i n / f C o u t is the compressor flow entering/leaving node i; f P i n / f P o u t is the pipeline flow entering/leaving node i; ρin/ρout is the specific gravity of gas entering/leaving node i; qin/qout is the GCV of gas entering/leaving node i; ρS/qS is the specific gravity/GCV of gas injected at node i; ρ/q is the gas specific gravity/GCV of type ; fS is the known pressure source flow at node i; and f I is the known injection source flow of type at node i. Note that Equation (25) is formulated recursively, where the gas flow direction plays a crucial role. Therefore, drawing on the strategy we employed in the DHN model formulation, the matrix representation of the gas composition tracking equations can be constructed through the incidence matrices as
diag ρ f D + T C τ C + B g C ¯ f C + A gd ¯ f P + B g S diag ρ S f S l G type B g l f I l ρ l B g C ¯ diag f C B g C ¯ T ρ A gd ¯ diag f P A gd ¯ T ρ = 0 diag q f D + T C τ C + B g C ¯ f C + A gd ¯ f P + B g S diag q S f S l G type B g l f I l q l B g C ¯ diag f C B g C ¯ T q A gd ¯ diag f P A gd ¯ T q = 0
where ρS/qS is the specific gravity/GCV vector of injected gas at π nodes; B g is the node-non-slack source type incidence matrix; and f I is the non-slack source flow vector of type . Specifically, ρ, q, and other gas property variables represent the characteristics of outflowing gas from DGN nodes.
The above is the current mainstream DGN model considering alternative gas injection, where the gas is assumed to obey the ideal gas law. However, as the gas pressure level increases, the EFC deviation caused by this assumption becomes more pronounced. To simulate the MES more accurately, the real gas Equation of State (EoS) is applied to characterize the gas properties, with the gas compressibility factor treated as a variable rather than a constant. The molar fraction of each gas source type is a key parameter to calculate the compressibility factor of the mixture. Based on Equation (26), the nodal molar fraction for gas type is derived as
ε l = B g l f I l B g S diag ε S l f S diag f D + T C τ C + B g C ¯ f C + A gd ¯ f P B g C ¯ diag f C B g C ¯ T A gd ¯ diag f P A gd ¯ T
where ε is the nodal molar fraction vector of gas type ; and ε S is the molar fraction vector of gas type at known pressure sources. The function between ρS/qS and ε S is given by
ρ S = l G type ε S l ρ l q S = l G type ε S l q l
Virial-type models are primary methods for calculating the compressibility factor of the gas mixture. In this paper, the empirical model of the American Gas Association (AGA) [32] is employed to update ZP. The matrix formulation of the AGA model is given by
Z P = 1 + 0 . 257 0 . 533 T st A gd ¯ T 1 T cr · A gd ¯ T P cr 1 · π ˜ π ˜ = 2 3 π s + π e π s · π e · π s + π e 1
where π ~ is the average pressure vector of the pipeline, and Tcr/Pcr is the critical temperature/pressure vector of the mixture, with its value estimated by Kay’s mixing rule:
υ = l G type ε l υ l
where υ is the vector of the specific property of the mixture, and υ is the specific property of gas type . As for the compressor equations, ZC,in and ω also need to be revised according to
Z C , in = 1 + 0 . 257 0 . 533 T st B g C ¯ T 1 T cr · B g C ¯ T P cr 1 · π i ω = ω cp · ω cv 1
where ωcp/ωcv is the specific heat capacity vector at constant pressure/volume, whose value is also calculated via Equation (30). So far, the matrix-based universal DGN model is preliminarily established.

2.3.2. Modified DGN Model Considering Dynamic Flow Direction

In NR-based EFC methods, the gas flow directions are highly uncertain during the EFC iteration process. This presents a challenge to the robustness of DGN modeling, specifically whether the DGN model can accurately represent the energy flow distribution of the gas network across all possible flow directions. Upon re-examining the matrix-based universal DGN model, it is evident that the nodal volume flow balance equations and equipment control equations hold for dynamic flow directions. However, things become more complicated when it comes to the gas composition tracking equations.
As shown in Figure 3, the positive direction of different types of gas flows in traditional models is predefined. Specifically, the positive direction of known pressure source flow fS, known injection source flow fI, compressor flow fC, or pipeline flow fP can be defined as inflow into a node, while the positive direction of load flow fD, compressor consumption flow τC, compressor flow fC, or pipeline flow fP can be defined as outflow from a node. It is evident that during the iteration process, both the magnitude and direction of these gas flows are variable, and the nodal inflow–outflow balance has not been established. In such cases, the physical meaning of the gas tracking equations becomes difficult to guarantee.
Taking the two extreme cases shown in Figure 4 as examples, node ‘a’ has only inflow and no outflow, while node ‘b’ has only outflow and no inflow. To address this issue, the deviation flow, denoted as ΔfL, is introduced. This strategy can partially ensure the physical meaning of the gas tracking equations and avoid the Jacobian matrix or molar fraction calculation matrix becoming singular in extreme cases. However, it still cannot handle the special situation depicted in Figure 5. Since the positive direction of the compressor is artificially predetermined in traditional models, the density tracking equation at node ‘a’ in Figure 5 is written as −ρj f P , a j i n ρsp,aΔ f L , a i n ρi f C , i a i n = 0 according to Equation (26). Due to the absence of outflow gas, the equation clearly becomes meaningless. In fact, not only the compressor flow, but also the load flow, known pressure source flow, and compressor consumption flow are variables, and as such, all of them have the potential for reverse flow. To this end, direction factors S g C , S g S , and S g τ are designed to track the gas flow direction in real-time within the DGN. Ultimately, Equations (25) and (26) are rewritten as
ρ i out Δ f L , i out + f D , i out + f S , i out + j G C tap , i τ C , j out + k G C out , i f C , k out + l G P out , i f P , l out ρ S , i f S , i in l G type ρ l f I , i l m G C in , i ρ i , m in f C , m in n G P in , i ρ i , n in f P , n in j G C tap , i ρ sp , i τ C , j in ρ sp , i Δ f L , i in + f D , i in = 0 q i out Δ f L , i out + f D , i out + f S , i out + j G C tap , i τ C , j out + k G C out , i f C , k out + l G P out , i f P , l out q S , i f S , i in l G type q l f I , i l m G C in , i q i , m in f C , m in n G P in , i q i , n in f P , n in j G C tap , i q sp , i τ C , j in q sp , i Δ f L , i in + f D , i in = 0
diag ρ f D ¯ + T Cd ¯ τ C + B gd C ¯ f C + B gd S ¯ f S + A gd ¯ f P + Δ f L ¯ B gd S ¯ diag ρ S f S l G type B g l f I l ρ l B gd C ¯ diag f C B gd C ¯ T ρ A gd ¯ diag f P A gd ¯ T ρ T Cd ¯ τ C + Δ f L ¯ + f D ¯ ρ sp = 0 diag q f D ¯ + T Cd ¯ τ C + B gd C ¯ f C + B gd S ¯ f S + A gd ¯ f P + Δ f L ¯ B gd S ¯ diag q S f S l G type B g l f I l q l B gd C ¯ diag f C B gd C ¯ T q A gd ¯ diag f P A gd ¯ T q T Cd ¯ τ C + Δ f L ¯ + f D ¯ q sp = 0
where Δ f L in / f D in / f S in / τ C in is deviation/load/known pressure source/compressor consumption flow entering node i; Δ f L out / f D out / f S out / τ C out is deviation/load/known pressure source/compressor consumption flow leaving node i; and ρsp/qsp is the specified specific gravity/GCV of deviation/load/compressor consumption flow entering node i. The matrix expressions of deviation flow and direction factors are as follows:
Δ f L = A g f P + B g f E + f L + T C τ C
S g C = diag f C · f C 1 B gd C = B g C S g C S g S = diag f S · f S 1 B gd S = B g S S g S S g τ = diag τ C · τ C 1 T Cd = T C S g τ
In addition, the nodal molar fraction equation is accordingly adjusted to
ε l = B g l f I l + B gd S ¯ diag ε S l f S + T Cd ¯ τ C + Δ f L ¯ + f D ¯ ε sp l diag f D ¯ + T Cd ¯ τ C + B gd C ¯ f C + B gd S ¯ f S + A gd ¯ f P + Δ f L ¯ B gd C ¯ diag f C B gd C ¯ T A gd ¯ diag f P A gd ¯ T l G type
where ε s p is the specified molar fraction vector of gas type for deviation/load/compressor consumption flow entering the node.

2.4. Coupling Device Formulation

Two typical CHP units (CHPI with back-pressure turbine and CHPII with extraction-condensing turbine) are considered, whose mathematical models are given by
z CHPI = Φ CHPI / P CHPI f CHPI = 3600 P CHPI / η CHPI q gas
z CHPII = Φ CHPII / η CHPII f CHPII q gas / 3600 P CHPII
where zCHPI/zCHPII is the control parameter of CHPI/CHPII; Φx/Px/fx/ηx is the heat power/electrical power/gas consumption/conversion efficiency of device x; and qgas is the GCV of the consumed gas.
The linear models of GTG, GB and HP/EB are adopted, which are written as
f GTG = 3600 P GTG / η GTG q gas
f GB = 3600 Φ GB / η GB q gas
Φ HP / EB = P HP / EB η HP / EB
P2G is assumed to produce SNG through electrolysis and catalysis, and its operating formula is given by
f P 2 G = 3600 η P 2 G P P 2 G / q SNG
where fP2G is the injected flow rate of SNG; PP2G is the consumed power of P2G; and qSNG is the GCV of SNG.
The energy conversion model of MC and CP is written as
P C = 745.7 H C / 3600 × 10 6 P CP = m CP g h CP / η CP × 10 6
where PC/PCP is the driving power of MC/CP; mcp is the mass flow through CP; g is the gravitational acceleration; and hcp is the pump head.

3. Jacobian Matrix Derivation for MES

The Jacobian matrix is not only a crucial part of the NR-based EFC method, but also serves to characterize the interrelationships between state variables within the MES. In this section, the Jacobian matrices with gradient descent direction are formulated for each subnetwork of the MES.

3.1. Jacobian Matrix for DEN

The state variable of the DEN is defined as xe = [θ; |V|], where θ/|V| is the voltage angle/magnitude vector, and the mismatch vector of the DEN Fe is expressed as
F e = Δ P = P S P L Real V · Y V Δ Q = Q S Q L Imag V · Y V
where ΔPQ is the mismatch vector of nodal active/reactive power. The Jacobian matrix of the DEN Jee equals the partial derivatives of Fe with respect to xe:
J ee = Δ P θ Δ P V Δ Q θ Δ Q V
Note that each submatrix in Jee can be formulated in matrix form. The detailed formulation of Jee can be referenced in [7].

3.2. Jacobian Matrix for DHN

Referring to [11], the state variable of the DHN is set as xh = [m; T n S ; T n R ]. Based on the proposed matrix-based DHN model, the mismatch vector of the DHN Fh is obtained via
F h = Δ Φ n = C p A h , n m T n S T sp R Φ n Δ Φ s = C p A h , s m T sp S T s R Φ s Δ h f = B h K h m m Δ T n S = D 1 , nn S + D 2 , nn S D 3 , nn S T n S D 3 , ns S T s S Δ T n R = D 1 , nn R D 2 , nn R T n R D 2 , nn R T sp R D 3 , ns R T s R
It is worthwhile noting that hTs nodes are excluded from ΔΦs; if the DHN topology is radial, Δhf ought to be omitted. Similarly, the Jacobian matrix of the DHN Jhh is given by the partial derivatives of Fh with respect to xh:
J hh = Δ Φ , h f m Δ Φ , h f T n S 0 Δ T n S m Δ T n S T n S 0 Δ T n R m 0 Δ T n R T n R
The matrix-based formulations for submatrices in the first row of Jhh follow [11]. ∂Δ T n S /∂ T n S and ∂Δ T n R /∂ T n R are commonly computed via a flow chart or formulated recursively in existing DHN models. Instead of employing these inefficient methodologies, the matrix form of the two partial derivatives can be directly derived from the proposed thermal model as follows:
Δ T n S T n S = D 1 , nn S + D 2 , nn S D 3 , nn S Δ T n R T n R = D 1 , nn R D 2 , nn R
As for ∂Δ T n S /∂m and ∂Δ T n R /∂m, most existing models adopt a practical and convenient approach, which approximates them as zero [11]. However, studies have shown that this approximation can compromise the convergence of the EFC [33]. Hence, to achieve the complete Jacobian matrix of the DHN with gradient descent direction, ∂Δ T n S /∂m and ∂Δ T n R /∂m are derived in matrix form as
Δ T n S m = diag T n S A hd , n ¯ A hd , n ¯ diag A hd ¯ T T S R 2 S h Δ T n R m = diag T n R A hd , n ¯ A hd , n ¯ diag A hd ¯ T T R R 2 diag T sp R A hd , n S h R 2 = diag 1 + λ h · L h · C p m 1 · e λ h · L h · C p m 1

3.3. Jacobian Matrix for DGN

3.3.1. Traditional Matrix-Based DGN Model

Let the state variable vector of the DHN be xg = [Π; fE; ρ; q], and the mismatch vector for the traditional DGN model Fg is given by
F g = Δ f L = A g f P + B g f E + f L + T C τ C Δ d = W N Π + W E f E d Δ ρ = diag ρ f D + T C τ C + B g C ¯ f C + A gd ¯ f P + B g S diag ρ S f S             l G type B g l f I l ρ l B g C ¯ diag f C B g C ¯ T ρ A gd ¯ diag f P A gd ¯ T ρ Δ q = diag q f D + T C τ C + B g C ¯ f C + A gd ¯ f P + B g S diag q S f S            l G type B g l f I l q l B g C ¯ diag f C B g C ¯ T q A gd ¯ diag f P A gd ¯ T q
Then, the Jacobian matrix of the traditional DGN model Jgg can be expressed as
J gg = Δ f L Π Δ f L f E Δ f L ρ Δ f L q Δ d Π Δ d f E 0 0 Δ ρ Π Δ ρ f E Δ ρ ρ Δ ρ q Δ q Π Δ q f E Δ q ρ Δ q q = J 11 J 12 J 13 J 14 J 21 J 22 0 0 J 31 J 32 J 33 J 34 J 41 J 42 J 43 J 44
Similar to Jhh, a few elements in Jgg are also neglected for simplicity [27], causing the convergence of NR-based EFC methods to deteriorate. To tackle this issue, each part of Jgg is derived in matrix form as follows:
J 11 = Ω + T C Y Ω = A g Γ A g T Γ = χ 1 diag f P · Π s Π e 1 Y = diag τ C , st Π i · q C 1 B g C ¯ T + diag τ C , st Π o · q C 1 B g C ¯ T τ C , st Π i = B C · 2 f C · 2 θ C · π o · π i 1 θ C 2 Π i · β C · B C · 1 f C + 1 2 γ C · π o · π i 1 θ C 2 γ C τ C , st Π o = B C · 2 f C · 2 θ C · π o · π i 1 θ C 2 Π o · β C · B C · 1 f C + 1 2 γ C · π o · π i 1 θ C 2 γ C
J 12 = B g S B g C + T C Ξ Ξ = diag τ C , st f C · q C 1 τ C , st f C = β C · B C · π o · π i 1 θ C 1 + 2 γ C · B C · 2 f C · π o · π i 1 θ C 1 2
J 13 = μ χ 1 A g diag f P A gd ¯ T diag ρ 1
J 14 = diag q 1 · f D diag q 2 · T C τ C , st
J 21 = W N
J 22 = W E
J 31 = A gd ¯ diag A gd ¯ T ρ diag ρ A gd ¯ Γ A gd + T diag ρ T C Y
J 32 = B g S diag ρ S B g C diag B g C ¯ T ρ + diag ρ T C Ξ
J 33 = μ χ 1 A g diag f P A gd ¯ T + B g C diag f C B g C ¯ T + diag f D + T C diag τ C T C T
J 34 = diag ρ · q 1 · f D diag ρ · q 2 · T C τ C , st
J 41 = A gd ¯ diag A gd ¯ T q Γ A gd T diag q A gd ¯ Γ A gd + T diag q T C Y
J 41 = A gd ¯ diag A gd ¯ T q diag q A gd ¯ Γ A gd + T diag q T C Y
J 42 = B g S diag q S B g S B g C diag B g C ¯ T q + diag q T C Ξ
J 43 = μ χ 1 A g diag f P A gd ¯ T diag q · ρ 1
J 44 = diag A gd ¯ f P A gd ¯ diag f P A gd ¯ T + B g C diag f C B g C ¯ T

3.3.2. Modified Matrix-Based DGN Model

F g 2 = Δ f L = A g f P + B g f E + f L + T C τ C Δ d = W N Π + W E f E d Δ ρ = diag ρ f D ¯ + T Cd ¯ τ C + B gd C ¯ f C + B gd S ¯ f S + A gd ¯ f P + Δ f L ¯            B gd S ¯ diag ρ S f S l G type B g l f I l ρ l B gd C ¯ diag f C B gd C ¯ T ρ            A gd ¯ diag f P A gd ¯ T ρ T Cd ¯ τ C + Δ f L ¯ + f D ¯ ρ sp Δ q = diag q f D ¯ + T Cd ¯ τ C + B gd C ¯ f C + B gd S ¯ f S + A gd ¯ f P + Δ f L ¯            B gd S ¯ diag q S f S l G type B g l f I l q l B gd C ¯ diag f C B gd C ¯ T q            A gd ¯ diag f P A gd ¯ T q T Cd ¯ τ C + Δ f L ¯ + f D ¯ q sp
For the modified DGN model, its mismatch vector Fg is accordingly revised as
In addition, the Jacobian matrix for the modified DGN model Jgg is also derived, which is identical to Jgg except for the following elements:
J 31 = A gd ¯ diag A gd ¯ T ρ diag ρ A gd ¯ R ρ A gd Γ A gd T            + diag ρ T Cd ¯ + diag ρ sp T Cd ¯ R ρ T Cd Y R ρ = diag Δ f L ¯ · ρ + Δ f L ¯ · ρ sp · Δ f L 1
J 32 = diag ρ B gd S ¯ B gd S ¯ diag ρ S + R ρ B g S B g C diag B gd C ¯ T ρ R ρ B g C + diag ρ T Cd ¯ + diag ρ sp T Cd ¯ R ρ T Cd Ξ T
J 33 = μ χ 1 A g diag f P A gd ¯ T E + R ρ diag ρ 1 + B g C diag f C B gd C ¯ T            + diag f D ¯ + Δ f L ¯ + T Cd ¯ diag τ C T Cd ¯ T B gd S ¯ diag f S B gd S ¯ T
J 34 = diag R ρ q 2 · T Cd τ C , st + q · f D ρ · q 2 · T Cd ¯ τ C , st + q · f D ¯ ρ sp · q 2 · T Cd ¯ τ C , st q · f D ¯
J 41 = A gd ¯ diag A gd ¯ T q diag q A gd ¯ R q A gd Γ A gd T            + diag q T Cd ¯ + diag q sp T Cd ¯ R q T Cd Y R q = diag Δ f L ¯ · q + Δ f L ¯ · q sp · Δ f L 1
J 42 = diag q B gd S ¯ B gd S ¯ diag q S + R q B g S B g C diag B gd C ¯ T q R q B g C + diag q T Cd ¯ + diag q sp T Cd ¯ R q T Cd Ξ T
J 43 = μ χ 1 A g diag f P A gd ¯ T diag q · ρ 1 R q ρ 1
J 44 = diag A gd ¯ f P B gd S ¯ f S + Δ f L ¯ + R q q 2 · q · f D ¯ + T Cd τ C , st q sp · q 2 · T Cd ¯ τ C , st q · f D ¯            A gd ¯ diag f P A gd ¯ T + B g C diag f C B gd C ¯ T
where E denotes the identity matrix.
So far, the Jacobian matrix for the MES has been formulated and strictly adheres to the gradient descent direction, which can be directly used in the NR-based EFC iteration.

4. NR-Based Solution Strategy for EFC

The essence of the steady-state EFC problem is to solve a high-dimensional nonlinear system of equations. Therefore, the NR-based method becomes one of the most widely used EFC solution strategies. Herein, all subnetworks in the MES are considered as a whole, and the unified EFC solution strategy is adopted. The basic iteration format of the NR method for the whole MES is written as
x k + 1 = x k J k 1 F k
where x = [xe; xh; xg] is the unknown variable vector of MES; k is the iteration time; F = [Fe; Fh; Fg] is the mismatch vector of MES; and J is the Jacobian matrix of MES, which is formulated as
J = J ee J eh J eg J he J hh J hg J ge J gh J gg = F e x e F e x h F e x g F h x e F h x h F h x g F g x e F g x h F g x g
According to Section 2 and Section 3, the node types, state variables x, model formulations, and mismatch equations F for the whole MES are summarized in Table 2 in detail. The size of J depends on the number of unknown variables, which is (Ne + Npq − 1) + (Nhp + 2Nhn) + (3Ng + Nge) in this paper (Npq/Nhp/Nhn/Ng/Nge is the number of PQ bus/heat pipeline/heat non-source node/gas node/gas equipment). The formulation of main diagonal elements in J, i.e., Jee, Jhh, and Jgg, has been derived in Section 3. The remaining elements in J, i.e., Jxy, denote the effect of subnetwork ‘y’ on subnetwork ‘x’, whose construction method can be found in [12,34].
The flow chart of the NR-based unified EFC solution strategy is shown in Figure 6, and the main steps are as follows:
  • Step 1: Input the basic parameters, including the MES data, convergence tolerance ζ, and maximum iteration number K.
  • Step 2: Initialize the unknown variables, i.e., θ, |V|, m, T n S , T n R , Π, fE, ρ, and q. Specifically, flat initialization is applied to all unknown variables except for Π; θ and |V| are initialized to 1 p.u. and 0°, respectively; T n S and T n R are set to T s p S and T s p R , respectively; m and fE are valued as the design flow of typical pipelines; ρ and q are set to the specific gravity and GCV of natural gas.
  • Step 3: Calculate the mismatch vector F according to the formulations in Table 2; calculate the Jacobian matrix J and update the unknown variables x according to Equation (77) and Equation (76), respectively; update the intermediate variables according to the proposed MES model in Table 2.
  • Step 4: If the maximum absolute value of F is less than ζ, or if the iteration number exceeds K, proceed to Step 5; otherwise, go to Step 3.
  • Step 5: Output the steady-state energy flow results of the MES.

5. Case Studies

To validate the effectiveness of the proposed model, the test system, consisting of a 14-node gas network [35], Barry Island heating network [11], and IEEE 30-bus system [36], is established, as shown in Figure 7. The CHP, GB, and natural gas well serve as the balancing nodes of the corresponding subnetworks. More detailed parameters of the test system can be found in [37]. Hydrogen storage, SNG storage, and P2G constitute the alternative gas sources, and the properties of heterogeneous gas sources are listed in Table 3. In addition, the gas temperature is set to 288.15 K, and STP is defined as 1.01325 bar and 293.15 K. For the test system, the initial values of m and fE are specified as 100 kg/s and 2.5 MSCMD, respectively; T s p S and T s p R are valued as 100 °C and 30 °C, respectively; the convergence and iteration tolerances are set to 10−8 and 200 times, respectively. All simulations are solved by MATLAB 2023a on a laptop with an Intel (R) Core (TM) i9-13900H CPU @2.60 GHz and 16.0 GB of memory.

5.1. Correctness Analysis

The correctness of the proposed matrix MES model and Jacobian matrix is first verified. Three types of models are considered in this part: (1) Model I (benchmark model): the traditional MES model with the DHN model of [11] and the DGN model of [27]; (2) Model II: the proposed matrix-based MES model with the universal DGN model; (3) Model III: the proposed matrix-based MES model with the modified DGN model. It should be noted that, in Models I-III, the DEN models are the same, and the gas is assumed to behave ideally.
The absolute EFC errors between Model I and Model II/III on the test system are given in Table 4, and the typical iteration process of Models I-III is shown in Figure 8a. It can be found that the maximum absolute errors of Model II and Model III from the benchmark model are 4.01 × 10−9 MJ/m3 and 3.95 × 10−9 MJ/m3, respectively, demonstrating the accuracy of the proposed matrix model. In addition, Model II and Model III converge in 18 and 17 steps, respectively, while it takes Model I 40 steps to meet the accuracy criterion. Thus, the proposed Jacobian matrix offers a faster convergence rate owing to its gradient descent direction. Additionally, it can also be found that the convergence processes of Model II and Model III are similar, which means that the proposed modification strategy does not affect the convergence speed of the matrix-based models.
With the accurate basic model, the validity of Model II/III is further discussed considering the volatility of the gas compressibility factor Z. The iteration process of Model II/III with variable Z is depicted in Figure 8b. It can be seen that the proposed models can still converge at a faster speed when the updating of Z is added during the EFC iteration process. Figure 9 displays the EFC results of the DGN characterized by Model I and Model II/III with variable Z. Obviously, the EFC results of Model II and Model III are consistent, while Model I has a more pronounced difference. This is because the energy flow distribution of the DGN has changed after accounting for the varying Z. Specifically, Model I and Model II/III have the same load energy demand, and their GCVs across the DGN are also similar, resulting in comparable gas flow between Model I and Model II/III. The calculated true Z values in Model II/III are generally greater than the given value of 0.8 in Model I. According to the pipeline function Equation (18), for a constant flow rate, a larger Z value leads to a greater pressure drop in the pipeline, which explains why the gas pressure in Model II/III is lower in Figure 9a Table 5 further illustrates the output of the coupling devices in Models I-III. Referring to Equation (20), it can be observed that when the compressor flow is constant, the larger the Z, the greater the compressor energy consumption. Since the compressibility factors of compressor flow in Model II/III are higher than the given value of 0.8 in Model I, the compressor energy consumption in Model II/III, as shown in Table 5, is greater. This energy consumption deviation is transmitted to the DEN through MC, causing a change in CHP output, which in turn affects the output of GB. Therefore, due to the interdependencies within the MES, the energy flow results of DEN and DHN differ between Model I and Model II/III. In summary, the proposed model can avoid the EFC deviation in the DGN caused by differences in the gas compressibility factor, thereby yielding more accurate MES simulation results.

5.2. Influence of Initial Value on Convergence

In this subsection, the convergence behavior of the proposed matrix DGN model and the rationale behind its modified version are discussed from the perspective of initial values. The examined models include (1) Model II and (2) Model IV, where only the deviation flow is incorporated into Model II without considering the direction factor, and (3) Model III. Among the four types of initial values of the DGN, gas pressure Π0 and equipment flow fE,0 primarily influence the convergence of the hydraulic part, while specific gravity ρ0 and GCV q0 mainly affect the convergence of the gas composition tracking part. To comprehensively explore the convergence domains of different models, the hydraulic initial values Π0 and fE,0 are set as random values in the intervals of [(1 − k1/2)Πini, (1+k1/2)Πini] and [(1 − k1/2)fE,ini, (1+k1/2)fE,ini], respectively, and the gas quality initial values ρ0 and q0 are set to k2ρini and k2qini, respectively. k1/k2 ∈ [0, 1] is the coefficient of hydraulic/gas quality initial values. Πini is the pressure of the π node. fE,ini/ρini/qini is the reference initial value of equipment flow/specific gravity/GCV. The values of k1 and k2 are traversed with a step size of 0.02 within [0, 1], forming 2500 groups of different initial value samples. For each group, the convergence rates of the models are calculated. Considering the randomness of the hydraulic initial value generation, the EFC is performed 200 times for each group of initial value samples, and the average convergence rate is counted.
In this manner, the convergence domains of Models II–IV are illustrated in Figure 10. As shown in Figure 10a, Model II only converges with a very low probability in the region where k1 takes small values and k2 takes large values, indicating that the traditional DGN model is highly sensitive to the selection of initial values. In contrast, the proposed modified DGN model effectively overcomes this issue and ensures reliable convergence within a reasonable range of initial values. Specifically, the convergence region of Model III is similar to that of Model IV, with the convergence rate decreasing as k1 increases or k2 decreases (because larger k1 and smaller k2 values cause the initial values to deviate further from the actual state of the DGN). However, because Model III simultaneously considers the imbalance of nodal inflow and outflow and the uncertainty of gas flow direction, it exhibits a higher convergence rate compared to Model IV. Taking k1 = 0.04 and k2 = 0.8 as an example, the convergence curves of Models II–IV based on the same initial values are presented in Figure 11. It can be observed that, except for Model III, the remaining models fail to converge. By analyzing the state variables at the convergence termination, it is found that after one iteration, the gas flow values in pipeline 8 and compressor 3 in Model II are −0.53 MSCMD and 2.48 MSCMD, respectively, leading to a nodal flow imbalance at node 9, as shown in Figure 4. This further causes the Jacobian matrix of the DGN to become singular, ultimately terminating the EFC iteration of Model II. As for Model IV, after the second iteration, the flow value in compressor 3 becomes −0.63 MSCMD, while the flow value in pipeline 8 remains negative at −0.62 MSCMD, leading to the ill condition occurring at node 9, as illustrated in Figure 5. This also causes the Jacobian matrix of the DGN to become singular, preventing further EFC solution in Model IV. In contrast, Model III successfully avoids the convergence difficulties caused by the above-mentioned model defects and achieves the preset computational accuracy after 15 iterations. These results all demonstrate the effectiveness of the proposed modification strategy.
Furthermore, when considering the variable compressibility factor Z, the convergence domains of Models II–IV are obtained in the same manner and are presented in Figure 12. By comparing Figure 12a–c horizontally, similar conclusions to those drawn from Figure 10 can be obtained, indicating that the proposed modification strategy remains effective even under non-ideal gas conditions. Additionally, by comparing Figure 10 and Figure 12 vertically, it can be observed that the convergence domains of the models do not exhibit significant changes before and after tracking and updating Z. This demonstrates that the model incorporating the variable compressibility factor, as proposed in this paper, also exhibits robust convergence performance.
It should be noted that the model convergence domain detected in Figure 10 and Figure 12 is the convergence domain of the proposed MES model under the classic NR iteration format, from which it can be seen that there is still a large non-convergence space in the model at this time. Therefore, exploring advanced NR iterative formats becomes one of the feasible methods to further improve the convergence of the MES model, and it is also a potential direction for our future research.

5.3. Influence of Gas Properties on Convergence

In addition to the initial values, the operating conditions of the MES also influence the convergence of the energy flow model. To simulate the convergence behavior of the proposed models under different gas qualities, the injection proportion of hydrogen—representing the most significant variation in gas quality compared to natural gas—is adjusted in the DGN. This creates MES operation scenarios with varying gas quality conditions while minimizing changes to the hydraulic conditions of the DGN. Let the original hydrogen injection amount f I , ini H 2 of the test system be the baseline; the hydrogen blending level is varied according to k3  f I H 2 , where k3 ∈ [0, 3000] is the hydrogen injection coefficient. In addition, since the gas quality conditions of the DGN have changed, the effects of gas quality initial values ρ0 and q0 on model convergence must also be considered. Therefore, the gas quality initial values are set to k2ρini and k2qini, respectively. Similarly, to generate 2500 MES operation scenarios at equal intervals, k2 and k3 are iterated within their value ranges with step sizes of 0.02 and 60, respectively, while k1 is fixed at 0.2. The resulting convergence domains of Models II–IV under different gas quality conditions are shown in Figure 13.
As observed in Figure 13, due to its high sensitivity to initial values, the traditional model almost fails to converge under any gas quality conditions. However, after incorporating the deviation flow, the convergence range of Model IV has been significantly expanded compared to Model II. Within a reasonable range of gas quality initial values, Model IV can reliably converge under all gas quality conditions (with convergence rates above 80% defined as reliable convergence). Notably, when k3 = 60, the model reliably converges within the range k2 ∈ [0.5,1], whereas when k3 = 3 × 103, the reliable convergence range of k2 shifts to [0.4,0.75]. This indicates that as the hydrogen concentration increases, the reliable convergence range of gas quality initial values in Model IV shifts left (i.e., the values decrease), and the range narrows. This is because, with higher hydrogen concentrations, the actual gas quality parameters in the DGN decrease, making smaller gas quality initial values closer to the actual values and thus facilitating reliable convergence. Furthermore, under high hydrogen permeability, the probability of ill conditioning in Model IV with inappropriate gas quality initial values also increases, which leads to a narrower reliable convergence range. In contrast, Model III, which accounts for the uncertainty in gas flow direction, shows an expanding reliable convergence range as the hydrogen injection amount increases. The reliable convergence range for k2 changes from [0.5,1] at k3 = 60 to [0.4,1] at k3 = 3 × 103, further demonstrating the superiority of the proposed modified model.
Figure 14 shows the convergence curves of Models II–IV with the same initial values when k2 = 0.9 and k3 = 3 × 103. At this point, the average values of ρ and q in the DGN are 0.46 and 32.28 MJ/m3, respectively. It can be observed that Models II and IV terminate their iterations after 33 and 32 steps, respectively. At the termination points, in Model II, the flow in gas pipeline 8 reverses, causing the gas quality tracking equation at node 9 to become invalid. In Model IV, reverse flow occurs in gas pipelines 1 and 2 and in the slack gas source, with flow values of −8.58 MSCMD, −7.56 MSCMD, and −20.54 MSCMD, respectively. This results in a nodal flow imbalance at node 1, even when deviation flow is considered. In contrast, although the increase in hydrogen concentration leads to more iterations for Model III, it successfully achieves the EFC results for the MES after 42 steps, indicating that the proposed method is also well-adapted to different gas quality conditions.

5.4. Influence of Load Level on Convergence

Finally, the convergence performance of different models under varying load conditions is examined. Using the original gas load energy demand ED,ini of the test system as the baseline, the load level of the DGN is varied according to k4ED,ini, where k4 ∈ [0.5,1.5] is the load level coefficient. Considering the significant differences in hydraulic state variables of the DGN under different load conditions, the hydraulic initial values Π0 and fE,0 are set as random values within the intervals [(1−k1/2)Πini, (1 + k1/2)Πini] and [(1−k1/2)fE,ini, (1 + k1/2)fE,ini], respectively. k2 is fixed at 1. Similarly, the values of k1 and k4 are iterated with a step size of 0.02 within their respective ranges, resulting in 2500 different MES operation scenarios. The calculated convergence domains of Models II–IV under different load levels are shown in Figure 15.
As shown in Figure 15a, Model I has a low probability of convergence only in the top-left corner of the convergence domain. When k4 > 0.8 and the hydraulic initial values are appropriately chosen, Model IV can achieve reliable convergence. Specifically, as the load level increases, the reliable convergence range of the hydraulic initial values narrows from [0.04, 0.44] at k4 = 0.9 to [0, 0.24] at k4 = 1.5. This is because the pressure within the DGN decreases as the load becomes heavier, so only smaller k1 values can bring the gas pressure initial values closer to the actual pressure levels in the gas network. When k4 < 0.8, i.e., when the DGN operates in a light load mode, Model IV completely fails. Figure 15c presents the full convergence domain of the test system. It is evident that Model III converges under all load levels, with the convergence range expanding as the load decreases. Additionally, in the overlap of the convergence domains with Model IV, Model III exhibits a higher convergence rate.
Herein, we focus on the operating conditions of the DGN when k4 < 0.8. The convergence performance of Models II–IV with the same initial values for k1 = 0.2 and k4 = 0.8 is shown in Figure 16. In the first iteration, Model II encounters an ill-conditioned state due to the flow imbalance at gas node 9. Model IV also fails after 12 iterations due to insufficient precision in solving the inverse of the Jacobian matrix. Model III successfully converges after 27 iterations. However, it should be noted that in the results calculated by Model III, the flow in compressor 3, the gas consumption of compressor 3, and the flows in gas pipelines 6 and 8 are all negative. This indicates that compressor 3 and pipelines 6 and 8 are operating in reverse flow, which is clearly not permissible in a real system. Therefore, the proposed model not only applies to normal operating scenarios but also reveals some infeasible extreme conditions, which helps outline the operational boundaries of the MES and mitigate potential operational risks.

5.5. Efficiency Analysis

Based on the analysis of the convergence process above, it is evident that different initial values and operating conditions affect the convergence rate of the model, which, in turn, affects the computational time. To comprehensively assess the convergence efficiency of the proposed models, the computational time of Models I-III under various initial values and operating conditions is calculated. The iteration steps and computational time for Models I–III across multiple operating scenarios are shown in Table 6. Similarly, all results presented are the average values of 200 simulation runs.
In Scenario 1, where k1 = 0.2, k2 = 1, k3 = 1, and k4 = 1, the DGN operates under the original condition, and the initial values are close to the actual system operating state. It can be found from Table 6 that, when the variation in Z is not considered, Model I takes approximately 40 steps to converge, with a computation time of 0.076s. In contrast, owing to the Jacobian matrix with the gradient descent direction, Models II–III converge in less than 20 steps. Furthermore, due to the matrix calculation structure rather than conventional recursive loops, the computational time for Models II–III is only one-third of that of Model I. When variable Z is considered, Models II–III still exhibit good convergence rates, but due to the increased number of model equations, the computation time is slightly longer compared to the models without Z variation. In Scenario 2, where k1 = 0.2, k2 = 0.2, k3 = 3 × 103, and k4 = 1, the DGN operates under high hydrogen penetration conditions, with unfavorable gas quality initial values. In Scenario 3, where k1 = 1, k2 = 1, k3 = 1, and k4 = 0.8, the DGN operates under light load conditions with inappropriate hydraulic initial values. As shown in Table 6, only Model III successfully converges in these two scenarios, with both the number of iterations and computational time larger than those in Scenario 1. Additionally, when considering Z variation, the convergence steps of these two scenarios become lower while the computation time remains longer due to the increased model complexity. Last but not least, although the iterations of Model III in Scenarios 2 and 3 are similar to those of Model I in Scenario 1, the computation time is still much shorter for Model III. This is still attributed to the proposed matrix formulation, which is crucial for improving the efficiency of the NR-based EFC framework that requires repeated calculation of the same equations.
In addition, by comparing the iteration steps and computation time of Model III in different scenarios, it can be seen that the computational efficiency of the proposed model will be attenuated under inappropriate initial value conditions. Therefore, how to select appropriate initial values for the NR iteration to ensure the EFC computational efficiency is also one of the potential research directions in the future.

6. Conclusions

This paper presents a matrix-based energy flow model for the electricity–heat–gas MESs. Specifically, the injection of alternative gas sources and the effect of gas compressibility factor on the DGN state are considered to improve the universality and accuracy of the DGN model. Then, the deviation flow and directional factor are introduced to fundamentally prevent the potential ill conditioning of the gas composition tracking equations. After that, the Jacobian matrices with gradient descent direction are derived to further ensure the convergence of the EFC process solved by the NR method. Finally, adopting the NR-based unified EFC solution strategy, the effectiveness of the proposed method is validated through numerical simulations, and the main conclusions can be drawn as follows:
  • The proposed MES model is accurate, with an error of less than 1 × 10−8 compared to the traditional MES model. Owing to the precisely derived Jacobian matrices, the convergence steps of the proposed model are less than 0.5 times that of the traditional method.
  • Ignoring the change in the gas compressibility factor will lead to inaccurate estimation of the DGN state, especially the node pressure.
  • In the framework of the classic NR solution method, the convergence domains of the proposed modified MES models are significantly expanded under different initial values, gas quality conditions, and load levels.
  • The matrix-based formulations for MES models and Jacobian matrices are proven to be computationally efficient, whose time consumption is only one-third of that of the traditional method under the same conditions.
During the case study analysis, we found that the proposed model still has local non-convergence space under the classic NR iteration format. Therefore, improved NR algorithms can be investigated in the future to further enhance the convergence of the MES model. In addition, the initial value optimization method for NR iteration can also help to further improve the convergence rate of the proposed model.

Author Contributions

Conceptualization, J.W. and J.Z.; methodology, J.W.; software, F.M.; investigation, S.W., R.X. and K.L.; writing—original draft preparation, J.W.; writing—review and editing, F.M.; visualization, S.W.; supervision, J.Z.; funding acquisition, F.M. All authors have read and agreed to the published version of the manuscript.

Funding

This work has been supported by the Key Research and Development Program of Jiangsu Province (Grant No. BE2020027), the National Key Research and Development Program of China (Grant No. 2022YFE0140600), and the China Scholarship Council (Grant No. 202306090135).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The original contributions presented in this study are included in the article; further inquiries can be directed to the corresponding author.

Acknowledgments

We extend our deepest gratitude to all authors who have participated in this study and contributed to the manuscript. Each author’s expertise and tireless work have been pivotal to the completion of our research findings. We wish to express our heartfelt thanks to Southeast University for the invaluable support provided in conducting the experiments of this study. The resources and facilities offered by the university have been crucial for the completion of our experimental and analytical work. In addition, we also thank the LASAR Laboratory for helpful discussions and suggestions.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
MESMulti-energy system
EFCEnergy flow calculation
P2GPower-to-gas
DENDistrict electricity network
DHNDistrict heat network
DGNDistrict gas network
SNGSynthetic natural gas
NRNewton–Raphson
ACAlternative current
AEsAlgebraic equations
GCVGross calorific value
GTGGas turbine generator
GBGas boiler
HPHeat pump
EBElectric boiler
CHPCombined heat and power
MCMoto-compressor
TCTurbo-compressor
CPCirculation pump
STPStandard temperature and pressure
EoSEquation of State
Symbols
PS,i/PL,iActive source/load power of bus i
QS,i/QL,iReactive source/load power of bus i
|Vi|Voltage magnitude of bus i
θijVoltage angle difference between bus i and bus j
NeTotal bus number of DEN
Gij/BijConductance/susceptance of branch ij
E PQ / E PV Set of PQ/PV buses
PS/PLActive source/load power vector
QS/QLReactive source/load power vector
VVoltage vector
YNodal admittance matrix
AhNode–branch incidence matrix of DHN
mPipeline mass flow vector
mqNodal mass flow vector
BhLoop-branch incidence matrix of DHN
KhPipeline resistance coefficient vector
Φn/ΦsConsumed heat power vector of non-source/source nodes
CpSpecific heat capacity of water
T n S / T s R Outflow temperature vector of non-source/source nodes
T s p S / T s p R Specified inflow temperature vector of supply/return nodes
T o u t , k P / T i n , k P Outlet/inlet temperature of heat pipeline k
Ta,kAmbient temperature of heat pipeline k
λh,kHeat transfer coefficient of heat pipeline k
Lh,kLength of heat pipeline k
mkMass flow of heat pipeline k
pipe Set of heat pipelines
T o u t , k P / T i n , k P Equivalent outlet/inlet temperature of heat pipeline k
T in , i , k N / T o u t , j N Inflow/outflow temperature of node i/j
AhdDirectional node–branch incidence matrix of DHN
ShDirectional factor vector of heat pipelines
mout/minMass flow leaving/entering a node
node Set of DHN nodes
out , i / in , i Set of heat pipelines with
Node i as the inlet/heat pipelines with node i as the outlet
T i n N / T out N Nodal inflow/outflow temperature vector
D 1 S / D 1 R Weighted mass flow leaving into pipelines from supply/return nodes
D 2 S / D 2 R Weighted mass flow leaving into loads from supply/return nodes
D 3 S / D 3 R Weighted mass flow entering from pipelines from supply/return nodes
fPGas pipeline flow vector
SgDirectional factor vector of gas pipelines
KPGas pipeline coefficient vector
Πs/ΠeSquared pressure vector of gas pipeline start/end node
MPConstant part in KP
ZPGas pipeline compressibility factor vector
ρSpecific gravity vector
φP/LP/DPFriction factor/length/diameter vector of gas pipeline
Cp/TgConstant parameter/gas temperature of gas pipeline
χ/κ/μFlow exponent/diameter exponent/specific gravity exponent
AgNode–pipeline incidence matrix of DGN
AgdDirectional node–pipeline incidence matrix of DGN
HC/BCAdiabatic horsepower/power coefficient vector of compressor
fC/θCGas flow/compression exponent vector of compressor
πi/πoInlet/outlet pressure vector of compressor
CCCompressor characteristic constant
Pst/TstStandard temperature/pressure
Tg,inGas temperature at the compressor inlet
ZC,inGas compressibility factor vector at the compressor inlet
ωGas polytropic coefficient vector
τCConsumed gas flow vector of compressor
τC,stEquivalent energy consumption vector of the extracted gas under standard GCV
qCGCV vector at the extraction node
αC/βC/γCEfficiency coefficient vector
BgNode–equipment incidence matrix of DGN
B g S / B g C Node–slack source incidence matrix/node-compressor incidence matrix
fE/fSEquipment gas flow/slack source flow vector
fL/fD/fINet load/volume demand/non-slack source flow vector
EDLoad energy demand vector
qNodal GCV vector
TCNode-extraction incidence matrix
R C 0 Specified squared boost ratio
D C 0 Specified squared boost difference
Π 0 I Specified squared inlet pressure
Π O 0 Specified squared outlet pressure
f C 0 Specified compressor flow rate
wN,ks/wN,kiControl parameter of slack source node pressure/compressor inlet node pressure
wN,ko/wE,k/dkControl parameter of compressor outlet node pressure/equipment flow/compressor
Πs/Πi/ΠoSquared pressure of slack source node/compressor inlet node/compressor outlet node
fE,kGas flow of the equipment
G equ Equipment set of DGN
WN/WE/dControl parameter matrix
G C tap , i / G type Set of compressors extracting from node i/gas source types
G C in , i / G C out , i Set of compressors entering/leaving node i
G P in , i / G P out , i Set of pipelines entering/leaving node i
G node Set of DGN nodes
f C i n / f C o u t Compressor flow entering/leaving node i
f P i n / f P o u t Pipeline flow entering/leaving node i
ρin/ρoutSpecific gravity of gas entering/leaving node i
qin/qoutGCV of gas entering/leaving node i
ρS/qSSpecific gravity/GCV of injected gas
ρ/qGas specific gravity/GCV of type
fSKnown pressure source flow
f I Known injection source flow of type
ρS/qSSpecific gravity/GCV vector of injected gas at π nodes
B g Node-non-slack source type incidence matrix of DGN
f I Non-slack source flow vector of type
εNodal molar fraction vector of gas type
ε S Molar fraction vector of gas type at known-pressure sources
π ~ Average pressure vector of gas pipelines
Tcr/PcrCritical temperature/pressure vector of the mixture
υSpecific property vector of the mixture
υSpecific property of gas type
ωcp/ωcvSpecific heat capacity vector at constant pressure/volume
fI/fC/fP/fDKnown injection source/compressor/gas pipeline/gas load flow
ΔfLNodal deviation flow
S g C / S g S / S g τ Directional factor vector of compressor/known pressure source/consumption flow
Δ f L in / f D in Deviation/load flow entering node i
f S in / τ C out Known pressure source/compressor consumption flow entering node i
Δ f L out / f D out Deviation/load flow leaving node i
f S out / τ C out Known pressure source/compressor consumption flow leaving node i
ρsp/qspSpecified specific gravity/GCV of gas flow entering node i
ε sp Specified molar fraction vector of gas type for gas flow entering the node
zCHPI/zCHPIIControl parameter of CHPI/CHPII
Φx/Px/fx/ηxHeat power/electrical power/gas consumption/conversion efficiency of device x
qgas/qSNGGCV of the consumed gas/SNG
fP2G/PP2GInjected flow rate of SNG/consumed power of P2G
PC/PCPDriving power of MC/CP
mcpMass flow through CP
gGravitational acceleration
hcpPump head
xe/xh/xgState variable vector of DEN/DHN/DGN
Fe/Fh/FgMismatch vector of DEN/DHN/DGN
Jee/Jhh/JggJacobian matrix of DEN/DHN/DGN
ΔPQMismatch vector of nodal active/reactive power
ΔΦsΦnMismatch vector of heat source/load power
ΔhfMismatch vector of heat pressure
Δ T n R T n S Mismatch vector of supply/return temperature
EIdentity matrix
x/F/JState variable vector/mismatch vector/Jacobian matrix of MES
JxyJacobian matrix representing the effect of subnetwork ‘y′ to subnetwork ‘x′
Npq/Nhp/NhnNumber of PQ bus/heat pipeline/heat non-source node
Ng/NgeNumber of gas node/gas equipment
ζ/KConvergence tolerance/maximum iteration number

References

  1. Schaffartzik, A.; Fischer-Kowalski, M. Latecomers to the Fossil Energy Transition, Frontrunners for Change? The Relevance of the Energy ‘Underdogs’ for Sustainability Transformations. Sustainability 2018, 10, 2650. [Google Scholar] [CrossRef]
  2. Ilyushin, P.; Gerasimov, D.; Suslov, K. Method for Simulation Modeling of Integrated Multi-Energy Systems Based on the Concept of an Energy Hub. Appl. Sci. 2023, 13, 7656. [Google Scholar] [CrossRef]
  3. Zhang, L.J.; Shi, J.Q.; Wang, L.L.; Xu, C.Q. Electricity, Heat, and Gas Load Forecasting Based on Deep Multitask Learning in Industrial-Park Integrated Energy System. Entropy 2020, 22, 1355. [Google Scholar] [CrossRef]
  4. Song, X.H.; Qu, Z.W.; Kou, J.A.; Wang, Y.J.; Georgievitch, P.M. Environmental Economical Dispatching of Electric-Gas Integrated Energy System Considering Hydrogen Compressed-Natural Gas. Processes 2022, 10, 2642. [Google Scholar] [CrossRef]
  5. Yang, D.Y.; Xi, Y.F.; Cai, G.W. Day-Ahead Dispatch Model of Electro-Thermal Integrated Energy System with Power to Gas Function. Appl. Sci. 2017, 7, 1326. [Google Scholar] [CrossRef]
  6. Yang, C.; You, S.J.; Han, Y.Z.; Wang, X.; Li, J.; Wang, L. Research on Optimization Method of Integrated Energy System Network Planning. Sustainability 2023, 15, 8843. [Google Scholar] [CrossRef]
  7. Dutto, S.; Masetti, G.; Chiaradonna, S.; Di Giandomenico, F. On Extending and Comparing Newton-Raphson Variants for Solving Power-Flow Equations. IEEE Trans. Power Syst. 2019, 34, 2577–2587. [Google Scholar] [CrossRef]
  8. Martínez-Mares, A.; Fuerte-Esquivel, C.R. A Unified Gas and Power Flow Analysis in Natural Gas and Electricity Coupled Networks. IEEE Trans. Power Syst. 2012, 27, 2156–2166. [Google Scholar] [CrossRef]
  9. Zeng, Q.; Fang, J.; Li, J.; Chen, Z. Steady-state analysis of the integrated natural gas and electric power system with bi-directional energy conversion. Appl. Energy 2016, 184, 1483–1492. [Google Scholar] [CrossRef]
  10. Huang, Y.J.; Sun, Q.Y.; Zhang, N.; Wang, R. A Multi-Slack Bus Model for Bi-Directional Energy Flow Analysis of Integrated Power-Gas Systems. CSEE J. Power Energy Syst 2024, 10, 2186–2196. [Google Scholar] [CrossRef]
  11. Liu, X.; Wu, J.; Jenkins, N.; Bagdanavicius, A. Combined analysis of electricity and heat networks. Appl. Energy 2016, 162, 1238–1250. [Google Scholar] [CrossRef]
  12. Shabanpour-Haghighi, A.; Seifi, A.R. An Integrated Steady-State Operation Assessment of Electrical, Natural Gas, and District Heating Networks. IEEE Trans. Power Syst. 2016, 31, 3636–3647. [Google Scholar] [CrossRef]
  13. Liu, X.; Mancarella, P. Modelling, assessment and Sankey diagrams of integrated electricity-heat-gas networks in multi-vector district energy systems. Appl. Energy 2016, 167, 336–352. [Google Scholar] [CrossRef]
  14. Markensteijn, A.S.; Romate, J.E.; Vuik, C. A graph-based model framework for steady-state load flow problems of general multi-carrier energy systems. Appl. Energy 2020, 280, 115286. [Google Scholar] [CrossRef]
  15. Li, J.; Huang, Y.; Zhu, M. Gradient descent iterative method for energy flow of integrated energy system considering multiple modes of compressors. Energy Convers. Manag. 2020, 207, 112534. [Google Scholar] [CrossRef]
  16. Chen, D.; Hu, X.; Li, Y.; Wang, R.; Abbas, Z.; Zeng, S.; Wang, L. Nodal-pressure-based heating flow model for analyzing heating networks in integrated energy systems. Energy Convers. Manag. 2020, 206, 112491. [Google Scholar] [CrossRef]
  17. Zhang, S.; Gu, W.; Lu, H.; Qiu, H.; Lu, S.; Wang, D.; Liang, J.; Li, W. Superposition-principle based decoupling method for energy flow calculation in district heating networks. Appl. Energy 2021, 295, 117032. [Google Scholar] [CrossRef]
  18. Zheng, J.H.; Xiao, W.; Wu, C.Q.; Li, Z.; Wang, L.X.; Wu, Q.H. A gradient descent direction based-cumulants method for probabilistic energy flow analysis of individual-based integrated energy systems. Energy 2023, 265, 126290. [Google Scholar] [CrossRef]
  19. Ma, H.; Liu, C.; Zhao, H.; Zhang, H.; Wang, M.; Wang, X. A novel analytical unified energy flow calculation method for integrated energy systems based on holomorphic embedding. Appl. Energy 2023, 344, 121163. [Google Scholar] [CrossRef]
  20. Yao, S.; Gu, W.; Wu, J.; Qadrdan, M.; Lu, H.; Lu, S.; Zhou, Y. Fast and Generic Energy Flow Analysis of the Integrated Electric Power and Heating Networks. IEEE Trans. Smart Grid 2024, 15, 355–367. [Google Scholar] [CrossRef]
  21. Yang, L.; Zhao, X.; Li, X.; Yan, W. Probabilistic Steady-State Operation and Interaction Analysis of Integrated Electricity, Gas and Heating Systems. Energies 2018, 11, 917. [Google Scholar] [CrossRef]
  22. Massrur, H.R.; Niknam, T.; Aghaei, J.; Shafie-Khah, M.; Catalao, J.P.S. Fast Decomposed Energy Flow in Large-Scale Integrated Electricity-Gas-Heat Energy Systems. IEEE Trans. Sustainable Energy 2018, 9, 1565–1577. [Google Scholar] [CrossRef]
  23. Jiang, Y.; Ren, Z.; Yang, X.; Li, Q.; Xu, Y. A steady-state energy flow analysis method for integrated natural gas and power systems based on topology decoupling. Appl. Energy 2022, 306, 118007. [Google Scholar] [CrossRef]
  24. Ayele, G.T.; Haurant, P.; Laumert, B.; Lacarriere, B. An extended energy hub approach for load flow analysis of highly coupled district energy networks: Illustration with electricity and heating. Appl. Energy 2018, 212, 850–867. [Google Scholar] [CrossRef]
  25. Sun, Q.; Dong, Q.; You, S.; Li, Z.; Wang, R. A unified energy flow analysis considering initial guesses in complex multi-energy carrier systems. Energy 2020, 213, 118812. [Google Scholar] [CrossRef]
  26. Chen, Y.; Zhao, J.; Ma, J. Fast Decoupled Multi-Energy Flow Calculation for Integrated Energy System. J. Mod. Power Syst. Clean Energy 2020, 8, 951–960. [Google Scholar] [CrossRef]
  27. Huang, Y.; Sun, Q.; Li, Y.; Sun, C.; Chen, Z. Damping technique empowered robust energy flow calculation for integrated energy systems. Appl. Energy 2023, 343, 121168. [Google Scholar] [CrossRef]
  28. Tian, H.; Zhao, H.; Liu, C.; Chen, J.; Wu, Q.; Terzija, V. A dual-driven linear modeling approach for multiple energy flow calculation in electricity-heat system. Appl. Energy 2022, 314, 118872. [Google Scholar] [CrossRef]
  29. Jia, W.H.; Ding, T.; Shahidehpour, M. Second-Order Cone Programming for Data-Driven Fluid and Gas Energy Flow With a Tight Reformulation. IEEE Trans. Power Syst. 2021, 36, 1652–1655. [Google Scholar] [CrossRef]
  30. Wang, S.; Zhai, J.; Hui, H. Optimal Energy Flow in Integrated Electricity and Gas Systems With Injection of Alternative Gas. IEEE Trans. Sustainable Energy 2023, 14, 1540–1557. [Google Scholar] [CrossRef]
  31. Osiadacz, A.J.; Chaczykowski, M. Modeling and Simulation of Gas Distribution Networks in a Multienergy System Environment. Proc. IEEE 2020, 108, 1580–1595. [Google Scholar] [CrossRef]
  32. Schmidt, M.; Steinbach, M.C.; Willert, B.M. High detail stationary optimization models for gas networks. Optim. Eng. 2015, 16, 131–164. [Google Scholar] [CrossRef]
  33. Jia, M.; Huang, S.; Tang, K.; Shen, C. An Investigation on the Applicability of the Integrated Method for Multi-Carrier Energy Flow Analysis. In Proceedings of the IEEE-Power-and-Energy-Society General Meeting (PESGM), Portland, OR, USA, 5–10 August 2018; IEEE: Piscataway, NJ, USA, 2018. [Google Scholar]
  34. Zhu, M.T.; Xu, C.S.; Dong, S.F.; Tang, K.J.; Gu, C.H. An integrated multi-energy flow calculation method for electricity-gas-thermal integrated energy systems. Prot. Control Mod. Power Syst. 2021, 6, 5. [Google Scholar] [CrossRef]
  35. Li, Q.; An, S.; Gedra, T.W. Solving natural gas loadflow problems using electric loadflow techniques. In Proceedings of the North American Power Symposium, Dallas, TX, USA, 19–20 December 2003. [Google Scholar]
  36. Zimmerman, R.D.; Murillo-Sánchez, C.E. MATPOWER, version 7.1; Zenodo: Meyrin, Switzerland, 2020. [Google Scholar] [CrossRef]
  37. Wu, J. Data of the MES Test Systems [Dataset], version 2; Figshare Dataset: London, UK, 2025. [Google Scholar] [CrossRef]
  38. Engineeringtoolbox. Available online: https://www.engineeringtoolbox.com (accessed on 10 March 2025).
Figure 1. General framework diagram of the MES.
Figure 1. General framework diagram of the MES.
Applsci 15 04815 g001
Figure 2. Typical schematic diagram of the DHN.
Figure 2. Typical schematic diagram of the DHN.
Applsci 15 04815 g002
Figure 3. Traditional positive direction definition of the DGN.
Figure 3. Traditional positive direction definition of the DGN.
Applsci 15 04815 g003
Figure 4. Schematic diagram of deviation flow.
Figure 4. Schematic diagram of deviation flow.
Applsci 15 04815 g004
Figure 5. Irrationality of presetting the gas flow positive direction.
Figure 5. Irrationality of presetting the gas flow positive direction.
Applsci 15 04815 g005
Figure 6. Flowchart of the proposed NR-based EFC solution strategy.
Figure 6. Flowchart of the proposed NR-based EFC solution strategy.
Applsci 15 04815 g006
Figure 7. Structure schematic of the test system.
Figure 7. Structure schematic of the test system.
Applsci 15 04815 g007
Figure 8. Iteration process of Models I–III on the test system. (a) With constant gas compressibility factor; (b) with variable gas compressibility factor.
Figure 8. Iteration process of Models I–III on the test system. (a) With constant gas compressibility factor; (b) with variable gas compressibility factor.
Applsci 15 04815 g008
Figure 9. The EFC results of the DGN in the test system. (a) Nodal pressure; (b) pipeline gas flow and compressibility factor; (c) equipment gas flow and compressibility factor; (d) nodal specific gravity; (e) nodal GCV.
Figure 9. The EFC results of the DGN in the test system. (a) Nodal pressure; (b) pipeline gas flow and compressibility factor; (c) equipment gas flow and compressibility factor; (d) nodal specific gravity; (e) nodal GCV.
Applsci 15 04815 g009aApplsci 15 04815 g009b
Figure 10. The convergence domains of Models II–IV under different initial values. (a) Model II; (b) Model IV; (c) Model III.
Figure 10. The convergence domains of Models II–IV under different initial values. (a) Model II; (b) Model IV; (c) Model III.
Applsci 15 04815 g010
Figure 11. Iteration process of Models II–IV with k1 = 0.04 and k2 = 0.8.
Figure 11. Iteration process of Models II–IV with k1 = 0.04 and k2 = 0.8.
Applsci 15 04815 g011
Figure 12. The convergence domains of Models II–IV with variable Z under different initial values. (a) Model II with variable Z; (b) Model IV with variable Z; (c) Model III with variable Z.
Figure 12. The convergence domains of Models II–IV with variable Z under different initial values. (a) Model II with variable Z; (b) Model IV with variable Z; (c) Model III with variable Z.
Applsci 15 04815 g012
Figure 13. The convergence domains of Models II–IV under different gas qualities. (a) Model II; (b) Model IV; (c) Model III.
Figure 13. The convergence domains of Models II–IV under different gas qualities. (a) Model II; (b) Model IV; (c) Model III.
Applsci 15 04815 g013
Figure 14. Iteration process of Models II–IV with k2 = 0.9 and k3 = 3 × 103.
Figure 14. Iteration process of Models II–IV with k2 = 0.9 and k3 = 3 × 103.
Applsci 15 04815 g014
Figure 15. The convergence domains of Models II–IV under different load levels. (a) Model II; (b) Model IV; (c) Model III.
Figure 15. The convergence domains of Models II–IV under different load levels. (a) Model II; (b) Model IV; (c) Model III.
Applsci 15 04815 g015
Figure 16. Iteration process of Models II–IV with k1 = 0.2 and k4 = 0.8.
Figure 16. Iteration process of Models II–IV with k1 = 0.2 and k4 = 0.8.
Applsci 15 04815 g016
Table 1. Values of control parameters for different equipment modes.
Table 1. Values of control parameters for different equipment modes.
EquipmentOperation ModewN,kswN,kiwN,kowE,kdk
SourceSlack1000 Π S 0 (bar2)
CompressorMode I0 R C 0 −100
Mode II0−110 D C 0 (bar2)
Mode III0001 f C 0 (MSCMD)
Mode IV0100 Π I 0 (bar2)
Mode V0010 Π O 0 (bar2)
Table 2. Summary of node types, state variables, and model formulations for MES.
Table 2. Summary of node types, state variables, and model formulations for MES.
SubnetworkNode TypeKnown VariablesUnknown VariablesModel FormulationsMismatch Equations
DENθVθ, VP, Q(1) and (2)(44)
PQP, Qθ, V
PVP, Vθ, Q
DHNhTSh, T sp S Φ, m, TS, TR(3), (4), (14) and (17)(46)
ΦTSΦ, T sp S m, TS, TR
ΦTRΦ, T T sp R m, TS, TR
DGNππ, ρS, qSfS, ρ, q(22), (24), (29)–(33) and (36)(50) and (67)
ffL, ρS, qSπ, fC, ρ, q
Table 3. Properties of different types of gas sources [38].
Table 3. Properties of different types of gas sources [38].
Gas PropertyGas Category
Natural GasH2SNG
Critical temperature (K)192.4533.15190.55
Critical pressure (bar)46.3713.1046.5
Heat capacity at constant volume (kJ·kg−1·K−1)1.6910.191.71
Heat capacity at constant pressure (kJ·kg−1·K−1)2.2014.312.23
Specific gravity0.61060.06960.58
GCV (MJ/m3)41.0412.7537.04
Table 4. The EFC errors of the proposed models on the test system.
Table 4. The EFC errors of the proposed models on the test system.
ErrorDEN ResultsDHN ResultsDGN Results
|V| (p.u.)θ (°)m (kg/s)TS (°C)TR (°C)π (bar)fE (MSCMD)ρq (MJ/m3)
Model IIMax3.99 × 10−155.40 × 10−131.09 × 10−119.95 × 10−1402.78 × 10−116.18 × 10−117.76 × 10−114.01 × 10−9
Average4.66 × 10−161.98 × 10−131.63 × 10−121.55 × 10−1407.60 × 10−121.63 × 10−111.86 × 10−119.15 × 10−10
Min0000001.61 × 10−122.00 × 10−152.10 × 10−12
Model IIIMax6.11 × 10−151.67 × 10−125.10 × 10−111.14 × 10−1307.98 × 10−116.31 × 10−117.79 × 10−113.95 × 10−9
Average1.10 × 10−158.80 × 10−137.84 × 10−124.40 × 10−1402.57 × 10−112.55 × 10−111.53 × 10−118.02 × 10−10
Min0000009.99 × 10−1400
Table 5. The interdependencies within Models I–III.
Table 5. The interdependencies within Models I–III.
CHP GB Compressor 1Compressor 4Compressor 2Compressor 3
ΦCHP (MW)PCHP (MW)fCHP (MSCMD)ΦGB (MW)fGB (MSCMD)PC (MW)PC (MW)τC (MSCMD)τC (MSCMD)
Model I76.991161.59290.271458.82800.14650.23180.70290.11280.0145
Model II77.082561.66600.271758.73670.14620.25870.74640.11620.0182
Model III77.082561.66600.271758.73670.14620.25870.74640.11620.0182
Table 6. Iterations and computational time for Models I–III in Scenarios 1–3.
Table 6. Iterations and computational time for Models I–III in Scenarios 1–3.
ScenarioModelWithout Z VariationWith Z Variation
StepsTime (s)StepsTime (s)
Scenario 1Model I39.470.07573--
Model II18.940.0251517.480.03477
Model III18.440.0237216.740.02387
Scenario 2Model I----
Model II----
Model III31.370.0360727.590.03652
Scenario 3Model I----
Model II----
Model III42.630.0477337.650.04762
Abbreviation—‘-’ represents non-convergence or non-existence.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wu, J.; Zheng, J.; Mei, F.; Wang, S.; Xu, R.; Li, K. Energy Flow Calculation Method for Multi-Energy Systems: A Matrix Approach Considering Alternative Gas Injection and Dynamic Flow Direction. Appl. Sci. 2025, 15, 4815. https://doi.org/10.3390/app15094815

AMA Style

Wu J, Zheng J, Mei F, Wang S, Xu R, Li K. Energy Flow Calculation Method for Multi-Energy Systems: A Matrix Approach Considering Alternative Gas Injection and Dynamic Flow Direction. Applied Sciences. 2025; 15(9):4815. https://doi.org/10.3390/app15094815

Chicago/Turabian Style

Wu, Jianzhang, Jianyong Zheng, Fei Mei, Shuai Wang, Ruilin Xu, and Kai Li. 2025. "Energy Flow Calculation Method for Multi-Energy Systems: A Matrix Approach Considering Alternative Gas Injection and Dynamic Flow Direction" Applied Sciences 15, no. 9: 4815. https://doi.org/10.3390/app15094815

APA Style

Wu, J., Zheng, J., Mei, F., Wang, S., Xu, R., & Li, K. (2025). Energy Flow Calculation Method for Multi-Energy Systems: A Matrix Approach Considering Alternative Gas Injection and Dynamic Flow Direction. Applied Sciences, 15(9), 4815. https://doi.org/10.3390/app15094815

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop