# Optimal Coordination of Over-Current Relays in Microgrids Using Unsupervised Learning Techniques
## 4 Methodology  
Initially, the microgrid under study is modeled and several simulations are carried out in order to characterize its behavior. In this step, information regarding short-circuit currents that are seen by the relays for a set of operative scenarios and faults is obtained. In this case, three-phase faults were considered in the middle of the lines. However, other types of faults and locations can be considered, which may result in different settings of the DOCRs. It is worth mentioning that every system operator determines the type of faults and locations to be evaluated beforehand in order to establish the protection coordination scheme. From the results of the aforementioned simulations, a cluster analysis is performed when considering several operative scenarios using the machine learning algorithms described in Section 3. Subsequently, the optimal coordination of DOCRs is performed for each cluster that was obtained by the machine learning algorithms. A genetic algorithm (GA) is used in this step. Nonetheless, is worth mentioning that any other metaheuristic technique can be implemented in this step. Finally, while taking the results  
Figure 3: Illustration of hierarchical clustering.  
of the DOCRs coordination and the defined clusters into account, a heuristic is applied for improving the coordination. Figure 4 depicts the flowchart of the proposed methodology. Each of the steps is described in detail below.  
A short-circuit analysis is first performed in all operative scenarios to perform the clustering. In each operative scenario, each fault current that is seen by each relay of the system is taken, according to the established faults. Once it is established, the database with all of the fault currents that are seen by the relays, the clustering is carried out with each of the automatic learning techniques described in the document. In all of the automatic learning methods implemented, clustering is carried out from the fault currents that are seen by the relays in all operating scenarios. In the particular case of the K-means technique, the clustering is carried out, taking, as a starting point, a centroid that essentially depends on the fault currents seen by the relays.  
Once the clusters are defined, in order to identify the coordination of each one, the previously established fault currents are considered and the coordination is evaluated while taking into account the fault current seen by each relay in all the scenarios found in the cluster, while using the GA. The above process is repeated for each cluster.  
As already mentioned, the GA is in charge of coordinating each cluster based on the fault currents that are seen by each relay in the operating scenarios present in the cluster.  
Figure 4: Flowchart of the proposed methodology.  
In order to carry out this coordination, the initial individuals of the population are defined randomly, while considering the constraints of the decision variables. In this problem, the individuals are the variables that are to be adjusted in each relay of the system. The GA considers the operating times of all relays as the objective function. What is sought in this case is to reduce operating times, ensuring that the constraints that are presented in the formulation are met.  
There are different stopping criteria in the steps of the methodology. In the general methodology, the first one is that there are no coordination violations between relays. The second one is that the maximum number of clusters allowed is reached (this is defined according to the characteristics of the commercial relay that is being used, depending on the maximum number of groups of settings that it has enabled). In the case of the GA, a maximum number of iterations was defined as the stopping criterion (2000 iterations for the test system used).