## 2 Hybrid Active Power Filter Concept
Then, selecting the desired reference vectors as \(X_{d}\), the error function is found in Equation (8):  
\[E=X-X_{d}. \tag{8}\]  
Substituting Equation (8) for Equation (7) yields that:  
\[\frac{d}{dt}E=A_{L}E+B_{L}u-\frac{d}{dt}X+\Delta H+\Delta h. \tag{9}\]  
Utilizing high-order sliding mode control approaches will be useful to remove the chattering effect in switching functions. Thus, in order to delete the steady-state system error, the sliding surface is chosen as shown in Equation (10). \[\vartheta=k_{1}E+k_{2}\int\limits_{0}^{t}E\,dt \tag{10}\]where \(k_{1}\) and \(k_{2}\) are constant vectors. Using the differentiate from Equation (10) will result in:  
\[\frac{d}{dt}\vartheta=k_{1}(A_{L}E+B_{L}u-\frac{d}{dt}X+A_{L}X_{d}+\Delta H+ \Delta h)+k_{2}E. \tag{11}\]  
The main idea for implementing SMC in this control system is described in the following. In the first step, the sliding surface (\(\vartheta\)) is defined regarding the tracking error. In the second step, the inputs are designed due to \(\vartheta\) being obtained. In the third step, \(\vartheta\) and its derivative must turn in to get a zero amount. In other words, the system paths leading to the \(\vartheta-\dot{\vartheta}\) plane are converged to the balance point with equation \(\vartheta=\dot{\vartheta}=0\). This definition is plotted in Figure 4.  
Using the derivative from Equation (11) to achieve the second-order SMC is conducted to:  
\[ \begin{split}\frac{d^{2}}{dt^{2}}\vartheta=\Big{(}k_{1}A_{L}^{2} +k_{2}A_{L}\Big{)}+k_{1}A_{L}B_{L}u+\Big{(}k_{1}A_{L}^{2}+k_{2}A_{L}\Big{)}E+ X_{d}-k_{2}\frac{d}{dt}X_{d}-k_{1}\frac{d^{2}}{dt^{2}}X_{d}\\ +(k_{1}A_{L}+k_{2})(\Delta H+\Delta h)+k_{1}\frac{d}{dt}(\Delta H +\Delta h)+k_{1}B_{L}\frac{d}{dt}u.\end{split}  \tag{12}\]  
If the possibility for reaching zero for \(\vartheta\) and its derivative in steady state by using the \(\dot{u}\) signal is obtainable, then the real input of the system is going to be achieved considering the integral of the \(\dot{u}\) signal. Therefore, the multi-state SMC sliding surface is defined as shown in Equation (13). \[S=\gamma\vartheta+\frac{d}{dt}\vartheta \tag{13}\]  
where \(\gamma\) is constant, and to calculate \(\dot{S}\), it could be done that:  
\[\begin{split}\dot{S}=\gamma\frac{d}{dt}\vartheta+\frac{d^{2}}{dt^ {2}}\vartheta=\Big{(}k_{1}A_{L}^{2}+k_{2}A_{L}+\gamma k_{1}  
where \(m_{1}\) and \(m_{2}\) are positive constant coefficients. In this way, a suitable control rule should be defined for a closed loop system to place the state variable on a sliding surface. Using the Lyapunov function written in Equation (17) will guarantee the system's stability.  
\[V=\frac{1}{2}\ S^{2} \tag{17}\]  
To ensure the stability of the whole system, the first derivative of the aforementioned Lyapunov function must by semi-definite negative. Therefore, we have:  
\[ \begin{array}{c}\frac{d}{dt}V=S\times\frac{d}{dt}S=S\Big{(}\!\Big{(}k_{1}A_{ L}^{2}+k_{2}A_{L}+\gamma k_{1}A_{L}+\gamma k_{2}\Big{)}E+(k_{1}A_{L}B_{L}+k_{2}B_{L}+ \gamma k_{1}B_{L})u\\ +\Big{(}k_{1}A_{L}^{2}+k_{2}A_{L}+\gamma k_{1}A_{L}\Big{)}X_{d}-(\gamma k_{1} +k_{2})\frac{d}{dt}X_{d}-\frac{d}{dt^{2}}X_{d}+k_{1}B_{L}\frac{d}{dt}u\\ +(\gamma k_{1}A_{L}+\gamma k_{2}+\gamma k_{1})(\Delta H+\Delta h)+k_{1}\frac{d }{dt}(\Delta H+\Delta h)\Big{\}}\end{array}  \tag{18}\]  
Substituting Equation (14) to Equation (16) results in:  
\[ \begin{array}{c}\dot{u}=-(k_{1}B_{L})^{-1}\Big{\{}\Big{(}k_{1}A_{L}^{2}+k_{2 }A_{L}+\gamma k_{1}A_{L}+\gamma k_{2}\Big{)}E+(k_{1}A_{L}B_{L}+k_{2}B_{L}+ \gamma k_{1}B_{L})u\\ +\Big{(}k_{1}A_{L}^{2}+k_{2}A_{L}+\gamma k_{1}A_{L}\Big{)}X_{d}+m_{1}S+m_{2} sign(S)\end{array}  \tag{19}\]  
where the uncertainties and external attenuation applied to the reference vector are considered to be zero. The vector \((k_{1}B_{L})^{-1}\) is non-zero, which has been obtained by the proper designing of the sliding surface coefficient \(k_{1}\). Substituting Equation (19) in Equation (18) results in:  
\[