The estimate of amplitude and phase of harmonics in power system using the extended kalman filter

Received Jan 9, 2021 Revised Apr 13, 2021 Accepted May 29, 2021 Nowadays, the amplitude of the harmonics in the power grid has increased unwittingly due to the increasing use of the nonlinear elements and power electronics. It has led to a significant reduction in power quality indicators. As a first step, the estimate of the amplitude, and the phase of the harmonics in the power grid are essential to resolve this problem. We use the Kalman filter to estimate the phase, and we use the minimal squared linear estimator to assess the amplitude. To test the aforementioned method, we use terminal test signals of the industrial charge consisting of the power converters and ignition coils. The results show that this algorithm has a high accuracy and estimation speed, and they confirm the proper performance in instantaneous tracking of the parameters.

A rapid and reliable estimation of power system signal harmonics is highly vital for the assessment of power quality and plays an important role in power systems. Voltage distortion and current waveforms are severely affected by an increasing demand for non-linear loads, the large-scale use of electronic equipments of high-power industrial and medium-power domestic loads, arc furnaces, controlled motor drives [12]. An unexpected increase in harmonic pollution resulted from the signal circuit intereference, communications, and electric railway systems [13], is one of the critical issues of the power quality [14] assessment and decreases the electricity quality supplied to the consumers [15]. This is why a fast and proper component harmonics assessment is critical.
The research on harmonic estimation suggests that the amplitude of the harmonics can be estimated by both parametric and non-parametric methods. Kalman filter, Prony method, adaptive notch filtering, Hilbert-Huang transform matrix pencil method, and Taylor-Fourier. are the parametric methods whereas nonparametric algorithms are based on the discrete fourier transform (DFT) [16]. In FFT-based [17]- [19] frequency algorithm, non-synchronous sampling produces some unavoidable defects such as spectral leakage and picket fence effect [20]. To alleviate these shortcomings, windowed interpolation FFT (WIFFT) algorithm [21] has been suggested. Using spectral analysis, Cheng-I Chen et al. [20] have tackled frequency estimation for inter-harmonics and power system harmonics. Kalman filter (KF) being one of the best methods for the estimation of the sinusoid parameters manipulated by unknown measurement noise fails to produce exact results during nonlinearity and power system dynamics. Sub-optimal solutions comprising two classes, that is, local approach and global approach, employ nonlinear extended kalman filter (EKF) [22] as one of the local approach methods which yields recursive sub-optimal solutions for nonlinear dynamic systems [23]. Although EKF is computationally efficient and linearizes the state-space model with first order Taylor series expansion [24], this method may deviate from the correct course due to model nonlinearity and improper initialization. Thus, to decrease such instances, unscented kalman filter (UKF) [25], has been suggested that surpasses the conventional EKF for its capacity to diminish linearization burden for the predicted states and achieve the second-order accuracy. Nevertheless, it does not yield the correct second-order moments for quadratic functions [26]. Quadrature kalman filter (QKF) [27], robust kalman filter [28], iterated kalman filter (IKF) [29] and ensemble kalman filter (EnKF) [30] have been introduced to enhance the stability and accuracy of the estimation. Among all these KF, QKF exactly calculates the recursive Bayesian estimation integrals based on the gaussian assumption employing the Gauss-Hermite numerical integration rule; however, QKF is likely to diverge due to high dimensional state-space models [23]. In this paper, the proposed method consists of the KF combination, and a linear estimator named as the least squared (LS), therefore, we suggest LS.KF as the name for this method. This algorithm uses the KF method to estimate the phase, and the LS method to estimate the amplitude.

EXTENDED KALMAN FILTER
A new version of the linear kalman filter with certain modifications called the EKF is used in systems with measurement equations and non-linear processes. In each stage of the recursive algorithm, using a first order Taylor series, the non-linear equations are linearized to form a linear process before the linear Kalman filter model is employed. The EKF delineates the relationship between the states and the measurements and the state transition function using the nonlinear functions f and h, respectively: Where xk and zk are the state vector and the measurement at instant k, respectively; and wk and vk are the uncertainties introduced by the measurement noise and the state transition, both with zero mean and covariances Qk and Rk, respectively. The nonlinear functions f and h are linearized by a first-order Taylor series as: The kalman filter is a two-step prediction-correction process. Starting with an initial estimate of the process / , and its error covariance matrix / , the measurement at instant k, zk, is used to improve the estimation. A linear combination of the estimate and the measurement is chosen according to (4): Where xk is the estimation update at instant k and Kk is the filter coefficient. εk is the residual, defined as: That illustrates the difference between the measurement zk and the estimation / at instant k. The state transition matrix Φk is used to project the filter ahead using the measurement at instant k+1. Kalman filter equations can be found in [14].

INTRODUCING THE LS.KF METHOD
Since the maintenance of the power quality indicators to the extent-required standard is as an important issue for the utility companies, the awareness of the parameters of the harmonics is necessary for designing the suitable filters in order to either eliminate or reduce them. Several methods have been proposed for the amplitude and phase harmonics assessment up to now. However, the time-based methods show better performance at the time of noise. In the other words, the accuracy and the speed of the convergences are higher than the frequency-based algorithms One of the famous methods used to estimate harmonics is KF algorithm. This algorithm with maintaining simplicity, linearity, and sustainability is able to estimate harmonic parameters even during the noises and nonlinear factors in the main signal. This filter has been considered as one of the most successful analytical ones. It instantly assesses the function without initial training, and optimal output is produced. The time amplitude methods estimate the harmonic parameters in it by instantaneous sampling of the signals. The test signal can be shown as: In this paper, the Kalman filter is used to estimate the phase of the harmonics. The procedure is as follows. First, the estimated phase parameters are considered as the following vector: The system dynamics is defined as a discrete time equation as: Where in ( , +1 ) is a matrix of (n+1, n+1) and w is a model noise. The system mode is updated based on the above equations, and the covariance matrix is obtained at this stage from the following equation.
According to (6), the value of ZK can be the voltage or current desired, which includes noise.
The kalman interest matrix is calculated as: After obtaining the measurement values of Z, the update equations are estimated as: Moreover, the matrix P is obtained as: In each replication, this algorithm is used by the KF method to estimate the phase, and the least squares method (LS) is used to estimate the amplitude. This process is repeated until we will get an acceptable answer. To estimate the amplitude of the signal, the discrete linear model of the sampled signal is used as: In which Zk is measured from the sample K-signal. Hk is the matrix of system structure, Ak is the matrix of unknown parameters to be estimated, and is also the input noise. To find the best estimate for matrix A meaning Ae, we use the minimization of the following function.
After phase estimation, KF and Hk are calculated as: Further estimation based on LS method, it is achieved by solving the following objective function: By using the last sample obtained from the previous relationship, the amplitude vector is estimated by LS as: In addition, this process is repeated until the final answer is reached.

THE SIMULATION RESULTS
To simulate the performance of the above algorithm, a test signal has been used. This signal has a distortion as: The test signal from the terminal of an industrial charge is sampled consisting of the power converters and the ignition kilns. This test signal contains 5 harmonics, Gaussian noises with a mean of 0 and variance one. The coefficient is considered equal to 0.05. To test the efficiency of the proposed algorithm, several test signals are used as follows: − Static test signal with the low noise − Static test signal with the high noise − The dynamic test signal − The signal test with the frequency deviation For the static signal with the low noise, the signal-to-noise ratio is SNR=20 db, and for static signals, with high noise the signal-to-noise ratio is SNR=5 db. The results are as follows: As you can see in Figure 1 and Figure 2, the actual values with the simulated estimated values for the static signal with the low noise is SNR=20 db, and with the high noise is SNR=5 db. Therefore, they are hardly different from each other. In other words, the results show the accuracy of the above method to estimate these types of signals. In a real power system, the amplitude of the waveform of the electric waves varies with different times. The As indicated in Figure 3 and Figure 4, despite the change in harmonic amplitude and noise, the LS.KF method follows the sudden changes in amplitude and phases.  In Figure 5 and Figure 6, the amplitude and phase of the third harmonic are estimated in dynamical conditions by using the above algorithm. As you can see, the precision of the method is also used to estimate the harmonics. Moreover, this method can also be used to estimate other harmonics in the network. Since there is always a mechanical deviation for any power system, we test the proposed estimation against these deviations. For this purpose, we used the mechanical deviation of ∆ = −1 . This deviation was applied at the beginning of the second cycle, and that will be eliminated after 33 ms because the harmonics are the correct multiplication of the base frequency. Subsequently, the deviation at the original frequency affects all the harmonics. The results of the baseline harmonic amplitude and phase estimation are presented in Figure 7 and Figure 8.
As we can see, the estimated range of the amplitude and phase do not show much deviation, after applying frequency deviation. In case of smaller deviations like ∆ = 0.1 the introduced LS-KF method can monitor the parameters almost uninterruptedly.

THE COMPARISON OF THE ALGORITHM-LS-KF WITH DFT METHOD
To understand the efficiency of the algorithm, its performance is compared with the DFT1 fourier transform traditional method. For this purpose, the desired signal is initially combined with the white noise and the signal-to-noise ratio of SNR=10 db is used for modeling. The results are shown in Figure 9 and Figure 10. To compare the performance of the LS-KF algorithm with the DFT method better, we used the following two indicators, there are; 1) the squares average of the estimated signal error, 2) the variance of the estimated signal. Also, the results are shown in Table 1.

CONCLUSION
Today, the accurate estimation of the amplitude and phase of the harmonics to design filters to remove unwanted harmonics is essential for the proper operation of the power system. In this paper, a new and efficient method to identify the harmonic parameters is used. The proposed method consists of a combination of the KF filter and a linear estimator called the least squared LS. Therefore, the LS-KF name is suggested for this method. In this algorithm, we used the KF method to estimate the phase, and we also used the LS method to estimate the amplitude. As the results of the simulation show us that, the harmonic parameters converge in less than one cycle to real values. The algorithm also performs well in the moment tracking of the parameters. To show the accuracy of the proposed method, we used two indicators, one of them was MSE, and another one was variance to test signals.