The main purpose of the stability controller is to give out a variable inertia of the PV-VSG, thus the transient energy of the power system will attenuate and the power grid with PVs will recover to a stable state after the disturbance. This section will analyze the transient energy of the power system after the fault and obtains the relation between the virtual inertia of the VSG and the transient energy. According to the above relation, the virtual inertia control strategy of the PV-VSG is designed to make the transient energy decay to zero after disturbance.

### Transient energy function (TEF)

A two-area power system is shown in Fig. 4. According to [2], the TEF can be used as a measurement of the unbalanced power when the power system is under disturbance. The transient energy (TE) of the power system is defined as follows:

$$ \mathrm{TE}=\frac{1}{2}{\omega}_{AB}^2-\underset{\delta_{AB0}}{\overset{\delta_{AB}}{\int }}\left[\frac{\left({P}_{A0}-{P}_A\right)}{J_A}-\frac{\left({P}_{B0}+{P}_B\right)}{J_B}\right]d{\delta}_{AB} $$

(3)

where *δ*
_{
AB
} and *ω*
_{
AB
} denote the difference in power angles and angular speed between the center of inertia (COI) of areas A and B, respectively. *P*
_{
A0} and *P*
_{
B0}are the intimal differences between the total power generation and consumption in the two areas. *P*
_{
A
} and *P*
_{
B
} are the transmission power as shown in Fig. 4. *J*
_{
A
} and *J*
_{
B
} denote the moment of inertia of the two areas.

In (3), the first and second terms are the transient kinetic energy (TKE) and the transient potential energy (TPE), respectively. When a fault occurs, the power system will oscillate correspondingly. The transient KE and transient PE will transform mutually, however, their sum, the total OTEF will remain constant for a zero-damped oscillation. Hence the TEF descent method can be proposed to design an inertia controller to dissipate the unbalanced energy and suppress the power oscillation. Thus the power system recoveries to a stable state after fault quickly.

### TEF descent method

As shown in Fig. 5, the transmission power of the tie line will oscillate after a disturbance. For one cycle of the power oscillation, it could be divided into the following four phases.

Phase I is the backward acceleration phase. In this phase, the difference of the angular speed*ω*
_{
AB
} between the two areas is less than zero and the differential rate of *ω*
_{
AB
} is also less than zero. As a result, *ω*
_{
AB
} will decrease from zero to a minimum value *ω*
_{
ABmin} and *δ*
_{
AB
} will also decrease. The transmission power of the tie line will decrease to the minimum value, and the power change of the transmission power Δ*P*
_{
A
} will increase from zero to the maximum value as shown in Fig. 5 during the time from *t*
_{
a
} to *t*
_{
b
}.

Phase II is the backward deceleration phase. As shown in Fig. 5 during the time from *t*
_{
b
} to *t*
_{
c
}, *dω*
_{
AB
}/*dt* > 0 and *ω*
_{
AB
}will increase from the minimum value to zero. The difference of the angular speed satisfies *ω*
_{
ABmin} < *ω*
_{
AB
} < 0.

Phase III is the forward acceleration phase. During the time from *t*
_{
b
} to *t*
_{
c
}, the differential rate of *ω*
_{
AB
} keeps larger than zero. Thus the difference of the angular speed *ω*
_{
AB
} between the two areas will across zero to be positive and will reach the maximum value. That means 0 < *ω*
_{
AB
} < *ω*
_{
ABmax} and *dω*
_{
AB
}/*dt* > 0.

Phase IV is the forward deceleration phase. In this phase, during the time *t* ∈ [*t*
_{
d
}, *t*
_{
e
}] as shown in Fig. 5, 0 < *ω*
_{
AB
} < *ω*
_{
ABmax} and *dω*
_{
AB
}/*dt* < 0.

For the four phases, the TPE and the TKE will convict to each. If the damping of the power system is zero, the TEF of the power system will keep constant. After one cycle the TPE and the TKE will return to its initial state. The TPE at the time *t*
_{
e
} could be calculated from the TPE at the time *t*
_{
a
} by the following equation.

$$ {\displaystyle \begin{array}{l}\mathrm{TPE}\left({t}_e\right)=\mathrm{TPE}\left({t}_a\right)\\ {}\kern4.61em -\underset{\delta_{AB\left({t}_a\right)}}{\overset{\delta_{AB\left({t}_e\right)}}{\int }}-\left[\frac{\left({P}_{A0}-{P}_A\right)}{J_A}-\frac{\left({P}_{B0}+{P}_B\right)}{J_B}\right]d{\delta}_{AB}\end{array}} $$

(4)

If we assuming that the damping of the power grid is zero, the TPE at the time *t*
_{
a
} and *t*
_{
e
} will equal to each other. That meansOPE(*t*
_{
e
}) = OPE(*t*
_{
a
}), and we could obtain:

$$ \underset{\delta_{AB\left({t}_a\right)}}{\overset{\delta_{AB\left({t}_e\right)}}{\int }}\left[\frac{1}{J_A}\left({P}_{A0}-{P}_A\right)-\frac{1}{J_B}\left({P}_{B0}+{P}_B\right)\right]d{\delta}_{AB}=0 $$

(5)

Form (5), it could be easily found that if the inertia of the two areas could be controlled, the TPE of the power system could decent after one cycle, also the decreasing of the TE will follow. Since the inertia of the VSG is adjustable unlike SG, a suitable variable inertia control strategy of the VSG could be adopted to improving the transient stability of the power system. In this paper, we assume that the VSG is on the receiving side area B. If we want to make the TPE attenuate during one oscillation cycle, the following strategy could be designed. In phases I and II, (*P*
_{
B0} + *P*
_{
B
})*dδ*
_{
AB
} > 0, let \( \frac{1}{J_B^{\prime }}=\frac{1}{J_B}+\frac{1}{\Delta J} \); in phases III and IV, (*P*
_{
B0} + *P*
_{
B
})*dδ*
_{
AB
} < 0, let \( \frac{1}{J_B^{\prime }}=\frac{1}{J_B}-\frac{1}{\Delta J} \). Then the OPE at the time *t*
_{
e
} becomes:

$$ {\displaystyle \begin{array}{l}\mathrm{OPE}\left({t}_e\right)=\mathrm{OPE}\left({t}_a\right)\\ {}\kern4.5em +\underset{\delta_{AB\left({t}_a\right)}}{\overset{\delta_{AB\left({t}_c\right)}}{\int }}-\left[\frac{\left({P}_{A0}-{P}_A\right)}{J_A}-\left(\frac{1}{J_B}+\frac{1}{\Delta J}\right)\left({P}_{B0}+{P}_B\right)\right]d{\delta}_{AB}\\ {}\kern3.42em +\underset{\delta_{AB\left({t}_c\right)}}{\overset{\delta_{AB\left({t}_e\right)}}{\int }}-\left[\frac{\left({P}_{A0}-{P}_A\right)}{J_A}-\left(\frac{1}{J_B}-\frac{1}{\Delta J}\right)\left({P}_{B0}+{P}_B\right)\right]d{\delta}_{AB}\end{array}} $$

(6)

Taking (5) into (6), the following equation could be gotten:

$$ \mathrm{TPE}\left({t}_e\right)=\mathrm{TPE}\left({t}_a\right)-\Delta \mathrm{TPE} $$

(7)

where:

$$ {\displaystyle \begin{array}{l}\Delta \mathrm{TPE}=\underset{\delta_{AB\left({t}_c\right)}}{\overset{\delta_{AB\left({t}_a\right)}}{\int }}\left[\frac{1}{\Delta J}\left({P}_{B0}+{P}_B\right)\right]d{\delta}_{AB}\\ {}+\underset{\delta_{AB\left({t}_c\right)}}{\overset{\delta_{AB\left({t}_e\right)}}{\int }}\left[\frac{1}{\Delta J}\left({P}_{B0}+{P}_B\right)\right]d{\delta}_{AB}\end{array}} $$

(8)

Since during the time from *t*
_{
a
}to *t*
_{
c
}, *dδ*
_{
AB
} < 0 and *P*
_{
B0} + *P*
_{
B
} < 0, the first term in (8) is larger than zero. The second term in (8) is also larger than zero because *dδ*
_{
AB
} and *P*
_{
B0} + *P*
_{
B
} are both larger than zero during the time from *t*
_{
c
} to *t*
_{
e
}. Thus with the control strategy proposed above, ΔTPE will be a positive value. The total TEF will descend continuously in every oscillation cycle and hence the unbalanced energy will be efficiently dissipated and the power swing will be effectively suppressed. The transient stability of the power system with high penetration PVs could be enhanced.

### Stability controller for the VSG

From the TEF analysis in TEF descent method, it is easy to found that when the difference of the angular speed*ω*
_{
AB
} between the two areas is large than zero, increasing the virtual inertia of the PV-VSG is beneficial for the stable of the power system. When *ω*
_{
AB
} < 0, decreasing the virtual inertia of the PV-VSG could improve the stability of the power system. According to this rule, a bang-bang control strategy of VSG’s moment of inertia is proposed. The control strategy is illustrated in Fig. 6. *J*
_{
vsg
} is the variable moment of inertia of the PV-VSG. It is consisted by the variable part Δ*J* and constant part *J*
_{con}. Δ*J* is a positive value, *ε* is a small value chosen to eliminate measurement errors. Since in phase I and II, the difference of the angular speed *ω*
_{
AB
} is large than zero, the inertia of the VSG will be increased by Δ*J*. The inertia of the VSG will be decreased by Δ*J* when *ω*
_{
AB
} < 0. By applying this control strategy, the transient energy of the PV power system will attenuate quickly after the disturbance. Thus the transient stability of the PV power system will be enhanced.