Red deer optimized recurrent neural network for the classification of power quality disturbance

Power Quality Disturbance (PQD) in a power grid distribution destroys the quality of power to the user. Thus, early detection of disturbances in the power grid distribution is essential to diagnose the network before failure. Several disturbances in the power grid may cause voltage sag, voltage swell, or occurrence of both. In the proposed method deep recurrent neural network (DRNN) is used for classifying the PQD as well as Red Deer Optimization (RDO) algorithm is used for optimizing the weight from DRNN. Based on the behaviour of deer roaring rate will optimize the weight of DRNN from RDO. Signal processing is done by S-transform (ST) because of the better performance in signals detection in terms of a high order of noise. The proposed method is implemented in Simulink tool and the results are compared with the existing methods. The result shows that the power disturbances are classified with high accuracy of 99.95% and precision of 99.98% that are higher than the existing methods.


Introduction
Recently, problems due to Power Quality Disturbance (PQD) have existed, and the manufacturing Industries commonly face that. The electricity is used for commercial, industrial, and domestic purposes. The country's economic growth also depends upon the total quantity of power produced and supplied [1]. But there have occurred many losses in the presence of irregularity such as interruption in voltage, current, and frequency while transmitting the power [2]. These irregularities will degrade the efficiency of the equipment and cause the breakdown of electrical and electronic equipment. To meet the consumer's requirement, the smart grid technology is concentrated on integrating renewable resources [3,4]. Sometimes PQD can happen because reducing this occur in power electronic devices like electronic inverters and solid-state switches due to large use of electronic charging and an increase of battery energy storage devices at the transformation stage. The connection of various energy resources leads to electronic measurements, asynchronous motors, non-linear loads, and control devices, which provoke the imbalanced current and voltage level. In the view of various PDQs, many energy systems are accomplished and to find different PDQs [12] an effective method is required to overcome the PQ issues. Then, there is an immediate requirement for classifying the PDQ to eliminate equipment damage and enhance the power quality [13].
The detection of PQD is more complex in micro grids [14] than in traditional power systems, but the performance and line faults are the same as that of the traditional power system. For instance, Voltage flickers, spikes, transients and fluctuations have occurred because of switching off the loads immediately, transformer energy, capacitor bank [15], and short circuit issues. A microgrid is considered a significant part of a smart grid as detecting PDQ will be potential and purposeful [16]. Real-time PQ identification assists the system performance and leads to decision making [17] for managing the energy, such as evaluating the working manner of the micro grid. The multiple energy systems or equipment like transformer monitoring and solving the issues at a suitable time provide steady and secure operation and troubleshooting unusual operation.
Moreover, it is mandatory to know about the PQ for regulating, adapting and utilizing. There is an essential requirement to expand the automatic system for recognizing, detecting and inspecting different PQR due to a large amount of field acquired data. Signal analysis [18], feature selection [19], and classification of disturbance [20] are the three phases of the automatic finding of PQR. Depending on signal processing, various signal analyses are introduced by Wavelet Packet Transform (WPT), Short-Time Fourier Transform (STFT), etc., but these methods have some limitations. Then, feature selection is considered an important process for PQR. An adaptive artificial bee colony, swarm optimization, probabilistic neural network, etc., are some methods used for extracting the features. Deep learning, heuristic based technique, and machine learning are some methods used for classification. The deep learning method plays a suitable role in classification of the image [21] from the extracted feature. Deep Neural Network (DNN) contains specialized layers and various trained samples to improve the classification. However, DNN did not provide better accuracy.
The proposed research contribution is listed below, • Consider 35 power quality disturbances with the combination of single, double and multi harmonics.
• Deep Recurrent Neural Network (DRNN) is used for classifying the power quality disturbance. • The Red Deer Optimization algorithm optimizes the weight of DRNN to get the best optimal solution. • The S-transform identifies the signals' disturbance, thus providing better frequency with the least noise.
In this paper, section-1 introduces the proposed method that elaborated different types of PQDs exist in power grid distribution and the types of layers neural networks. Section-2 includes the literature survey about the work, in which different types of neural networks are analysed for PQD classification. Section 3 includes the proposed work that elaborated DRNN network architecture, designing and RDO algorithm model for the layer section in DRNN. Section-4 involves the conclusion of the work that discusses the result obtained from the proposed method.

Literature survey
In micro grid, power electronic equipment, non-linear loads and distributed power generation systems are integrated, so there was a complexity in PQD. Thus, Haihua Xue et al. [22] proposed micro grid PQR classification model using DNN and Spectrogram. The convolutional based and PQD waveform was reconstructed using spectrogram to reduce the PQD issues. The convolution base comprised of batch normalization, 2-D convolution, max pooling layer and dropout to find features, lower over-fitting, and speed up the training. The features were extracted automatically with the help of convolutional base from the waveform at various length of time. The obtained result is in the form of PQD waveform. Moreover, this method did not identify the single and multiple disturbances over various time lengths.
In order to improve the accuracy of PQDs in the power supply, Seckin Karasu and Zehra Sarac [23] proposed 2D-Riesz Transform (RT), Multi-Objective Grey Wolf Optimizer (MOGWO), and Machine Learning schemes. The MOGWO and k-Nearest Neighbor (KNN) were used to classify PQD for selecting the feature. Machine learning scheme was applied for classification from the extracted features. 2D-RT was used to convert 1D signal to 2D signal, and determined 12 sub band metrics for selecting suitable features. In a sub band matrix, about 120 features were determined. As a result, using MOGWO-KNN technique a maximum performance was achieved along with the classification of disturbance and noisy signals.
To improve the automatic identification and classification of PQD and improve system performance, Callum O Donovan et al. [24] proposed a PQD classification technique based on Auto-encoders for automatically detecting and classifying the PQD. Here, mainly two deep learning approaches were introduced as Convolutional Auto encoder based LSTM model Convolutional Neural Network (CNN) (AE)-LSTM and CNN-LSTM (AE). Voltage swell, interruptions, and voltage sags were the various types of PQD. The maximum classification accuracy was determined using CNN-LSTM (AE). The strides and higher filter size reduces the accuracy of convolutional filters.
The voltage instability is the major cause of power quality disturbance in power systems. Thus the early prediction of such defect secures the network from failure. Amr M. Ibrahima & Noha H. El-Amary [25] proposed particle swarm optimization based on RNN for voltage instability prediction to cope with this issue. By using Particle Swam Optimization (PSO) every network is termed as particles that were candidate solutions. On that model back propagation training algorithm is utilized for training the errors. That model used in IEEE 14-bus standard system.
To overcome the defects in traditional PQD classification methods and improve the accuracy, Sami Ekici et al. [26] proposed Bayesian optimized convolutional neural networks for classification of Power quality events. The proposed method used convolutional neural network which applied voltage signal through continuous wavelet transform. For experimental analysis, 1500 real-time disturbances observed from different locations. That proposed model classifies the PQD of voltage sag, voltage swell, harmonics and interruption.
To overcome the limitations of classifying power quality disturbances in the power grid Rodriguez et al. [27] proposed auto encoders and static RNN. That proposed method utilized auto encoder compressed architecture and Long Short Term Memory (LSTM) RNN. That model was evaluated by analysing a mathematically formulated database for nine disturbances. That proposed method reduced the computation time and improved the accuracy.
To overcome the issues of poor noise immunity in the power grid distribution and enhance the quality of power in every stage of the power transmission, ShouxiangWang & HaiwenChen [28] proposed a deep learning method. That proposed method used a deep Convolution Neural Network (DNN) for detecting and classifying the PQD in the network. PQD is considered by constructing 1-D convolution, pooling and batch-normalized layers. By analysing the results from that proposed mode, it was clear that it improved the computation time and accuracy of the system.
To overcome the software defects prediction accuracy and classification Jayanthi and Lilly Florence [29] proposed a feature reduced principle component analysis based scheme. The method used neural network-based classification, which was implemented using MATLAB platform. The result analysis verified that the proposed model offers higher accuracy of 97.20% on software defects prediction.

Problem definition and motivation
The power supply to the consumers faces many interruptions because of the physical and environmental condition of the power system. The poor performed equipment and the network illegal connections were damaged the distribution power supply, and climatic conditions also affect power distribution. Due to these problem, several PQD happen, such as interruption, harmonics, and voltage sag/swell. Here, in this research work, a total of 35 power quality issues are considered that have been happening in the power system due to environmental changes, poor maintenance of electrical equipment's and careless handling of power at the substation. Early detection of these power quality issues is one of the challenging tasks in power distribution. Meanwhile, the early detection is required to proper operation distribution system and transformers. An unregulated supply of power will cause the load to draw a high amount of power along with the load current. To manage it is necessary for early diagnosis of PQD. The literature models make use of only a specified quality issues in power system, but here an elaborate model of disturbances are provided.
Here 35 PQ issues are identified and classified by the using of neural networks. The researchers propose different types of neural networks to overcome the PQD classification. By adopting the neural network for PQD are classified with high accuracy. The early detection and identification of PQD will improve network efficiency.

Proposed method
The proposed method utilized DRNN for PQD classification, in which DRNN is a closed loop feedback network that does not require manual operation. The supervised training process automatically updates each layer's weighting in the network. The DRNN is used in the proposed method to classify the PQD due to the reduced complexity of the network. Signal processing is a technique for effectively analysing the network performance by wavelet transform, ridgelet transform, and curvelet transform however, lack of directionality, oscillation, number of co-efficient degradation, high noise etc. So in order to overcome this issues, S-transform is used in this work. The advantage of using S-transform is it provides better frequency with the least noise. The ST has the composition of attributes in wavelet transform (WT) and Short Time Fourier (SFT). The ST analyse the power quality disturbance like voltage sag, swell, interruptions, oscillation, spike, noise, etc. even with the high order noise. The ST can analyse power quality problems based on its time frequency localization properties. The output from ST is a plot of amplitude contours represented by the time-frequency coordinated system. The resulting s-matrix from ST comprises frequency and magnitude counters sent to the DRNN. The hidden layers processing these features and the s-matrix for classifying the disturbances which presented in the sensed signals. The RDO is adopted for optimizing the number of hidden layers in DRNN. Neuron connections translate into weighting by the DRNN interconnection. The weight of each layer is altered during the training process.
The RDO algorithm is utilized to find the approximate layer near the best solution that searches the best layer based on layer weighting. RDO searches for a number of hidden layers in DRNN. The behaviour of the deer during breeding season is utilized for DRNN network optimization based on weights of the layers. The layers' weights match the deer roaring-pitch, and selecting deer for mating matches the layers section in DRNN. The DRNN is comparing the result with the last action performed. The processed signals are forward to the output layer; if there are any errors in the processed signal, they are fed to the hidden layers. The back propagation algorithm is used for feed forwarding the errors in the output layer. The back propagation algorithm utilization improves the accuracy of the layer output and the proposed model implemented in Simulink tool for PQD classification. Applying DRNN in the process of PQD classification reduces the man power and improves the system performance. Thus the proposed method improves the system efficiency by improving the accuracy of the PQD classification.

PQD in power grid
There are various PQDs are happens in the power system, some of them are listed below.

Voltage sag
The voltage sag events happen due to the single line-toground fault occurring at the end of the transmission line. In some cases, the sudden start of a wind turbine will cause the voltage to sag in the system. Similarly, switching on both the battery and linear load simultaneously will lead to the sag in voltage in the system. The voltage sag mainly occurs due to the transient load conditions, changing climatic conditions, and various short circuit failures [30].

Voltage swell
Voltage swelling is the common power quality disturbance that occurs in the smart grid. Switch off heavy loads and line-to-line faults are resulting voltage swell in the network. The output power surging of wind turbine and photovoltaic generators cause the voltage to swell in micro grid [31]. The voltage swelling in the system may damage the equipment that has low voltage rating.

Voltage interruption
The voltage interruption in micro grid degraded the PQ in the network. In micro grids the voltages are caused by double line-to-ground fault and three phase fault [32]. The voltage interruption is defined by the drop of 90-100% of voltage in the micro grid in 1 to 9 cycles.

Voltage spike
Switching large capacitor banks in the power system are the main cause of the distribution voltage impulse. To overcome the voltage impulse in the network, converters are used [28].

Harmonics and flicker disturbances
The harmonics and flickers are happened due to the connection of non-linear power converters and line faults. The power quality is disturbed by the changes in operating modes, load switching and unbalanced loads in the power grid [33].

Oscillatory transient
It is a sudden change of non-power frequency in steady state current, voltage, or both conditions, which contain positive and negative polarity values.

Impulsive transient
It is a sudden changes of non-power frequency in steady state current, voltage or else both condition, which contains either positive or negative unidirectional polarity. As well as, sudden increases in current may cause voltage spikes. Types of PQDs are given in Table 1, which is classified as single, double and multi harmonics.

S-Transform for signal analysis
The extension of continuous wavelet transform (CWT) is ST that sense the signals based on time-frequency features. The main advantage of ST is modulating sinusoidal which is fixed with time axis. The ST of time series u(t) is given by, where frequency is denoted as f and time is denoted t. Gaussian modulation g(ϑ, f ) is given as below, (2) The CWT W (ϑ, m) and u (t) is defined as, The ST is obtained by multiplying CWT with phase factor. That is given by, The continuous form of ST is given by, where, G(m, n) e −2π 2 m 2 ϑ n 2 2 , j, m, n 0, 1, 2, ....., N −1. The multi-resolution signal analysis by the ST is shown in Fig. 1. Figures.1, 2, 3   The above features 1-5 are taken from the time amplitude plot and features 6-10 extracted from the time frequency plot. These are given as the input to RNN for disturbance classification. Here, features 5 and 6 can separate disturbance regions among similar disturbance signals overlapping. These extracted features from the ST are given to the RNN for classifying disturbances.

Modelling of deep recurrent neural network (RNN)
DRNN is the type of deep neural network that uses the previous step's input as the input to the current step. RNN uses numbers of hidden layers on the basis of problem definition due to the large number of hidden layers the RNN is termed as DRNN. In this work, there are four hidden layers are used for better performance. The hidden layers do not hold the previous output, independent of each other. The connection between layers is defined as weights and memory in the DRNN uses the holds the works to do that comprises its own set of weights and biases. The DRNN has directed cycle in network nodes in hidden layer [34]. The analysed signal parameters are sent as the input to the DRNN which is processed by the number of hidden layers. The hidden layer of DRNN is categorised as the S-matrix values based on its unique frequency and amplitude. In DRNN, the input matrix is transformed from input layer to the hidden layers. The RDO algorithm is used to mitigate the network complexity of DRNN and get the optimized layer. The DRNN with equivalent unfold network is shown in Fig. 8. The network input with time sequence t is represented in Fig. 8 as (...x t−1 , x t , x t+1 ....) connection is assigned with the weight matrix A 1h . If the hidden layers having n units are defined as p t ( p 1 , p 2 , p 3 , .. p n ). these hidden layers are connected through a recurrent network. The current state is examined by using the following equation, where, p t is current state, p t−1 is previous state, and x t is the input state, f p is state transition function. The equation of the state at t time is given by, where, the weight at recurrent neuron is A hh , A xh is the weight at input neuron, tan p is the activation function. On the above equation the recurrent neuron was considering the previous state. The output was obtained only after the final state was calculated. The output calculation was done by, y t A hy p t (11) where, y t is output, A hy is the weight at output layer and f 0 is output function. The set of N training sequence is given by The cost function is given by, In this work, there are three hidden layers are used hence to optimize these layers the RDO is adopted. Due to the number of hidden layers, this network is referred as deep network. Structure of DRNN is shown in Fig. 9. This deep networks offers high performance efficiency than the conventional neural networks.
The characteristics of power quality classification are given below. • The frequency of sag, interruption and swell is considerably changed and the amplitude distortion of frequency area is very close to the fundamental frequency. • Flicker amplitude is changed at times and the frequency distortion is very close to the fundamental frequency.
• The distortion focused on high frequency area from 150 to 550 Hz whereas harmonic fundamental frequency remains stable. • The same harmonics characteristics are in two types of complex disturbances, however, when sag or swell occur the amplitude will change. • When the frequency is above 900 Hz transient distortion will occurs.

Red deer optimization algorithm
The RDO algorithm is utilized to find the approximate layer near the best solution that searches the best layer based on layer weighting. RDO search for number of hidden layers in DRNN. The RDO algorithm optimizes the number of layers in DRNN on layer weights. The layer's weights match the deer roaring-pitch and selecting deer for mating matches the layers section in DRNN. Here, RDO algorithm [35] is inspired by the different mating behaviour of Scottish Red Deer (RD) during its breading season. In RDO, the deer's is classified as hinds and male RD. Let us assume male RD is weight and hinds is represented as biases. The process of RDO algorithm is shown in Fig. 10.

Initialization of RD
The first step in the RDO is generating the initial number of RD (i.e. layer), in this stage, an array of variables are generated for optimization. Each Layer is defined as solution for optimization. In R dimensional problem, the array is defined as, The value of the function is examined by, The size of the matrix in the initial population is given by 'R popukation .

Position changing
The male RD (i.e. layer) changes their position in every stage and updates their objectives function better than the prior one. The maximum roaring rate (i.e. value) is attracting the biases.

Selection of male commanders
The layers are classified based on their roaring rate, which differs the high-pitch roaring weights commanders from the low-pitch roaring biases, where the best weights are given by, The stag population is calculated by, where, R.male.commander is represented as weight commander, R Male is represented as weight and R Stags is represented as biases.

Fighting between commanders and stags
In this stage, the male commanders (i.e. weight commanders) are randomly fighting with the biases, which means fighting when the objective function is higher than the prior one.

Harem formation
As defined earlier harem is the group of hind that depends on the power of male commander (i.e. power of weight commander) ability to fight and roaring. The normalized value of the male commander is obtained by, In above equation, b n represents number of n th male commander and B n is the normalized value. The normalized power of commander is given by, The number of hinds in a harem is given by, where, R hind is a number of all hinds. In cross over activity of mating, the male commanders and hinds are parents, then their offspring brings the new solution of where, R.haerm mate n represents number of hinds in n th harem that are ready for mating with the male RDs. The harem is selected randomly, and the commander mate with the τ percentage of hind of a harem. That is, where,R.harem mate n is the number of hinds in the harem mating with one male deer commander. The mating formulation is created by latest solution that is,

Stag Mating
The distance between the male RD and all hinds is calculated by, • The succeeding generation of male RD gives the best solution then chosen the hind for next generation via routine selection. • The convergence may be numerous iteration or else the high quality of the solution obtained. • Work flow of the DRNN by adopting RDO to optimize the layers is shown in Fig. 11.

Results and discussion
At first, 1000 signals are generated by the proposed method, then the noise in that signals and the disturbances are analysed by ST. The traditional methods are failed to detect the noise in the system but the proposed method detect the noise at severe condition. The proposed method analyze the signals periodically and detect the noise upto 50 dB. The loss and accuracy of each signals are identified by the proposed method. By overlooking the traditional methods, which had poor immunity due to noise detection for PQD detection. The issues was overcomed by using the proposed technique. The back propogation algorithm enables feed forwarding of error signals and forming the closed loop operation. The proposed method implemented in the Simulink tool for analysing the signals.
In this work, we have considered 35 categories of single, double and multiple complex power quality disturbance with 7250 samples for classification. The size of training data is 4800 and testing data is 2450. The data window size to extract features is 64 × 128 pixels. Here, consider the confusion matrix for single, double, and multiple harmonics for 2450 testing samples. Totally 35 number of classes, and each classes have 70 samples. Figure 12 shows the confusion matrix for the PQD classification results for single, double and multi harmonics. Figure 12 is normal sinusoidal without any disturbance Figs. 13,14,15,16,17 occur double harmonics like swell with harmonics, notch with flickers, sag with impulsive transient and swell with the oscillatory transient. Figure 18 occurs multi harmonic i.e. swell with a notch with harmonics.

Performace measures
To measure the performance of the proposed method following parameters are considered. The three paramters like accuracy, Precision and recall are considered in this work to show the effciency of the proposed method.

Accuracy
Accuracy is the measure of performance and quality of the network that is defined as the ratio of correctly predicted events in the set to a total number of test events.

Accuracy
Correctly evaluated events in the test Total number of test set (23)

Precision
Precision of the network is defined as the ratio of true positive signals to the addition of true positive signals and false positive signal. Signals from the output layer that correctly predict the disturbance without errors are indicated as true positive signals, and signals from the output layer with errors Sort the values of frequency and amplitudes in the matrix by equation (16) and (17) Examine each layer weight by equation (15) Form group by equation (20), (21) and (22) Update the best weighted hidden layer then match it with appropriate feature Compare among the features by using equation (18)

Recall
Recall is the fraction of retrieved signals relevant to the PQD classification. Signals from the output layer that correctly predict the disturbance without errors are indicated as true positive. The failed attempt to sense the disturbance in the network is indicated as false negative.

Recall
True positive true positive + False negative (25) The comparison of the proposed method with the existing method is shown in Table 2. The comparison Table shows that the proposed method offers high precision, accuracy and recall than the existing methods. In Table,         The classification accuracy for single harmonics from CL1 to CL9 is given in Fig. 19. Some existing optimization techniques like Genetic Algorithm (GA), Particle Swarm Optimization (PSO) and Cuckoo Optimization Algorithm The classification accuracy for double harmonics from CL10 to CL24 is given in Fig. 20. The classification accuracy is compared with existing techniques like ST + DRNN + GA, ST + DRNN + PSO, ST + DRNN + COA and the proposed method i.e. ST + DRNN + RDO for double harmonics from CL10 to CL24. Our proposed ST + DRNN + RDO is higher classification accuracy than existing techniques.
The classification accuracy for single harmonics from CL25 to CL35 is given in Fig. 21. The classification accuracy is compared with existing techniques like ST + DRNN + GA, ST + DRNN + PSO, ST + DRNN + COA and the proposed method i.e. ST + DRNN + RDO for multi harmonics from CL25 to CL35. When compared to other existing techniques our proposed ST + DRNN + Opti is higher classification accuracy.

Conclusion
Early identification of the PQD and classification disturbances in a power grid is challenging. To overcome the issues in PQD, the proposed method uses DRNN, one of the types in Artificial Neural Network (ANN). RDO is used in the DRNN to select the optimum hidden layer in the network to obtain the best solution based on layer weighting. Signals are analysed by ST that is effective against noise in the network. Back propagation algorithm in DRNN is used to feedback the errors to previous layers that process the analysed signals. The proposed method is implemented in the Simulink tool. The result of proposed method is compared with the conventional methods, by analysing the results, proposed method results in higher accuracy of 99. 95% and takes less time for computation. The proposed method offers a high precision of 99.93% higher than the prevailing methods. Hence early detection and classification of PQD in the proposed model will improve the efficiency of power grid distribution.
Authors contributions All authors have equal contributions in this work.
Funding No funding is provided for the preparation of manuscript.
Data availability statement Data sharing not applicable to this article.

Declarations
Conflict of interest Authors declare that they have no conflict of interest.
Consent to participate All the authors involved have agreed to participate in this submitted article.

Consent to Publish
All the authors involved in this manuscript give full consent for publication of this submitted article.
Ethical Approval This article does not contain any studies with human participants or animals performed by any of the authors.