# Design and Optimization of a Neuro-Fuzzy System for the Control of an Electromechanical Plant
## 7 Results  
Using the equations described in Sections 5 and 6, the respective optimization of the control system is carried out for both the linear and fuzzy controllers. The settings for the \(Q\) and \(R\) values are as follows:  
* QR1: \(Q=1\), \(R=0.00005\). * QR2: \(Q=1\), \(R=0.0001\). * QR3: \(Q=1\), \(R=0.0005\). * QR4: \(Q=1\), \(R=0.001\). After the training process Figure 14 shows the results when considering different reference values using the PI discrete linear controller. The transfer functions of the PI controller obtained to \(Q\) and \(R\) values are the following:  
* QR1: \[C(z)=\frac{66.79z-66.67}{z-1}=\frac{66.79(z-0.9982)}{(z-1)}\]
* QR2: \[C(z)=\frac{48.48z-48.39}{z-1}=\frac{48.48(z-0.9981)}{(z-1)}\]
* QR3: \[C(z)=\frac{22.66z-22.62}{z-1}=\frac{22.66(z-0.9982)}{(z-1)}\]
* QR4: \[C(z)=\frac{16.11z-16.08}{z-1}=\frac{16.11(z-0.9981)}{(z-1)}\]  
The stability analysis for linear controller consists of determining the closed-loop poles of the control system (controller and plant). In this order, if the poles are in the unit circle the system is stable. For each case the transfer function \(T(z)\) in a closed loop is:  
* QR1: \[T(z)=\frac{0.001942z^{3}+0.001945z^{2}-0.001935z-0.001938}{1.002z^{3}-2.765z^{2 }+2.532z-0.7689}\]
* QR2: \[T(z)=\frac{0.001409z^{3}+0.001412z^{2}-0.001404z-0.001407}{1.001z^{3}-2.766z^{2 }+2.533z-0.7684}\]
* QR3: \[T(z)=\frac{0.0006587z^{3}+0.0006599z^{2}-0.0006564z-0.0006576}{1.001z^{3}-2.766z^ {2}+2.533z-0.7677}\]
* QR4: \[T(z)=\frac{0.0004683z^{3}+0.0004692z^{2}-0.0004666z-0.0004674}{z^{3}-2.767z^{2}+ 2.534z-0.7675}\]  
Figure 14: System response with the linear controller. The respective pole localization is presented in Table 1. It is observed that the poles are within the unit circle. Therefore, all the systems in a closed loop are stable. Additionally, as observed, the controllers display the zero near to \(z=0.998\), while the gain \(K\) has the values 66.79, 48.48, 22.66 and 16.11. Moreover, when incrementing the value of \(R\) (which weighs the action control), the gain value of the \(K\) controller is reduced. Furthermore, it is seen that the algorithm establishes the zero near the pole, therefore the pole and zero \"almost cancel\" which is consistent with reference [34] for the PI controller design. As results analysis, Figure 15 shows the root locus for the PI control system. This figure also displays the movement of the roots as the gain \(K\) increases. Employing configurations of functions \(f_{i}(x_{i})\) shown in Figure 16, it is possible to use the values obtained from the optimization of the linear controller to define an initial configuration to optimize the fuzzy controller. Thus, the slope of \(f_{i}\) in the linear region is set to be equivalent with each parameter of the linear controller. The fuzzy controller parameters obtained, with which the simulation of the closed-loop system can be performed, are shown in \[C(z)=\frac{48.48z-48.39}{z-1}=\frac{48.48(z-0.9981)}{(z-1)}\]0 As can be seen, there are different parameters considering the QR case. In this table, \(i\) corresponds to rows and \(j\) to columns. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**QR1** & **QR2** & **QR3** & **QR4** \\ \hline
0.9981 & 0.9980 & 0.9978 & 0.9971 \\ \hline
0.9639 & 0.9756 & 0.9905 & 0.9947 \\ \hline
0.7978 & 0.7881 & 0.7762 & 0.7734 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Pole localization for each QR case. Figure 16: Configuration employed for \(f_{i}(x_{i})\). Figure 15: Root locus for the linear controllers obtained. After performing the fuzzy controller training, Figure 17 shows the system response for different reference values, as well as the value of the control signal; additionally, Figure 18 shows in detail the system response for a unitary reference. According to simulations, the suitable configurations correspond to QR2 or QR3 considering the values of control action and settling time.