## 3 Fuzzy MPC Algorithm with Advanced Generation of Prediction
### Iterative Improvement of the Prediction  
In practice, the proposed approach gives results very similar to those offered by the NMPC algorithm. However it is possible to further improve the control quality, if necessary, thanks to iterative improvement of the prediction determined in the algorithm. Then smaller corrections of control trajectories in each subsequent iteration are obtained, what is beneficial because impact of them on the process outputs is predicted using the dynamic matrix instead of a more accurate non-linear process model. The first, internal iteration of the algorithm is the same as in the basic version of the algorithm. After receiving the future control trajectories, one can either apply them in the process or try to improve the resulting solution. In such a case, the second internal iteration of the algorithm should be executed. Denote the values of future control signal trajectories obtained in the first iteration as \(u_{k+i|k(1)}^{m}\) and future control increments as \(\Delta u_{k+i|k(1)}^{m}\). In subsequent iterations, because subsequent control signal trajectories are available, future control values are decomposed as follows:  
\[u_{k+i|k(i_{w})}^{m}=u_{k+i|k(i_{w})}^{m}+u_{k+i|k(i_{w}-1)}^{m}\;, \tag{38}\]  
where \(i_{w}\)--index of the internal iteration of the algorithm, \(i_{w}=2,3,\ldots\). Similarly, future control increments are decomposed:  
\[\Delta u_{k+i|k(i_{w})}^{m}=\Delta\hat{u}_{k+i|k(i_{w})}^{m}+\Delta u_{k+i|k(i _{w}-1)}^{m}\;. \tag{39}\]  
Assume  
\[\mathbf{u}_{k+i|k(i_{w}-1)}=\left[u_{k+i|k(i_{w}-1)}^{1},\ldots,u_{k+i|k(i_{w}-1)} ^{m}\right]^{T}\;, \tag{40}\]  
Thus, using the non-linear process model, the free response is iteratively derived as follows:  
* First, the model is used to obtain values \[\widehat{\mathbf{y}}_{k+1}=\mathbf{f}(\mathbf{y}_{k},\mathbf{y}_{k-1},\ldots,\mathbf{y}_{k-n_{k}+1 },\mathbf{u}_{k|k(i_{w}-1)},\mathbf{u}_{k-1},\ldots,\mathbf{u}_{k-n_{k}+1})\;;\] (41)
* Next, the values \(\widehat{\mathbf{y}}_{k+1}\) are used to calculate the output values \(\widehat{\mathbf{y}}_{k+2}\) for the next sampling instant: \[\widehat{\mathbf{y}}_{k+2}=\mathbf{f}(\widehat{\mathbf{y}}_{k+1},\mathbf{y}_{k},\ldots,\mathbf{y}_ {k-n_{k}+2},\mathbf{u}_{k+1|k(i_{w}-1)},\mathbf{u}_{k|k(i_{w}-1)},\mathbf{u}_{k-1},\ldots,\mathbf{u}_{k-n_{k}+2})\;;\] (42)
* For the \(i\)th iteration, using the values \(\widehat{\mathbf{y}}_{k+1},\ldots,\widehat{\mathbf{y}}_{k+i-1}\)one obtains: \[\widehat{\mathbf{y}}_{k+i}=\mathbf{f}\left( \begin{array}{c}\widehat{\mathbf{y }}_{k+i-1},\widehat{\mathbf{y}}_{k+i-2},\ldots,\mathbf{y}_{k-n_{k}+i},\\ \mathbf{u}_{k+i-1|k(i_{w}-1)},\mathbf{u}_{k+i-2|k(i_{w}-1)},\ldots,\mathbf{u}_{k-n_{k}+i} \end{array} \right).\] (43)
* After taking into account the estimation of unmeasured disturbances \(\mathbf{d}_{k}=\mathbf{y}_{k}-\widehat{\mathbf{y}}_{k|k-1}\), containing also influence of modeling errors, like in (30), the final formula describing the elements of the free response is obtained: \[\widetilde{\mathbf{y}}_{k+i|k}=\widehat{\mathbf{y}}_{k+i}+\mathbf{d}_{k}\;.\] (44)  
As in the basic algorithm, the dynamic matrix is used to predict the influence of control corrections on the control plant outputs. Thus, after using the free response (44) and the dynamic matrix (22) one obtains the following prediction:  
\[\mathbf{y}=\widetilde{\mathbf{y}}+\mathbf{A}_{k}\cdot\Delta\widetilde{\mathbf{n}}\;. \tag{45}\]where  
\[\Delta\vec{u}=\left[\Delta\vec{u}^{1},\ldots,\Delta\vec{u}^{m}_{u}\right]^{T}, \ \Delta\vec{u}^{m}=\left[\Delta\vec{u}^{m}_{k+1|k(i_{w})},\ldots,\Delta\vec{u}^{m }_{k+s-1|k(i_{w})}\right]. \tag{46}\]  
This prediction should then be used to formulate the optimization task in the same way as in the basic algorithm. After solving this task, one can either use the result to control the process or to perform another internal iteration of the algorithm.