# Fault Location and Restoration of Microgrids via Particle Swarm Optimization
## 3 Derivation of Fault Location Approach
### Fault Location Algorithm Based on \(Z_{Bus}\)  
The proposed fault location algorithm uses the bus voltage variation, which is caused by the fault current contributed by the upstream utility grid, and distributed energy resources to determine fault locations. A fast \(Z_{Bus}\) modified algorithm based on the _BIBC_ and _BCBV_ matrices is necessary for the rigid computation of the bus voltage variations before and after the occurrence of a fault. Therefore, \(Z_{Bus}\) can be built by using Equation (3) according to the pre-fault network topology. \(Z_{Bus}\) needs to be modified when a short-circuit fault occurs at bus \(k\). We assumed that the MGs are equipped with measuring devices placed at the output terminals of each DG unit. During fault conditions, the values of zero-sequence, positive-sequence, and negative-sequence voltages and currents are recorded by the measuring devices and can be used to obtain the zero-, positive-, and negative-sequence. Thevenin impedances of the DGs [27], respectively. The phase frame impedance of the DGs is calculated by using Equation (8), where \(a~{}=~{}e^{\frac{2\pi}{3}}\), \(Z_{S}\) is the sequence impedance. The derived Thevenin impedances of all DGs are added as branches from the connected buses to the reference bus. Consequently, \(Z_{Bus}\) can be modified according to the minor changes in the _BIBC_ and _BCBV_ matrices. \[Z_{abc}~{}=~{}\left( \begin{array}{ccc}Z_{Sa}&Z_{Sab}&Z_{Sac}\\ Z_{Sba}&Z_{Sb}&Z_{Shc}\\ Z_{Sca}&Z_{Scb}&Z_{Scc}\end{array} \right)~{}=~{}\frac{1}{3}\left( \begin{array} []{ccc}1&1&1\\ 1&a&a^{2}\\ 1&a^{2}&a\end{array} \right)\left( \begin{array}{ccc}Z_{S}{}^{(0)}&0&0\\ 0&Z_{S}{}^{(1)}&0\\ 0&0&Z_{S}{}^{(2)}\end{array} \right)\left( \begin{array}{ccc}1&1&1\\ 1&a^{2}&a\\ 1&a&a^{2}\end{array} \right) \tag{8}\]  
While a three-phase short-circuit fault occurs at bus \(j\), the bus voltage can be expressed as the pre-fault voltage plus the voltage deviation caused by the fault current by Equation (9). The voltage at faulted bus \(j\) can be obtained by Equation (10) and can also be derived by multiplying the fault current by the fault impedance as shown in Equation (11). \[ \begin{bmatrix}V_{1}^{abc}(F)\\ \vdots\\ V_{j}^{abc}(F)\\ \vdots\\ V_{n}^{abc}(F)\end{bmatrix} ~{}=~{} \begin{bmatrix}V_{1}^{abc}(0)\\ \vdots\\ V_{j}^{abc}(0)\\ \vdots\\ V_{n}^{abc}(0)\end{bmatrix} + \begin{bmatrix}Z_{11}^{abc}&\cdots&Z_{1j}^{abc}& \cdots&Z_{1n}^{abc}\\ \vdots&\ddots&\vdots&\ddots&\vdots\\ Z_{n1}^{abc}&\cdots&Z_{nj}^{abc}&\cdots&Z_{nn}^{abc}\end{bmatrix}\begin{bmatrix} 0\\ \vdots\\ -I_{j}^{abc}(F)\\ \vdots\\ 0\end{bmatrix}  \tag{9}\]  
\[V_{j}^{abc}(F)~{}=~{}V_{j}^{abc}(0)-Z_{jj}^{abc}I_{j}^{abc}(F) \tag{10}\]  
\[V_{j}^{abc}(F)~{}=~{}Z_{f}^{abc}I_{j}^{abc}(F) \tag{11}\]  
Therefore, the fault current can be obtained from Equations (10) and (11), as shown in Equation (12), for the three-phase bolted fault. \(Z_{f}^{abc}~{}=~{}0\), and \(V_{j}^{abc}(F)~{}=~{}0\). \[I_{j}^{abc}(F)~{}=~{}\frac{V_{j}^{abc}(0)}{Z_{jj}^{abc}+Z_{f}^{abc}} \tag{12}\]  
where  
\(V_{j}^{abc}(0)\) is the pre-fault three-phase voltage at bus \(j\),  
\(I_{j}^{abc}(F)\) is the fault three-phase current from bus \(j\) to the ground,  
\(Z_{jj}^{abc}\) is the equivalent three-phase impedance from bus j and can be obtained from \(Z_{Bus}\),  
\(Z_{f}^{abc}\) is the three-phase fault impedance. Using Equation (12), the bus voltage derivation at bus \(i\) due to a fault at bus \(j\) is expressed as Equation (13). \[\Delta V_{i-j}^{abc}~{}=~{}Z_{bus}(i,\,j)\times I_{j}^{abc}(F) \tag{13}\]The three-phase bus voltage derivation at all DG buses for the assumed fault location can be calculated by Equation (13). The first step of the proposed algorithm is to calculate the voltage error at each bus, as shown in Equation (14). The voltage error at bus \(j\) is expressed as the norm of the difference between the voltage derivation and the value of the measured voltage.