*3.2. Closed-Loop Stability*

In this section, we show the boundedness of both the tracking error and the adjustable parameters via the Lyapunov function analysis. Equation (30) can be rewritten as

$$\beta(\mathbf{x})u = \left(y\_{ref}^{(r)} - y^{(r)}\right) + \mathbf{K}\underline{\mathbf{e}} + y^{(r)} - \mathbf{\hat{n}}(\mathbf{x})\tag{31}$$

Using Equation (25) in Equation (31) to obtain the following error equation in terms of the fuzzy approximation errors, it becomes

$$
\begin{bmatrix} \mathbf{e}\_1^{(r\_1)} \\ \mathbf{e}\_2^{(r\_2)} \end{bmatrix} = \begin{pmatrix} y\_{ref}^{(r)} - y^{(r)} \\ \end{pmatrix} = -\mathbf{K}\boldsymbol{\varepsilon} + (\mathbb{A}(\mathbf{x}) - \mathbf{a}(\mathbf{x})) + (\beta(\mathbf{x}) - \beta(\mathbf{x}))\boldsymbol{\mu} \tag{32}
$$

From Equation (32), the error equation for the *ith* output becomes

$$\varepsilon\_i^{r\_i} = -k\_i \underline{\varepsilon}\_i + \Delta \alpha\_i(\mathbf{x}) + \sum\_{j=1}^p \Delta \beta\_{i\bar{j}}(\mathbf{x}) u\_{\bar{j}} \tag{33}$$

where <sup>Δ</sup>*αi*(*x*) = *<sup>α</sup>*<sup>ˆ</sup>*i*(*x*) − *<sup>α</sup>i*(*x*) and <sup>Δ</sup>*βij*(*x*) = *β*<sup>ˆ</sup>*ij*(*x*) − *βij*(*x*) are the fuzzy approximation errors.

In state-variable form, the error equation of the *ith* output Equation (33) takes the form

$$\dot{\boldsymbol{e}}\_{i} = \boldsymbol{A}\_{i}\boldsymbol{e}\_{i} + [\Delta\boldsymbol{a}\_{i}(\boldsymbol{x}) + \sum\_{j=1}^{p-2} \Delta\beta\_{ij}(\boldsymbol{x})\boldsymbol{u}\_{j}]\boldsymbol{b}\_{i} \tag{34}$$

where *Ai* and *bi* are given by

$$\begin{cases} \begin{array}{c} A\_1 = -k\_{01} \ b\_1 = 1 \\ 0 < b\_{12} \end{array} \\ \begin{array}{c} A\_2 = \begin{bmatrix} 0 & 1 \\ -k\_{12} & -k\_{02} \end{bmatrix} \end{cases} \end{cases} \tag{35}$$

**Theorem 1.** *The closed-loop tracking error e* = *e*1 *e*2*T is globally ultimately bounded if the updating laws of the parameter vectors θi* ∈ *RM*×<sup>1</sup> *and θij* ∈ *RM*×<sup>1</sup> *are chosen as in Equations (36) and (37):*

$$\dot{\theta}\_i = -\gamma\_i e\_{\int\_i}^T P\_i b\_i \xi(\mathbf{x}) \tag{36}$$

$$\dot{\theta}\_{i\dot{j}} = -\gamma\_{i\dot{j}} e\_{\dot{j}}^T P\_i b\_i \mathfrak{z}(\mathbf{x}) u\_{\dot{j}} \tag{37}$$

*where γi and γij are design parameters and Pi is a unique positive definite matrix solution of the Lyapunov Equation (38) with arbitrary positive definite matrix Qi*

$$A\_i{}^T P\_i + P\_i A\_i = -Q\_i \tag{38}$$

**Proof.** Define the minimum fuzzy approximation error *wi* in terms of the optimal values of adjustable parameters *θ*∗*i* and *θ*∗*ij* as

$$w\_i = \left[\mathbb{A}\_i(\mathbf{x} \mid \theta\_i^\*) - a\_i(\mathbf{x})\right] + \sum\_{j=1}^{p=2} \left[\mathbb{A}\_{ij}\left(\mathbf{x} \mid \theta\_{ij}^\*\right) - \beta\_{ij}(\mathbf{x})\right] \mu\_j \tag{39}$$

Add and subtract the terms *<sup>α</sup>*<sup>ˆ</sup>*i<sup>x</sup>* | *θ*∗*i* and *β*<sup>ˆ</sup>*ij*(*<sup>x</sup>* | *θ*∗*ij*) to Equation (34) and then use the definition given in Equation (39) to obtain the following error equation

$$\dot{e}\_{i} = A\_{i}e\_{i} + b\_{i}[w\_{i} + \boldsymbol{\varphi}\_{a\_{i}}^{T}\boldsymbol{\xi}(\boldsymbol{x}) + \sum\_{j=1}^{p-2} \boldsymbol{\varphi}\_{\beta\_{ij}}^{T}\boldsymbol{\xi}(\boldsymbol{x})u\_{j}] \tag{40}$$

where *ϕαi*<sup>=</sup> (*θ i*−*θ*<sup>∗</sup>*i* ) and *ϕβij* = *<sup>θ</sup>ij*−*θ*<sup>∗</sup>*ij* are the parameter errors. Note that the derivatives of these parameter errors are given by:

.

.

$$
\dot{\varphi}\_{a\_i} = \dot{\theta}\_i \tag{41}
$$

$$
\dot{\varphi}\_{\not p\_{ij}} = \dot{\theta}\_{ij} \tag{42}
$$

 The following positive Lyapunov function is formulated as a quadratic function of the error involved, namely the tracking error (34) and the parameter error (41) and (42):

$$V\_i = \frac{1}{2} \varepsilon\_i^T P\_i \varepsilon\_i + \frac{1}{2\gamma\_i} \varphi\_{a\_i}^T \varphi\_{a\_i} + \sum\_{j=1}^{p-2} \frac{1}{2\gamma\_{ij}} \varphi\_{\beta\_{ij}}^T \varphi\_{\beta\_{ij}} \tag{43}$$

The time derivative of Equation (43) along the trajectories Equations (40)–(42) is found as:

$$\dot{V}\_{i} = -\frac{1}{2}\boldsymbol{\varepsilon}\_{i}^{T}\mathbf{Q}\_{i}\boldsymbol{\varepsilon}\_{i} + \frac{1}{\gamma\_{i}}\boldsymbol{\varrho}\_{a\_{i}}^{T}\left(\dot{\theta}\_{i} + \gamma\_{i}\boldsymbol{\varepsilon}\_{i}^{T}\boldsymbol{P}\_{i}\mathbf{b}\_{i}\mathbf{\hat{y}}(\mathbf{x})\right) + \left(\frac{1}{\gamma\_{i\bar{\imath}}}\sum\_{j=1}^{p=2}{\boldsymbol{\varrho}\_{\bar{\jmath}\_{\bar{\imath}}}^{T}\dot{\theta}\_{i\bar{\jmath}}}\dot{\theta}\_{i\bar{\jmath}} + \boldsymbol{\varepsilon}\_{i}^{T}\boldsymbol{P}\_{\bar{\imath}}\dot{\theta}\_{i}\sum\_{j=1}^{p=2}{\boldsymbol{\varrho}\_{\bar{\jmath}\_{\bar{\imath}}}^{T}\dot{\mathbf{y}}\_{i}^{T}(\mathbf{x})\boldsymbol{u}\_{j}}\right) + \boldsymbol{\varepsilon}\_{i}^{T}\boldsymbol{P}\_{\bar{\imath}}\dot{\theta}\_{i\bar{\imath}}\mathbf{w}\_{i}\tag{44}$$

Now, substituting the parameters' updating laws in Equations (36) and (37) in Equation (44) to get:

$$\dot{V}\_i = -\frac{1}{2} e\_i^T Q\_i e\_i + e\_i^T P\_i b\_i w\_i \tag{45}$$

Provided that *ei* ≥ <sup>4</sup>*σiλmax*(*Pi*) *βiλmin*(*Qi*) = *ri* , it is straightforward to write Equation (45) in

the form

$$\dot{V}\_i \le -\frac{1}{2}(1 - \beta\_i)\lambda\_{\min}(Q\_i)\left\|c\_i\right\|^2\tag{46}$$

where 0 < *βi* < 1, *<sup>σ</sup>i*> 0, such that *wi* ≤ *σi*, *<sup>λ</sup>min*(*Qi*) and *<sup>λ</sup>max*(*Pi*) are the minimum and maximum eigenvalues of the indicated matrices and ||.|| stands for the Euclidean norm. From the positive definiteness of Equation (43) and the negative definiteness of Equation (46), we conclude that the tracking error is globally ultimately bounded with bound *μbi*= *ri<sup>λ</sup>max*(*Pi*) *<sup>λ</sup>min*(*Pi*) [47]. In Equation (43), the Lyapunov function is quadratic; the non-quadratic Lyapunov function can also be used in adaptive schemes for better performance [49]. -

#### **4. Implementation of the Proposed Adaptive Fuzzy Controller for GCIS**

In order to implement the proposed AFC based on feedback linearization given by Equations (26), (27), (32), (36), and (37), fuzzy sets *Fik* have to be selected where *i* = 1, 2, ... *N*, *N* is the number of the fuzzy sets and *k* = 1, 2, 3. The fuzzy sets are utilized to determine the vector of FBFs given in Equation (28). To this end, three Gaussian fuzzy sets, namely Negative (N), Zero (Z), and Positive (P) are used to generate the FBFs for each

state of the system. These fuzzy sets are characterized by the membership functions. The general form of the membership functions of Gaussian type is given by

$$\mu\_{F\_k^i}(\mathbf{x}\_k) = \exp\left(-\frac{\left(\mathbf{x}\_k - \overline{\mathbf{x}}\_k^i\right)^2}{\sigma\_k^i}\right) \tag{47}$$

where *xik*and *σik*are the center and the width of the *ith* fuzzy set *Fik*.

The block diagram of the proposed controller is shown in Figure 2. It can be seen in the block diagram that the grid voltage and current are transformed into a *dq* frame from an *abc* frame. The control laws in Equations (36) and (37) were used to estimate the unknown parameters of GCIS, where the calculation initially started from chosen initial values of *θi* and *<sup>θ</sup>ij*. Then, AFC low in Equation (30) was applied to generate the control signals. The PWM was generated by applying space vector pulse width modulation (SVPWM) to drive the inverter. Note that the signal *Vdcref*is released from the MPPT algorithm.

**Figure 2.** The proposed adaptive fuzzy control (AFC) technique for the grid connected inverter system (GCIS).

#### **5. Simulation Cases and Results**

To examine the effectiveness of the proposed controller performance, the proposed AFC was implemented and tested in the MATLAB/SIMULINK [50] environment for a GCIS having the parameters as listed in Table 1. The other design parameters were selected as *k*01 = 10, *k*02 = *k*12 = 10, 000, *γ*1<sup>=</sup> 40, *γ*2<sup>=</sup> 0.01, *γ*11 = 0.01, *γ*12 = 0.1, *γ*21 = 0.1, and *γ*22 = 1. The selected positive definite matrices *Qi* and the unique positive definite matrix solution *Pi*, *i* = 1, 2 that appeared in Lyapunov Equation (38) are given by

$$Q\_1 = 100, \ Q\_2 = \begin{bmatrix} 2000 & 0\\ 0 & 1 \end{bmatrix}, \ P\_1 = 5, \ P\_2 = \begin{bmatrix} 1000.6 & 0.1\\ 0.1 & 0.00006 \end{bmatrix}$$

**Table 1.** System parameters.


For each state of the system, the parameters of the Gaussian membership functions given in Equation (47) are listed in Table 2. The membership functions for the state *x*1 are shown in Figure 3, as an example for states membership functions.

**Table 2.** Parameters of the Gaussian membership functions.


**Figure 3.** Membership functions for *x*1.

The proposed AFC was studied under different operating cases as unity power factor tracking, tracking of power factor changes, and robust tracking. Smooth reference values were used for all simulation cases.

#### *5.1. Case I: Unity Power Factor Tracking*

In this case, simulation was carried out by selecting the reference grid current components as *iqre f* = 0.0 A, which corresponds to unity power factor. The output voltage and current are shown in Figure 4. The figure clearly shows that the grid current is in phase with grid voltage, which indicates unity PF operation. Figure 5a,b depicts the reactive *iq* and

active *id* current tracking output of the proposed controller. The DC voltage and reference voltage are shown in Figure 6. The control signal *u*1 and *u*2 are shown in Figure 7a,b, from which it can be noticed that they are bounded. From the obtained result in case of the unity power factor, it can be stated that the proposed controller provides excellent tracking performance with bounded tracking error and bounded control signals.

**Figure 4.** Output voltage current.

**Figure 6.** DC voltage and reference voltage.

#### *5.2. Case II: Tracking of Power Factor Changes*

In this case study, the performance of the proposed AFC was tested for power factor tracking. At the start, the system was assumed to operate at unity power factor with *iqre f* = 0, then a step change of 10 A in *iqre f* at 0.4 s was applied. This change in *iqre f* corresponded to a change in the power factor to 0.937. Figure 8a,b display the effect of changes in *iqre f* , *iq*, and *id*. The results demonstrate that *iq* reaches its new reference quickly. Hence, the obtained results clearly prove that the proposed AFC has the ability to track power factor changes. The output voltage and current are shown in Figure 9. A phase shift can be noticed between current and voltage after t = 0.4 s, confirming the tracking of the desired power factor. The active and reactive power delivered by the inverter to the grid are shown in Figure 10a,b, confirming the proposed controller tracking ability. The bounded control signals *u*1= *vd*and *u*2= *vq* are shown in Figure 11a,b.

**Figure 8.** Grid current components: (**a**) *iq*, *iqref* ; (**b**) *id*.

**Figure 11.** Control signals: (**a**) *u*1= *vd*; (**b**) *u*2= *vq*.

To evaluate the effectiveness of AFC, the performance of the proposed controller was compared with the PI controller as in [51]. The comparison was conducted for power factor change tracking case by applying a step change of 10 A in *iqre f* at 0.4 s. Figure 12 demonstrates the performance of the proposed AFC and PI controller. The result illustrates that the tracking between *iq* and *iqre f* after the step change occurs has less fluctuations and overshooting in case of proposed AFC in comparison to the PI controller. Moreover, a comparison between the performance of the proposed controller, the PI controller, and the TSKPFNN controller presented in [35] is shown in Table 3. From the illustrated results in Table 3, it can be said that the performance of proposed AFC is better and exceeds the PI controller and TSKPFNN controller performances.

**Figure 12.** Comparison between PI controller and AFC with power factor tracking.

**Table 3.** Comparison between the performance of the proposed controller, PI, and TSKPFNN controllers.


#### *5.3. Case III: Robust Tracking*

In certain cases, the parameters used in the GCIS are either time-varying or not precisely defined, so there are often parametric uncertainties where the filters connected to the grid inductance value change over time, affected by the impedance value of the grid which varies depending on the grid structure and conditions leading to resonance and instability problems. In addition, due to changes in ambient operating temperature or changes in applied voltage and frequency, DC Link capacitance values can change.

, In this simulation case, the robustness of the proposed AFC was tested for GCIS parameter variations. Simulations were carried out for different percentages of variations in filter inductor *L* and dc-link capacitor *C*. Grid reactive current component *iq*, with 10% variations in filter inductor *L*, is shown in Figure 13. Figure 14 illustrates the bounded control signals of the proposed controller with the same variation in *L*. The obtained results illustrate the robustness of the AFC with filter inductor increase.

**Figure 13.** *iq* & *iqre f* with 10% increase in *L*.

.

**Figure 14.** Control signals with 10% increase in *L*: (**a**) *u*1= *vd* (**b**) *u*2= *vq*.

To study the robustness of the proposed AFC for variations dc-link capacitor *C*, simulations were carried out for 30% increase and carried again for 20% decrease in *C*. The performance of the GCIS with proposed AFC with applied variations is shown in Figures 15–18, where Figure 15a,b displays *iq* and *id* with 30% increase in *C.* Grid voltage and current with the same increase in C are shown in Figure 16. For the case of the 20% decrease in *C*, Figure 17 illustrates the bounded control signals; tracking between *iq* and *iqre f* , is shown in Figure 18. The obtained simulation results with variations in *C* prove the robustness of the controller. Furthermore, Figure 19 displays the performance of the proposed controller for variation in the inductor and capacitor at the same time with 10% increase in *L* and 30% increase in *C*.

**Figure 15.** GCIS performance with 30% increase in *C*: (**a**) *iq*, *iqre f* , (**b**) *id*.

**Figure 19.** *iq* & *iqref* with simultaneous 10% increase in *L* and 30% increase in *C*.

From all conducted simulation results for parameter uncertainties, the performance of the GCIS proves that the proposed AFC is capable to cope with the uncertainty of the GCIS parameters and achieve the desired tracking performance.

#### *5.4. Case IV: Tracking in the Presence of Model Uncertainity*

The proposed AFC given in (30) can achieve tracking in presence of modelling uncertainties that are inherent in the nature of the GCIS. The presence of the PV in the GCIS model given by (10) is the main reason for the modelling uncertainties and to account for these uncertainties, Equation (10) can be rewritten as follows:

$$
\dot{\mathbf{x}} = (f(\mathbf{x}) + \Delta f(\mathbf{x})) + \,\,\lg(\mathbf{x})u\tag{48}
$$

where <sup>Δ</sup>*f*(*x*) is the uncertainty associated with *f*(*x*) and given by

$$
\Delta f \,\,= \begin{bmatrix}
\Delta f\_1 \\
\Delta f\_2 \\
\Delta f\_3
\end{bmatrix} \tag{49}
$$

In this case, the function *α*(*x*) given in Equation (17) that results from feedback linearization will be perturbed by <sup>Δ</sup>*α*(*x*) given by

$$
\Delta a(\mathbf{x}) = \begin{bmatrix} \Delta f\_2 \\ \Delta a\_2 \end{bmatrix} \tag{50}
$$

In (50), Δ*α*2 is given by

.

$$
\Delta \alpha\_2 = -\frac{1}{\mathbb{C} \, \mathbf{x}\_3} \left( \upsilon\_{\mathbb{S}^d} \Delta f\_1 + \upsilon\_{\mathbb{S}^q} \Delta f\_2 \right) + n \, \Delta f\_3 \tag{51}
$$

where *n* = (*vgd <sup>x</sup>*1+*vgqx*2) *Cx*23

To test the tracking performance of the proposed AFC against modeling uncertainty, we assumed there is an uncertainty <sup>Δ</sup>*f*3 = 5% which is mainly due to the presence of the PV current. The other uncertainties <sup>Δ</sup>*f*1 = <sup>Δ</sup>*f*2 were assumed zero. The simulation result for tracking *iqre f* is shown in Figure 20. It can be seen that even with modeling uncertainty, the proposed AFC controller is able to track the reference reactive current *iqre f* and keep the GCIS operating at the unity power factor.

**Figure 20.** *iq* & *iqref* with modeling uncertainty <sup>Δ</sup>*f*3= 5%.
