## 10 Thermal Mixing Tank System
It is worth noting that it has been verified that the optimization is not affected if the value of \(R_{1}\) remains constant. Since the goal is to obtain the values that optimize the cost function, it is recommended to apply ESC globally. That is, the system should be subjected to large variations in the reference input for both output flow rate and output temperature across its entire operating range. Table 3 shows the selected points, establishing the path from point \(1\) to point \(11\) and then returning back to point \(1\). Figure 6 shows the convergence of \(J(\theta)\) and the values obtained for the \(Q\) matrix. It can be observed that the value of \(Q_{1}\) continues to increase; however, the value obtained at iteration number \(500\) is taken, since \(J(\theta)\) no longer decreases. The resulting \(Q\) and \(R\) values are as follows:  
\[Q=0.001 diag(\left[ \begin{array}{cccccc}7.5&0.18&0.22&0.22&0.22&0.22&0.22\\ \end{array} \right])\]  
\[R=diag(\left[ \begin{array}{cccccc}1&1&1\\ \end{array} \right])\]  
The feedback matrix \(K\) is obtained for each fuzzy rule, which is defined as  
\[\mathbb{S}^{(1,1)}\text{: If }Q_{s}(k)\text{ is }M_{1}^{1}\text{ and }T_{s}(k)\text{ is }M_{2}^{1}\text{, then}\]  
\[K^{(1,1)}=\left[ \begin{array}{cccccc}0.0307&0.0113&1.4218&\ldots&0.4782\\ 0.0778&-0.0046&4.1532&\ldots&-0.2984\\ \end{array} \right]\]  
\[\vdots\]  
\[\mathbb{S}^{(3,3)}\text{: If }Q_{s}(k)\text{ is }M_{1}^{3}\text{ and }T_{s}(k)\text{ is }M_{2}^{3}\text{, then}\]  
\[K^{(3,3)}=\left[ \begin{array}{cccccc}0.0674&0.0076&9.0385&\ldots&0.7719\\ 0.0504&-0.0100&6.2131&\ldots&-0.8202\\ \end{array} \right]\]  
Figures 7 and 8 show the responses of flow rate and output temperature to excessive step-type input throughout the operating range of the nonlinear system, comparing the system when ESC is not used with the values obtained for the matrices \(Q\) and \(R\) using Global ESC. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Point** & \(\mathbf{Q_{s}}\) & \(\mathbf{T_{s}}\) \\ \hline
1 & 4 (m\({}^{3}\)/s) & 50 (\({}^{\circ}\)C) \\
2 & 7 (m\({}^{3}\)/s) & 50 (\({}^{\circ}\)C) \\
3 & 1 (m\({}^{3}\)/s) & 50 (\({}^{\circ}\)C) \\
4 & 1 (m\({}^{3}\)/s) & 80 (\({}^{\circ}\)C) \\
5 & 4 (m\({}^{3}\)/s) & 80 (\({}^{\circ}\)C) \\
6 & 4 (m\({}^{3}\)/s) & 20 (\({}^{\circ}\)C) \\
7 & 1 (m\({}^{3}\)/s) & 20 (\({}^{\circ}\)C) \\
8 & 1 (m\({}^{3}\)/s) & 50 (\({}^{\circ}\)C) \\
9 & 5.5 (m\({}^{3}\)/s) & 50 (\({}^{\circ}\)C) \\
10 & 5.5 (m\({}^{3}\)/s) & 65 (\({}^{\circ}\)C) \\
11 & 5.5 (m\({}^{3}\)/s) & 35 (\({}^{\circ}\)C) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Points selected for the optimization of the ESC. As shown in Figure 7, by using Global ESC, a better response is obtained in the output flow rate. It is faster and exhibits a smaller amplitude in the peaks that occur when there is an abrupt temperature change and the flow rate remains constant. On the other hand, in Figure 8, it can be seen that using ESC slightly increases the peaks in the temperature response when it remains constant and the system is subjected to an abrupt change in the temperature response. Figure 8: Comparison of the response of \(T_{s}\) response to excessive step-type reference signals without Global ESC and with Global ESC using an incremental-1 control. Figure 6: Convergence of the cost function and values for the matrix \(Q\). Figure 7: Comparison of the response of \(Q_{s}\) response to excessive step-type reference signals without Global ESC and with Global ESC using an incremental-1 control. flow rate. However, a faster response is achieved. This can be better understood by looking at Table 4, which shows the cost function \(J(\theta)\) and the RMSE (Root Mean Square Error) value for \(Q_{s}\) and \(T_{s}\), comparing the method used to obtain the matrices \(Q\) and \(R\). This confirms that the application of ESC leads to an improved and faster response under excessive step inputs. Moreover, this method simplifies the determination of the optimal values for the matrices \(Q\) and \(R\).