# Fault Location and Restoration of Microgrids via Particle Swarm Optimization
## 4 Proposed Service Restoration Approach  
MGs are capable of grid-tied and islanding operations integrated with DGs and loads. Therefore, electricity service restoration can be divided into two operation modes. Regardless of the operation mode, service restoration is aimed at reducing the out-of-service un-faulted zone and then minimizing its effect. Consequently, the service restoration problem can be described as the minimization of a multi-objective non-linear problem that is composed of the loss of load service, the number of switch operations, and power loss, as shown in Equation (17).  
\[\min F\ =\ w_{1}\times\frac{P_{loss-service}-P_{loss-service}^{\min}}{P_{loss- service}^{\max}-P_{loss-service}^{\min}}+w_{2}\times\frac{n_{ops}-n_{ops}^{\min}}{n_{ops}^{ \max}-n_{ops}^{\min}}+w_{3}\times\frac{P_{loss}-P_{loss}^{\min}}{P_{loss}^{ \max}-P_{loss}^{\min}} \tag{17}\]  
subject to  
\[w_{1}+w_{2}+w_{3}\ =\ 1 \tag{18}\]  
\[I\leq I^{\max} \tag{19}\]  
\[V^{\min}\leq V\leq V^{\max} \tag{20}\]  
where \(P_{loss-service}\) denotes the loss of load service; \(n_{ops}\) represents the number of switch operations; \(P_{loss}\) denotes the system power loss; \(w_{i}\) denotes a weighting factor that can be adjusted for the requirement; \(I^{\max}\) is the ampere capacity of the conductor; and \(V^{\min}\) and \(V^{\max}\) represent the lower and upper limits of bus voltage, respectively. The related parameters of the objective function and constraints are set to \(w_{1}\) = 0.2, \(w_{2}\) = 0.1, and \(w_{3}\) = 0.7. Furthermore, the lower and upper limits of the bus voltage are 0.95-1.05 pu, and the ampere capacity is 300 A.  
By applying the PSO algorithm to solve the proposed service restoration approach, the A matrix is built according to the switch status and must be transferred to the PSO algorithm to obtain the corresponding network topology. The power flow algorithm is used to compute the specified network topology, and the value of the proposed function of each particle is obtained. PSO, which is a combination of the _pbest_ and _gbest_, allows a particle to quickly and correctly adjust, thereby resulting in rapid convergence using Equations (21)-(25).  
\[V_{n}^{k+1}\ =\ V_{n}^{k}+c_{1}\times rand_{1}\times(pbest_{n}^{k}-s_{n}^{k}) \tag{21}\]  
\[V_{n}^{k+1}\ =\ V_{n}^{k}+c_{2}\times rand_{2}\times(gbest^{k}-s_{n}^{k}) \tag{22}\]  
\[V_{n}^{k+1}\ =\ w\times V_{n}^{k}+c_{1}\times rand_{1}\times(pbest_{n}^{k}-s_{n}^{k}) +c_{2}\times rand_{2}\times(gbest^{k}-s_{n}^{k}) \tag{23}\]  
\[s_{n}^{k+1}\ =\ s_{n}^{k}+v_{n}^{k+1} \tag{24}\]  
\[w\ =\ w_{\max}-(w_{\max}-w_{\min})\times\frac{k}{k_{\max}} \tag{25}\]  
where \(V_{n}^{k}\) denotes the velocity of the \(n\)th particle at the \(k\)th iteration; \(s_{n}^{k}\) represents the \(k\)th position of the \(n\)th particle; the learning factors are represented as \(c_{1}\) and \(c_{2}\); the random numbers of \(rand_{1}\) and \(rand_{2}\) are between 0 and 1; \(pbest_{n}^{k}\) denotes the best value of the \(n\)th particle at the \(k\)th iteration; and \(gbest^{k}\) denotes the global best value at the \(k\)th iteration. \(w_{max}\), and \(w_{min}\) are the maximum and minimum of the inertia weighting value, respectively, which are set to \(w_{max}\) = 0.9, \(w_{min}\) = 0.2, so in Equation (25) this means that the weighting value of inertial velocity is decreased from 0.9 to 0.2; \(n\) denotes the particle number; and \(k_{max}\) denotes the maximum iteration. In this study, the related parameters of PSO were set to \(n\) = 500; the maximum iteration number was 200; \(c_{1}\) = 2, and \(c_{2}\) = 2. The detailed solution procedure of the service restoration is illustrated in Figure 4.