A Novel Single-Phase Reactive Current Detection Algorithm Based on Fast Orthogonal Signal Generator and Enhanced Moving Average Filter

: This paper developed a novel single-phase reactive current detection algorithm based on fast orthogonal signal generator (OSG) and enhanced moving average ﬁlter (MAF), overcoming the limitation of conventional schemes in detection speed, computation burden and noise/harmonic immunity. A fast and accurate OSG scheme is introduced ﬁrst, which can remarkably improve the precision and response speed of the developed detection scheme. In d-q frame, the enhanced MAF is developed and its optimal design principle is also presented, which can sufﬁciently eliminate the noise and harmonics while achieve the possible shortest response time, particularly in the case of selective harmonics cancellation. Finally, high-performance single-phase STATCOM control is realized utilizing the proposed method. Experiments reveal that the proposed detection scheme exhibits fast speed, high precision as well as noise/harmonics immunity, providing satisfactory control performances.


Introduction
Reactive power transmission in power grids increases energy loss and leads to low network efficiency, hence reactive power needs to be compensated locally. Cascaded static synchronous compensator (STATCOM), which is featured with remarkable reactive-power compensation performance as well as grid voltage stabilization in high-voltage grids [1], is the key equipment in smart grid and, hence, has attracted widespread attention. Current research works and applications mainly focuses on the 3-phase grids [1][2][3]. The single-phase STATCOM is also utilized to compensate the single-phase reactive loads or when an individual phase should be considered [3][4][5][6].
Fast and accurate reactive current detection is a key issue for the STATCOM control. Fryze methods [7], Fast Fourier Transformation (FFT) methods [8] and the instantaneous reactive power detection methods [9][10][11][12][13][14] are three main schemes. Fryze methods are based on the calculation of average power and require reactive current integral in one period; hence these methods exhibit weak real-time performance [7][8][9][10][11]. FFT methods extract the amplitude, frequency and phase of each harmonic in frequency domain, and can ensure the high accuracy on condition that the sampling frequency is bigger than the Nyquist frequency. However, the fundamental reactive current cannot be intuitively obtained and must be acquired by some other methods [10][11][12]. Besides, these algorithms need two FFT processes, causing long detection time and thus weak real-time feature. Detection schemes based on the instantaneous reactive power theory proposed by Professor Akagi is commonly used in 3-phase grids [6]. However, the application in single-phase grid requires the construction of virtual phase (a-b-c) signals or virtual orthogonal (α-β) signals, in which the detected load current serves as one signal and the other signals require proper generation algorithms. The construction of virtual a-b-c signal utilizes the three-phase grid symmetry in time domain and has a time delay of 1/3 grid cycle. The virtual α-β signal construction, however, utilizes the detected load current as the β-axis signal and can calculate the reactive current by Park transformation. Therefore, the orthogonal signal generator (OSG) is very important and many solutions have been carried out [10][11][12][13][14]. Masoud et al. [10] delayed the current phase by 90 • to generate the orthogonal signal, causing a time delay of a quarter cycles. The improvement developed by [11] utilizes an arbitrary given delay to construct the orthogonal signal. Unfortunately, the detection precision is dependent on the delay time, besides the calculation is cumbersome and multiple low-pass filters (LPFs) are introduced, leading to high implementation complexity. The first-order differential operation proposed in [14] can generate the orthogonal signal quickly. However, the random noise in the sampling will be amplified by such operation. Xiong et al. [15] recently presented a novel OSG algorithm featured with noise immunity and high accuracy. In addition, eliminating the effect of harmonics is another important issue, which is usually achieved by adding one or more LPFs [16,17]. However, the response speed is usually limited to deal with the high-content and low-order harmonics in the utility signal. Moving average filter (MAF) is beneficial for filtering out the periodical noise [18]. The harmonic can be viewed as the periodic noise and can be eliminated by the MAF with proper window length. Obviously, the cascaded MAF (CMAF) blocks with different time delays can eliminate several harmonics. However, such CMAF inevitably cause the long-time delay, failing to meet the fast response requirement for STATCOM. Achieving the shortest possible response time for eliminating specific harmonics is a key issue.
Overcoming the limitation of conventional Park transformation-based algorithms, a novel reactive current detection algorithm based on the proposed Enhanced MAF (EMAF) and the recently published OSG algorithm, with fast and accurate properties, is developed in this paper, guaranteeing the fast response performance. The proposed EMAF algorithm with only one block can eliminate a group of harmonics in the shortest possible response time. Experimental results based on a single-phase STATCOM validate the proposed scheme, achieving the desired control performance. Figure 1 illustrates the developed single-phase reactive current detection scheme in d-q frame. The cascaded EMAF block and OSG algorithm block promise the expected high-performance. The single-phase grid voltage can be expressed as:

Proposed Single-Phase Reactive Current Detection Method in d-q Frame
where U m and ω s are the voltage amplitude and frequency, respectively. The single-phase load current yields: where I m and θ are the load current amplitude and phase angle, respectively. The orthogonal signal of i(t) is given by: The load current in (2) can be utilized to construct the orthogonal signal and the corresponding α-β frame expression can thus be obtained as: The transformation from α-β frame to d-q frame yields: where the transformation matrix is given by: Accordingly, substituting (6) into (5), we can deduce that: The instantaneous load current can be regarded as the sum of the active current component i p and the reactive current component i q , which are the projections of the load current in (2) on the dand q-axis, respectively. Therefore, we can deduce that: Accordingly, i p and i q can be expressed as: Obviously, generating the orthogonal signal precisely and rapidly is of paramount importance for the developed reactive current detection scheme (see Figure 1). Filtering the interfering signals (noise/harmonics) completely and rapidly is another important issue that should be addressed.
It is apparent from Figure 1 that the overall response time of the developed reactive current detection is determined by the OSG block and the filtering block simultaneously and yields: Consequently, the dynamic response speed of OSG block as well as filtering block must be improved to obtain a faster detection speed.
It is noted that the interfering signal imposed on the generated orthogonal signal can be filtered out by the subsequent filtering block (e.g., the EMAF block in d-q frame). The original signal includes interfering signals and both the original and amplified interfering signals should be filtered out in the subsequent EMAF block (see Figure 1), hence it's unnecessary to overdesign the OSG filtering ability.

Fast OSG Scheme
Delaying the input signal by 1/4 cycles [10] and differentiating the input signal [14] are two typical OSG schemes. The latter is merely an approximation of orthogonal signal. Besides, the noise in the sampling is evidently amplified, and will be more severe with the increase of sampling frequency f s [15]. In a special case when f s is 10 kHz, the noise will be amplified by 32 times. Hence, in practical applications, the 1/4 period delaying method is preferred. However, this method requires time delay of a quarter grid cycle, leading to slow dynamic feature. To surmount the disadvantages of the above methods, a novel OSG algorithm for single-phase grid was presented in [15], which is firstly introduced into the developed reactive current detection scheme.
Firstly, (4) can be rearranged as: Accordingly, By combining (12) and (13), the new OSG scheme can be described as: It is noted that this OSG method is obtained by rigorous mathematical deduction and no simplification is made during the process, i.e., the calculation result in (14) is precisely equivalent to the theoretical value and independent on the sampling frequency. On the contrary, amplitude and phase errors are imposed on the results obtained from the differentiating method and will be increased significantly with the decrease of sampling frequency. Accordingly, the differentiating method is unavailable in low sampling frequency systems, while the new algorithm in (14) is free from the sampling frequency and is feasible for broad sampling frequency band. This serves as the predominant advantage compared with the differentiating scheme.
It is noted that the random noise is also amplified by the new OSG algorithm. Considering the noise, (14) should be revised as: In (15), where k is the maximum noise amplification factor of the new OSG method in the worst condition.
It's apparent that the new OSG method is also noise sensitive. Therefore, decreasing f s is essential for limiting the noise amplification effect (note that the high accuracy of constructed orthogonal signal has nothing to do with the sampling frequency for the new method).
Let ∆T in (14) be replaced by K∆T (see Figure 2), accordingly (16) can be rewritten as: Figure 3 shows that the amplification factor decreases obviously with K. For a good compromise, K is designed as 20 in this paper and the response time of OSG block is 2 ms accordingly [15]. The possible maximum noise amplification factor is 3 and the remaining noise can be attenuated sufficiently by the proposed EMAFs that are set in subsequent d-q frame.  To verify the noise immunity of the introduced OSG algorithm, a simulation example is illustrated. In this example, the simulated single-phase signal contains 1.0 p.u. ideal sinusoidal component and 0.05 p.u. random noise. Figure 4 shows the results of d-and q-axis components generated from the quarter-cycle delay scheme and the new OSG algorithm, respectively. Because the quarter-cycle delay method does not amplify the noise of the sampled single-phase signal, the d-and q-axis components generated by it (red waves in Figure 4) are used as references to evaluate noise immunity of the developed algorithm.
The d-and q-axis components before filtering are illustrated in Figure 4a,b, respectively. Compared with the red waves, the noise signals are amplified slightly with the developed algorithm. However, it's apparent that the issue of noise amplification is not such serious as (16) indicates, since (16) is obtained for the worst situation but not for most cases. The peak values of the noise amplitude are 0.05 p.u. and 0.055 p.u., for the quarter-cycle delay scheme and the developed OSG algorithm respectively. The amplified noise can be eliminated thoroughly by a low-bandwidth LPF or an EMAF block in Figure 1. The noise amplitude of the proposed algorithm after filtering (see the black curves in Figure 4c,d) is lower than that of the quarter-cycle delay method. Consequently, the final d-and q-axis components (black waves) are smooth enough.
Therefore, the introduced OSG scheme does not amplify interfering signals, and it maintains high precision of generated orthogonal signal (its accuracy is irrelevant to the sampling frequency) on the condition that computational burden is not increased significantly. The response time is within 2 ms, which is important for achieving fast reactive current detection in single-phase grid.

Harmonic/Noise Filtering
A better noise/harmonic filtering capability, which is also the essential requirement of the reactive current detection algorithm, is necessary for industrial applications. Traditional solutions mainly comprise of LPF, delayed signal cancellation (DSC) and MAF. If a LPF is utilized to sufficiently suppress the low order harmonics, the response time of overall reactive current detection algorithm will be apparently increased. The DSC algorithm responds fast to input changes; however, harmonics cannot be eliminated thoroughly and detection errors could be introduced with improper sampling frequency and grid frequency deviation [19]. MAF is an effective solution for random noise elimination. Harmonics, which can be regarded as periodic interfering signals, can as well be effectively suppressed by MAF. The optimal design of moving average window length, which is of paramount importance in obtaining the possible minimum response time when several harmonics are designated to be suppressed, is proposed as follows.

Principles of Harmonic Elimination with MAF
For sake of simplicity, MAF n denotes the MAF eliminating the nth harmonic. Assume T n is the nth harmonic period and yields ∆T T n . The model of MAF subjected to the nth harmonic can be expressed as [20] X n (k) where the window length L n is given by where round[·] is the round function (rounded to the nearest integer). Rewriting (19) yields Based on (20), the practical MAF algorithm for the nth harmonic, which is denoted by MAF n , can be obtained, as shown in Figure 5. If several harmonics need to be eliminated (see Figure 6), the cascaded MAF (CMAF) scheme can achieve such target. The response time of CMAF is the sum of all the MAFs in cascade. It is apparent that the response time increases with the harmonics, leading to weak response performance of reactive current detection. To address this issue, the Enhanced MAF (EMAF) scheme, which can eliminate several given orders of harmonics as well as suppressing random noise by only one filter block (see Figure 6), is proposed in this paper.

Enhanced MAF and Optimal Window Length Design
Extending the window length of MAF n to Z n L n (Z n = 1, 2, 3 . . . ), (18) can be rearranged as: According to (21), the nth harmonic can be eliminated thoroughly if the window length is an integer multiple of the sample number in a period.
According to (21) and its conclusions, it yields: ∀n ∈ Z + : Equation (22) is the necessary and sufficient condition that an EMAF can eliminate the nth harmonic. In (23), the window length L EMAF is the lowest common multiple of the window length of corresponding MAF blocks. Therefore, L EMAF can be given by In the following special cases, it holds that (T is the grid cycle): The response time for eliminating all the even harmonics and all the odd harmonics are T/2 and T, respectively; The response time for eliminating all the harmonics is T.
It is noted that the real-time grid frequency can be captured directly by the existing single-phase PLL schemes if needed. Generally, grid codes enforce that the grid frequency fluctuation should not less than a certain value. Take State Grid Corporation of China as an example, the acceptable frequency fluctuation is ±0.2 Hz for the large grid (>3000 MW) and ±0.5 Hz for the small grid (<3000 MW). That being said, the utility grid can be viewed as a constant frequency power source. Therefore, to make the actual operation easier, the grid frequency fluctuation issue is not considered in this paper and the conclusions of neglecting the grid frequency fluctuation can satisfy most utility scenarios.

Single-Phase STATCOM Based on the Developed Reactive Current Detection Algorithm
In the following experiments, the proposed reactive current detection method was performed on a single-phase cascaded STATCOM, which comprise of Cascaded Multilevel Inverter (CMI) in series [21], as illustrated in Figure 7. Four identical H-bridge inverters compose the CMI and the carrier phase shifted SPWM method is utilized. C dc is the DC-side capacitance and u dcµ (µ = 1, 2, 3, 4) is the DC capacitor voltage. Besides, the DC voltage balance control is achieved by a parallel DC-side resistor R dc . The main parameters are given in Table 1.  Direct current control strategy [21] is utilized for cascaded STATCOM, as shown in Figure 8. Besides, the DC capacitor voltage control contains the equivalent DC voltage U CMI control and the DC voltage balance control. The current reference contains the detected reactive current i q and the active current i p given by the DC voltage control. The equivalent DC-side voltage U CMI yields [22]: where U dc is the reference DC capacitor voltage, N is the H-bridge inverter number in a CMI.

Experimental Verification
Experiments based on a signal generator and a single-phase cascaded STATCOM were carried out to verify the proposed reactive current detection algorithm based on the developed enhanced MAF algorithm and the recently published fast OSG scheme. The power circuit of cascaded STATCOM was implemented on the RTLAB platform and the control circuit was conducted by a TMS320F28335 DSP based control system. The sampling frequency is 10 kHz.

Experimental Verification Based on Signal Generator
Experimental signals (grid voltages and load currents) were simulated by a DSP controller (DSP A). Reactive current detection algorithm was implemented by DSP B, which also generate the active/reactive current calculated by the developed algorithm, as shown in Figure 9. For the convenience of observing experimental results, D/A converters were added to output the analog signals of the sampled grid voltage, load current and the calculated results (the active component, the reactive component and the harmonic component). Figure 10 illustrates the experimental results of the developed reactive current detection algorithm. The 3rd harmonic amplitude is 0.35 p.u. and the 5th harmonic amplitude is 0.35 p.u. These two harmonics are imposed on the load current and the fundamental component amplitude decreases from 1.0 p.u. to 0.3 p.u. The fundamental current phase leads grid voltage by 45 degrees after change. Figure 10a-c show the calculated active, reactive and harmonic components, respectively. Figure 10d demonstrates the calculated d-axis component of the load current.
Experimental results indicate that the instantaneous active, reactive and harmonic components can be precisely captured from the load current by both the conventional method and the developed algorithm. The main difference lays on their response times, which are about 18 ms and 8 ms, respectively. The significant performance in dynamic response time, for the developed algorithm, attributes to the fast OSG and enhanced MAF which ensure achieving the possible shortest response time.

Experimental Verification Based on STATCOM
The system configuration of the experiment is shown in Figure 8 and the main parameters are given in Table 1. Figure 11 presents the experimental results of the single-phase cascaded STATCOM when the load current has a sudden change. Figure 11a,b present the experimental results in the case of load change. The developed algorithm can trace the active component and the reactive component of the load current precisely.   Figure 11c shows the output current can trace the reference signal precisely and the STATCOM has remarkable steady-state performance and quick dynamic process. Figure 11d shows the unity power factor on the grid side is achieved and, the grid voltage and current are always kept in phase regardless of the load current disturbance. Therefore, the single-phase STATCOM has achieved the high-performance control with the proposed reactive current detection algorithm.
Obviously, all the experimental results have verified the effectiveness and the advantage of the developed reactive current detection algorithm.

Conclusions
Extracting the reactive component from the load current quickly and precisely is of utmost importance for the single-phase STATCOM control. To tackle the dynamic speed and distortion susceptibility of conventional methods, a novel reactive current detection algorithm based on the developed enhanced MAF and the recently published fast OSG scheme is proposed. The introduced OSG algorithm is featured with fast response and strong robustness with respect to interfering signals. More importantly, the accuracy of the new OSG algorithm is free from the sampling frequency and it is feasible in a wide sampling frequency range. The developed enhanced MAF can thoroughly eliminate the noise and harmonics, which can achieve the possible shortest response time. Experimental results have verified the correctness and the advantage of the proposed detection algorithm.