1 Introduction

Microgrid technology has provided a new technical approach for the large-scale integration of renewable energy and distributed generations, as well as technical support for the grid-connected operation of distributed generations to meet the requirements of smart grid. However, power quality problem is a prominent challenge for microgrid. On one hand, there are a variety of distributed generations and nonlinear fluctuating loads in microgrid. Especially the output power of wind turbines and photovoltaic cells has the trait of fluctuation, randomness and intermittent. This may lead to the unbalanced power between microsources and loads. On the other hand, the extensive use of power electronic devices such as grid-connected inverters, solid state switches and electric vehicle charging devices deteriorates the power quality indices. The research on power quality in microgrid has important theoretical and practical significance.

The power quality issue in microgrid may be dealt with a new power management system, accurate and rapid disturbance detection is an essential function of this system. Power quality issues in microgrid mainly include voltage and current harmonics, voltage sags, voltage swells, voltage short interruptions, voltage fluctuations and flickers, voltage and current unbalance components and so on [14]. Due to the traits of distributed sources the harmonics and inter-harmonics in microgrid may be abundant. Meanwhile the voltage fluctuation and flicker as random, dynamic and non-stationary phenomenon may become important issue for microgrid operation.

The disturbance detection method for microgrid application needs to analyze not only harmonic and inter-harmonic signals but also nonlinear and non-stationary signals. Hilbert-Huang transform (HHT) is an adaptive time-frequency analysis method which can deal with nonlinear and non-stationary signal analysis as well. This time-frequency analysis method can adaptively decompose signals according to their characteristics, thus characteristics of power quality disturbance are automatically extracted from the signals themselves. Compared with Fourier transform, HHT can analyze non-stationary and non-periodic signals. Furthermore, compared with wavelet transform, HHT not only has the advantages of wavelet transform, but also does not need to select basic functions [5]. For these reasons, HHT is a suitable method to carry out disturbance detection in microgrid. In this paper an improved HHT method is studied.

2 Basic principle and existing problem of HHT

2.1 Basic principle

HHT is a new nonlinear and non-stationary data analysis method composed of empirical mode decomposition (EMD) and Hilbert transform (HT). A nonlinear and non-stationary sequence can be decomposed into finite number of intrinsic mode functions (IMFs) and a trend term through EMD, which is called EMD sifting processing [6, 7]. An IMF must satisfy the following two constrains: ① the number of zero-crossing points and the number of extreme points must either be equal or differ at most by one; ② the average value of the upper envelope defined by the local maximums and the lower envelope defined by the local minimums is zero. Hilbert transform is applied to each IMF to calculate its instantaneous frequency and amplitude and to get the oscillation characteristics of different time scales which are contained in signals.

2.2 End effect

One of the greatest disadvantages of HHT is the end effect which exists in the process of EMD and HT. Signal distortion superimposes in the two processes so that the end portions of HHT cannot correctly reflect the information contained in the signal. Specifically, cubic spline interpolation function is used to obtain the upper and lower envelopes in EMD process. But it cannot ensure the two endpoints of the data sequence are exactly the extreme points. That means, at the endpoints, the spline interpolation may have low precision and it may lead to ‘overshoot’ or ‘undershoot’ phenomenon. Even worse, the entire data sequence may be “contaminated” through loop iteration, which eventually leads to serious distortion of IMFs and the generation of false IMFs.

Fast Fourier transform is exploited to compute instantaneous frequency and amplitude of IMFs during Hilbert transform. However if the periodic signal is sampled non-periodically, Fourier transform may cause ‘Gibbs phenomenon’ and frequency leakage, which may result in ‘runaway’ at both ends of the signal, that is, losing information of the signal itself.

The end effect reduces the signal analysis accuracy of HHT and impedes its wide application. Many methods and techniques have been studied and developed to solve this problem. Ideally, periodic sampling is the most valid way but its feasibility is poor. The essence of the suppression of the end effect in EMD is how to solve the interpolation of bad points in the process of fitting extreme point envelope curve. There are two basic methods for this problem: ① improving the interpolation function; ② extending the signal at the two endpoints to reduce the errors of fitting envelope curve at the endpoints. The latter method is the main solution for the end effect. It can be divided into three categories which are summarized and shown in Fig. 1 [813].

Fig. 1
figure 1

Extension methods for end effect prediction

Among them, the basic idea of waveform extension is to use the variation trend of the signal to extend itself. The extension results approach to the characteristics of the original data. The basic idea of data prediction extension is to build a particular mathematical model, of which the parameters are computed according to the original signal. The trend of the two endpoints of the signal can be predicted by the model. However, the establishment of the model (especially those of some artificial intelligence algorithms) is of high requirement. As for extreme point extension, it uses the extreme points to extend the signal. But its time adaptability is poor. In order to take full advantage of each method, some of these methods are combined. But the difficulty is how to find an effective way to make the combination.

2.3 Mode mixing

Another important drawback of HHT is the mode mixing which is discovered by Huang firstly. The mode mixing refers to that an IMF contains quite different characteristic time scales, or different IMFs contain similar characteristic time scales. It appears when the waveform of an IMF mixes with those of its adjacent IMFs. Thus identification of the waveforms is difficult which causes Hilbert transform to lose physical meaning [14]. There are two reasons of the generation of mode mixing. Firstly, signals are mixed with abnormal events [6], that is, discontinuous component contained in signals [7], pulse interference and noise. EMD uses the upper and lower envelopes of the signal (which are obtained by the spline interpolation of the extreme points of the signal) to compute the average value, then to complete the screening process. Therefore the presence of abnormal events leads to locally abnormal distribution of the extreme points, which results in mode mixing. Secondly, the amplitude and frequency of each component of the signal may influence each other. Because the amplitude and frequency determine the distribution of the extreme points, the influence between each component finally causes mode mixing.

Currently, solutions for mode mixing are proposed by researchers according to different causes. Figure 2 shows the classification of these methods [1417]. For mode mixing caused by abnormal events, there are methods include abnormal event elimination method, auxiliary signal addition method, signal filtering method and so on. The adaptability of abnormal event elimination method needs further improvement. Signal filtering method cannot completely eliminate the abnormal events. For mode mixing caused by the influence of the amplitude and frequency of the signal itself, there are methods included pseudo wave method of additive and subtractive sinusoidal signal, overall average EMD added white noise and so on. But both the two methods have a problem that the physical meaning of the average IMF is controversial.

Fig. 2
figure 2

Suppression methods for mode mixing

3 Improved HHT with adaptive waveform matching extension

3.1 Improved HHT method

In order to improve the accuracy of HHT for power quality disturbance detection, this paper introduces an adaptive waveform matching extension method.

To solve the end effect of EMD, both ends of the original signal require extension. The extension should be consistent with the changing trend of the original signal as much as possible. So the changing trend of the original signal can be maintained and a smooth transition from the original signal to the extension waveform can be obtained to suppress the end effect more effectively. Based on this, the adaptive waveform matching extension method is proposed.

The basic idea of the adaptive waveform matching extension method is as follows. Based on the hypothesis that similar waveforms would be repeated in the signal, one can find a triangular waveform which matches the boundary of the signal best in the waveform of the signal. According to the local value of the triangular waveform, one can predict the local value at the boundary of the signal. For signals which have weak inherent laws and abnormal changes of boundary data, one can only consider the extreme points at the boundary of the signal. This makes the method more adaptive. Since power quality disturbances usually last for a while, power quality signals contain information of the disturbances at the endpoints of the signals. This feature satisfies the hypothesis of the adaptive waveform matching extension. So the improved HHT based on adaptive waveform matching extension is more suitable for power quality analysis.

The principle of the adaptive waveform matching method is shown in Fig. 3. In Fig. 3, x(t) is the original signal; M 1 and N 1 are the first maximum and minimum values from the left point of the signal, corresponding to time \(t_{{m_{1} }}\) and \(t_{{n_{1} }}\), respectively; P 1 is the left boundary point. The \(P_{1} - M_{1} - N_{1}\) triangular waveform is used as the characteristic waveform. All sequences are searched for the most matching waveform \(P_{i} - M_{i} - N_{i}\). Data before (after) the matching waveform are taken as the left (right) extension of x(t), so as to satisfy the natural trend of the signal. Conventionally, only the amplitudes of point P, point M and point N are considered in the waveform matching error computational formula. But for the description of a signal, in addition to the depth of the waveform above, rise time and fall time should also be considered. Therefore this paper improves the waveform matching error computational formula to takes all these factors into account to enhance the accuracy of the found matching waveform and to improve the end effect of HHT.

Fig. 3
figure 3

Principle diagram of adaptive waveform matching method Time

The steps of adaptive waveform matching method are shown as follows.

1) Calculate the corresponding time of boundary point P i of the matching waveform by

$$t_{{P_{i} }} = \frac{{t_{{m_{1} }} t_{{n_{i} }} - t_{{n_{1} }} t_{{m_{i} }} }}{{t_{{m_{1} }} - t_{{n_{1} }} }}$$
(1)

2) Calculate matching error of characteristics waveform by

$$\left\{ \begin{array} {l} \delta (i) = \delta_{1} (i) + \delta_{2} (i) \hfill \\ \delta_{1} (i) = \left| {P_{1} - P_{i} } \right| + \left| {M_{1} - M_{i} } \right| + \left| {N_{1} - N_{i} } \right| \hfill \\ \delta_{2} (i) = \left| {t_{{{\text{up,}}1}} - t_{{{\text{up,}}i}} } \right| + \left| {t_{{{\text{down,}}1}} - t_{{{\text{down,}}i}} } \right| \hfill \\ \end{array} \right.$$
(2)

where \(\delta_{1}(i)\) is the magnitude error of waveforms; \(\delta_{2}(i)\) is the error of the rise time and fall time of waveforms.

3) Get the new \(\delta_{2}(i)\) by the normalization processing of matching error, and then get the normalized matching error \(\delta (i)\) with new \(\delta_{2}(i)\).

$$\begin{aligned} \delta_{2} (i) = \,& \left| {t_{{{\text{up,}}1}} - t_{{{\text{up,}}i}} } \right| + \left| {t_{{{\text{down,}}1}} - t_{{{\text{down,}}i}} } \right| \\ = & \,\alpha \left| {\left( {M_{1} - P_{1} } \right) - \left( {M_{i} - P_{i} } \right)} \right| \\ & + \beta \left| {\left( {N_{1} - M_{1} } \right) - \left( {N_{i} - M_{i} } \right)} \right| \\ \end{aligned}$$
(3)
$$\begin{aligned} \delta (i) =\, & \left| {P_{1} - P_{i} } \right| + \left| {M_{1} - M_{i} } \right| + \left| {N_{1} - N_{i} } \right| \\ = \,& \alpha \left| {\left( {M_{1} - P_{1} } \right) - \left( {M_{i} - P_{i} } \right)} \right| \\ & + \beta \left| {\left( {N_{1} - M_{1} } \right) - \left( {N_{i} - M_{i} } \right)} \right| \\ \end{aligned}$$
(4)

where t up is the rise time of the signal and \(t_{\text{up}} = t_{M} - t_{P}\); \(t_{\text{down}}\) is the fall time of the signal and \(t_{\text{down}} = t_{N} - t_{M}\); α and β are constants which are obtained by (5). M, N, P are the corresponding vectors.

$$\left\{ \begin{aligned} \alpha = \frac{{\left| {M - P} \right|}}{{\left| {t_{M} - t_{P} } \right|}} \hfill \\ \beta = \frac{{\left| {N - M} \right|}}{{\left| {t_{N} - t_{M} } \right|}} \hfill \\ \end{aligned} \right.$$
(5)

4) Take the waveform which has the smallest matching error in all matching errors as matching waveform.

5) Fetch data from the matching waveform between the previous point of the nearest data point to P i and the previous extreme point to obtain the extension waveform and extend the waveform to the left endpoint.

6) Extend the signal at the right endpoint in the same way which is shown in step 5, and get the complete extension of the signal as \(x'(t)\).

7) Apply HHT analysis to the extended \(x'(t)\), and get the instantaneous frequency and amplitude of the signal.

3.2 End effect suppression simulation

Test of the short-time harmonic signal in (6) is conducted to validate the adaptive waveform matching extension method in end effect suppression. HHT analysis results of the test are given as follows.

$$u(t) = \sum\limits_{i = 1}^{ 2} {A_{i} \sin (2{\uppi }f_{i} t)}$$
(6)

where \(A_{1} = 3\); \(f_{1} = 30\); \(A_{2} = 1.5\); \(f_{2} = 5\); the sampling frequency is 256 Hz; the number of sampling points is 512. The cubic spline interpolation is used to fit the envelopes of the signal.

The results in Fig. 4a indicate that with the extension method, the envelopes conform better to the natural trend of the signal. And the comparison of Fig. 4b with Fig. 4c shows that distortion at the endpoints, i.e., the end effect, is perfectly suppressed with the extension.

Fig. 4
figure 4

HHT analysis results of short-time harmonic signal

4 Experimental validations

In order to evaluate the performance of the improved HHT with adaptive waveform matching extension in power quality disturbance detection of microgrid, different simulations are implemented and the results are discussed. Improved HHT with adaptive waveform matching extension and HHT combining artificial neural network and mirror extension are compared below.

4.1 Voltage sag detection

In microgrid, sudden startup of wind turbines may cause voltage sags. The voltage sag signal given by (7) is extended directly since it is a single component signal.

$$u(t) = \left\{ {\begin{array}{ll} {\cos (2{\uppi }ft)} & {\text{others}} \\ {0.7\cos (2{\uppi }ft)} & {0.15 \le t \le 0.35} \\ \end{array} } \right.$$
(7)

As can be seen from Fig. 5, the voltage sag starts at t = 0.15 s and ends at t = 0.35 s, and the amplitude of the voltage disturbance is 0.3 V. Both two methods improve the end effect problem. The comparison between HHT combining artificial neural network and mirror extension is shown in Table 1. The improved HHT method can improve the amplitude accuracy by 0.52%, and the frequency accuracy is improved by 0.19%. We can also know that the detection time is reduced by 0.1037 s. That is to say, the detection precision and response speed of the method proposed in this paper is better. It is thus clear that the improved HHT method is accurate and valid for voltage sag detection in microgrid.

Fig. 5
figure 5

Improved HHT analysis results of voltage sag signal

Table 1 Results of two methods for voltage sag

4.2 Integer harmonic detection

An integer harmonic signal is given as

$$u(t){ = }\sum\limits_{i = 1}^{3} {A_{i} \sin (2{\uppi }f_{i} t)}$$
(8)

where \(A_{1} = 1\), \(f_{1} = 50\) of the fundamental wave; \(A_{2} = 0.3\), \(f_{2} = 250\) of the fifth harmonic component; \(A_{3} = 0.1\), \(f_{3} = 350\) of the seventh harmonic component. The sampling frequency is 3600 Hz, and the number of sampling points is 1800.

It can be clearly seen in Fig. 6 that the improved HHT extracts each harmonic component quiet well, and obtains precise instantaneous frequency and amplitude of each harmonic component. Both two methods improve the end effect problem. From Table 2, compared with the HHT combining artificial neural network and mirror extension, the improved HHT method proposed in this paper can improve the amplitude accuracy by 0.89% (5th) and 0.84% (7th), and the frequency accuracy is improved by 0.17% (5th) and 0.11% (7th). We can also know that the detection time is reduced by 0.0573 s. That is to say, the detection precision and response speed of the method proposed in this paper is better. It is thus clear that the improved HHT method proposed in this paper can accurately detect integer harmonics in microgrid.

Fig. 6
figure 6

Improved HHT analysis results of integer harmonic signal

Table 2 Results of two methods for integer harmonic

4.3 Inter-harmonic detection

Inter-harmonics which have the less or greater frequencies than the fundamental wave are selected for detection. The inter-harmonic signal is expressed as

$$u(t){ = }\sum\limits_{i = 1}^{3} {A_{i} \sin (2{\uppi }f_{i} t + \varphi_{i} )}$$
(9)

where \(A_{1} = 1\), \(f_{1} = 50\), \(\varphi_{1} = {\uppi }/4\) for the fundamental wave, \(A_{2} = 0.5\), \(f_{2} = 25\), \(\varphi_{2} = {\uppi }/15\) for the 0.5th harmonic component, \(A_{3} = 0.1\), \(f_{3} = 275\), \(\varphi_{3} = {\uppi }/24\) for the 5.5th harmonic component. The sampling frequency is 2048 Hz, and the number of the sampling points is 1024.

From Fig. 7, we can know that both two methods improve the end effect problem. From Table 3, compared with the HHT combining artificial neural network and mirror extension, the improved HHT method proposed in this paper can improve the amplitude accuracy by 0.82% (5th) and 0.80% (7th), and the frequency accuracy is improved by 0.32% (5th) and 0.144% (7th). We can also know that the detection time is reduced by 0.0616 s. That is to say, the detection precision and response speed of the method proposed in this paper is better. It is thus clear that the improved HHT method proposed in this paper can precisely detect inter-harmonics in microgrid.

Fig. 7
figure 7

Improved HHT analysis results of inter-harmonic signal

Table 3 Results of two methods for inter-harmonic

4.4 Voltage fluctuation and flicker detection

Since human’s eyes are most sensitive to approximately 8 Hz voltage flickers, a simulation of the 8 Hz voltage fluctuation and flicker defined by (10) is carried out.

$$\left\{ \begin{array} {l} u(t) = A(1 + Mp(t)\cos (2{\uppi }f_{1} t))\cos (2{\uppi }ft) \hfill \\ P\left( t \right) = \left\{ {\begin{array}{*{20}c} 1 & {0.15 \le t \le 0.65} \\ 0 & {\text{others}} \\ \end{array} } \right. \hfill \\ \end{array} \right.$$
(10)

where \(A = 1\), \(M = 0.1\), \(f = 50{\kern 1pt} {\kern 1pt} {\text{Hz}}\), \(f_{1} = 8{\kern 1pt} {\kern 1pt} {\text{Hz}}\). The sampling frequency is 1024 Hz, and the number of sampling points is 1024. Accurate start time and end time of the voltage flick are detected as seen from Fig. 8.

Fig. 8
figure 8

Improved HHT analysis results of voltage flicker signal

From Fig. 8, we can know that both two methods improve the end effect problem. From Table 4, compared with the HHT combining artificial neural network and mirror extension, the improved HHT method proposed in this paper can improve the amplitude accuracy by 1.20%, and the frequency accuracy is improved by 0.51%. We can also know that the detection time is reduced by 0.0484 s. That is to say, the detection precision and response speed of the method proposed in this paper is better. Simulation results indicate that the improved HHT proposed in this paper is effective in the voltage flicks detection.

Table 4 Results of two methods for voltage flicker

5 Analysis of measured resonance waveform based on improved HHT

5.1 Fluke harmonic experiment

A current waveform is generated by the Fluke harmonic generator as shown in Fig. 9. The sampling frequency is 12800 Hz, and 256 points are sampled in one sampling period.

Fig. 9
figure 9

Current waveform of Fluke harmonic generator

Improved HHT analysis results in Fig. 10 show that the harmonic current of different frequency amplitudes including the 0.5th, 3th, 5th, 5.5th, 7th and 11th harmonic components, which is in accordance with the current waveform shown in Fig. 9. This indicates that the improved HHT works well for integer harmonics, fractional harmonics and inter-harmonics detection.

Fig. 10
figure 10

Improved HHT analysis results of harmonic currents

5.2 Field experiment of photovoltaic grid-connected system

When SVG reactive power compensation devices and all devices in the PV field area were at normal operation, the 110 kV bus voltage had been measured through a quality recorder (USA Fluke 1760) for 7 days (September 26th, 2013 - October 3rd, 2013) in a 30 MWp photovoltaic grid-connected system of an industrial park. The voltage distortion of phase A at the period of September 26th 15:00-21:00 which is obtained by power quality analyzer is taken as an example in Fig. 11. The improve HHT analysis results are shown in Fig. 12. The vertical axis represents the total voltage harmonic distortion (THD) percentage value.

Fig. 11
figure 11

THD of field phase A voltage distortion

Fig. 12
figure 12

Improved HHT analysis results of field voltage distortion

As can be seen from Fig. 12, the voltage harmonic distortion contains the 2th, 3th, 5th, 7th harmonic and voltage sag components. The harmonic orders, harmonic contents and voltage sag information obtained by the proposed method in this paper are consistent with the results of the field measurement obtained by power quality analyzer. Hence, the effectiveness of the proposed method is verified.

6 Conclusions

This paper systematically analyzes the causes of the end effect of HHT and the mode mixing problem. An improved HHT with adaptive waveform matching extension is proposed. This innovative method considers not only the depth of the waveform, but also the rise time and fall time of the waveform. Thus it is more accurate than traditional waveform extension method. Both simulation and experiment results show that adaptive waveform matching extension can effectively suppress the end effect of original HHT and enhance the accuracy of HHT analysis. The improved HHT is valid in various power quality disturbance detection of microgrid. Moreover, it provides a theoretical basis for the wider application of HHT in power quality analysis.

As perspective, the proposed improved HHT method may be used to detect sudden variation of different power quality index of a microgrid and to give right information to energy management system in order to determine appropriate working modes (grid-connected or islanded).