## 2 \(p\)-\(q\) Method Using Clarke Transform for Three-, Five-, and Two-Phase Systems
### Using Digital Filtering  
The transfer function of a digital filter is formally similar to any system transfer  
\[H(z)=\frac{b_{0-n}.z^{-n}}{a_{0-n}.z^{-n}}, \tag{12}\]  
where sequence \(f\{a_{0-n}\}\) represents input signal and \(f\{b_{0-n}\}\) output one. It is, therefore, relatively easy to use a filter to extract the fundamental frequency of real and reactive power components. Properties of a stable digital filter type of the finite impulse response (DFIR) show its frequency characteristics, in Figure 2.  
Figure 1: Principal time-waveform of \(P_{av}(k)\) by using of MAF method: step \(k=0.5\ \mathrm{ms}\), length of sliding window \(l=T/2=0.01\ \mathrm{s}\). Comparison between DFIR and MAF  
The frequency characteristics of a moving average filter method (MAF) are shown in Figure 3.  
Using of digital infinite impulse response filter (DIIR) can lead to instability [15; 16]. On the other hand, its advantage can be better (faster) attenuation of higher harmonics. Similarly, using the Butterworth filter of 4 th order gives good results regarding harmonics attenuation [11]. A comparison of power waveforms worked out by MAF-, DFIR and DIIR filters in the time domain is shown in Figure 4a,b, respectively. The choice of filter is a compromise: the DC term must be passed, and the double frequency term rejected. A sharp, high-order filter will give a long-step response, whereas a low-order filter will give poor separation of the terms and imperfect current cancellation. The resulting system usually has a response time of 2-3 main cycles. So, regarding the  
Figure 4: Comparison of power waveforms calculated by different methods MAF and direct function in the time domain \(p(t)\) and \(q(t)\)—(**a**), DFIR and DIIR filters for \(P_{av}(k)\) and \(Q_{av}(k)\) —(**b**). Figure 3: Amplitude—(**a**) and phase—(**b**) frequency characteristics of MAF filter. Figure 2: Amplitude—(**a**) and phase—(**b**) frequency characteristics of DFIR filter. speed of calculation and accuracy, we have decided on MAF, although the principal results of both of them are very similar (see Figure 4a,b). After worked-out the DC power components \(P_{av}\) and \(Q_{av}\), we can easily calculate AC components \(p_{ac}(t)\) and \(q_{ac}(t)\). \[p_{ac}(t)=p(t)-P_{av}(k), \tag{13a}\] \[q_{ac}(t)=q(t)-Q_{av}(k). \tag{13b}\]  
Now, we can determine all components of power, including the power factor  
\[S_{av}(k)=\frac{3}{2}\big{[}U_{a,rms}(k)I_{a,rms}(k)+U_{\beta,rms}(k)I_{\beta, rms}(k)\big{]} \tag{14}\]  
Figure 2.0  
Figure 2.1  
Figure 2.2  
where \(P_{ac,rms}(k)\), \(Q_{ac,rms}(k)\) are determined by the integral calculus of \(p_{ac}(t)\) and \(q_{ac}(t)\)  
Figure 2.3 Figure 2.4  
Or we can use classical relation  
Figure 2.5  
when a moving average method should be applied to provide the results in each computation (integration) step \(k\). The power factor is defined as the relation between \(P_{av}\) and \(S_{av}\), thus  
Figure 2.6  
Regarding total harmonic distortion, it can be calculated by the definition of IEC standards [21] using harmonic analysis or rms values of the sum of higher harmonics \(Y_{\Sigma\
u rms}\) and total quantity \(Y_{rms}\)  
Figure 2.7 Figure 2.8  
Another approach uses the Cauchy method of residues [22]; for impulse system quantities using infinite series [23]. Relation (21b) can be adapted for input current (under harmonic voltage). See derivation (32). Figure 2.9The maximal limit for total harmonic distortion for the input voltage is recommended at 5% (by IEEE standard [24]), with the largest single harmonic being no more than 3% of the fundamental voltage. So, now each power component can be determined in any computation step (\(k\)). Further, using Fourier analysis, applied to active \(P_{av}(k)\), or reactive \(Q_{av}(k)\) power components, we obtain the active and reactive power of the fundamental harmonic \(P_{1 av}(k)\) and \(Q_{1 av}(k)\), and at the same time \(\cos\varphi_{1}(k)\)-power factor of fundamental and \(\sin\varphi_{1}(k)\), respectively.