Real-Time Detection of Microgrid Islanding Considering Sources of Uncertainty using Type-2 Fuzzy Logic and PSO Algorithm

Background : Nowadays, in microgrids based on renewable energy resources (RESs), the uncertainties of load and power generation of distributed generation (DGs) resources is inevitable, which if not taken into account, will lead to errors in network analysis. Results : In this paper, a new method based on type-2 fuzzy logic isproposed to detect microgrid islanding; in whichthe power system does not misoperateduring complex operations, can correctly discriminate the microgrid islandingand other network events at the proper time, and prevent the undesirable performance of DGs. This controller detects islanding in the fastest time under different conditions, and the uncertainties in the system will not considerablyaffect the controller's performance. Conclusions : The proposed method is simulated on the sample system and examined in different scenarios. Then, a comparison is made in different conditions and scenarios between the suggested method and some common methods that have been presented so far to determine the ability of the proposed method to detect islanding.


Introduction
The disconnection of DGs along with a part of theload from the upstream network and operating as an independent network creates a concept known as the islanding phenomenon, which can happen intentionally or unintentionally.In case the islanding is predetermined and preplanned, it is easier to control the voltage and frequency beforehand; however, if the islandingoccurs unintentionally and during the connection of a heavy load, it will cause an imbalance in the system.The main problem in this situation is that the electric charge in the islanded sectionis very different from the generated electricity.Under these conditions, the voltage and frequency changes of the islanded section are slow and the protective devices will not be able to detect the formation of the island.Other disadvantages of this phenomenon and inability to identify it in the real time include endangering the safety personnel, reducing power quality, serious damage to DGs, damage to network loads due to voltage and frequency instability, and incoordinationof reconnecting DGs to the network.
Identifying the islanding status is an important issue in microgrids connection, which has been the subject of research in recent years.Necessary conditions for becoming an island in microgrids have been published in a number of standards, such as IEEE-1574 [1] and IEC-62116 [2].The methods of identifying islanding are generally divided into two categories: "remote" and "local" detection methods .Remote methods are based on telecommunication systems between the operator and DG, while local methods use information collected at DG locations.
Remote methods have a fast response time, lacka non-detection zone (NDZ), and are highly reliable.Nonetheless, the disadvantage of this method is the relatively high cost of their implementation and maintenance.
Local detection methods can be categorized into passive, active, hybrid, and intelligent methods, which operate by measuring SG parameters, such as voltage, current, frequency, and harmonic distortion on the microgrid side [5].Passive methods include under/overvoltage relays (UVR/OVR), under/over-frequency relays (UFR/OFR) [5], rate of change of frequency (ROCOF) [6], methods based on rate of change of active power (ROCOAP) and rate of change of reactive power (ROCORP) [7], a technique based on two criteria of transient index value (TIV) and positive sequence of current angle at common connection point [8], detection methods using signal processing techniques [9], methods based on unbalance voltage (UV) [2], methods based on total harmonic distortion (THD) [10], and methods based on differential transient rate of change of frequency (DTROCOF) [11].
In hybrid methods, the capabilities of active and passive methods have been used to detect islandingfaults.Ref. [26] presents a hybrid method based on the Gibbs phenomenon for identifying islands based on a combination of ROCOF methods at a given moment and measuring the THD.The hybrid method based on active and inactive algorithms that use the voltage phase angle (VPA) and the voltage unbalance (VU) is presented in [27].
Authors in [29] utilize a network impedance estimation method that uses resonant excitation when a fault occurs in the network.In [30], the hybrid method of islanding identification and priority-based load curtailment has been used in distribution networks in the presence of DG units.In [31], a hybrid islanding identification system is introduced based on an inverter that acts as a virtual synchronous generator.
Each of the protection methods has NDZs during islanding conditions.Determining a threshold value is also one of the major problems for passive methods.This is because if asmall value of threshold is considered, then the normal operation of the network and some switching conditions in the network will be mis-identified as islanding situations, and if a large value is selected, the islanding will not be detected in some cases.Uncertainty has also been less addressed in the proposed methods.
Over time, with the growth of intelligent methods, attention has been focused on using these methods to identify islandingcases.Examples of such methods include the decision-making tree (DT) [32], support vector machine (SVM) [33], artificial neural network (ANN) [34], fuzzy logic control (FLC) [35], and adaptive neuro-fuzzy inference system (ANFIS) [36], which are used to categorize different conditions.In [37], graph search method isemployed to determine the islanding operation of RESs and the main grid based on system configuration.A new method of islanding identification is proposed in [38] for photovoltaic systems (PVs) connected to the main grid using the maximum power point (MPP) tracking algorithm.In [39], morphological filters along with experimental modal analysis (EMD) have been used to implement islanding adaptive signal detection.
The previously introduced intelligent methods for islanding mode identification suffer from two important drawbacks: inability to identify the islanding mode in the short term and disregarding uncertainty in the power system.Some intelligent methods are unable to detect the islanding mode in a very short time due to the complex logic behind them.On the other hand, the methods that satisfy the time allowed for islanding identificationdo not take into account the various uncertainties that may arise in a microgrid.
In this paper, a new controller design is proposed to determine the islanding mode in the event of system uncertainty.The performance of this controller is based on the type-2 fuzzy logic.In general, the capabilities of this method are summarized as follows: • They do not misoperate in complex operations of the power system.
• They candiscriminate the island mode from other network events in a short time.
• Uncertainties in the power system (uncertainty in load, system parameters, measuring devices, power generation in DGs) have little effect on the performance of the controller.
The organization of thepaper is as follows.Section 2describes the system under study.Uncertainty modeling in microgrids is given in Section 3. Section 4 of the paper introduces the proposed method to identify the islandingmode.Simulation results are provided in Section 5 and finally, conclusions and suggestions are given in Section 6.

The system under study
The block diagram of the system under study is presented in Fig. 1.The system has four buses, two power sources including a wind turbine in bus 1 and solar panels installed in bus 2. Other specifications of the studied network are listed in Table 1.Fig. 1.The system under study [40] The line between buses 1 and 3 and the line between buses 2 and 3 has a resistance of 1.2 Ωand a reactance of 106 mH.Between Bass 3 and 4 the impedance is almost zero.

Modeling of uncertainty in microgrids
Studies and research in the field of power systems need to consider many uncertainties, the lack of which leads to errors in the results of studies on the network.In this paper, the uncertainties considered for the studied network are divided into two parts.

Uncertainty in the network load
In conventional methods for detecting the microgrid islanding, the assumption is that the load is a fixed value, which simplifies implementation but does not correspond to the actual behavior of the load in the power system.Statistical studies have shown that consumers' electrical load behavior is uncertain and follows a normal distribution.In this distribution, the average value is considered to be the same as the predicted value, and the standard deviation is determined according to the historical information, which is as follows [41]. ( where,PL, PL  and PL  denote the load power (KW), the average value of the load power(KW), and the standard deviation of the load power(KW), respectively.

Uncertainty in DGs 3.2.1. Wind turbine
Wind speed is random in nature, and to model it, it is necessary to select the probability density function (PDF) or the cumulativeprobability function (CDF) properly.In this field, many studies and researches have been done and various density probability functions have been tested, such as Weibull, Rayleigh, and Normal probability distribution functions.
In this paper, the Weibull probability distribution function (Eq.( 2)) is used to model the uncertainty of wind power [42]. ( Where,  (m/s),  ,andv (m/s) are scale and shape parameters of the Weibull distribution and wind speed, respectively.
These samples are then converted to wind turbine generator output power using the wind speed-power curve (Eq.( 3)) [42]. ( ,. . Where, ci v , r v and co v are the starting speedv (m/s), nominal speedv (m/s), and cut-off speed v (m/s) of the wind turbine.

PV panels
PV output power is expressed as a function of irradiation as the irradiance power curve, as given in Eq. ( 4) [42]

Islanding detection method
A new method based on type-2 fuzzy logic is presented in this study for detecting and identifyingof microgrid islanding so that in complex operations, the power system does not misoperate and can correctly discriminate the microgrid islandingand other network events and prevent the undesirable performance of DGs.The most important sources of uncertainty considered in the system under study include uncertainties in power generation of DGs, load, and fuzzy logic membership functions, and other cases of uncertainty will be neglected.

Type-2 fuzzy logic
The interval type-2 fuzzy logic system (IT2FLS) consists of two type-1 membership functions, and the distance between these two membership functions indicates uncertainty.Now, if the existing uncertainties are defined in a form suitable for the fuzzy controller, the uncertainties can be overcome to a great extent.
It can be said that the most important issue in fuzzy controllers based on tpe-2 fuzzy logic systems is recognizing the sources of uncertainty and correct definition of membership functions [7].
As shown in Fig. 2, a type-2 fuzzy logic system is described similar toa type-1 fuzzy system using a series of if-then rules, except for the type-2 fuzzy sets use a range (this can be a fuzzy set) in their membership functions,instead of employing a numberfor defining the degree of membership.This range is called the footprint of uncertainties (FOU).Fuzzificationputs the crisp input vector (x1, x2… xn) within the IT2FLS.Contrary to the type-1 fuzzy logic, where membership functions have a crisp number, its membership functions are in the fuzzy range of [0,1].

Fig. 2. Type-2 membership function
In the fuzzy logic system, linguistic numerical uncertainties can create uncertainties in the rules.The IT2FLS can address these uncertainties.Fig. 3 shows the IT2FLS schematic to solve the problem of islanding identification.The IT2FLS includes fuzzification, inference motor, base fuzzy rules, and an output processor.

Out put islanding
Type Reduced Set Fig. 3. Schematic of the IT2FLS In the type-2 fuzzy logic, each rule provides a type-2 relationship between n inputs in the input space, 11 ... nn x X x X  , and one output, Y.In the case of m rules, we have [43]: (5) Fi k represents the IT2FLS ofthe ith input mode related to the kth rule.Also, x1 to xnindicate the input, G k is the input to the IT2FLS for the kth rule, and Nis the number of rules.
The fuzzy inference engine combines fuzzy rules and maps a given fuzzy input to a fuzzy output.Output to output mapping provides a basis for decision making or pattern recognition.The fuzzy inference engine consists of a database defined by membership functions, If-then fuzzy rules, and logical operations.The kthrule means that F k (x1, x2, …, xn) generates the distance between the two limits   ( 1 ,  2 , … ,   ) and   ( 1 ,  2 , … ,   ), which is stated as follows: (6) ( , ,..., ) ( , ,..., ), ( , ,..., ) , where,   and  are defined as follows: (7) Type reduction is one of the key steps in IT2FLS.The type reducer converts the output of an IT2FLS into an outputof a type-1 fuzzy set.In this study, a centroid type reducer was used as follows: ( (z )* (w ) ... ... where, A GC % shows the reduced type-1set, nis the number of discrete points A % , z i R  and ( ), ( ) ... ... ...
To achieve the crisp range, this distance set must be reused.The most common method of determining a centroid set is to use a type reduced set.The following expression presents the centroid of an n-point reduced set: The iterative Karnik-Mendel algorithm is used to calculate the output [43].Therefore, defuzzification of the IT2FLS is as follows:

Controller
The proposed controller can have a structure such as Fig. 4. The controller input is the frequency error and it derivative and its output is applied to a comparator block to create the appropriate control command.The membership function considered for fuzzy controllers is an interval type-2 fuzzy controller.The general idea in detecting microgrid islanding is to create a range for frequency changes as well as rate of changes over time.It is assumed that the amount of changes and the ROCOF for islanding are known, and in the proposed controller, the frequency is first sampled and compared with the reference frequency, then the output of this comparison is amplified and its derivative is obtained.It is then given as two separate inputs to the type-2 fuzzy controller and the controller provides the necessary outputs based on these two inputs.

Objective function
The form of membership functionsis the most important issue.Accurate design of membership functions is an important issue in fuzzy system design.Because these functions are designed according to the experienced of a skilled person, and due to the person's error, the desired performance will not be achieved and sometimes the system may be driven to instability.For this purpose, in addition to the experience of the expert, meta-heuristic algorithms can be used to design membership functions.The objective function for optimization can be defined as Eq. ( 13): (13) 0 ( )  where,tsim is the simulation time, e is the frequency error value, and t is the time operator.A controllerwith smallvalues of error and time will perform better.

PSO algorithm
The PSO algorithm is a population-based search algorithm and is modeled by imitating the behavior of bird swarms.In this algorithm, the particles in the search space are randomly distributed and the location of the particles in the search space is affected by the experience and knowledge of themselves and their neighbors; thus, the positions of other particles affect how a particle searches the space.The modeling of this social behavior leads to a search process in which particles in successive repetitions tend to successful areas.
The steps for implementing the algorithm are as follows [44].

Step 1: generating theinitial population
Generatingthe initial population is the random determination of the initialpositions of the particles with a uniform distribution in the search space.

Step 2: evaluating the objective function
At this step, each particle that represents a solution to the problem must be evaluated.Depending on the problem under consideration, the evaluation method will be different.This is performedby the objective function specific to each problem.

Step 3: determining the best personal particle and the best global particle
After evaluating each particle, the best fitness of each particle ever obtained is stored.

Step 4: updating particles
The new Velocity of the particles is updated using the speed of each particle: The new position of the particles is updated using the speed of each particle: (15) 11

Step 5: checking the termination criterion
To terminate the algorithm, a criterion is always set, which can be the maximum number of iterations or the maximum number of iterations without changing the total fitness.The process of implementing the PSO algorithm is shown in Fig. 5.

Simulation and numerical results
The simulation of the proposed method is performed in MATLAB/Simulink environment.In t = 6 s, islandingisperformed using the switch that exists between the microgrid and the maingrid.
In this microgrid, the solar source includes a PV panel that converts solar power to DC power, and using an IGBT-based inverter, DC power is converted to three-phase AC power.The output power of the inverter is controlled by modulated pulses applied to its gate, and based on the changes in the microgrid frequency, its output power changes, and as a result, its generatedpower is adjusted to the load demand.
The wind source also includes awind turbine with the ability to adjust the output power, which changes its output power to match the supply and demand according to the frequency of the system.
Table 2 shows the fuzzy rules used to identify islanding.To consider the uncertainty of wind speed, solar radiation, and load, we change the nominal value to ±25 p.u, with 25 different modes being considered for load demand changes.Furthermore, to investigate the effect of the type of power exchange between the system and the microgrid on frequency changes and islandingidentification, we considered the system voltage angles in three different modes: 0 and ±12.In total, 75 different states of uncertainty are considered for each scenario.
Four different scenarios are presented to evaluate the proposed method: 1)Islanding 2) Short circuits in the tie line between the microgrid and the network without islanding 3)Interrupting the power generation resources of the microgrid without islanding 4)Islandingsimultaneous with a sudden increase in the generation power of microgrid resources

Scenario 1: Islanding
Table 3 shows all possible states, frequency changes during islanding, and whether islanding was identified.Moreover, to investigate the effect of type of power exchange between the system and the microgrid on frequency changes and islanding identification, the system voltage angles are considered in three different modes.Load and frequency changes in terms of p.u.
Table 3 shows that in all the cases considered for microgrids and changes in supply and demand, as well as changes in the exchange power between the power system and the distribution network, the islanding identification was well performed.It can also be seen that the maximum frequency deviation occurs at 12 ° and the minimum frequency deviation occurs at-12°.In all cases, when the power output of the wind and solar sources is 1.25 per unit (p.u.) and the system voltage angle is -12°, the minimum frequency deviation is present.Also, when the generation is 1.25 p.u., the load is 0.75 p.u., and the system voltage angle is 12°, the maximum frequency deviation appears.Therefore, when the system voltage angle is less than the microgrid voltage angle, it will be more difficult to detect islanding using the proposed method, but in all cases, islanding event is detected.deviation is because ofload demand changes and it can be observed in fig 6(c)that least impact is due to power generation variations.Although increasing the load did not affect the maximum deviation, it did reduce the frequency fluctuations.Also, when the network voltage angle is less than that of the microgrid, the frequency deviation is smaller. (

Fig. 6. Comparison of frequency deviation in different modes for the first scenario
To analyze the ability of the presented method, it is compared with three other methods.For this purpose, all 75 modes presented in Table 3 were simulated using type-1 fuzzy logic, neural network, and the neuro-fuzzy methods.Table 3 presents the results of the comparison statistically.Table 4 shows that the type-2 fuzzy logic was able to detect 100% of the islandingmodes, while the other methods had an error percentage, wheretype-1 fuzzy logic method was the most erroneous one.It is also observed that the type-2 fuzzy logic has a higher detection speed than other methods, the neuro-fuzzy method had a better operating speed than other methods, and the type-1 fuzzy logic had the lowest speed.

Scenario 2: Short circuits in the tie line between the microgrid and the network without islanding
In this scenario, three different cases will be considered.In Case 1, the switch that creates the islanding mode at t = 6 s is removed, and instead all three phases in tie line that connects the microgrid to the main grid are short circuited.Short circuit occurs at t = 6 s and is cleared at t = 7 s.In Case 2, islanding does not occur, but a short circuit occurs in the PV bus.In Case 3, a short circuit occurs in the WT bus.In these three cases, the islanding mode should not be detected in all 75 cases mentioned above.In this scenario, the proposed method has been compared with three other methods, the results of which have been presented in Table 4. Table 5 shows that the type-2 fuzzy logic was able to correctly identify 100% of the nonislandingmodes in all three cases, while the other methods had an error percentage.The type-1 fuzzy method had the greatest error in all three cases.Also, in Case 2, neural network and neuro-fuzzy methods hadequal error percentage, but the neuro-fuzzy method had less error overall.(c) that the effect of load demand changes on frequency deviation is less than those inScenario 1, but the effects of changes in the power generation and power exchange with the network had increased, although these changes have not affected the maximum deviation.In this scenario, three different cases will be considered.In all three cases,the switch that creates the islanding mode at t = 6 s is removed and the islanding mode is not created.In Case 1, the PV power source of is disconnected from the microgrid att = 6 s, and all 75 modes mentioned above are examined.In Case of 2, WT source is disconnected from the microgrid at t = 6 s and all 75 modes are checked.In Case 3, both WT and PV power generation sources are disconnected from the microgrid at t = 6 sand all modes are examined.In this scenario, the proposed method has been compared with three other methods, the results of which have been presented in Table 6.Table 6 shows that the type-2 fuzzy logic correctly identified 100% of the non-islanding in all three cases, but other methods in this scenario also had an error percentage.In this scenario, the type-1 fuzzy logic method had the highest error in all three cases and the neuro-fuzzy method had the least error.Also, in Case 3,type-1 fuzzy, neural network, and neuro-fuzzy methods had a higher error rate than in cases 1 and 2. Furthermore, in general, in this scenario, the error percentage in these three methods has increased compared to scenarios 1 and 2. In this scenario, three different cases are examined, and in all three cases, the switch that creates the islanding mode at t = 6 s, establishesthe islanding mode.In Case 1, the PV source experiences an abrupt change of 70% at t = 6 s and all 75 states mentioned above are investigated.In Case 2, the WT sources experiences a sudden change of 70% at t = 6 s and all 75 states mentioned above are investigated.In Case 3, both = WT and PV sources face a sudden change of 70% at t = 6 s and all 75 states mentioned above are examined.In this scenario, the proposed method has been compared with three other methods, the results of which have been presented in Table 7. able 7 shows that the type-2 fuzzy logic in all three cases correctly identified 100% of the non-islanding but other methods in this scenario also had an error percentage.In this scenario, the type-1 fuzzy logic method had the highest error in all three cases and the neuofuzzy method had the least error.Also, in Case 3,type-1 fuzzy, neural network, and neurofuzzy method had a higher error percentage than in cases 1 and 2. Also, in general, in this scenario, the error percentage in these three methods has increased compared to scenarios 1 and 2.

Conclusion
This paper presents a novel method for detecting islanding using a combination of type-2 fuzzy logic and PSO optimization algorithm based on microgrid frequency changes in situations where the production of wind and solar resources as well as load consumption are uncertain.The proposed method was simulated on a sample system in MATLAB software and different scenarios were considered.The advantages of the proposed method, which distinguishes it from other methods, can be described as follows: • In each scenario, 75 different modes of changes in power generation, power consumption, and power exchange between the microgrid and the main network were presented.In all cases, the proposed method was able to identify islanding.
• The type-2 fuzzy system issuperiorto the type-1 fuzzy logic in supporting noise conditions, changes in the environment, and the presence of uncertainty because its membership degreeis a fuzzy set itself.
• In faults where islanding did not occur, such as disconnection of resources or short circuits, the proposed method correctly recognized that islanding did not occur.
• When islanding was accompanied by a sudden increase in the power generation of power resources, the islanding was still correctly detected.
• The method presented did not misoperate for any case or scenario, while other methods such as type-1 fuzzy logic, neural network, and neuro-fuzzy methods were always had error percentage in identifying whether or not an islanding has occurred.

R
denotes the nominal power of the PV (W/m 2 ), irradiance, thespecific irradiance point (W/m 2 ) that is usually set to 150 W/m 2 , and irradiance in standard conditions, which is set to 1000 W/m 2 .
functions.Zi and Wi and T is a t norm.

Fig. 4 .
Fig. 4. Block diagram of the proposed controller

Fig. 6
compares several cases of frequency deviation in 10 s for the first scenario.In this figure, frequency changes Due to load demand (Pd) changes, Voltage angle, power generation changesis shown in fig 6(a), fig 6(b), and fig 6(c)respectively.It can be observedin fig 6(a)that the greatest impact on frequency

Fig. 7
Fig.7 compares several frequency deviations in 10 seconds for the second scenario.In this figure, frequency changes Due to load demand changes, Voltage angle, power generation changesis shown in fig 7(a), fig 7(b), and fig7(c)respectively.It is observed in fig (a), (b) and(c) that the effect of load demand changes on frequency deviation is less than those inScenario 1, but the effects of changes in the power generation and power exchange with the network had increased, although these changes have not affected the maximum deviation.

Fig. 7 . 8 . 3 .
Fig.7.Comparison of frequency deviations in different modes for the second scenario

Fig. 8 Fig. 8 .of frequency deviation in different modes for the third scenario 8 . 4 . Scenario 4 :
Fig. 8 compares several cases of frequency deviation in 10 seconds for the third scenario.In this figure, frequency changes Due to load demand changes, Voltage angle, power generation changesis shown in fig 8(a), fig 8(b), and fig 8(c)respectively.In fig 8(a),it is observed that the effect of load demand changes on frequency deviation is less than Scenario 1 but higher than Scenario 2. In fig 8(b) and fig 8(c), it isrecognizable the effects of changes in power generation and power exchange with network have increased compared to previous scenarios.

Fig. 9
Fig.9 compares several cases of frequency deviation in 10 seconds for the fourth scenario.In this figure, frequency changes Due to load demand changes, Voltage angle, power generation changesis shown in fig 9(a), fig 9(b), and fig 9(c) respectively.The effect of load demand changes (fig 9(a)), power generation changes (fig 9(b)), and power exchange changes (fig 9(a))on frequency deviation has been greatly increased.It can even be seen that changes in power generation and power exchange changes affect the maximum frequency deviation.

Fig. 9 .
Fig. 9. Comparison of frequency deviation in different cases for the fourth scenario

Table 3 .
Results of islanding identification

Table 4 .
Comparison of Percentage of Detectionby different methods in Scenario 1

Table 5 .
Comparison of Percentage of Detection by different methods in Scenario 2

Table 6 .
Comparison of Percentage of Detection by different methods in Scenario 3

Table 7 .
Comparison of Percentage of Detection by different methods in Scenario 3