*3.4. Defuzzification*

Defuzzification is the final step to obtain the real output value, and in this paper, the Takagi–Sugeno method is used because it is simple to implement and fast for computation. It is executed by forming rule output level matrix *H*, shown in Equation (18). Elements of matrix *H* are calculated using Equation (19). This equation is structured for each element in matrix *H* and its coefficients depend on the output linguistic value *Z* ¯ *nm* defined by Table 1.

$$H = \begin{bmatrix} h\_{11} & \dots & h\_{1m} \\ \vdots & \ddots & \vdots \\ h\_{n1} & \dots & h\_{nm} \end{bmatrix} \tag{18}$$

$$h\_{nm} = c\_{nm}\boldsymbol{\alpha}\_1 + d\_{nm}\boldsymbol{\alpha}\_2 + c\_{nm}$$

$$\boldsymbol{c}\_{nm} = \begin{cases} c\_{N\prime} & Z\_{nm} = N \\ c\_{Z\prime} & Z\_{nm} = Z \\ c\_{P\prime} & Z\_{nm} = P \end{cases} \quad d\_{nm} = \begin{cases} d\_{N\prime} & Z\_{nm} = N \\ d\_{Z\prime} & Z\_{nm} = Z \\ d\_{P\prime} & Z\_{nm} = P \end{cases} \quad \boldsymbol{c}\_{nm} = \begin{cases} \boldsymbol{c}\_{N\prime} & Z\_{nm} = N \\ \boldsymbol{c}\_{Z\prime} & Z\_{nm} = Z \\ \boldsymbol{c}\_{P\prime} & Z\_{nm} = P \end{cases} \tag{19}$$

$$n, m \in [1, 5]$$

Defuzzified output controller value *z* is calculated from matrices *W* and *H*, as shown in Equation (20).

$$z = \frac{\sum\_{i=n}^{5} \sum\_{m=1}^{5} w\_{nm} h\_{nm}}{\sum\_{i=n}^{5} \sum\_{m=1}^{5} w\_{nm}} \tag{20}$$

The final topology of the FLC that is used in the paper is shown in Figure 4. It can be seen that there are four additional parameters: *Be* and *Bce* are base values, which are used to scale the inputs of the fuzzy controller, since input membership functions are chosen to be unit piecewise functions. *KP f* and *KI f* serve as proportional and integral gains on the produced fuzzy error.

**Figure 4.** Topology of the fuzzy controller.

It can be seen from Figure 1 that the described fuzzy logic controller is used as a speed controller to generate torque reference, which implicitly generates the reference *β*-current component through some scaling and reference frame transformation. Based on the selected input membership functions, output level functions, and base and gain values of the controller, there are 33 parameters, represented by vector *θ* in Equation (21), that need to be tuned to accurately control the drive. Vector *θ* is also called a decision variable vector that is used in the fuzzy controller optimization procedure, which is explained in the following section.

$$\begin{aligned} \theta &= \{a\_{11} \ldots a\_{i\mathbf{k}}, b\_{11} \ldots b\_{i\mathbf{k}\prime}, c\_{\mathbf{N}\prime}, c\_{\mathbf{Z}\prime}, c\_{\mathbf{P}\prime}, d\_{\mathbf{N}\prime}, d\_{\mathbf{Z}\prime}, e\_{\mathbf{N}\prime}, e\_{\mathbf{Z}\prime}, e\_{\mathbf{P}\prime}, B\_{\mathbf{e}\prime}, K\_{\mathbf{P}\prime}, K\_{\mathbf{I}\prime}\} \\ &= \{\theta\_{1\prime}, \theta\_{2\prime}, \ldots, \theta\_{33}\}, \quad k \in [1, 5], i \in \{1, 2\} \end{aligned} \tag{21}$$

#### **4. Optimization of Fuzzy Logic Controller**

In the following text, the optimization procedure of the FLC is explained. The problem statement is given, the objective function structure with decision variables and their boundaries is selected, and the optimization tool is described.

## *4.1. Problem Statement*

In the proposed control method, FLC is employed as a speed controller that produces a torque reference for PCC of an induction machine. The reference torque must change in a timely manner to produce minimal speed tracking error and have a minimal amount of overshoot so that it does not stress the rotor shaft. To meet these demands, optimal FLC parameters must be calculated. FLC is defined by a large number of parameters, and to find the optimal combination of them, optimization must be employed. Parameters calculated in the optimization process highly depend on the criteria used to calculate the objective function value. The following text provides insight into how different criteria affect the final results. By finding the correct criterion, optimal parameters that produce the best induction machine drive performance can be obtained.
