A Two-Stage Algorithm to Estimate the Fundamental Frequency of Asynchronously Sampled Signals in Power Systems

A two-stage algorithm is proposed for the estimation of the fundamental frequency of asynchronously sampled signals in power systems. In the first stage, time-domain interpolation reconstructs the power system signal at a new sampling time and the reconstructed signal passes through a tuned sine filter to eliminate harmonics. In the second stage, the fundamental frequency is estimated using a modified curve fitting, which is robust to noise. The evaluation results confirm the efficiency and validity of the two-stage algorithm for accurate estimation of the fundamental frequency even for asynchronously sampled signals contaminated with noise, harmonics, and an inter-harmonic component.


Introduction
Sampling-based power measurements are typically carried out using a clock signal that is synchronized with the signal from the power system under analysis.However, often there may be no means of synchronizing the clock signal to the power system signal, and power measurements are instead based on asynchronous sampling of power system signals.These circumstances include OPEN ACCESS industrial measurements and high-precision calibrations in metrology laboratories.Under such circumstances, accurate estimation of the fundamental frequency of power system signals is essential to minimize the errors caused by asynchronous sampling.
Numerous studies have estimated the fundamental frequency of asynchronously sampled signals, and several interesting results have been published in recent decades.Spectral techniques [1][2][3][4][5] are among the most popular approaches because of their low computational burden and feasibility for real-time applications.When asynchronously sampled data are processed using a discrete Fourier transform (DFT) to extract frequency information, the spectral leakage error is appended to the calculated result.Spectral techniques compensate for this leakage error to estimate the fundamental frequency.Orthogonal techniques [6][7][8][9][10][11][12][13][14] are another of the most popular approaches for real-time applications.In this approach, filters generate orthogonal signals and complex vectors, which are used to estimate the fundamental frequency.However, the calculation accuracy of spectral and orthogonal techniques is limited, and does not satisfy the precision required for certain applications.
In contrast, time-domain techniques, such as curve fitting [15][16][17][18][19] and parametric interpolations [20][21][22][23], are capable of highly accurate frequency estimation, at the cost of a higher computational burden.Curve fitting algorithms are commonly used in time-domain techniques because of their robustness to noise.In particular, the four-parameter sine fit (4PSF) algorithm [16] performs close to the Cramer Rao lower bound (CRLB), which is the theoretical limit of variance for an unbiased estimator, for almost all noise levels [24,25].The 4PSF algorithm is more suited to less distorted steady-state waveforms, since its performance significantly degrades as total harmonic distortion (THD) increases.Parametric interpolations, such as cubic spline interpolations [20,21] and Newton interpolations [22,23], offer an alternative time-domain approach and are used to modify the sampling rate of an analog-to-digital conversion in software.In particular, the time-domain interpolation and scanning (TDIS) algorithm [20] reconstructs a waveform by cubic spline interpolation to find a new sampling rate that is an integer multiple of the fundamental frequency using a scanning procedure.The phase drift in the reconstructed waveform is used to estimate the fundamental frequency and iteratively correct the waveform.The TDIS algorithm gives greater frequency errors in the presence of inter-harmonics.In the opposite sense to the TDIS algorithm, which modifies the sampled signal to synchronize with the estimated frequency, the phase sensitive frequency estimation with interpolated phase (PSFEi) algorithm [26,27] modifies the frequency of the sine waves used in curve fitting to synchronize with the sampled data.The PSFEi algorithm calculates the phase increase of the fundamental component between two groups within the sampled data using the three-parameter sine fit (3PSF) algorithm [28] and then updates the fundamental frequency to be consistent with the phase increase.To minimize the effect of harmonic components, the phase increase in the final iteration is interpolated to an exact integer number of fundamental cycles.The PSFEi gives greater frequency errors in the presence of fluctuating harmonics.
In this paper, a two-stage algorithm is proposed for accurate estimation of the fundamental frequency of asynchronously sampled signals regardless of noise and harmonics.The remainder of the paper is organized as follows: frequency estimation using the two-stage algorithm is formulated in Section 2, and the performance of the algorithm is evaluated in Section 3 using both computer simulations and a hardware implementation.Conclusions are presented in Section 4.

Two-Stage Algorithm for Estimating a Fundamental Frequency
Assuming that a power system signal has a purely sinusoidal waveform with a fundamental frequency ωf (rad/s), amplitude Af (V or A), and phase θf (rad), the N M -point data uniformly sampled with a sampling time Δt can be described in discrete time steps as follows: where ω 0 (rad/s) is a nominal frequency and N 0 is the number of samples per cycle at ω 0 .

Tuned Sine Filtering Followed by Time-Domain Interpolation
Harmonics within a power system signal make accurate estimation of the fundamental frequency difficult.To eliminate these harmonics from the power system signal, a sine filter is usually used and its reference frequency is typically set to the nominal frequency [11].When the fundamental frequency is equal to the reference frequency, the sine filter can eliminate harmonics from the power system signal perfectly.However, when the fundamental frequency deviates from the reference frequency, harmonics may not be eliminated effectively.To overcome this drawback, this paper proposes a tuned sine filter that adjusts its reference frequency to synchronize with an estimate of the fundamental frequency.The filter length should be matched to the number of samples per cycle at the reference frequency to keep its ability to eliminate harmonics.To meet this constraint, time-domain interpolation is used to reconstruct the power system signal at a new sampling time corresponding to the reference frequency, prior to applying the tuned sine filter.
Assuming that ( 1) ω i f  is an estimate of the fundamental frequency at the previous iteration (i -1), which will be used as the reference frequency for the tuned sine filter, the new sampling time ( ) ˆi t  is given as: To reconstruct the power system signal at the new sampling time, application of cubic spline interpolation to Equation (1) yields: where ( )  ˆi M N is the number of samples in the reconstructed signal and is given as . The algorithm used to compute the splines and interpolation is taken from [29].Using the estimate of the fundamental frequency as the reference frequency for the tuned sine filter, the coefficients of the filter are given by: ( 1) It is noted that the coefficients of the filter are independent of the estimate of the fundamental frequency since this has already been considered in the calculation of the new sampling time, given in Equation (2).Applying Equation ( 4) to ( )  ˆ( ) i y n in Equation ( 3) yields a sine-filtered signal: where are the amplitude and phase response of the tuned sine filter at ωf, respectively.Some minor calculations yield: where:

Modified Curve Fitting with an Unknown Frequency
The 3PSF algorithm performs a least-squares curve fitting on the sampled data to find the DC component, and the amplitude and phase of the component at a known frequency [28].In the 4PSF algorithm, the frequency itself is treated as an unknown parameter to be found.Although the 4PSF algorithm is more computationally complex, this algorithm is recommended for sampled data containing five or more cycles of the power system signal [16,30], because the 4PSF algorithm usually determines the frequency to greater accuracy even if it is accurately known a priori.Since the tuned sine filter, which is used prior to applying the modified curve fitting, can eliminate the DC component, it can be assumed that there is no DC component in the sine-filtered signal given in Equation (6).Therefore, the number of modeling parameters in the 4PSF algorithm can be reduced from four to three: the fundamental frequency, amplitude, and phase.Assuming that ( ) ˆi f C , ( )  ˆi f S , and ( ) ω i f are estimates of Cf, Sf, and ωf in Equation ( 6) respectively, the sine-filtered signal of Equation ( 6) can be expressed as: To find an iterative form of Equation ( 7), a Taylor series expansion of the cosine function in Equation ( 7) is taken around the previous frequency estimate ( 1) ) Similarly, a Taylor series expansion of the sine function in Equation ( 7) is taken around Substitution of Equations ( 8) and ( 9) into Equation ( 7) yields: ( 1) The successive samples in Equation ( 10) can be written in matrix form: where:

Frequency Estimation Procedure
Figure 1 shows the block diagram for the frequency estimation procedure using the two-stage algorithm.Initial estimates for (0)  ˆf C , (0) ˆf S , and ωf are obtained using 3pDFT [31], a simple and efficient algorithm for estimating the fundamental frequency.At the first iteration, a new sampling time (1)  t  is calculated corresponding to (0) ωf and cubic spline interpolation is applied to reconstruct the power system signal at the new sampling time.The reconstructed signal passes through the tuned sine filter to eliminate harmonics.Prior to performing the modified curve fitting on the sine-filtered signal, the coefficients of (1)  Â are calculated based on (0) ˆf C , (0) ˆf S , and (0) t  .After finding the pseudo inverse of (1)  Â as given in Equation ( 12), the modified curve fitting determines the modeling parameters ( (1)  ˆf C , (1)  ˆf S , and ωf  ) and the frequency estimate (1) ωf is updated using (1) ωf  .The th i iteration is the same as the first iteration, but uses the most recent estimates ( 1)  ˆi f C  , ( 1)  ˆi f S  , and ωf .Since curve fitting algorithms with an unknown frequency double the number of significant digits in the frequency estimate at each iteration and converge very rapidly, six iterations have been considered more than adequate [30].In this paper, six iterations are repeated to produce an accurate frequency estimate.

Figure 1.
Frequency estimation procedure for the two-stage algorithm.

Performance Evaluation
To evaluate the performance of the two-stage algorithm, results were compared with those obtained using the TDIS, 4PSF, and PSFEi algorithms.All four algorithms were tested using two approaches: computer simulations and a hardware implementation.

Number of Cycles in the Data Window
While the sampling time and length of the data window were fixed (i.e., 30 t us   and 8192 the number of cycles in the data window was varied by varying the fundamental frequency of the test waveform, which consisted of a single-tone sine wave and a 60 dB white noise signal.In the simulations, the number of cycles in the data window was varied between 3 and 20, which corresponds to the fundamental frequencies between 12.207 Hz and 81.380 Hz.The root-mean-square (RMS) error of frequency estimation after 1000 repetitions at each number of cycles is shown in Figure 2, together with the CRLB.The 4PSF and PSFEi algorithms perform close to the CRLB for all numbers of cycles; the TDIS algorithm performs well, but is marginally worse than the 4PSF and PSFEi algorithms for six cycles or more within the data window.It was also found that the two-stage algorithm needs at least eight cycles in the data window to perform close to the CRLB.

ˆˆ, ,
RMS error of frequency estimation with an increasing number of cycles in the data window.

Noise Level
Simulations with noise were performed using a single-tone sine waveform with a random phase and fundamental frequency of 61.2 Hz.The signal-to-noise ratio (SNR) varied from 0 dB to 100 dB with a noise increase of 10 dB.The RMS error of frequency estimation after 1000 repetitions at each SNR level is shown in Figure 3.As with previous tests, the 4PSF and PSFEi algorithms perform close to the CRLB for all noise levels, and the two-stage algorithm also performs close to the CRLB.The TDIS algorithm performs 1.2-fold worse than the others.

Harmonics
The simulated test waveforms have the following form: Tests were run with fundamental frequencies varying within 60 ± 5 Hz, with a random phase θ h for each harmonic.The other parameters in Equation ( 14) were set as follows: ( ) 60 dB e n  , 10 H  , 1 ( ) 1 A n , ,even ( ) 0.01 , where S was an integer multiplier from 0 to 4 used to increase the amplitudes of the even and odd harmonics.The maximum error of frequency estimation after 1000 repetitions at each level of THD is given in Figure 4.The performance of the 4PSF algorithm significantly degrades as the multiplier S and, therefore, the THD increases.The PSFEi, TDIS, and two-stage algorithms perform with greater accuracy regardless of THD level, with the two-stage algorithm exhibiting slightly improved performance over the PSFEi and TDIS algorithms.

Fluctuating Harmonic Component
The simulated test waveforms with a fluctuating harmonic component of order k have the following form: where ωk is the frequency of fluctuation, which was set to vary randomly within 7 ± 2 Hz; Ak is the amplitude of the fluctuating harmonic component, which was set to 0.5; and Bk is the depth of fluctuation, which was set to 0.1.The other parameters were identical to those used in Section 3.1.3,except that here the integer multiplier S was set to 1.The order of the fluctuating harmonic component was varied from 2 to 10, and the maximum error of frequency estimation after 1000 repetitions for each fluctuating harmonic order is given in Figure 5; comparison between Figures 4 and 5 shows that the maximum errors for most of the algorithms are significantly worse when one of the harmonics fluctuates.Performance slightly improves as the fluctuating harmonic order increases.This is most likely because spectral leakage from a fluctuating harmonic closer to the fundamental frequency has a greater effect on the estimate.To evaluate the effect of modulation depth, the order of the fluctuating harmonic was set to 3 and B k was varied from 0 to 1.0 in 0.1 increments.The maximum error of frequency estimation after 1000 repetitions for each modulation depth is shown in Figure 6.Similar to the effect seen when changing the fluctuating harmonic order, an increase in spectral leakage due to greater modulation depth has an adverse effect on the performance of the PSFEi, TDIS and two-stage algorithms.The 4PSF algorithm is more influenced by THD level and a fluctuating harmonic component does not have a significant effect on its performance.
where ω x is the frequency of fluctuation, which was set to vary randomly within 7 ± 2 Hz; and x B is the depth of fluctuation, which was set to 0.1.Other parameters were identical to those used in Section 3.1.3,except that the integer multiplier S was set to 1.The inter-harmonic amplitude Ax was varied from 0 to 0.7 in 0.1 increments.The maximum error of frequency estimation after 1000 repetitions for each of the inter-harmonic amplitude is given in Figure 7.At each repetition, index x was randomly varied from 1.5 to 10.The contamination of the fundamental component caused by the inter-harmonic component leads to increasing estimation errors for the TDIS, PSFEi, and two-stage algorithms with increasing inter-harmonic amplitude.Again, a fluctuating inter-harmonic component does not have a significant effect on the performance of the 4PSF algorithm.3.1.6.Computational Burden Table 1 lists the average time taken to complete a frequency estimate in the simulations for each of the algorithms.The algorithms were implemented in MATLAB, and all simulations were run on a personal computer with an Intel Core i7 processor running at 4.0 GHz.The TDIS and two-stage algorithms required significantly more time than the 4PSF and PSFEi algorithms, which is due to the time-domain interpolation.

Hardware Implementation
Tests using real waveforms with known characteristics are a useful indicator of the performance of the algorithms under real conditions.A system for efficient implementation and comparison of the algorithms was developed at Korea Testing Laboratory (KTL), a representative accreditation authority in South Korea for the testing and calibration of measurement equipment.As shown in Figure 8, an electrical power quality calibrator (Fluke 6105A) generates calibration voltage and current signals, which were sampled using the data acquisition system developed for the KTL power measurement calibration service.In the data acquisition system, a current shunt (Fluke A40B) converts the calibration current signal to a shunt voltage signal.Two digitizing multi-meters (Agilent 3458A) encode the calibration voltage signal and the shunt voltage signal into digital outputs at a 16-bit resolution.During the encoding process, a waveform generator (Agilent 33500B) produces an EXT TRIG signal to synchronize the operation of the two multi-meters.Integrated software on a host computer controls the two multi-meters through a GPIB and gathers the sampled data, which are used for power measurement calibration.All four algorithms are implemented as sub-programs to estimate the fundamental frequency of the calibration voltage signal, sampled at 8.192 kS/s for 8192-point data.Table 2 summarizes the maximum errors of frequency estimation when tests were run at a fundamental frequency of 60 Hz.Two calibration voltage levels (110 V and 220 V) were used in the tests and all algorithms demonstrated similar performance regardless of the calibration voltage level and harmonic.In particular, the maximum errors of the two-stage algorithm are maintained stably between

Conclusions
A two-stage algorithm is proposed for estimation of the fundamental frequency of asynchronously sampled signals in power systems.In the first stage, time-domain interpolation reconstructs the power system signal at a new sampling time and the reconstructed signal passes through a tuned sine filter.The tuned sine filter retains its ability to eliminate harmonics by adjusting its reference frequency to synchronize with an estimate of the fundamental frequency.Prior to applying the tuned sine filter, time-domain interpolation renders it possible to match the filter length of the tuned sine filter to the number of samples per cycle in the reconstructed signal.In the second stage, the fundamental frequency is estimated using a modified curve fitting, which is robust to noise.Since the tuned sine filter eliminates the DC component in addition to harmonics, the DC component is removed from the modeling parameters of the modified curve fitting.
The performance of the two-stage algorithm was evaluated using computer-simulated signals, which were asynchronously sampled and contaminated with noise, harmonics, and an inter-harmonic component.The comparison showed that the two-stage algorithm required approximately eight cycles within the data window to provide a level of performance similar to CRLB, and enabled estimation of the fundamental frequency accurately under a range of conditions.In particular, the two-stage algorithm could estimate the fundamental frequency with greater accuracy than the other algorithms in the presence of high levels of THD, a fluctuating harmonic component and a fluctuating inter-harmonic component.The two-stage algorithm was then implemented on a KTL data acquisition system with 16-bit resolution.The results of this implementation demonstrate both the efficiency and validity of the two-stage algorithm, and show that it can achieve accurate estimations of the fundamental frequency in practical conditions.Therefore, the two-stage algorithm may be considered useful for high-precision applications, such as calibrations in metrology laboratories.

Figure 3 .
Figure 3. Root-mean-square (RMS) error of frequency estimation with increasing noise level.

Figure 4 .
Figure 4. Maximum error of frequency estimation with increasing THD.

Figure 5 .
Figure 5. Maximum error of frequency estimation with increasing order of the fluctuating harmonic.

Figure 6 .
Figure 6.Maximum error of frequency estimation with increasing modulation depth of the third harmonic. 0

Figure 7 .
Figure 7. Maximum error of frequency estimation with increasing inter-harmonic amplitude.

Figure 8 .
Figure 8. Hardware implementation for tests using real waveforms.

Table 1 .
Average time required for one frequency estimation (ms).