## 3 Controller Design
### Closed-Loop Paradigm  
The dual mode controller proposed in this work differs from others proposed in the literature by three important points. First of all, usually in the classical dual mode MPC schemes, the terminal control law defined in the terminal region is obtained offline by solving a linear quadratic regulator problem, but in this paper the terminal control law is determined online by solving an unconstrained nonlinear GPC problem as presented in the previous paragraph. Secondly, the terminal controller takes into account the economic costs by including the gradient of the economic function as an additional term in the objective function of the NGPC. Finally, here, even though the parameters of NGPC are tuned to assure a good performance and stability if there are not constraints, the dual mode approach is adopted in order to handle constraints when necessary and to the performance of the closed loop system respecting them while maintaining stability. **Remark. **_It must be stressed that the switching between the modes 1 and 2 in (13) is in the predictions only. The closed loop control law has a single mode, but uses dual mode predictions in the optimization._  
A common choice is \(u(k)=Fx(k)+c(k)\) as in El bahja, H. [25] where \(F\) is a unchanging feedback gain computed offline and \(c(k)\) is the new manipulated variable. From results of Section 3.2 and particularly on Equation (34), the control parameterization proposed for the CLGPC is based on affine function disturbances as follows, making the controller less conservative. \[\Delta u(k)=-F(\chi(k))\chi(k)+d(k)+c(k) \tag{35}\]  
At each step time \(k\), we assume that the feedback \(F(\chi(k))\) and \(d(k)\) are constant and \(c(k)\) is the new decision variable. The degrees of freedom are the disturbance \(c(k)\) as it is described in Figure 1. It is conventional to define these as:  
\[\underline{c}(k) =[c^{T}(k)\quad\dots c^{T}(k+n_{u}-1)]^{T}; \tag{36}\] \[c(k+i+n_{u}) =0\quad\text{for}\quad i>0\]  
That is, suppose a limited number \(n_{u}\) of nonzero values for \(\underline{c}(k)\). After \(n_{u}\) the disturbances are zero and the loop acts in a linear fashion and is equivalent to mode 2 of the dual mode predictions. Then the performance index in (3) and constraints (4,5 and 6), must be formulated in function of \(c(k)\). \[\min_{u(k)}= \min(\sum_{i=1}^{n_{y}}||w_{1}(r(k+i|k))-y(k+i|k)||_{2}^{2}\] (37) \[+\sum_{i=0}^{n_{u}-1}||w_{2}\Delta u(k+i-1|k)||_{2}^{2}\] \[+||w_{3}\underline{\sigma}_{u+\Delta u}^{T}||_{2}^{2})\] subject to (4), (5) and (6)In order to obtain the prediction equations considering the control parameterization (35), those equations are rewritten here:  
\[ \begin{split}\Delta u(k)&=-F(\chi(k))\chi(k)+d(k)+c(k) \\ F(\chi(k))&=(S^{T}(k)w_{1}S(k)+w_{2}+G^{T}w_{3}G)^{- 1}S(k)w_{1}\Phi(k)\tilde{A}(k)\chi(k)\\ d(k)&=(S^{T}(k)w_{1}S(k)+w_{2}+G^{T}w_{3}G)^{-1}[S(k)w _{1}\underline{\Gamma}(k)-G^{T}w_{3}D]\end{split}  \tag{38}\]  
The predictions with the new control parameterization are:  
\[ \begin{split}\chi(k+i+1)&=\tilde{A}(k)\chi(k+i)+ \tilde{B}(k)\Delta u(k+i);\\ \Delta u(k+i)&=-F(\chi(k))\chi(k)+c_{t}(k+i)\end{split}  \tag{39}\]  
With \(i=0,\ldots,n_{u}-1\) and \(c_{t}(k+i)=d(k)+c(k+i)\). Eliminating the dependent variable \(\Delta u(k+i)\) one makes:  
\[\chi(k+i+1)=(\tilde{A}(k)-\tilde{B}(k)F(\chi(k)))\chi(k+i)+\tilde{B}(k)c_{t}(k +i) \tag{40}\]  
Predicting onward in time with \(\Phi(k)=\tilde{A}(k)-\tilde{B}(k)F(\chi(k))\) one gets;  
\[\underline{\chi}(k)=\left[ \begin{array}{c}\Phi\\ \Phi^{2}\\ \Phi^{3}\\ \vdots\end{array} \right]\chi(k)+\left[ \begin{array}{cccc}\tilde{B}(k)&0&0& \ldots\\ \Phi\tilde{B}(k)&\tilde{B}(k)&0&\ldots\\ \Phi^{2}\tilde{B}(k)&\Phi\tilde{B}(k)&\tilde{B}(k)&\ldots\\ \vdots&\vdots&\vdots&\vdots\end{array} \right]c_{t}(k) \tag{41}\]  
with  
\[ \begin{split}\underline{\chi}(k)&=[\chi^{T}(k+1)&\chi^{T}(k+2 )&\ldots&\chi^{T}(k+n_{y})]^{T}\\ \underline{c}_{t}(k)&=[c_{t}^{T}(k+1)&c_{t}^{T}(k+2)&\ldots&c_{t}^{T}(k+n_{u} )]^{T}\end{split}