The state space model of microgrid used for the stability analysis is shown in Fig. 1. In Fig. 1, there are three inverters, which are considered as sources (because all the sources in microgrid are integrated with the system using inverters). The output frequency of inverter one is taken as a reference.
Mathematical modelling of microgrid
In this section, mathematical modelling of the source, load and network are presented. Inverter source model, composite load model and network model are presented in detail as below.
Source model
The photovoltaic cell, diesel generator, wind turbine are the main sources of microgrid. But power is getting injected into the grid through inverters; therefore, it is called as the source of the system. The detailed mathematical model is given in this section [13, 16]. The complete inverter source model of the system is given in Fig. 2; it consists of power controller, voltage controller and current controller. These controllers are required for interconnection of the inerter with point of common coupling (PCC).
Equation 1 describes the dynamics of inverter in the form of the state space model. The state variables affect the stability of inverter and finally stability of microgrid.
$$\mathop {[\Delta x_{\text{inv}} ]}\limits^{ \cdot } = A_{\text{inv}} \left[ {\Delta x_{\text{inv}} } \right] + B_{\text{inv}} \left[ {\Delta v_{\text{bDQ}} } \right] + B_{{\omega_{\text{com}} }} \left[ {\Delta \omega_{\text{com}} } \right]$$
(1)
$$\left[ {\begin{array}{*{20}c} {\Delta \omega } \\ {\Delta i_{\text{oDQ}} } \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} {C_{{{\text{inv}}\upomega}} } \\ {C_{\text{invc}} } \\ \end{array} } \right]\left[ {\Delta x_{\text{inv}} } \right]$$
(2)
where \(\mathop {\Delta x}\limits^{ \cdot }\) is the dynamic state variable vector, ∆xinv is a state variable vector, \(A_{\text{inv}}\) is the state matrix of inverters, Binv, Bωco, Cinvω and Cinvc are the input matrix of inverters, \(\left[ {\Delta v_{\text{bDQ}} } \right]\) is a bus voltage vector, \(\left[ {\Delta \omega_{\text{com}} } \right]\) is the reference frequency vector, and ∆IoDQ is an output current matrix in the DQ reference frame.
Load model
Loads are energy consuming part of the system. The loads may be static, dynamic or composite load.
RL load
The equations given below describe the state of the RL load with the changes in frequency, resistance and inductance of the load.
$$A_{\text{load1}} = \left[ {\begin{array}{*{20}c} { - \frac{{R_{\text{load1}} }}{{L_{\text{load1}} }}} & \omega \\ { - \omega } & { - \frac{{R_{\text{load1}} }}{{L_{\text{load1}} }}} \\ \end{array} } \right]$$
(3)
$$A_{\text{load2}} = \left[ {\begin{array}{*{20}c} { - \frac{{R_{\text{load2}} }}{{L_{\text{load2}} }}} & \omega \\ { - \omega } & { - \frac{{R_{\text{load2}} }}{{L_{\text{load2}} }}} \\ \end{array} } \right]$$
(4)
$$B_{{ 1 {\text{load1}}}} = \left[ {\begin{array}{*{20}c} {\frac{1}{{L_{\text{load1}} }}} & 0 \\ 0 & {\frac{1}{{L_{\text{load1}} }}} \\ \end{array} } \right],\quad B_{{ 2 {\text{load1}}}} = \left[ {\begin{array}{*{20}c} {\Delta i_{\text{loadQ1}} } \\ { - \Delta i_{\text{loadD1}} } \\ \end{array} } \right],\quad B_{{ 1 {\text{load2}}}} = \left[ {\begin{array}{*{20}c} {\frac{1}{{L_{\text{load2}} }}} & 0 \\ 0 & {\frac{1}{{L_{\text{load2}} }}} \\ \end{array} } \right],\quad B_{{ 2 {\text{load2}}}} = \left[ {\begin{array}{*{20}c} {\Delta i_{\text{loadQ2}} } \\ { - \Delta i_{\text{loadD2}} } \\ \end{array} } \right]$$
(5)
where \(A_{\text{load1}}\), \(A_{\text{load2}}\) are the state matrix of the load, \(B_{{ 1 {\text{load1}}}}\),\(B_{{ 1 {\text{load2}}}}\), \(B_{{ 2 {\text{load1}}}}\) and \(B_{{ 2 {\text{load2}}}}\) are the input matrix of the load, \(R_{\text{load}}\) is the resistance of RL load, \(L_{\text{load}}\) is the inductance of RL load and \(\omega\) is the frequency of RL load.
Constant impedance, current and power load
The constant impedance, current and power model are also known as ZIP model or static load. In this model, the impedance, current and the power remain constant, but the actual voltage keeps changing. In ZIP model, active power (P) and reactive power (Q) are expressed in terms of exponent a and b, respectively. The detail ZIP model is presented in [17].
Equations 6 and 7 describe the active and reactive power changes for static load, while Eq. 8 gives the relation between constant of the active and reactive power
$$\frac{P}{{P_{0} }} =\, K_{pz} \left( {\frac{V}{{V_{0} }}} \right)^{2} + K_{pi} \left( {\frac{V}{{V_{0} }}} \right) + K_{pp} + K_{p1} \left( {\frac{V}{{V_{0} }}} \right)^{{n_{pv1} }} \left( {1 + n_{pf1} \left( {f - f_{0} } \right)} \right) + K_{p2} \left( {\frac{V}{{V_{0} }}} \right)^{{n_{pv2} }} \left( {1 + n_{pf2} \left( {f - f_{0} } \right)} \right)$$
(6)
$$\frac{Q}{{Q_{0} }} =\, K_{qz} \left( {\frac{V}{{V_{0} }}} \right)^{2} + K_{qi} \left( {\frac{V}{{V_{0} }}} \right) + K_{qp} + K_{q1} \left( {\frac{V}{{V_{0} }}} \right)^{{n_{qv1} }} \left( {1 + n_{qf1} \left( {f - f_{0} } \right)} \right) + K_{q2} \left( {\frac{V}{{V_{0} }}} \right)^{{n_{qv2} }} \left( {1 + n_{qf2} \left( {f - f_{0} } \right)} \right)$$
(7)
$$K_{pz} =\, 1 - \left( {K_{pi} + K_{pp} + K_{p1} + K_{p2} } \right)$$
(8)
where P and Q are the active power and reactive power, respectively, Subscript ‘0’ identifies the value of respective variable at the initial operating condition, \(K_{pz}\), \(K_{qz}\) are the constant impedance component for active power and reactive power, respectively, \(K_{pi}\), \(K_{qi}\) are the constant current component for active power and reactive power, respectively, \(K_{p} n_{pv}\), \(K_{q} n_{qv}\) are the constant power component for active power and reactive power, respectively.
Equations 9 and 10 describe the d-axis and q-axis reference frame current, respectively, where Eq. 11 represents the change in d-axis reference frame current with respect to the parameter of load. These equations give the interrelationship between the current, voltage and power for the static load.
$$I_{d} = P\left( {\frac{{V_{d} }}{{V^{2} }}} \right) + Q\left( {\frac{{V_{q} }}{{V^{2} }}} \right)$$
(9)
$$I_{q} = P\left( {\frac{{V_{q} }}{{V^{2} }}} \right) - Q\left( {\frac{{V_{d} }}{{V^{2} }}} \right)$$
(10)
$$\begin{aligned} \Delta I_{d} & = \,\left[ {\frac{{V_{d0}^{2} }}{{V_{0}^{4} }}P_{0} a + \frac{{V_{q0} V_{d0} }}{{V_{0}^{4} }}Q_{0} b + \frac{{P_{0} }}{{V_{0}^{2} }} + \left( { - \frac{2}{{V_{0}^{4} }}} \right)\left( {P_{0} V_{d0}^{2} + Q_{0} V_{d0} V_{q0} } \right)} \right]\Delta V_{d} \\ & \quad + \left[ {\frac{{V_{q0}^{2} }}{{V_{0}^{4} }}Q_{0} b + \frac{{V_{d0} V_{q0} }}{{V_{0}^{4} }}P_{0} a + \frac{{Q_{0} }}{{V_{0}^{2} }} + \left( { - \frac{2}{{V_{0}^{4} }}} \right)\left( {P_{0} V_{q0} V_{d0} + Q_{0} V_{q0}^{2} } \right)} \right]\Delta V_{q} + \left[ {\frac{{P_{0} V_{d0} }}{{V_{0}^{2} }}c + \frac{{Q_{0} V_{q0} }}{{V_{0}^{2} }}d} \right]\Delta f \\ \end{aligned}$$
(11)
The dynamics of d-axis reference framed load with the variable voltages, current, active power and reactive power is represented by Eqs. 12, 13 and 14 as given below
$$Y_{1} = \frac{1}{{V_{0}^{2} }}\left[ {\frac{{V_{d0}^{2} }}{{V_{0}^{2} }}P_{o} a + \frac{{V_{q0} V_{d0} }}{{V_{0}^{2} }}Q_{0} b + P_{0} + \left( {P_{0} V_{d0}^{2} + Q_{0} V_{d0} V_{q0} } \right)\left( { - \frac{2}{{V_{0}^{4} }}} \right)} \right]$$
(12)
$$Y_{2} = \frac{1}{{V_{0}^{2} }}\left[ {\frac{{V_{q0}^{2} }}{{V_{0}^{2} }}Q_{o} b + \frac{{V_{q0} V_{d0} }}{{V_{0}^{2} }}P_{0} a + Q_{0} + \left( {P_{0} V_{q0} V_{d0} + Q_{0} V_{q0}^{2} } \right)\left( { - \frac{2}{{V_{0}^{4} }}} \right)} \right]$$
(13)
$$Y_{f1} = \frac{1}{{V_{0}^{2} }}\left[ {P_{0} V_{d0} c + Q_{0} V_{q0} d} \right]$$
(14)
where a and c represent the coefficients of active power which describes the constant power, constant current and constant impedance coefficients for active power, b and d represent the coefficients of reactive power which describes the constant power, constant current and constant impedance coefficients for reactive power.
These constants in terms of static characteristics of load are expressed by Eqs. 15–18 as presented given below,
$$a = 2K_{pz} + K_{pi} + K_{p1} n_{pv1} + K_{p2} n_{pv2}$$
(15)
$$b = 2K_{qz} + K_{qi} + K_{q1} n_{qv1} + K_{q2} n_{qv2}$$
(16)
$$c = K_{p1} n_{pf1} + K_{p2} n_{pf2}$$
(17)
$$d = K_{q1} n_{qf1} + K_{q2} n_{qf2}$$
(18)
where \(K_{pp}\), \(K_{qp}\), Kp1, Kp2, Kq1, Kq2, npv1, npv2, nqv1, nqv2 are the static characteristics of the load.
Equation 19 represents the change in q-axis reference frame current with respect to the parameter of load. The dynamics of d-axis reference framed load with the variables such as voltages, current, active power and reactive power is represented by Eqs. 20, 21 and 22.
$$\begin{aligned} \Delta I_{q} & = \left[ {\frac{{V_{q0}^{2} }}{{V_{0}^{4} }}P_{0} a - \frac{{V_{d0} V_{q0} }}{{V_{0}^{4} }}Q_{0} b + \frac{{P_{0} }}{{V_{0}^{2} }} + \left( { - \frac{2}{{V_{0}^{4} }}} \right)\left( {P_{0} V_{q0}^{2} - Q_{0} V_{q0} V_{d0} } \right)} \right]\Delta V_{q} \\ & \quad + \left[ {\frac{{V_{d0} V_{q0} }}{{V_{0}^{4} }}P_{0} a - \frac{{V_{q0}^{2} }}{{V_{0}^{4} }}Q_{0} b - \frac{{Q_{0} }}{{V_{0}^{2} }} + \left( { - \frac{2}{{V_{0}^{4} }}} \right)\left( {P_{0} V_{q0} V_{d0} + Q_{0} V_{d0}^{2} } \right)} \right]\Delta V_{d} + \left[ {\frac{{P_{0} V_{q0} }}{{V_{0}^{2} }}c - \frac{{Q_{0} V_{d0} }}{{V_{0}^{2} }}d} \right]\Delta f \\ \end{aligned}$$
(19)
$$Y_{3} = \frac{1}{{V_{0}^{2} }}\left[ {\frac{{V_{q0} V_{d0} }}{{V_{0}^{2} }}P_{0} a - \frac{{V_{d0}^{2} }}{{V_{0}^{2} }}Q_{o} b + Q_{0} + \left( {P_{0} V_{d0} V_{q0} - Q_{0} V_{d0}^{2} } \right)\left( { - \frac{2}{{V_{0}^{4} }}} \right)} \right]$$
(20)
$$Y_{4} = \frac{1}{{V_{0}^{2} }}\left[ {\frac{{V_{q0}^{2} }}{{V_{0}^{2} }}P_{o} a - \frac{{V_{q0} V_{d0} }}{{V_{0}^{2} }}Q_{0} b + P_{0} + \left( {P_{0} V_{q0}^{2} - Q_{0} V_{q0} V_{d0} } \right)\left( { - \frac{2}{{V_{0}^{4} }}} \right)} \right]$$
(21)
$$Y_{f2} = \frac{1}{{V_{0}^{2} }}\left[ {P_{0} V_{q0} c - Q_{0} V_{d0} d} \right].$$
(22)
Dynamic load
In most of the system’s static load are considered, but load changes with respect to changes in system parameters hence dynamic load model study is important. The equations given below describe the modelling of induction motor, whose dynamics changes to the variables of induction motor such as current, flux, frequency, etc.
$$\frac{1}{{\omega_{\text{b}} }}\frac{{{\text{d}}\varphi_{ds} }}{{{\text{d}}t}} = - R_{\text{s}} i_{ds} + \frac{\omega }{{\omega_{\text{b}} }}\varphi_{qs} + v_{ds}$$
(23)
$$\frac{1}{{\omega_{\text{b}} }}\frac{{{\text{d}}\varphi_{dr} }}{{{\text{d}}t}} = - R_{\text{r}} i_{dr} + \frac{{\omega - \omega_{\text{r}} }}{{\omega_{\text{b}} }}\varphi_{ds} + v_{dr}$$
(24)
$$\frac{1}{{\omega_{\text{b}} }}\frac{{{\text{d}}\varphi_{qs} }}{{{\text{d}}t}} = - R_{\text{s}} i_{qs} - \frac{\omega }{{\omega_{\text{b}} }}\varphi_{ds} + v_{qs}$$
(25)
$$\frac{1}{{\omega_{\text{b}} }}\frac{{{\text{d}}\varphi_{qr} }}{{{\text{d}}t}} = - R_{\text{r}} i_{qr} + \frac{{\omega - \omega_{\text{r}} }}{{\omega_{\text{b}} }}\varphi_{qr} + v_{qr}$$
(26)
$$\varphi_{ds} = \left( {X_{\text{s}} + X_{\text{m}} } \right)i_{ds} + X_{\text{m}} i_{dr}$$
(27)
$$\varphi_{dr} = X_{\text{m}} i_{ds} + \left( {X_{\text{r}} + X_{\text{m}} } \right)i_{dr}$$
(28)
$$\varphi_{qs} = \left( {X_{\text{s}} + X_{\text{m}} } \right)i_{qs} + X_{\text{m}} i_{qr}$$
(29)
$$\varphi_{qr} = X_{\text{m}} i_{qs} + \left( {X_{\text{r}} + X_{\text{m}} } \right)i_{qr}$$
(30)
$$T_{\text{e}} = \varphi_{\text{qr}} i_{\text{dr}} - \varphi_{\text{dr}} i_{\text{qr}}$$
(31)
$$T_{\text{m}} = T_{0} \left( {\frac{{\omega_{\text{r}} }}{{\omega_{\text{b}} }}} \right)^{\beta }$$
(32)
$$\mathop {X_{\text{IM}} }\limits^{ \cdot } = A_{\text{IM}} X_{\text{IM}} + B_{{ 1 {\text{IM}}}} \Delta V + B_{{ 2 {\text{IM}}}} \Delta \omega$$
(33)
$$y = C_{\text{IM}} X_{\text{IM}}$$
(34)
Here, state variable \(X_{\text{IM}} , \, \Delta V\) and \(y\) are represented by the following equation
$$X_{\text{IM}} = \left[ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {\Delta i_{\text{ds}} } \\ {\Delta i_{\text{dr}} } \\ \end{array} } \\ {\Delta i_{\text{qs}} } \\ {\Delta i_{\text{qr}} } \\ {\Delta \omega_{\text{r}} } \\ \end{array} } \right],\quad \Delta V = \left[ {\begin{array}{*{20}c} {\Delta V_{\text{ds}} } \\ {\Delta V_{\text{qs}} } \\ \end{array} } \right],\quad y = \left[ {\begin{array}{*{20}c} {\Delta i_{\text{ds}} } \\ {\Delta i_{\text{qs}} } \\ \end{array} } \right]$$
(35)
where \(T_{\text{e}}\) is the electrical torque, Tm is mechanical torque, \(\varphi_{\text{ds}} , \, \varphi_{\text{dr}} , \, \varphi_{\text{qr}}\), \(\varphi_{dr}\) are the flux linkages for stator and rotor, \(i_{dr}\), \(i_{ds}\), \(i_{\text{qs}}\), \(i_{\text{qr}}\) are the currents through stator and rotor of induction motor, \(X_{\text{IM}}\) are the state variables of induction motor, ωb is the base angular speed, ∆ωr is the rotor frequency, AIM is the state matrix of induction motor, B1IM, B2IM, CIM are the inputs for induction motor, Rs and Rr are stator and rotor resistances, respectively, Xs is stator leakage reactance and Xm is the magnetizing reactance and \(\Delta V\) is voltages of the induction motor with DQ reference frame.
Network model
The source model and load model are interlinked by using network model. For stability analysis of network model, RL network is considered [16]. The equations given below describe the dynamics of the network with line resistance, inductance and the bus voltages.
$$\frac{{{\text{d}}i_{\text{lineD1}} }}{{{\text{d}}t}} = - \frac{{r_{\text{line1}} }}{{L_{\text{line1}} }}i_{\text{lineD1}} + \omega i_{\text{lineQ1}} + \frac{1}{{L_{\text{line1}} }}V_{bD1} - \frac{1}{{i_{\text{line1}} }}V_{bD2}$$
(36)
$$\frac{{{\text{d}}i_{\text{lineQ1}} }}{{{\text{d}}t}} = - \frac{{r_{\text{line1}} }}{{L_{\text{line1}} }}i_{\text{lineQ1}} + \omega i_{\text{lineD1}} + \frac{1}{{L_{\text{line1}} }}V_{\text{bQ1}} - \frac{1}{{i_{\text{line1}} }}V_{\text{bQ2}}$$
(37)
$$\frac{{{\text{d}}i_{\text{lineD2}} }}{{{\text{d}}t}} = - \frac{{r_{\text{line2}} }}{{L_{\text{line2}} }}i_{\text{lineD2}} + \omega i_{\text{lineQ2}} + \frac{1}{{L_{\text{line2}} }}V_{\text{bD2}} - \frac{1}{{i_{\text{line1}} }}V_{\text{bD3}}$$
(38)
$$\frac{{{\text{d}}i_{\text{lineQ2}} }}{{{\text{d}}t}} = - \frac{{r_{\text{line2}} }}{{L_{\text{line2}} }}i_{\text{lineQ2}} + \omega i_{\text{lineD2}} + \frac{1}{{L_{\text{line2}} }}V_{\text{bQ2}} - \frac{1}{{i_{\text{line1}} }}V_{\text{bQ3}}$$
(39)
Equations. 40 and 41 give the state space model for network 1and network 2, respectively.
$$\mathop {\left[ {\begin{array}{*{20}c} {\Delta i_{\text{lineD1}} } \\ {\Delta i_{\text{lineQ1}} } \\ \end{array} } \right]}\limits^{ \cdot } = A_{\text{NET1}} \left[ {\begin{array}{*{20}c} {\Delta i_{\text{lineD1}} } \\ {\Delta i_{\text{lineQ1}} } \\ \end{array} } \right] + B_{{ 1 {\text{NET1}}}} \Delta V_{\text{b}} + B_{{ 2 {\text{NET1}}}} \left[ {\Delta \omega } \right] ,$$
(40)
$$\mathop {\left[ {\begin{array}{*{20}c} {\Delta i_{\text{lineD2}} } \\ {\Delta i_{\text{lineQ2}} } \\ \end{array} } \right]}\limits^{ \cdot } = A_{\text{NET2}} \left[ {\begin{array}{*{20}c} {\Delta i_{\text{lineD2}} } \\ {\Delta i_{\text{lineQ2}} } \\ \end{array} } \right] + B_{{ 1 {\text{NET2}}}} \, \Delta V_{\text{b}} + B_{{ 2 {\text{NET2}}}} \left[ {\Delta \omega } \right]$$
(41)
Here, variable \(\Delta V_{\text{b}}\) are represented by the following equation
$$\Delta V_{\text{b}} = \left[ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {V_{\text{bD1}} } \\ {V_{\text{bQ1}} } \\ {V_{\text{bD2}} } \\ \end{array} } \\ {\begin{array}{*{20}c} {V_{\text{bQ2}} } \\ {V_{\text{bD3}} } \\ {V_{\text{bQ3}} } \\ \end{array} } \\ \end{array} } \right]$$
(42)
where \(A_{\text{NET}}\) is state matrix of the network, \(\omega\) is the frequency, \(r_{\text{line}}\) is the line resistance, \(L_{\text{line}}\) is the line inductance, B1NET1, B1NET2, B2NET1, B2NET2 are the input matrices for network, \(\Delta i\) represents the state variables in the form of current and \(\Delta V_{b}\) are the components of bus voltages.