## 4 Thermal Mixing Tank System
### Fuzzy Modeling and Control Based on One-Dimensional Membership Functions  
First, the modeling, identification, and fuzzy control based on one-dimensional membership functions is established, as detailed in Section 2. After generating the data as shown in the previous section, we next proceed to determine the membership functions in order to generate the fuzzy system, as shown in Figure 10.  
Through the fuzzy inference process, a total of nine rules are obtained, as shown in Figure 11.  
Figure 10: One-dimensional membership functions for the flow rate Q and temperature T of the thermal mixing tank system. Figure 9: Uniform system data representation. Figure 12 shows the projections of the centers of the fuzzy rules obtained by the fuzzy inference process onto the workspace of the thermal mixing tank system. It can be seen that the top right [7.80] and bottom right [7.20] rules do not cover a significant working space and that samples requiring these fuzzy rules are rarely obtained. This is because working with flow rates requires the inlet valves to be opened, which causes the liquids to mix and the outlet temperature to be close to the average of the inlet temperatures. The mean square error method is used here to comparison of the effectiveness of the different methodologies. To identify the nonlinear system, the generalized T-S identification method is used. A least-squares identification of the linearized system at the nominal working point is performed using the \(\gamma^{2}=10^{-6}\) parameter. As a result, the following identification errors are obtained:  
\[RMSE(err_{Q})=0.0026,\ \ RMSE(err_{T})=0.1128. \tag{69}\]  
Based on the parameters identified for the nonlinear system, the incremental state model is obtained for each fuzzy rule [35]. Next, the incremental state model obtained for the central rule is provided as follows:  
Figure 11: Fuzzy inference representation of one-dimensional membership functions. Figure 12: Center points of the fuzzy rules obtained by fuzzy inference of one-dimensional membership functions and projected onto the workspace of the thermal mixing tank system. \[S^{(22)}:\text{If }Q_{m}(k)\text{is }M^{2}_{Q_{m}}\text{ and }T_{S}(k)\text{ is }M^{2}_{T_{S}}\text{ then }:\] \[x_{a}(k+1) =A^{(2,2)}_{a}x_{a}(k)+B^{(2,2)}_{a}\delta\text{u}(k) \tag{70}\] \[y(k) =C^{(2,2)}_{a}x_{a}(k),\]  
where  
\[A^{(2,2)}_{a}=\left[ \begin{array}{cccccccccccc}1&0&1.87&1&0&0&0&0&0&0&0&0\\ 0&1&0&0&0&0&0&0&2.40&1&0&0\\ 0&0&1.87&1&0&0&0&0&0&0&0\\ 0&0&-0.88&0&1&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&1&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&2.40&1&0&0\\ 0&0&0&0&0&0&0&-1.94&0&1&0\\ 0&0&0&0&0&0&0&0.2&0&0&1\\ 0&0&0&0&0&0&0&0&0&0&0\end{array} \right],B^{(2,2)}_{a}=\left[ \begin{array}{ c}0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0.0061\\ 0.0052&-0.0013\\ 0.0002&0\\ 0&0\\ 0&-0.1696\\ 0.1236&0.1030\\ -0.0616&0\end{array} \right]. \tag{71}\]  
For each fuzzy rule, the state feedback matrix is calculated using the discrete LQR method. The Q and R matrices used in the design are detailed below:  
\[Q\text{ }=0.1\text{ }diag([3\text{ }0.02\text{ }1\text{ }1\text{ }1\text{ }1\text{ }1 \text{ }1\text{ }1\text{ }1\text{ }1\text{ }1]);\text{ }R=\text{ }diag([1\text{ }1\text{ }1]). \tag{73}\]  
The feedback matrix K\({}^{(2,2)}\) obtained in the central rule is as follows:  
\[S^{(2,2)}:\text{If }Q_{m}(k)\text{is }M^{2}_{Q_{m}}\text{ and }T_{S}(k)\text{is }M^{2}_{T_{S}}\text{ then }:\] \[K^{(2,2)}=\left[ \begin{array}{cccccccccccc}0.1&0.0&14.0&13.6&13. 1&12.5&11.9&11.4&1.2&1.1&1.1&1.0\\ 0.1&-0.0&11.9&11.5&11.0&10.5&10.0&9.4&-1.2&-1.1&-1.0&-0.9\end{array} \right] \tag{74}\]  
The state observer in each fuzzy rule is obtained by means of the optimal state observer. The matrix H\({}^{(2,2)}\) obtained in the central rule is  
\[S^{(2,2)}:\text{If }Q_{m}(k)\text{is }M^{2}_{Q_{m}}\text{ and }T_{S}(k)\text{is }M^{2}_{T_{S}}\text{ then }:\] \[H^{(2,2)}=\left[ \begin{array}{cccccccc}1.8770&0\\ -0.8821&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&0\\ 0&2.4055\\ 0&-1.9350\\ 0&0.5237\\ 0&0\end{array} \right].