## 3 Results
### Results of the Analysis of the Influence of the Prediction Algorithm Parameters  
For each set of the varying parameters to be optimised within the GRAMPC predictive algorithm described in Section 2, ten simulations (with the same set of the parameters) were performed to avoid random errors. The average values were used in the process of finding the optimal values. A visualisation of the obtained measurements is shown in Figures 3-6. The accuracy of system operation in accordance with a given speed trajectory--\(N_{s}\) (_Accuracy, in \(\%\)_)--is calculated using Formula (8) below:  
\[N_{s}=\left(1-\left[\frac{1}{N}\sum_{j=1}^{N}\frac{n_{ramp,j}-n_{j}}{n_{ramp, j}}\right]\right)\times 100\%, \tag{8}\]  
where \(N\) is the total number of sampling points; \(n_{ramp,j}\) is the speed setpoint at sampling instant \(j\); \(n_{j}\) is the result of the actual model execution at sampling instant \(j\). Figure 3: Plots of \(E_{L}\), _Accuracy, Calculation time_, and \(R^{2}\) versus \(N_{horizon}\) and \(N_{MaxGradler}\). The coefficient of determination (\(R^{2}\)), calculated using (9), was used as a quantitative measure of the accuracy of system operation in accordance with the magnetisation current trajectory:  
\[R^{2}=1-\frac{\sum_{j=1}^{N}\left(I_{1d,j}-T_{1d,j}\right)^{2}}{\sum_{j=1}^{N} \left(I_{1d,j}-I_{1d,avg}\right)^{2}}, \tag{9}\]  
where \(N\) is the total number of sampling points; \(I_{1d,j}\) is the desired result at sampling instant \(j\); \(T_{1d,j}\) is the result of the actual model execution at sampling instant \(j\); \(I_{1d,avg}\) is the average value of the desired result. Figure 4: Plots of \(E_{L}\), _Accuracy_, and \(R^{2}\) versus \(P_{Cast}\) (_loss_) and \(P_{Cast}\) (_speed_). Figure 5: Plots of \(E_{L}\), _Accuracy_, and \(R^{2}\) versus _LineSearchMax_. The weighting coefficients of the significance of the indicators (accuracy of system operation in accordance with a given speed trajectory)--\(N_{s}\) (_Accuracy, in %_), calculation time for parameters--\(T_{s}\) (_Calculation time, in seconds_), energy consumption--\(E_{L}\), accuracy of system operation in accordance with the magnetisation current trajectory--R\({}^{2}\)) with varying different algorithmic parameters are given in Table 2. The initial values of the algorithmic parameters are given in Table 3.  
In Figure 3, the dependence of the indicators on the parameters \(N_{horizon}\) and \(N_{MaxGradIter}\) is shown. Figure 4 displays the dependence on \(P_{Cost}\), whereas in Figure 5, the effect of the variation of the _LineSearchMax_ parameter is shown, and in Figure 6, the effect of the \(T_{horizon}\) is given. The \(N_{horizon}\) parameter determines the number of sampling points on the \(T_{horizon}\) prediction horizon. According to Ref. [32], this parameter is one of the key parameters that affects both the performance and computational load of the MPC. A larger number of points usually improves stability and control accuracy, but increases the amount of computation. The energy consumption \(E_{L}\) is shown in Figure 3a. For each fixed \(N_{MaxGradIter}\), the generalised trend is a decrease in energy consumption with increasing \(N_{horizon}\). For example, at \(N_{MaxGradIter}=4\), the \(E_{L}\) decreases from ~80.5 (N\({}_{horizon}=5\)) to ~44.3 J (\(N_{horizon}=20\)), which indicates more efficient operation with a larger number of \(N_{horizon}\) points. At the same time, with a small number of \(N_{MaxGradIter}\) iterations, anomalies arose: for example, for \(N_{MaxGradIter}=1\), \(E_{L}\) was initially ~82 J at \(N_{horizon}=20\), and at \(N_{MaxGradIter}=2\), the value of \(E_{L}\) sharply decreased to 45.6 J. In general, the smallest \(E_{L}\) is provided by the largest \(N_{horizon}\) and \(N_{MaxGradIter}\), indicating that a deeper gradient search allows for finding better solutions. The results for the \(N_{s}\) metric for \(N_{horizon}\) and \(N_{MaxGradIter}\) are shown in Figure 3b. It is evident that with an increase in \(N_{horizon}\), the accuracy of the speed increases: for example,