INTERNATIONAL TRANSACTIONS ON ELECTRICAL ENERGY SYSTEMS Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 Published online 19 July 2012 in Wiley Online Library (wileyonlinelibrary.com). DOI: 10.1002/etep.1656 Real-time application of shunt active power filter dynamic compensation using real-time windows target H. A. Ramos-Carranza1*,†, A. Medina1 and G. W. Chang2 1 Universidad Michoacana de San Nicolás de Hidalgo, 58030 Morelia, México 2 Nacional Chung Cheng University, 621 Chia Yi, Taiwan R.O.C. SUMMARY In this contribution, a control strategy in phase coordinates abc is proposed as the reference current generator to be used by the shunt active power filter (APF) compensation device. The development of the proposed reference current generator is described in detail. Its control design is kept simple, and transformation between different frameworks is not needed, thus allowing the control strategy to be applicable for both three-phase and single-phase electric systems maintaining theoretical and practical advantages. The proposed control strategy for the reference current generator is tested using Matlab/SimulinkW with the incorporation of the Real-Time WorkshopW for the simulation of the shunt APF compensation in real time. Based on the reported real-time application, it is possible to obtain simulation conditions that are close to the true real-time environment under study using only a single computer, giving accurate results with relatively low-cost hardware and providing a more complete evaluation of the applied control strategy. The dynamic behavior and performance of the shunt APF, using the proposed reference current calculator, have shown remarkable results. Copyright © 2012 John Wiley & Sons, Ltd. key words: active power filter; reference current generator; real-time application; real-time windows target 1. INTRODUCTION The continuous increase in the incorporation of power-electronic converters and controllers for industrial processes and drives, and other types of nonlinear loads connected to the power system, has come together with different associated power quality problems, such as it is the harmonic distortion of current and voltage waveforms [1]. In particular, the shunt active power filter (APF) has demonstrated to be an appropriated tool for the mitigation of harmonic currents and reactive power compensation [2–8]. The shunt APF has four main stages clearly identified that allow the compensation process: (1) The reference current generator. The reference filtering currents are obtained/computed accordingly to a chosen control strategy to achieve that purpose. (2) The current controller. Once the reference filtering currents are calculated, these are used by a current controller technique, usually a pulse-width modulation (PWM) controller technique, which generates the switching control signals for operating a power-electronic converter. (3) The power-electronic converter. Usually, a voltage-source inverter (VSI) is used to reproduce the actual currents, as close as possible to those calculated as the reference, to be injected into the electric system. (4) PI controller. The dc voltage of the power-electronic converter must maintain a constant dc voltage in order to allow the correct performance of the shunt APF during compensation. Due to harmonics and switching, the dc voltage in the dc side of the electronic converter slightly fluctuates, and a PI controller is used to control and compensate this variation by adding a control signal. *Correspondence to: H. A. Ramos-Carranza, Universidad Michoacana de San Nicolás de Hidalgo, 58030 Morelia, México. † E-mail: aramos@faraday.fie.umich.mx Copyright © 2012 John Wiley & Sons, Ltd. 1290 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG In addition to these four stages, an inductive element is placed between the power system and the converter, e.g. a coupling transformer. The inductive element is used as an energy link and the actual filtering currents flow through this element to the power system performing the corrective measure and achieving in this way the compensation of reactive power and the mitigation of harmonic distortion. In particular, the current reference generator, described above as the first stage in the compensation process, is of vital importance in the final performance that the shunt APF is able to provide. Performance comparisons of different control strategies used to implement the reference current generator can be found in [3–6]. Under the shunt APF compensation scheme, the implemented control strategy to compute the reference filtering currents should guarantee the generation of the correct reference for the shunt APF, at all times during the compensation process, in order to obtain the desired results. Even more, the correct reference should be generated in spite different compensation scenarios (e.g. dynamic compensation due to load variations) and operation system conditions (e.g. harmonic distortion/unbalance in the source voltages) that could be present in the electric system during shunt APF compensation. In addition, the control strategy used as the reference current generator should have other important characteristics. First, the APF should not consume/supply active power [5]; its compensation mechanism does not require active power. Second, feasibility of physical implementation implies the reasonably affordable computational demand required by its internal algorithm for computing the reference currents. All these ideas mentioned above, and previous reported work associated to the particular matter [7,9], have motivated the authors to develop a control strategy to calculate the reference filtering currents of a shunt APF. The proposed control strategy presented in this manuscript is developed to be able to handle steady-state and/or dynamic compensation in either 3F-4W or 3F-3W systems. Furthermore, the reduction of the developed control strategy from the three-phase system to a single-phase system can be implemented in a direct fashion, keeping theoretical and implementation design principles in the process as there is no need of transformation between reference frameworks involved. In the same workflow, one of the main targets during the control strategy design process was to find a control strategy that can be identified as efficient, simple, and be remarked as suitable for further/possible physical implementation of the compensation device, increasing the feasibility of its implementation. To validate the performance of the developed control strategy for computing the reference filtering currents, and its reasonable affordable computational demand required for the implementation of its internal algorithm, the authors have opted for testing it with a real-time application. With the growing importance of power quality problems to electric utilities and customers, there is an increasing interest on the search of new techniques for accurate analysis and resolution of such problems [10,11]. The real-time simulation techniques are used for several studies of power systems containing nonlinear loads. Available literature details several techniques developed and implemented to perform real-time simulations in power system analysis [10,11]. These real-time implementations allow the evaluation of several conditions to be tryout before the hardware is built. In this manuscript, the real-time simulation of the shunt APF compensation is developed with the incorporation of the Real-Time Windows Target (RTWT) toolbox of Matlab/Simulink [12], which is used as a PC solution for prototyping and testing the real-time system. Under this real-time simulation environment, a single computer is used as a host and target [12,13]. This real-time application makes possible the observation and evaluation of simulation conditions close to the true real-time environment under study using a single computer, it gives accurate results with relatively low-cost hardware, and also it provides a more complete evaluation of the applied control strategy during the calculation of the reference filtering currents. The complete details of the developed control strategy, the real-time implementation of the case study, and the dynamic operation and analysis performance of the shunt APF using the proposed control strategy are given in the sections to follow. In Section two, the derivation of formulae for computing the reference filtering currents by the proposed control strategy is given in detail. Section three provides the basis of the implementation procedure for the real-time simulation. The control strategy performance presented in this manuscript is illustrated for dynamic compensation in a three-phase four-wire system with harmonic content highly heterogeneous in phases a, b, c, as this will be shown with a case study in Section four. The main conclusions obtained as a result of this investigation work are given in Section five. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1291 2. CONTROL STRATEGY FOR THE DERIVATION OF THE REFERENCE FILTERING CURRENTS The reactive power compensation and harmonic distortion mitigation using the shunt APF compensation device should be efficient. Once the shunt APF is in operation, the source currents should be balanced, without harmonic distortion, and it should compensate reactive power. The proposed control strategy for the calculation of the reference filtering currents works as a sinusoidal source current method, calculating the desired source currents (i.e. the source currents we want to have once the shunt APF is in operation) and subtracting them from the actual load currents in order to obtain the reference filtering currents, e.g. ifk ðt Þ ¼ ilk ðt Þ isk ðt Þ k ¼ a; b; c (1) Where ifk ðt Þ are the instantaneous reference filtering currents, ilk(t) are the instantaneous load currents, and isk ðt Þ are the instantaneous desired source currents. Figure 1 shows a schematic diagram of a three-phase four-wire electric system with a shunt APF connected to the electric network. Once the source currents and source voltages are measured, the reference filtering currents are calculated, and the APF injects the actual filtering current of compensation. The control strategy for computing the reference filtering currents is based in two main assumptions: First, the amplitude of the source currents should be the same, i.e. Im ¼ Ima ¼ Imb ¼ Imc (2) Second, the source currents should be in phase with the source voltages at each phase respectively, i.e. θisk ¼ θuk ðk ¼ a; b; cÞ (3) In addition, after accomplishing the above assumptions, the total average power delivered to the load should be supplied only from the source with equally contribution by the three phases a, b, c. Then, the total average power PT, supplied from the source to the load, can be expressed according to Equations (4)–(5). 1 PT ¼ T ZT ua ðt Þisa ðt Þ þ ub ðt Þisb ðt Þ þ uc ðt Þisc ðt Þ dt (4) 0 PT ¼ Uma Ima Umb Imb Umc Imc þ þ 2 2 2 (5) Figure 1. Schematic diagram of the shunt APF connected to the electric network. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep 1292 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG Where Umk and Imk are the amplitudes of the instantaneous source voltages and the desired source currents for k = a, b, c. Following the assumption in Equation (2), the total power delivered to the load in Equation (5) now can be expressed as, ðUma þ Umb þ Umc Þ Im (6) PT ¼ 2 From Equation (6), it can be seen that the amplitude of the desired source currents at each phase is given by, Im ¼ 2PT UmT (7) Where UmT = Uma + Umb + Umc. Finally, a unitary signal of reference, derived from the measured source voltage, is included to the source currents amplitude so that the desired source currents are calculated as 2PT uk ðt Þ k ¼ a; b; c (8) isk ðt Þ ¼ UmT Umk The term within the parenthesis on the right-hand side of Equation (8) is the instantaneous unitary signal which gives the phase to the desired source current, respectively, for each phase, so that the assumption in Equation (3) holds. So far, the instantaneous source voltages uk(t), used in Equation (8) to incorporate the instantaneous unitary signal, are assumed to be free of harmonic distortion and phase balanced, i.e. purely sinusoidal and balanced three-phase source voltages. If Equation (8) is applied as a part of the procedure for calculating the reference filtering currents, and the source voltages uk(t) have presence of harmonic distortion and/or phase unbalance, the resulting performance on the calculation of the desired source currents isk ðt Þ would be really poor and erroneous [2,3]. And, as stated in Equation (1), the calculation of the reference filtering currents will be erroneous as well. It is easy to notice that the waveform of the desired source current, isk ðt Þ in Equation (8), will have the same shape in its instantaneous waveform as the instantaneous unitary signal waveform, which in turn will have the shape of the waveform of the source voltages uk(t), respectively, at each phase k. The erroneous calculation of the reference filtering currents due to presence of nonsinusoidal source voltages has been documented and reported in the literature [2,3], where for instance, the formulation in Equations (8) and (1) to obtain the reference filtering currents can be regarded as the synchronous current detection method [8], as evaluated and analyzed in [5]. Similar difficulties can be observed in other methodologies no matter the use or not of a transformation between different frameworks [4]. For practical reasons, the control strategy should be developed assuming that the source voltages may be harmonic distorted and/or unbalanced. Moreover, despite the harmonic content or unbalance that might be present in the source voltages, an adequate performance in the calculation of the desired source currents isk ðt Þ and reference filtering currents ifk ðt Þ must be achieved by the control strategy. To tackle the aforementioned problem, in this contribution, it is proposed the use of reference signals uk ðt Þ, instead of the actual source voltages signals uk(t), in Equation (8). These reference signals uk ðt Þ should be obtained by post-processing the data of the actual measured source voltages. The procedure has the following two main targets: First, to avoid harmonic distortion that could be present in the measured source voltagesuk(t), i.e. to obtain the reference signal voltages uk ðt Þ at each phase that will always be purely sinusoidal. Second, to avoid phase unbalance that could be present in the measured source voltages uk(t), i.e. the reference signal voltages uk ðt Þ will always be phase balanced. In summary, the two-aim procedure guarantees the reference signal voltages uk ðt Þ as three-phase pure sinusoidal and balanced signals. So that once the new instantaneous unitary signals uk ðt Þ=Uk are formed using the reference signals uk ðt Þ, the unitary signals of reference will have the desired characteristics that will allow the correct calculation of both the desired source currents and the reference filtering currents. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1293 2.1. Obtaining the reference source voltages At this stage, the goal is to extract the fundamental component information from the measured source voltages and then process the information to form the reference source voltages to be used in Equation (8). Diverse applications and studies require the determination of the phase and amplitude of the voltage at fundamental frequency. These variables are needed for the determination of the reference signal for the active filtering, the detection of peak voltages for VAR compensation and for the extraction of power at fundamental frequency for the transient stability evaluation [14–19]. To obtain the fundamental frequency of the source voltages, the measured data could be treated according with the techniques described next. 2.1.1. Least-squares fitting. This curve fitting method uses least-squares error estimation to find the amplitude and the angle of the fundamental component. Curve fitting selects the best fit of a curve to a waveform and measures the discrete residual values between the waveform and the fitted curve. The size of these residuals is measured by the addition of their squared values. This is then minimized to obtain the least-square error, and the amplitude and phase of the best fitted curve are calculated. In particular, this method has been reported as an appropriated alternative for a real-time monitoring and analysis of harmonic variations incorporating the use of neural nets for the improvement of computational demand and efficiency [17–19]. 2.1.2. The Fourier transform. Fourier analysis is used to convert time-domain waveforms into their component frequencies and vice-versa. In practice, data are often available in the form of sample time function, represented by a time series of variable amplitude, separated by fixed time intervals of limited duration. Discrete Fourier transform (DFT) or its variant the fast Fourier transform (FFT), are usually used for this purpose. The frequency components provided by the DFT or FFT are time independent; in fact, for stationary signals these components remain the same over time. However, this is very different if the voltage waveforms are non-stationary, where the use of a Fourier transform alone becomes inadequate. A suitable way to extract such information is to apply an innerly related time-frequency signal decomposition. Therefore, for the development of the proposed reference current generator, a discrete short-time Fourier transform [14], often referred to as the sliding-window DFT, is used for the time-frequency decomposition of non-stationary signals, i.e. for the extraction of the fundamental component of the source voltages. It is important to notice that any other technique for the extraction of the fundamental source voltage component, which represents a viable option, could be incorporated for this purpose into the control strategy. Once the fundamental component information has been extracted from the source voltages, a phase-locked technique (PLT) is proposed to ensure symmetry in the desired source currents. At difference of a phase-locked loop, which is generally built with a phase detector, a low-pass filter and a voltage controller oscillator placed in a negative feedback closed-loop configuration, for the PLT described next, it is only required to identify the phase angle of one of the phases of the source voltage. Such information, i.e. the fundamental frequency source voltages information, has been already obtained with any of the techniques described above, so that the application of the PLT does not require extra processing of data. 2.1.3. Phase-locked technique. If asymmetry is present in the obtained source voltages at fundamental frequency, and the shunt APF is placed to compensate harmonic currents and reactive power in a three-phase four-wire electric system, it will result in the presence of a relatively high neutral current. To avoid this problem, it is proposed to apply a 120 positive sequence phase shift over the reference voltage signals once the fundamental frequency source voltage information is obtained. This is achieved by detecting the phase angle of the phase selected as the reference, e.g. phase a, and adding or subtracting 120 to the other two phases. At the end of the two-aim procedure described above, the reference voltage signals to be used for the calculation of the desired source currents are now of the form given in Equations (9)–(11). ua ðt Þ ¼ Uma1 sinðot þ fa1 Þ Copyright © 2012 John Wiley & Sons, Ltd. (9) Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep 1294 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG ub ðt Þ ¼ Umb1 sinðot þ fa1 2p=3Þ (10) uc ðt Þ ¼ Umc1 sinðot þ fa1 þ 2p=3Þ (11) where uk ðt Þ are the reference voltage signals, Umk1 are the amplitudes of the source voltages at fundamental frequency, and ’a1 is the angle of the fundamental component of the source voltage at phase a. The substitution of Equations (9)–(11) into Equation (8) gives the proposed formulation to find the desired source currents, e.g. isa APF abc ðt Þ ¼ 2PT Uma1 sinðot þ fa1 Þ UT Uma1 (12) isb APF abc ðt Þ ¼ 2PT Umb1 sinðot þ fa1 2p=3Þ UT Uma1 (13) isc APF abc ðt Þ ¼ 2PT Umc1 sinðot þ fa1 þ 2p=3Þ UT Umc1 (14) Since the power losses caused by switching and capacitor voltage variations must be supplied by the source, a power signal Ploss is added to the power delivered to the load. Thus, taking the above into consideration and according to Equations (6)–(7), the amplitude of the desired source currents including power losses is redefined and given as, Im ¼ 2ðPT þ Ploss Þ UT (15) where Im is the amplitude of the desired source currents including power losses. Therefore, the reference filtering currents for phases a, b, and c are found by the arrangement of Equation (15) into Equations (12)–(14) and then using Equation (1), ifa ðt Þ ¼ ila ðt Þ Im sinðot fa1 Þ (16) ifb ðt Þ ¼ ilb ðt Þ Im sinðot þ fa1 2p=3Þ (17) ifc ðt Þ ¼ ilc ðt Þ Im sinðot þ fa1 þ 2p=3Þ (18) Under sinusoidal supply voltages the desired source currents of Equation (12)–(14) can be regarded as a three-phase generalization of the active current definition proposed by Fryze for a single-phase system [19]. The source currents also agree with the definition proposed by Czarnecki via orthogonal current decomposition for the three-phase system [20], where the load current can be decomposed into active and residual components, e.g. ilk ðt Þ ¼ isk APF abc ðt Þ þ ik residual ðt Þ (19) In Equation (19), isk APF abc ðt Þ is the minimum effective source current associated with the transfer of average real power from the source to the load and the residual component is the non active component. Thus, the residual component will be equal to the reference filtering currents allowing the not consumption/supply of real power by the APF. 3. APF CONFIGURATION Since Matlab/SimulinkW provides the full capabilities required for accurate simulations for testing the case study presented in this contribution, it has been adopted as the simulation tool to be used. Figure 2 Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1295 Figure 2. Shunt APF configuration. shows the digital implementation diagram in Matlab/Simulink of the shunt APF model for a real-time simulation. The reference current calculator is implemented according to the proposed strategy to determinate the reference filtering currents, as given by Equations (16)–(18). Once the reference filtering currents are determined, they are input to a hysteresis-band current controller to produce the control signals of the PWM VSI and to inject into the electric system the actual filtering currents with the same waveform of the reference filtering currents. In the hysteresis-band current control [21], the actual filtering current ifk(t) is left to oscillate within a window Δi placed above and below the reference waveform ifk ðt Þ. The PWM inverter consists of six switches with anti-parallel diode across each switch and with a split capacitor connected in parallel at the end. The split capacitor is used for energy storage and maintains a constant dc voltage. The shunt APF only supplies/absorbs reactive power, and it does not provide any active power to the load. Among the various PWM techniques available, the hysteresis-band current control is widely used due its simplicity of implementation [21]. This technique can be implemented to generate the switching pattern in order to obtain stability, very fast response, and good accuracy, and it has proven to be most suitable for all the applications of current controlled VSI for APFs. The switching logic is formulated as follows: If ifk < ifk Δi =2 upper switch OFF; lower switch ON (20) If ifk > ifk þ Δi =2 upper switch ON; lower switch OFF (21) The split capacitor is used for energy storage, and even though the dc voltage slightly fluctuates due to the harmonics, it must maintain a constant dc voltage. Since the losses produced by the switching converter and dc voltage variations must be supplied by the source, the power signal Ploss controlled via a PI controller, and the difference between the actual and the reference voltages of the capacitor, Udc and U*dc, respectively, are then input to the reference current calculator. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep 1296 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG 4. REAL-TIME APPLICATION The real-time simulation of the APF connected to the power system provides advantages in the design process by allowing options to be tried out before the hardware is built. After creating a Simulink model, the simulation parameters are used by Real-Time WorkshopW to generate C code and to build the real-time application. Real-Time WorkshopW generates optimized, portable, and customizable ANSI C or C++ code from Simulink models to create standalone implementations of models that operate in real time in a variety of target environments, and with commercial or proprietary real-time operating systems. In this contribution, the real-time application of the shunt APF compensation was developed with the incorporation of the RTWT toolbox of Matlab/Simulink. RTWT is a PC solution for prototyping and testing real-time systems. It is an environment where a single computer is used as a host and target. After creating a model and simulating it with Simulink in normal mode, it is possible to generate executable code; then the application in real time is achieved with the Simulink external mode. RTWT uses a small real-time kernel to ensure that the real-time application runs in real time. The real-time kernel runs at CPU ring zero (privileged or kernel mode) and uses the built-in PC clock as its primary source of time [12,13]. The kernel intercepts the interrupt from the PC clock before the Windows operating system receives it, this blocks any calls to the Windows operating system [12]. Communication between Simulink and the real-time application is through the Simulink external mode interface module. This module talks directly to the real-time kernel and is used to start the real-time application. External mode requires a communication interface to pass external parameters to Simulink, and on the receiving end, the same communications protocol must be used to accept new parameter values, and to insert them in the proper memory locations to be used by the real-time application. For the case of this contribution, the host computer also serves as the target computer. Therefore, only a virtual device driver is needed to exchange parameters between the Matlab and Simulink memory space and the memory that is accessible by the real-time application [12]. Figure 3 shows the report of code generation for the real-time application. Figure 3. Code generation report for APF_rtwt with Real-Time Workshop. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1297 5. CASE STUDY The potential of the developed control strategy for calculating the reference filtering currents in phase coordinates is illustrated with the analysis of the test system of Figure 4, where the three-phase balanced source voltages supply an assumed unbalanced nonlinear load. In this scenario, there are three different distorting loads connected between each phase and the neutral wire, which give place to a three-phase harmonic composition highly heterogeneous at the point of common coupling (PCC). These loads consist on: a single-phase full-wave rectifier with a high inductance on the dc side for phase a; a single-phase full-wave rectifier with a high capacitance on the dc side for phase b, and multiple harmonic current injections for phase c, which represent a given single-phase nonlinear load, as shown in Figure 4. For phases a and b, the single-phase transformer is assumed to be linear and the multiple current injections information of the nonlinear load at phase c is given in Equation (22). In order to simulate a load change during the shunt APF compensation, and be able to observe the dynamic performance of the proposed control strategy in real time during the transient, a load change after three cycles of simulation is programmed (switching ON all breakers at T = 0.6 s in Figure 4). The load changes for phases a and b consist on adding a pure resistive load that is connected in parallel on the dc side. For phase c, a pure resistive load is connected in parallel with the multiple harmonic current injections that simulate the single-phase non linear load, see Figure 4. ilc ðt Þ ¼ 3:9862 sinðot þ 172:77 Þ þ 0:28479 sinð3ot þ 2:26 Þ (22) þ1:5125 sinð5ot þ 4:43 Þ þ 0:4846 sinð7ot þ 6:17 Þ A The electric circuit conditions of the test system under study are shown in Figure 5. The source voltages are sinusoidal and balanced, as observed in Figure 5(a), and the load currents are highly distorted/unbalanced as seen in Figure 5(b). In particular, a meaningful and detailed analysis of the load currents is illustrated through Figures 6, 7, and 8, for phases a, b, and c, respectively. From Figure 6(a), it is observed the load current waveform at phase a, where both the total harmonic distortion (THD) and the current waveform are varying after three cycles of simulation, at T = 0.06 s; Figure 6(b) and Figure 6(c) show the magnitude of the harmonic Figure 4. Shunt APF in Matlab/SimulinkW external mode for Real-Time application. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep 1298 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG Figure 5. Electric circuit conditions of the case of study. Figure 6. Load current at phase a. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1299 Figure 7. Load current at phase b. content in amperes and % of the fundamental, respectively. A similar condition is presented for phase b, as it can be observed from Figure 7(a), (b), and (c). For these two phases, after the load change at T = 0.06 s, the harmonic content in the load current is varying in both amperes and % of the fundamental. On the other hand, the harmonic content in phase c after the load change is observed in Figure 8(a). It can be observed that the harmonic current injections in amperes are maintaining the same magnitudes as illustrated in Figure 8(b), and the fundamental frequency component has been increased due to the addition of the liner load (i.e. the pure resistive element), so that as a result of this conditions, the THD index is reduced. Given the simulation conditions explained above, it is expected that the calculation of the reference filtering currents, needed to generate the switching commands of the shunt APF, proceeds to adjust their values during the load change, instantaneously as needed, in order to ensure a good performance of the compensation device. In this way, it will be expected that the reference filtering currents for phase a and b adjust their values after the load change condition at T = 0.06 s. For phase c, the reference filtering current should remains constant during the complete shunt APF compensation process due to the no change of the harmonic content in phase c, see Figure 8. The results of the shunt APF compensation are illustrated in Figures 9 and 10. Figure 9 illustrates the source currents at the PCC, where it can be observed the elimination of the harmonic currents in all phases during the complete real-time simulation of the shunt APF compensation process. The neutral current is well controlled during the complete compensation process, despite the load change conditions, see Figure 10. The injection currents by the APF are shown in Figure 11(a), (b), and (c), for phases a, b, and c, respectively. As it was expected, after the load change, at T = 0.06 s, the filtering currents of phases a and b adjust their values continuously to be able to achieve an adequate performance of the APF, Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep 1300 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG Figure 8. Load current at phase c. meanwhile the filtering current for phase c remains constant as it was required and correctly calculated by the proposed reference current generator. It is important to notice that in order to be able to compensate unbalanced nonlinear currents by the APF and maintain the neutral current controlled, it was required the use of a three-leg split capacitor as the converter configuration of the VSI illustrated in Figure 2. The converter configuration and the modulation technique, used for generating the switching commands, allows that the control of the injection currents of each phase be independent to each other, working directly over the reference Figure 9. Currents at the PCC with shunt APF compensation. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1301 Figure 10. Neutral current during shunt APF compensation. filtering current with a low computational demand required for that purpose. On the other hand, when using simulating modulation techniques with a fixed-step solver, the integration step should be small enough to provide accurate solutions, or the inclusion of another software package would be necessary for obtaining a feasible solution. Giving the characteristics of the commutation technique used in this real-time application, a maximum of 50-kHz commutation frequency was used for the appropriated real-time operation of the shunt APF. Figure 11. Shunt APF compensation current. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep 1302 H. A. RAMOS-CARRANZA, A. MEDINA AND G. W. CHANG 6. DISCUSSION AND CONCLUSIONS The electric system under study and the complete dynamic model of the shunt APF has been implemented in the real-time simulation package RTWT of Matlab/SimulinkW. This real-time implementation of the shunt APF has included the VSI, the modulation technique, and the reference current generator. According to the observed results obtained with the case study, it is possible to indentify the proposed reference current generator as an efficient and accurate control strategy to calculate the reference filtering currents needed for the shunt APF compensation process. The reference current generator has achieved remarkable results even during the transient due to a load change condition observing a very good dynamic response of the algorithm. Once the shunt APF is in operation, effective harmonic distortion mitigation in the source currents has been achieved, as well as the source currents are balanced, thus controlling the neutral current. The APF compensation ensures the mitigation of the harmonic content in the source currents at all times in spite of the harmonic content present in dynamic load currents, maintaining the THD on average close to 1%. This final value of THD is due to the ripple current inherent to the APF injection currents. In addition, the reactive power compensation has been conveniently achieved since the source currents have been placed in phase with the source voltages at fundamental frequency. The control strategy in phase coordinates has been developed avoiding the transformation between different frameworks, thus it is feasible to reduce the control strategy to a single-phase application maintaining the theoretical and practical advantages observed for the three-phase control strategy. In this control strategy and for the work presented in this paper, the election of the sliding-window DFT for the extraction of the fundamental component information from the source voltage relies on the good behavior of the method, taking full advantage from the Matlab/SimulinkW and its embedded functions supported by RTWT. RTWT avoids additional hardware requirements for a real-time application and gives good accuracy in the solution. Since only virtual drivers are required and these are provided for Real-Time Workshop of Matlab/Simulink, the communication links between host and target are highly efficient. The real-time application of the shunt APF compensation has allowed us to establish the proposed control strategy as an effective compensation strategy with affordable computational demand required by its compensation algorithm, making it suitable for a further physical implementation of the compensation device. If the compensation scenario includes the electric system with unbalance in the source voltages, the use of the positive sequence of the source voltages at fundamental frequency as the reference signals, instead of the reference signals of Equations (9)–(11), represents a more suitable option to proceed with the calculation of the reference filtering currents in order to obtain the desired results. Nevertheless, it is important to notice that the use of the positive sequence at fundamental frequency signals will increase the necessary computation demand needed by the reference current generator, and some adjustments on the theory of the calculation of the amplitude of the desired source current should be made. 7. LIST OF SYMBOLS ifk ðt Þ ilk(t) isk ðt Þ Im, Imk Im ; Imk θisk θuk PT uk(t) Umk Umk1 Ploss Reference filtering currents Load currents Desired source currents after compensation Amplitude of the source currents after compensation Amplitude of the desired source currents after compensation Angles of phase of the source currents Angles of phase of the source voltages Total average power Instantaneous source voltages Source voltage amplitudes Source voltage amplitudes at fundamental component Power losses signal Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep REAL-TIME APPLICATION OF SHUNT APF DYNAMIC COMPENSATION 1303 ik _ residual(t) Residual current component Delta window for the hysteresis-band current controller Δi Udc Capacitor dc voltage Capacitor dc voltage of reference Udc ACKNOWLEDGEMENT The authors gratefully acknowledge to the Univesidad Michoacana de San Nicolás de Hidalgo through the Post grade Studies Division of the Electric Engineering Faculty for the facilities granted to carry out this investigation. REFERENCES 1. Singh GK. Power system harmonics research: a survey. European Transactions on Electrical Power 2009; 19:151–172. DOI: 10.1002/etep.201. 2. Sharaf AM, Wang W, Altas IH. A novel hybrid active filter compensator for stabilization of wind-utility grid interface scheme. European Transactions on Electrical Power 2010; 20:306–326. DOI: 10.1002/etep.313 3. Grady WM, Samotyj MJ, Noyola AH. Survey of active power line conditioning methodologies. IEEE Transactions on Power Delivery 1990; 5:1536–1542. 4. Chang GW, Shee TC. A comparative study of active power filter reference compensation approaches. IEEE Power Engineering Society Summer Meeting 2002; 2:1017–1021. 5. Chang GW, Shee TC. A novel reference compensation current strategy for shunt active power filter control. IEEE Transactions on Power Delivery 2004; 19:1751–1758. 6. Aredes M, Hafner J, Heunman K. Three-phase four-wire shunt active filter control strategies. IEEE Transactions on Power Electronics 1997; 12:311–318. 7. Medina A, Ramos-Carranza HA. An active power filter in phase coordinates for harmonic mitigation. IEEE Transactions on Power Delivery 2007; 22:1991–1993. 8. Chen CL, Lin CE, Huang CL. Reactive and harmonic current compensation for unbalanced three-phase systems using the synchronous detection method. Electric Power Systems Research 1993; 26:163–170. 9. Ramos-Carranza HA, Medina A, Chang GW. Real-Time shunt active power filter compensation. IEEE Transactions on Power Delivery 2008; 23:2623–2625. 10. Pak L, Dinavahi V, Chang G, Steurer M, Ribeiro PF. Real-Time digital time-varying harmonic modeling and simulation techniques. IEEE Transactions on Power Delivery 2007; 22:1218–1227. 11. Apostolopoulos CA, Korres GN. Real-time implementation of digital relay models using MATLAB/SIMULINK and RTDS. European Transactions on Electrical Power 2010; 20:290–305. DOI: 10.1002/etep.311 12. Real-Time Windows Target User’s Guide. The Mathworks Inc.: USA, 2007. 13. Real-Time Workshop. The Mathworks Inc.: USA, 2007. 14. Bollen MHJ, Gu IYH. Signal Processing of Power Quality Disturbances. John Wiley & Sons: USA, 2006. 15. Martins AP. A DFT-based phasor estimation method for power electronics converter control and protection under strong grid voltage perturbations. European Transactions on Electrical Power 2009; 19:1082–1097. DOI: 10.1002/etep.284 16. Ece DG, Gerek ÖN. A power quality analysis scheme using adaptive subband decomposition. European Transactions on Electrical Power 2009; 19:499–508. DOI: 10.1002/etep.237 17. Lai LL, Chang WL, Tse CT, So ATP. Real-Time frequency and harmonic evaluation using artifitial neural networks. IEEE Transactions on Power Delivery 1999; 14:52–59. 18. Lin HC. Intelligent neural-network-based adaptive power line conditioner for real-time harmonics filtering. IEE Proceedings Generation, Transmission & Distribution 2004; 151:561–567. 19. Arrillaga J, Watson NR, Chen S. Power System Quality Assessment. John Wiley & Sons: England, 2001. 20. Czarnecki LS. Orthogonal decomposition of the current in a 3-phase nonlinear asymmetrical circuit with a nonsinusoidal voltage source. IEEE Transactions on Instrumentation and Measurement 1998; 35:30–34. 21. Buso S, Malesani L, Mattavelli P. Comparison of current control techniques for active filter applications. IEEE Transactions on Industrial Electronics 1998; 45:722–729. Copyright © 2012 John Wiley & Sons, Ltd. Int. Trans. Electr. Energ. Syst. 2013; 23:1289–1303 DOI: 10.1002/etep