Electrical Harmonic Energy Measurement Based on Wavelet Packet Decomposition and Reconstruction Algorithm

Mengshuang Liu*, Xudong Shi and Chen Yang

Electric Power Research Institute of State Grid Xinjiang Electric Power Co., Ltd., Xinjiang, Urumqi 830000, China

E-mail: liumengshuang@dky.xj.sgcc.com.cn

*Corresponding Author

Received 15 July 2021; Accepted 17 August 2021; Publication 09 November 2021

## Abstract

In order to study the accurate measurement of electric energy in complex industrial field, a method of harmonic electric energy measurement based on wavelet packet decomposition and reconstruction algorithm, as well as the calculation formula of harmonic power and the principle of harmonic electric energy measurement are proposed. Using db42 wavelet function to carry out harmonic energy metering simulation analysis, the results show that: The fundamental frequency of the simulation signal is 50 Hz, two-layer wavelet packet transform is adopted, the simulation input signals within 40 fundamental wave cycles are taken, and the sampling frequency fs is 800 Hz. Conclusion: The three-phase harmonic energy metering device based on virtual instrument technology has realized the measurement of each harmonic active power and reactive power, and the accuracy reaches 0.2 s.

Keywords: Harmonic energy, wavelet packet decomposition and reconstruction, electric harmonic.

## 1 Introduction

The nonlinear characteristics of a large number of equipment and loads in the power system have caused huge harmonic pollution to the power grid. Even in some working conditions, there are integer harmonics and non-integer harmonics at the same time. How to accurately measure the harmonics has become a major topic in the power industry. At present, Fourier transform and wavelet transform are the most widely used classical measurement algorithms. The key is to successfully extract the harmonic signals of voltage and current, and then calculate the harmonic power. However, the windowing interpolation method can effectively suppress the Fourier transform spectrum leakage and the fence effect, but cannot accurately measure the unsteady signal [1]. Wavelet transform overcomes the shortcoming that Fourier transform has no locality in frequency domain and time domain. It can extract the time-frequency information of signal at the same time, and realize the accurate measurement of steady-state and unsteady-state harmonics. It is widely used in the field of power quality harmonic analysis. The difference between wavelet packet transform and wavelet transform is that the former makes a fine binary division for the high-frequency and low-frequency parts of the signal, which overcomes the disadvantage that the wavelet transform only makes a binary decomposition for the low-frequency band of the signal and has a low resolution for the high-frequency signal. Lift wavelet transform inherits the characteristics of multi-resolution analysis of classical wavelet transform in time domain, and at the same time overcomes the shortcomings of the latter based on convolution operation, which leads to large amount of computation, high complexity and storage space. Lift wavelet transform can realize in-situ operation and can be implemented on the chip, which has high engineering application value [2].

With the development of modern industry, the nonlinear load in power system increases greatly, which leads to the voltage distortion of power network and the serious deterioration of power quality, endangering the safety and economic operation of power system. Mostly in the form of dynamic load in the power system, especially in big industrial load such as arc furnace, rolling mill stop and electric locomotive running makes the grid voltage and current waveform changes at any time, apply to stationary signal analysis of Fourier transform has been unable to meet the requirements of dynamic signal analysis, the current widespread use of electric power harmonic measuring instrument based on FFT algorithm is also in the process of actual use There are defects [3]. In recent years, wavelet transform, as an effective means of signal processing, has gradually attracted the attention and attention of researchers in various fields, and become a new branch of mathematics. The traditional Fourier transform is a pure frequency domain analysis method, which reflects the overall frequency domain characteristics of the whole signal in the whole time, but cannot provide any frequency information in the local time period, that is, it has no time domain resolution ability. The wavelet transform has the ability to characterize the local characteristics of the signal in time domain and frequency domain. Wavelet analysis based on wavelet transform uses a variable window which can be expanded and shifted, and can focus on any details of the signal for time-frequency domain processing, which can not only see the whole picture of the signal, but also analyze the details of the signal, and retain the instantaneous characteristics of the data. Therefore, wavelet analysis has a very broad application prospect in the fields of unsteady power signal, image processing, pattern recognition, etc. [4]. Fast Fourier transform algorithm has many advantages, such as orthogonal, complete, etc., and has been widely used in traditional power system harmonic detection and analysis. However, the use of FFT transform technology to detect power system harmonics must have the following three points: (1) Sampling law: Nyquist sampling law must be satisfied, that is, the sampling frequency must be greater than or equal to two times of the highest frequency of the sampled signal, usually more than three times in practical application; (2) Periodicity: the detected signal must meet the periodicity, that is, regular changes; (3) Sampling points: In order to meet the speed of FFT and reduce the calculation storage capacity, the sampling points must meet 2N(where N is an integer), otherwise the calculation time and storage capacity will increase exponentially. The most critical point is that when the sampling window cannot keep strict synchronization with the period of the detected signal, the use of FFT transform will produce “side lobe” and “spectrum leakage” and other phenomena, and information will be lost. In addition, FFT transform is to convert the time-domain signal to the frequency domain for analysis, and the spectrum of any sudden change in time-domain information will be distributed over the entire frequency band, so the change of time-domain signal cannot be accurately obtained [5]. Therefore, Gabor used the windowing technique to regard the unstable process as the collection of a series of short-term stationary processes, and then evolved the STFT method. However, this technique has its limitations. The real-time window is not adaptive and therefore cannot cover all the mutation processes. Wavelet transform overcomes the disadvantage that Fourier transform cannot analyze local information. Its wavelet window can transform the width under a certain area and simultaneously analyze the time-frequency information of the detected signal. It is suitable for the analysis of all kinds of abrupt signals and unstable signals, and is known as “mathematical microscope” [6].

The spatial segmentation of the wavelet packet can decompose the original signal into different wavelet subspace, that is, through the wavelet packet decomposition, each frequency component contained in the signal can be decomposed into the corresponding frequency band, so as to achieve the frequency band decomposition of the signal. Wavelet packet is suitable for harmonic analysis and power metering by dividing the signal in frequency domain with equal space. At present, the main method of measuring harmonic energy is to use FFT to analyze each harmonic, then calculate each harmonic power and measure the harmonic electric quantity [7]. Wavelet transform and wavelet packet transform is actually the signal through a series of band-pass filter, the difference between the two is wavelet transform filter bank is the low frequency zone of binary classification, and wavelet packet transform of high frequency and low frequency band are binary classification, overcomes the defect of the former high frequency signal low resolution [8].

The innovation point is based on the wavelet packet decomposition and reconstruction of the harmonic energy metering method, the harmonic energy metering model is established, and the harmonic energy metering device based on virtual instrument is designed on the basis of the simulation experiment to verify the accuracy of the model. The function and metering accuracy both meet the requirements of the power industry.

## 2 Research Methods

### 2.1 Wavelet Packet Decomposition and Reconstruction

The basic idea of wavelet packet is to decompose the wavelet subspace in multi-resolution analysis. Given the orthogonal scale function $ϕ$(t) and the wavelet function $ψ$(t), the two-scale relation is:

 $ϕ0⁢(t)$ $=2⁢∑kh0⁢k⁢ϕ⁢(2⁢t-k)$ $ϕ1⁢(t)$ $=2⁢∑kh1⁢k⁢ϕ⁢(2⁢t-k)$ (1)

In the formula, h0k and h1k are filter coefficients of multi-resolution analysis respectively. To further extend the two-scale equation, the recursion relation is defined as follows:

 $w2⁢n⁢(t)$ $=2⁢∑k∈Zh0⁢k⁢wn⁢(2⁢t-k)$ $w2⁢n+1⁢(t)$ $=2⁢∑k∈Zh1⁢k⁢wn⁢(2⁢t-k)$ (2)

When n $=$ 0

 $w0⁢(t)$ $=ϕ⁢(t)$ $w1⁢(t)$ $=ψ⁢(t)$ (3)

The wavelet packet determined by the above function set {wn(t)}n$□$Z is w0(t)$=φ$(t), that is, the wavelet packet {wn(t)}n$□$Z is a set of functions with some relation including the scale function w0(t) and the wavelet generating function w1(t). The wavelet packet space is spanned by a stretching and translation system of wn, and

 $Wjn=s⁢p⁢a⁢n⁢{2-j/2⁢wn⁢(2-j⁢t-k)}k∈Z$ (4)

In the formula, j$□$Z (non-negative integer); N $□$Z (negative integer). Wavelet packet operation includes wavelet packet decomposition and wavelet packet reconstruction. The wavelet packet is decomposed by {dljn}, {dkj+1,2n} and {dkj+1,2n+1}.

### 2.2 Extraction of Harmonic Signals

The key to the measurement of harmonic energy is to extract the harmonic voltage and current signals effectively. Wavelet packet decomposition realizes the frequency band decomposition of f(t), but the larger the decomposition scale, the larger the signal compression, and the more obvious the waveform stepping, such stepping in the spectral domain is manifested as high order harmonics, resulting in algorithm errors. The step effect caused by data compression can be eliminated by signal reconstruction. According to the above equation, the time-domain signals in each sub-frequency band can be reconstructed by wavelet packet decomposition coefficients, that is, the original signal f(t) can be described as,

 $f⁢(t)=f0⁢(t)+f1⁢(t)+⋯+f2j-1⁢(t)$ (5)

Is the time domain signal in each subband after wavelet packet decomposition coefficient reconstruction. The number of frequency bands is determined by the scale of decomposition. Through the reconstruction of the wavelet packet decomposition coefficient, the power harmonic parameters in each frequency band can be measured, and the harmonic changes in each frequency band can be tracked and observed. Figure 1 is a schematic diagram of harmonic signal extraction based on wavelet packet transform. 0$∼$100 Hz frequency band represents the fundamental signal, 100$∼$200 Hz frequency band represents the third harmonic signal.

Figure 1 Schematic diagram of extraction of various harmonic voltage and current signals.

## 3 Results Experiment

The DB42 wavelet function is used to carry out the simulation analysis of harmonic energy metering. The fundamental frequency of the simulation signal is 50 Hz, and the two-layer wavelet packet transform is adopted. The simulation input signals within 40 fundamental wave cycles are taken, and the sampling frequency is fs $=$ 800 Hz.

### 3.1 Metering Simulation of Active Power

(1) Steady state signal simulation

Let the input signals u(t) and i(t) of simulation contain 3, 5 and 7 harmonics, i.e

 $u⁢(t)$ $=100⁢s⁢i⁢n⁢(2⁢π⁢50⁢t)+14⁢s⁢i⁢n⁢(2⁢π⁢150⁢t)+12⁢s⁢i⁢n⁢(2⁢π⁢250⁢t)$ $+3⁢s⁢i⁢n⁢(2⁢π⁢350⁢t)⁢0=40⁢T$ $i⁢(t)$ $=10⁢s⁢i⁢n⁢(2⁢π⁢50⁢t)+4.5⁢sin⁢(2⁢π⁢150⁢t)+4⁢s⁢i⁢n⁢(2⁢π⁢250⁢t)$ $+2⁢s⁢i⁢n⁢(2⁢π⁢350⁢t)⁢0=40⁢T$

The waveform of each harmonic voltage and current extracted after the steady-state signal is transformed by the wavelet packet is shown in Figure 2, respectively. The simulation results of active energy measurement of the steady-state signal are shown in Table 1.

Figure 2 Reconstruction waveform of steady-state signal.

Table 1 Active power simulation experimental data of steady-state signal

 Band/Hz The True Value The Simulation Value The Relative Error(%) 0$∼$100 300.0000/3600 299.9785/3600 0.0072 100$∼$200 18.9000/3600 18.8331/3600 0.3540 200$∼$300 14.4000/3600 14.4643/3600 ?0.4467 300$∼$400 1.8000/3600 1.7999/3600 0.0071 The total 335.1000/3600 335.0758/3600 0.0072

(2) Unsteady state signal simulation

Let the input signals u(t) and i(t) of the simulation contain 3, 5 and 7 harmonics, i.e

 $u⁢(t)$ $={100⁢sin⁡(2⁢π⁢50⁢t) 0≤t<10⁢T100⁢sin⁡(2⁢π⁢50⁢t)+20⁢sin⁡(2⁢π⁢150⁢t) 10⁢T≤t<20⁢T100⁢sin⁡(2⁢π⁢50⁢t)+20⁢sin⁡(2⁢π⁢150⁢t) 20⁢T≤t<25⁢T+17⁢sin⁡(2⁢π⁢250⁢t) 100⁢sin⁡(2⁢π⁢50⁢t)+20⁢sin⁡(2⁢π⁢150⁢t) 25⁢T≤t<40⁢T+17⁢sin⁡(2⁢π⁢250⁢t) +15⁢sin⁡(2⁢π⁢350⁢t)$ (6) $i⁢(t)$ $={10⁢sin⁡(2⁢π⁢50⁢t) 0≤t<10⁢T10⁢sin⁡(2⁢π⁢50⁢t)+2⁢sin⁡(2⁢π⁢150⁢t) 10⁢T≤t<20⁢T10⁢sin⁡(2⁢π⁢50⁢t)+2⁢sin⁡(2⁢π⁢150⁢t) 20⁢T≤t<25⁢T+1.8⁢sin⁡(2⁢π⁢250⁢t) 10⁢sin⁡(2⁢π⁢50⁢t)+2⁢sin⁡(2⁢π⁢150⁢t) +1.8⁢sin⁡(2⁢π⁢250⁢t) +1.5⁢sin⁡(2⁢π⁢350⁢t)$ (7)

The active energy metering simulation results of unsteady signals are shown in Table 2.

Table 2 Active power simulation experimental data of unsteady signals

 Band/Hz The True Value The Simulation Value The Relative Error (%) 0$∼$100 300.0000/3600 299.9894/3600 0.0035 100$∼$200 10.0000/3600 9.9741/3600 0.32590 200$∼$300 4.59000/3600 4.6030/3600 -0.2832 300$∼$400 2.25000/3600 2.2597/3600 -0.4311 The total 316.8400/3600 316.8262/3600 0.0044

The true value in Tables 1 and 2 is the active power of the original signal in each frequency band, and the simulation value is the active power of each frequency band extracted after the wavelet packet transform. In order to remove the influence of boundary effect, the data within 5T $∼$ 35T were taken to calculate the active energy. The simulation results show that the wavelet packet transform can extract the signals of each frequency band effectively, and the active energy measurement method based on the wavelet packet transform is reasonable and accurate, which is suitable for the steady and unsteady active energy measurement.

### 3.2 Reactive Power Measurement Simulation

The instantaneous reactive power is equal to the product of the instantaneous voltage value at the time leading $π$/2 and the instantaneous current value at the current time. Therefore, combined with the Hilbert transform method to carry out 90$∘$ phase shift for the voltage channel sampling signal, that is, the measurement method of harmonic active power can be used to realize the measurement of reactive power and achieve the purpose of simplifying the system algorithm.

Steady state signal simulation

Let the input signals u(t) and i(t) of simulation contain 3, 5 and 7 harmonics, i.e

 $u⁢(t)$ $=100sin(2π50t+90)∘+14sin(2π150t+90)∘$ $+12sin(2π250t+85)∘+3sin(2π350t+85)∘$ $0$ $=t=40⁢T$ $i⁢(t)$ $=10⁢s⁢i⁢n⁢(2⁢π⁢50⁢t)+4.5⁢sin⁢(2⁢π⁢150⁢t)+4⁢s⁢i⁢n⁢(2⁢π⁢250⁢t)$ $+2⁢s⁢i⁢n⁢(2⁢π⁢350⁢t)⁢0=t=40⁢T$

Table 3 Reactive power simulation experimental data of unsteady signals

 Band/Hz The True Value The Simulation Value The Relative Error (%) 0$∼$100 300.0000/3600 300.3320/3600 $-$0.1107 100$∼$200 9.5036/3600 9.5324/3600 $-$0.3035 200$∼$300 8.6304/3600 8.6716/3600 $-$0.4768 300$∼$400 2.2451/3600 2.2508/3600 $-$0.2506 The total 320.3791/3600 320.7868/3600 $-$0.1272

The true value in Table 3 is the reactive power of the original signal in each frequency band, and the simulation value is the reactive power of each frequency band extracted after the wavelet packet transform. In order to eliminate the influence of boundary effect, the data within 5T $∼$ 35T were taken to calculate the reactive energy. The simulation results show that the wavelet packet transform can extract the signals of each frequency band effectively, and the measurement method of reactive energy based on the wavelet packet transform is reasonable and accurate, which is suitable for the measurement of steady and unsteady reactive energy.

### 3.3 Harmonic Energy Metering Realization Based on Virtual Instrument

The feasibility and accuracy of the algorithm are verified by simulation, and a harmonic energy metering device based on virtual instrument is developed. After the measured three-phase voltage is transformed by the resistance divider network and the measured three-phase current is transformed by the transformer (TL) and the resistance network, the obtained 6-channel measurement signals are sent to the computer for information processing through the high-speed data acquisition card, and the harmonic analysis and harmonic energy measurement results are output. In order to avoid the influence of high frequency components on the wavelet packet transform, a FIR filter with symmetrical structure and linear phase characteristics is needed to conduct low-pass digital filtering for the sampled data of 6 channels. The voltage channel has AC gain error (ratio difference), and the current channel has AC gain error and phase offset error (Angle difference), so the above errors need to be corrected respectively before the wavelet packet transformation. After the successful development of the device, the operation test and accuracy test were carried out in Guangxi Electric Power Company, Hunan Electric Power Company and other units, which are a set of test results of the accuracy test of harmonic current measurement of the harmonic energy metering device in Guangxi Electric Power Test and Research Institute system. Among them, the signal source of sine wave superposition harmonic component is PS-3E standard signal source, the reference standard instrument is Arbitersystems931 harmonic analyzer, the input fundamental current is 2A, the input harmonic current Ih $=$ 2%In.

## 4 Conclusions

Based on the harmonic energy metering scheme of lifting wavelet packet transform, its principle and the realization process of decomposition and reconstruction algorithm are described in detail. On the basis of the feasibility and accuracy of the algorithm proved by simulation, a three-phase harmonic energy metering device based on virtual instrument technology is developed. The results show that, The function and measurement accuracy of the system are in line with the requirements of class A standard of GB/ T14549-1993.

## Acknowledgement

Science and technology project of the headquarters of State Grid Corporation of China: Research on Key Technologies of topology identification and line loss calculation application of complex low-voltage typhoon based on cross platform multi-source data fusion (5600-2019168a-0-0-00).

## References

[1] Veitinger J, Purves R S, Sovilla B. Potential slab avalanche release area identification from estimated winter terrain: a multi-scale, fuzzy logic approach[J]. Natural Hazards and Earth System Sciences Discussions, 3(10), pp. 6569–6614, 2015.

[2] Zhao L Y, Wang L, Yan R Q. Rolling Bearing Fault Diagnosis Based on Wavelet Packet Decomposition and Multi-Scale Permutation Entropy[J]. Entropy, 17(9), pp. 6447–6461, 2015.

[3] Lin Z, Jia Y. Transcale control for a class of discrete stochastic systems based on wavelet packet decomposition[J]. Information Sciences, 296(1), pp. 25–41, 2015.

[4] Wang, Ming-yue, Miao. Adaptive Bearing Fault Diagnosis based on Wavelet Packet Decomposition and LMD Permutation Entropy[J]. International Journal of Plant Engineering and Management, 04(v.47;No.229), pp. 12–26, 2016.

[5] GMR, Institute, of. Detection and power quality disturbance classification based on wavelet packet decomposition and modified immune optimization algorithm[J]. International Journal of Knowledge-based and Intelligent Engineering Systems, 16(4), pp. 261–277, 2016.

[6] Resalat S N, Saba V. A practical method for driver sleepiness detection by processing the EEG signals stimulated with external flickering light[J]. Signal Image & Video Processing, 9(8), pp. 1751–1757, 2015.

[7] Ye R, Guo Z, Liu R. Wind Speed and Wind Power Forecasting Method Based on Wavelet Packet Decomposition and Improved Elman Neural Network[J]. Diangong Jishu Xuebao/Transactions of China Electrotechnical Society, 32(21), pp. 103–111, 2017.

[8] Zhang Y, Pan F, Shen J. Adaptive audio steganography algorithm based on wavelet packet decomposition and matrix code[J]. Journal of Computer Applications, 35(3), pp. 722–725, 2015.

[9] Djerbouai S, Souag-Gamane D. Drought Forecasting Using Neural Networks, Wavelet Neural Networks, and Stochastic Models: Case of the Algerois Basin in North Algeria[J]. Water Resources Management, 30(7), pp. 2445–2464, 2016.

[10] Kim J. Discrete Wavelet Transform-Based Feature Extraction of Experimental Voltage Signal for Li-Ion Cell Consistency[J]. IEEE Transactions on Vehicular Technology, 65(3), pp. 1150–1161, 2016.

## Biographies

Mengshuang Liu, male, undergraduate, he now is an engineer working in Electric Power Research Institute of State Grid Xinjiang Electric Power Co., Ltd. His research direction is power metering and collection and operation.

Xudong Shi, male, undergraduate, he now is an senior engineer working in Electric Power Research Institute of State Grid Xinjiang Electric Power Co., Ltd. His research direction is measurement management, line loss management and power marketing.

Chen Yang, male, his degree is bachelor, he now is an assistant engineer working in Electric Power Research Institute of State Grid Xinjiang Electric Power Co., Ltd. His research direction is power marketing and information management.