1 Introduction

Compared with traditional coal-fired power generation, gas-fired power generation has many advantages, such as high efficiency, lower environmental impact, and flexible startup and shutdown. With the growth of proven natural gas reserves, the development of gas turbine technology and increased environmental pressures, the proportion of gas turbines in power generation has significantly increased in recent years. In the foreseeable future, it is reasonable to predict that natural gas will have good prospects for application in the power system. At the same time, the development of the Energy Internet in the future will also prompt the tight coupling of the power system and the natural gas system.

There are many random factors in the natural gas and electricity coupled system, such as the uncertainty of renewable energy output, the random outage of generator units, and the random fluctuation of the power load and gas load. The existence of these random factors makes the state variables, e.g. gas flow in the gas pipeline, or the bus voltage and branch power, no longer constants and present certain probability distribution characteristics. In the traditional power system, the power flow is deterministic, which means that the bus voltage and branch power are constants. If deterministic gas and power flow methods are used to analyze the natural gas and electricity coupled system, not only is there a large amount of calculation, but also it is difficult to obtain a detailed description of the overall situation of the system. However, given the statistical characteristics of the injection variables in the coupled system as input data, if the probabilistic flow algorithm is used, probability distribution information of state variables can be obtained after a single calculation. Then, the operational situation of the combined system including uncertain factors can be fully reflected, which is helpful to discover potential threats to the safe operation of the coupled system.

At present, the widely used probabilistic power flow methods include the Monte Carlo method, cumulant method and point estimate method. In the Monte Carlo simulation method, [1] adopts the K-means clustering load model and considers the component outage probability. The proposed method promotes the practical application of probabilistic power flow methods based on Monte Carlo. In contrast to [1], [2] uses Latin hypercube sampling and the Gram-Schmidt sequence orthogonal method to improve sampling efficiency, and reduces computation time of the Monte Carlo simulation. In [3], probabilistic energy flow is analyzed in an integrated energy system by adopting the Monte Carlo simulation, which is innovative but time consuming. In terms of the probabilistic power flow method based on the cumulant, a probability distribution is obtained by the combination of the cumulant method and the Gram–Charlier expansion given in [4]. Besides, [5] combines the Von-Mises expansion and the cumulant method, putting forward a probabilistic power flow method considering branch outages and random node injection. As for research on probabilistic power flow based on point estimates, [6] presents a new method and compares the results with the Monte Carlo simulation, which proves the feasibility of the algorithm. For calculating the point estimate method [7], it is pointed out in [8] that, in the case of n input random variables, the point estimate method can obtain the probability distribution information of state variables only by 2n power flow calculations.

It is generally believed that, although the Monte Carlo simulation can get accurate results, it usually takes a large number of simulations and is time-consuming, which makes this method not suitable for practical systems [9]. Therefore, the result of Monte Carlo simulation is often used as the reference for other algorithms. However, the cumulant method has the advantages of less computational burden and higher speed, so it has been widely used to model practical systems.

In this paper, after develo** a steady state power and gas flow model, a unified probabilistic power and gas flow method, that adopts cumulant method and Gram-Charlier expansion, is applied to the natural gas and electricity coupled system. The contributions of this paper mainly include:

  1. 1)

    The multi-slack-bus model applied in both the natural gas and the electricity system is proposed to calculate the steady-state power and gas flow, which is more accurate compared to the traditional single-slack-bus model.

  2. 2)

    For the first time, a unified probabilistic power and gas flow calculation based on the cumulant method is proposed to analyze the effect of uncertain factors on the natural gas and electricity coupled system. This method is much faster than other existing methods of unified probabilistic power and gas flow, such as the Monte Carlo simulation used in [3].

  3. 3)

    A new method of piecewise linearization is put forward to achieve a more precise fit to the probability distribution when random factors with large variation range appear in the coupled system.

This paper is organized as follows. Section 2 presents a model of the natural gas system and introduces its components. A steady-state power and gas flow model with multiple slack buses is proposed in Sect. 3. Unified probabilistic power flow based on the cumulant method and Gram–Charlier expansion is introduced in Sect. 4. In Sect. 5, the proposed approach is applied to a test system to verify its effectiveness. Finally, conclusions are presented in Sect. 6.

2 Model of natural gas system

In the past, models of the power system have been thoroughly investigated, and the AC power flow model is adopted in this paper. In this section, a model of the natural gas system, to be used in the coupled system model, is introduced.

The natural gas network is shown in Fig. 1. It mainly consists of five parts: the natural gas source, natural gas pipeline, compressor, storage tank and natural gas load. The storage tank is treated as a gas source in this paper.

Fig. 1
figure 1

Simplified schematic diagram of natural gas system

The models of key natural gas components are described as follows.

2.1 Gas flow model of natural gas pipeline

In this paper, the Weymouth steady-state power flow model is used to describe the relationship between gas flow in the pipeline and pressure at both ends of the pipeline [10]:

$$sgn_{p} (\pi_{i} ,\pi_{j} ) \cdot fp_{p}^{2} = \phi_{p} (\pi_{i}^{2} - \pi_{j}^{2} ) \,$$
(1)
$$- F_{p}^{{max}} \; \le \;fp_{p} \le F_{p}^{{max}} \quad \forall p \in SP$$
(2)
$$sgn_{p} (\pi_{i} ,\pi_{j} ) = \left\{ {\begin{array}{*{20}l} { + 1} \hfill & {\pi_{i} > \pi_{j} } \hfill \\ { - 1} \hfill & {\pi_{i} < \pi_{j} } \hfill \\ \end{array} } \right.$$
(3)

where \(fp_{p}\), \(\pi_{i}\) and \(\pi_{j}\) stand for the gas flow in the pipeline and the pressure at both ends of the pipeline; \(\phi_{p}\) and \(sgn_{p}\) stand for the gas flow transmission parameter and direction of flow in pipeline p; \(F_{p}^{max}\) is the transmission capacity limit of pipeline p; SP is the set of pipelines.

2.2 Compressor model

The model of the compressor is a nonconvex and nonlinear equation that describes the relationship between the compression ratio and the energy consumption [11]:

$$H_{o} = B_{o} \cdot fc_{o} \left[ {\left( {\frac{{\pi_{j} }}{{\pi_{i} }}} \right)^{{Z_{oi} \left( {\frac{\alpha - 1}{\alpha }} \right)}} - 1} \right]\quad \forall o \in SC$$
(4)

where \(H_{o}\) is the energy consumption of compressor o; \(fc_{o}\) is the natural gas flow in the compressor; \(\pi_{i}\) and \(\pi_{j}\) stand for the gas pressure at the inlet and outlet of the compressor, respectively; \(Z_{oi}\) and\(\alpha\)stand for the compression parameter and heat ratio of compressor o at its inlet; \(B_{o}\) is a parameter related to operating temperature, heat ratio and working efficiency; SC is the set of compressors.

The energy consumed by the compressor can be supplied by electricity or natural gas. Here, only the natural gas is taken into consideration. The relationship between the energy consumption and gas consumption is shown in (5):

$$\tau_{o} = \xi^{\prime\prime}_{o} H_{o}^{2} + \xi^{\prime}_{o} H_{o} + \xi_{o} \;\;\;\;\;\;\forall o \in SC$$
(5)

where \(\xi^{\prime\prime}_{o}\), \(\xi^{\prime}_{o}\) and \(\xi_{o}\) are the coefficients of quadratic term, linear term and constant term of compressor o’s energy consumption curve, respectively.

When the compressor operating mode is given, the gas pressure relationship between the inlet and outlet of the compressor can be described by (6), where \(\varUpsilon_{o}\) is the compression ratio of compressor o:

$$\pi_{j} = \varUpsilon_{o} \pi_{i} \;\;\;\;\;\;\forall o \in SC$$
(6)

2.3 Node flow balance equation

$$\begin{aligned} & \sum\limits_{{p \in SP}} {A_{{jp}} \cdot fp_{p} } + \sum\limits_{{o \in SC}} {U_{{jo}} \cdot fc_{o} } + \sum\limits_{{h \in SWS}} {C_{{jh}} \cdot WS_{h} } = \sum\limits_{{o \in SC}} {T_{{jo}} \tau _{o} } \\ & \quad + {\mkern 1mu} \sum\limits_{{r \in SWL^{\prime } }} {D_{{jr}}^{\prime } \cdot WL_{r}^{0} } + \sum\limits_{{g \in SWL^{{\prime \prime }} }} {D_{{jg}}^{{\prime \prime }} \cdot wl_{g} } \quad \forall j \in SGB \\ \end{aligned}$$
(7)

where A, U, C, D , D″ and T stand for different incidence matrixes; \(WS_{h}\) and \(WL_{r}^{0}\) represent the gas output of source h and the gas load of node r in a given operational situation (no gas turbine included); \(wl_{g}\) is the gas consumption of gas turbine g; SWS is the set of gas source nodes; \(SWL^{\prime }\) and \(SWL^{\prime \prime }\) stand for the sets of conventional natural gas load nodes and gas turbine nodes, respectively; \(SGB\) is the set of natural gas network nodes.

2.4 Coupling equation between power system and natural gas system

The natural gas network and power network are coupled by gas turbines, creating the relationship shown in (8):

$$wl_{k} = \frac{{\mu_{1} \cdot Pg_{i}^{2} + \mu_{2} \cdot Pg_{i} + \mu_{3} }}{GHV}\quad \forall k \in \varOmega_{1} ,\forall i \in \varOmega_{2}$$
(8)

where \(\varOmega_{1}\) and \(\varOmega_{2}\) are the sets of coupled nodes in the gas network and power network, respectively; \(\mu_{1}\), \(\mu_{2}\) and \(\mu_{3}\) are the coefficients of quadratic term, linear term and constant term of the turbine’s energy consumption curve, respectively; GHV is the coefficient of energy conversion; \(Pg_{i}\) is the real active power output of generator i.

3 Steady-state power and gas flow of coupled system with multiple slack buses

Referring to the dynamic power flow model presented in [12], a steady state power and gas flow model with multiple slack buses is proposed. The steady state flow equations of the coupled system are divided into two parts: the power flow equations for the power system and the gas flow equations for the natural gas system.

3.1 Power flow equation for power system

When the traditional power flow equations are used, it is necessary to appoint a slack bus in the system, and assume all the unbalanced power in the system is corrected by this node. However, in case of a branch and a generator outage, a large amount of unbalanced power appears, and it is unreasonable to maintain balance of the total power system by relying only on the one slack bus. In practical operation of the power system, a small part of unbalanced power in the system is regulated by the frequency characteristics of the load, and the vast majority is shared by multiple generators. Therefore, power flow equations with a multi-slack-bus model, which are more in line with practical operation, are adopted to calculate the power flow in the power system. In such a calculation, it is required to select multiple generators to participate in the regulation of unbalanced power in advance and appoint the participation factor for each generator. In addition, it is also required to select a bus voltage angle as a reference.

Given the network parameters and operating conditions of the power system, the multi-slack-bus power flow equations are shown in (9):

$$\left\{ {\begin{array}{*{20}l} {\Delta P_{i} = \sum\limits_{l \in i} {Pg_{l} } - \sum\limits_{k \in i} {Pd_{k}^{0} } - \sum\limits_{j \in i} {P_{ij} } = 0} \hfill \\ {\Delta Q_{i} = \sum\limits_{l \in i} {Qg_{l}^{0} } - \sum\limits_{k \in i} {Qd_{k}^{0} } - \sum\limits_{j \in i} {Q_{ij} } = 0} \hfill \\ \end{array} \;\;\;\;\;\;\;\forall i \in SNB} \right.$$
(9)

where

$$Pg_{l} = Pg_{l}^{0} + \zeta_{l} \Delta P_{\varSigma } \;\;\;\;\;\;\;\forall l \in SG$$
(10)
$$\sum\limits_{l \in SG} {\zeta_{l} } = 1\;\;\;\; \, 0 \le \zeta_{l} \le 1$$
(11)

\(Pg_{l}\) is the real active power output of generator l; \(Pd_{k}^{0}\) and \(Qd_{k}^{0}\) are the active and reactive power demand of load k; \(P_{ij}\) and \(Q_{ij}\) are the active and reactive power flow in the line from node i to node j; \(Pg_{l}^{0}\) and \(Qg_{l}^{0}\) are the initial active and reactive power output of generator l; \(\Delta P_{\varSigma }\) is the total amount of unbalanced power of system, and \(\zeta_{l}\) is the participation factor of generator l; SG is the set of generators in the power system; SNB stands for the network nodes in the power system.

Assuming the number of nodes is NE, and that the number of PV nodes is r, there are active power balance equations for all nodes, and NE − r reactive power balance equations for non-PV nodes. The unknown variables to be solved in power system are of three kinds: the voltage magnitude vector \(\varvec{V}\)of NE − r dimensions; the voltage angle vector \(\varvec{\theta}\) of NE − 1 dimensions; and the total unbalanced power of system \(\Delta P_{\varSigma }\). In multi-slack-bus power flow, the number of variables is 2NE − r and the number of equations is 2NE − r; these numbers are equal, so there is a unique solution if the equations are well conditioned.

3.2 Gas flow equation in natural gas system

Using the models of various components introduced in Sect. 2, it is not difficult to obtain the gas flow equations in the natural gas system:

$$\left\{ \begin{aligned}\Delta W_{j} & = \sum\limits_{p \in SP} {A_{jp} \cdot fp_{p} } + \sum\limits_{o \in SC} {U_{jo} \cdot fc_{o} } + \sum\limits_{h \in SWS} {C_{jh} \cdot WS_{h} } \\ & \quad - \sum\limits_{o \in SC} {T_{jo} \tau_{o} } - \sum\limits_{{r \in SWL^{\prime}}} {D_{jr}^{\prime } \cdot WL_{r}^{0} } \\ & \quad - \sum\limits_{{g \in SWL^{\prime \prime } }} {D_{jg}^{\prime \prime } \cdot wl_{g} = 0} \quad \forall j \in SGB \\\Delta fp_{p} & = fp_{p}^{2} - \text{sgn}_{p} (\pi_{i} ,\pi_{j} )\phi_{p} \left( {\pi_{i}^{2} - \pi_{j}^{2} } \right) = 0\quad \forall p \in SP \\\Delta H_{o} & = ht_{o} - B_{o} \cdot fc_{o} \left[ {\left( {\frac{{\pi_{j} }}{{\pi_{i} }}} \right)^{{Z_{oi} \left( {\frac{\alpha - 1}{\alpha }} \right)}} - 1} \right] = 0\quad \forall o \in SC \\\Delta \varGamma_{o} & = \tau_{o} - (\xi_{o} + \xi_{o}^{\prime } \cdot ht_{o} + \xi_{o}^{\prime \prime } \cdot ht_{o}^{2} ) = 0\quad \forall o \in SC \\\Delta \varPi_{o} & = \pi_{j} - \varUpsilon_{o} \pi = 0_{i} \quad \forall o \in SC \\ \end{aligned} \right.$$
(12)

Similar to power loss in the power system, the natural gas consumption of compressor is unknown before gas flow calculation. The slack nodes should be set to balance the gas flow in the natural gas system. The dynamic gas flow model, similar to the dynamic power flow model, is applied to calculate the gas flow; that is to say, the amount of unbalanced gas gets balanced from multiple gas wells. The gas output in (12) can be expressed as follows:

$$WS_{h} = WS_{h}^{0} + \varsigma_{h} \Delta W_{\varSigma } \quad \forall h \in SWS$$
(13)
$$\sum\limits_{h \in SWS} {\varsigma_{h} } = 1, \, 0 \le \varsigma_{h} \le 1\quad \forall h \in SWS$$
(14)

where \(WS_{h}^{0}\) stands for the given gas output of gas well h; \(\varsigma_{h}\) is the participation factor of gas well h; \(\Delta W_{\varSigma }\) is the total amount of unbalanced gas of the gas system.

It is assumed that there are NGB nodes, NPL pipelines, NC compressors and NGG gas turbines in the natural gas system. The number of variables remaining to be solved in the gas flow equations is NGB + NPL + 3NC + NGG, consisting of seven kinds: the gas pressure vector \(\varvec{\pi}\) of NGB  1 dimensions; the pipeline gas flow vector \(\varvec{fp}\) of NPL dimensions; the compressor gas flow vector \(\varvec{fc}\) of NC dimensions; the compressor energy consumption vector \(\varvec{ht}\) of NC dimensions; the compressor gas consumption vector \(\varvec{\tau}\) of NC dimensions; the unbalanced gas \(\Delta W_{\varSigma }\) in the natural gas system; and the gas turbine gas consumption \(\varvec{wl}\) of NGG dimensions. However, the number of equations in the gas flow calculation is NGB + NPL + 3NC. Thus, the number of equations is NGG less than the number of variables. It is required to supplement the relationship, which contains NGG equations (equal to the number of gas turbines), between the power system and natural gas system, shown in (15):

$$\begin{aligned} \Delta WL_{k} = wl_{k} - \frac{{\mu_{1} \cdot Pg_{i}^{2} + \mu_{2} \cdot Pg_{i} + \mu_{3} }}{GHV} = 0 \hfill \\ \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \forall k \in \varOmega_{1} ,\forall i \in \varOmega_{2} \hfill \\ \end{aligned}$$
(15)

3.3 Unified flow equation in coupled system

Combining the equations in (9), (12) and (15) together, the unified power and gas flow equations for the coupled system are obtained, where the number of equations is equal to the number of variables (both 2NE  r + NGB + NPL + 3NC + NGG):

$$\left\{ {\begin{array}{*{20}l} {\Delta P_{i} = \sum\limits_{j \in i} {Pg_{j} } - \sum\limits_{k \in i} {Pd_{k}^{0} } - \sum\limits_{j \in i} {P_{ij} } = 0\quad \, \forall i \in SNB} \hfill \\ {\Delta Q_{i} = \sum\limits_{j \in i} {Qg_{j}^{0} } - \sum\limits_{k \in i} {Qd_{k}^{0} } - \sum\limits_{j \in i} {Q_{ij} } = 0\quad \forall i \in SPQ} \hfill \\ {\Delta W_{j} = \sum\limits_{p \in SP} {A_{jp} \cdot fp_{p} } + \sum\limits_{o \in SC} {U_{jo} \cdot fc_{o} } + \sum\limits_{h \in SWS} {C_{jh} \cdot WS_{h} } } \hfill \\ {\quad - \sum\limits_{o \in SC} {T_{jo} \tau_{o} } - \sum\limits_{{r \in SWL^{\prime } }} {D_{jr}^{\prime } \cdot WL_{r}^{0} } } \hfill \\ {\quad - \sum\limits_{{g \in SWL^{\prime \prime } }} {D_{jg}^{\prime \prime } \cdot wl_{g} } = 0\quad \forall j \in SGB} \hfill \\ {\Delta fp_{p} = fp_{p}^{2} - \text{sgn}_{p} (\pi_{i} ,\pi_{j} )\phi_{p} \left( {\pi_{i}^{2} - \pi_{j}^{2} } \right) = 0\quad \forall p \in SP} \hfill \\ {\Delta H_{o} = ht_{o} - B_{o} \cdot fc_{o} \left[ {\left( {\frac{{\pi_{j} }}{{\pi_{i} }}} \right)^{{Z_{oi} \left( {\frac{\alpha - 1}{\alpha }} \right)}} - 1} \right] = 0\quad \forall o \in SC} \hfill \\ {\Delta \varGamma_{o} = \tau_{o} - (\xi_{o} + \xi_{o}^{\prime } \cdot ht_{o} + \xi_{o}^{\prime \prime } \cdot ht_{o}^{2} ) = 0\quad \forall o \in SC} \hfill \\ {\Delta \varPi_{o} = \pi_{j} - \varUpsilon_{o} \pi_{i} = 0\quad \forall o \in SC} \hfill \\ {\Delta WL_{k} = wl_{k} - \frac{{\mu_{1} \cdot Pg_{i}^{2} + \mu_{2} \cdot Pg_{i} + \mu_{3} }}{GHV} = 0} \hfill \\ {\quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \forall k \in \varOmega_{1} ,\forall i \in \varOmega_{2} } \hfill \\ \end{array} } \right.$$
(16)

Note that several intermediate variables, such as the pipeline gas vector and the compressor gas consumption vector, are introduced into the equations of the coupled system [1315]. This increase in the number of variables greatly improves the convenience of the generation of the Jacobi matrix in the subsequent model.

By removing the node injection vector to the left of the coupled system flow equation in (16), using W as a short form, and introducing the function f(X) to stand for the expression on the right, the original flow equations can be simplified as:

$$\varvec{W} = \varvec{f}\text{(}\varvec{X}\text{)}$$
(17)

The equation shown in (17) can be expressed as a Taylor series expansion at the steady-state working point to obtain the linear form, ignoring the quadratic and higher-order terms. Then, the correction equations shown in (18) are obtained, with which the variables to be solved in the coupled system can be obtained by Newton–Raphson method.

For the convenience of expression, the equations in (18) are transformed into the equation in (19), where J ac is the Jacobi matrix of the correction equations.

$$\left[ {\begin{array}{*{20}l} {\Delta \varvec{P}} \hfill \\ {\Delta \varvec{Q}} \hfill \\ {\Delta \varvec{W}} \hfill \\ {\Delta \varvec{fp}} \hfill \\ {\Delta \varvec{H}} \hfill \\ {\Delta\varvec{\varGamma}} \hfill \\ {\Delta\varvec{\varPi}} \hfill \\ {\Delta \varvec{WL}} \hfill \\ \end{array} } \right] = \left[ {\begin{array}{*{20}l} {\frac{{\partial \Delta \varvec{P}}}{{\partial \Delta \varvec{V}}}} \hfill & {\frac{{\partial \Delta \varvec{P}}}{{\partial \Delta\varvec{\theta}}}} \hfill & {\frac{{\partial \Delta \varvec{P}}}{{\partial \Delta P_{\;\varSigma } }}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill \\ {\frac{{\partial \Delta \varvec{Q}}}{{\partial \Delta \varvec{V}}}} \hfill & {\frac{{\partial \Delta \varvec{Q}}}{{\partial \Delta\varvec{\theta}}}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill \\ {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{W}}}{{\partial \Delta\varvec{\pi}}}} \hfill & {\frac{{\partial \Delta \varvec{W}}}{{\partial \Delta \varvec{fp}}}} \hfill & {\frac{{\partial \Delta \varvec{W}}}{{\partial \Delta \varvec{fc}}}} \hfill & {\frac{{\partial \Delta \varvec{W}}}{{\partial \Delta\varvec{\tau}}}} \hfill & {\frac{{\partial \Delta \varvec{W}}}{{\partial \Delta \varvec{wl}}}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{W}}}{{\partial \Delta W_{\varSigma } }}} \hfill \\ {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{fp}}}{{\partial \Delta\varvec{\pi}}}} \hfill & {\frac{{\partial \Delta \varvec{fp}}}{{\partial \Delta \varvec{fp}}}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill \\ {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{H}}}{{\partial \Delta\varvec{\pi}}}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{H}}}{{\partial \Delta \varvec{fc}}}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{H}}}{{\partial \Delta \varvec{ht}}}} \hfill & {\mathbf{0}} \hfill \\ {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta\varvec{\varGamma}}}{{\partial \Delta\varvec{\tau}}}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta\varvec{\varGamma}}}{{\partial \Delta \varvec{ht}}}} \hfill & {\mathbf{0}} \hfill \\ {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta\varvec{\varPi}}}{{\partial \Delta\varvec{\pi}}}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill \\ {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{WL}}}{{\partial \Delta P_{\;\varSigma } }}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill & {\frac{{\partial \Delta \varvec{WL}}}{{\partial \Delta \varvec{wl}}}} \hfill & {\mathbf{0}} \hfill & {\mathbf{0}} \hfill \\ \end{array} } \right]\left[ {\begin{array}{*{20}l} {\Delta \varvec{V}} \hfill \\ {\Delta\varvec{\theta}} \hfill \\ {\Delta P_{\varSigma } } \hfill \\ {\Delta\varvec{\pi}} \hfill \\ {\Delta \varvec{fp}} \hfill \\ {\Delta \varvec{fc}} \hfill \\ {\Delta\varvec{\tau}} \hfill \\ {\Delta \varvec{wl}} \hfill \\ {\Delta \varvec{ht}} \hfill \\ {\Delta W_{\varSigma } } \hfill \\ \end{array} } \right]$$
(18)
$$\Delta \varvec{W} = \varvec{J}_{ac} \Delta \varvec{X}$$
(19)

The detailed procedure of steady state power and gas flow calculation in the coupled system is as follows.

  1. 1)

    Set the iteration number iter = 1. The convergence precision \(\varepsilon\) and the operational mode of the coupled system should be given, including the output of generators, the output of gas wells and the compression ratio of compressors.

  2. 2)

    Give initial values X ini to the unknown variables X(iter) in the coupled system. A flat startup is used in the power system, assigning voltage magnitude to 1 and angle to 0. The initial value for the natural gas system can be set by solving a linearized optimal gas flow problem according to [10].

  3. 3)

    Substitute the values of unknown variables X(iter) into the correction equation (18), so the constant term \(\Delta \varvec{W}\)(iter) and coefficient matrix J ac (iter) can be obtained.

  4. 4)

    Calculate the correction quantities \(\Delta \varvec{X}\)(iter) by the correction equations and correct the unknown variables by X(iter + 1) = X(iter+ \(\Delta \varvec{X}\)(iter). Update the iteration number iter = iter + 1.

  5. 5)

    Apply the updated value of unknown variables X(iter) to calculate the constant term \(\Delta \varvec{W}\)(iter) in the correction equations. Judge whether \(\left| {\Delta \varvec{W}} \right|\) is less than \(\varepsilon\). If it is, stop the iteration and output the final result. Otherwise, go back to step 3 and continue calculating.

4 Calculation of probabilistic flow in coupled system

Based on the steady-state power and gas flow model with multiple slack buses presented in the Sect. 3, this part focuses on calculation of unified probabilistic power and gas flow in the coupled system.

4.1 Model of random factors in coupled system

The uncertainties considered in the system consist of the uncertainty of power load, gas load and the output of wind power. To model the uncertain factors, a normal distribution [16] is applied to describe the active and reactive load in the power system and the gas load in the natural gas system.

$$\left\{ {\begin{array}{*{20}c} {f\left( {P_{l} } \right) = \frac{1}{{\sqrt {2\pi \sigma_{pl} } }}\exp \left( { - \frac{{\left( {P_{l} - \mu_{pl} } \right)^{2} }}{{2\sigma_{pl}^{2} }}} \right)} \\ {f\left( {Q_{l} } \right) = \frac{1}{{\sqrt {2\pi \sigma_{ql} } }}\exp \left( { - \frac{{\left( {Q_{l} - \mu_{ql} } \right)^{2} }}{{2\sigma_{ql}^{2} }}} \right)} \\ {f\left( {G_{l} } \right) = \frac{1}{{\sqrt {2\pi \sigma_{gl} } }}\exp \left( { - \frac{{\left( {G_{l} - \mu_{gl} } \right)^{2} }}{{2\sigma_{gl}^{2} }}} \right)} \\ \end{array} } \right.$$
(20)

where \(\mu_{pl}\), \(\mu_{ql}\) and \(\mu_{gl}\) are expected values of the active load, reactive load and gas load, respectively; \(\sigma_{pl}\), \(\sigma_{ql}\) and \(\sigma_{gl}\) are the corresponding standard deviations of the active load, reactive load and gas load, respectively.

The probabilistic model of wind power depends on the probabilistic model of wind speed and the relationship between the output power and the wind speed. The Weibull distribution is applied to model the wind speed [17]:

$$f(v) = \frac{b}{a}\left( {\frac{v}{a}} \right)^{b - 1} \exp \left( { - \left( {\frac{v}{a}} \right)^{b} } \right)$$
(21)

The relationship between the wind power output and wind speed can be described by (22):

$$P = \left\{ {\begin{array}{*{20}l} 0 \hfill & {v \le v_{in} ,v \ge v_{out} } \hfill \\ {P_{N} \frac{{v - v_{in} }}{{v_{rated} - v_{in} }}} \hfill & {v_{in} < v < v_{rated} } \hfill \\ {P_{N} } \hfill & {v_{rated} \le v < v_{out} } \hfill \\ \end{array} } \right.$$
(22)

where \(v\) is the wind speed; a, b are the scale and shape parameters of Weibull distribution, respectively; \(v_{in}\), \(v_{out}\) and \(v_{rated}\) are the cut-in, cut-out and rated wind speed, respectively, of the wind turbines modelled; \(P_{N}\) is the rated wind power output.

4.2 Cumulant method

Based on the models in (20), (21) and (22), the central moments of load and wind power can be obtained by the method presented in [4] and [18]. The relationship between central moments and cumulants is presented in (23), by which the cumulants can be deduced from the central moments:

$$\left\{ {\begin{array}{*{20}l} {\gamma_{1} = m} \hfill \\ {\gamma_{2} = \beta_{2} = \sigma^{2} } \hfill \\ {\gamma_{3} = \beta_{3} } \hfill \\ {\gamma_{4} = \beta_{4} - 3\beta_{2}^{2} } \hfill \\ {\gamma_{5} = \beta_{5} - 10\beta_{2} \beta_{3} } \hfill \\ {\gamma_{6} = \beta_{6} - 15\beta_{2} \beta_{4} - 10\beta_{3}^{2} + 30\beta_{2}^{3} } \hfill \\ {\gamma_{7} = \beta_{7} - 21\beta_{2} \beta_{5} - 35\beta_{3} \beta_{4} + 210\beta_{3} \beta_{2}^{2} } \hfill \\ {\; \vdots } \hfill \\ \end{array} } \right.$$
(23)

where m is the mean value; \(\sigma\) is the standard deviation; \(\gamma_{i}\) is the i-order cumulant; \(\beta_{i}\) is the i-order central moment.

In (17), if the uncertainties of the power load, gas load and renewable energy are considered, W will be a random variable vector. Assuming there emerges a small fluctuation \(\Delta \varvec{W}\) of the node injection vector, the state variable vector will change by \(\Delta \varvec{X}\), correspondingly. About the steady-state working point, \(\varvec{W}_{0} = \varvec{f}\left( {\varvec{X}_{0} } \right)\), the fluctuations can be calculated by:

$$\varvec{W}_{\text{0}} + {\Delta }\varvec{W} = \varvec{f}\left( {\varvec{X}_{\text{0}} + {\Delta }\varvec{X}} \right) \approx \varvec{f}\left( {\varvec{X}_{\text{0}} } \right) + \varvec{J}_{\text{0}}\Delta \varvec{X}$$
(24)
$$\left\{ {\begin{array}{*{20}l} {\Delta \varvec{X = J}_{\text{0}}^{{\text{ - 1}}}\Delta \varvec{W = S}_{\text{0}}\Delta \varvec{W}} \\ {\varvec{J}_{\text{0}} \varvec = \left. {\frac{{\partial \varvec{f}\left( \varvec{X} \right)}}{{\partial \varvec{X}}}} \right|_{{\varvec{X = X}_{\text{0}} }} } \\ \end{array} } \right.$$
(25)

J 0 is the Jacobi matrix of the previous iteration. The random fluctuation \(\Delta \varvec{W}\) of node injection can be obtained by the convolution of wind output fluctuation \(\Delta \varvec{W}_{W}\), power load fluctuation \(\Delta \varvec{W}_{EL}\) and gas load fluctuation \(\Delta \varvec{W}_{GL}\):

$$\Delta \varvec{W} = {\Delta }\varvec{W}_{W}\, *\, {\Delta }\varvec{W}_{EL} \,*\, {\Delta }\varvec{W}_{GL}$$
(26)

where * is the symbol of convolution.

Assuming that the random variables of node injection in coupled system are independent of each other, the cumulant computation can be used to replace the convolution operation:

$$\varvec{\gamma}^{k} =\varvec{\gamma}_{W}^{k} +\varvec{\gamma}_{EL}^{k} +\varvec{\gamma}_{GL}^{k}$$
(27)

where \(\varvec{\gamma}^{k}\), \(\varvec{\gamma}_{W}^{k}\), \(\varvec{\gamma}_{EL}^{k}\) and \(\varvec{\gamma}_{GL}^{k}\) are the k-order cumulants of the node injection variable, wind power output, and power load and gas load, respectively.

4.3 Gram–Charlier expansion

After getting the cumulants of the node injection variable, the cumulant of the state variable can be obtained according to the relationship in (25) and the homogeneity and additivity of cumulants [4]. Then, the Gram–Charlier expansion, the Edge-Worth expansion or the Cornish-Fisher expansion can be applied to obtain the probability distribution of the state variables [19].

In this paper, the widely-used Gram–Charlier expansion is applied. Its main idea is to express the probability distribution characteristics by the expansion series made up of all-order derivatives of the standard normal distribution. The coefficients of the expansion are composed of normalized cumulants. By substituting normalized cumulants of state variables into (28), the corresponding probability distribution of the normalized state variables can be obtained:

$$\begin{aligned} f\left( t \right) & = N\left( t \right)\left( {1 + \frac{{g_{3} }}{3!}H_{3} \left( t \right) + \frac{{g_{4} }}{4!}H_{4} \left( t \right) + \frac{{g_{5} }}{5!}H_{5} \left( t \right)} \right. \\ & \quad \left. { + \frac{{g_{6} + 10g_{3}^{2} }}{6!}H_{3} \left( t \right) + \frac{{g_{7} + 35g_{3} g_{4} }}{7!}H_{7} \left( t \right) + \cdots } \right) \\ \end{aligned}$$
(28)

where

$$t = \frac{X - E(X)}{{\delta_{X} }}$$
(29)
$$g_{i} = \frac{{\gamma^{i} }}{{\delta_{X}^{i} }}$$
(30)

\(N\left( t \right)\) is the probability density function of the normal distribution; t is the normalized random variable; g i is the normalized i-order cumulant; \(H_{i} \left( t \right)\) is i-order Hermite polynomial; E(X) and \(\delta_{X}\) are the expected value and standard deviation of standard variable X.

Based on the combined cumulant and Gram–Charlier expansion method, Fig. 2 shows the solution process of the proposed probabilistic flow method for the coupled system. Note that the cumulant and state variables should be normalized. All state variables except the power flow in the power system can be obtained by the method shown in Fig. 2. As for power flow in power system, it can be obtained by the method in [20, 21].

Fig. 2
figure 2

Flow chart of proposed probabilistic flow method

4.4 A new method of piecewise linearization

When the random factors in the coupled system fluctuate over a large range, the fitting precision of the proposed method may become worse. To tackle this problem, a new method of piecewise linearization is proposed. Its main idea is based on the multi-point Taylor series expansion [22]. The detailed calculation process is as follows:

  1. 1)

    Divide the random factors with a large variation range into several intervals, to obtain a number of operation scenarios.

  2. 2)

    The probability of each scenario can be calculated according to the distribution of random factors.

  3. 3)

    Apply the proposed method to obtain the cumulative distribution function f(x) of state variable x in each scenario, which can be represented as (31):

    $$f\left( x \right) = \left\{ {\begin{array}{*{20}l} {f_{1} \left( x \right)\;\;\;\;\;\;\;p = p_{1} } \hfill \\ {f_{2} \left( x \right)\;\;\;\;\;\;\;p = p_{2} } \hfill \\ {\;\; \vdots } \hfill \\ {f_{N} \left( x \right)\;\;\;\;\;p = p_{N} } \hfill \\ \end{array} } \right.$$
    (31)

    where \(f_{i} \left( x \right)\) is the cumulative distribution function of variable x in scenario i; \(p_{i}\) is the probability of scenario i; \(\sum\limits_{i = 1}^{N} {p_{i} } = 1\); N is the number of scenarios.

  4. 4)

    Finally, the cumulative distribution function f(x) of state variable x can be obtained by (32):

    $$f\left( x \right) = \sum\limits_{i = 1}^{N} {p_{i} f_{i} \left( x \right)}$$
    (32)

    By applying the method illustrated above, the fitting precision of the proposed method can be well improved.

5 Case study

There are 38 lines and 33 generators in the IEEE case24 power system [23]. In the 15-node natural gas system [11], there are 12 pipelines, 4 compressors and 5 gas loads (gas turbines not included). The total installed capacity of the power system is 2999 MW and the total load is 2850 MW. The power system and natural gas system are coupled by 4 gas turbines, with coupling nodes noted yellow in Fig. 3. The buses with gas turbines and gas wells are slack buses, i.e., buses 1, 2, 7 and 13 are slack buses in the electricity system, and nodes 1 and 2 are slack buses in the natural gas system.

Fig. 3
figure 3

Natural gas and electricity coupled system

5.1 Probabilistic gas and power flow analysis

The gas load and power load are assumed to obey the normal distribution, and two cases are designed to analyze the effect of random factors on the coupled system: case 1, where the standard deviation coefficient of the normal distribution is 0.02, and case 2, where the standard deviation coefficient of the normal distribution is 0.05. There are 3 wind turbines in the system, with their data shown in Table 1.

Table 1 Data of wind turbines

In case 1, the node pressure in the natural gas system and the bus voltage in the power system are both studied by probabilistic power and gas flow to illustrate the effect of random factors on the state variables.

Figure 4 shows the node pressure in the natural gas system when random factors are introduced. It is clear that the node pressure is no longer a constant when there appears a fluctuation of node injection. Compared with the Monte Carlo (MC) method, the proposed method has a good fitting precision. Comparing the curve fitting at node 5 with node 11 in Fig. 4, it can be concluded that the curve fitting is better when the state variable is further away from random factors, intuitively.

Fig. 4
figure 4

Probability distribution of pressure at node 5 and 11

In Fig. 5, it can be seen that, similarly to the node pressure in the natural gas system, the bus voltages in the power system also exhibit variation when random factors are introduced [24]. However, the variation range of bus voltage is much smaller than that of node pressure. This means that the bus voltage is more robust than the node pressure under the influence of random factors.

Fig. 5
figure 5

Probability distribution of pressure at bus 3 and 24

As for other state variables in the coupled system, the gas flow in the pipeline, the active power flow and the reactive power flow in the power system are also analyzed and shown in Fig. 6. It can be seen that the proposed method can also attain good curve fitting about other state variables.

Fig. 6
figure 6

Probability distribution of other state variables

The random factors in case 2 have a wider range than those in case 1, and the effect of larger random factors on the coupled system is analyzed. The condition of state variables in case 2 is compared with that in case 1, and the results are shown in Fig. 7.

Fig. 7
figure 7

Probability characteristics of pressure and voltage

Figure 7a, b compare the cumulative distribution function of pressure at node 11 and Fig. 7c, d compare the probability density function of the voltage at bus 12. In Fig. 7a, the pressure at node 11 ranges from 665 to 825 Pa, while in Fig. 7b, the pressure at node 11 ranges from 555 to 935 Pa. Meanwhile, the curve fitting in Fig. 7d is worse than that in Fig. 7c. When random factors have a wider range, the state variables in the coupled system also vary over a wider range and the curve fitting of the proposed method becomes worse.

5.2 Computation time comparison

The computation time of the proposed method and the MC method is shown in Table 2.

Table 2 Computation time comparison

It can be seen that, depending on the order of Gram–Charlier expansion, the cumulant method is ten times faster than the Monte Carlo method. According to Table 2, for the Monte Carlo method, there is a linear relationship between computation time and the number of iterations. However, the computation time increases only slightly when the order of Gram–Charlier expansion rises.

5.3 ARMS error analysis

In order to demonstrate the proposed method has a good fitting precision, the average root mean square (ARMS) error is calculated using the Monte Carlo results as reference [4]. ARMS is defined as:

$$ARMS = \frac{{\sqrt {\sum\limits_{i = 1}^{N} {\left( {MC_{i} - CG_{i} } \right)^{2} } } }}{N}$$
(33)

where \(MC_{i}\) is the value of i th point on the cumulative distribution function calculated by the Monte Carlo method; \(CG_{i}\) is the value of i th point on the cumulative distribution function calculated by the cumulant method; \(N\) stands for the number of points, with N assigned as 100 for this analysis.

The definition of case 1 and 2 has been given in Sect. 5.1. The relevant ARMS errors of state variables under two cases are calculated to quantitatively analyze the precision of curve fitting when the random factors have a wider range. The results are shown in Table 3.

Table 3 ARMS results of state variables in coupled system

The results in Table 3 quantitatively illustrate that the proposed method has a good fitting precision. Taking the pressure at node 5 as an example, the value of ARMS reaches 0.062%, which indicates the fitting precision is very high. Comparing the results of case 1 and case 2, it can also be concluded that as the random factors have a wider range, the fitting precision will degenerate as reflected by the values of ARMS.

5.4 Piecewise linearization

The effect of the proposed piecewise linearization method is explored by increasing the capacity of the wind turbine at node 1–150 MW, so that the wind output has a very large range, while kee** all other parameters unchanged. The standard deviation coefficient of the normal distribution is 0.02 as for case 1 above. The capacity is divided into three pieces: 1–50, 50–100 and 100–150 MW, and the expected value and probability of each piece are shown in Table 4.

Table 4 Information of each scenario

The cumulative distribution function of the studied variables can be obtained by the method proposed in Sect. 4.4. The curve fitting results of direct linearization and piecewise linearization are shown in Fig. 8 for contrast.

Fig. 8
figure 8

Pressure at node 10 in different cases

Using piecewise linearization, the precision of curve fitting is intuitively expected to be much better than that of direct linearization. In fact, the ARMS of direct linearization is 0.650%, while the ARMS of piecewise linearization is 0.220%. It should be pointed out that the reason why the piecewise linearization can reduce error is that this method is equivalent to reducing the fluctuation of random factors. Another benefit is that, after applying piecewise linearization, the occurrence of negative values of the probability density function can be avoided.

6 Conclusion

A unified probabilistic gas and power flow calculation method is proposed to analyze the effect of random factors on the natural gas and electricity coupled system. The case study demonstrates that when random factors are introduced into the coupled system, the fluctuation of random factors usually has a more significant impact on the state variables of the nearby buses. An increase in the fluctuation range of the random factors will lead to larger fluctuation of the state variables, which can result in worse curve fitting of the proposed method.

When the proposed method is applied to calculate the probabilistic flow in the coupled system, it has the desired precision and is approximately ten times faster than the Monte Carlo simulation method for the cases examined. The new method of piecewise linearization introduced by this paper can effectively deal with random factors with a large range of variability, making the proposed method broadly applicable. By accurately calculating expected ranges of important state variables, the proposed method can provide quantitative safety assessment to instruct the planning and operation of the natural gas and electricity coupled system.