1 Introduction

Nonlinear and time-varying electronic devices cause power quality problems in the power system such as low power factor, current/voltage waveform distortion, surges and phase distortion problems. Active power filters (APF) have proven very effective for the suppression of harmonics and the compensation of reactive currents. The basic principle of APF is to produce a compensation current having the same amplitude and opposite phase as the harmonic currents. APFs are widely used in many applications to compensate for the undesirable effects of current harmonics produced by nonlinear loads on industrial, commercial, and residential equipment [1, 2].

Parallel-connected shunt active power filters (SAPF) are mainly operated as harmonic isolator between nonlinear loads and the utility system. The SAFP can also provide reactive power support to the load. Figure 1 shows the basic structure of a SAPF [3, 4] which includes the following steps:

  • Measurement of current and voltage signals,

  • Reference current generation,

  • Pulse generation to control the inverter.

Fig. 1
figure 1

Basic compensation principle of the shunt APF

A better performance of Shunt APFs is achieved if the voltage across the DC link capacitor is maintained at a prescribed reference level. Fuzzy logic control (FLC) has been successfully used in a wide range of industrial applications because of its robustness and model-free approach. Wang [57] proposed a universal approximation theorem and demonstrated that an arbitrary function of a certain set of functions can be accurately approximated using a fuzzy system. The advantages of FLCs over conventional controllers are that they do not require an accurate mathematical model of the plant, they can work with imprecise inputs, can handle non-linearity and are more robust than conventional nonlinear controllers [7, 17].

FLC and sliding mode control (SMC) have been combined in a variety of ways for the design of sliding surface [8, 9]. These approaches can be classified into two categories. The first approach taken by many researchers is to use FLC to determine the sliding surface movement of the classical SMC [10]. A Takagi-Sugeno type fuzzy tuning algorithm is used to model the movement of the sliding surface [1012]. In the second approach, the sliding surface is determined directly basedon fuzzy logic.This latter method is referred to as sliding mode fuzzy control (SMFC). In [13], a PI (proportional-integral) fuzzy controller is proposed to improve the voltage tracking performance for the DC side capacitor voltage and a model reference adaptive controller is derived based on Lyapunov analysis for the AC side current compensation. In [14], a fuzzy sliding mode of a hybrid microgrid is presented.

These hybrid controllers try to ensure the asymptotic stability and reduce chattering by combining sliding-mode control with other techniques, such as adaptive control and fuzzy control [15, 16]. Most of these hybrid controllers have a complex structure and are difficult to implement.

In this study, a hybrid fuzzy sliding mode controller (HFSMC) is used to regulate the voltage across the capacitor by setting a reference DC current required to maintain the voltage across capacitor constant. The simulation results demonstrate superior performance of the SAPF as compared to classical PI and SMC controllers [1315].

The paper is organized as follows: The circuit configuration of the APF system is presented in Sect. 2. In Sect. 3, the DC voltage control strategy is developed and the SMC design is presented taking into consideration stability conditions. Finally, in Sect. 4, simulation results are presented to demonstrate the performance of the proposed APF control scheme for harmonic elimination and reactive power compensation.

2 Synchronous detection method

The synchronous detection method is implemented for the calculation of the compensating currents in a system consisting of a three phase source feeding a highly nonlinear load. The balanced three phase source currents can be obtained after compensation.

The three-phase source voltage is given as:

$$\begin{aligned} V_{sa} ( t)=V_{ma} \sin \omega t \end{aligned}$$
$$\begin{aligned} V_{sb} ( t)=V_{mb} \sin (\omega t-120^{\circ }) \end{aligned}$$
(1)
$$\begin{aligned} V_{sc} ( t)=V_{mc} \sin (\omega t-240^{\circ }) \end{aligned}$$

The three-phase current drawn by the load can be expressed as:

$$\begin{aligned} I_{La} ( t)=\mathop \sum \limits _{n=1}^\infty I_{an} \sin (\omega t-\emptyset _{an} ) \end{aligned}$$
$$\begin{aligned} I_{Lb} ( t)=\mathop \sum \limits _{n=1}^\infty I_{bn} \sin ( {\omega t-\emptyset _{bn} -120^{\circ }}) \end{aligned}$$
(2)
$$\begin{aligned} I_{Lc} ( t)=\mathop \sum \limits _{n=1}^\infty I_{cn} \sin (\omega t-\emptyset _{cn} -240^{\circ }) \end{aligned}$$

The following steps are used for generation of the reference signal [4]:

Step 1: The three-phase instantaneous power (\(p_{3ph} )\) in the proposed system is calculated using:

$$\begin{aligned} p_{3ph}= & {} v_{sa} i_{La} +v_{sb} i_{Lb} +v_{sc} i_{Lc} \end{aligned}$$
$$\begin{aligned} p_{3ph}= & {} p_a +p_b +p_c=V_{ma} \sin (\omega t)\mathop \sum \limits _{n=1}^\infty I_{an} \sin (\omega t-\emptyset _{an} )\nonumber \\&+V_{mb} \sin ( {\omega t-120^{\circ }})\mathop \sum \limits _{n=1}^\infty I_{bn} \sin ( {\omega t-\emptyset _{bn} -120^{\circ }})\nonumber \\&+V_{mc} \sin (\omega t-240^{\circ })\mathop \sum \limits _{n=1}^\infty I_{cn} \sin (\omega t-\emptyset _{cn} -240^{\circ }) \end{aligned}$$
(3)

Where \(p_a , p_b \) and \(p_c \) represent the instantaneous power in phases a, b and c respectively.

Step 2: The three-phase instantaneous power \(p_{3ph} \) is passed througha low pass filter (LPF) to determine the fundamental power (\(p_{dc} \) or \(p_{fund} )\) and block high order frequency components.

$$\begin{aligned} p_{fund}= & {} V_{ma} \sin ( {\omega t})I_{a1} \sin ( {\omega t-f_{a1} })\nonumber \\&+V_{mb} \sin ( {\omega t-120^{\circ }})I_{b1} \sin ( {\omega t-f_{b1} -120^{\circ }})\nonumber \\&+ V_{mc} \sin ( {\omega t-240^{\circ }})I_{c1} \sin ( {\omega t-f_{c1} -120^{\circ }}) \end{aligned}$$
(4)
$$\begin{aligned} p_{fund}= & {} \frac{V_{ma} I_{a1} }{2}\left[ {\cos ( {\phi _{a1} })-\cos (2\omega t+\phi _{a1} )} \right] \nonumber \\&+\frac{V_{mb} I_{b1} }{2}\left[ {\cos ( {\phi _{b1} })-\cos (2\omega t+\phi _{b1} )} \right] \nonumber \\&+\frac{V_{mc} I_{c1} }{2}\left[ {\cos ( {\phi _{c1} })-\cos (2\omega t+\phi _{c1} )} \right] \end{aligned}$$
(5)

Step 3: The average three phase fundamental power is calculated as:

$$\begin{aligned} p_{av} =\mathop \int \nolimits _0^T p_{fund} dt=\frac{V_{ma} I_{a1} }{2}\cos ( {\phi _{a1} })+\frac{V_{mb} I_{b1} }{2}\cos ( {\phi _{b1} })+\frac{V_{mc} I_{c1} }{2}\cos ( {\phi _{c1} })\nonumber \\ \end{aligned}$$
(6)

For a three phase balanced nonlinear load, the following can be written as:

$$\begin{aligned} V_{ma} =V_{mb} =V_{mc} =V \qquad \qquad I_{a1} =I_{b1} =I_{c1} =I \qquad \qquad \phi _{a1} =\phi _{b1} =\phi _{c1} =\phi _1 \end{aligned}$$
$$\begin{aligned} P_{av} =\frac{3VI}{2}\cos ( {\phi _1 }) \end{aligned}$$
(7)

Step 4: Using (6), the per phase average power can be written as:

$$\begin{aligned} p_{av,ph} =\frac{VI}{2}\cos ( {\phi _1 }) \end{aligned}$$
(8)

Let \(I\cos (\phi _1 )=I_m =\)Maximum amplitude of the per phase fundamental current.

$$\begin{aligned} I_m =\frac{2p_{av,ph} }{V} \end{aligned}$$
(9)

Step 5: The load current contains fundamental, reactive and harmonic components. If the SAPF can compensate for the total reactive and harmonic components then the source current waveform will be sinusoidal. Hence for accurate compensation, it is necessary to estimate the fundamental component of the load current as the reference current.

The fundamental component of the load current is given as:

$$\begin{aligned} I_{Fa} =I_m \sin (\omega t)\nonumber \\ I_{Fb} =I_m \sin ( {\omega t-120^{\circ }})\nonumber \\ I_{Fc} =I_m \sin (\omega t-240^{\circ }) \end{aligned}$$
(10)

The reference current for the SAPF in each phase\(( {i_{ca}^*,i_{cb}^*,i_{cc}^*})\) can be determined by comparing the total load current with it is fundamental component. The reference current can be written as:

$$\begin{aligned} i_{ca}^*=I_{La} -I_{Fa}\nonumber \\ i_{cb}^*=I_{Lb} -I_{Fb}\nonumber \\ i_{cc}^*=I_{Lc} -I_{Fc} \end{aligned}$$
(11)

Here, the compensating currents \(( {i_{ca} ,i_{cb} ,i_{cc} })\)are compared with the reference current \(( {i_{ca}^*,i_{cb}^*,i_{cc}^*})\) using hysteresis comparator to generate six switching pulses for turning on and off the inverter IGBT switches.

3 DC voltage control

The proposed control scheme of the APF is shown in Fig. 2. The DC link voltage is regulated to estimate the reference current.

Fig. 2
figure 2

Proposed control scheme of the APF

(a) Fuzzy logic controller (FLC) design

FLC was deduced from fuzzy set theory introduced by Zadeh in 1965, where transition is between membership and non membership function. Therefore, limitation or boundaries of fuzzy sets can be undefined and ambiguous. FLCs are an excellent choice when precise mathematical formulations are impossible as in the context of APFs and harmonic elimination.

A fuzzy controller involves four basic stages: fuzzification, knowledge base, inference mechanisms and defuzzification. The knowledge base is designed to achieve a good dynamic response in the presence of external disturbances and uncertainty in the system parameters [5, 7, 26, 27]. In this application, the fuzzy controller inputs are the voltage error and error change.

Table 1 Fuzzy Decision Matrix
Fig. 3
figure 3

Membership functions of inputs values

The choice of the membership functions depends on the designer experience and apriori knowledge about the system. It is not trivial to choose a particular shape that is better than others. The triangular-shaped membership functions has advantages of simplicity and ease of implementation and is chosen in this application.

In the design of a fuzzy control system, the formulation of the rule set plays a key role in the performance of the system. The rule base consists of nine (9) rules as shown in Table 1, where P, Z, N are linguistic labels (P: positive, Z: zero, N: negative).

The membership functions used for the input and output variables are shown in Figs. 3 and 4.

Fig. 4
figure 4

Membership functions of output value

Various inference mechanisms existand in this paper, the max–min method is used. The center of gravity method was used to deffuzzify the implied fuzzy control variables.

(b) Sliding mode control (SMC) design

Sliding mode control theory has been widely applied in APF, due to its desirable performance characteristics such as speed of response, robustness and stability.

Peak value of supply current \(( {I_{sp}^*})\)is estimated using SMC over the actual and reference DC bus voltage (\(v_{DC} (n))\) and (\(v_{DC}^*(n))\). The DC bus voltage error \(v_e ( n)\) at the nth sampling instant is [1823]:

$$\begin{aligned} v_e ( n)=v_{DC}^*( n)-v_{DC} ( n)+x_1 \end{aligned}$$
(12)

and its derivative is defined as:

$$\begin{aligned} x_2 ={{\dot{x}}_1}=\frac{1}{T}\left[ v_e(n)-v_e(n-1)\right] \end{aligned}$$
(13)

where T is sampling interval and \(x_1 \)and \(x_2 \) are the state variables.

In SMC, the control term, \(y=sgn(\sigma )\) is defined as:

$$\begin{aligned} sgn( \sigma )=\left\{ {{\begin{array}{lll} {+1 \quad \quad \textit{if}\quad \sigma \ge 1} \\ {-1 \quad \quad \textit{if} \quad \sigma <1} \\ \end{array} }} \right. \end{aligned}$$
(14)

And the switching functions \(y_1 \) and \(y_2 \) are defined as:

$$\begin{aligned} y_1 =\left\{ {{\begin{array}{lll} {+1\quad \quad \textit{if} \quad zx_1 >0} \\ {-1 \quad \quad \textit{if} \quad zx_1 <0} \\ \end{array} }} \right. \end{aligned}$$
$$\begin{aligned} y_2 =\left\{ {{\begin{array}{lll} {+1\quad \quad \textit{if}\quad zx_2 >0} \\ {-1\quad \quad \textit{if}\quad zx_2 <0} \\ \end{array} }} \right. \end{aligned}$$
(15)
$$\begin{aligned} z=c_1 x_1 +c_2 x_2 \end{aligned}$$

where \(c_1 ,c_2 \) are constants of the SMC and z is a switching hyper plane function. This introduces chattering effect which is undesirable in any dynamic system due to its infinite switching frequency. The natural attempt to overcome the chattering is to smooth out the signal with a continuous function that closely approximate the \(sgn(\sigma )\) term especially around the neighbourhood of the sliding surface. The introduction of a small boundary layer near the surface is adapted which correspond to the substitution of \(sgn (\sigma )\) with \(sat\,(\cdot )\) function, defined as follows:

$$\begin{aligned} \text{ sat }\left( {\frac{\sigma }{\pi }}\right) =\left\{ {{\begin{array}{lll} {\frac{\sigma }{\pi }\quad \quad \quad \textit{if}\left| \sigma \right| <\pi } \\ {sgn(\sigma )\quad \text{ otherwise }} \\ \end{array} }} \right. \end{aligned}$$
(16)
$$\begin{aligned} y_1 =\left\{ {{\begin{array}{lll} {\frac{zx_1 }{\pi } \quad \quad \quad \textit{if} \left| {zx_1 } \right| <\pi } \\ {sgn(zx_1 ) \quad \text{ otherwise }}\\ \end{array} }} \right. \end{aligned}$$
(17)

where \(\prod \) is the thickness of the boundary layer. The boundary layer control which is manifested by \(sat\,(\cdot )\) is shown in Fig. 5, where \(U_{fsw} \) is the magnitude of the controller.

Fig. 5
figure 5

Boundary Layer for the sliding mode

The output of SMC is the peak magnitude of supply current,

$$\begin{aligned} u( n)=c_3 x_1 y_1 +c_4 x_2 y_2 =I_{sp}^*\end{aligned}$$
(18)

where \(c_3 \) and \(c_4 \) are constants of the SMC.

4 Simulation results

In this section, simulation results are presented to illustrate the performance of the proposed control scheme. The performance of the three phase SAPF is related to the quality of the current references, the synchronous detection method used for harmonic currents identification and calculation and the current obtained. The proposed control method allows both harmonic currents and reactive power compensation simultaneously.

The system parameters used in this simulation studies are given in Table 2.

Table 2 Parameter of the simulation circuit

The phase voltage and load current waveforms without using the SAPF are shown in Fig. 6a and b respectively. The load current is highly distorted and its Total Harmonic Distorsion (THD) calculated from the frequency spectrum shown in Fig. 6c is equal to 23 %.

Figure 7a and b show the compensating current and source current of the SAPF under PI controller. In Fig. 8a and b are shown the same currents of the SAPF with the proposed HFSMC. The THD values for the PI and HFSMC are equal to 3 and 3.9 % respectively (Figs. 7c, 8c) and are with in the allowable harmonic limit. Figures 7d and 8d show the DC capacitor voltage response with PI and HFSMC controllers respectively.

The results show a good transient performance of the source current, good regulation of the DC side capacitor voltage and sinusoidal waveform of the source current.

The chattering effects due to the SMC scheme have been reduced with appropriate selection of fuzzy rules which consist of freezing the controller gains when steady-state condition is reached [24, 25]. The proposed HFSMC provides superior performance as compared to a conventional PI, a basic fuzzy logic and sliding mode controller and has the ability to improve the tracking performance of DC side voltage, enhances the robustness of the entire control system and reduce chattering.

Fig. 6
figure 6

Simulation results before filtering a source voltage, b source current and c THD of source current. a Time(S), b time(S), c order of Harmonic

Fig. 7
figure 7

SAPF control using PI Controller a Filter current b source current c THD spectrum d Response of DC-link capacitor voltage. a Time(S), b time(S), c order of Harmonic, d time(S)

Fig. 8
figure 8

SAPF control using Hybrid Fuzzy Sliding Mode Controller a Filter current, b source current, c THD spectrum, d response of DC-link capacitor voltage. a Time(S), b time(S), c order of Harmonic, d time(S)

5 Conclusion

A Hybrid Fuzzy Sliding Mode Controller (HFSMC) is designed in this paper for shunt active power filter by combining sliding mode control with fuzzy logic control.The results show the superiority and effectiveness of the proposed HFSMC in terms of eliminating harmonics, response time. The THD is significantly reduced from 23.74 to 3.9 % with a conventional PI controller and to 3 % with the proposed HFSMC controller, which are conform with the IEEE standard norms. The proposed HFSMC does not need the accurate model of the system, so it is relatively easy to design and implement. Hence, this proposed controller could be a potential candidate to control shunt active power filter based on Static Var Compensator (SVC) inverter topology toward eliminating the harmonic currents and improving the power factor.