Fault Detection and Location by Static Switches in Microgrids Using Wavelet Transform and Adaptive Network-based Fuzzy Inference System

Microgrids are a highly efficient means of embedding distributed generation sources in a power system. However, if a fault occurs inside or outside the microgrid, the microgrid should be immediately disconnected from the main grid using a static switch installed at the secondary side of the main transformer near the point of common coupling (PCC). The static switch should have a reliable module implemented in a chip to detect/locate the fault and activate the breaker to open the circuit immediately. This paper proposes a novel approach to design this module in a static switch using the discrete wavelet transform (DWT) and adaptive network-based fuzzy inference system (ANFIS). The wavelet coefficient of the fault voltage and the inference results of ANFIS with the wavelet energy of the fault current at the secondary side of the main transformer determine the control action (open or close) of a static switch. The ANFIS identifies the faulty zones inside or outside the microgrid. The proposed method is applied to the first outdoor microgrid test bed in Taiwan, with a generation capacity of 360.5 kW. This microgrid test bed is studied using the real-time simulator eMegaSim developed by Opal-RT Technology Inc. (Montreal, QC, Canada). The proposed method based on DWT and ANFIS is implemented in a field programmable gate array (FPGA) by using the Xilinx System Generator. Simulation results reveal that the proposed method is efficient and applicable in the real-time control environment of a power system.


Introduction
The Kyoto Protocol mandates that industrialized countries reduce their collective greenhouse gas emissions in 2012 to 5.2% below the levels in 1990 [1].Later, the Copenhagen Accord required the reduction of global emissions in order to limit the increase in global temperatures to a maximum of 2 °C [2].Renewable energy plays a major role in providing distributed electricity resources in power systems to achieve a low carbon environment.However, the penetration of renewable energies in a distribution system causes many operational problems (such as protective coordination).To avoid this problem, the concept of the microgrid was developed to include these renewable energies [3,4].Owing to the intermittence of the generation from renewable energies (such as wind-turbine and solar power), the reliability of the microgrid should be enhanced using other power sources (e.g., gas turbines and batteries).
Many works have developed methods to implement the microgrid test bed.The Consortium for Electric Reliability Technology Solutions (CERTS) microgrid testbed was developed in the early 1990s [3], and an assessment report for this testbed was published recently [4].The important concepts developed by CERTS include peer-to-peer and plug-and-play devices embedded in the microgrid.Numerous new issues, which were not raised by the conventional large power systems, have emerged [5,6].Ahn and Peng [5] presented a decentralized control architecture for microgrids along with a simulation environment appropriate for on-going investigations into real-time decision-making.Lim et al. [6] presented a distributed load-shedding system for agent-based autonomous operation of a microgrid.The total amount of load to be shed is calculated to maintain frequency above minimum permissible frequency for the maximum anticipated overload.
A new issue associated with static switches in microgrids has emerged recently.A static switch is a fast electronic switch located at the secondary side of the main transformer near the point of common coupling (PCC).When a fault occurs inside or outside a microgrid, the static switch should immediately disconnect the microgrid from the power system of the utility [3,4].Klapp and Vollkommer [7] developed a silicon controlled rectifier (SCR)-based static switch, which incorporates a high level system control scheme to comply with IEEE Standard 1547.Nikkhajoei and Lasseter [8] suggested that a static switch should activate the breaker in 1/2-2 cycles.Kroposki et al. [9] developed the concept of the circuit-breaker-based (20-100 ms), SCR-based (1/2-1 cycle) and insulated-gate bipolar transistor (IGBT)-based (100 µs) switches.A digital signal processor (DSP) was designed to perform functions of relay, communication, monitoring and diagnosis [9].Chan et al. [10] designed a static switch that has a 16-bit DSP chip-based controller and an SCR-based switch (JK3PTS-48850).Thresholds of overcurrent, high/low-voltage and high/low-frequency are specified in the DSP chip for detecting a fault in either the main grid or the microgrid.Once the fault is detected, the static switch is opened in 10 ms.A complex programmable logic device (CPLD)-based module circuit board with a communication circuit interface using RS-485/CAN2.0B/IEEE802.3Ethernet was developed to transmit operating data [10].
This work presents a novel method for a static switch to detect/locate a fault in the first outdoor microgrid test bed in Taiwan.The generation capacity of this microgrid, including gas-turbine generators, wind-turbine generators (WTG), energy storage and high concentration photovoltaic (PV), is 360.5 kW.Numerous research projects have been undertaken to investigate key technologies, including power converters, wind turbines, PV modules, protection schemes, and monitoring systems.Preliminary studies of the operating mode, motor starting and voltage fluctuation have been published [11,12].In contrast to [7][8][9][10], this work focuses mainly on the detection/location module of a static switch.Sensitive signal processing is necessary since the fault current originating from power converter-based distributed generation is very small and the fault voltage at the PCC is not significant [7].Therefore, this work analyzes the fault voltage and current at the secondary side of the main transformer near the PCC by using multi-resolution analysis (MRA) of the discrete wavelet transform (DWT).Additionally, the faulty zone is identified using the adaptive network-based fuzzy inference system (ANFIS), based on the wavelet energy of the fault current.The proposed method that uses the voltage wavelet coefficient and the ANFIS output determines whether the electronic breaker should be opened or not.Moreover, this microgrid test bed is studied using the real-time simulator, eMegaSim, which was developed by Opal-RT Technology Inc. (Montreal, QC, Canada) [13].The detection module is implemented in a field programmable gate array (FPGA) using the Xilinx System Generator.
The rest of this paper is organized as follows: Section 2 briefly introduces the microgrid and presents the assumptions in the studied problem; Section 3 introduces the proposed method based on DWT, ANFIS and Opal-RT; Section 4 summarizes the simulation results; and Section 5 draws conclusions and offers recommendations for future research.

Microgrid Testbed
The studied microgrid has 11 AC buses.Figure 1 illustrates the one-line diagram of this microgrid with rectifiers, buck/boost converters, and inverters, which will be fully considered in the transient/dynamic simulation.The microgrid testbed (380 V) is planned to cover three zones: 2011: Buses 1-6 are constructed in Zone 1, which includes a 60 kW load, 65 kW gas turbine, 100 kW (60 kW h) battery and 31.5 kW PV; 2012: Buses 7-10 are located in Zone 2, which mainly consists of a 90 kW load, 25 and 4 kW wind turbines, and 10 kW PV; 2013: Bus 11 is located in Zone 3, which comprises a 60 kW PV and a 65-kW gas turbine.
Detailed models of components used in the microgrid are given in the appendix [11,12,14].

Assumptions
In order to study the problem, the following assumptions are made: (a) The voltage and current at the secondary side of the main transformer near the PCC are available.
PT and CT are generally installed at the secondary side of the main transformer.The levels of fault voltage and current are reduced for the further usage of FPGA chip.(b) The time delay in the electronic switch is ignored in the simulation.If an IGBT-based switch is used, opening the circuit takes about 100 µs [9].The proposed method takes advantage of 1/4 of the cycle of the fault voltage and current for further signal processing.One-fourth of the cycle is used because the voltage/current is most likely to experience a large variation of the instantaneous values in a 1/4 of the cycle.(c) The latency of FPGA is ignored in the simulation.According to the results herein, the latency of FPGA is several nano seconds, which is significantly shorter than that of a DSP chip (a latency of the order of milli seconds).(d) The faulty zone is disconnected by the zonal isolating switch if a fault occurs in the microgrid.(e) The fault and the microgrid are balanced.Neither the single-phase grounded fault nor the phase-to-phase fault is discussed herein.Nine hundred and ninety-four balanced scenarios are studied herein using MATLAB/Simulink (see Section 4.1).Almost 3000 scenarios will be studied in case imbalance is concerned.The detection logic architecture is still the same in case of imbalance.

Outline
Fault detection and location problems for both distribution and transmission systems have been extensively studied [15][16][17][18].The harmonic impedance [15], wavelet singular entropy [16], automated graph [17], and three different structures of neural networks incorporating with the negative current [18] were employed in these methods.However, since the inverter-based power converter in distributed generations is used, the fault current is not large and may not be easily detected if a fault occurs inside a microgrid.ANFIS, DWT and FPGA are used herein to cope with the above dilemma for the following reasons: (1) The small disturbance caused by faults inside a microgrid is detected using DWT because DWT is a transient-sensitive means of processing a signal.Both the wavelet coefficient of the transient voltage and the sum of squared wavelet coefficients (called wavelet energy herein) of the fault current are utilized to enhance the proposed method.The proposed method avoids negative sequence of components [18], which may be caused by unbalanced loads rather than balanced faults, and avoids the use of fault currents only [15], which may lead to a delay in the detection logic.( 2) Fuzzy reasoning provides a high-level linguistic inference engine that can tolerate uncertainty but lacks learning capability.An artificial neural network, by contrast, is like a black box but it can learn and tolerate imprecision.ANFIS is an intelligent system that integrates fuzzy reasoning with a neural network by considering their advantages.ANFIS builds a hybrid intelligent system that is capable of reasoning and learning in an uncertain and imprecise environment.However, three different neural networks, which are not subject to uncertainty and lack reasoning capability, were developed in [18].(3) The use of double detection/location logics (wavelet coefficient of transient voltage and ANFIS plus wavelet energy of transient current) enhances the reliability of the proposed method.The proposed method, therefore, is able to use only the transient voltage and current near PCC to detect and locate a fault.This capability is essential in case the plug-and-play and peer-to-peer implementations are concerned and the decentralized control is applied.However, references [15][16][17][18] used multiple sensors in the power systems.(4) The microgrid test bed is studied using the real-time simulator eMegaSim developed by Opal-RT Technology Inc. [13].The detection/location module established by the DWT and ANFIS is implemented in an FPGA using the Xilinx System Generator.Other studies in [16,17] are not suitable for real-time applications.

DWT
A signal can be represented as a sum of wavelets and scale functions with coefficients at different time shifts and scales (frequencies) using DWT.DWT is able to extract the features of transient signals by decomposing signal components overlapping in both time and frequency [15].According to DWT, a time-varying function (signal) The small scales represent high-frequency ranges of a transient signal.Thus, the wavelet coefficient (d j ) of a fault voltage (i.e., if f(t) is the fault voltage) is used as a feature to detect the occurrence of a transient caused by a fault.
In summary, this work utilizes the wavelet coefficients of the fault voltage and the sum of the squared wavelet coefficients of the fault current to activate the electronic switch to open once a fault occurs inside or outside the microgrid.All wavelet coefficients are computed using 1/4 of a cycle of sampled points of both the voltage and current.Traditional effective (rms) values of the fault voltage and current are not suitable to be indicators for detecting the fault occurrence because the faults may occur at zero crossings.However, the DWT is able to detect changes of instantaneous voltage/current by using the detailed coefficients obtained at their corresponding scales (j = 1, 2, 3…) even though the fault occurs at zero crossings.Some mother wavelets are available in the wavelet theory [19]: the Haar wavelet is defined in a finite bounded set but is discontinuous.The Shannon wavelet is smooth and decays at infinity very slowly; it is not compactly supported, either.The linear spline wavelet is continuous, but has infinite support.Thus, these mother wavelets are not suitable to study the power system transients.Compared with these wavelets, the Daubechies 4 belongs to a class of compactly supported, continuous, and orthonormal basis-generating wavelets.The Daubechies 4 was also used in [20,21].

ANFIS
This subsection describes the use of three inputs (i.e., WI(1), WI(2), and WI(3)) to demonstrate the feasibility of using ANFIS to identify the faulty zone, where WI(1), WI(2) and WI(3) denote the "wavelet energies" of the fault current at Scales 1, 2 and 3, respectively.A typical fuzzy rule of ANFIS can be expressed as follows: where A1, B1 and C1 are the membership functions for the wavelet energies.The antecedent part of the fuzzy rules is related to inputs WI(1), WI(2), and WI(3).The consequent part of the fuzzy rules is a linear combination of WI(1), WI(2), and WI(3).f i is a real function.In this paper, A1-A5, B1-B5, and C1-C5 are considered as possible membership functions of WI(1), WI(2), and WI(3), respectively.For example, A1, A2, A3, A4, and A5 signify "very small", "small", "normal", "large" and "very large" memberships of WI(1), respectively.Combining A1-A5, B1-B5, and C1-C5 yields 125 (i.e., 5 3 ) fuzzy rules.If A1-A5, B1-B5, and C1-C5 and f i are known, then the output can be determined.However, A1-A5, B1-B5, and C1-C5 and f i are unknowns, which must be determined by training the ANFIS using various scenario data.ANFIS is an effective approach to transforming the fuzzy rules (e.g., Equation ( 3)) into a neural network, including membership functions.Figure 2 shows the equivalent ANFIS for these 125 fuzzy rules.The structure of ANFIS can be explained as follows: the first layer in Figure 2 is the input layer; the second layer includes the membership functions, which are the same as the activation functions in the neural network, of the fuzzy rules.Each membership (activation) function can be expressed as follows: where a i , b i and c i represent the center, width and slope of input values, respectively.The superscript "(2)" in Equation ( 4) denotes the second layer.The third layer performs the rules and the ∏ i operator applies the linguistic "and" in the antecedent part of the fuzzy rules.Normalization (denoted as "N i ") is implemented in the fourth layer.The fifth layer deals with defuzzification as follows: ) where i μ refers to the normalized value of the output (consequence) of the i-th fuzzy rule in the fourth layer.Finally, the value of each output neuron can be integrated from 125 fuzzy rules with proper values of i μ in the sixth layer: In the training stage for developing the proposed ANFIS, the unknowns a i , b i and c i and the coefficients k i0 , k i1 , k i2 and k i3 of f i are determined by training the neural network using input/output pairs (WI(1), WI(2), WI(3); binary bit) where the binary bit denotes 1 (faulted) or 0 (unfaulted).In the testing stage for developing the proposed ANFIS, the output of the ANFIS is evaluated using Equation ( 6).If the value of Equation ( 6) exceeds 0.5, then a fault occurs; otherwise, no fault occurs.Like other supervised neural networks, the ANFIS needs to be trained again if the topology of the microgrid system is changed.

Module for Fault Detection and Location
The occurrence of a fault inside/outside the microgrid is detected and located using two logics: First, the occurrence of a fault is detected using the MRA of DWT implemented by FPGA.Wavelet coefficients at Scale 2 are the most appropriate for this role (see Figure 3 below).In this work, a cycle includes 256 sampled points.64 sampled points (1/4 of the cycle) were used for implementation (see Assumption (b) in Section 2.2).
Second, because the voltage transient may be related to other disturbance (e.g., capacitor switching), the wavelet energies that are calculated using wavelet coefficients of 1/4 cycle of the fault current at Scales 1, 2 and 3 are also used to identify faulty zone by ANFIS.
If the values of both logics are unities, then the electronic switch is activated to open the circuit.Figure 4 shows the overall architecture of these two logics.ANFIS1-ANFIS4 were trained individually with different data sets.For example, only the data sets related to the scenarios with faults occurring in Zone 1 were used to train ANFIS2.If identifying the fault locations is not needed, then only one ANFIS is required.

Real-Time Digital Simulation and FPGA Implementation
Real-time simulation was conducted in this work using Opal-RT eMegaSim.eMegaSim, which is composed of software (RT-Lab, Montreal, QC, Canada) and hardware (target computer; Intel i7 965 Extrem), can be integrated entirely with the MATLAB\Simulink software.Parallel computation is implemented in Opal-RT-Redhat OS.In a host PC, the user can perform preliminary design and integrate the above models constructed in the studied case in the Simulink environment (i.e., SimPowerSystem Blockset).The developed Simulink-based case can then be moved to the Opal-RT-Redhat OS to perform parallel computation in the target computer (eMegaSim).
In this work, the Xilinx FPGA chip and the Xilinx System Generator (XSG) are used to implement the proposed method.The XSG toolbox can build a system model to be a hardware circuit in a Matlab/Simulink environment.Figure 5    The proposed ANFIS was trained using the MATLAB ANFIS Editor GUI.Following convergence, a i , b i and c i and the coefficients k i0 , k i1 , k i2 and k i3 of f i can be determined and are used in the XSG environment to design the FPGA chip.

Test Results
The performance of the proposed method is evaluated using the microgrid described in Section 2. This microgrid test bed is described in detail in [11,12].

Performance of Proposed Method
This section uses various wind speeds (11, 10, 9, 8 and 0 m/s), irradiations (1000, 800, 600, 400 and 0 W/m 2 ), load levels (150 kW multiplied by 100%, 85% and 70%) and short circuit capacities (1714.2MV A multiplied by 100% and 70%) at PCC.The minimum generation of a gas-turbine generator is 37 kW.The power generation in the microgrid is not allowed to be injected into the main grid.Thus, there are a total of 142 base cases, which include normal and extreme meteorological limits as well as possible operating conditions.The faults are assumed to occur individually at Buses 1, 4-6, or 9-11.Considering these faults yields 994 scenarios: the results of simulating 663 and 331 scenarios are used for training and testing ANFIS, respectively.In order to enhance the proposed method, the 663 training scenarios are selected at random.The simulations are conducted using the MATLAB/Simulink SymPowerSystem.
Figure 3 shows the wavelet coefficients of voltages at PCC determined from the scenarios in which individual faults occur at Buses 1 and 5 (i.e., outside and inside the microgrid).Figure 3 does not consider the action of static switch because the effect of wavelet coefficients is addressed.Duration of the fault is 2 s in the simulation (t = 2-4 s); however, only 1/4 of the first cycle is used in the proposed method.Obviously, d 2 is the most suitable wavelet coefficient for detecting the occurrence of a fault transient.Specifically, a sufficiently large d 2 occurs at t = 2 s compared with other d 2 .However, the value of d 1 at t = 2 s is not sufficiently large and values of d 3 oscillate after t = 2 s.These imply d 1 and d 3 are inappropriate for the usage of detection.Any transient and noise may be included in the measured signals.However, the DWT can still identify the most appropriate scale (j = 2 herein) because different scales (j = 1, 2, 3) cover different frequency bands.
Unlike traditional methods in which multiple sensors are used in the power systems, the proposed method only uses the transient voltages and currents near the PCC. Figure 6 shows the obtained 15 corresponding membership functions.
The accuracy of the proposed ANFIS is still promising although only signals near the PCC are used, as shown in Table 1.Besides, this table also shows that the proposed method is able to locate the faults in different areas (main grid and Zones 1-3) even though the fault currents are small due to the current limits that are imposed by the inverters of the distributed generators.

Scenario of Islanding Microgrid from Grid-Tied Mode
This subsection discusses a three-phase balanced fault occurring at Bus 4 at 2 s.Suppose that the wind speed, irradiation and system load are 8 m/s (corresponding to 11 and 1.5 kW from the two wind turbines at Bus 10), 600 W/m 2 (corresponding to 17, 6 and 30 kW at Buses 6, 10 and 11) and 150 kW, respectively.After 1/4 of the cycle, the proposed method activates the static switch at PCC and the microgrid becomes islanded.Meanwhile, the following actions are carried out according to the assumptions described in Section 2: (a) Disconnect all loads, the gas-turbine generator, PV and the energy storage at Bus 4. (b) The gas-turbine generator at bus 11 becomes the master generation source with the V/f control.
The other distributed generations are maintained in their P/Q mode.
Figure 7 illustrates the system responses including kW generations for different distributed generations, voltage and frequency.The real power generation of a gas-turbine generator at Bus 5 (P/Q mode) becomes zero after disconnection.Bus 11 increases its generation from 37 kW (P/Q mode) to 45 kW (V/f mode).This figure reveals that the lowest voltage is close to 325 V (0.86 p.u.) and the lowest frequency is 59.8 Hz during the fault.Additionally, each DG is operated individually with the same real power generation before and after the fault in the steady state due to their P/Q mode except for the gas-turbine generator at bus 11 (for which the P/Q mode is switched to V/f mode).The time step is 1 µs in the above simulation.The simulation is run for 4 s.(e) (f)

Conclusions
This work presents a novel method for designing the fault detection/location module of a static switch in a microgrid.The contributions of the proposed method are summarized as follows:  Both the wavelet coefficient of fault voltage and the "wavelet energy" of fault current incorporating with ANFIS are utilized.The small fault current from the inverter-based distributed generations can therefore be effectively and reliably detected and located. Only the transient voltage and current near the PCC are utilized.No complicated communication system and other sensors at other buses inside the microgrid are required.This may enable peer-to-peer and plug-and-play to be realized in the microgrid. The proposed ANFIS is capable of reasoning and learning to detect/locate a fault inside or outside the microgrid.Fifteen membership functions for three "wavelet energies" are evaluated by training a six-layered ANFIS. Not only is the simulation performed, the detection/location module is also implemented using the Xilinx FPGA chip.The accuracy of the proposed method, applied to the studied problem, is favorable.The performance of the designed FPGA indicates that the proposed method is highly promising for applications in a real-time environment.
Future work will consider imbalanced faults and resynchronization between the main grid and the islanded microgrid.

A3. Energy Storage
The microgrid has one energy storage device, which is a Li-based battery system.This battery system is 100 kW, 60 kW h, and 696 Vdc.This battery system has two control modes: (a) master mode operates with both V and f controls once the microgrid is islanded; and (b) slave mode operates with the P/Q controls if the microgrid is grid-tied.Figure A3 illustrates the buck/boost DC/DC converter and inverter for the battery energy storage system.

A4. Gas Turbine Generator
The Capstone 65 kW gas-turbine generator is adopted in the microgrid.It is a high-speed single-shaft design with the compressor and turbine mounted on the same shaft as the permanent magnet synchronous generator [22].The generator produces an extremely high frequency signal ranging from 1500 Hz to 4000 Hz, which is first rectified and then inverted to a nominal 50/60 Hz signal.Thus, the generation of AC power from the micro-turbine generator is controlled by AC/DC and DC/AC converters.The DC bus voltages are 760 V and 750-785 V in the grid-tied and the standalone modes, respectively.When the microgrid is grid-connected, the gas-turbine generators can operate in either the P/Q control mode or the standby mode.The gas-turbine can be operated in the V/f control mode once the microgrid is islanded.
, φ(t), c 0 and d j represent the scaling function, wavelet function, scaling (coarse) coefficient at Scale 0, and wavelet (detailed) coefficient at scale j, respectively.The symbol k refers to the translation coefficient, which localizes (detects) a signal in time.The scales j = 1, 2, … denote the different (high to low) frequency bands.The symbol j 0 could be any integer.The translated and scaled (dilated) version of the wavelet, -frequency picture of the decomposed signal.Daubechies 4 is used as a mother wavelet herein.

Figure 4 .
Figure 4. Overall architecture of the two logics.MRA: multi-resolution analysis; DWT: discrete wavelet transform; and ANFIS: adaptive network-based fuzzy inference system.
illustrates how wavelet coefficients d 1 , d 2 and d 3 are calculated by wavelet high-pass (G) and low pass (H) filters as well as down sampling 「↓2」 using the MRA of DWT in the XSG environment.The symbol "C0" denotes the original signal.

Figure A3 .
Figure A3.Control of discharge from energy storage device.

Table 2 .
Table 2 lists different approaches to perform the simulations.The ATX motherboard of Opal-RT eMegaSim OP5600 has 12 processor cores in a single CPU.The studied microgrid is decomposed into 11 cores.One of the 12 cores is used to coordinate all computations in the other 11 cores.According to Table2, 12 s are required to simulate 4 s using Opal-RT eMegaSim.This required time can be reduced by using more cores.The used PC in Table2has an Intel Xeon Processor (X3440 2.53 GHz) and 4.0 G RAM. CPU times required using the three approaches.