## 1. Introduction

Power conditioning systems like active filters, universal power flow controllers, static compensators, and dynamic voltage restorers need accurate control and synchronization circuits capable of dealing with very different grid voltage perturbations. Phasor estimation and symmetrical components estimation is a fundamental task in power systems relaying and power quality characterization. Voltage sags and swells, harmonics, frequency variation, phase steps, DC components and noise, are phenomena that can cause severe malfunction in the control or supervision circuits of such power systems. Additionally, they must be identified, measured and quantified for power quality purposes. Moreover, some protection systems are sensitive to these parameters and can develop erroneous actions. Instantaneous symmetrical components, required for power quality analysis and power electronics converter control, are robust estimated by the Discrete Fourier Transform algorithm in normal conditions. However, strong grid voltage perturbations, occurring in weak grids, especially in the grid connection of renewable energies, are more challenging. The chapter accurately describes the DFT errors under frequency variation, decaying DC components and harmonics. The error analysis allows the extension of the DFT algorithm to manage these known but more frequent and severe phenomena. The method is capable of handling a large variety of grid voltage perturbations, maintaining a good dynamic response and accuracy. These are the main reasons why the DFT algorithm is widely used in Phasor Measurement Units (PMUs) and power quality analyzers [1-2].

## 2. The DFT environment

The Discrete Fourier Transform (DFT) has been widely used in the analysis of the fundamental component and harmonics of the electric grid voltages and currents, namely in PMUs and protection relays [3-4]. The temporal information loss caused by the transformation is recovered by analyzing the signal in just one temporal window with duration of one or a multiple of the fundamental period of the analyzed waveform. The DFT method gives accurate results when the sampled period is equal to the fundamental period.

In case of input frequency variations there is a phase shift between the input and output signals, as well as spectral leakage. With unknown input frequencies the signal components are projected to the presumed frequency components, multiples of the input frequency. During fast transients or faults, the grid voltage is characterized by being a non-periodic signal containing fast oscillations, exponential decaying components and harmonics, among other possible disturbances. Fundamental component extraction by conventional DFT is affected by an important error due to the limited temporal resolution of the analyzed window.

The phase difference resulting from the difference between the presumed frequency and the real frequency can be compensated in different ways: by imposing that the analyzed interval should be equal to the grid period, [5], or by adding a phase offset to cancel the phase difference. The second method is preferable since it does not imply a change in the execution frequency of the digital algorithm that can be embedded in control task with other algorithms that need to be executed at a fixed frequency. The so-called Smart Discrete Fourier Transform, [6], measures the input phasor signal and estimates the frequency with high precision, superior to the conventional DFT, showing robustness and being implemented in a recursive manner. The estimation precision is robust in the presence of noise and is higher if it is considered high order harmonics but implying a more complex algorithm and pre filtering, [7].

Different methods have been proposed to allow the DFT algorithm to deal with variable frequency input signals, exponential decaying components and noise immunity. Adaptive variation of the temporal window, adaptive change of the sampling frequency, phase and amplitude correction and input data modification are the main proposed methods to increase the DFT algorithm performance.

Input low pass anti-aliasing filters can eliminate the high frequency components but can not remove decaying dc components and reject low frequency components. Under these conditions, the DFT-based phasor estimation is more difficult and slower and affects the performance of converters synchronization and digital relaying.

Absolute and recursive DFT modified algorithms can be applied to some of the above mentioned non-nominal operating conditions. However, a more realistic list of abnormal field operating conditions includes:

Amplitude variation (sags and swells). If voltage swells are important because they can cause serious damage in electrical machines and transformers voltage sags are becoming more demanding since there is a need to maintain some important grid connected system in operation even under high amplitude sags, [8].

Harmonics. The presence of high power nonlinear loads, deregulation rules and increased power flow allowed the increase of harmonics presence in the grid voltage.

Spikes and notches. Caused by power devices switching and capacitors commutation they can severely affect zero crossing detection and generate low frequency harmonics.

Frequency variation (step and continuous). High active power variations, generators failure and power transfers between large connected areas can cause frequency variations. As voltage sags, frequency deviations from the nominal value are imposing new and demanding conditions in the new energy generation era.

Phase steps. Connecting and disconnecting large loads, especially in weak grids, are the main origin of phase steps occurrence. Having an extremely large frequency spectrum they cause important transient phenomena as in amplitude measurement or frequency estimation as in control systems.

Exponential decaying components. Generated by different fault types or grid connection of high power electrical machines they constitute with phase steps the more important disturbances that appear in a grid voltage system.

Noise. Always present and generated by very different sources.

Phasor estimation under different grid voltage perturbations and symmetrical components calculation for power conditioning converters control are the parameters to be analyzed in the chapter. Performance optimization for the all conditions should be a compromise.

## 3. Symmetrical components estimation with the DFT

Apart from noise and harmonics, which will be considered later, the main components of a voltage signal from the phasor detection point of view can be expressed as:

where *A* is the initial amplitude of a decaying DC component being τ its time constant, *X* is the amplitude of the voltage signal, ω the fundamental frequency, and ϕ the phase angle of the voltage signal.

Assume that *x*(*t*) is sampled at a sampling rate *f*_{s}, multiple of the nominal frequency, *f*_{o}:

Being *f*_{o} the nominal frequency and *N* the number of samples per fundamental nominal period, the sampling produces a data sequence *x*(*kT*_{s}), or *x*(*k*):

Using a phasor representation with

The signal *x*(*k*) can be represented by

where * denotes complex conjugate. The fundamental frequency component, *X*_{1}, (at instant *k* and with nominal frequency, *f*=*f*_{o}) given by the DFT algorithm is

It is important to note that at instant *k*, the data window used to compute the DFT goes from *k*-*N* to *k*-1. Taken frequency variation, *f*=*f*_{o}+Δ*f*, into consideration and substituting the signal phasor representation in the DFT expression, the fundamental component is

With some algebraic manipulation, the expression can be given by

The frequency deviation dependent angles θ_{1} and θ_{2} are given by

Harmonics presence in the grid voltage when there is a frequency deviation creates additional errors. It can be shown that the existence of *m* harmonics causes an error in the fundamental component that is given by:

where

Eq. (8) and (10) clearly show the behaviour of the DFT algorithm under abnormal conditions. In what respects to frequency deviation the resulting fundamental component has two types of errors: amplitude and phase. The positive direction rotating phasor presents a frequency deviation dependent amplitude and phase; the negative direction rotating phasor has also variable amplitude and rotates at a double frequency. Harmonics have a similar but much smaller contribution to the referred errors. The presence of an exponential decay component introduces a complex error, very unfavourable in phasor detection.

The DFT algorithm with these two conditions, variable frequency and exponential component, can be used if the resulting errors are correctly handled.

### 3.1. Correction for variable frequency

There are some approaches to variable frequency operation: analytical correction based on absolute DFT calculation [6, 9], recursive DFT algorithm [5, 10-11], and high frequency filtering [12].

In [9], frequency estimation is based on the phase variation given by two DFT calculations and approximate expressions so containing a frequency deviation dependent error. The method presented in [6] is simple in ideal conditions and can be recursive, but is susceptible to harmonics; its consideration highly increases the method complexity. Recursive DFT approaches share the same initial simplicity. When dealing with variable frequency the correction methods are very different, essentially depending on the measurement purpose.

In [10] it is analyzed only phase correction, not amplitude, which is important for phasor estimation. Sampling frequency variation, proposed in [5], is not a feasible method; also, linear correction of the measured phase presents good results but is not tested in all conditions. Recursive DFT calculation with phase and amplitude correction, as presented in [11], works well. However, DC decaying components cause significant perturbations in phasor estimation. Filtering the high frequency components present in the amplitude and phase values returned by the DFT is limited to small frequency deviations [12]. Also, filtering introduces an additional delay in the phasor estimation.

In general, it can not be guaranteed the absence of even harmonics, so any method based on the half cycle DFT is not considered. The relative slower dynamics of the full cycle DFT must be assumed.

### 3.2. Decaying DC component compensation

Accurate elimination of the exponentially decaying DC component from the fundamental phasor calculated by the DFT is treated by different methods: mimic filter [13], input data correction [14-15], and analytical calculation with variable data window [16].

The mimic filter just uses an average value of the presumed decay component time constant, amplifies high frequency components and introduces a phase advance in the fundamental component, so making it unsuitable for accurate instantaneous phasor detection. Also, operation under variable frequency introduces amplitude errors. Input data correction, so eliminating the decay component, can be made just one cycle after the occurrence of a fault. Naturally, there is a need to detect the fault; the method is tailored for fault occurrence.

The correct fundamental component phasor is only obtained after *N* samples [15] or *N*+4 samples [17]. Of course, this is much better than the simple DFT algorithm that originates an amplitude overshoot and settling time dependent on the time constant but also is done with high complex calculations. In practical applications this complexity results in two very important aspects: execution time and run time errors, due to trigonometric operations and possible divide by zero operations or square root calculations, respectively.

The variable data window method in [16] is not so complex and is also fast but does not consider frequency deviation. Additionally, its main algorithm is tailored for fault detection, not for permanent operation like grid voltage feature extraction or control purposes like synchronization or current control.

### 3.3. Symmetrical components for power conditioning devices

Single phase phasor estimation and three-phase symmetrical components estimation are a very useful tool in power systems. During unbalanced disturbances their values change significantly. Although the symmetrical components concept is a frequency domain one, it is extended to the time domain, [18]. The estimation of symmetrical components from measured signals can be used for efficient control, supervision and protection in electrical power systems especially in unbalanced ones [19] or for instantaneous phasor detection [20-21].

The digital implementation of three-phase symmetrical components is based on two approaches: by the definition, with the help of a digital time delay, or by the decomposition of the three-phase signals in orthogonal components followed by a complex digital filtering [22]. The former is more general and will be used here.

Being *v*_{a}(*t*), *v*_{b}(*t*), and *v*_{c}(*t*) three-phase instantaneous voltages the instantaneous symmetrical components are defined by:

where *a*=exp(2π/3).

The instantaneous positive and negative sequence components deﬁned by (12) are in general complex signals. Another definition yielding real signals can be obtained through the substitution of the complex operator *a* by a 120º phase shift in the time domain as follows:

The negative sequence instantaneous symmetrical component is of no interest, because it is the complex conjugate of the positive sequence instantaneous symmetrical component.

Since the DFT algorithm extracts the phasor information, the symmetrical components can be easily obtained through the phase shift operator and algebraic processing. Furthermore, using only the fundamental component returned by the DFT it can be readily obtained the fundamental positive and negative instantaneous components.

The positive sequence instantaneous component has the following expression:

The application of the DFT algorithm to extract the symmetrical sequence components was discussed in several works [12, 23-24]. The algorithm, with the appropriate and presented counter measures is capable of dealing with non-stationary signals and variable frequency. Symmetrical components estimation in conjunction with amplitude, phase and frequency detection can be made according to the diagram in Figure 1. With the sampling theorem satisfied by fast A/D converters, enough bandwidth is available for fast dynamics, namely for including low frequency harmonics detection.

## 4. Handling grid perturbations

The proposed method is focussed for power converters control and protection. It is intended for operating under all input voltage conditions including the above referred ones. The most demanding are the decaying DC components and the frequency variations. With these conditions present it was made an extensive study on the performance of a DFT-based method for operating under a general and unknown electrical environment.

Different criteria have been used to assess the performance of a particular method. Operation in all mandatory conditions must be a compromise between dynamics and precision: dynamics in order to efficiently control the converter currents and correctly measure the amplitude value with no over or undershoots; precision to accurately compute the parameters of interest and the control algorithms output values.

### 4.1. General purpose method

An online DFT-based phasor estimation method with decaying DC component correction and frequency deviation compensation is presented. Among the different possibilities for minimizing the effects of a decaying DC component in DFT fundamental component phasor estimation, the partial sums approach will be used. Being excellent in the case of a fault occurrence, it deteriorates the DFT performance under other transients like voltage sags and swells, and phase steps. Also, it should be considered that a frequency deviation creates an error in the corrected data, so affecting its performance. The partial sums are defined by:

In the absence of a decaying DC component and with nominal frequency the two sums are zero and the acquired data are not changed. Frequency deviation introduces an error that must be considered in real-time phasor estimation. The partial sums then result in:

where *b*=exp(-1/(*f*_{o}*N*τ)) and the errors are given by:

The errors are dependent on the fundamental component amplitude, *X*, the frequency deviation, Δ*f*, the sampling frequency, *Nf*_{o}, and the actual instant, *k*. At each sampling instant, the partial sums must be calculated according to (17) and (18); then *A* and *b* are determined by simple algebra, [15].

The data correction made at each sampling instant by the DC component compensation algorithm does not allow using the recursive DFT method. The approach to deal with the frequency deviation is based on the method presented in [11] but modified to the absolute version of the DFT algorithm. Some increase in the computational needs is the consequence of a more general algorithm.

The algorithm operates iteratively under the flow diagram shown in Figure 2. When a new sample occurs, the partial sums are calculated according to (15) and (16); the new *b* and *A* parameters are determined with (19) and (20) using the errors *e*_{1} and *e*_{2} determined with (17) and (18), with the frequency deviation of the previous sampling; the data window is corrected; the absolute DFT is computed; the phase, frequency and amplitude errors are calculated; the phasor parameters are outputted. Simultaneously, samples for *v*_{a}^{f}(*k*), S_{120}*v*_{a}^{f}(*k*) and S_{240}*v*_{a}^{f}(*k*) are generated in order to compute the instantaneous positive, negative and zero sequence symmetrical components.

### 4.2. Simulation results

As referred in the Introduction, the grid voltage is subjected to very different phenomena. So, a phasor and symmetrical components estimation method must be tested against conditions like the ones that will be faced in field operation.

The simulated conditions can be divided into three categories: voltage perturbations, frequency deviations and harmonics and noise rejection. In the voltage perturbations category it is considered balanced voltage sags and swells, and decaying DC components; in the frequency deviations it is analyzed the behaviour under frequency variations and phase steps; random noise and low frequency harmonics presence in association with frequency estimation precision are considered in the last group. The main simulation parameters are: the nominal voltage is 1 p.u., the nominal frequency is 50 Hz, with 32 samples per period.

Stationary symmetrical components in different conditions are extracted in Figure 3, where phase *a* has a 20% voltage sag (unbalanced sag) during the time interval *t*=[0.2 s, 0.4 s] and, at *t*=0.6 s, phases *b* and *c* have a phase jump of +20º.

Due to a deregulated market and a high penetration level of renewable power sources strong voltage perturbations are expected in the near future. The amplitude voltage perturbations are presented in Figures 4, 5 and 6. For all the three conditions, several tests have been made. In all of them, the dynamics of the transient response is dependent on the instant when the perturbation occurred. The presented ones show the worst situations.

Figure 4 shows, between *t*=0.2 s and *t*=0.3 s, the collapse of the voltage down to 20% (balanced sag), the instantaneous positive sequence voltage estimation, and the positive and negative sequence amplitudes. Only one and a half cycle is required to reach the steady-state condition.

Figure 5 shows the same waveforms but for a voltage swell of 180%, between *t*=0.4 s and *t*=0.5 s.

Exponentially decaying DC components are caused by several fault types including the recovering of short circuits and overload conditions.

Figure 6 shows such an example: at *t*=0.24 s the voltage collapses to zero; then, at *t*=0.3 s the voltage raises again, with an exponential decaying component with *A*=1 p.u. and a time constant of 30 ms.

Balanced voltage sags and swells have one and a half cycle time response. Decaying DC components generate a not so small perturbation in the negative component but are efficiently handled in the instantaneous positive sequence.

Different fault types can cause unbalanced voltage sags, possibly with phase steps. Frequency perturbations come from generation-consumption unbalance in static and dynamic conditions. Frequency deviation steps are not usual in strong grids but can occur in weak systems; continuous frequency deviations and phase steps are much more common. Three conditions are presented in Figures 7, 8 and 9. In Figure 7, frequency goes from 50 Hz to 48 Hz at *t*=0.3 s. With a time response of two cycles the frequency is correctly tracked with no amplitude errors.

An unbalanced voltage sag is presented in Figure 8, during the interval *t*=[0.2 s, 0.3 s]. In this case, phase *a* maintains its amplitude and phase while phase *b* decreases to an amplitude of 0.577 with a phase jump of -30º and phase *c* decreases to the same amplitude of phase *b* with a phase jump of +30º. This condition generates a negative sequence component but not a zero sequence one.

Another unbalanced condition, as referred in IEEE 1159 [25], is shown in Figure 9, during the time interval *t*=[0.4 s, 0.5 s]. While phase *a* maintains its amplitude and phase, phase *b* decreases to an amplitude of 0.1 with a phase jump of -55º and phase *c* decreases to an amplitude of 0.5 with a phase jump of -20º, in a three-phase four-wire system. The three components, positive, negative and zero, are now present in the three-phase system and are efficiently detected.

Frequency deviation and severe phase steps cause severe perturbations at different levels. As in symmetrical components estimation as in amplitude detection and frequency estimation the perturbations are important but are correctly handled by the DFT-based estimation method.

Quite often there is the occurrence of harmonics in power systems: nonlinear loads generate harmonic currents and the associated voltage drops in the line impedances create voltage harmonics. These degrade the overall quality of the delivered power and can also severely affect the operation of grid-connected equipment. The DFT algorithm can easily extract the harmonics present in the three-phase voltages; in fact it is a common feature of any power quality analyzer.

Figure 10 demonstrates the dynamic operation of the DFT algorithm in the estimation of the three-phase instantaneous positive sequence and its magnitude in the following conditions: between *t*=0.1 s and *t*=0.2 s the voltage signal contains the following harmonics: 2^{nd} with 1%, 3^{rd} with 5%, 5^{th} with 10%, and 7^{th} with 5%, and arbitrary phase; the frequency is maintained in 50 Hz and the *S/N* ratio is 30 dB. As expected there is a very small disturbance in the estimation of the symmetrical components magnitudes; the instantaneous positive sequence is almost undisturbed.

In low-voltage grids another important phenomenon already referred is the occurrence of exponentially decaying DC components: if associated with low-frequency harmonics (e.g. caused by the switching of lightly filtered phase-controlled rectifiers) and noise they can severely affect the operation of any analyzer or protection relay. In order to show this condition and the robustness property of the enhanced DFT algorithm Figure 11 is presented. The used conditions are as follows: after *t*=0.098 s the voltage signal contains a decaying DC component with a time constant of 30 ms and the following harmonics: 5^{th} with 15%, and 7^{th} with 10%, and arbitrary phase; the frequency is 50 Hz and the *S/N* ratio is 20 dB. This is a severe condition; all the parameters related to power quality are affected: the positive and negative sequences vary during almost two grid cycles; the estimated frequency suffers a strong transient. Comparing with Figure 10 it can be concluded that these perturbations are mainly caused by the DC component; low-frequency harmonics and a certain noise level are quite well tolerated by the DFT algorithm.

The DFT algorithm is immune to harmonics, but only at nominal frequency; when there is a frequency deviation from the nominal value the presented DFT-based method is also capable of maintaining harmonics immunity as is demonstrated in Figure 12. Between *t*=0.2 s and *t*=0.3 s, the frequency goes to 48 Hz and the signal contains the following harmonics: 2^{nd} with 5%, 3^{rd} with 20%, 5^{th} with 20%, and 7^{th}, with 10%, and arbitrary phase.

Different noise types generated by electromagnetic interference, digital circuits or power electronics converters are always present in the acquired signals. Also, low frequency harmonics due to nonlinear loads or saturated magnetic circuits are common in the grid voltage. Figure 13 shows the noise rejection capability of the presented DFT-based method when the three-phase voltages contain the same harmonic level as in Figure 12 and are corrupted by non-correlated random noise with a signal to noise ratio as low as 20 dB between *t*=0.1 s and *t*=0.5 s, and 30 dB between *t*=0.6 s and *t*=1.0 s.

There is no noticeable perturbation in the amplitude detection or in the instantaneous positive sequence component estimation.

All the presented results are dependent on the imposed conditions; some can be managed in real experimental implementations like noise level and low frequency harmonic distortion. The others are uncontrollable: sags, swells, AC fluctuation, DC decaying components, frequency deviations and phase steps will occur in an unpredictable way and level. Any phasor estimation method should be prepared to deal with them guaranteeing appropriate dynamics, stability, precision and robustness; the presented method does.

## 5. Applications

As discussed in Section III.C and according to the diagram in Figure 1 and the flow diagram in Figure 2, the application of the DFT-based algorithm in the power quality domain can be divided into two categories: real-time operation and off-line processing. Hard real-time is used in the synchronization of power electronics converters like STATCOMS or FACTS, in phasor estimation or control and in protection functions. Nearly real-time processing (or off-line) is used in quasi-steady-state conditions to evaluate power quality parameters like symmetrical components estimation, voltage sags, swells and harmonics, [1, 26-27].

The extraction of harmonics is made according to (21). Like the fundamental component, the *h* order harmonic can be estimated using the absolute or recursive version of (21).

The algorithm is based on intensive data processing and uses trigonometric functions and nonlinear functions to estimate the power quality parameters. A fundamental issue arising in the case of harmonics detection is the number of samples needed (*N*); it must satisfy the Nyquist criterion and highly increases the number of operations (and the required time) needed to estimate a range of harmonics. However, the use of fast A/D converters in conjunction with FPGAs or DSPs allows an efficient solution to be used in spectrum and power quality analyzers, [1].

In case of variable frequency conditions (or frequency deviation) the power quality parameters are estimated in quasi-steady-state. Instead of using a constant and fixed sampling frequency a variable one is preferred and there are no errors due to a non-matched window.

As referred in [1], despite some issues (e.g. computational complexity, memory requirements, and data synchronization) it is predicted that new designs of PQ instruments will use the FFT algorithm.

## 6. Conclusions

Power quality monitoring and power systems control and protection need fast and accurate frequency and amplitude estimation. Also, instantaneous symmetrical components estimation with amplitude and phase detection is needed for power systems stability analysis. Phenomena like high amplitude voltage sags and swells, decaying DC components, phase and frequency deviations, harmonics and noise are becoming more frequent and more intense, especially in weak grids. The corrupted voltage is difficult to manage in all conditions.

In this chapter, the recognized robustness of the DFT algorithm is extended to handle this new and more demanding grid voltage behaviour. The main errors caused by large frequency deviations and DC decaying components occurring in the DFT algorithm are acknowledged and analyzed, and the associated corrections to deal with the referred parameters are presented. The results, obtained in very unfavourable conditions, shown that it is needed a careful signal conditioning and a computationally powerful control platform in order to obtain fast dynamics and high accuracy.

In terms of power quality monitoring, the enhanced DFT method is capable of detecting all related parameters: symmetrical components, voltage sags and swells, frequency deviations and a range of harmonics. Its use is a requirement imposed by some Standards but its specific implementation in each PQ instrument or protection device has different possibilities. The presented DFT-based method has improved capabilities namely substantially improves the robustness to decaying DC components and frequency deviations.

### Nomenclature

Δ*f* frequency deviation

ϕ phase reference

τ time constant of exponential component

ω angular frequency

*A* magnitude of exponential component

*a* complex operator: *a*=exp(*j*2π/3)

*b* operator: *b*=exp(-1(*f*_{o}*N*τ))

*e* error

*f*_{o} nominal frequency

*f*_{s} sampling frequency

*N* number of samples per period

*PS* power sum

S_{120}, S_{240} time delay operators

*S*/*N* signal to noise ratio

*X* magnitude of input signal

x(t) continuous input signal

x_{c}(k) corrected samples

v_{a}(t), v_{b}(t), v_{c}(t) phase-neutral voltage, phases a, b, c

v_{a}^{p}(t), v_{b}^{p}(t), v_{c}^{p}(t) positive sequence, phases a, b, c

v_{a}^{n}(t), v_{b}^{n}(t), v_{c}^{n}(t) negative sequence, phases a, b, c

v_{a}^{0}(t), v_{b}^{0}(t), v_{c}^{0}(t) negative sequence, phases a, b, c

## Acknowledgments

The Author wishes to thank José Miguel Ferreira for helpful discussions related to this work.