## 3 Results
### Results of the Analysis of the Influence of the Prediction Algorithm Parameters
Here, a clear compromise can be seen, as in the case of Figure 4b: at high \(P_{Cost}\)_(loss)_ weight, \(R^{2}\) drops significantly (even to negative values), indicating a deterioration in current regulation. Conversely, at low \(P_{Cost}\)_(loss)_ weight and moderate \(P_{Cost}\)_(speed)_ weight, \(R^{2}\) approaches 1.0 (the best values \(\sim\)1.0 are observed at \(P_{Cost}\)_(loss)_ \(\geq\) 2 and \(P_{Cost}\)_(speed)_ \(\leq\) 10). Thus, prioritising speed accuracy leads to better current regulation and vice versa. Setting the \(P_{Cost}\) weight allows for achieving a balance between two objectives. Higher weights for speed ensure almost perfect profile tracking (\(N_{s}\approx\) 100%), but result in increased energy consumption. Conversely, focusing on minimising energy consumption slightly reduces speed accuracy. This trade-off is to be expected with multidimensional functionality, i.e., increasing one indicator stochastically harms the others. The _LineSearchMax_ parameter sets the maximum possible step size of the line search algorithm in the gradient method. This is critical for the convergence speed and stability of the optimisation. GRAMPC uses specialised line search strategies optimised for fast and resource-efficient implementation [32]. Figure 5 shows that at very low values of _LineSearchMax_ (0.01-0.05) the system demonstrates unsatisfactory results: \(N_{s}\approx\) 92-97%, losses \(E_{L}\) are very high (78.9-47.1 J), and the \(R^{2}\) indicator is equal 0, and in some cases, negative values are observed, i.e., the model clearly did not converge. With an increase in _LineSearchMax_ to 0.1-0.4, \(N_{s}\) grows rapidly (up to \(\approx\)99.8%), \(E_{L}\) drops to \(\approx\)42.8 J, and \(R^{2}\) becomes positive and reaches 1.0. With _LineSearchMax_\(\geq\) 0.5, all indicators stabilise: \(N_{s}\approx\) 99.8%, \(E_{L}\approx\) 42.8 J, \(R^{2}=\) 1.0, and \(T_{s}\approx\) 2.4 s. Thus, a line search with a larger maximum permissible step ensured a stable and rapid transition to the optimal solution. A small maximum step size (_LineSearchMax_ < 0.1) will 'lock' the algorithm with a small \(N_{MaxGradlter}\) and lead to an inefficient solution (low accuracy \(N_{s}\), high energy consumption \(E_{L}\), and unstable \(R^{2}\)). Increasing _LineSearchMax_ allows for wider gradient steps, which significantly speeds up convergence and stabilises the solution. This is consistent with practical experiments, which show that in some cases, it is necessary to increase _LineSearchMax_ for reliable convergence. The parameter \(T_{horizon}\) specifies the prediction horizon (the end time of the control segment). Figure 6 shows the following trends: when \(T_{horizon}\) is increased from very small values \(\approx\) 0.09 s, there is a noticeable improvement in performance. In particular, the accuracy of \(N_{s}\) increases from \(\approx\) 98.7% (\(T_{horizon}\approx\) 0.044 s) to \(\approx\) 99.3% (\(T_{horizon}\approx\) 0.088 s). At the same time, energy consumption decreases (from 43.3 J to 42.9 J), and \(R^{2}\) improves significantly (from \(\approx\) 0.5 to \(\approx\) 0.8). Moreover, in the range \(T_{horizon}\approx\) 0.13-0.20 s, the metrics nearly stabilise: \(N_{s}\approx\) 99.2-99.3%, \(E_{L}\approx\) 42.8-42.9 J, and \(R^{2}\approx\) 0.9. At a very large \(T_{horizon}\) (greater than 0.20 s), \(R^{2}\) decreases slightly (\(\sim\)0.8). In general, \(T_{horizon}\approx\) 0.14 s proved to be optimal in terms of the accuracy / cost ratio. Increasing the time horizon of the predictions usually allows for longer system behaviour to be taken into account, which improves control quality and increases stability. The analysis showed that optimising GRAMPC parameters significantly affects the performance of the electric drive control. In particular, increasing \(N_{horizon}\) and to a lesser extent, \(N_{MaxGradlter}\), contributed to an increase in profile tracking accuracy (increase in \(N_{s}\)), improved current control (increase in \(R^{2}\)), and reduced energy consumption.