## 3 Three-Phase Unbalanced Distribution Network Fault Location Algorithm
### Fault Location Algorithm
A common method for solving fault state variables is the least squares estimation algorithm, which establishes the objective function according to the weighted least squares principle:  
\[J(x)=(z-Hx)^{T}W(z-Hx) \tag{15}\]  
Take the derivative of the objective function and take it to zero, that is:  
\[\frac{\partial J(x)}{\partial x}=0 \tag{16}\]  
Solve the above equation to get the x value and write it in matrix form:  
\[\hat{x}=\left(H^{T}R^{-1}H\right)^{-1}H^{T}R^{-1}z \tag{17}\]  
where \(\hat{x}\) is the estimated value of the state quantity; \(H^{T}R^{-1}H\) is the information matrix; \(W=R^{-1}\) is the measurement error variance matrix, and its elements are:  
\[R_{i}^{-1}=\frac{1}{\sigma_{i}^{2}} \tag{18}\]  
where \(\sigma\) is the standard deviation of the measurement error. When the node \(k\) is assumed to be a virtual fault node, variable \(\Delta I_{k}^{\theta}\) in \(\Delta I^{\theta^{\prime}}\) in Equation (14) is taken as a separate quantity to be calculated, and the coefficient matrix \(H\) is adjusted to obtain the virtual fault state equation:  
\[ \begin{bmatrix}\Delta U_{1}^{\theta}\\ \Delta U_{2}^{\theta}\\ \vdots\\ \Delta U_{m}^{\theta}\end{bmatrix} =H^{\prime\prime}\cdot \begin{bmatrix}\Delta U _{DG1}^{\theta}\\ \Delta U_{DG2}^{\theta}\\ \vdots\\ \Delta U_{DG\ s}^{\theta}\\ \Delta I_{k}^{\varphi}\end{bmatrix}  \tag{19}\]  
Since \(m>s+1\), Equation (19) is an overdetermined equation. The least squares method is used to calculate the residual value of the equation, which is small when the virtual fault point agrees with the actual fault point, and large when the virtual fault point differs from the actual fault point. The fault section can then be identified. The voltage of the fault phase where the ground fault occurs will decrease, while the voltage of the non-fault phase will increase, allowing for the location of the fault section. The variations in each phase's voltage in the fault section can be used to identify the fault phase. This indicates that the fault phase is the phase whose voltage decreases while the voltage of the other two phases increases. The fault phase is also the two phases or the three phases if the voltage in those phases decreases. At the same time, a suitable threshold should be set when determining whether the voltage increases or decreases due to measurement errors. Therefore, the location of the distribution network fault sections considering the data of the distribution power supply area proposed in this paper is divided into the five following steps. 1. The coefficient matrix of the state equation is determined according to the distribution network structure, line parameters, and the configuration of the intelligent terminal. 2. Using the fault detection algorithm to determine the moment of fault occurrence;
3. The fault injection current is then calculated using the voltage measurement values before and after the fault occurs;
4. Use the least squares method to calculate the residual error of the virtual fault state equation. Then, identify faulty segments based on residual size;
5. Determine the fault type according to the three-phase voltage change of the fault section. The basic process is shown in Figure 3.