## 3 Control Strategy
### MPC Close Loop Structure  
MPC uses a system model to predict behavior (e.g., the number of steps). It handles MIMO systems (Multiple-Input Multiple-Output) with interactions between inputs and outputs. The goal is to find the optimal control action that minimizes a cost function subject to constraints. Quadratic Programming (QP) is a mathematical optimization technique that aims to find the optimal solution to a given problem by minimizing or maximizing an objective function subject to certain constraints. QP involves the use of mathematical \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Sample time & 1 \\ Prediction Horizon & 30 \\ Control horizon & 10 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Tuning of model predictive control. Sample time is set equal to 1 to limit samples to 20 during rise time and to follow [PERSON]’s theorem. A prediction horizon of 20 to 40 samples is recommended. Therefore, a value of 30 is chosen. A control horizon equal to 10 is selected, as this value is typically less than (or equal to) the prediction horizon [25]. models and algorithms to optimize a specific objective function while satisfying a set of constraints. Thus, QP was used to determine the best control input at each time step, to achieve optimal performance while adhering to the system's constraints. The strategy is known as a receding horizon control strategy, where only the first calculated moves are applied at each instant and the process is repeated to obtain new control moves. This strategy is shown in Figure 7. The MPC structure used in this project is shown in Figure 8. The layout of the project ecosystem implemented in MATLAB \({}^{\copyright}\) is shown in Figure 9. Some abbreviations used in this figure are explained in Table 3.  
At each time instant (\(t\)), the controller uses previous system information and its states, current demands, and control actions to forecast the system outcome for the prediction horizon. Based on this, it calculates a sequence of future control actions for the control or move horizon by solving an optimization problem using cost functions from Equations (18) and (19). \[\mathbf{J}(z_{k})=\mathbf{J}_{y}(z_{k})+\mathbf{J}_{u}(z_{k})+\mathbf{J}_{\Delta u}(z_{k})+\mathbf{J} _{x}(z_{k}) \tag{18}\]  
\[z_{k}^{T}=\Big{[}u(k|k)^{T}\;u(k+1|k)^{T}\;...\;u(k+p-1|k)^{T}\;\;\epsilon_{k} \Big{]}, \tag{19}\]  
where \(J_{i}(z_{k})\) are the partial cost functions, \(z_{k}\) is the quadratic programming (\(QP\)) decision, and slack variable \(\epsilon_{k}\) (dimensionless) represents the deviation of system state variables from their setpoints at each control interval in control systems. \[\mathbf{J}_{y}(z_{k})=\sum_{j=1}^{n_{y}}\sum_{i=1}^{p}\left\{\frac{w_{i,j}^{y}}{s_ {j}^{y}}\big{[}r_{j}(k+i|k)-y_{j}(k+i|k)\big{]}\right\}^{2}, \tag{20}\]  
where:  
Figure 8: MPC structure. Goals (\(u_{8}\)) and expected points (\(u_{9}\)) are the manipulated variables. Environmental context (\(u_{7}\)), granted points (\(u_{10}\)), and goal attainment (\(u_{11}\)) are measured disturbances. Actual steps-behavior is the controlled variable. All the other outputs are also measured but not controlled. Figure 9: Closed-loop Model Predictive Control project ecosystem in Simulink block (graphical programming environment in MATLAB®). These blocks represent the various components such as the plant (simplified SCT), controller (MPC), and other supporting functions. * \(k\) is the current control interval;
* \(p\) is the prediction horizon (number of intervals);
* \(n_{y}\) is the number of plant output variables;
* \(y_{j}(k+i|k)\) is the predicted value of the \(j\)th plant output at the \(i-\)th prediction horizon step;
* \(r_{j}(k+i|k)\) is the reference value for the \(j\)th plant output at the \(i\)th prediction horizon step;
* \(s_{j}^{y}\) is the scale factor for the \(j\)th plant output;
* \(w_{i,j}^{y}\) is the tuning weight for the \(j\)th plant output at the \(i\)th prediction horizon step (dimensionless).