## 3 Controller Design  
In this section, the Closed Loop Model Predictive Control (CLMPC) that is the basis of the one layer economic controller proposed is presented, starting with the open loop MPC, the predictions using state dependent coefficient matrices and the optimization. The predictions are obtained using a discrete time varying prediction model of the process along the prediction horizon \(n_{y}\) of the form:  
\[x(k+i+1|k)=A(k+i|k)x(k+i|k)+B(k+i|k)u(k+i|k),\quad i=0,1,\ldots,n_{y}-1 \tag{9}\]  
With initial condition established by:  
\[x(k|k)=x(k) \tag{10}\]  
The predicted input sequences are often stacked into the matrices \(\underline{u}\) defined by:  
\[\underline{u}=\left[ \begin{array}{c}u(k|k)\\ u(k+1|k)\\ \vdots\\ u(k+n_{u}-1|k)\\ \end{array} \right] \tag{11}\]  
Clearly \(J(k)\) is a function of \(u(k)\), and the optimal input sequence for the problem minimizing \(J(k)\) is denoted \(\underline{u}^{*}(k)\):  
\[\underline{u}^{*}=arg\min_{\underline{u}(k)}J(k)\] (12) Subject to \[(3),\ (4)\] and \[(5)\]  
In order to improve the numerical conditioning of the optimization and the controller performance, a closed loop MPC has been considered by defining the predicted input sequence along the control horizon specified by \(n_{c}\) as:  
Figure 1: Nonlinear Closed Loop Generalized Predictive Control. \[\underline{u}=\left[ \begin{array}{ccc}F(k)x(k)+c(k)\\ F(k+1)x(k+1)+c(k+1)\\ \vdots\\ F(k+n_{u}-1)x(k+n_{u}-1)+c(k+n_{u}-1)\\ F(k+n_{u})x(k+n_{u})\\ F(k+n_{u}+1)x(k+n_{u}+1)\\ \vdots\\ F(k+n_{u}+n_{y})\Phi(k+n_{u}+n_{y}-1)\ldots\Phi(k+n_{u})x(k+n_{u})\end{array}  \right] \tag{13}\]  
where, \(F(x(k))\in\mathbb{R}^{m\times n}\) is a nonlinear stabilizing state feedback and \(\Phi(k)=A(k)+B(k)F(x(k))\). Then, the predictions considering the closed loop control law are:  
\[x(k+i|k) = A(x(k+i-1|k))x(k+i-1|k)+B(x(k+i-1|k))u(k+i-1|k);\] \[u(k+i|k) = F(x(k+i|k))x(k+i|k)+c(k+i|k),\quad i=0,\ldots,n_{u}-1.\] \[u(k+i|k) = F(x(k+i|k))x(k+i|k),\quad i\geqslant n_{u}.\]  
The system model becomes  
\[\left\{ \begin{array}{rcl}x(k+1)&=&(A(x(k))+B(x(k))F(x(k)))x(k)+B(x(k))c(k)\\ y(k)&=&C(x(k))x(k)\end{array} \right. \tag{14}\]  
Where \(c(k)\in\mathbb{R}^{m}\) is the new manipulated input. Thus the problem to be minimized at each sampling time is:  
\[\underline{c}^{*}=arg\min_{\underline{c}(k)}J(k)\] (15) subject to \[ \begin{array}{c}\text{Constraints }(\ref{eq:c}),\,(\ref{eq:c})\text{and }(\ref{eq:c})\\ x(k+i+1|k)=\Phi(k+i|k)x(k+i|k)+B(k+i|k)c(k+i|k)\\ \text{for}\quad i=0,\ldots,n_{u-1}.\\ x(k+i+1|k)=\Phi(k+i|k)x(k+1|k),\quad\text{for}\quad i\geqslant n_{u}\end{array} \]  
where, \(\underline{c}(k)=[c^{T}(k|k)\quad\ldots\quad c^{T}(k+n_{u}-1|k)]^{T}\) and \(\underline{c}^{*}(k)\) is the first element of \(\underline{c}(k)\). The closed loop nonlinear GPC controller is implemented in a moving horizon framework. At current time step \(k\), the plant state \(x(k)\) is used as the initial condition and the economic optimization problem is solved on a horizon \(n_{y}\), however, only the first calculated control action is implemented \((u(k)=F(x(k))x(k)+c^{*}(k))\). At the next time step \(k+1\), we move the time frame one step ahead and the problem is solved with the new plant state \(x(k+1)\) as the initial condition. **Remark. **  
1. _Due to the non uniqueness of_ \(A(x(k))\) _different choices may produce different controllability matrices and one can always find a stabilizable pair_ \((A(x(k)),B(x(k)))\)_. However, although this may be quite easy for lower order systems is becomes laborious for light order systems._
2. _There are numerous ways to choose_ \(A(x(k))\) _and the choice of_ \(A(x(k))\) _can affect the performance of the controller. Therefore, the non uniqueness of this matrix leads to that the controller developed here is suboptimal rather than optimal._In the next section, the procedure for obtaining the controller proposed in this work is detailed.