## 2 Modification of the Controller  
When designing a control structure for objects characterized by a noticeable time delay, a structure that utilizes an object model is typically considered. Such a structure can include, for example, a system with a _Smith predictor_ or a system with _Internal Model Control_. When the designed dynamics of such a system are not large, a properly selected PI/PID controller can be used instead of a more complex control structure [7]. In the case of a single-input controller, this block is fed only by the speed error (Figure 1). The settings for such a typical form of controller and for the identified object can be determined analytically or experimentally. For the I2 PD system, the settings were determined analytically (see later sections in this article for details), and for the system with a PMSM, the settings were determined using a random method. One implementation of this method--RWC (_Random Weight Change_)--as described in [37; 38], has been used to determine the parameters of an artificial neural network. This algorithm, due to its simplicity (Figure 2), allows for easy implementation in various development environments as well as in embedded devices. Tests have shown that this algorithm can be executed not only during simulation but also on the laboratory bench. The described controller structure is used as a reference system for the modified system. Based on the observed and tested properties, it was proposed to modify the structure to enhance performance, improve stability, and address any limitations identified during the testing phase. These modifications aim to optimize the system's overall efficiency and ensure better adaptability to varying operational conditions. The proposed modification of the controller's structure, as presented in Figure 3, consists of preconditioning the signal feeding the speed controller by adding a delay line. The outputs of the individual branches  
Figure 1: Basic implementation of a PID speed controller. A system with one input (error) and one output (control signal). Figure 2: Visualization of speed controller parameter determination—selection of weights or/and controller parameters—algorithm RWC. of the delay line are then summed with appropriate weighting. The modified controller presented in this article will be called MPI/MPID (multi-input PI/PID). Such a signal processing structure corresponds to a finite impulse response filter, the general form of which is presented below (1):  
\[y[n]=\sum_{k=0}^{M}b_{k}\,x[n-k], \tag{1}\]  
where \(y[n]\) is the output, \(M\) is the order of the FIR, \(b_{k}\) are the coefficients, and \(x[n-k]\) are the delayed input signals. The application uses a high-order FIR filter with multiple null parameters to achieve a delay value greater than the sampling step. The delay value of the signal \(\tau\) (Figure 3) is selected to allow repeated sampling of the waveform containing the component of the expected highest frequency. The signal delay time is determined experimentally through a series of tests. By evaluating quality indicators for different delay values, the optimal delay is selected. The calculation process is performed in parallel (multithreaded), which reduces computation time. In the system under study, the number of delayed deviation signals was chosen as \(M=9\). This limitation is due to the available memory in the laboratory system. The weights and settings of the modified controller are determined using the \(R\)WC method described above. An important feature of this approach is that the procedure for determining the parameters of the weights, as well as the new controller settings, can start from known, analytically determined parameters. This applies to the controller parameters, but also to the initial FIR weights. The optimization process can start with weights selected so that the controller works like a \"typical\" controller without modifications. This allows the optimization to be performed safely on the real system.