Simulation and FPGA Implementation of Transient Power Quality Disturbance Detection

With the access to new energy in the smart grids and the massive use of nonlinear and unbalanced large loads, the problem of power quality becomes more and more serious. At present, the transient power quality disturbance problem has been paid more attention to. The research on transient power quality is relatively late, and various detection methods and technologies are not mature. It is necessary to use more efficient methods to detect and identify transient power quality to improve the safety of electricity use. This paper proposes to detect transient power quality disturbance by wavelet transform. In this paper, the original signal modelling of five kinds of power quality problems such as voltage sag and voltage swell. The 9/7 wavelet lifting coefficient is optimized in this paper and is carried out on the MATLAB software platform to improve the processing speed of the algorithm and realize parallel processing. The simulation results show that the improved lifting wavelet processing can effectively detect the transient power quality disturbance.


Introduction
Electric energy is a special commodity provided by the electric power department, which needs to be jointly maintained with users to ensure its quality.As other goods have a quality of good or bad points, electric energy also has the requirements of electric energy quality and evaluation indicators.Under normal conditions, the electrical energy used by the user is the standard frequency sinusoidal voltage and current.However, the power quality is often affected by various nonlinear loads, circuit faults, and bad weather, so the power reaching users is often distorted by sinusoidal voltage and current.In recent years, due to the influence of new energy, the power grid is facing higher power quality risks.With the rapid development of artificial intelligence technology and a microprocessor, detection technology of power quality disturbance is developing in the direction of digitalization, information, and intelligence [1].To sum up, with access to new energy in the smart grids and the massive use of nonlinear loads, power quality problems of the power grid become more and more serious.Therefore, it is necessary to adopt more efficient methods to detect and identify power quality in the new situation.

Related Work
The study of steady-state power quality disturbance with harmonic as main has a relatively long history and its analysis and detection methods are relatively mature.Due to the inherent characteristics of transient power quality, such as short duration, non-stationary and random intensity, the detection method used for transient power quality disturbance is required to have good dynamic response characteristics and real-time performance.In recent years, more and more attention has been paid to transient power quality disturbance, and the research on transient power quality disturbance started relatively late, and various detection methods and technologies are not mature yet.Wang et al. proposed a new method for transient power quality disturbance detection, which is very simple, does not need to set a pre-filter unit, has only two parameters, and is insensitive to the detection results [2].Xu et al. used STFT time-frequency signal analysis to detect power quality disturbance [3].At the same time, singular value decomposition is used to determine the disturbance time positioning, and the detection is more accurate.However, the shape and size of the window function of this method are fixed, and the adaptive ability is poor, so it is more suitable for the analysis of stationary signals.Huang et al. proposed a transient disturbance identification method combining improved multi-resolution fast S transform and two-position morphological denoising.This method has obvious advantages in processing signals containing high noise, but it is difficult to ensure real-time performance due to its large amount of computation [4].At present, local mean decomposition (LMD), improved strong tracking UKF, Prony analysis, artificial neural network analysis, and so on are applied to detect the transient disturbance [5].Wavelet transformed with the advantage of time-frequency localization, strong transient characterization ability for abrupt signal, and can carry out multi-scale analysis of signal through translation and expansion transformation.
Among many wavelet basis functions, the 9/7 lifting wavelet has compactly supported and orthogonality in the time domain, and has a mature fast algorithm, which is the most suitable basis function for power quality transient disturbance analysis.Therefore, this paper chooses the 9/7 lifting wavelet transform for power quality transient disturbance analysis.
Many experts have done a lot of research on the 9/7 lifting wavelet.Chen et al. studied the 9/7 lifting wavelet for image object detection [6].Wang et al. designed a new high-speed 9/7 lifting wavelet implemented on FPGA [7].The system can meet the requirements of high-speed operation by using a pipeline structure and improving the lifting algorithm.But the algorithm still uses floating-point arithmetic.Gu et al. adopted the 9/7 lifting wavelet to detect the start and end time of the power disturbance signal [8].The simulation results show that the lifting wavelet transform is accurate and overcomes many defects of the traditional method, which proves the superiority of the lifting algorithm.However, the advantages of this algorithm are not further reflected in FPGA.In this paper, the 9/7 lifting wavelet is used to realize the fast detection of power quality disturbance on FPGA, and the algorithm performance is improved by optimizing the wavelet coefficient to reduce floating point arithmetic.

Continuous wavelet transform
Wavelet analysis uses the basic function to approximate and expand the known signal to achieve the purpose of studying the characteristics of the known signal [9].There is A square-integrable function In the equation, ) Accordingly, the inverse wavelet transforms of the signal ( )  f t is shown in Equation (4).

Lifting wavelet
Daubechies and Sweldens showed that the wavelet transformation of any finite impulse response wavelet filter can be decomposed into a series of simple lifting steps.The promotion step includes split, prediction, and update [10].Firstly, the original signal is divided into two different sequences by splitting, and then the high and low-frequency components of the signal are separated by prediction and update.Due to the local correlation between continuous signals, the signal value at a certain point can be predicted by its adjacent signals.The prediction error is the high-frequency information of the signal, and the low-frequency information can be obtained by updating and adjusting the original signal through the high-frequency information.
The 9/7 wavelet is a biorthogonal wavelet basis, which has the characteristics of a large vanishing moment and good energy concentration.It is widely used and can effectively detect the occurrence of power quality singular signals.Different from the general lifting method, the 9/7 lifting wavelet consists of two stages of prediction and update, which can prevent the expansion of signal reconstruction error and improve system stability.
• Odd and even separation We divide an array into data groups with an odd index and data groups with an even index.
• Promotion The 9/7 wavelet transform goes through two lifting phases, as shown below.

Wavelet mode maximum principle of signal singularities
In transient power quality signals, the occurrence of abrupt change points usually indicates the occurrence of faults.Therefore, the purpose of fault detection can be realized through singularity detection.By extracting and analyzing its fault characteristics, the corresponding fault treatment and compensation measures are taken.The start and end time of the disturbance of the transient power quality signal is corresponding to the signal singularity, which can be represented by its modal maximum after wavelet transformation.The modal maxima of wavelet transform can be used to extract the disturbance characteristics of transient power quality.

Modeling of transient power quality disturbance signal
Steady-state power quality includes harmonic, unbalanced, and frequency fluctuation.Transient power quality mainly includes voltage sag, voltage swell, voltage interrupt, oscillation transient, and pulse transient.With the increasing harm of transient power quality to users, transient power quality disturbance has gradually become an urgent problem for power supply departments and users and has become a new hot spot in the field of power system research in recent years [11].The characteristics of transient power quality can be described by voltage amplitude variation and duration of the transient disturbance.Therefore, the detection of the start and end time of transient power quality and the calculation of its amplitude is the primary problems to be solved.The focus of this paper is to detect the start and end times of transient power quality.Based on the definition and characteristics, mathematical modeling of the disturbance signal is presented.The model will be implemented by writing code in MATLAB and Simulink, respectively.To compare the simulation results more easily, the signal model does not add noise processing.
• Voltage sag Voltage sag refers to a transient voltage quality problem lasting 0.5 cycles to 1 minute when the power-frequency voltage drops to between 0.1 p.u and 0.9 p.u.According to statistics, 80% of power quality problems are usually caused by voltage sag.The mathematical model of voltage sag signal established in this paper is 2 2 0 2 sin(1 0 0 ) 0 0 .1,0 .20 .25 ( ) 22 0 2 sin (1 00 ) 0 .1 0 .2,0 .5 (13) • Voltage swell Voltage swell refers to the voltage quality problem when the effective value of power frequency voltage rises to 1.1-1.8PU and lasts for 0.5 cycles to 1 minute.Transient swell is also associated with system failures, including removal of heavy loads, charging of capacitor banks, and temporary voltage increases during single-phase grounding failures, but they are not as common as voltage sag.The mathematical model of the voltage swell signal established in this paper is 220 2 sin(100 ) 0 0.1, 0.2 0.25 ( ) 220 2 sin(100 ) 0.1 0.2, 1.5 • Voltage interruption It refers to the voltage quality problem when the voltage drops below 0. 1pu and lasts no more than 1 minute.The causes of voltage outages include lightning strikes, equipment failures, mis-operation of control devices, etc.In general, the interruption caused by a fault in the power system is determined by the action time of the protection device of the power system [3].Discontinuities caused by equipment failure or loose connection are of indefinite duration.If the outage is caused by a power system failure, a voltage dip may occur before the outage occurs.The mathematical model of voltage interrupt signal established in this paper is 220

optimization and FPGA implementation of lifting wavelet
The main work of the FPGA lifting wavelet algorithm is the realization of lifting wavelet filter banks.This paper will optimize the wavelet coefficient and reduce floating point arithmetic to improve the performance of the 9/7 wavelet on FPGA.The module of the lifting wavelet algorithm is designed by Xilinx's System Generator and converted into a Verilog/HDL file which is a common hardware description language of FPGA.If the coefficient in the lifting scheme is a power series of 2, it will be beneficial to implement it in ASIC design.Chen Yongfei et al. proposed a 9/7 lifting wavelet target detection algorithm [6].In addition, it can be proved that the 9/7 wavelet satisfies the biorthogonal wavelet construction theorem.Therefore, the 9/7 lifting wavelet is easy to be implemented by hardware and can retain the excellent performance of the 9/7 wavelet filter.The coefficients of the 9/7 wavelet lifting transform are as follows: where the filter coefficient can be obtained as follows: 1.586134342 The implementation of this set of coefficients requires floating-point calculations, which run slowly.To simplify the calculation, some special choices can be made for the free variable α.The lifting coefficients of a simple set of filters are obtained, which still satisfy the biorthogonal wavelet construction theorem.The above equation shows that the 9/7 wavelet has at least three power series with a denominator.9/7 lifting wavelet coefficient is simpler and has the advantages of less computation and easy hardware implementation.Using pipelining technology in FPGA can make full use of the parallelism of FPGA's internal hardware and improve the system's ability to process data per unit of time [13].
Although 9/7 lifting wavelet coefficients are easier to be implemented by hardware than CDF9/7, there are floating point numbers in the lifting coefficients, which are not easy to be implemented by FPGA hardware when high-speed processing is carried out.The multiplication operation of coefficients in the equation can be realized by shifting and adding operations.The implementation and optimization process of the 9/7 lifting wavelet is as follows.
• The first prediction and update: The coefficient of the first prediction step of the 9/7 lifting wavelet transform is -3/2, which is equivalent to -(1+1/2).In FPGA, the data can be shifted to the right by 1 bit plus the original data after the negative number, a negative number can be realized by subtraction.The coefficient of the first update step of the 9/7 lifting wavelet is -1/16, which can be realized by shifting the data to the right by 4 bits and then taking the negative number.The first prediction and update module designed on the System Generator is shown in Figure 6 where  x output by the first module are respectively the even sequence and odd sequence of the input signal of the second module.The normalization coefficient of the 9/7 lifting wavelet is K=1.25, which is equivalent to (1+1/4).In FPGA, the data can be shifted to the right by 2 bits plus the original data.The normalization coefficient 1/K is 0.8, and its realization method is the same as the coefficient of the second update step of the 9/7 wavelet transform.Figure 8 shows the normalized module designed on the System Generator, where H represents the high-frequency component output after lifting wavelet processing, and L represents the low-frequency component.There is some deviation between the simulation results and the previous MATLAB processing results, which is due to the use of bit operation and data rounding operation in the process of operation, resulting in some data loss.However, through a large number of experimental simulations, the detection results

0a>
， b is called the translation factor and a is called the scale factor.Since the translation factor b and the scale factor a are continuous, is also called the continuous wavelet basis function.If the signal( )

) 4 .
Results and Analysis4.1 Simulation of MATLAB detection algorithmThis section simulates the detection of five disturbances, including voltage sag, voltage swell, voltage interruption, oscillation transient, and pulse transient, under the environment of MATLAB software.The start and end times of the disturbance can be obtained by analyzing the modal maximum of the highfrequency coefficient waveform.As it is shown in Figure1, the maximum value of the high-frequency coefficient of the lifting wavelet is obtained at 0.1 s and 0.2 s respectively, thus the start and end time of the corresponding voltage sag disturbance can be measured.It can be seen from Figure2that the highfrequency coefficient of the lifting wavelet achieves the maximum modulus at 0.1 s and 0.2 s respectively, thus the start and end time of the corresponding voltage swell disturbance can be measured.It can be seen from Figure3that the high-frequency coefficient of the lifting wavelet achieves the maximum modulus at 0.1 s and 0.2 s respectively, thus the start and end time of corresponding voltage interruption disturbance can be measured.It can be seen from Figure4that the maximum value of the high-frequency coefficient of the lifting wavelet is obtained near 0.2 s, from which the occurrence time of the corresponding oscillation transient disturbance can be measured.It can be seen from Figure5that the maximum value of the high-frequency coefficient of the lifting wavelet is obtained near 0.2 s, from which the occurrence time of the corresponding pulse transient disturbance can be measured.

Figure 1
Figure 1 The lifting wavelet transform of voltage sag

Figure 2 Figure 3 6 Figure 4 Figure 5
Figure 2 The lifting wavelet transform of a voltage swell sequence of the input signal and e v e n X the even sequence of the input signal.Timing control is completed through the System Generator delay module.The lifting coefficient and prediction coefficient of the lifting wavelet can be realized by the System Generator adder and shifter.

Figure 6
Figure 6 The first prediction and update module • The second prediction and update:The coefficient of the second prediction step of the 9/7 lifting wavelet is 0.8.The original data were shifted to the right by 1 bit, 2 bits, 5 bits, and 6 bits, and then their results were added to achieve the multiplication of coefficient 0.8.The coefficient 0.46875 in the second update step of the 9/7 lifting wavelet is equivalent to 0.5-0.3125,so it can be achieved by subtracting the result of the original data shifted by one bit to the right from the result of the original data shifted by five bits.The second prediction and update module designed on the System Generator is shown in Figure 7.The signal e x and signal ox output by the first module are respectively the even sequence and odd sequence of the input signal of the second module.

Figure 7
Figure 7 The second prediction and update module • Normalization:The normalization coefficient of the 9/7 lifting wavelet is K=1.25, which is equivalent to (1+1/4).In FPGA, the data can be shifted to the right by 2 bits plus the original data.The normalization coefficient 1/K is 0.8, and its realization method is the same as the coefficient of the second update step of the 9/7 wavelet transform.Figure8shows the normalized module designed on the System Generator, where H represents the high-frequency component output after lifting wavelet processing, and L represents the low-frequency component.

Figure 8
Figure 8 Normalization module4.3FPGA simulation verificationThe software design is converted into Verilog/HDL, and ModelSim is used for functional simulation verification.The previous mathematical model is realized in simulation by Verilog/HDL hardware description language, and the original data of the disturbance model is obtained.The resulting perturbed model data is converted to an ISE-supported DAT file.Then add the DAT data file to RAM in the simulation test file.Finally, the data in the RAM is read as the simulation excitation signal to carry on the lifting wavelet processing.There is some deviation between the simulation results and the previous MATLAB processing results, which is due to the use of bit operation and data rounding operation in the process of operation, resulting in some data loss.However, through a large number of experimental simulations, the detection results Oscillation transient An oscillation transient refers to the non-power frequency bipolar mutation of voltage or current under its steady state condition.The causes of the oscillation transient include line load, switching of the capacitor bank, etc.The oscillation transient simulation model established in this paper is Pulse transient A pulse transient is a sudden change or quantitative change of voltage or current between two continuous steady states in a very short time.It may be either a pulse of either polarity or the first peak of a damped oscillation of either polarity.The most common cause of pulse transients is lightning.The pulse transient simulation model established in this paper is