A Novel Microgrid Islanding Detection Algorithm Based on a Multi ‐ Feature Improved LSTM

: Islanding detection is one of the conditions necessary for the safe operation of the mi ‐ crogrid. The detection technology should provide the ability to differentiate islanded operations from power grid disturbances effectively. Given that it is difficult to set the fault threshold using the passive detection method, and because the traditional active detection method affects the output power quality, a microgrid islanding detection method based on the Sliding Window Discrete Fou ‐ rier Transform (SDFT) ‐ Empirical Mode Decomposition (EMD) and Long Short ‐ Term Memory (LSTM) network optimized by an attention mechanism is proposed. In this paper, the inverter out ‐ put current and voltage at the point of common coupling (PCC) are transformed by the SDFT. The positive sequence, zero sequence, and negative sequence components of voltage and current har ‐ monics are calculated and reconstructed by adopting the symmetrical component method (SCM). Meanwhile, the current and voltage are decomposed into a mono intrinsic mode function (IMF). The symmetric components of voltage, current, and IMFs are used as inputs to the deep learning algorithm. An LSTM with the features extracted to classify islanding and grid disturbance is pro ‐ posed. By using the attention mechanism to set the weight values of the features of hidden states obtained by the LSTM network, the proportion of important features increases, which improves the classification effect. MATLAB/Simulink simulation results indicate that the proposed method can effectively classify the islanding state under different working conditions with an accuracy level of 98.4% and a loss value of 0.0725 with a maximal detection time of 66.94 ms. It can also reduce the non ‐ detection zone (NDZ) and detection time and has a certain level of noise resistance. Meanwhile, the problem whereby the active method affects the microgrid power quality is avoided without disturbing the current or power of the microgrid.


Introduction
The microgrid can operate in both island mode and grid-connected mode.With the rapid development of the new energy industry, the new energy power grid-connection mode significantly affects the stability of the power grid.The islanding effect occurs when a grid fails due to overhaul or accidental failure and the distributed power generation system entering the grid cannot be detected and separated from the grid in time, resulting in a problem with the load supply of an independent, integrated distributed power system.This is a common fault [1].A typical example of the islanding effect is shown in Figure 1, which includes a synchronous generator and inverter-based distribution generation such as solar photovoltaic, wind farm system.For unplanned islanding operations, the reliability of the power supply cannot be guaranteed, which harms the power generation system and can even cause potential harm to humanity.To ensure the safety and power quality of the microgrid, the microgrid should have the capability to undergo rapid islanding detection during unplanned islanding operations, and its maximal detection time should not exceed 2 s.Therefore, effective islanding detection is an essential condition for grid-connected operations of the microgrid [2].Islanding detection methods usually include three method types: communicationbased, active, and passive [3].In the communication-based method, the objectives of a small non-detection zone (NDZ) and fast detection are achieved without disturbing the current or power of the microgrid.However, the communication devices have a significant cost, which is a barrier to their application.The active method detects the islanding state by introducing a deliberate disturbance to boost the variation during the islanding operation mode by inducing factors such as active frequency drift [4], disturbance power [5], and impedance measurement [6], etc.Meanwhile, the active method has the advantage of a small NDZ and fast detection; however, it causes power quality problems due to the injection of disturbance signals, which slow down the system's performance.The passive method is based on the local voltage or frequency measurement.It detects deviations from specified fault thresholds, such as over-voltage, low-voltage, over-frequency, and low-frequency protection methods [7] as well as harmonic detection [8].The passive method has a large NDZ under the power mismatch scenario, leading to misdetection.In [9], a hybrid method with active and passive methods was proposed, but its detection efficiency has yet to be improved.Under the power mismatch scenario, the NDZ and fault threshold are the main factors that affect islanding detection.The selection of islanding features and suitable thresholds is the key to islanding detection.To overcome the weaknesses of the islanding detection methods mentioned above, the combination of signal processing with deep learning is a new way to alleviate the threshold and NDZ problems in islanding detection [10].Signal preprocessing is used to extract important features of the input signal.The primary signal processing tools used for islanding detections are S-Transform [11], Hilbert Huang Transform [12], Wavelet Transform (WT) [13], TT-Transform [14], and Empirical Mode Decomposition (EMD) [15].Deep learning is used to train and build a model for islanding classifiers based on the features of the test signal, such as the Artificial Neural Network (ANN) [16], Perceptron Neural Network [17], and Convolutional Neural Network [18].
The back-propagation (BP) algorithm-based islanding detection method was employed in [19].This can identify islanding states based only on the voltage in the sample cycle by singular value decomposition (SVD), leading to locally optimal solutions.In [20], islanding detection based on the detection of non-stationary modal voltage signals using the variational mode decomposition (VMD) and ANN was proposed; however, it is easy to detect errors when the distributed power system provides all of the load power.In [21], the use of autoregressive (AR) signal modeling and the support vector machine (SVM) to extract the voltage waveform of the distributed power source was reported.However, this method is time-consuming due to the need for voltage and current data.In addition, it does not consider systems with multiple inverters.The Long Short-Term Memory (LSTM) network was used for islanding detection in [22], where it was employed as the feature extractor and classifier, resulting in the accuracy of detection suffering due to the LSTM model structure.Moreover, multi-LSTM architecture was adopted to detect islanding in [23].To select islanding features, in [24], the difference between the point of common coupling (PCC) voltage and current signals was extracted along with their respective reference values through the two-layer WT, and the BP neural network was used for feature classification.However, the selected characteristic quantity could not fully reflect the characteristics of islanding, leading to the possibility of misdetection.In [25], the relative mode energy ratio, mode instantaneous amplitude, number of zero crossings, and center frequency were transformed by VMD using the subspace-K-nearest neighbor (SSKNN) to train and test the model to recognize un-intended islanding events.However, the dilution effect between different distributed power generation sources was not considered.In [26], an islanding detection method with empirical WT, which decomposes the three-phase voltage signal into empirical modes or sub-bands and combines the instantaneous amplitude and instantaneous frequency of different frequency bands, was proposed.The above methods can accurately identify islanding and non-islanding events when the output power of the power supply and the absorbed power of the load in the microgrid are not equal.Nevertheless, these methods do not consider the tiny changes in the inverter output active power and reactive power during unplanned islanding effects, which mean that the PCC voltage and frequency do not change significantly.In this case, it is not easy to detect the islanding state.Table 1 shows a comparison of features of the proposed method with other related methods described in the literature, including the test system, feature extraction methods, classifier, input signal, point of measurement, and NDZ analysis.The LSTM network can be used as both a feature extractor and classifier, and its islanding detection performance depends entirely on the structure of the LSTM network.In order to truly improve the performance of the LSTM network, the LSTM network's capabilities in the field of islanding detection must be improved.

Ref.
Test System

Classifier
Input Signal

Point of Measurement
No Need for Pre-Processing NDZ Analysis [19] Inverter With the development of the "Smart Grid" and "power Internet of things", the intelligent islanding detection model has gained broad application prospects following the future development of the microgrid.Based on the above discussion, this paper proposes an approach for rapid intelligent detection of islanding events that has a superior performance when working with noisy measurements as it improves the feature extraction of voltage and current signals and has the structure of a deep learning network.Firstly, the instantaneous three-phase voltage at the PCC and inverter output current measurements are processed using the sliding window discrete Fourier transform (SDFT) and symmetrical component method (SCM), and the symmetrical components of voltage and current are extracted.Meanwhile, the voltage and current are decomposed into IMF1, IMF2, and IMF3 by empirical mode decomposition (EMD).IMF2 and IMF1 times IMF3 are extracted.The above ten extracted features are used as inputs to the deep learning algorithm.Then, the attention-mechanism-optimized LSTM network classifier is established to rebuild the feature quantity and achieve a higher level of accuracy.Meanwhile, the LSTM network classifier offers superior training and testing accuracies.The major contribution of this study is its novel aspects, which include the following: 1.A new islanding detection scheme based on the multi-feature and attention-LSTM method is proposed for microgrids with all types of inverted, interfaced distributed generation units.The proposed scheme can also be implemented on synchronous generators.2. A deep learning classier based on the attention-mechanism-optimized LSTM network is applied.3. A novel index for islanding detection is proposed.The method combines SDFT-SCM with EMD, which is a good way to retrieve the essential features of signals during islanding and disturbance conditions.The proposed method does not require a threshold value.4. The proposed method has an accuracy level of 98.4% and a loss value of 0.0725 with a maximal detection time of 66.94 ms and a reduced NDZ and detection time.The robustness of the proposed scheme is verified by its anti-noise performance.5.The proposed method is recommended due to its accuracy and detection time compared with other methods, such as the pure 1D-CNN, BP, SVM, and LSTM.
The rest of the paper is structured as follows: Section 2 introduces an analysis of the islanding features of the microgrid; the basic theory of the SDFT and SCM is discussed in Section 2.1; and an analysis of the islanding features index of the SDFT-SCM is discussed in Section 2.2.1.An explanation of empirical mode decomposition and an analysis of the islanding features index is provided in Section 2.2.In Section 3, an intelligent fault identification algorithm for the microgrid based on improved-LSTM deep learning is introduced.In Section 4, the simulation process used in the proposed method is presented, and the test system is discussed in Section 4.1.In Section 4.2, the experimental environment and results are presented.In Section 5, a performance analysis of the methodology is given.Finally, in Section 6, the theory proposed in this paper is summarized.

SDFT and SCM
The combination of signal processing with deep learning is a new way to alleviate the threshold and NDZ problems in islanding detection.The most common method used for frequency domain analysis is Fourier transform (FT), but it cannot detect the time distribution of different frequencies.The discrete Fourier transform (DFT) evolved from FT is usually used to analyze the harmonic components of sinusoidal signals.The DFT calculation formula is As in Equation (1), N is the calculated length, x(n) is the value of the n-th sample, k is the harmonic order, and X(k) is the detection result for the n-th harmonic.The power system has a solid real-time performance.When the frequency of the power system fluctuates, the truncation of the time-domain will produce spectrum leakage and non-integer period sampling, and harmonic extraction based on the Fourier transform will have a large error.The SDFT modifies the DFT by adding a sliding sampling window, which inherits the advantages of the DFT.It greatly accelerates the operation speed of the DFT and can improve high ability to track signal changes.In the power system harmonic detection and analysis field, the SDFT can be used to analyze both entire harmonics and single harmonics.It has a superior ability to update data and is suited to programs on computers.Thus, the SDFT has an outstanding advantage in harmonic components, it can be used in scenarios of islanding detection.In two adjacent calculations, the algorithm updates a sampling value, and its iterative calculation formula can be expressed as [27]   As in Equation ( 2), x(n) is the current sampled value and Xs(k − 1) is the result of the previous calculation.Equation (3) shows that the SDFT extracts the n-th harmonic component of voltage.
where Ncur represents the latest sampled point; An and Bn represent the cos() coefficient and sin() coefficient of the n-th harmonic, respectively; SDFT transforms the discrete frequency spectrum of the voltage and current harmonics; and the amplitude and frequency of each harmonic can be obtained accurately.
The harmonics extracted by the SDFT are very complex.They include the positive sequence, zero sequence, and negative sequence components.The zero sequence component usually does not affect the system, and it is necessary to use the symmetric component method to extract the positive sequence, zero sequence, and negative sequence components.The size of the symmetric sequence component is used to indicate the presence of interference in the voltage or current waveforms [28].The SCM transforms the inverter's three-phase voltage (Va, Vb, Vc) of the PCC and the output current (Ia, Ib, Ic).The calculation formula can be expressed as where a is the operator, and a = 1∠ − 120°, Vp, Vn, V0 are the positive, negative, and zero sequences of the voltage, respectively; Ip, In, I0 are the positive, negative, and zero sequences of the current, respectively.Figure 2 shows the feature extraction flow of the proposed islanding detection method, and we define the islanding features as X1 = (Vp, Vn, V0, Ip, In, I0).

Analysis of the Islanding Features Index by SDFT-SCM
Case A: Opening of The Circuit Breaker at the PCC With a Loaded Quality Factor Qf = 1 The parameters of the parallel RCL load are R = 0.64  , C = 4.97 mF, and L = 2.04 mH.At this time, the load quality factor is 1, and the resonance frequency of the RCL load is 50 Hz.The three-phase circuit breaker opens at 0.8 s.The current flowing into the grid is 0 A instantaneously at 0.8 s, as shown in Figure 3a.Meanwhile, microgrid status changes from grid-connected to islanding.Since the resonance frequency of the RCL load is equal to the system's frequency, the voltage frequency is stable, as shown in Figure 3b.In Figure 3c,e, the voltage at the PCC and the inverter output current do not fluctuate significantly.The power required by the load is totally provided by the inverter.Under these circumstances, the over-voltage, under-voltage, over-frequency, and under-frequency protection methods cannot effectively identify islanding events.It is difficult to detect islanding events using the test system under the most severe conditions.
The second harmonic symmetrical components of the voltage at the PCC and the output current waveforms are shown in Figure 3d,f.The positive sequence, zero sequence, and negative sequence components show the interference of the voltage and current waveforms.The symmetrical voltage components increase remarkably from 0 to 2 V.At the same time, the symmetrical current components are unstable.
Case B: Opening of The Circuit Breaker at the PCC With a Loaded Quality Factor Qf = 2.5 The load quality factor is changed to 2.5 by changing the parameters of the parallel RCL load to: R = 0.64  , C = 4.97 mF, L = 0.326 mH. Figure 4d,f show that the second harmonic symmetrical components of the voltage and current waveforms contribute significantly during the islanding event.Case C: Three-phase Short Circuit at the PCC An unintentional islanding event is conducted using a three-phase short circuit between the distributed power and the utility grid at the PCC.The three-phase fault occurs at t = 0.8 s.The simulated waveform results of the PCC voltage and the inverter current at the moment the fault occurs are shown in Figure 5c,e, and the second harmonic symmetrical components of the voltage and current waveforms are shown in Figure 5d,f.After the fault occurs, the positive, zero, and negative sequence components of the voltage and current harmonics change obviously.

EMD
EMD is a signal splitting technique that decomposes a time series into intrinsic mode functions (IMFs) with a separate range of frequencies.Different IMFs represent different characteristic fluctuation series, making the fluctuation characteristics of the original data stand out at different time scales.The randomness of voltage and current signals in the microgrid can enrich the diversity of input variables through EMD decomposition.Meanwhile, the IMFs highlight the local characteristics of the voltage and current signals under different time scales and reflect the fluctuation, periodicity, and trend change of the original environmental series.The specific decomposition steps for the EMD processing algorithm are as follows 1.For a voltage or current signal x(t), all maximum points are identified as the upper envelope xu(t), and all minimum points are recognized as the lower envelope xl(t).m(t) represents the mean value of the upper envelope and the lower envelope and can be calculated using Equation Therefore, the first IMF h1(t) is as follows 2. In step 2, h1(t) is regarded as the original data, and m1(t) is the mean value of the upper and lower envelope of h1(t).The second IMF h2(t) is determined using the method shown in Step 1. 3. The same process is repeated to evolve the subsequent IMFs, and this is repeated n times until hn(t) is an IMF or the residual component rn(t).Then, the decomposition process terminates.4. In conclusion, and residual component rn(t), as shown in Equation (8).

Analysis of the Islanding Features Index by EMD
Taking the voltage at the PPC as an example, the IMFs of the above four voltage cases are illustrated in Figure 7.However, in the IMFs decomposed by EMD, a false modal component appears in the low frequency part, and the noise component appears in the high frequency part, negatively impacting islanding detection.We use the Spearman rank correlation of the IMFs and the original signal as a measure to choose IMFs that should be reserved and discarded.The Spearman rank correlation (r) can be calculated as The Spearman rank correlations between the IMFs and the original signal are illustrated in Figure 8 The Spearman rank correlations of IMF1, IMF2, and IMF3 are 0.1, 0.94, and 0.016, respectively, showing a better correlation.Due to the low level of correlation between IMF1 and IMF3, their product is taken as another islanding feature, as shown in Figure 9. Therefore, IMF2 and IMF1 times IMF3 is considered for the feature extraction of islanding detection using EMD feature extraction.Finally, we define the islanding features X2 = (VIMF2, VIMF1*IMF3, IIMF2, IIMF1*IMF3).

The LSTM Network
The emergence of the LSTM network mainly alleviated the gradient disappearance and gradient explosion of Recurrent Neural Networks.The core components of the LSTM network are the input layer and the LSTM layer.The input layer signals are time series data, and the LSTM layer learns the correlation between sequence data and time [29].The LSTM network framework used for islanding detection is shown in  . .
The specific mechanism used by the LSTM cell is shown in Figure 12, where ft is the forget gate, it is the input gate, and ot is the output gate.The three gates can control whether information is discarded or inherited.The calculation of each state is done as follows [30] where sigmoid () and tanh () are activation functions, and  are learning parameters.k and d are the input size and the size of the hidden layer, respectively.The operator  refers to the element-wise multiplication of vectors.ht−1 and Xt are the output at the previous time and the input at the current time, respectively.In this work, the input signal Xt represents the symmetrical components of the inverter output current, the voltage at the PCC, and the IMFs extracted by EMD.

Attention Mechanism
The attention mechanism introduced into the LSTM network model improves the learning and recognition performance of the LSTM network, which adaptively scores the features learned at the LSTM network and assigns weights to them.Thus, the probability of each mode is more accurately calculated in the final fully connected layer.The hidden layer state hf of the LSTM network is used as the input to the attention mechanism to obtain the attention weight et.ut is the attention probability vector normalized by softmax.The calculation process is as follows [31] tan h ( ) The hidden layer state hf of the LSTM network is multiplied by the attention probability vector ut to obtain the corresponding weight matrix st as shown in Equation (13).
The core of the attention mechanism is the matrix calculation.Since st contains important information about the attention mechanism layer, st is connected to the softmax layer through the fully connected layer.The result of the softmax layer is mapped to a probability value between 0 and 1, and the probability is calculated as follows [32] max( ) where  are learning parameters.

The Proposed Intelligent Islanding Detection Algorithm for the Microgrid
A framework based on hybrid signal processing and the deep learning algorithm was developed for fault diagnosis during intelligent islanding detection, as presented in Figure 13.The proposed detection algorithm is a three-step procedure in which the first step is to build a microgrid model in MATLAB/Simulink.To improve the multi-feature detection accuracy, the second step is feature extraction, which is classified as SDFT-SCM and EMD.The islanding features X1 = (Vp, Vn, V0, Ip, In, I0) and X2 = (VIMF2, VIMF1*IMF3, IIMF2, IIMF1*IMF3) are extracted, respectively.In the third step, deep learning based on the LSTM network is applied to identify islanding decisions.In addition, we originally proposed the integration of a feature attention mechanism layer into the LSTM framework for better feature extraction by weighing features.The multi-features Xt = (Vp, Vn, V0, Ip, In, I0, VIMF2, VIMF1*IMF3, IIMF2, IIMF1*IMF3) are obtained by combining the islanding features X1 = (Vp, Vn, V0, Ip, In, I0) with X2 = (VIMF2, VIMF1*IMF3, IIMF2, IIMF1*IMF3) to determine the attention-LSTM of the feature vector space.This can be used to detect islanding events under different working conditions.Islanding detection is essentially a two-classification event, which means that the results of the classifier outputs are composed of two states: label 1 represents islanding events, and label 0 represents non-islanding events.The proposed issues involved in the proposed architecture are summarized as follows Step 1: Building a microgrid model in MATLAB/Simulink based on a three-phase voltage source inverter.Both the sampling frequency and switching frequency are 5 KHz.Simulating the system's operation under different islanding or non-islanding conditions, such as the occurrence of circuit breaker tripping under other quality factors, all types of short-circuit faults at the PCC, and local load changes.
Step 2: To obtain each harmonic's amplitude and frequency information, the measured signals are transformed by the SDFT.The harmonic that has the most significant impact on the system needs to be determined.The positive sequence, zero sequence, and negative sequence components of voltage and current harmonics are calculated and reconstructed by adopting the SCM.Meanwhile, the voltage and current are decomposed into IMFs by EMD.
Step 3: The fusion features Xt are input into the attention-LSTM.Meanwhile, the characteristic data are divided into the train, verification, and test samples.
Step 4: The LSTM network model optimized by the attention mechanism is initialized, and the training samples are used as the feature vector space of the LSTM network.The offline training model parameters are introduced to the online detection model after training has been completed.
Step 5: The test samples are imported to verify the identification accuracy of the online detection model for direct islanding detection under different conditions, and the model's performance is evaluated.

Test System
Figure 14 depicts the ordinary inverter control strategy used in the simulation model.As the current source in the microgrid, the inverter adopts single current loop control with the given output current and Space vector pulse width modulation technology (SVPWM).The sampled current frequency and voltage vector are transformed by a single synchronous reference frame software phase-locked loop (SSRF-SPLL).The frequency of the system's power is 50 Hz, and the switching frequency is 5 kHz.The grid line voltage is 270 V, the inverter's output power is 100 kW, the inverter's output filter reactor is 0.3 mH, and the filter capacitor is 960 uF.The parameters of the parallel RLC load are as follows: R = 0.64  , C = 4.97 mF, and L = 2.04 mH.The loaded quality factor reflects the resonance capability of the local load.The greater the load quality factor, the stronger the resonance capability of the local load, Qf, which can be represented as where Qf is the loaded quality factor, and R, C, and L are the resistance, capacitance, and inductance.The data sample is the basis of the training of the attention-LSTM network, the electrical parameters at the PCC are measured on the static switch, so four case studies are presented to assess the performance of the proposed methodology when detecting islanding.These case studies include tripping a circuit breaker at the PCC with the loaded quality factor quality factors of 1 and 2.5; all types of short-circuit fault at the PCC; and local load mutations.SDFT-EMD transforms the sampled data within 6 ms under different working conditions, and the voltage and current harmonics are calculated and reconstructed using the SCM.The IMFs are extracted by EMD.The combined feature vector is used as the training and test sample in the attention-LSTM network, and islanding and non-islanding are the output labels.

Experimental Environment and Results
All experiments were carried out on a work-platform with Intel i5-10500 CPU @ 3.10 GHz, 8 G RAM.A deep learning experiment environment was built based on Anaconda3 and PyCharm.The programming language used was Python 3.6, and the framework of deep learning was TensorFlow 2.0.The parameters R, L, and C varied with the load quality under different working conditions.A total of 4504 islanding and 1497 non-islanding events were generated for the test system, and these were divided into mutually exclusive training, verification, and test samples.The ratio of segmentation was 7:1.5:1.5.
The number of hidden layer nodes is the key to the detection performance.Numerous experiments and many alternative options were used to determine the optimal values for the proposed model parameters.Therefore, the parameters, hyper-parameters, and layer type utilized in training/testing/verifying were carefully chosen, and the obtained specific values are given in 2. The results of feature weight extraction of the LSTM hidden layer by the attention mechanism are shown in Figure 15, and important fault information is highlighted.Figure 16 shows the accuracy and loss of the trained model with an average training accuracy of

Anti-Noise Performance
To verify the performance of the detection algorithm under the influence of noise, the above four examples were selected for simulation.White Gaussian noise interference was added to the voltage at the PCC.Three new data sets with signal-to-noise ratios (SNRs) of 40, 50, and 60 dB were generated, and test samples of noise interference were obtained.The noise interference test samples were input into the attention-LSTM network for testing.The test results are shown in Table 3.The smaller the SNR, the higher the noise content, so the test accuracy decreased with 40 dB SNR.In contrast, when the SNR was 50 or 60 dB, the algorithm has a certain anti-noise performance and robustly distinguishes islanding events between the islanding effect and noise interference.

Detection Time
The islanding detection time comprises the time taken for sampling, feature extraction, and test code execution.In terms of the sampling time, the transient variation of the fault is about 2.5 to 3 ms, the sampling time of the simulation model is 1 us, and the sampling time required to acquire 6001 samples is about 6 ms.In terms of the feature extraction time, the average time required to complete feature extraction is 31.67 ms.In terms of the test code execution time, the trained model does not need to be taught again in subsequent calculations, and the test time is 29.27 ms.In summary, the maximum detection time is 66.94 ms, satisfying the IEEE Std 1547.6-2011 and GB/T33593-2017 islanded detection standard.

Comparison with Other Algorithms
For the sake of verifying the effectiveness of the proposed method based on the SDFT-EMD-Attention-LSTM, the 1D Convolutional Neural Network (1D-CNN), LSTM, BP Neural Network, and SVM are used in comparison experiments.On the one hand, pure neural networks take the raw data as the input.On the other hand, the multi-feature + 1D-CNN, multi-feature + LSTM, multi-feature + BP, and multi-feature + SVM take the signal of fusion features as the input.Moreover, we used the accuracy, precision, recall, and F1-score to evaluate the performance of the above different methods.The four criteria used were TP Pr e TP FP   where TP, TN, FN, and FP are the true positives, true negatives, false negatives, and false positives, respectively.This paper shows the details of the TP, TN, FN, and FP in Table 4. Furthermore, Acc, Pre, Rec, and F1 denote the accuracy, precision, recall, and F1-score, respectively.

True class label
Non-islanding event (0) TP (0, 0) FN (0, 1) Islanding event (1) FP (1, 0) TN (1, 1) As shown in Figure 17, the method proposed in this paper outperformed the above different approaches with an average testing accuracy of 98.4%, with the four criteria having values of over 0.9.Due to the lack of important features, the detection results for the pure neural network were not ideal.Meanwhile, compared with the BP, 1D-CNN, and SVM, the detection results with the LSTM were better for processing time series signals.The proposed method is obviously superior to the pure LSTM, mainly because of the introduced attention mechanism and fusion features.Meanwhile, to clearly analyze the advantages of the proposed method, Figure 18 shows the confusion matrix of the 1D-CNN, BP, and SVM.Of the 125 test samples, 123 test samples were classified correctly using the proposed method, as shown in Figure 18a, and the confusion matrix outperformed the above approaches.The main reason for this is that the effective islanding multi-features obtained by the SDFT-SCM-EMD make it easier to distinguish between islanding and non-islanding events with the Attention-LSTM method.It is revealed that the newly added multi-feature improves the accuracy of islanding detection.The performance of the proposed method was compared with the results given in recent literature, as shown in Table 5.The accuracy of the proposed method (98.4%) was found to be better than the levels of the stacked auto-encoder based deep neural network (DNN) provided in [33] (98.3%) and the artificial neural network provided in [34] (95%), and [35] (78.7%).The detection time of the proposed method was better than those of the Feedback-mechanism [36] and Adaboost [37], reaching 66.94 ms.The iterative procedure of multiple base classifiers of the Adaboost method results in a longer consumption time compared with that of the LSTM network.Moreover, compared with recently published state-of-the-art techniques ( [38][39][40]), the proposed Multi-feature-Attention-LSTM-based method has a higher detection accuracy than the other methods.

Conclusions
Signal processing was combined with an improved-LSTM deep learning algorithm for microgrid islanding detection in this paper, and a high-precision Multi-feature-Attention-LSTM microgrid islanding detection method was proposed.The approach includes feature extraction, classification, and recognition.A new islanding detection index was proposed for harmonic measurements at the PCC and IMFs extracted by EMD.The performance of the algorithm is improved by its multi-feature characteristic.The proposed model was trained and tested using about six thousand non-islanding and islanding events.It was shown to accurately distinguish islanding events from other non-islanding events under harsh conditions in which the load's absorbed power completely matches the distributed generation's output power.In addition, this method effectively alleviates the problem of large NDZ and difficulty in setting fault threshold by the passive detection method.The problem of the active method affecting the microgrid power quality is avoided without disturbing the current or power of the microgrid.The simulation results for grid faults and non-grid faults show that the proposed method can identify islanding events with an accuracy level of 98.4% and a loss value of 0.0725 with a maximum detection time of 66.94 ms.Finally, to clearly analyze the advantages of the proposed method, other intelligent algorithms such as 1D-CNN, BP, SVM, and LSTM were used to train and test the feature dataset.The proposed Multi-feature-Attention-LSTM method is recommended due to its higher accuracy and short detection time compared with other methods.Subsequent work should be done to verify and further study the application of the Multi-feature-Attention-LSTM method for islanding detection based on a real microgrid experimental platform.
The proposed Multi-feature-Attention-LSTM was further verified in different noisy environments and was shown to reduce noise interference and ensure the safe operation of the microgrid.Due to the high training speed of the Attention-LSTM, the microgrid applied with the proposed technology has the function of quick online judgment and warning.Moreover, the multi-feature extraction model can be easily added to, deleted, or changed.The internal structure of the Attention-LSTM can also be easily extended.These advantages make it applicable to other fault diagnosis fields.

Figure 3 .
Figure 3. Islanding simulation waveforms with the loaded quality factor Qf = 1: (a) The current flowing into the grid; (b) System's voltage frequency; (c) The voltage at the PCC; (d) The second harmonic symmetrical components of the measured voltage; (e) Inverter output current; (f) The second harmonic symmetrical components of the measured current.

Figure 4 .
Figure 4. Islanding simulation waveforms with the loaded quality factor Qf = 2.5: (a) The current flowing into the grid; (b) System's voltage frequency; (c) The voltage at the PCC; (d) The second harmonic symmetrical components of the measured voltage; (e) Inverter output current; (f) The second harmonic symmetrical components of the measured current.

Figure 5 .
Figure 5. Simulation waveforms of the PCC three-phase short circuit: (a) The current flowing into the grid; (b) System's voltage frequency; (c) The voltage at the PCC; (d) The second harmonic symmetrical components of the measured voltage; (e) Inverter output current; (f) The second harmonic symmetrical components of the measured current.Case D: Local Load Mutation Figure 6d,f show that when the circuit breaker is closed at 0.8 s, the second harmonic symmetrical component values of voltage and current have small peaks and then quickly return to about 0 A, which indicates that the inverter normally works during the transient process.A new parallel RLC load is added, with the parameters R = 0.64  , C = 4.97 mF, and L = 2.04 mH.Because the load power in the microgrid increases, the power grid provides current to the microgrid, and the current flowing into the power grid fluctuates, as shown in Figure 6a.

Figure 6 .
Figure 6.Simulated waveforms with the local load mutation: (a) The current flowing into the grid; (b) System's voltage frequency; (c) The voltage at the PCC; (d) The second harmonic symmetrical components of the measured voltage; (e) Inverter output current; (f) The second harmonic symmetrical components of the measured current.

Figure 7 .
Figure 7.The results of the voltage decomposed by EMD: (a) The IMFs for case A; (b) The IMFs for case B; (c) The IMFs for case C; (d) The IMFs for case D.
Figure 10 shows the proposed feature extraction method.The extracted multi-features Xt are fed into the Attention-LSTM input layer.

Figure 8 .Figure 9 .Figure 10 .
Figure 8.The Spearman rank correlations between the IMFs and the original voltage signal.

Figure 11 .
It is a process in which a time series passes through the LSTM network.The corresponding hidden state h1t, h2t…hkt and the updated cell state Ct are generated by the first LSTM cell based on the initial state Ct−1, ht−1 and the input sequence x11, x12…xk1.Meanwhile, the next LSTM cell updates the current cell state and calculates the hidden output state and another updated cell state.x is the input signal with k characteristics, and h is the number of hidden layer units.

Figure 13 .
Figure 13.Schematic diagram of the intelligent islanding detection method.

Figure 14 .
Figure 14.Simulation model for the microgrid grid-connected system.

Figure 15 .Figure 16 .
Figure 15.The results of the attention mechanism.

Author
Contributions: Conceptualization, Y.X.; methodology, F.Y.; investigation, X.X. and Q.Z.; data curation, Q.H.; writing-original draft preparation, F.Y.; writing-review and editing, F.Y. and Y.X.All authors have read and agreed to the published version of the manuscript.Funding: This research was supported by the Innovation Fund of Postgraduate, Sichuan University of Science & Engineering (y2021061), and the Artificial Intelligence Key Laboratory of Sichuan Province (2021RZJ02).

Table 1 .
Comparison of the proposed method with related methods described in the literature.

Table 3 .
Performance analysis of the algorithm under noise interference conditions.

Table 4 .
Confusion table used in this paper.

Table 5 .
Comparison of the detection time of the proposed method with that of methods proposed in the literature.