## 4 Thermal Mixing Tank System
### Fuzzy Modeling and Control Based on MDMFs Fitted by the GG Algorithm  
This section establishes the modeling, identification, and fuzzy control of T-S based on MDMFs fitted by means of the GG algorithm. To check whether there is any improvement over the seven rules specified in the previous section, we again used seven clusters. Uniform samples were used in order to avoid changes in the position of the cluster centers due to the massive clustering of data in certain parts of the working area. Figure 29 shows the shapes of the MDMFs obtained after applying the GG algorithm. Figure 30 shows the set of samples of the system and their membership in the cluster that best represents them. The centers of the clusters are also depicted in order to show where the algorithm determined that they should be located. Figure 28: Response of temperature T to various setpoint changes using fuzzy control based on MDMFs defined by the GK method of clustering. Figure 27: Response of flow Q to various setpoint changes using fuzzy control based on MDMFs defined by the GK method of clustering. We deliberately located one of the cluster centers at the point (4, 50), as this is the nominal working point of the system. When performing T-S identification by means of the membership functions fitted with the GG algorithm, the following identification errors were obtained based on the open-loop data of the thermal mixing tank system:  
\[RMSE(err_{Q})=0.0026,\ RMSE(err_{T})=0.1061.\]  
Recalling the incremental state model obtained in (78), the matrices are  
\[A_{a}^{(1)}=\left[ \begin{array}{cccccccccccc}1&0&1.79&1&0&0&0&0&0&0&0&0\\ 0&1&0&0&0&0&0&0&2.03&1&0&0\\ 0&0&1.79&1&0&0&0&0&0&0&0\\ 0&0&-0.81&0&1&0&0&0&0&0&0\\ 0&0&0&0&0&1&0&0&0&0&0\\ 0&0&0&0&0&1&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&2.02&1&0&0\\ 0&0&0&0&0&0&0&-1.46&0&1&0\\ 0&0&0&0&0&0&0&0.41&0&1\\ 0&0&0&0&0&0&0&0&0&0&0\end{array} \right],B_{a}^{(1)}=\left[ \begin{array}{ c}0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0.0103\\ -0.0049&0\\ 0&0\\ 0&-1.0111\\ 0.8258&0.3329\\ -0.4853&0\end{array} \right]. \tag{86}\]  
The C matrix is the same as in previous methods, and the Q and R matrices are also the same. The feedback matrix K\({}^{(1)}\) obtained in the central rule is  
\[S^{(1)}:\text{If}\ z(k)\text{is}\ M^{(1)}\ \text{then}:\]  
Figure 30: Representation of the cluster centers obtained by the GG method in the working area of uniform samples. Figure 29: Representation of the MDMFs obtained using the GG method. \[K^{(1)}=\left[ \begin{array}{cccccccccccc}0.1&0.0&13.1&12.7&12.2&11.6&11.1&10.5&2.4&2. 2&2.0&1.9\\ 0.1&-0.0&11.7&11.3&10.8&10.3&9.8&9.2&-2.3&-2.1&-1.9&-1.7\end{array} \right]. \tag{87}\]  
The state observer in each fuzzy rule is again obtained by the optimal state observer method. The matrix \(\mathrm{H}^{(2,2)}\) obtained in the central rule is  
\[S^{(1)}:\text{If }z(k)\text{is }M^{(1)}\text{ then }:\] \[H^{(1)}=\left[ \begin{array}{cccccccc}1.8718&0\\ -0.8771&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&2.6091\\ 0&-2.2878\\ 0&0.6758\\ 0&0\end{array} \right]. \tag{88}\]  
Figures 31 and 32 show the response of the system controlled by the GG algorithm when the system is subject to changes in the reference values of the flow and temperature. Furthermore, Figures 33 and 34 show the response of the controlled system to successive changes in the reference signals. It can be seen that the fuzzy controller acts correctly in areas far from the nominal operating point. It should be noted that the samples do not need to be normalized, which represents an immediate advantage over the FCM algorithm. However, having to rely on a more robust algorithm to determine a non-random initial participation matrix means that the GG algorithm is at a disadvantage with respect to the GK algorithm. It can be seen that the errors are greater than those obtained using the GK method. Moreover, from an intuitive point of view, the form of the clusters does not seem very suitable for generating MDMFs, which makes it the worst solution among those proposed in this work.