## 6 Implementation of the Dynamic Fuzzy Logic Controller (Dynamic FLC)
### Dynamic Fuzzy Reasoning Process Optimized by the PSO  
Figure 8 shows that in addition to the 17 dimensions of the dynamic fuzzification process, another additional 5 consequent dimensions were taken into consideration. The first 3 consequent axes represent the linguistic variables, and in the other remaining two axes one axis represents either the \"and\" fuzzy operator (minimum) or the \"or\" fuzzy operator (maximum) between the consequent and the other remaining axis, which represents the weight of the fuzzy rule, as shown in Figure 9. In the first three axes (axis: \(j\) = 18, 19 and 20) the lower bound value \(L_{Bj}\) and the upper bound value \(U_{Bj}\) were limited to 1 and 7, respectively. However, in practice, it was noted during the optimization process that when the particles moved to the global best position \(G_{(Best)_{j}}\) they generated floating values. Therefore, the generated optimized values of axes 18, 19 and 20 were rounded and assigned to the most suitable linguistic variables of the inputs and output fuzzy variables. In this dynamic metaheuristic FLC, the corresponding global solution values of each dimension are \"\(NB\) = 1\", \"\(NM\) = 2\", \"\(NS\) = 3\", \"\(Z\) = 4\", \"\(PS\) = 5\", \"\(PM\) = 6\" and \"\(PB\) = 7\". The lower bound limit and the upper bound limit of the other remaining axes (axis 21 and axis 22) are limited to 0 and 1, respectively. However, on axis 21, the obtained optimized values are rounded. If the rounded value is 0 or 1 then it is assigned to the logical operator \"or\" or \"and\", respectively. The 22-axis value (value between 0 and 1), which is generated through the PSO mechanism, is used as the firing strength of the fuzzy rule. All of these 5-dimensional optimized values are obtained over and over again for every sampling instant \"\(K\)\" to generate the appropriate dynamic fuzzy rules in the fuzzy reasoning process. Figure 8: The overall mechanism of the dynamic fuzzification process through the dynamic PSO mechanism. Table 7 shows all corresponding decimal values that are assigned to each linguistic variable of each membership function. Therefore, Figure 9 shows the dynamically generated fuzzy rule through the dynamic PSO mechanism in the fuzzy reasoning process, which can be expressed as in Table 8.  
Here, \(U_{k}\) is the output angular speed should be of the permanent magnet BLDC motor. In addition to these dynamically generated fuzzy rules through the PSO mechanism, 49 static fuzzy rules are also taken into consideration when optimizing the behavior of the BLDC motor as illustrated in Figure 2 and Table 2. Figure 10 shows the designed and developed program structure used to integrate the static fuzzy rule mechanism and the dynamic fuzzy rule mechanism into the proposed metaheuristic FLC. In the optimization mechanism, these static and dynamic fuzzy reasoning processes are synchronized for every sampling instant \"\(k\)\" However, Figure 2 shows that the proposed robust PSO mechanism was optimized through the TSK-FLC. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multicolumn{1}{c}{\multirow{2}{*}{Fuzzy variables}} & \multicolumn{6}{c}{\(E_{k}\)} & \(dE_{k}\) & \(U_{k}\) \\ Decimal representation & \(\vdots\) & 3 & 5 & 6 \\ Corresponding fuzzy rule & \(\vdots\) & If the \(E_{k}\) is **NS** and the \(dE_{k}\) is **PS** then \(U_{k}\) is **PM** \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Dynamically generated fuzzy rules through the dynamic PSO mechanism. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multicolumn{1}{c}{\multirow{2}{*}{Fuzzy variables}} & \multicolumn{6}{c}{\(U_{k}\) is the output angular speed should be of the permanent magnet BLDC motor.} \\ \cline{2-6}  & **NS** & **NM** & **NS** & **ZE** & **PS** & **PM** & **PB** \\ \hline \hline \multicolumn{1}{c}{\multirow{2}{*}{Decimal representation}} & \multicolumn{6}{c}{\(1\)} & \(2\) & \(3\) & \(4\) & \(5\) & \(6\) & \(7\) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Corresponding decimal values for the linguistic variables in the PSO mechanism.