An Optimization of Least-Square Harmonic Phasor Estimators in Presence of Multi-Interference and Harmonic Frequency Variance

: The wide application of power electronic devices brings an increasing amount of undesired harmonic and interharmonic tones, and accurate harmonic phasor estimation under a complex signal input is an important task for smart grid applications. In this paper, an optimization of least-square dynamic harmonic phasor estimators, considering multi-interference and harmonic frequency variance, is proposed. A comprehensive error index (CEI) composed of the fundamental-leakage-led harmonic amplitude estimation error, harmonic mutual interference, out-of-band interference, and harmonic frequency deviation is employed. The largest CEI part of least-square algorithms using three different signal decomposition models is analyzed for the ﬁrst time, and variables to reduce this error component are then introduced using singular value decomposition. With the CEI and deﬁned variables, a minimum-error estimation of harmonic phasors under various interference and harmonic frequency change is discussed. Numerical tests are performed, and the test results show that after the proposed optimization is applied to least-square algorithms, the harmonic phasor estimation errors are considerably reduced, especially for low-order harmonics. We also show the possibility of choosing desired optimal phasor ﬁlter design by balancing the measurement accuracy and data latency. For example, when the window length is set to three nominal cycles, the proposed optimization can yield both good accuracy and fast measurement speed for estimating harmonic phasors under multi-interference and harmonic frequency variance.


Introduction
The development of low-carbon power systems and smart grids greatly promotes the application of power electronic equipment [1,2].Although the power electronic device improves the efficiency and flexibility of power utilization, it also brings an increasing amount of undesired harmonic and interharmonic tones [1].For example, considerable harmonic and interharmonic components have been observed in the current of DC arc furnaces [3].These undesired components distort the signal waveform, deteriorate power quality, cause oscillations, and even lead to power system failures [4][5][6].Measuring harmonic components is the first and critical step to locating harmonic sources, and then yields the possibility of suppressing harmonic components by using active filters [7].Additionally, the accurate harmonic phasor estimation is of great importance for some advanced applications, e.g., identification of a distribution topology [8], high impedance fault location [9], Energies 2023, 16, 3397 2 of 23 and arcing fault detection [10], etc.However, the increasingly complex signal environment hinders the accurate estimation of harmonic phasors.
The signal complexity and measurement algorithm are two core elements ruling the performance of a harmonic phasor estimator.The standards for synchrophasor estimation, e.g., IEC/IEEE 60255-118-1 [11], summarize a variety of complex signals into several typical characteristics, such as amplitude deviation, harmonic interference, out-of-band interference (OBI), amplitude modulation, phase modulation, as well as frequency deviation or linear change.Similar conditions apply for harmonic measurements, and usually two major targets, i.e., the accuracy and response speed, are most concerned in phasor estimation.The accuracy relies on the suppression of various interference and how well the harmonic frequency change is tracked.The speed concern expects as short time window length as possible to get the estimation, which is, however, likely to be detrimental to the estimation accuracy [12].
Classical synchrophasor estimators based on DFT employ window function or interpolation to help improve the performance, and the approaches work well under dynamic conditions.However, they are less effective for the harmonic phasor estimation [13,14], because they can not provide enough compensation in the wider frequency deviation range.To improve the estimation accuracy for harmonic phasors, researchers have developed several frequency-domain algorithms.For example, the IEC 61000-4-7 recommended a grouping harmonic method based on DFT and Parseval's theorem to calculate the harmonic amplitude [15], but it is unable to calculate the harmonic phase.Reddy et al. employed compressive sensing to estimate dynamic harmonic phasor, yielding a high frequency resolution at the expanse of a heavier computation burden [16].
Time-domain methods have also been developed to improve the dynamic performance of harmonic phasor estimations.The Taylor signal model was adopted using least-square or Kalman to lower the passband ripple, e.g., Taylor-Fourier transform (TFT) [17], discretetime TFT filter banks designed with O-Splines [18], and Taylor-Kalman filter [19].Choosing an appropriate window function also reduces the passband ripple, and increases the attenuation at mutual harmonic interference frequencies [20].The passband ripple and, hence, the estimation error of these dynamic algorithms, however, increase with the harmonic order [21].To address this issue, research works have explored harmonic filters with passbands that increase with the harmonic order, and, in this case, the passband ripple stops growing with the harmonic order.For example, sinc interpolation function [21], and frequency-domain sampling theorem [22] have been proposed to replace the Taylor series function to reach the above targets.However, these least-square algorithms suffer from large transition band gain [23], and, hence, are sensitive to the possible OBI tones, e.g., a communication signal at 178 Hz around the third harmonic [15], some interharmonics at 330 Hz, 380 Hz, and 530 Hz, respectively, around the sixth, seventh, and tenth harmonics in an electric power system [24].Increasing the window length can mitigate the negative effect from OBI, but it may not meet the fast response requirement when measuring strong dynamic signal in active distribution networks [25].In [26], we proposed to enable the TFT algorithm with improved suppression of OBI tones without increasing window length.However, the proposal is less practical because it does not consider the harmonic frequency deviation and dynamic change.
For the suppression of interference, especially the OBI, harmonic phasor filters with notches at the interference frequencies are required.A key step in such an approach is to detect the component number and frequency from signal samples, which in practice can be realized by employing, e.g., the IpDFT [27], Prony [4], matrix pencil [28], or ESPRIT [1] methods.The least-square is finally applied to estimate the harmonic phasors, and usually satisfying performance, even under dynamic and OBI conditions, can be achieved.The drawback of the notch filter algorithms is that they produce a heavy real-time computation burden, and the estimation error can increase considerably when the signal component number and frequency are not well identified.
The above research works tend to focus on harmonic signals with a variant frequency or OBI tone.For example, the least-square algorithms have good dynamic performance but weak suppression of interharmonics while the SVDHPE is the opposite [26].Therefore in this paper, we aim to keep the good dynamic performance of least-square algorithms, and enable them with good suppression of OBI, fundamental leakage, and harmonic mutual interference under a short time window, e.g., three nominal cycles.First, in Section 2, the comprehensive error index (CEI) is employed to indicate the harmonic amplitude estimation error caused by the multi-interference and harmonic frequency deviation.The largest source contributing to the CEI for harmonic phasor filters using three different least-square algorithms is analyzed.Then in Section 3, new variables are introduced to the least-square equations by singular value decomposition (SVD), and a minimum error optimization is delivered based on the CEI and the defined variables.Next, in Section 4, the proposed minimum error estimation of harmonic phasors under various interference and harmonic frequency change is tested using numerical tests.Finally, the applicability of the proposed optimization is analyzed in Section 5, and the conclusion is drawn in Section 6.
To summarize, the novelty and contributions of this paper mainly include: (1) The interharmonic is found as the largest error source for the harmonic phasor estimation with least-square algorithms, and hence some variables to suppress interharmonic interference and reduce CEI are introduced; (2) An optimization to minimize the CEI by changing the introduced variables is proposed.The optimal design, compared to other approaches, takes both the different interference suppressions and the dynamic accuracy as optimization targets; (3) We conduct a detailed theoretical analysis and design a set of typical scenarios to fully evaluate the proposed algorithm in terms of accuracy, response performance, and computational burden.

The Comprehensive Error Index, CEI
In this section, we employ the comprehensive error-index to indicate the performance of harmonic phasor filters under the multi-influence of interference and harmonic frequency deviation.It begins with the signal model without losing generality as x h,i (t), (1) where the signal contains the fundamental x 1 (t), harmonic x h (t), and OBI component x h,i (t).The OBI tone means the signal component resulting in spectral aliasing when the phasor data are transferred to the master station, and in (1), there are many OBI tones around the fundamental and harmonics.The fundamental's frequency, amplitude, and phase are f 1 , a 1 , and φ 1 .The harmonic x h (t) has an integer multiple frequencies of the fundamental, i.e., h f 1 , with an amplitude a h and phase φ h .The OBI component x h,i (t) has a frequency pertaining to , where nominal frequency f 0 = 50 Hz, and reporting rate [11] f r = 50 frames/sec in this paper.The amplitude of the OBI component is a h,i , while its phase is φ h,i .According to [11], the synchrophasor and harmonic phasor are defined as p h (t) = a h e jφ h (t) .Then, the timedomain form of the fundamental and harmonic signals can be rewritten as where * denotes the conjugate operation.Considering that p h (t) changes slowly with time, then from (2), the Fourier transform of x h (t) (h ∈ [1, H]) is obtained as where the angular frequency ω = 2π f and ω 1 = 2π f 1 ; δ(•) represents the unit impulse function; ⊗ denotes the convolution operation.Suppose that the harmonic phasor filter has an ideal magnitude-frequency response as follows where v represents the fundamental frequency deviation, i.e., the filter passband, and hence the harmonic frequency deviation is hv.Then, the positive frequency part of X h (ω) in (3) can be obtained by multiplying the h−order harmonic phasor filter and the Fourier transform of signal x(t), i.e., X(ω), as The corresponding time-domain form is Let the signal x(t) be sampled at frequency f s , and the center of every time window be tagged as the initial time t = 0, then the harmonic amplitude and phase can be calculated by where t r denotes the Coordinated Universal Time (UTC) attached to the center time of the r-th time window represents the data number in a time window; T s = 1/ f s is the sampling interval.
Considering that the implemented harmonic filter often has non-zero gain out of the passband, with interference, the filtering produces a harmonic phasor estimation as where l r h (t) denotes the implemented filter.Compared with (6), the undesired term o(t) will cause harmonic phasor estimation error, and its Fourier transform is where L r h (ω) is the magnitude-frequency response of l r h (t); ω i represents the signal component in the signal x(t) after omitting the h−order harmonic.For the h−order harmonic phasor filter, some indices used in the following text are defined as where max|Y| denotes the maximum absolute value of Y.The four indices defined in (10) respectively represent the maximum gain error between L r h (ω) and L i h (ω) in the passband, the conjugate range of the passband, the positive frequency range of the interference, and the negative frequency range of the conjugate components for the h−order harmonic phasor filter.Specifically, for the h-order harmonic, . Note that the OBI frequency range containing the passband of the h−order harmonic filter needs to be eliminated, i.e., when i 9) and ( 10), the maximum amplitude of o(t), i.e., the inverse Fourier transform of O(ω), is As a result, a comprehensive error-index, standing the h−order harmonic amplitude estimation error attached to the implemented filter l r h (t), is defined as where Ŷ denotes the estimation of Y; k i = a i /a h is a parameter related to the amplitudes of harmonic and interharmonic tones.Equation (12) shows that CEI h results from the joint action of non-ideal filtering, and in the presence of interference and harmonic parameter change.CEI h can be divided into three parts: (δ ) is related to the non-ideal harmonic parameters such as the harmonic frequency deviation; ) is with the fundamental leakage and harmonic mutual interference, and With the CEI defined, it can then be used to analyze the errors of the existing dynamic harmonic phasor estimators.Here we take as an example the recently developed leastsquare algorithm based on the frequency domain sampling theorem (LS-FST).The LS-FST analysis begins with the decomposition model of the discretized harmonic phasor [22], i.e., where the harmonic model order Q = 2K + 1; p h,k denotes the k-th sample of the discrete time Fourier transform of p h (nT s ), and ∆ f h is the sample interval.With this decomposition, the N = 2N h + 1 signal samples in a time window for signal s(nT where the column vector s ∈ R N×1 contains N samples of signal s(t), i.e., s(−N h T s ), ; the column vector p h ∈ C Q×1 consists of the spectrum sampling parameters to be solved, i.e., p h,−K /2, ..., p h,K /2; Y T denotes the transpose of the matrix Y.
The least-square algorithm is employed to estimate the unknown vector p, i.e., p = ((EF) H (EF) where Y H , Y −1 , Y + represent the conjugate transpose, inverse, and generalized inverse operations for the matrix Y; G + ∈ C 2HQ×N .Combining ( 13) and ( 15), the h-order harmonic phasor estimation can be obtained by where p(i, 1) represents the i-th element in the column vector p.Based on ( 15) and ( 16), the filter coefficients for h-order harmonic phasor are given as where G + (i, :) ∈ C 1×N denotes the i-th row elements of matrix G + .For harmonic filter obtained by ( 17), three components are separately indicated following the three terms of CEI h defined in (12).
Comparing three components with a numerical example helps to understand the relative contributions to the CEI of LS-FST.Table 1 shows an example, and the parameters included in this example are: the nominal frequency f 0 = 50 Hz; the sampling frequency f s = 10 kHz; the time window T w = 3/ f 0 ; the signal model order Q = 3; the maximum harmonic order H = 13 [22]; the frequency interval ∆ f h = 0.5h Hz [22]; the fundamental frequency f 1 = f 0 ; the amplitudes of the fundamental, harmonic, and OBI are a 1 = 1 pu, a h = 0.1 pu, and a h,i = 0.01 pu [11], respectively.It can be seen from Table 1 that the EP h,3 , coming from the OBI components, takes over 90% weight for all harmonic orders less than 13, and is the largest error contribution for LS-FST harmonic phasor estimators.The above analysis fits other least-square algorithms.Table 1 also shows the proportion of each CEI part obtained by the other two least-square algorithms, respectively, based on Taylor expansion (LS-Taylor) [17], and sinc interpolation function (LS-Sinc) [21].The analysis is under the same test example as above for the LS-FST.A similar result, i.e., EP h,3 takes the largest error contribution, is found.

Proposed Optimal Design of Dynamic Harmonic Phasor Filter
Since the major error component of least-square algorithms is from OBI tone, reducing the response gain among the OBI frequency range should be an effective way to reduce the CEI h and improve the measurement accuracy of least-square algorithms.In this paper, the core idea is to use singular value decomposition to lower the OBI band gain, the third part of the CEI h .Our previous work has shown that the SVD can efficiently increase the attenuation to OBI for fundamental and harmonic phasor estimation based on LS-Taylor [26,30], and here we implement the approach in harmonic phasor estimation based on LS-FST, LS-Sinc, and LS-Taylor as part of the new improvement target.In the following exploration of SVD potential in harmonic phasor estimation, the latest LS-FST is still used as an example.Only the key formulas are given here, and the detailed derivation process can be found in [26,30].
The analysis begins with decomposing F h by SVD, i.e., Using F h in (19), the elements from row (h − 1)Q + 1 to row hQ of the matrix G + in ( 15) can be written as where ) is formed by the intersection elements of (h − 1)Q + 1 to hQ rows and columns in the matrix M, M = (U H E H EU) −1 , and and diag(•) represents a matrix formed by putting matrices in the parentheses on the diagonal; E is defined in (14).Then, the filter coefficients for h−order harmonic phasor in (17) can be rewritten as Referring to [26,30], the weight pair V h Σ −1 h is chosen to change the filtering performance by introducing variables y h,k e , and then the h−order (h ∈ [2, H]) dynamic harmonic phasor filter is designed as where w h (1, k e ) is the k e -th element of the row vector and V h (i, :) ∈ C 1×Q denotes the i-th row elements of matrix V h ; Σ h (k e , k e ) is the k e -th element in the diagonal of Σ h ; L h (k e , :) ∈ C 1×N denotes the k e -th row elements of matrix [26,30] show the appropriate variable values can reduce the transition band gain, and hence the estimation error from OBI, with the increase of passband ripple, and the error caused by frequency deviation.Whether the CEI h can be reduced depends on their joint effects, as well as the harmonic mutual interference.Therefore, we formulate the following minimum optimization with the defined CEI h and a total of Q variables introduced with SVD to explore the LS-FST performance improvement under multi-interference and harmonic frequency change.
where CEI h is calculated by ( 12) and ( 10) for the h−order harmonic phasor filter designed by (21); c = T w f 0 denotes the number of nominal cycles in a time window.The first constraint is used to keep computation stability.The second one is obtained by the following two points: (1) Equation ( 14) should have a least-square or a unique solution, which requires the number of equations greater than or equal to the number of the unknown sampling parameters, i.e., cM ≥ 2HQ where M = f s / f 0 is the sample number in a nominal cycle; (2) The Nyquist sampling theorem requires 0.5M Merging two conditions yields c ≥ Q/m.Since this relationship should always hold, with the largest value on the right at m = 1, c ≥ Q.The optimization aims to minimize the CEI h with appropriate variable values.For LS-Taylor and LS-Sinc algorithms, a similar optimization problem can be obtained by replacing the signal decomposition model in (13) with the corresponding basis function.
Here a two-step numerical search method is employed to find optimal variable values and the minimum CEI h .The first step is to observe the CEI h change as a function of each y h,k e (fixing other parameters).With this step, only the variables that help to reduce CEI h value are set adjustable, and others are fixed at one.Then, the adjustable variables are enumerated to reach an optimal combination for minimizing CEI h .
So far, the optimization for the three least-square algorithms is achieved under the given time window c and signal model order Q (Q = 2K + 1 for LS-FST and LS-Sinc; Q = K + 1 for LS-Taylor).The following is an example to visually display the optimization results.For a simple case, the time window length is set to three nominal cycles, and the signal model order is set to 3 for the least-square algorithms, i.e., c = Q = 3.Then, three variables, y h,1 , y h,2 , and y h,3 , are introduced.Figure 1 shows their relationships with the CEI h while the other two variables are fixed to unchanged one.It can be seen that: (1) The individual change of y h,1 toward either direction from one will increase CEI h , (2) CEI h is independent of y h,2 , and (3) y h,3 can reduce CEI h when it is greater than one.The optimal y h,3 value for each harmonic is chosen at the valley of the green curve.For the same least-square algorithm, the optimal values for different harmonics are slightly different, 1.56-1.66,1.46-1.59,and 1.56-1.64for the LS-FST, LS-Taylor, and LS-Sinc, respectively.
The CEI h change with and without optimization for the three least-square algorithms is plotted in Figure 2. The results agree with the analysis: (1) EP h,2 and EP h,3 caused by fundamental leakage, mutual harmonic interference, and OBI components are well suppressed after optimization; (2) the EP h,1 related to the filter passband ripple increases, but the overall CEI h , especially for h ∈ [2, 10], is reduced considerably.This observation is further verified by the frequency responses in Figure 3, i.e., the optimized harmonic filters reduce transition band and stop band gain, but enlarge passband ripple.
It is interesting to know whether the proposed optimization in (22) always has the effect of CEI h reduction and harmonic phasor estimation accuracy improvement under different least-square order Q and window length c.Here we show numerical examples in the range {3, 4, 5, 6, 7} for both parameters.Q = 1, and 2 are not considered because they yield only one variable y h,1 for optimization, and changing y h,1 can only increase the CEI h value.Since c ≥ Q, c can not go lower than 3.The upper limit, 7, is considering the length limit set in IEC/IEEE standard [11].Figure 4 displays the results of three least-square algorithms with and without the proposed optimization in three columns.but the overall CEI h , especially for h ∈ [2, 10], is reduced considerably.This observation is further verified by the frequency responses in Figure 3, i.e., the optimized harmonic filters reduce transition band and stop band gain, but enlarge passband ripple.As we can see from Figure 4, the red-line values are always less than the black lines at the same configuration of least-square order and window length, which checks the validation of the proposed optimization.The optimized CEI h varies with the harmonic order h, and in most cases, increases with h.The reason is that the passband ripple effect becomes higher at high-order harmonics.Another interesting conclusion observed from Figure 4 is that when keeping Q constant, a larger window length yields a higher optimized CEI h value.Considering c ≥ Q, it suggests using c = Q as the optimal when the window length varies in different applications.The last row of subplots in Figure 4 summarizes the CEI h at the optimal c = Q.There is no doubt that good CEI reductions are achieved at long window lengths, e.g., c = 5, 6, 7, and these optimizations can be used in measurement class schemes.For the proposal, however, we observe better improvement for odd c than for even c.Therefore, a special interest result is for c = 3: it can achieve a much lower CEI h value than c = 4 and uses the smallest response latency for phasor update.In this case, i.e., c = 3, the optimization can be used in protection-scheme applications.

LS-FST
(a) LS-FST To conclude, the diagram of the proposed optimal algorithm for dynamic harmonic phasor filters is shown in Figure 5.As the black boxes show, Equations ( 1)-( 12) construct the CEI h for any non-ideal harmonic filter under multi-interference and parameter deviation; The green boxes show that Equations ( 13)-( 18) analyze the largest CEI source (i.e., the OBI tones denoted by EP h,3 ) for the harmonic filters obtained by the three least-square (LS) algorithms; In Equations ( 19)-( 21) displayed in the blue boxes, variables y h,k e are introduced to reduce CEI h with the help of the SVD, where the relationships between CEI h and the introduced variables for different least-square algorithms are shown in Figure 1; Then, Equation ( 22) yields the maximum CEI h reduction by changing the introduced variables, and Figures 2 and 3 show an example of the maximum CEI h reduction and filtering response improvement; Finally, we evaluate the optimization performance under different configurations of two parameters, i.e., signal model order Q and window length c as in Figure 4, and recommend c = Q = 3 for realizing both good accuracy and fast measurement speed.

Results
In this section, typical scenarios referring to [11] are carried out to test the estimation accuracy and response speed of the optimized harmonic phasor measurement algorithms.To keep the text concise, we take the case with window length c = 3 as an example.Conventional LS-FST [22], LS-Taylor [17], and LS-Sinc [21] are used as input algorithms.Their performances with and without the proposed optimization, as well as two state-ofthe-art works, the matrix pencil for estimating harmonics and interharmonics (HI-MP) [28], and the ESPRIT for measuring harmonic phasors [1], are compared.The test settings are identical for all eight algorithms: the nominal frequency f 0 = 50 Hz; the sampling frequency f s = 10 kHz; the reporting rate f r = 50 frames/sec; the signal model order Q = 3.The frequency interval is 0.5h Hz for LS-FST [22], and the basic frequency band is 0.575 h Hz for LS-Sinc [21] where h is the harmonic order.The total vector error (TVE) and response time defined in [11] are used as indicators.The mean TVE of the signal parameter variation (magnitude, frequency variation, etc.) over 100 runs is plotted in the following graphs.

Harmonic Amplitude Test
The first four steady tests employ the signal in (1) to test the eight algorithms under different harmonic amplitude, noise interference (white noise is added to signal in (1)), interharmonic amplitude, and harmonic frequency deviation.
As shown in (1), the signal contains the fundamental tone, harmonics with an order from 2 to H, and each component is accompanied by an OBI tone.The fundamental has frequency f 1 = f 0 , amplitude a 1 = 1 pu, and phase φ 1 randomly chosen within [−π, π].The harmonic frequency is set to an integer multiple of the fundamental, the maximum harmonic order H = 13 [22], the harmonic amplitudes increase from 8% to 12% of the fundamental in a step of 0.5% in each implementation, i.e., a h ∈ [0.08, 0.12] pu, and the harmonic phases φ h ∈ [−π, π].The OBI tones have frequencies f h,i = h f 0 − 0.5 f r (In the OBI tone frequency range, this is the worst case), amplitudes a h,i = 0.01 pu, and phases The fundamental amplitude, maximum harmonic order, OBI frequencies, and all component phases have the same settings as here and it will not be repeated in the following tests.
The mean TVEs of the three least-square algorithms with and without the proposed optimization, as well as HI-MP and ESPRIT methods, are shown in Figure 6.The test results show that the proposed method has a better performance than the HI-MP and ESPRIT algorithms.The main reason is that the number and frequencies of signal components are not accurately identified for the comparing algorithms, causing significant harmonic phasor estimation errors.Figure 6 also shows that the three least-square algorithms have very similar performances under multi-interference before optimization.Note that this similarity of the three least-square algorithms remains the same in the following tests, and the reason is that they own a comparable ability to suppress OBI components.In Figure 6, after optimization, the total errors caused by the fundamental leakage, 11 harmonic mutual interference (except the estimated harmonic from the 12 harmonics when H =13), and 13 OBI components are below 5.9%, 3.2%, and 4.3% for LS-FST, LS-Taylor, and LS-Sinc, respectively.The mean TVE reductions within a harmonic order of 10 are over 0.03, 0.043, and 0.038 for the three least-square algorithms.However, the TVEs of optimized LS-FST and LS-Sinc increase with the harmonic order.This is because (1) Their deviations of the filter gain from the ideal value of one at the set nominal frequency become larger with the increase of the harmonic order, which does not exist in the optimized LS-Taylor, and (2) The interharmonic amplitude related parameter k i ∈ [0.1/0.12,0.1/0.08] in this test is different from the value used in the optimization k i = 0.1.

Noise Interference Test
This test employs the signal in (1) added with white noise to evaluate the noise immunity of the eight algorithms.The signal settings include: the frequencies of the fundamental and harmonics are f 1 = f 0 and h f 1 , respectively; the amplitudes of the harmonic and OBI are a h = 0.1 pu and a h,i = 0.01 pu, respectively.The noise intensity is characterized by the signal-to-noise ratio (SNR) defined as where a 1 = 1 pu represents the fundamental amplitude in (1), and β denotes the standard deviation of the white noise.
For each test, the SNR increases from 50 dB to 80 dB with a step of 5 dB, and the average TVEs across different SNRs and 100 running times are shown in Figure 7.After optimization, the ceiling values for average TVEs are reduced from 7.72%, 7.72%, and 7.73% to 4.4%, 3.2%, and 3.7% for 2-10 harmonic phasors obtained by LS-FST, LS-Taylor, and LS-Sinc algorithms, respectively.Moreover, the optimization achieves higher accuracy than the HI-MP and ESPRIT algorithms, and shows good robustness to noise interference.

OBI Amplitude Test
This test is to estimate the performance of the eight algorithms under different interharmonic amplitudes.The test signal in ( 1) is set as follows: the fundamental frequency f 1 = f 0 ; the harmonic frequencies are h f 1 ; the OBI amplitudes a h,i ∈ [0.001, 0.02] pu; and all the harmonic amplitudes a h = 0.1 pu.
In each test, a h,i , the amplitudes of all OBI increase from 1% to 20% of the harmonic in a step of 1%.The optimized LS-FST, LS-Taylor, and LS-Sinc respectively achieve a TVE reduction over 0.03, 0.045, and 0.038 for 2-10 harmonics.The results in Figure 8 show that the optimization still produces good accuracy improvement, and achieves a much lower estimation error than the HI-MP and ESPRIT algorithms, while the ceiling OBI amplitude a h,i = 0.02 used in the test is much larger than that a h,i = 0.01 in the optimization analysis.This fact proves the proposed optimization is less sensitive to the OBI amplitude increase.It is observed that the estimation error curves of the three least-square algorithms with the proposed optimization in Figures 6-8 appear to be the same curve trend as the optimized subplots in Figure 2.This is because for high-order harmonic, the error EP h,1 caused by passband ripple takes a larger proportion, and EP h,3 related to the transition band becomes smaller.The proposed optimization realizes CEI reduction by decreasing EP h,3 , and hence the CEI reduction becomes smaller with the harmonic order increase.Namely, the proposal yields better performance improvement for low harmonics than for high harmonics.

Harmonic Frequency Deviation Test
Figure 2 implies that the passband ripples of the optimized harmonic filters are bigger than the original conditions.This will lead to larger errors caused by harmonic frequency deviation in the harmonic phasor estimation.Therefore, this part tests the proposed harmonic estimators and the compared algorithms when there are harmonic frequency deviations and multiple instances of interference.The signal in (1) is also used in this test, and the settings are given as the fundamental frequency f 1 changes within Energies 2023, 16, 3397 16 of 23 [49.5, 50.5]Hz [22] with a step of 0.1 Hz in each test; accordingly, the harmonic frequencies h f 1 increase from 49.5h Hz to 50.5h Hz in a step of 0.1h Hz; the harmonic and OBI amplitudes are a h = 0.1 pu and a h,i = 0.01 pu, respectively.
As seen in Figure 9, the proposed optimization still performs a goodly decrease in the mean TVEs, and produces much lower error than the HI-MP and ESPRIT algorithms.The values are always below 4.2%, 4.5%, and 3.9% for the optimized LS-FST, LS-Taylor, and LS-Sinc, respectively.Moreover, we compare the maximum TVEs and the theoretical values in Figure 2. Most differences are less than 0.02 for all three least-square algorithms, which proves the test results are in good agreement with the theoretical analysis.

Harmonic Amplitude Modulation Test
The following three tests are carried out to check the algorithms' ability to deal with dynamic conditions, i.e., harmonic modulation in amplitude and phase, and harmonic frequency ramp.The signal for the harmonic amplitude modulation test is a h,i cos(2π f h,i t + φ h,i ), (24) where the fundamental and harmonic amplitudes, i.e., a 1 = 1 pu and a h = 0.1 pu are modulated with level 0.1, and frequency f m ∈ [0.1, 2]Hz [11] in a step of 0.1 Hz for each test; the OBI amplitudes a h,i = 0.01 pu; the frequencies of the fundamental and harmonics are f 1 = f 0 and h f 1 , respectively.
Figure 10 shows the optimized LS-FST, LS-Taylor, and LS-Sinc ensure a TVE reduction over 0.028, 0.041, and 0.035 for 2-10 harmonics, respectively, and achieve more accurate estimation than HI-MP and ESPRIT methods.This observation indicates the proposed optimization still has good performance under dynamic signal condition.

Harmonic Phase Modulation Test
Equation (25) gives the signal used in the harmonic phase modulation test.The fundamental phase φ 1 and harmonic phases φ h are all added with a modulation component having level 0.1h and frequency f m ∈ [0.1, 2] Hz [11].Other settings are as follows: the fundamental has frequency f 1 = f 0 and amplitude a 1 = 1 pu; the harmonics own frequencies h f 1 and amplitudes a h = 0.1 pu; the OBI tones have amplitudes a h,i = 0.01 pu.
a h,i cos(2π f h,i t + φ h,i ).(25) In this test, the mean TVEs resulting from the phase modulation and multi-interference are always below 5.8%, 3.2%, and 4.1% for the three least-square algorithms with the proposed optimization.

Harmonic Frequency Ramp Test
Harmonic frequency ramp may result in a bigger estimation error than frequency deviation when covering the same frequency range.Therefore, the test evaluates the eight algorithms under harmonic frequency ramp and various interference.The test signal is where a 1 = 1 pu, a h = 0.1 pu, and a h,i = 0.01 pu; the fundamental frequency changes linearly from 49.5 Hz to 50.5 Hz in one second, i.e., R f = 1 Hz/s, and correspondingly the harmonic frequencies increase from 49.5h Hz to 50.5h Hz at the ramp hR f = h Hz/s. Figure 12 shows that the optimized LS-FST, LS-Taylor, and LS-Sinc maintain the mean TVEs at a low level.The TVE reduction is over 0.043, 0.046, and 0.047 for harmonics with an order from 2 to 10.Moreover, the error values and volatility of the optimized least-square method are smaller than those of the HI-MP and ESPRIT algorithms.As seen in the seven tests above, the optimized least-square algorithms achieve good accuracy improvement compared with the original form, and more accurate estimation than the HI-MP and ESPRIT methods in most conditions, which proves the proposal is valid both in steady and dynamic conditions.However, the proposal fails to estimate the thirteenth harmonic phasor for LS-FST.There are two reasons for this failure: (1) The error proportion EP h,3 caused by OBI tones decreases with harmonic order, which means the CEI reduction becomes small for high-order harmonic filters; (2) The interharmonic amplitude related parameter k i in the tests is different from the value used in the optimization, e.g., k i ∈ [0.083, 0.125] in the first test, while k i = 0.1 in the optimization.In this case, the optimization should be implemented with the appropriate maximum harmonic order H and amplitude parameter k i .

The Sampling Frequency Test
In this test, the sampling frequency is ramped from 5 kHz to 10 kHz in steps of 1 kHz.The signal in (1) added with a 60 dB white noise is employed, and the signal settings include the following: the fundamental frequency has a deviation of 0.2 Hz, i.e., f 1 = 50.2Hz, and hence the harmonic frequency is 50.2hHz; the amplitudes of the harmonic and OBI are a h = 0.1 pu and a h,i = 0.01 pu, respectively.
The mean TVEs of the second and thirteenth harmonic phasors are shown in Figure 13.The results for 3-12 harmonics have similar trends.It is observed that the three leastsquare algorithms with the proposed optimization maintain better robustness over different sampling frequencies compared to the HI-MP and ESPRIT methods.

Harmonic Amplitude and Phase Step Tests
The step tests are implemented to obtain the response times of the optimized algorithms.The test signal includes the fundamental and one harmonic, and they perform steps together, i.e., where the step level configurations k a = 0.1, k p = 0 and k a = 0, k p = −π/18 are taken for the h−order harmonic amplitude and phase step tests, respectively; the harmonic order h increases from 2 to 13 [22] for both step tests; the step function b(t) = 0, t < 0 and b(t) = 1, t > 0. To calculate the response times, the errors caused by the non-ideal gain at the nominal harmonic frequency (shown in Figure 3) for the optimized LS-FST and LS-Sinc are compensated.As shown in Tables 2 and 3, the optimized algorithms have a fast response speed, and the most response times are below two nominal cycles, no matter in the harmonic amplitude or phase step test.

Accuracy Analysis under Different Window Lengths
This part analyzes the relationship between the time window length and estimation accuracy of the three least-square algorithms with and without the proposed optimization to determine the application environment.The harmonic frequency deviation test signal with a 40 dB [31] white noise is employed in this section.When the time window length

Computational Burden Analysis of the Proposed Optimization
Since the proposed optimization is implemented offline, the last Equation in (15) produces the mainly real-time computation for the three least-square algorithms with and without the proposed optimization [32].This means the six algorithms have comparable time complexity, as shown in Table 4.Moreover, Table 4 also shows the minimum and maximum execution times for a single implementation of the six algorithms when the time window increases from three to seven nominal cycles.The test signal has the same settings

Figure 1 .
Figure 1.The left subplots show the relationships between CEI and the introduced variables for different least-square algorithms.The right subplots show the CEI change when y h,3 varies.The values with y h,3 = 1 are used as reference.The black dash line in each subplot represents the optimal value for y h,3 .

Figure 2 .
Figure 2. The CEI distribution of three least-square algorithms with and without using the proposed optimization.

Figure 2 .
Figure 2. The CEI distribution of three least-square algorithms with and without using the proposed optimization.

Figure 3 .
Figure 3.The frequency responses of second harmonic phasor filters for the three least-square algorithms with and without using the proposed optimization.Similar frequency responses can be observed in other order harmonic filters.

Figure 4 .
Figure 4.The subplots in the first four rows show the variation of the CEI for each harmonic with the window length c when keeping the signal model order Q constant for the three least-square algorithms with and without the proposed optimization.The last row of subplots summarizes the CEI as c = Q.

Figure 5 .
Figure 5.The diagram of the proposed optimal algorithm for dynamic harmonic phasor filters.

Figure 6 .
Figure 6.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under harmonic amplitude test.

Figure 7 .
Figure 7.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under noise interference test.

Figure 8 .
Figure 8.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under OBI amplitude test.

Figure 9 .
Figure 9.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under harmonic frequency deviation test.

Figure 10 .
Figure 10.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under harmonic amplitude modulation test.
Figure 11 also indicates that the optimized TVEs are respectively reduced by more than 0.033, 0.043, and 0.04 compared with the original LS-FST, LS-Taylor, and LS-Sinc, and are much lower than the TVEs of HI-MP and ESPRIT methods for 2-10 harmonics.

Figure 11 .
Figure 11.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under harmonic phase modulation test.

Figure 12 .
Figure 12.The mean TVE of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under frequency ramp test.

Figure 13 .
Figure 13.The mean TVE for (a) second and (b) thirteenth harmonic phasors of LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization, as well as the HI-MP and ESPRIT methods under sampling frequency test.
to seven nominal cycles[11], the the estimation errors and the improvement degrees of the proposed optimization are respectively shown in the left and right subplots of Figure14.As seen in the right subplots, the proposal produces larger CEI reduction under c = 3, 5, and 7 than c = 4 and 6.Wherein, the response latency of c = 3 is the shortest among c = 3, 5, and 7. Therefore, for applications that require fast response and good accuracy, we recommend c = 3.

Figure 14 .
Figure 14.The left subplots show the relationship between the mean TVE of each harmonic and the time window length c (or signal model order Q) for the (a) LS-FST, (b) LS-Taylor, and (c) LS-Sinc with and without the proposed optimization.The right subplots show the optimized TVE change, and the reference is the TVE before the optimization under the same parameter configuration.

Table 1 .
Each part proportion of the harmonic amplitude estimation error obtained by different least-square algorithms.

Table 2 .
The response times of the LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization under harmonic amplitude step test.

Table 3 .
The response times of the LS-FST, LS-Taylor, and LS-Sinc with and without the proposed optimization under harmonic phase step test.