# Tuning of Multivariable Model Predictive Control for Industrial Tasks
## 3 MPC Tuning Procedure  
When all parameters \(\psi_{p,n}\) for \(p=1,\ldots,N\), \(n=1,\ldots,n_{y}\) are optimised at the same time, the optimisation problem has as many as \(n_{y}N\) decision variables [12; 32; 33]. For typical lengths of the prediction horizon and a few controlled variables, the resulting optimisation problem is quite difficult. In order to simplify the computational task, the discussed tuning method is based on the following two rules:  
* The tuning coefficients for only one manipulated variable are calculated at the same time, i.e., \(\psi_{1,n},\ldots,\psi_{N,n}\), for the consecutive process outputs \(n=1,\ldots,n_{y}\). * If all the coefficients \(\psi_{1,n},\ldots,\psi_{N,n}\) were optimised directly at the same time by a numerical optimisation procedure, we still would have as many as \(N\) decision variables. As an alternative, that sequence of coefficients is parameterised using Gauss-like functions [34]. At first, a very general approximation of the Gauss function is used in which for one point, the function has a value of \(K_{n}\); for all other points, it has a default value equal to one: \[\psi_{p,n}= \begin{cases}K_{n}&\text{if }p=m_{n}\\ 1&\text{if }p\
eq m_{n}\end{cases} \] (5) The function (5) is characterised by two parameters: \(m_{n}\) and \(K_{n}\). The first one defines the chosen sampling instant within the prediction horizon for which the function has the value of \(K_{n}\). When the parameters \(m_{n}\) and \(K_{n}\) are selected, the trajectory of the weights is calculated precisely from the Gauss function: \[\psi_{p,n}=K_{n}\exp\left(-\left(\frac{p-m_{n}}{a_{n}}\right)^{2}\right)\] (6) where \(a_{n}\) defines the spread. All things considered, irrespective of the number of process outputs and the prediction horizon, in the discussed approach, there are always only three decision variables: \(m_{n}\), \(K_{n}\) and \(a_{n}\). What is important is that they are not calculated at the same time, but always, only one parameter is found. Calculations are repeated for all process outputs, \(n=1,\ldots,n_{y}\). Unlike fully-fledged optimisation-based tuning methods, in our simulation-based approach, we simply assess how the consecutive parameters influence the value of the performance indices, and we choose the parameters for which the best results are possible. No numerical optimisation is used, but we simply evaluate the values of control the performance indices for a chosen set of tuning parameters. Of course, our procedure is suboptimal, i.e., one may expect that full numerical optimisation of all tuning parameters at the same time may give better results, but our procedure is deliberately rather uncomplicated and is recommended to be used in industrial applications in which all tuning parameters are usually constant. The tuning procedure is comprised of the following steps:  
1. The trajectory of the \(N\) coefficients \(\psi_{1,n},\ldots,\psi_{N,n}\) is found for the controlled variable \(n\). All other coefficients are tuned or have their default value. 1. The best trajectory (5) is found, i.e., its parameters \(m_{n}\) and \(K_{n}\) are determined. 1. The constant value of the parameter \(K_{n}\) is assumed. Its value has to be larger than one, and it should result in a noticeable change in control quality in comparison with the control quality achieved for the scenario in which all coefficients \(\psi_{p,n}=1\). 2. The performance indices are calculated from simulations of the MPC algorithm for a few values of the parameter \(m_{n}\). It is recommended to start the tests from \(m_{n}=N/2\) and analyse the results obtained in some neighbourhood of this value first. 3. The value of the parameter \(m_{n}\) is chosen for which the performance indices are the best. iv. For the chosen value of \(m_{n}\), the performance indices are calculated from the simulations of the MPC algorithm for a few values of the parameter \(K_{n}\). This step should start with the values of the parameter that are lower than those assumed in the first step. Next, it is increased.