An Adaptive Detection Algorithm for Micro-grid Harmonic Power Based on Deep Belief Network

: There are many non-linear load devices in the micro-grid, resulting in a lot of complex harmonics, which is a key problem that leads to low measurement accuracy of electric energy metering devices. The traditional integrated empirical mode decomposition (EEMD) method can effectively deal with the problem of nonlinear and non-stationary signals, but this method has the problem of being highly dependent on artificial pre-set parameters. Here, the deep belief network (DBN) is introduced in the white noise signal generation process of EEMD. The main problems solved are as follows: one is to adaptively match the white noise signal according to the data characteristics of the current signal in the micro-grid, the other is to reduce the artificial setting error and make the separation result closer to the theoretical value. Finally, this paper uses the operating data in the actual environment to carry out experimental verification, and the results show that the error between the value of harmonic power in the production environment and the theoretical value given is reduced by 9.73%.


INTRODUCTION
In recent years, micro-grid has developed rapidly because it can realize self-control, protection and management. At the same time, a mass of harmonics is generated because there are many nonlinear load devices in the micro-grid, such as distributed power sources, energy storage devices, energy conversion devices, loads, monitoring and protection devices, etc., which lead to non standard sinusoidal waveform of voltage,. As a result, it is difficult for the electric energy metering device to measure accurately in Diahovchenko et al. [1] and Ghanizadeh et al. [2]. In order to accurately measure the electrical energy in the micro-grid, it is necessary to consider the harmonic power, which is caused by harmonic voltage and current of the same frequency. Under normal circumstances, the working principle and technical specifications of electric energy metering devices are designed and operated in standard sinusoidal voltage and current signals at a rated frequency of 50 Hz. However, that does not consider the harmonic interference factors in the grid-connected power generation environment such as the renewable energy in Gorbatenko et al. [3]. Actually, harmonics are widespread in the power systems. Standards IEEE-519 and IEC 61000-3-2 all require harmonic to inject into current (into the public grid) to be limited to a specified range [4,5]. That does reduce the impact of harmonics on the accuracy of measuring electric energy for a certain extent, but it cannot eliminate harmonics fundamentally. Considering that, many scholars have carried out lots of researches and put forward many advanced theories and solutions.
There are many popular harmonic power detection methods: FFT method [6], aiming at the problem of spectrum interference between harmonics and interharmonics generated by nonlinear equipment in power systems, proposed an interharmonics detection method combined with time domain (TD) quasisynchroni-zation. Synchronous sampling method in Zhu et al. [7] and Geng et al. [8] focused on the problems of non-linearity, randomness, distribution, and non-stationarity of harmonics, which are difficult to accurately measure. And then a dynamic harmonic solution method based on quasisynchronous sampling algorithm is proposed. The wavelet transform method in Jiang et al. [9] proposed a multichannel fast Fourier wavelet transform method for the low-frequency oscillation analysis from power systems, which absolutely relies on the built model and parameter accuracy. Harirchi and Simoes [10] proposed a decomposite algorithm based on instantaneous reactive power theory, which is helpful for optimizing control strategies of power electronic interfaces and power quality compensators. Balouji et al. [11] proposed a deep learning algorithm to compensate both the response and reaction times of active power filters for highly time-varying harmonics and inter-harmonics. This method can predict or predetect the future samples, the features of harmonics, the interharmonics in the TD, and the frequency domain. Moreover, it can eliminate the response and reaction times caused by filter and hardware. Moeini et al. [12] used an artificial neural network (ANN) for low-frequency modulation techniques, different phases and magnitudes of the fundamentaland harmonics for the voltage of the converter can be obtained in real time. Baghaee et al. [13] used radial basis functions to solve harmonic power flow to obtain voltage harmonics, active and reactive power. Jain and Singh [14] proposed a fast and accurate real-time estimation method for time-varying voltage/current harmonic signals to calculate signal parameters. Wu et al. [15] proposed a method based on harmonic amplitude kurtosis detection, which uses kurtosis detection and interval estimation methods to extract sub-sequences of effective fluctuating harmonic amplitude data. Adineh et al. [16] trained the ANN offline and estimated the voltage value, then calculated harmonic components and THD online at the desired bus. However, all the above methods have the problems of unreasonable parameter setting of white noise signal and low harmonic detection accuracy in analyzing nonlinear and non-stationary signals.
Based on the above outstanding problems, this paper proposed an adaptive detection algorithm for micro-grid harmonic power based on DBN in Abdellaoui and Douik [17]. Specifically, DBN was introduced in the white noise signal processing process of EEMD in Cheng and Zhao [18]. The first object of the present study is to achieve adaptive matching with white noise signals according to the current signal data characteristics in Sbargoud et al. [19], and the second one is to reduce the artificial setting error, so that the separation result can be closer to the theoretical value.

PRINCIPLE OF ADAPTIVE DETECTION ALGORITHM
In this paper, DBN was adopted to built micro-grid harmonic power adaptive detection algorithm proposed. The overall structure is composed of EEMD decomposition, white noise data set generation and DBN-EEMD model training in Lim et al. [20].
The specific workflow is shown in Fig. 1. When performing harmonic detection, the original sampled data can be directly fed into the trained DBN model. The DBN model will adaptively match the white noise signal according to the signal data characteristics, thereby reducing artificial setting errors and making the separation result closer to the theoretical value.

EEMD Decomposition Principle
Considering the problems such as modal aliasing and frequency fluctuations during EMD signal decomposition, Norden and Huang et al. proposed the EEMD method in Amarouayache et al. [21] by using the uniform distribution and zero-mean characteristics of the white noise spectrum. Due to the injection of white noise signals, the output voltage and current signals of the micro-grid at different time scales will be automatically distributed to the appropriate reference scale in Zhang et al. [22]. After multiple decomposition, the injected white noise signals will cancel each other out. Finally, the average value of multiple decomposition of EEMD is used as the result in Shokrolahi and Kazempour [23]. The specific process is as follows: (1) A composite signal X i (t) is obtained through injecting white noise into the voltage and current signals x(t) generated by the nonlinear load under different working conditions. As in the above step, the white noise added each time is uncorrelated, there will be no white noise signal in X i (t) after multiple decomposition. The formula is shown as follows in Lobato et al. [24]: (2) Performing EMD decomposition of the composite signal X i (t) to get the component c i,j (t) and remainder r i (t) of n Intrinsic Mode Functions ( IMF): (3) Inject different Gaussian white noise signals into the original signal, repeat (1) and (2) to reach the predetermined decomposition times, and then average the decomposed IMF components: (4) Using the zero-average principle of white noise signal to eliminate the influence of Gaussian white noise, thereby obtaining the original current signal: (5) Hilbert transform is applied to the final result IMF component decomposed from the original signal, then the analytical signal can be obtained in Huang et al. [25]: Among which: (6) Instantaneous angular frequency function ω(t) and instantaneous frequency function f(t) are obtained through the phase function: The instantaneous frequency is obtained by Hilbert transform The experimental standard deviation was used to score The white noise dataset  (7) After transforming the analytical signal z(t), the Hilbert amplitude spectrum can be obtained: According to the above derivation, the Hilbert marginal energy spectrum of the original current signal in the micro-grid is obtained, which is used to reflect the total amplitude of a certain frequency inside the current signal and the energy distribution in the entire time span, as shown in the following formula:

High-Score White Noise Data Set Generation
When performing EEMD decomposition, the white noise coefficient should be set reasonably with adding white noise. If the setting is too large or too small, the decomposition error will increase and the decomposition result will be meaningless. According to the signal characteristics in the micro-grid, the evaluation function method can be used to select the optimal white noise signal to reduce the impact of the unreasonable white noise coefficient setting on the decomposition result in Gao et al. [26]. According to Eq. (8), the experimental standard deviation s j of the instantaneous frequency of the j-th IMF when adding different sub-Gaussian white noise signals is calculated, and Eqs. (11) and (12)  According to adding different sub-Gaussian white noise signals, the smaller the s j , the higher the evaluation.

DBN-EEMD Model
DBN is a sub discipline of deep learning, which was first proposed by Jeffrey Hinton in 2006 to solve the problem of nonlinear separation in Hinton [27]. DBN is constructed by stacking multiple RBMs, and uses an unsupervised mode to train each layer of RBM from lowlevel to high-level. This paper uses the Back propagation (BP) algorithm to fine-tune the training error of the entire DBN network. The network training model is constructed as shown in Fig. 2.
RBM is composed of visible layer v and hidden layer h in Dai et al. [28], and its joint configuration energy is defined as Eq. (13).
where: v i is the visible element state of the RBM visible layer, h j is the hidden element state of the RBM hidden layer, a i and b j are the biases of the RBM explicit element i and hidden element j, w j,i is the connection weight between RBM explicit element i and hidden element j, and θ = {w j,i , a i , b j } is the model parameter, respectively.

Figure 2 DBN-BP network training model
Based on the energy function, the state joint probability distribution is: is the normalization factor. Because the states and activation conditions of the explicit and hidden elements are independent, the activation probability of the j-th hidden element and the ith explicit element are: σ(•) is the activation function, using sigmoid and tanh functions, as shown in Eqs. (17) and (18) Here we use the evaluation function in Eq. (12) to obtain the optimal white noise as the label, and then use the RBM output feature vector as the BP input feature vector in Salakhutdinov and Hinton et al. [29]. The purpose is to conduct supervised training through the BP network, and continuously adjust the parameters in reverse to reduce the training error. Finally, the DBN-EEMD model is used to obtain the matched optimal white noise, which can reduce the artificial setting error and make the separation result closer to the theoretical value.

EXPERIMENT 3.1 Data collection
The real micro-grid is composed of photovoltaic power with rated power 150 kW, wind power with rated power 15 kW, hybrid energy storage system with rated power 80 kW, and energy management system, which is connected to power grid by 400 V AC bus, as shown in Fig.  3.

Figure 3 The diagram micro-grid structure
The data collection equipment with type DEWE 5000 is produced by DEWETRON company in Austria, which has 16 isolated inputs module and 1 MS/s signal output rate, to achieve field data collection for voltage and current signals. The original data collected this time is the current signal, and the total sample points obtained are 3×10 6 . The sampling setting parameter is that the fundamental frequency is 50 Hz, 200 points are sampled in one cycle, and 60,000 cycles are sampled within 5 min. The sampling point is set at the grid connection point of the micro-grid laboratory, and the working conditions are switched through the switch. The collection scope includes real-time current data under working conditions such as photovoltaic power generation, wind power generation, and energy storage and discharge. The deployment diagram of the collection location is shown in Fig. 4.

Feature Parameter Selection
The test data includes current signals generated by non-linear loads such as energy storage and discharge (ETD), wind power generation (WPG), photovoltaic power generation (PV), wind and solar power generation (WSPG), and wind and solar energy storage power generation (WSEPG). The selected characteristic parameters were data source type, sampling node, sampling frequency and data length. At first, 100,000 pieces of data were taken from each group of measurement data, then divided into 2 groups, named training data set and test data set, respectively. One group, with a total of 90,000 pieces, was used as a training data set and used to train the DBN-EEMD model. The other group was used as a test data set to verify the model, with a total of 10,000 pieces. During model verification, A piece of data was randomly selected from the test data set to verify the accuracy of the model. After the above process was completed, we randomly select some collected data from the data collected under 5 different working conditions to analyze the harmonic characteristics of current and power. The data collection equipment was set up with the same sampling frequency of 10 kHz, and the same time length of 5 min for data consistency and comparative analysis. The source of the data is shown in Tab. 1.

DBN-EEMD Model Test
(1) DBN-BP network structure This paper uses Back propagation (BP) algorithm to fine-tune the training error of the entire DBN network. The DBN network structure is the key to signal extraction efficiency. Therefore, the reconstruction error of different layers of DBN is quantified to compare the extraction efficiency of signal features in Xu et al. [30], as shown in Fig. 5a. After many experiments, we set the number of DBN layers to 3 layers, with the number of nodes in each layer being 350, 200, and 50, respectively. The test results show that the obtained reconstruction error is the smallest (0.010), which takes 8.1 seconds.
In addition, the loss function of the DBN-BP model is also tested. After 8 iterations, the test error and training error are reduced to 0.01 and 0.02, respectively. Experiments results show that the test error was significantly smaller than the training error, and both are basically close to zero, as shown in Fig. 5b. (2) Model validation After the DBN-BP model is built, the optimal white noise can be automatically matched through the trained DBN-BP model. In theory, the result of harmonic decomposition will also be significantly better than that of white noise set artificially and randomly. The following is an experimental verification of the theoretical derivation.
In the experiment, according to the randomness of the current harmonic signal under the energy storage and discharge conditions, the traditional EEMD and the proposed algorithm in this paper are used for model verification. The specific step is to use two methods to decompose the randomly drawn current signals. The white noise value obtained according to the traditional EEMD parameter setting method is ω = 0.24. The white noise parameter obtained by using the DBN-BP algorithm is ω = 0.33.   Fig. 6b are the decomposition results of traditional EEMD and DBN-EEMD, respectively. It can be seen from Figure 6 that the traditional EEMD method has large modal aliasing in the separation results of the 3-rd (150 Hz), 5-th (250 Hz), 7-th (350 Hz) and 9-th (450 Hz) harmonics. Remarkably, the waveform obtained by the DBN-EEMD method is more stable, which is significantly better than the decomposition result of the traditional EEMD method. It can also be seen from Fig. 5b that the DBN-EEMD method can more effectively map the various harmonics of different signals to the corresponding IMF. The harmonic decomposition results of third, fifth and seventh harmonic with higher content were compared with the theoretical values, in order to verify the correctness of the model. The error of the traditional EEMD and the DBN-EEMD for the above-mentioned frequency harmonic decomposition is compared in Tab. 2. The results show that the error between the decomposition result of the DBN-EEMD and the theoretical value is lower than that of the traditional EEMD. The DBN-EEMD method has a maximum error of 2.01% and a minimum error of 0.98%, which are respectively 9.73% and 1.3% lower than the maximum error of 11.74% and the minimum error of 2.28% of the traditional EEMD method.

Engineering Test Verification
(1) Current waveform decomposition In the engineering test, the current waveforms generated by the nonlinear load equipment under five working conditions of ETD, WPG, PV, WSPG, and WSEPG are first extracted. The DBN-EEMD method is used to decompose the extracted current waveform, and then the respective distortion rates are calculated according to the decomposed results. By calculating the distortion rate of the current waveform in Fig. 6, the total distortion rates of the five working conditions are 16.92%, 17.93%, 17.32%, 44.24%, and 20.67%, respectively. Due to the mutual influence of the harmonics between WPG and PV, the total distortion rate of these two working conditions is larger than that of the other three working conditions, as shown in Fig. 7.  The number of harmonics generated in the micro-grid is mainly 3-rd, 5-th, 7-th, 9-th, 11-th and 13-th. Among them, PV, WSPG are affected by external factors, resulting in larger harmonic currents. The 5th harmonic distortion rates of these two working conditions are 15.33% and 39.45%, respectively. Because the randomness of the harmonics of WSPG cancels each other out, the harmonic generated under this working condition is relatively small.
The largest harmonic current distortion rate is the 9th harmonic, which is only 1.58%, as shown in Fig. 8.
(2) Energy calculation Generally, electrical energy is equal to power multiplied by time. But in the case of a certain time, power is a key factor that needs to be considered. Therefore, the emphasis of this experiment is to consider the harmonic power. According to the decomposition result of the previous current waveform, the respective harmonic power can be calculated by the formula P = U⸱I, as shown in Fig.  9:  Under working condition 4, WPG is not only affected by multiple factors such as wind speed, temperature, and nonlinear equipment, but also affected by the harmonic interaction of PV. Therefore, the harmonic power obtained in the experiment is larger. Its harmonic power dropped to a valley value of 0.09 W at the 9-th harmonic, while it reached a peak of 13.5 W at the 5-th harmonic. Under working condition 5, WSEPG is larger. However, due to the uncertainty of the harmonic direction and the cancellation of the generated harmonics, the current harmonic distortion rate is the smallest. Compared with working conditions 3 and 4, the harmonic power is the smallest, the maximum value of the harmonic power is 2.87 W, and the minimum value is 0.012 W.

CONCLUSIONS
In short, in view of the large number of non-linear load devices in the micro-grid, the complex harmonic content generated is a key problem of poor accuracy. In this paper, the DBN is introduced in the white noise signal generation process of EEMD, and the white noise signal can be adaptively matched according to the current signal data characteristics through the DBN-EEMD model. The proposed model also reduces the artificial setting error, making the separation result closer to the theoretical value. At last, we use the actual operating data of the micro-grid to carry out experimental verification. The validation results show that the error between the value of harmonic power in the production environment and the theoretical value given is reduced by 9.73%. The proposed method does solve the problem of harmonic detection accuracy, it also provides a new idea for exploring harmonic detection in power grids.
The proposed DBN-EEMD model has a strong value of engineering application to improve the accuracy of electric energy metering devices, and provide data support for improving the ability of nonlinear load management. However, due to the complex operation conditions of the actual equipments and various influence factors, a larger training database is needed in the future, to accurately analyze more nonlinear loads.