Deep Learning Based Relay for Online Fault Detection, Classification, and Fault Location in a Grid-Connected Microgrid

In this article, a maiden attempt have been taken for the online detection of faults, classification of faults, and identification of the fault locations of a grid-connected Micro-grid (MG) system. A deep learning algorithm-based Long Short Term Memory (LSTM) network is proposed, for the first time, for the online detection of faults and their classifications of the considered MG system to overcome the issues that persist in the existing algorithms. Also, a combination of an LSTM network and feed-forward neural network (FFNN) with a back-propagation algorithm (BPA) is proposed to identify the exact locations of the faults since the identification of fault locations is more challenging than fault categorizations. To select a suitable deep learning network with multiple hidden layers for achieving the aforesaid objectives, a rigorous analysis has been done. To study the accuracy of the proposed techniques, different types of faults with different parameters are considered in this paper. An extensive simulation has been done in MATLAB/Simulink platform to study the performance of the system with the proposed techniques. To validate the effectiveness of the proposed techniques, the entire system is implemented in the real-time platform using the OPAL-RT digital simulator. Comparison has also been done for the results obtained using ANN and proposed techniques. The results show that the proposed techniques based on the deep learning network effectively detect, classify, and identify the location of different faults of an MG system with acceptable performances.


I. INTRODUCTION
The demand for power from microgrids (MG) is increasing rapidly due to their reliability and ability to supply green energy [1], [2]. A MG consists of multiple distributed The associate editor coordinating the review of this manuscript and approving it for publication was Gab-Su Seo . energy resources (DERs), communication devices, and variable loads which are always a reason for an electrical fault in the MG [3], [4], [5]. MG can operate both in islanded mode and grid connected mode. Unpredictable properties of MG components have negative impacts on the safety mechanism [6]. Therefore, the safety of an MG system is a significant matter before implementing this technique [7], [8], [9], [10], [11]. The faults in a power system are mainly two types; which are open circuit faults and short circuit faults. Open circuit faults occur in the system mainly due to the failure of one or more conductors. Asymmetrical and symmetrical faults are the two main types of short-circuit faults [12]. Some of the causes of these faults are weather conditions, equipment failures, human errors, etc.
The Fault in a microgrid can be unpredictable and require a focused strategy to fix the damaged parts [13]. There are different types of short circuit faults phase to phase, and phase to ground, which appear in the MG supply line and create an unstable current signal in the MG [14]. The presence of electrical faults makes the system unstable and the quality of the power is affected by it [15], [16], [17]. The appearance of these faults makes the operation of the system abnormal. It may be dangerous to personnel as well as animals and also affects the operating voltage actively. The abnormal currents due to faults can make the equipment overheat.
There are various safety devices such as circuit breakers, fuses, and relays which are commonly used for protection. Detection and classification of the faults is a big issue. Also, the location of the fault needs to be identified at the earliest possible so that faulty parts can be isolated from the main healthy system. Multiple fault analysis systems are studied to categorize the faults in the MG [18], [19], [20], [21]. In [22] and [23], a safety strategy built on transmission are presented. This method has a backup safety option when the core safety system fails to function. A mathematical morphology-based method was planned for a radial low-voltage DC distribution network [24]. A method based on abc-dq transformation is aimed at [25] to sense the type of fault. All these techniques only concentrate on the safety of a specific functioning system. In [26] phase angle, a positive voltage and zero sequences voltage-based fault identification method was planned. One more MG protection strategy based on harmonic analysis was proposed in [27]. An artificial neural network-based technique is proposed by Majid [28], where a feed-forward neural network is applied for the detection-classification of fault in the transmission line. The proposed technique was only tested with a three-phase transmission line in Simulink. Transmission lines are always connected with a main grid or with any microgrid and the response of the techniques can be different in these types of conditions. A sequential overlapping differential transform-based fault detection method is proposed by Haiyan in [29] for high-resistance ground faults. By using the initial current values, this method is tested with an AC microgrid. Zero-mode current values are used to identify the fault which is only suitable for single-phase to-ground faults. In the DC microgrid, for detecting the fault a superconducting fault current limiter is applied by Guangyang [30]. By comparing the currents of the healthy area with the faulty area currents it detects the fault. But sometimes it is difficult to know the location of the fault, so the collection of data for the comparison can become a big challenge. This method becomes slower when the fault is high resistance fault. For the detection of open circuit switch faults a method which is based on transistor logic is proposed by Godvin [31]. Transistor logic-based fault detection module is applied to detect the fault by analyzing the charge of the capacitor. An H-bridge inverter fault is detected with this technique. The operating efficiency of PV systems can be affected by unsymmetrical faults, and even can damage the system. For detecting various types of unsymmetrical faults in the PV system a voltage sensing-based method is investigated in [32]. Characteristics of the voltage signal of the system are analyzed to detect various unsymmetrical faults. But the techniques used for the detection, classification, and location of faults need to be updated and should be based on modern technology [33]. So, that the power system can easily handle these problems that are making it unstable in operation. Considering the above, there is a knowledge gap in the methods of fault detection and classification in microgrids. Deep learning-based networks have become very popular because of their accuracy and learning ability.
So, from the above mentioned survey, the contributions in the paper are as follows: 1) A maiden technique based Deep learning-based Long short-term memory (LSTM) network is proposed to classify the types of faults and to detect the presence of a fault of a grid-connected micro-grid system. 2) A combination of deep learning and artificial neural network is also proposed to detect the fault location of a grid-connected microgrid. 3) To study the effectiveness of the proposed techniques, different types of faults with different parameters are considered. 4) The study system with proposed techniques is implemented in real-time platform using OPAL-RT (OP4510) digital simulator for validation purpose. 5) Comparison has also been done for the results obtained using ANN and proposed techniques. For the analysis of the proposed techniques, a gridconnected microgrid system is built in MATLAB/Simulink environment and different types of faults are created in the transmission line of the studied model. For every type of fault model, phase voltage and current data are collected to train the proposed LSTM network as well as the artificial neural network (ANN), FFNN. For the classification and detection of a fault, the proposed technique is compared with the ANN-based technique of detection classification of a fault. The proposed technique uses the phase voltage and current waveform data and zero sequence voltage-current data as key inputs for the fault analysis of the MG.
Based on the aforementioned objectives, the paper has been prepared as follows: the description of the studied microgrid model and methodologies are discussed in section II. Section III presents the system response and analysis. Finally, section IV draws a conclusion.

II. MODELING AND TECHNIQUES A. MICROGRID SYSTEM CONFIGURATION AND MODELING
A grid-connected MG system is shown in Figure 1, comprising solar, diesel generator and battery, which are simulated to develop and implement the proposed method based upon ANNs. In the following sections, the mathematical formulation of the microgrid components is discussed.
Renewable energy generation contains solar PV and a wind energy source. A battery is added to maintain a constant power supply to load. Solar: Solar PV power (P pv ) is produced by the PV array cells and define as, where G, T, A, η, andαare solar irradiation, temperature, panel area, efficiency, and power degradation respectively. Wind: Wind power (P w ) produced by a wind system and formally defined as, where σ is the air density, A b is the blade area and v is the speed of the wind. Diesel Generator: The output power (P G ) of N numbers of diesel generators defined as, where P Gi is the output of the n th generator. Battery storage: Voltage (output) and the State of Charge are analyzed as, where V b , I b , E o , R in , K, Q, A, and B denote battery terminal voltage, battery terminal current, battery no-load voltage, internal resistance, polarization voltage, the capacity of the battery, zone amplitude, and inverse time constant respectively.

B. PROPOSED TECHNIQUE
ANN is useful for fault recognition and categorization efficiently because of its reliability to work in complex systems. For solving nonlinear as well as complex problems the ANNs are the best among other methods. The ANN can learn and update themself with involvements. They are usually accepted and applied in solving problems of different types of fault identification for the following properties: • The condition of the power system changes after every single fault and a neural network (NN) can rearrange the system's dynamic changes.
• ANN can learn by experience and can make choices.
• They can perform more than one function at a time because of their numerical strength. The ANN has many advantages, but it also has certain disadvantages with it. Some important features are the selection of network type, selection of the number of hidden layers, selection of the number of neurons, and learning algorithm parameters. There are some constraints like pre and post-fault values of line currents and voltages required for the detection of fault and categorization of fault. Pre and post-fault values of line current and voltage of the MG transmission lines are very different. So, the fault classification method required a NN that can able to sense and categorize the nature of faults from the pre and post-fault value patterns.

1) BACK PROPAGATION NEURAL NETWORK (BPNN)
In BPNN proper tuning of the weights reduce the rate of error. The output returned to the previous iteration to analyze any weight change. The weights are chosen randomly. After each step, the weights get updated and it is a repeated process. The most prominent advantages of BPNN are as follows: • Backpropagation is easy, simple, and fast to program. • Only the number of input parameters needs to tune. • It can work without having proper knowledge of the network. The algorithm of BPNN is shown in Figure 2.

2) DEEP LEARNING-BASED LSTM NETWORK
Neural network use neurons to transmit input data to get output responses, their deep learning system work with the transformation and extraction of features. Deep learning work with neurons that are interconnected and inspired by the human brain. LSTM is a deep-learning algorithm designed by Hochreiter and Schmidhuber. LSTM is an advanced type of Recurrent Neural Network (RNN). Power system load forecasting has been based on this method [34], for quick detection in power system LSTM is used [35], and so many other works [36], [37], [38] has shown the popularity of LSTM has increased in the field of power system because of having to multitask learning ability. To enable the storage and access of information over a long period, a memory cell is imported into the RNN structure and it runs straight down the entire chain. To add information to the memory cell, LSTM uses different optional gates. The output gate controls any entries from the cell. The input gate decides when to read data, while the forget gate is responsible for resetting the cell. A basic LSTM structure is given in the literature [39], [40].

3) DATA COLLECTION, TRAINING, AND TESTING
Neural networks and deep learning networks can be developed when input and output data are available for prediction and response. Therefore, training the network or developing the network is a very important part of it. To develop the  For the training of ANN for the detection, classification, and detection of fault location, MATLAB neural network fitting toolbox is used. Where 10 hidden neurons are used with 70 % of training, 15 % of testing, and 15 % of testing data. After training the neural network, the trained network is exported as MATLAB/Simulink model and used in the studied model for fault detection, classification, and detection of location. The flow chart of the proposed deep learning-based LSTM network is given in Figure 3(a) and an LSTM cell structure is shown in Figure 3(b), where c and h represent the current state quantity and the current output of the LSTM unit respectively For the training of the LSTM network fault voltage and current data of input as well as output is used, out of that 15% of data is used as testing data. A total of four layers have been utilized with 200 hidden units. The layers are the sequence input layer, LSTM layer, full connected layer, and regression layer. The number of epochs for training is 250. The LSTM network is built by MATLAB coding whose parameters are given in Table 1.
The NN toolbox and the LSTM network both use the whole dataset in three parts. The first part is the training dataset. This is responsible for the training of the NN by updating the network weights and computing the gradient till the error is zero. The second part of the dataset is validating the data set. The data set is validated, and it is used for the training. The third part is known as the testing set. The test set of data is different from training data which is not used to train. This test set of data examines the trained network. To achieve a good result large dataset is required. Therefore, different fault condition has been considered and observed at multiple locations of the transmission line. The process of fault detection, classification, and location are discussed below.

4) FAULT DETECTION
The deep network detects the fault depending on the inputs. The inputs are three-phase voltage signals, three-phase current signals, and zero sequence voltage and current. The values of input currents and voltages are updated by the pre-fault values of the currents and voltages respectively. The output of the deep network is in binary form, i.e., 1 or 0, where 1 indicates the appearance of the fault and 0 indicates the no-fault condition. Figure 4 shows the MATLAB/Simulink block for the detection of a fault in the studied model. Where the deep network takes 8 inputs in the form of voltage and current from the location of the fault that is been created in the three-phase line of the studied model as shown in Figure 1. It provides an output in binary form. When the fault is detected successfully it gives output as 1.
The same process of fault detection is applied to detect the fault in the studied model with the ANN technique but a trained ANN network is applied in this case. The ANN is trained with the same data set that is been used to train the LSTM network and the deep network shown in Figure 4 is replaced by this trained ANN network.

5) FAULT CLASSIFICATION
The same process is used for the development and design of the deep network for the classification of faults. The developed Network takes a set of eight inputs. Hence the deep network provides four numbers of outputs, one is for the ground line and the other corresponds to the three-phase line fault. The output result is in the binary form where 1 denotes the existence of fault on the corresponding line and 0 denotes the nonexistence of fault. The developed network with the connection of input and output ports is shown in Figure 4.
Also, for the classification of fault type by ANN-based technique same classification and the same model is applied. But the network that is used in this ANN-based technique is a trained neural network, trained in MATLAB neural network fitting toolbox with the help of pre-fault dataset, and the deep network shown in Figure 4 is replaced by this network.

6) FAULT LOCATION DETECTION
The MATLAB/Simulink neural network toolbox is utilized to detect fault locations in the line. For the detection of the location of various types of faults, two different NN are developed. The first one is used for the detection of line-to-ground and double-line-to-ground faults. Two inputs which are zero-sequence voltage and zero-sequence current are fed. The second one is used for location detection of double line fault, triple line fault, and triple line to ground fault as shown in Figure 5. The outputs depend on one input which is voltage. Figure 6 shows the structural diagram of the Simulink model for validation of the proposed method in OPAL-RT.      However, in figure 10, along with the fault detector graph, some disturbances can be seen in the AG graph, ABG graph, BCG graph, and ABCG graph. For the fault detector graph of figure 10, the fault detection signal rises at 0.2 sec of simulation time but also before that it rises from 0 to 1 in between the time duration of 0 to 0.1 sec. But the fault detector graph of the proposed technique shows fault is first detected at 0.2 sec 62680 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.              method and LSTM-based method respectively. From the fault detector graph of figure 18 and figure 19, it can be seen that the detector signal rises from 0 to 1 at the exact time of fault creation which is 0.2 sec for both techniques. There is no delay in detecting the fault and the detector signal stays at 1 for the remaining time which tells that fault is still present in the line. For classification, figure 18 shows ANN based technique successfully classify the type of fault because the fault signal rises from 0 to 1 and stays at 1 for the remaining time only for the BCG fault graph but with a bit of delay in this process that can be seen in the BCG fault graph of figure 18 and only disturbance can be seen in CG fault graph. In this classification process, LSTM based technique performs better as seen in figure 19. In figure 19    and the fault is present in the line. But for the LSTM-based technique, figure 21 shows that the detector signal of the fault detector graph rises from 0 to 1 at exactly 0.2 sec of simulation time. In the process of classification ANN base output in figure 20 shows, the fault signal rise from 0 to 1 and stays at 1 for some time duration for both the ABCG fault graph and the ABC fault graph. That tells that ANN based technique is not able to classify the type of fault. Some other disturbances can be seen in the BC fault graph and the AB fault graph of figure 20. But figure 21 shows that LSTM based technique successfully classifies the type of fault because the fault signal rises from 0 to 1 only for the ABCG fault graph.
So, in both classifying and detecting the fault LSTM based technique gives a better response than ANN based technique.
Although ANN-based technique can detect the fault with some delay in the detection process.  Figure 22 shows the ANN-based output and figure 23 shows the LSTM-based output for the detection and classification of line AB fault. In the fault detector graph of figure 22, the detector signal rises from 0 to 1 after 0.2 sec with some delay in it, not at exactly at 0.2 sec of simulation time, and stays at 1 for the rest of the simulation time. So, the ANN technique can detect the fault but with some delay in the process. But the fault detector graph of figure 23 shows that   the fault detector signal rises from 0 to 1 at exactly 0.2 sec of simulation time and stays at 1 for the rest of the time. So, the LSTM technique gives a better response to detecting the AB fault. To classify the type of fault, the AB fault graph of figure 22 shows a fault signal rise from 0 to 1 with some delay and stays at 1 for the rest of the simulation time. But the AB fault graph of figure 23 for the LSTM-based technique shows that the fault signal rises from 0 to 1 at exactly 0.2 sec time.
So, both techniques can classify and detect the AB fault without any disturbance but ANN based technique gives its response with some delay.  Figure 24 and figure 25 show the AC fault detection and classification results for ANN based technique and LSTM-based technique respectively. If the detector signal or the fault signal rises from zero to 1 that denotes the presence of fault and type of fault. In figure 24, the fault detector signal in the fault detector graph rises from 0 to 1 but not exactly at 0.2 sec, after 0.2 sec with some delay that conforms to the occurrence of a fault, and the signal 62688 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.         and length of the transmission line respectively. In figure 30 it can be seen that the output signal of the fault location detector rises from 0 to 10 at 0.25 sec and 10 denotes the location of the fault in kilometers. So, it confirms that the fault is at the 10 km end of the transmission line. The detector signal stays at 10 for the time duration of 0.25 second to 0.4 sec, which conforms that for that time duration fault is present in the line at 10 kilometers.

M. CASE 13: FAULT LOCATION AT 5 KM LENGTH
In case 13, the fault is created in the studied model of Simulink at a 5-kilometer end at 0.2 sec and the output of the location detector is given in figure 31. Where the Y-axis represents the length of the transmission line and X-axis represents the simulation time. It can be seen in figure 31 that the detector output is at the 0-kilometer end for the time duration of 0 to 0.2 sec. After that, it rises from 0 kilometers to 5 kilometers point at 0.2 sec of simulation time and stays at it for the rest of the time. So, figure 31 shows that the fault occurs at 0.2 sec of simulation time at 5 kilometers end of the transmission line, and for the rest of the simulation time fault is at 5 kilometers end.
For the detection and classification of different types of faults ANN based technique and LSTM based is applied and their results are discussed in cases 1, case 2, case 3, case 4, case 5, case 6, case 7, case 8, case 9, case 10, and case 11. After a complete analysis and comparison of the results of these two techniques, it has been found that the proposed LSTM-based technique is better at classifying the type of fault as well as detecting the fault. In some cases, like case 1, case 5, case 6, and case 11 both techniques can detect the fault accurately when a fault occurs in the line but in other cases like, case 2, case 3, case 4, case 7, case 8, case 9 and case 10 the proposed LSTM based techniques is For the detection of the location, a combination of deep learning and ANN-based technique is applied and a complete analysis of location detection is given in case 12 and case 13. In both cases, it has been found that the combination technique can detect the location of fault accurately. VOLUME 11, 2023

IV. CONCLUSION
In this study, deep learning-based LSTM network is applied for the detection and classification of the faults and a combination of LSTM and ANN is applied for the detection of the fault location where the fault occurred in MG. Three-phase voltages, three-phase currents, and zero sequence voltage and current are applied as input signals for both networks. The inputs are normalized concerning their pre-fault values. At different times various types of power system faults are created in the model and results for every condition are studied with the proposed method. For the classification and detection of a fault, the proposed technique is compared with the ANN-based classification and detection technique. After a complete analysis of results for different types of faults, it has been found that the proposed LSTM-based technique is much more accurate and better in classifying and detecting the fault. The proposed system has been effectively implemented in the real-time platform of simulation using the OPAL-RT digital simulator. The results show that the proposed technique successfully detects the fault and classifies their types in the MG. Furthermore, the combination successfully detects the location of the fault that occurred in the MG.  SAGER ALSULAMY received the Master of Science degree in electrical engineering from the University of Southern California, in 2016, where he gained interest in renewable energy and climate change. During his master's studies, he participated in the smart grid regional demonstration project and electrical vehicle program. He is currently a Master's Research Student. His Ph.D. research involves energy decarbonization pathways for newly built cities in Saudi Arabia. His previous experience includes working in the utility as an Electrical Engineer in the distribution sector, testing, and commissioning high to mediumvoltage substations, and routine and type tests for different electrical network equipment, such as cables, transformers, circuit breakers, and overhead lines. His research is focused on developing low carbon transition pathways plan for a non-grid-connected case study city in Saudi Arabia.
TAHA SELIM USTUN (Member, IEEE) received the Ph.D. degree in electrical engineering from Victoria University, Melbourne, VIC, Australia. He is currently a Researcher with the Fukushima Renewable Energy Institute (FREA), National Institute of Advanced Industrial Science and Technology (AIST), where he leads the Smart Grid Cybersecurity Laboratory. Before that, he was a Faculty Member with the School of Electrical and Computer Engineering, Carnegie Mellon University, Pittsburgh, PA, USA. He has been invited to run specialist courses in Africa, India, and China. He has delivered talks for the Qatar Foundation, the World Energy Council, the Waterloo Global Science Initiative, and the European Union Energy Initiative (EUEI). His research has attracted funding from prestigious programs in Japan, Australia, the EU, and North America. His current research interests include power systems protection, communication in power networks, distributed generation, microgrids, electric vehicle integration, and cybersecurity in smart grids. He is a member of the IEC Renewable Energy Management WG8 and IEC TC 57 WG17. He also serves on the editorial board for IEEE ACCESS, IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS, Energies, Electronics, Electricity, World Electric Vehicle Journal, and Information.