1 Introduction

Protecting and controlling of the smart grid require accurate and timely estimation of frequency. Measurement of frequency provides information of state estimation in the power networks around the wide area measurement system. The signal in a power system is easy to be distorted by harmonics, inter-harmonics, decaying direct current (DC) offset, and to be modulated in dynamic states. Therefore, methods of frequency estimation and measurement should have the ability of frequency-tracking under noisy, distorted, and distributed circumstances.

In the past few decades, many researchers have put emphasis on frequency measurement and analysis, and kinds of frequency estimation strategies have been reported, e. g., zero crossing [1, 2], least error squares [3], Newton approach [4], Kalman filter [5,6,7], prony algorithm [8], artificial neural networks [9], discrete Fourier transform (DFT), fast Fourier transform (FFT) [1, 10, 11] and demodulation technique [1]. DFT algorithm is the most well-known method for its capabilities of harmonics rejection and implementation of recursion. It is preferable for its availability, understandability, and simplicity when it is implemented by advanced digital signal processing chips.

Full-cycle DFT is a kind of window-based method requiring integral samples in each cycle. If the number of samples in a window is not an integer, which is common because of some off-nominal components in reality, DFT may provide certain errors [12]. DFT can approximate the instantaneous frequency, suppress the harmonics and smooth the noise by least squares method [13] in a steady state. However, the fundamental frequency of a signal would change and this signal may contain many off-nominal components as listed above, in which the decaying DC offset cannot be eliminated by simple DFT.

The fixed sampling rates are adopted by most data acquisition systems including the power system. It contains some drawbacks in frequency estimation and measurement. As a uniform sampling method, the sampling period of traditional DFT is constant. A simple frequency estimation method via exponential sampling and dyadic rational was provided in [14]. Other kinds of non-uniform sampling methods, e.g., log-time sampling [15], extended staggered under-sampling [16], logarithmic sampling [17], and near optimal sampling [18] were introduced. These sampling methods indicate that designing of phase-locked loop is important [19, 20]. Methods such as higher-order lags of the sample auto-correlation [21] and high-order Yule-Walker estimation [22] were utilized in calculating the sinusoidal frequency, and a variable-window-based algorithm for frequency tracking and phasor estimation was narrated in [23].

In this paper, a new method for frequency estimation and tracking was proposed, in which DFT algorithm iterates with re-sampling to confront frequency change in dynamic states of a power system. In each cycle, precise frequency estimation is accomplished by iterative DFT. In the following cycle, the initial sampling frequency is given by this converged frequency, and so on. The proposed iterative DFT by re-sampling is a two-rounded process to provide precise frequency estimation and frequency tracking ability dynamically in a power system.

The algorithm of frequency estimation by DFT was presented and the error caused by an off-nominal signal was analyzed in Section 2. Frequency tracking by iterative DFT with re-sampling was discussed. Recommended by IEEE Std. C37.118 [24, 25], analysis of three types of step-changed signal was made in Section 3. Performance of the new algorithm in different scenarios was shown in Section 4. Additional discussions about wavelet transform were made in Section 5. Conclusions were given in Section 6. Some formula derivations and auxiliary figures were provided in the Appendix.

2 Method of frequency estimation by DFT

2.1 Algorithm of classic DFT

DFT can provide the amplitude and phase angle of phasor and the frequency by way of differentiating the phase angles. Suppose the nominal voltage or current signal in a nominal power system is

$$ x(t)=A\cos \left(\omega t+{\varphi}_0\right)\kern0.5em \left(-\infty <t<\infty \right), $$
(1)

where ω and A are the angular frequency and amplitude respectively. ω is supposed to be 2πf0, f0 is the nominal frequency, and φ0 is the initial phase angle. In order to precede the DFT calculation, signal is always truncated and finite samples should be taken by kinds of windows. The process of making a phasor estimation will require sampling the waveform over some interval of time which can lead to some confusion if the number of samples is not an integer in a window. The magnitude is compensated by dividing the magnitude with a sine at the actual signals frequency. The 2-cycle triangular window produces a faster roll off than a standard 1s-cycle rectangular window, but the frequency deviation is spread with an additional factor of 1.625 to increase compensation [25]. A simple rectangular window is adopted in this study. By the way, the length of a rectangular window could be selected easily and arbitrarily according to the requirements of accuracy and computational burden. DFT converts the equally spaced and uniform samples into a finite combination of complex sinusoids, ordered by their frequency. According to DFT, a phasor is calculated by

$$ {X}_k=\sum \limits_{n=0}^{N-1}{x}_n\cdot {e}^{-j\frac{2\pi }{N} kn}, $$
(2)

where N is number of samples, x(n) = A cos(2πn/N + φ0), (n = 0,1, 2,…,N − 1) are the samples taken uniformly within the length of a rectangular window; k is the order of harmonic; especially if k = 1, it stands for the phasor of the nominal component. The amplitudes and phase angles of kth harmonics are

$$ {\displaystyle \begin{array}{l}\left|{X}_k\right|=\sqrt{{\left({X}_{k\_\mathrm{real}}\right)}^2+{\left({X}_{k\_\mathrm{imag}}\right)}^2},\\ {}\arg \left({X}_k\right)=\mathrm{atan}\left({X}_{k\_\mathrm{imag}}\right)/{X}_{k\_\mathrm{real}}\Big),\end{array}} $$
(3)

where atan stands for the arctan function. Xk_real and Xk_imag are real part and imaginary part of Xk. According to Eq. 2 and Eq. 3, if k = 1, the phasor of the nominal signal is calculated by

$$ {\displaystyle \begin{array}{l}{X}_1=\frac{2}{N}\sum \limits_{n=0}^{N-1}x(n){e}^{-j\frac{2\pi }{N}\cdot n},\\ {}{X}_{1\_\mathrm{real}}=\frac{2}{N}\sum \limits_{n=0}^{N-1}x(n)\cos \left(\frac{2\pi }{N}\cdot n\right),\\ {}{X}_{1\_\mathrm{imag}}=-\frac{2}{N}\sum \limits_{n=0}^{N-1}x(n)\sin \left(\frac{2\pi }{N}\cdot n\right),\end{array}} $$
(4)

where X1_real is the real part of the phasor of nominal component, and X1_imag is the imaginary part. In front of the summation sign, a multiplier of 2/N is used to generate the normalized amplitude of DFT, i.e., 1 p.u.. The phasor of nominal signal is expressed as

$$ {X}_1={Ae}^{j{\varphi}_0}. $$
(5)

Definition of synchronous phasor is shown in Fig. 1, in which the peak of the sine/cosine signal coincides with the time-tag, so the angular is 0°; if the signal crosses zero at the time-tag, it produces − 90° according to the IEEE Std. C37.118 [24,25,26].

Fig. 1
figure 1

Definition of synchronous phasor and the angular convention

2.2 Frequency estimation by classic DFT

The synchronous phasor (synchrophasor) is defined as a complex number, representing the fundamental frequency component of a voltage or current, with an accompanying time-tag defining the time instant for which the phasor measurement is performed [27]. Serial synchrophasors are calculated by shifting windows at each sampling time tr = rTs, r = 0,1,2,…,+∞, where Ts is the sampling interval, Ts = 1/fs. A synchrophasor at time tr is represented as

$$ {\displaystyle \begin{array}{l}{X}_1^r=\frac{2}{N}\sum \limits_{n=0}^{N-1}x(n){e}^{-j\frac{2\pi }{N}\cdot n}\cdot {e}^{j\frac{2\pi }{N}\cdot r}\;\\ {}\kern1.62em ={Ae}^{j\left({\varphi}_0+2\pi r/N\right)}={X}_1{e}^{j2\pi r/N},r=0,1,2,\dots, +\infty .\end{array}} $$
(6)

Amplitudes of serial synchrophasor at steady state are A, if the signal is a nominal one. The phase angles of serial synchrophasor are {φ0, φ0 + 2π/N, φ0 + 4π/N,…, φ0 + 2πr/N,…}. In the following, we use Xras the nominal phasor instead of \( {X}_1^r \) for simplicity. Frequency is defined as the speed of rotation of a phasor and can be calculated by two consecutive measured phases

$$ {f}^r=\left({\varphi}^{r+1}-{\varphi}^r\right)/\left(2\pi {T}_s\right), $$
(7)

where φr is the phase angle calculated by DFT. If φr is not the nominal one, f r would be inaccurate.

2.3 Frequency analysis for an off-nominal signal

It was reported that dynamic movement of rotors of generators and motors following power system disturbances causes the electromechanical transients or electromechanical non-steady states [24]. Generally, the frequency of an off-nominal signal is always represented as f0 + Δf. If Δf is a fixed frequency deviation. The representation of input signal is

$$ x(t)=A\cos \left[\left(2\pi {f}_0+2\pi \Delta f\right)t+{\varphi}_0\right]\kern0.5em \left(-\infty <t<\infty \right). $$
(8)

where x(n) are the samples taken in one window with length of NTs, x(n) = A cos[2πf0nTs + 2πΔfnTs + φ0], (n = 0,1, 2,…,N − 1). The nominal phasor is recorded as\( {X}_{\mathrm{nomi}}^r={Ae}^{j{\varphi}_{\mathrm{nomi}}^r} \), where \( {\varphi}_{\mathrm{nomi}}^r={\varphi}_0+2\pi r/N \)at time tr. The measured one is\( {X}_{\mathrm{meas}}^r={A}_{\mathrm{meas}}^r{e}^{j{\varphi}_{\mathrm{meas}}^r} \), and the measured phasor \( {X}_{\mathrm{meas}}^r \)for the off-nominal signal x(t) according to DFT is

$$ {\displaystyle \begin{array}{l}{X}_{\mathrm{meas}}^r=\frac{2}{N}\sum \limits_{n=0}^{N-1}x\left(n+r\right)\cdot {e}^{-j2\pi {f}_0{nT}_s}\\ {}\kern2.5em =\frac{1}{N}\sum \limits_{n=0}^{N-1}\Big[{Ae}^{j\left[2\pi {f}_0\left(n+r\right){T}_s+2\pi \Delta f\left(n+r\right){T}_s+{\varphi}_0\right]}\\ {}\kern5em +{Ae}^{-j\left[2\pi {f}_0\left(n+r\right){T}_s+2\pi \Delta f\left(n+r\right){T}_s+{\varphi}_0\right]}\Big]\cdot {e}^{-j2\pi {f}_0{nT}_s}\\ {}\kern2.5em ={Ae}^{j{\varphi}_0}{e}^{j2\pi \left({f}_0+\Delta f\right){rT}_s}\cdot \frac{1}{N}\sum \limits_{n=0}^{N-1}{e}^{j2\pi \Delta {fnT}_s}\\ {}\kern3em +{Ae}^{-j{\varphi}_0}{e}^{-j2\pi \left({f}_0+\Delta f\right){rT}_s}\cdot \frac{1}{N}\sum \limits_{n=0}^{N-1}{e}^{-j\left[2\pi \left(2{f}_0+\Delta f\right){nT}_s\right]}\\ {}\kern2.5em ={X}_{\mathrm{nomi}}^r{e}^{j2\pi \Delta {frT}_s}\cdot \mathrm{H}\left(\Delta f,N,{T}_s\right)\\ {}\kern5em +{X}_{\mathrm{nomi}}^{r\kern0.5em \ast }{e}^{-j2\pi \Delta {frT}_s}\cdot \mathrm{H}\left(-\left(2{f}_0+\Delta f\right),N,{T}_s\right)\\ {}\kern2.5em ={X}_{\mathrm{nomi}}^r{e}^{j2\pi \Delta {frT}_s}\cdot \mathrm{H}\left(\Delta f,N,{T}_s\right)\\ {}\kern6em +{X}_{\mathrm{nomi}}^{r\kern0.5em \ast }{e}^{-j2\pi \Delta {frT}_s}\cdot {\mathrm{H}}^{\ast}\left(2{f}_0+\Delta f,N,{T}_s\right)\\ {}\kern2.5em ={X}_{\mathrm{nomi}}^r\cdot \frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\sin \left(\pi \Delta {fT}_s\right)}\cdot {e}^{j{\varphi}_1^r}\\ {}\kern3em +{X}_{\mathrm{nomi}}^{r\kern0.5em \ast}\cdot \frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\sin \left(2\pi {f}_0{T}_s+\pi \Delta {fT}_s\right)}\cdot {e}^{j\left(2\pi {f}_0{T}_s-{\varphi}_1^r\right)},\end{array}} $$
(9)

where Η(Δf, N, Ts) is constant if the N, Δf, and Ts are all constant (detail formula derivations are in Appendix); and symbol “*” denotes the conjugation of a complex number.

If Δf→0, \( \underset{\Delta f\to 0}{\lim}\mid \mathrm{H}\left(\Delta f,N,{T}_s\right)\mid \to 1 \) as shown in Fig. 18 in Appendix. The phase angle \( {\varphi}_1^r \) at time tr in Eq. 9 is

$$ {\varphi}_1^r=\left(2r+N-1\right)\pi \Delta {fT}_s. $$
(10)

If Δf→0, \( \underset{\Delta f\to 0}{\lim}\mid \mathrm{H}\left(2{f}_0+\Delta f,N,{T}_s\right)\mid \to 0 \) is also shown in Fig. 18 in Appendix. \( {\varphi}_2^r \)is a very small phase angle as shown in Fig. 2 and can be calculated as

Fig. 2
figure 2

Relationship of measured phasor and the nominal one

$$ {\displaystyle \begin{array}{l}{\varphi}_2^r\approx \tan {\varphi}_2^r\\ {}=\frac{\left(\frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\cdot \sin \left(2\pi {f}_0{T}_s+\pi \Delta {fT}_s\right)}\right)\sin \left(2{\varphi}_{\mathrm{nomi}}^r+2{\varphi}_1^r-2\pi {f}_0{T}_s\right)}{\left(\frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\cdot \sin \left(\pi \Delta {fT}_s\right)}\right)+\left(\frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\cdot \sin \left(2\pi {f}_0{T}_s+\pi \Delta {fT}_s\right)}\right)\cos \left(2{\varphi}_{\mathrm{nomi}}^r+2{\varphi}_1^r-2\pi {f}_0{T}_s\right)}\end{array}}{\displaystyle \begin{array}{l}\approx \frac{\left(\frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\cdot \sin \left(2\pi {f}_0{T}_s+\pi \Delta {fT}_s\right)}\right)\sin \left(2{\varphi}_{\mathrm{nomi}}^r+2{\varphi}_1^r-2\pi {f}_0{T}_s\right)}{\left(\frac{\sin \left( N\pi \Delta {fT}_s\right)}{N\cdot \sin \left(\pi \Delta {fT}_s\right)}\right)}\\ {}=\frac{\sin \left(\pi \Delta {fT}_s\right)}{\sin \left(2\pi {f}_0{T}_s+\pi \Delta {fT}_s\right)}\sin \left(2{\varphi}_{\mathrm{nomi}}^r+2{\varphi}_1^r-2\pi {f}_0{T}_s\right)\\ {}\approx \frac{\pi \Delta {fT}_s}{\sin \left(2\pi {f}_0{T}_s\right)}\sin \left(2{\varphi}_{\mathrm{nomi}}^r+2{\varphi}_1^r-2\pi {f}_0{T}_s\right).\end{array}} $$
(11)

The measured phase angle \( {\varphi}_{\mathrm{meas}}^r \) is

$$ {\displaystyle \begin{array}{l}{\varphi}_{\mathrm{meas}}^r={\varphi}_{\mathrm{nomi}}^r+{\varphi}_1^r-{\varphi}_2^r\\ {}\kern2.1em ={\varphi}_{\mathrm{nomi}}^r+{\varphi}_1^r-\frac{\pi \Delta {fT}_s}{\sin \left(2\pi {f}_0{T}_s\right)}\sin \left(2{\varphi}_{\mathrm{nomi}}^r+2{\varphi}_1^r-2\pi {f}_0{T}_s\right).\end{array}} $$
(12)

According to Eq. 7, for the first two phase angles calculated by DFT, we have

$$ {\displaystyle \begin{array}{l}{f}_{\mathrm{meas}}^{r=0}=\frac{\varphi_{\mathrm{meas}}^{r=1}-{\varphi}_{\mathrm{meas}}^{r=0}}{2\pi {T}_s}=\frac{\left({\varphi}_{\mathrm{nomi}}^{r=1}+{\varphi}_1^{r=1}-{\varphi}_2^{r=1}\right)-\left({\varphi}_{\mathrm{nomi}}^{r=0}+{\varphi}_1^{r=0}-{\varphi}_2^{r=0}\right)}{2\pi {T}_s}\\ {}\kern2.1em =\frac{\varphi_{\mathrm{nomi}}^1-{\varphi}_{\mathrm{nomi}}^0}{2\pi {T}_s}+\Delta f-\frac{\Delta f}{2\sin \left(2\pi {f}_0{T}_s\right)}\Big[\sin \left(2{\varphi}_{\mathrm{nomi}}^1+2{\varphi}_1^1-2\pi {f}_0{T}_s\right)\\ {}\kern3em -\sin \left(2{\varphi}_{\mathrm{nomi}}^0+2{\varphi}_1^0-2\pi {f}_0{T}_s\right)\Big]\\ {}\kern2.1em ={f}_0+\Delta f-\frac{\Delta f}{\sin \left(2\pi {f}_0{T}_s\right)}\cos \left({\varphi}_{\mathrm{nomi}}^1+{\varphi}_1^1+{\varphi}_{\mathrm{nomi}}^0+{\varphi}_1^0-2\pi {f}_0{T}_s\right)\cdot \\ {}\kern3em \sin \left({\varphi}_{\mathrm{nomi}}^1+{\varphi}_1^1-{\varphi}_{\mathrm{meas}}^0-{\varphi}_1^0\right)\\ {}\kern2.1em ={f}_0+\Delta f-\frac{\Delta f}{\sin \left(2\pi {f}_0{T}_s\right)}\cos \left[2{\varphi}_0+\left(2N+1\right)\pi \Delta {fT}_s\right]\cdot \\ {}\kern3em \sin \left[2\pi \left(1+\Delta f/{f}_0\right)/N\right].\end{array}} $$
(13)

Without loss of generality, since N> > 4 and Δf < <f0, and suppose φ0 = 0, such in-equation of 0 < cos[(2N + 1)πΔfTs] < 1 can be fulfilled. We have

$$ \left\{\begin{array}{c}{f}_0<{f}_{\mathrm{meas}}\le {f}_0+\Delta f,\kern0.5em if\Delta f\ge 0\\ {}{f}_0+\Delta f\le {f}_{\mathrm{meas}}<{f}_0, if\Delta f<0\end{array}\right.. $$
(14)

3 Frequency tracking by iterative DFT with re-sampling

3.1 Inner-layered DFT iteration by re-sampling

From analysis above, the measured frequency fmeas would approach f0 + Δf more and more closely if we change the sampling frequency fs = Nfmeas consecutively. Especially when the sampling frequency becomes closely enough to the value of N(f0 + Δf), DFT calculated iteratively would give a measured frequency fmeas as the input and off-nominal frequency f0 + Δf exactly. It means that there are integral samples in 1 cycle of the input frequency again. The process of iterative DFT algorithm within 1 cycle (i.e., inner-layered iteration) is shown in Fig. 3.

Fig. 3
figure 3

Process of iterative DFT in 1 cycle

In the first cycle of DFT calculation, the sampling frequency fs is set to be Nf0 and two phasor are calculated to get the frequency fmeas. Then in the following cycle, new \( {f}_{\mathrm{meas}}^{\hbox{'}} \) is gotten according to the sampling frequency of \( {f}_s^{\hbox{'}}={Nf}_{\mathrm{meas}} \), until difference of two successive frequencies \( {f}_{\mathrm{meas}}^{\hbox{'}} \) and fmeas is less than a threshold δ. In Fig. 4, samples are taken by a rectangular overlapping shifting window at time tr = rTs (r = 0 and 1 respectively) as shown in Fig. 4. The first rectangle window contains N samples s0,s1,…,sN − 1 but not the sample of SN; however, the length of this window is N*Ts, where Ts is the sampling period. In the second rectangle window, N samples s1, s2,…,sN are taken with the same length N*Ts and so on.

Fig. 4
figure 4

Shifting windows of cosine waveform with time-tag at time t = 0 s

3.2 Outer-layered DFT iteration between cycles

3.2.1 Determination of initial frequency by amended exponential sampling

In the dynamic states or under the circumstance of low signal-to-noise ratio (SNR), the input frequency may change in every cycle. It introduces lots of harmonics and spectrum leakage, and also limits the application of exponential sampling in such situation. Exponential sampling is a kind of simple frequency estimation algorithm, which can simplify the process of sampling by exponential sampling and need only few samples distributed exponentially along the time [14]. Frequency is estimate based on a modified exponential sampling method, which is amended to be used in non-steady states.

For traditional exponential sampling, the sample are taken exponentially at

$$ {t}_p={2}^{p-Q-1}\kern0.5em (s),p=1,2,\dots, P, $$
(15)

where P defines the bit accuracy, and Q defines the maximal frequency fmax = 2Q. The samples are

$$ x\left({t}_p\right)=A\cos \left(2\pi {ft}_p+{\varphi}_0\right), $$
(16)

where f is the instantaneous frequency at tp, and it is not a constant anymore in the dynamic states. According to [14], the signal is a kind of sinusoidal signal. If a cosine signal is used in accordance with Eqs. 1, 8, and 16, we have

$$ s\left({t}_p\right)=\pm \sqrt{1-x{\left({t}_p\right)}^2}, $$
(17)

where symbols of “+” and “−” are taken according to the quadrants of phases of the signal. To guarantee the frequency to be an accuracy of 2QP Hz, we get

$$ {f}_{\mathrm{meas}}={f}_{\mathrm{max}}\sum \limits_{p=1}^P{b}_p{2}^{-p}, $$
(18)

where

$$ \left\{\begin{array}{c}{b}_p=0,\kern0.5em if\kern0.5em s\left({t}_p\right)>0\\ {}{b}_p=1,\kern0.5em if\kern0.5em s\left({t}_p\right)<0\end{array}\right.. $$
(19)

If s(tp) = 0 for some p = p0 ≤ P, and \( {b}_{p_0}=1 \), the Eq. 18 is rewritten to be

$$ {f}_{\mathrm{meas}}={f}_{\mathrm{max}}\sum \limits_{p=1}^{p_0}{b}_p{2}^{-p}, $$
(20)

where p0 is a terminator of exponential sampling. For example, if a power system with a nominal frequency of 60 Hz and the dynamic frequency range is [− 5, + 5] Hz, it indicates that off-nominal frequency may be 65 Hz > 64 = 26 Hz. Hence, we set Q = 7 and P = 7 for an accuracy of 1 Hz. We get x(tp) = {− 0.9809, 0.9239, 0.7071, 0, − 1, 1, 1}, and let us suppose φ0 = 0, s(tp) = {0.1951, − 0.3827, − 0.7071, − 1, 0, 0, 0} and b = {0, 1, 1, 1, 1, 0, 0}, where p0 = 5 without regard of noise.

Two factors influence the accuracy or even the correctness of frequency estimation by exponential sampling: first of all, if at the first sampling time t1 = 1/128 (s), the system frequency is suddenly changed to 65 Hz, we have s(t1) = − 0.0491, which means b1 = 1 and introduces frequency estimation error of 2Q−1 = 64 Hz; secondly, if the noise is big enough, values of samples may change from negative to positive (e.g., b2 = − 0.3827 may change to a positive value because of noise), which introduce frequency error of 2Q−2 = 32 Hz. So in the algorithm of amended exponential sampling (AES), we may set b0 = 0 and b1 = 1 constantly for P = Q = 7.

3.2.2 Process of frequency tracking cycle-by-cycle

Flow chart of DFT iteration is shown in Fig. 5, where L is the total number of cycles to be generated and \( {f}_{meas}^l \), l = 1,2,…,L are the measured frequency in the lth cycle by inner-layered calculation. In the following, we named the algorithm as “TLI-DFT (Two-layered iterative DFT) aided by AES”. In Fig. 5, the inner-layered iteration processes are implemented by iterative DFT in 1 cycle as shown in Fig. 3.

Fig. 5
figure 5

Iteration process of TLI-DFT aided by AES

3.2.3 Rate of change of amplitude and frequency

The rate of change of amplitude (ROCOA) is a simple technical analysis indicator showing the difference between the amplitudes of phasor Ar + 1 and Ar in the period of Ts. It is calculated by taking the time-derivative of the estimated amplitude numerically

$$ \mathrm{ROCOA}(r)=\left({A}^{r+1}-{A}^r\right)/{T}_s. $$
(21)

And the rate of change of frequency (ROCOF) in electricity networks is required by new IEEE/IEC/ CENELEC standards. Network frequency and its variation are key indicators of network stability and balance between electricity supply and demand. This balance is becoming more critical with the increasing use of highly variable renewable energy sources for electricity generation. At the same time, ROCOF measurements are inadequate for monitoring this balance. The ROCOF is calculated by

$$ \mathrm{ROCOF}(r)=\left({f}^{r+1}-{f}^r\right)/{T}_s\kern0.5em . $$
(22)

3.3 DFT analysis of off-nominal stepped-signals

In general, voltage and current waveforms are not always nominal sinusoids or cosine wave, particular in a distributed power system. Researchers have done some works on correcting this asynchronous effect [13, 28, 29]. Transients are non-unsteady states that occur in the power system. They are electrical transients and electromechanical transients generally.

The former are caused by faults and other switching operations, while the latter ones are generated by dynamic movement of rotors of generators and following power system disturbances [26, 30]. Phasors calculated in electrical transients often display a step change in phase angles and amplitude, but not the frequency. However, the motor speed in modern power systems may deviate from synchronous speed by 0.1~5 Hz, the phase angle behavior during the phasor estimation window is approximately linear [26, 30]. Recommend by IEEE Std. C37.118-2005 [30], three step-changing models are adopted.

3.3.1 Scenario of amplitude step

Signal of amplitude step is

$$ \left\{\begin{array}{c}x\left(0\le t<2T\right)=A\cos \left(2\pi {f}_0t+{\varphi}_0\right)\kern1em \\ {}x\left(t=2T\right)=\frac{A+{A}^{\hbox{'}}}{2}\cos \left(2\pi {f}_0t+{\varphi}_0\right)\\ {}x\left(2T<t<4T\right)={A}^{\hbox{'}}\cos \left(2\pi {f}_0t+{\varphi}_0\right)\end{array}\right., $$
(23)

where A and A' (we haveA ∈ {0.9A, 0.8A, 0.7A}) are the amplitudes of a voltage or current signal. An example of an amplitude step is shown in Fig. 6, in which A = 1 p.u.. A step change occurs (A’ → A) at time t = 2 T (cycle) in Fig. 6a. Amplitude given by phasor is shown in Fig. 6b. The total vector error (TVE) accuracy criterion detects errors in time synchronization, and phasor magnitude and angle estimation errors shown in Fig. 6c, where an amplitude variation of 0.1A generates 10% TVE.

Fig. 6
figure 6

Amplitude step change scenarios (step change occurs at the beginning of the second cycle; A = 1 p.u., f0 = 60 Hz, φ0 = 0)

TVE calculate the distortion of the signal from the nominal one by

$$ \mathrm{TVE}=\frac{\left|{X}_{\mathrm{meas}}-{X}_{\mathrm{nomi}}\right|}{\mid {X}_{\mathrm{nomi}}\mid}\times 100\%, $$
(24)

where Xmeas is the measured vector, and Xnomi is the nominal one.

The theoretical values of a synchrophasor representation of a sinusoid and the values obtained from a PMU (phasor measure unit) may include differences in both amplitude and phase. Although they could be separately specified, the amplitude and phase differences are considered together in this standard in the quantity called TVE. TVE is an expression of the difference between a “perfect” sample of a theoretical synchrophasor and the estimate given by the unit under test at the same instant of time [25].

The amplitude step change can influence phase angle of a phasor, the measured frequency, and ROCOF.

ROCOA, ROCOF, and frequency calculated by traditional DFT algorithm is shown in Fig. 6c–e. We find that an amplitude step can influence phasor measurement whose samples contains the stepped one and the variation starts from the beginning of first cycle to beginning of second cycle (in time-axis) as shown in Fig. 6.

3.3.2 Scenario of phase step

A step change of phase angle Δωω ∈ {π/2, π/3, π/6}) at time t = 2 T (cycle) is shown in Fig. 7, in which A = 1 p.u., f0 = 60 Hz, φ0 = 0. We have

$$ \left\{\begin{array}{c}x\left(0\le t<2T\right)=A\cos \left(2\pi {f}_0t\right)\kern3em \\ {}x\left(t=2T\right)=A\cos \left(2\pi {f}_0t+\Delta \omega /2\right)\kern1em \\ {}x\left(2T<t<4T\right)=A\cos \left(2\pi {f}_0t+\Delta \omega \right)\end{array}\right.. $$
(25)
Fig. 7
figure 7

Phase step change examples (step change occurs at the beginning of the second cycle t = 2 T, A = 1 p.u., f0 = 60 Hz, φ0 = 0)

Phase step influences amplitude and phase of measured phasor in a great deal. The measured TVE, frequency, and ROCOF are influenced as well as shown in Fig. 7.

3.3.3 Scenario of frequency step

The signal of frequency step is

$$ \left\{\begin{array}{c}x\left(0\le t<2T\right)=A\cos \left(2\pi {f}_0t+{\varphi}_0\right)\kern1.62em \\ {}x\left(t=2T\right)=A\kern9.22em \\ {}x\left(2T<t<4T\right)=A\cos \left(2\pi \left({f}_0+\Delta f\right)t\right)\end{array}\right., $$
(26)

where Δf is the frequency step of the signal as shown in Fig. 8, in which A = 1 p.u., f0 = 60 Hz, and φ0 = 0. Step occurs at the beginning of the second cycle t = 2 T (cycle).

Fig. 8
figure 8

Frequency step change examples (step change occurs at the beginning of the second cycle; A = 1 p.u., f0 = 60 Hz, φ0 = 0)

A phasor is severely influenced by step frequency as long as it exists in the signal. The circumstances of phase step and frequency step are similar as shown in Figs. 7 and 8.

4 Simulation results and data analysis

Traditionally, an adaptive sampling algorithm with varying sample interval Ts is adopted. Based on a feedback system, if the sampling frequency fs equals to N times of the frequency of the incoming signal finput, it provides that the incoming signal does not fluctuate in frequency [31]. New algorithm is compared with the traditional one. Parameters used in simulation are listed in Table 1.

Table 1 Parameters used in simulation

Weighted mean value of frequency \( {\overline{f}}_r \) in Eq. 27 is adopted by iteration process.

$$ {\overline{f}}_r=0.6\times {f}_{r+2}+0.3\times {f}_{r+1}+0.1\times {f}_r\kern0.5em \left(r\ge 0\right). $$
(27)

Weighted mean of fr, fr + 1, and fr + 2 that are calculated by three successive windows is adopted as a substitute of fr, which can provide a more smooth value for evaluation [25].

Five more complicated scenarios are considered to demonstrate the performance of the algorithms in the following text.

Scenario 1: Frequency changes randomly in every cycle.

The signal with frequency change randomly in each cycle is represented as

$$ {\displaystyle \begin{array}{l}x(t)=A\cos \left[2\pi \left({f}_0+\Delta {f}_l\right)t+{\varphi}_0\right]\kern0.5em +{N}_{noise}\kern0.5em \\ {}\kern6em \left(l=1,2,\dots, L;0\le t\le LT\right),\end{array}} $$
(28)

where Δfl = {Δf1, Δf2, …, ΔfL} and the integral Δfl ∈ [−5, 5]Hz are generated stochastically.

Sudden change of frequency introduces harmonics. Signals of this scenario contain additive white Gaussian noise (AWGN) Nnoise which can influence convergence of DFT iteration, especially in the situation of low SNR. Results of frequency tracking cycle-by-cycle by three algorithms are listed in Table 2, in which the smallest MSE is gotten by TLI-DFT aided by AES. Mean squared error (MSE) of frequencies versus SNR and the number of iterations are shown in Fig. 9.

Table 2 Comparison of three algorithms (iterative process stops at third iteration)
Fig. 9
figure 9

Performance comparison of three algorithms in scenario 1 (in the first algorithm (red)), initial frequency estimation of DFT iteration is aided by AES, in which P = Q = 7. In the second algorithm (green), initial frequency for DFT iteration is set to be 60 Hz in every cycle. The third one is from paper [31])

Because Δfl is generated stochastically in every cycle, frequencies of different cycles are irrelevant. Iterative DFT algorithm was utilized according to Fig. 3.

Comparing with algorithm of DFT iteration (red curve) in 1 cycle, algorithm of “DFT aided by AES (Green curve)” would not do much help as shown in Fig. 9. It is due to the fact that frequency step happens at the beginning of every cycle randomly, and the frequency calculated in previous cycle would not help to give a more precise initial frequency for the following cycle. In the algorithm of [31], the sampling frequency at each iteration is re-calculated till the value of tan(φm/2) approaching the nominal and fixed value tan(φ0/2) [31].

In each cycle of iteration, three measured frequencies are calculated by shifting windows, and then they are weighted and averaged by Eq. 27. Performance of DFT iteration is better than the traditional one. In Figs. 9a and 10a, MSE decreases with the increasing of SNR. In Figs. 9b and 10b, the gain is 5.6~6 dB better than algorithm of [31] .

Fig. 10
figure 10

Performance comparison of three algorithms in scenario 2 (a = 0.04, fm = 2 Hz)

Scenario 2: Amplitude modulated by a cosine signal.

The signal with amplitude modulated by a cosine signal is represented as

$$ x(t)=A\left[1+a\cdot \cos \left(2\pi {f}_mt\right)\right]\cos \left(2\pi {f}_0t+{\varphi}_0\right)+{N}_{\mathrm{noise}}\left(0\le t\le LT\right), $$
(29)

where a and fm are the modulating factor and the modulation frequency. Performances of three algorithms are compared and shown in Fig. 10, from which we find performance of algorithm TLI-DFT aided by AES is better than other two if the SNR is less than 20 dB. And two or three times of iteration can give a satisfying result as shown in Fig. 10b.

In Fig. 11, MSE increases with the increasing of fm and a. Using trigonometric function, Eq. 29 is rewritten to be

$$ {\displaystyle \begin{array}{l}x(t)=A\cos \left(2\pi {f}_0t+{\varphi}_0\right)+{N}_{\mathrm{noise}}+\frac{Aa}{2}\cos \left[2\pi \left({f}_0+{f}_m\right)t+{\varphi}_0\right]\\ {}\kern2em +\frac{Aa}{2}\cos \left[2\pi \left({f}_0-{f}_m\right)t+{\varphi}_0\right]\kern0.5em \left(0\le t\le LT\right).\end{array}} $$
(30)
Fig. 11
figure 11

Performance of TLI-DFT with or without AES algorithms in scenario 2 (iterative process stops at third iteration, a = 0.04, fm = 2 Hz)

The amplitude modulation can be look on as adding inter-harmonics into a nominal signal from Eq. (30).

Because the modulation frequency fm is generally much smaller than the nominal frequency, the inter-harmonics are quite close to the nominal one in spectrum. It is hard to be eliminated by low-pass filters (LPF) or smoothed by windows. Influence of inter-harmonics on TVE is shown in Fig. 12 with different fm and a.

Fig. 12
figure 12

Amplitude and TVE of phasor in amplitude modulation with different modulating factor and modulation frequency (A = 1 p.u., f0 = 60 Hz, φ0 = 0)

Scenario 3: Phase modulated by a cosine signal.

The signal with phase modulated by a cosine signal is represented by

$$ {\displaystyle \begin{array}{l}x(t)=A\cos \left(2\pi {f}_0t+a\cdot \cos \left(2\pi {f}_mt\right)+{\varphi}_0\right)+{N}_{\mathrm{noise}}\\ {}\kern1.94em =A\cos \left(2\pi {f}_0t+{\varphi}_m+{\varphi}_0\right)+{N}_{\mathrm{noise}},\end{array}} $$
(31)

where a is modulation factor and fm is modulation frequency. Adopting second-order Taylor expansion and trigonometric function, we have

$$ {\displaystyle \begin{array}{l}x(t)=A\cos \left(2\pi {f}_0t+a\cos \left(2\pi {f}_mt\right)+{\varphi}_0\right)\\ {}\kern1.5em \overset{\mathrm{Taylor}}{=}A\cos \left(2\pi {f}_0t+{\varphi}_0\right)-A2\pi {f}_0\sin \left(2\pi {f}_0t+{\varphi}_0\right)\cdot a\cos \left(2\pi {f}_mt\right)\\ {}\kern3.5em -A{\left(2\pi {f}_0\right)}^2\frac{\cos \left(2\pi {f}_0t+{\varphi}_0\right)}{2!}\cdot {\left[a\cdot \cos \left(2\pi {f}_mt\right)\right]}^2+\dots \\ {}\kern2em \approx A\cos \left(2\pi {f}_0t+{\varphi}_0\right)-\frac{A2\pi {f}_0a}{2}\sin \left[2\pi \left({f}_0+{f}_m\right)t+{\varphi}_0\right]\\ {}\kern3.5em -\frac{A2\pi {f}_0a}{2}\sin \left[2\pi \left({f}_0-{f}_m\right)t+{\varphi}_0\right],\end{array}} $$
(32)

where phase modulation factor a < < 1. The phase modulation is the same as amplitude modulation in Eq. 30. And if the amplitude and phase modulations occur simultaneously, the signal x(t) contains the sum and difference frequencies of sine and cosine components, which is called inter-modulation. TVE of phasor in phase modulation with different modulation frequency is shown in Fig. 13.

Fig. 13
figure 13

TVE of phasor in phase modulation with different modulating factor and modulation frequency (A = 1 p.u., f0 = 60 Hz, φ0 = 0)

Scenario 4: Frequency modulated by a cosine signal.

A signal whose frequency is modulated by cosine signal with the modulation factor a and the modulation frequency fm is represented as

$$ {\displaystyle \begin{array}{l}x(t)=A\cos \left(2\pi \left({f}_0+a\cdot \cos \left(2\pi {f}_mt\right)\right)t+{\varphi}_0\right)+{N}_{\mathrm{noise}}\\ {}\kern2.22em =A\cos \left(2\pi {f}_0t+a2\pi \cos \left(2\pi {f}_mt\right)t+{\varphi}_0\right)+{N}_{\mathrm{noise}}\\ {}\kern2.22em =A\cos \left(2\pi {f}_0t+{\varphi}_m^{\hbox{'}}+{\varphi}_0\right)+{N}_{\mathrm{noise}},\end{array}} $$
(33)

whose representation is the same as the representation of Eq. 31, except \( {\varphi}_m^{\hbox{'}}=a2\pi \cos \left(2\pi {f}_mt\right)t \). And the \( {\varphi}_m^{\hbox{'}} \)will become bigger and bigger with the passing of time t. Fortunately, three kinds of modulation in scenario 2~4 are all of short-time characteristic, which lasts only several cycles in transient states of a power system. So the representations of three modulation models are all similar in transient conditions.

Scenario 5: Decaying direct current offset components.

In an electrical power system, when a fault or a disturbance occurs, the current signal consists of exponentially decaying direct current (DC) offsets. The decaying rate of a DC offset depends on the time-constant determined by the inductive reactance to resistance ratio (X/R ratio) of the system. The large the X/R ratio is, the slower the DC component decays. Signal containing both the nominal component and decaying DC offsets is

$$ x(t)=A\cos \left(2\pi {f}_0t+{\varphi}_0\right)-\sum \limits_{i=1}^{N_{DC}}{I}_i{e}^{-t/{\tau}_i}+{N}_{\mathrm{noise}}\left(0\le t\le {T}_{DC}\right), $$
(34)

where NDC is the number of DC offset components, Ii and τi are the amplitude and time constant of the ith DC offset component. TDC is the operation time of decaying DC offsets. DC offset is a non-periodic signal whose frequency encompasses the whole spectrum, and it cannot be removed by simple anti-aliasing LPF.

A digital mimic filter was proposed to suppress the effect of decaying DC offsets over a broad range of time constants [32, 33]. But this filter needs exact values of the time constants for eliminating DC offsets, which is usually impractical in power system. Kalman filter also needs the exact time constants to obtain a good performance of filtering [5,6,7, 34]. DFT-based techniques are generally used for removal decaying DC offset from phasor estimation [35,36,37,38,39,40]. On the other hand, the decaying DC component affects the accuracy of the DFT algorithm greatly [41,42,43]. Different windows have been suggested and half-cycle DFT was used to get the phasor [10, 43,44,45] in the case of decaying DC offsets. Full-cycle DFT is a widely adopted [33, 36, 46]. Suppose there are two decaying DC offset components (i.e., NDC = 2). Their parameters are listed in Table 3. Their wave-forms are shown in Figs. 14 and 15. Speed of decaying of DC offset 1 is faster than that of DC offset 2. But the absolute value of amplitude of DC offset 2 is smaller.

Table 3 Parameters of decaying DC offset components
Fig. 14
figure 14

Waveform described in scenario 5

Fig. 15
figure 15

Amplitude of decaying DC offsets

In Figs. 9, 10, and 16, SNR = 20 dB is about the point of inflection, although curves of MSE are not as smooth as desirable owing to the limitation of number of estimated frequencies (i.e., TDC = 10 cycle). MSE of our proposed algorithms would not obtain much more gain when number of iterations is more than 3 or 4 as shown in Fig. 16b.

Fig. 16
figure 16

Performance of three algorithms with decaying DC offsets (considering the time constants of two decaying DC offsets. TDC = 10 cycle)

Frequency tracking and ROCOF by TLI-DFT are plotted in Fig. 17. Performance of algorithm TLI-DFT aided by AES is almost the same as that of TLI-DFT, because AES is used only once in the initial frequency estimation of inner-layered iteration in the first cycle.

Fig. 17
figure 17

Frequency tracking and ROCOF by TLI-DFT with decaying DC offsets

5 Additional discussions

Chaari et al. proposed a new tool of wavelets for the resonant-grounded power distribution systems [47,48,49]. An earth-phase fault was simulated, and then a wavelet transform (WT) is applied on two kinds of fault currents in the transient signals. The meaningful information is contained in fault signals and was obtained by this recursive wavelet transformation.

They also used wavelets-associated artificial neural networks to classified fault currents. They chose “mother wavelet” by fast decaying oscillation function in a simulated 20 kV resonant grounded relaying networks.

According to WT theory, Zhang et al. constructed a mother wavelet that is suitable for processing transient signals in a power system [50]. WT was carried out to detect transform inrush current. This recursive WT consist of two parts: backward transform based on historical data and forward transform, the latter one is calculated with future data and is based on the detection of the singularity of the power signals.

WT is more suitable in detecting disturbances than DFT/FFT when the time varies. With the time-frequency localization characteristics embedded in wavelets, the information of frequency and time combined might be presented as a visualized scheme [51]. Morlet wavelets was adopted and tested of various simulated disturbances, e.g., harmonics analysis, momentary interruption and oscillatory, voltage swell, and sag. It is feasible and practical to use WT in supervising disturbances in a power system [52]; however, more suitable WT approaches should be found and evaluated.

Trapezoid WT was supposed to be better than other WT methods, such as Mexico hat wavelet, Haar wavelet, and Morlet wavelet, in localizability and symmetry, and it had a more even frequency characteristics [53]. Trapezoid WT required less time-window data to detect characteristics in the fault signal and was better continuous than Shannon wavelet function in frequency tracking.

Lin et al. proposed a two-stepped approach to filter the high order harmonics by a bi-orthogonal WT and then extract the oscillation feature from the remnant signal by a complex WT. And in order to be implemented for real-time applications, they used a Mallat algorithm and the recursive version for torsional oscillation [54]. And furthermore, an improved boundary protection scheme based on a complex WT (which was used as a band-pass filter to contain enough higher frequencies) and spectrum energy evaluation was put forward to distinguish internal faults from different kinds of external ones with higher reliability [55]. Their scheme provides an option to implement boundary protection and transient-based protection.

Within three samples of an input signal, a recursive WT was capable of estimating the frequency known as fast response. It also could achieve accurate estimation over a wide range of frequency changes [56,57,58]. To meet the needs of high accuracy and low amount of calculation, people could select the signal sampling rate and data window length arbitrarily. In their conclusions, selecting sampling frequency of 18 kHz, a phasor could be computed within 0.5 cycle of input signal and the error was less than 1% TVE. How to select the two parameters of sampling rate and window length is the key issue.

6 Conclusions

A new approach of two-layered iterative DFT is proposed to track the input frequency in dynamic states. Inner-layered DFT iteration is adopted in every cycle, and frequency estimated in the previous cycle is used as the initial frequency in the following one. And a simple and fast method, exponential sampling is amended to adapt to the non-steady states. This algorithm is more accurate than the traditional one. New algorithms are compared with the old one with different situations, e.g., input frequencies changing randomly, signal modulated by a cosine signal, and in the presence of decaying DC offsets. New algorithms are tested with different simulation parameters, such as different SNR and maximal numbers of iteration predefined to stop the iteration process.

Simulation results show that SNR of 20 dB is about the point of inflection. Low SNR would influence the performance of proposed algorithm. Fortunately, many researches show that wide-band AWGN is not a serious problem is power system, which is always more than 40 dB. And maximal numbers of iteration is better to be three or four. More iteration would not do much help to increase the accuracy of frequency estimation.

In practical, variable sampling algorithms are highly connected with phase locked loop (PLL) of the frequency generator and the digital signal processor. Multiple-rated structure of adaptive PLL and time-varying PLL-based sampling methods is the main work for implementation of the proposed TLI-DFT algorithm.

In the following study, Hamming window, Hanning window, Blackman window, and other kinks of windows should be compared with rectangle window used in this study.