The equation of the PID transfer function is given in (3):

$$ K(s) = K_{\text{p}} + \frac{{K_{\text{i}} }}{s} \, + \, K_{\text{d}} \, s $$

(3)

where *K*_{p}, *K*_{i} and *K*_{d} are the proportional, integral and differential gains, respectively. Ant colony optimization (ACO) is used to obtain optima PID gains. Using the ant colony optimization process to find the optimal parameters of the controller such that to minimize or maximize a given cost function of the closed loop system consisting of an ant based PID controller and an unknown plant [17] the effectiveness of the PID based ant colony was investigated by the following parameters variation test [20, 21]. The performance criteria of the system were given in [17], and the optimal gains of the PID controllers were *K*_{p} = 60, *K*_{i} = 20 and *K*_{d} = 3.

### Type-2 fuzzy logic systems

There are two different approaches for FLSs design: type-1 FLSs (T1FLSs) and type-2 FLSs (T2FLSs). The latter is proposed as an extension of the former. While designing a T1FLSs, expertise and knowledge are needed to decide both the MFs and fuzzy rules. The T1FLSs, whose MFs are type-1 fuzzy sets, are unable to directly handle rule uncertainties [12, 21]. To deal with this problem, the concept of type-2 fuzzy sets was introduced by Zadeh as an extension of T1FLSs with the intention of being able to model the uncertainties that invariably exist in the rule base of the system [22].

### Type-2 fuzzy sets (T2 FSs)

A T2 FS, denoted \( \tilde{A} \), is characterized by a type-2 MF \( \mu_{{\tilde{A}}} = \left( {x, \, u} \right) \), where *x* ∈ *X* and \( u \in Jx \subseteq [0,1],\;{\text{i}} . {\text{e}}., \)

$$ \tilde{A} = \left\{ {\left( {\left( {x,u} \right),\mu_{{\tilde{A}}} \left( {x,u} \right)} \right)\left| {\forall x \in X,\forall u \in J_{x} \subseteq [0,1]} \right.} \right\} $$

(4)

in which \( 0 \le \mu_{\ A} \left( {x, u} \right) \le 1. \) \( \tilde{A} \) can also be expressed as

$$ \tilde{A} = \int\nolimits_{x \in X} \int\nolimits_{{u \in J_{x} }} \frac{{\mu_{\ A} \left( {x, u} \right)}}{{\left( {x, u} \right)}}J_{x} \subseteq \left[ { 0,1} \right] $$

(5)

where \( {\iint } \) denotes union over all admissible *x* and *u*. For discrete universes of discourse, \( \int\nolimits \) is replaced by \( \sum \) [12, 21].

### Interval type-2 fuzzy sets

When all \( \mu_{{\tilde{A}}} \left( {x, u} \right) = 1 \), \( \tilde{A} \) is an interval T2 FS (IT2 FS). Although the third dimension of the general T2 FS is no longer needed because it conveys no new information about the IT2 FS, the IT2 FS can still be expressed as a special case of the general T2 FS in (5), as [22]:

$$ \tilde{A} = \int\nolimits_{x \in X} \int\nolimits_{{u \in J_{x} }} \frac{1}{{\left( {x, u} \right)}}J_{x} \subseteq \left[ { 0,1} \right] $$

(6)

$$ \tilde{A} = \int\nolimits_{{x \in D_{x} }} \int\nolimits_{{u \in J_{x} \subseteq \left[ {0,1} \right]}} \frac{1}{{\left( {x,u} \right)}} = \int\nolimits_{{ \in D_{x} }} \left[ {\int\nolimits_{{u \in J_{x} \subseteq \left[ {0,1} \right]}} \frac{1}{u}} \right]/x $$

(7)

where *x*, called the primary variable, has domain \( D_{{\tilde{X}}} :u \in \left[ {0,1} \right] \), called the secondary variable, has domain \( J_{x} \subseteq \left[ {0,1} \right] \) at each \( x \in D_{{\tilde{X}}} ;J_{x} \) is also called the primary membership of *x* and the amplitude of \( \mu_{{\tilde{x}}} \left( {x,u} \right) \), called a secondary grade of \( \tilde{A} \), equals 1 for \( \forall x \in D_{{\tilde{X}}} \) and for \( \forall u \in J_{x} \subseteq [0,1 \)].

The upper membership function (UMF) and lower membership function (LMF) of \( \tilde{A} \) are two T1 membership functions that bound the footprint of uncertainty (FOU) as shown in Fig. 7. The UMF of \( \tilde{A} \) is the upper bound of the FOU \( ( {\tilde{A}} ) \) and denoted as \( \bar{\mu }_{{\tilde{x}}} \left( x \right)\forall x \in X \), and the LMF is the lower bound of the FOU \( ( {\tilde{A}} ) \) and denoted as \( \underline{\mu }_{{\tilde{x}}} \left( x \right)\forall x \in X \). The UMF and LMF can be characterized as follows [23, 24]:

$$ \bar{\mu }_{{\tilde{x}}} \left( x \right) = \overline{{{\text{FOU}}( {\tilde{A}} )}} \forall x \in X $$

(8)

$$ \underline{\mu }_{{\tilde{x}}} \left( x \right) = \underline{{{\text{FOU}}( {\tilde{A}} )}} \forall x \in X $$

(9)

The computations of fuzzification and inference for IT2-FLC were given and discussed in [12, 22,23,24]. For this operation, type reduction to convert IT2-FLC into a T1-FLC is performed [23, 24]. There are several methods of type reduction. In this paper, the “center-of-sets” type reduction is used. The calculations of this method were done and given in [23]. In addition, the defuzzification method is determined to convert type-reduced set to crisp output of an IT2-FLS [23, 24].

### Online interval type-2 fuzzy self-tuning for the OPID controller

Figure 8 shows the block diagram of an IT2F-PID controller for SPMSM. For the system under study, the universe of discourse for both *e*(*t*) and Δ*e*(*t*) for *K*_{p2}, *K*_{i2} and *K*_{d2} is normalized with [− 0.9, 0], [− 0.01, 0] and [− 0.1, 0], respectively, while the universe of discourse for each *K*_{p2}, *K*_{i2} and *K*_{d2} is normalized from [0, 5.5], [0, 10] and [0, 0.4], respectively. The linguistic labels are {negative big, negative medium, negative small, zero, positive small, positive medium, positive big}, and the linguistic labels of the outputs are {zero, medium small, small, medium, big, medium big, very big}. The IT2 of membership function for *e*(*t*) and Δ*e*(*t*) and for the output *K*_{p2} is shown in Figs. 9 and 10, respectively. The membership functions for *e*(t) and Δ*e*(*t*) and for *K*_{i2} and *K*_{d2} are similar to Figs. 9 and 10, respectively, but with different universes of discourse values.

The control rules used for T1FST of OPID controller for determining the output gains from fuzzy controller were given [7, 17].

This general equation of the PID can be written as:

$$ U = K_{\text{p}} + K_{\text{i}} \int\nolimits e{\text{d}}t + K_{\text{d}} \frac{{{\text{d}}e\left( t \right)}}{{{\text{d}}t}} $$

(10)

This equation of the PID after fuzzy effect can be written as:

$$ U = K_{{{\text{p}}3}} + K_{{{\text{i}}3}} \int\nolimits e{\text{d}}t + K_{{{\text{d}}3}} \frac{{{\text{d}}e\left( t \right) }}{{{\text{d}}t}} $$

(11)

where

$$ K_{{{\text{p}}3}} = K_{\text{p}} *K_{{{\text{p}}2}} ,\quad K_{{{\text{i}}3}} = K_{\text{i}} *K_{{{\text{i}}2}} ,\quad K_{{{\text{d}}3}} = K_{\text{d}} *K_{{{\text{d}}2}} $$

*K*_{p2}, *K*_{i2} and *K*_{d2} are the output gains from fuzzy controller of IT2FST, where *K*_{ei} error input normalizing gain, *i* = 1, 2, 3; *K*_{∆ei}, ∆error input normalizing gain, *i* = 1, 2, 3.