## 1. Introduction

In recent years, the increasing use of power electronics in the commercial and industry processes results in harmonics injection and lower power factor to the electric power system [Emanuel A E. (2004)]. Conventionally, in order to overcome these problems, passive R-L-C filters have been used. The use of this kind of filters has several disadvantages. Recently, due to the evolution in modern power electronics, new device called “shunt active power filter (SAPF)” was investigated and recognized as a viable alternative to the passive filters. The principle operation of the SAPF is the generation of the appropriate current harmonics required by the non-linear load.

For the reference currents generation, one of the best known and effective technique is the ‘instantaneous reactive power theory’ or ‘*p-q* theory’ [Czarnecki L S. (2006)]. In the literature, various modifications of *p-q* theory for the reference currents generation have been proposed [Salmeron P, Herrera R S, Vazquez J R. (2007)], [Kilic T, Milun S, et al. (2007)]. It is a common phenomenon in an electric power system, the grid voltages to be non-ideal [Segui-Chilet S S, Gimeno-Sales F J, et al. (2007)]. In such condition, the *p-q* theory is ineffective. To improve the efficiency of the *p-q* theory various reference currents generation techniques [Kale M, Ozdemir E. (2005)], [Tsengenes G, Adamidis G. (2011)] have been proposed. Except from the reference currents generation method, the current control method plays an important role to the overall system’s performance. Plenty of methods have been used in the current control loop [Buso S, Malesani L, et al. (1998)] (e.g. ramp comparison, space vector modulation), one of which is the hysteresis current control. Hysteresis current controller compared to other current control methods has a lot of advantages such as robustness and simplicity [Tsengenes G, Adamidis G. (2010)].

The conventional reference currents generation techniques use a PI controller in order to regulate the dc bus voltage. The tuning of the PI controller requires precise linear mathematical model of the plant, which is very difficult to obtained, and it fails to perform satisfactorily under parameters variations, non-linearities, etc. To overcome these disadvantages, in recent years controllers which use artificial intelligent techniques have been implemented, like fuzzy logic controllers (FLCs) and artificial neural network (ANN) [Saad A, Zellouma L. (2009)], [El-Kholy E E, El-Sabbe, et al. (2006)], [Han., Khan M M, Yao et al. (2010)], [Skretas S B, Papadopoulos D P (2009)]. The FLC surpasses the conventional PI controller due to its ability to handle non-imparities, its superior perform with a non-accurate mathematical model of the systems, and its robustness. In the literature some papers which implement FLCs in SAPF in order to improve the efficiency of the reference currents generation technique [Han Y, Khan M M, Yao et al. (2010)], [Jain S K, Agrawal P, et al. (2002)] and the current control loop have been reported [Mekri F, Machmoum M. (2010)], [Lin B R, Hoft R G. (1996)].

In this chapter a fuzzy logic controlled SAPF for current harmonics elimination is presented. The control scheme is based on two FLCs, the first one controls the dc bus voltage and the second one controls the output current of the inverter. Furthermore for the reference currents generation a modified version of the *p-q* theory is proposed, in order to improve the performance of the SAPF under non-ideal grid voltages. The performance of the proposed control scheme is evaluated through computer simulations using the software Matlab/Simulink under steady state and transient response. The superiority of the proposed fuzzy logic control scheme over the conventional control scheme is established both in steady state and transient response for current harmonics elimination and dc bus voltage of the SAPF respectively.

At the end a proposal for future investigation is presented. A combination between the fuzzy and the PI control is proposed. The new controller is called “fuzzy-tuned PI controller”. The theoretical analysis and some simulation results are illustrated in order to verify the efficiency of the fuzzy-tuned PI controller.

## 2. Description of the proposed fuzzy control scheme

The main function of the SAPF is the current harmonics elimination and the reactive power compensation of the load. The general block diagram of a grid connected SAPF, as well as the detailed model of the control scheme is illustrated in Fig.1. The Reference currents generation method includes the dc bus voltage control which is the outer control loop. The current control method is the internal control loop which generates the appropriate switching pattern.

### 2.1. Reference currents generation method

For the reference currents generation a modified version of the *p-q* theory is used. One of the disadvantages of the *p-q* theory is the very poor efficiency of the method under non-ideal grid voltages. In this chapter the generation of three virtual grid voltages is proposed, one per phase as shown in figure 2. These virtual voltages will have the same amplitude as the fundamental harmonic (50 Hz) of the grid voltage, and will be synchronized with zero phase shifting compared with the corresponding grid voltages.

Mathematical equations for the virtual grid voltages *a-b-c* reference frame are given by equations (1), (2) and (3).

Where *θ* is the angular frequency of the grid voltages (θ=2∙*π*∙*f*_{grid}=2∙*π*∙50).

The modified *p-q* theory, for the reference currents generation, will use the virtual grid voltages*α-β* reference frame according to the transformer matrix of equation (4). The virtual grid voltages and the load current in *α-β* reference frame are given by equations (5), (6).

The instantaneous active and reactive powers of the electric power system are calculated via the following equation:

The instantaneous powers p and q are composed from a dc part (-) and an ac part (~) corresponding to fundamental and harmonic current respectively. Equation (8) gives the instantaneous active and reactive power respectively.

The ac component of the active power is extracted using a low pass filter. Using the *p-q* theory current harmonics are eliminated and the reactive power of the load is compensated. Therefore the reference currents of the SAPF in *α-β* reference frame are:

Where _{i}) of the current a FLC for the dc bus voltage control and a FLC for the current control are implemented. The current controller handles the reference and the actual currents in *a-b-c* reference frame. As a result, the inverse *α-β* transformation of equation (10) is used in order to transform the reference currents in *a-b-c* reference frame.

### 2.2. Fuzzy logic dc bus voltage controller

For the dc bus voltage control a FLC is implemented. Figure 3 shows the synoptic block diagram of the proposed FLC. As inputs to FLC the error between the sensed and the reference dc bus voltage (*k*^{th} sampling instant are used. The output of the fuzzy logic controller is considered as the active power losses of the inverter (_{1}, G_{2} and G_{3} are used to adjust the input and output control signals.

The FLC converts the crisp variables into linguistic variables. To implement this process it uses the following seven fuzzy sets, which are: NL (Negative Large), NM (Negative Medium), NS (Negative Small), Z (Zero), PS (Positive Small), PM (Positive Medium), PL (Positive Large). The fuzzy logic controller characteristics used in this section are:

Seven fuzzy sets for each input (e, Δe) and output (Δp

_{loss}) with triangular and trapezoidal membership functions.Fuzzification using continuous universe of discourse.

Implications using Mamdani’s ‘min’ operator.

Defuzzification using the ‘centroid’ method.

Figure 4 shows the normalized triangular and trapezoidal membership functions for the input and output variables. The degree of fuzziness/membership (*μ*_{δ,tri}(*x*)) of the triangular membership function is determined by equation (11.a). The degree of fuzziness (*μ*_{δ,tra}(*x*)) of the trapezoidal membership function is determined by equation (11.b).

(11) |

Where *x*, *a*, *b*, *c*, and d belong to the universe of discourse (*X*).

In the defuzzification procedure the centroid method with a discretized universe of discurse can be expressed as:

Where *x*_{out} is crisp output value *x*_{i} is the output crisp variable and *i* is the number of output discrete elements in the universe of discourse.

In the design of the fuzzy control algorithm, the knowledge of the systems behavior is very important. This knowledge is put in the form of rules of inference. The rule table which is shown in Table 1 contains 49 rules. The elements of the rule table are obtained from an understanding of the SAPF behavior [Jain S K, Agrawal P, et al. (2002)].

### 2.3. Fuzzy logic Hysteresis current controller

One of the best known and most effective current control methods is the hysteresis band control technique. Some of its advantages are the simplicity of the construction combined with the excellent dynamic response. Apart from the significant advantages, this method has some drawbacks such as the high THD_{i} index.

For the reduction of the THD_{i} index, the implementation of a fuzzy logic hysteresis current controller is proposed. The synoptic diagram of fuzzy logic hysteresis controller for the phase-a is shown in figure 5. The same controller is applied to the other two-phases (b and c). As inputs to FLC the error between the reference current and the sensed current (*k*^{th} sampling instant are used. The output of the FLC is considered as the amplitude of the current error. The coefficients F_{1} and F_{2} are used to adjust the input control signals. The saturations blocks are used for limiting the initial error.

The fuzzy logic controller characteristics used in this section are the same as in the previous section (2.2). Figure 6 shows the triangular and trapezoidal membership functions for the input and output variables. The rule table for the hysteresis fuzzy logic controller is the same with Table 1.

## 3. Non-ideal grid voltages

It is a common phenomenon in electric power system the grid voltages to be non-ideal. This problem is particularly important in Greek electric power distribution system, mainly due to the large increase of power electronic devices. In this section the mathematical model of the grid voltages under several non-ideal cases will briefly be presented.

The ideal grid voltages have sinusoidal waveform and can be represented as:

The ideal grid voltages have only the fundamental frequency component.

When the three-phase grid voltages are unbalanced (

Where,, and are positive sequence components and,, and are negative sequence components.

It is a very common phenomenon in electric power distribution systems, voltages having non-ideal waveforms, and different levels of harmonics. When the three-phase grid voltages are distorted (*u*_{sd}), the grid voltages have harmonics components. In this scenario the distorted grid voltage can be represented as:

Where,

When the three-phase grid voltages are distorted and unbalanced (*u*_{du}), the grid voltages contain harmonic components and unbalances. For this case, the distorted and unbalanced three-phase grid voltages are expressed as:

## 4. Simulation results

In this section the electric power system of figure 1 will be simulated. The simulation will be carried out via Matlab/Simulink. The characteristics of the electric power system are shown in Table 2. Four practical scenarios were examined in which the grid voltages are ideal, unbalanced, distorted and distorted-unbalanced. For the worst case, where the grid voltages are distorted-unbalanced the performance of the electric power system will be analyzed using the conventional and the fuzzy logic control system. The behavior of the PI controller and the FLC will be compared based on the dc bus voltage control.

Besides, the behavior of the conventional hysteresis controller and the hysteresis FLC will be compared based on the inverter output current control. For the comparison of the performance between the conventional control methods and the control methods with fuzzy logic theory the THD_{i} index in steady state, and the oscillation of the dc bus voltage during the transient response will be considered. Thereafter, the non-linear load will be called “Load_1” and the linear load will be called “Load_2”. In all cases the transient response occurs at the same time (t=0.4 sec). It was considered that time t=0.4 sec in the electric power system, additionally to the initial non-linear load (Load_1) a linear load (Load_2) is connected.

### 4.1. Distorted-Unbalanced grid voltages

In this case the grid voltages are considered to be distorted-unbalanced, and they are expressed as:

(19) |

Figure 7 shows the distorted-unbalanced grid voltages. Figures 8 and 9 show the grid currents (*i*_{sa}, *i*_{sb}, *i*_{sc}) and the reactive power of the grid respectively, without the application of the SAPF. In Table 3 the THD_{i} index of the grid currents for the loads ‘Load_1’ and ‘Load_1+Load_2’ is denoted.

#### 4.1.1. Conventional controller and fuzzy controller for dc bus voltage control

In this section the control scheme consists of the PI dc bus voltage controller and the hysteresis current controller (called “PI-HYS”) will be compared with the control scheme consists of the fuzzy dc bus voltage controller (from section 2.2) and the hysteresis current controller (called “FUZ-HYS”). Figure 10 shows the dc bus voltage transient response at time t=0.4 sec for both control schemes.

From figure 10 it is obvious that the dc bus voltage fuzzy logic controller outperforms the conventional PI controller. In particular, it is noted that the oscillation of the dc bus voltage with the application if the fuzzy logic controller is smaller compared to the PI one. Likewise the recovery time until the dc bus voltage returns to steady state is fairly smaller when the FLC is applied. This result has an effect on the time needed by the grid currents to return to steady state operation.

Figures 11 and 12 show the grid currents and the reactive power of the grid when the SAPF connected. Figures 11and 12 illustrate the results for both control schemes. Table 4 shows the THD_{i} index of the grid currents considering the loads ‘Load_1’ and ‘Load_1+Load_2’.

PI-HYS | FYZ-HYS | |||||

Phases | a | b | c | a | b | c |

THD_{i} (Load_1) | 4.05 | 3.81 | 3.07 | 4.35 | 4.12 | 3.32 |

THD_{i} (Load_1 + Load_2) | 1.83 | 1.96 | 1.60 | 1.86 | 1.96 | 1.61 |

From figure 11 it is obvious that the faster response of the dc bus voltage using the fuzzy logic controller has a positive effect on the grid current, as the grid currents return to steady state operation faster (figure 11, time t_{1} for FLC, and time t_{2} for PI controller). It should be noted that, from figure 11 and Table 4 no significant change in the harmonic distortion of the grid currents in the case of dc bus voltage FLC is observed.

From the simulation results it is observed that the performance of the SAPF is satisfactory in the case where the grid voltages are distorted-unbalanced. This fact is a consequence of the modified version of the *p-q* theory, which was proposed in this chapter. The SAPF successfully eliminates the high order harmonics from the grid currents.

It is also observed that the SAPF compensates the reactive power of the load. As shown in figure 9 the reactive power of the grid without compensation for the ‘Load_1’ is Q=27 kVAr, then adding the ‘Load_2’ is increased to Q=58 kVAr. By using the active power filter, reactive power compensation is achieved for both initial and final load (the compensated reactive power of the grid is Q=28 VAr) as shown in figure 12. Comparing the two control schemes, PI-HYS and FYZ-HYS, similar behavior for the reactive power compensation is detected. For both control schemes there is a short transient period during the change of load.

#### 4.1.2. Conventional dc bus voltage and ac current controller compared with fuzzy controller

For the reduction of the THD_{i} index of the grid currents, authors propose a control scheme consists of a fuzzy logic dc bus voltage controller together with fuzzy logic hysteresis current controllers (as in section 2.3) (called “FUZ-FYZ HYS”).

In this section the control scheme consists of the PI controller for the dc bus voltage control and the hysteresis controller for current control (PI-HYS) will be compared with the control scheme consists of the fuzzy controller for the dc bus voltage control and the fuzzy logic hysteresis controller for current control (FUZ-FUZ HYS). Figure 13 shows the dc bus voltage response at time t=0.4 sec for both control schemes.

From figure 13 it is obvious that the use of fuzzy logic for and ac output current control outperforms the control scheme of PI dc bus voltage control and hysteresis current control. In particular we observe that the oscillation of the dc bus voltage is smaller when the fuzzy logic dc bus voltage control and the fuzzy hysteresis current control is used. Likewise the interval time until the dc bus voltage returns to steady state operation is fairly smaller when the fuzzy logic scheme is applied. Comparing the results of figure 10 with those of figure 10, it is observed that the control schemes of FUZ- HYS and FUZ-FUZ HYS have no significant difference in the control of the dc bus voltage.

Figures 14 and 15 show the grid currents and the reactive power of the grid with the application of the SAPF for both control schemes (PI-HYS and FUZ-FUZ HYS). Table 5 shows the grid currents THD_{i} index for the loads ‘Load_1’ and ‘Load_1+Load_2’.

PI‐HY | FYZ-HYS | FUZ-FYZ HYS | |||||||

Phases | a | b | c | a | b | c | a | b | c |

THD_{i} (1) | 4.05 | 3.81 | 3.07 | 4.35 | 4.12 | 3.32 | 3.37 | 3.53 | 3.04 |

THD_{i} (2) | 1.83 | 1.96 | 1.60 | 1.86 | 1.96 | 1.61 | 1.62 | 1.77 | 1.57 |

From figure 14 it is evident that the faster response of the dc bus voltage with the application of the FUZ-FUZ HYS control scheme has a positive effect on the grid current, as they return to steady state operation in smaller interval time (figure 14, time instant t_{1} for FUZ-FUZ HYS control scheme, and time instant t_{2} for PI-HYS control scheme). It should be noted that, from figure 14 smaller harmonic distortion of the grid currents is observed using the FUZ-FUZ HYS control scheme. In figure 14 some of the points where improvement is observed are highlighted using circles.

From the analysis of the simulation results, the improvement in the THD_{i} index of the grid current using the FUZ-FUZ HYS control scheme is observed, as shown in Table 5. For phase-a, the improvement in the THD_{i} index with the FUZ-FUZ HYS control scheme is about 22.5%. For phases-b and -c, the improvement in the THD_{i} index with the FUZ-FUZ HYS control scheme is about 14.3% and 8.5% respectively. Investigating the electric power system, the unbalances in the THD_{i} index is the result of the unbalances in the grid voltages.

From the comparison of the PI-HYS and FYZ-FUZ HYS control schemes, similar behavior for the reactive power compensation is observed. For both control schemes there is a short transition period during the load change. As shown in figure 9 the reactive power of the grid considering only the ‘Load_1’, without compensation for the is Q=27 kVAr, then adding the ‘Load_2’ the reactive power is increased to Q=58 kVAr. Using the SAPF, reactive power compensation is achieved for both initial and final load (in this case, the reactive power of the grid is approximately Q=29 VAr) as shown in figure 15.

From the simulation results it is observed that considering the above mentioned case the performance of the SAPF is excellent, as well as the performance of the SAPF is not affected by the distorted-unbalanced grid voltages. This fact is a consequence of the modified version of the *p-q* theory.

## 5. Future research

The fuzzy logic controller outperforms the conventional PI controller due to robustness and the superior transient response. However FLC have some significant disadvantages. The main drawback of the FLC is the requirement of an expert for the design of the membership functions and the fuzzy rules. To overcome this disadvantage, a novel artificial intelligent controller called “fuzzy-tuned PI controller” has been proposed in the literature of automation control [De Carli A, Linguori P, et al. (1994)], [Zhao Z-Y, Tomizuka M, et al. (1993)]. The fuzzy-tuned PI controller in figure 16 is a combination of the fuzzy controller and the PI controller. Using the fuzzy part we can estimate the gains *Κ*_{p} and *K*_{p} of the PI controller. Then the PI controller based on these gains outputs the reference signal. The fuzzy-tuned PI controller was initially applied for the speed control of the induction motor drives [Chen Y, Fu b, et al. (2008)] and the dc bus voltage control of the grid connected inverters [Suryanarayana H, Mishra MK (2008)].

No significant work, comparing the performance of the PI and fuzzy-tuned PI controller for the current control of a grid connected inverter, has been reported. In this section the PI and the fuzzy-tuned PI controller are applied to the inner current control loop. The criterion for the comparison of the two controllers are based on the transient response.

### 5.1. Fuzzy-tuned PI controller analysis for current control

The synoptic block diagram of the proposed fuzzy-tuned PI controller is illustrated in figure 16. As inputs to the fuzzy-tuned PI current controller are the actual and the reference currents. The current controller outputs the appropriate reference signal (reference voltage). The reference voltage in *α-β* reference frame will be used by the Space Vector Modulation algorithm for the switching pattern generation.

The operation of the fuzzy-tuned PI controller is based on the use of a FLC for on-line tuning of the gains *K*_{p} and *K*_{i} of the PI controller, as shown in equation (20). Then the PI controller uses the adjusted gains *K*_{p}, *K*_{i} and the current error (e) to create the reference output control signals (referencevoltage).

As inputs to the fuzzy-tuned PI controller the error *K*_{i} (pu) and Δ*K*_{p} (pu) of the PI controller, are determined. Using the gains *K*_{i} and *K*_{i}, the PI controller outputs the reference output voltage of the inverter (_{1}, G_{2}, G_{3} and G_{4} are used to normalize the input and output signals. In figure 17.a seven membership functions are used for each input (NL-Negative Large, NM-Negative Medium, NS-Negative Small, ZE-Zero, PS-Positive Small, PM-Positive Medium, and PL-Positive Large). In figure 17.b two membership functions are used for each output (B for Big and S for Small). For the fuzzy-tuned PI controller the triangular function was used as input and output fuzzy sets.

The fuzzy rules which are shown in Table 6 for the ΔK_{p} and in Table 7 for the ΔΚ_{i}, are determined using the standard form of fuzzy rules: *IF e is A*_{i}
*and Δe is B*_{j,}
*THEN ΔΚ*_{P,i}
*is C*_{ij}
*and*
*ΔΚ*_{I,i}
*is D*_{ij}*.*

### 5.2. Comparison between fuzzy-tuned PI controller and the PI controller

In this section the behavior of the two current controllers will be compared based on the dynamic response. At the time instant t=0.4 sec a sudden variation of the output power of the inverter occurs. Figures 18.a and 18.b show the output currents of the inverter in *a-b-c* reference frame for the PI and the fuzzy-tuned PI current controller, respectively.

From figure 18 we can observe that the current error in *a-b-c* reference frame is very big when the PI controller is used (the power of the inverter increases). When the fuzzy-tuned PI controller is applied the error becomes almost zero while the recovery time is smaller compared to the PI. This fact has a direct impact to the output currents, which in the case of fuzzy-tuned PI controller have smoother behavior, while in the case of PI controller have rougher behavior.

From the dynamic response of the electric power system is concluded that the fuzzy-tuned PI controller is best suited for the inner current control loop.

## 6. Conclusion

In this chapter a modified version of the *p-q* theory was proposed, in order to improve the performance of the SAPF in the case of non-ideal grid voltages. For the performance improvement of the control scheme, the fuzzy logic theory was applied. A fuzzy logic controller for the dc bus voltage control was used. From the computer simulations and the analysis of the results, smaller amplitude and duration of the dc bus voltage oscillations during the transient response has been demonstrated. A further investigation of the system was carried out applying fuzzy logic hysteresis controller to control the output current of the inverter. From the investigation of the control system using fuzzy logic controller both for dc bus voltage and inverter output current control, the dc bus voltage during the transient response and the THD_{i} index of the grid currents are obviously improved.

Furthermore, authors use a combination of the PI and the fuzzy control known as “fuzzy-tuned PI“ control. The performance of the inverter in case of the fuzzy-tuned PI control is used on the current control loop was investigated.