Nature-Inspired Algorithm Implemented for Stable Radial Basis Function Neural Controller of Electric Drive with Induction Motor

: The main point of this paper was to perform the design process for and verify the properties of an adaptive neural controller implemented for a real nonlinear object—an electric drive with an Induction Motor (IM). The controller was composed as a parallel combination of the classical Proportional-Integral (PI) structure, and the second part was based on Radial Basis Function Neural Networks (RBFNNs) with the on-line recalculation of the weight layer. The algorithm for the adaptive element of the speed controller contained two parts in parallel. The ﬁrst of them was dedicated for the main path of the neural network calculations. The second realized the equations of the adaptation law. The stability of the control system was provided according to the Lyapunov theorem. However, one of the main issues described in this work is the optimization of the constant part of the analyzed parallel speed controller. For this purpose, the Grey Wolf Optimizer (GWO) was applied. A deep analysis of the data processing during the calculations of this technique is shown. The implemented controller, based on the theory of neural networks, is an adaptive system that allows precise motor control. It ensures the precise and dynamic response of the electric drive. The theoretical considerations were ﬁrstly veriﬁed during the simulations. Then, experimental tests were performed (using a dSPACE1103 card and an induction machine with a rated power of 1.1 kW).


Introduction
Over the years, induction motors have been the dominant elements of energy conversion systems. The reasons for this are the low costs of the machines, dynamic features and high reliability [1][2][3]. Currently, the parameters of electric machines have significantly improved; this is the result of new technology in material fabrication and the presently popular numerical tools used for the design process. Moreover, cheap programming devices with high computational power are generally available. The above facts and the large number of industrial applications have led to increased requirements for drive systems with induction motors. A significant group of this devices needs precision of work (the dynamic control of speed or position) under disturbances, a simplified design methodology and the reduction of implementation costs [4,5]. However, meeting the above assumptions can be problematic in the real use of electrical machines. The operation of the electrical drive is often realized under the following conditions: the presence of parameter changes, measured disturbances, delays in signal processing, problems with proper identification, etc. The nonlinearity of the object is another factor that impedes the effective control of the drive.
Theoretical considerations in the field of control theory (control methods or observer algorithms) in applications to practical problems are more complicated. This is caused by the nonlinearity of plants.

Field-Oriented Control of the Induction Motor (IM)-Short Description
The fundamental element of the analyzed system is a parallel neural controller. The plant is an induction motor powered by a voltage inverter. The overall control structure is based on the Direct Field Oriented Control (DFOC) concept [43]. Using this method, the continuous (smooth) control of speed can be achieved. Moreover, precise changes in the state variables are possible. As a result, the external reference signal ω ref can force the acceleration of the drive (speed) without overshoots and oscillations. In the vector control technique, a variable frequency control signal is generated for the motor. The main assumption, that allows obtaining the mentioned properties, introduces two control paths (corresponding to the rotor flux and electromagnetic torque). This can be obtained through the representation of the stator current using two orthogonal components. The alpha-beta coordinates were used in the analysis. In this way, similarity to DC motor control (a cascade control structure) is achieved.
The overall control structure applied for most electrical machines is based on the cascade connection of two control circuits. The internal part is used for the dynamic shaping of the electromagnetic torque. It contains the following elements: a current controller, current sensors and power electronic devices. Some parts of the machine can also be considered as elements of the torque generation system. The second of them is related to the speed control. The dominant time constant t m is related to the mechanical part. Therefore, it can be concluded that the data processing in the torque control loop is much faster than that in the external part of the control structure. The internal part of the control system is a delay for the speed control part [44]. Thus, for the simplification of the design process, this part is often assumed as ideal (t Te = 0 s). It leads to a reduction of calculations and parameter identification (nonlinear elements should be taken into account). The analyzed simplification is beneficial; however, it obviously introduces some limitations. Omitting this point (precise information about the element of the current control loop) in the speed controller optimization process may introduce constraints related to the control dynamics. With very high dynamic changes in the reference signal or high values of the controller, oscillations of the state variables may appear.
In the analyzed structure, the speed and currents were measured. The rotor flux estimator was applied. For this purpose, the current model was used [45]: where: Ψ er i -the estimated signal, R r -the rotor resistance, L r the rotor inductance, L m -the magnetizing inductance, i s -the stator current, p b -the number of pole pairs, and ω-the rotor speed. The model of torque control loop is based on the transfer function described by the equation: G e (s) = 1 t Te s + 1 (2) where: s is the Laplace operator and t Te is the total time constant of the torque control part.
In the second part of the drive, the mechanical time constant t m is dominant: The formula below describes the motion of the rotor, neglecting the friction torque: where: J-the moment of inertia, T e -the electromagnetic torque, and T L -the load torque. The schematic diagram of the DFOC is presented in Figure 1. Based on the described configuration, the simulation model described in the next part of this article was performed.
Energies 2020, 13, x FOR PEER REVIEW 4 of 25 the control system is a delay for the speed control part [44]. Thus, for the simplification of the design process, this part is often assumed as ideal (tTe = 0 s). It leads to a reduction of calculations and parameter identification (nonlinear elements should be taken into account). The analyzed simplification is beneficial; however, it obviously introduces some limitations. Omitting this point (precise information about the element of the current control loop) in the speed controller optimization process may introduce constraints related to the control dynamics. With very high dynamic changes in the reference signal or high values of the controller, oscillations of the state variables may appear.
In the analyzed structure, the speed and currents were measured. The rotor flux estimator was applied. For this purpose, the current model was used [45]: where: Ψer i -the estimated signal, Rr-the rotor resistance, Lrthe rotor inductance, Lm-the magnetizing inductance, is-the stator current, pb-the number of pole pairs, and ω-the rotor speed.
The model of torque control loop is based on the transfer function described by the equation: where: s is the Laplace operator and tTe is the total time constant of the torque control part.
In the second part of the drive, the mechanical time constant tm is dominant: The formula below describes the motion of the rotor, neglecting the friction torque: where: J-the moment of inertia, Te-the electromagnetic torque, and TL-the load torque.
The schematic diagram of the DFOC is presented in Figure 1. Based on the described configuration, the simulation model described in the next part of this article was performed.

Design Process for Parallel Neural Controller
The analyzed speed controller was based on the neural network, with a radial basis activation function applied in the hidden layer. The input vector contained two signals: the speed error and the same signal from the previous step of calculations (a unit delay was applied). The goal during the on-line training (according to the rules described in this section) was minimizing the cost function that described the difference between the input signal and the actual speed trajectory. The Radial Basis Function Neural Network (RBFNN) controller was connected to the rest of the system in series. This meant that the object was a disturbance for the network. However, the adaptation law aims to obtain the set value at the output of the system. Therefore, the output of the net was a part of the control signal; it was a component of the reference value for the internal part of the FOC algorithm. The overall algorithms consisted of a PI controller and a neural network combined in parallel. The centers in the RBFNN were constant. However, assuming a fast update of the weights, the controller was able to adjust the operation to the nominal parameters of the object. Occurring disturbances were also quickly eliminated. In this case, the neural network was an adaptive compensation element. A mathematical description of the calculations performed in the speed controller is presented below. Moreover, the stability analysis was an important element of the design process described in this article.
The simplified topology of the controller is presented in Figure 2. The general form of the object can be assumed as: .
where: f (x) and g(x)-the plant and control functions, respectively, x-the state vector and u p -the input of the plant.

Design Process for Parallel Neural Controller
The analyzed speed controller was based on the neural network, with a radial basis activation function applied in the hidden layer. The input vector contained two signals: the speed error and the same signal from the previous step of calculations (a unit delay was applied). The goal during the on-line training (according to the rules described in this section) was minimizing the cost function that described the difference between the input signal and the actual speed trajectory. The Radial Basis Function Neural Network (RBFNN) controller was connected to the rest of the system in series. This meant that the object was a disturbance for the network. However, the adaptation law aims to obtain the set value at the output of the system. Therefore, the output of the net was a part of the control signal; it was a component of the reference value for the internal part of the FOC algorithm. The overall algorithms consisted of a PI controller and a neural network combined in parallel. The centers in the RBFNN were constant. However, assuming a fast update of the weights, the controller was able to adjust the operation to the nominal parameters of the object. Occurring disturbances were also quickly eliminated. In this case, the neural network was an adaptive compensation element. A mathematical description of the calculations performed in the speed controller is presented below. Moreover, the stability analysis was an important element of the design process described in this article.
The simplified topology of the controller is presented in Figure 2. The general form of the object can be assumed as: where: f(x) and g(x)-the plant and control functions, respectively, x-the state vector and up-the input of the plant. The error changes during the control system calculations can be described with the below expressions: where: xr is a reference state of the plant. Using (7) and the additional assumptions ( , the calculations presented below can be performed [14]: The error changes during the control system calculations can be described with the below expressions: . e = .
x r − . x where: x r is a reference state of the plant. Using (7) and the additional assumptions ( t → ∞, e(t) → 0, . e(t) → 0 ), the calculations presented below can be performed [14]: x r + u r (8) where: u r (t)-the reference (desired) control signal.
Based on the above, the error dynamics are defined by the below expression: .
The signals from the classical PI controller u c and the neural model u rbf are combined in the analyzed control structure (applied in the speed loop of the induction motor): where: and k p -the gain of the proportional part and k i -the gain of the second path of the controller (k p > 0, k i > 0). In this work, for neural calculations, the RBFNN model was applied. Several nodes of a hidden layer contain assigned centers (for the k-th element) [46]: Additionally, the width of the Gaussian function can be scaled using the parameters b (b k > 0): Thus, for the input vector (n-size): the outputs of the following radial neurons are described by the expression: where: . means the distance between the input values and the centers of the neurons. In the last part of neural processing, the values ϕ k are multiplied by the matrix of weights: and the output is calculated as: The considered application assumes on-line data handling (including the weight adaptation, described below), so for the i-th step of calculations, the RBFNN output is achieved using the equation: Energies 2020, 13, 6541 7 of 25 and the adaptation of the neural network weights, in several iterations i, can be described as: Concluding, the real output of the RBFNN can be formulated using the expression: where:Ŵ and ϕ-matrices of the calculated weights and hidden layer outputs, respectively. Then, Equation (10) is modified as below: .
Defining the error (using matrix): Then, (22) is represented as: . where: and The purpose of the RBFNN application is the reduction of the error applied in the control signal calculation. It works like a compensator: where: u rbfo -the optimal signal of the RBFNN (with the precise weight matrix W o ): Precise control means a significant reduction of the training error ε; thus, the bounds of the mentioned error should be assumed [47]: Then, using (27) in (24), the following formula is obtained: The following definitions of errors should also be introduced: .
Energies 2020, 13, 6541 8 of 25 After the next update, Equation (30) has form: A stable adaptation law can be derived after the Lyapunov function assumption: where: P-a positive definite matrix, Ξ is a non-negative matrix and tr means the trace of the matrix. The derivative of the Lyapunov function is calculated below: By using the derivative of the error (33), the above formula can be recalculated (for the next part of the calculations, the sizes of the matrices are neglected-to simplify the mathematical description): The P matrix is calculated using the equation: where: Q-a positive definite matrix. Then, the formula (36) can be rewritten: The following mathematical rule (for column matrices a and b) is known: and similarly, for square (m × n) matrices A and B: Based on the above, Equation (38) can be formulated as follows: Let the proposed stable adaptive law be as follows: After the recalculation of (41), using (42) and (32): Energies 2020, 13, 6541 For the stable work of the control structure, negative values of . L are necessary: Thus, it is obvious that l 1 from (43) is not positive (l 1 ≤ 0). For a small value of the training error (in the above calculations, the limits are introduced (29)), the control system is stable.

Details of Data Processing in the GWO
Modern optimization techniques, based on nature observations, assume the modification of the data set in each iteration of the calculations. According to specific rules, the space of potential solutions is processed. After each turn, the results are evaluated. A characteristic feature can be observed: the elementary operations are often very basic and dependent on the best values from the previous step. Observations of the natural behavior of a group of individuals (wolves) are the base for the optimization algorithm tested in this application.
The detailed rules are presented in Algorithm 1. After removing the data from previous tests, the simulation's condition is declared (the frequency of the calculations, solver, operation time of the model, etc.). Before starting the data processing in the GWO, a dedicated file with the plant should be prepared. It should contain proper reference signals and defined parameters (e.g., the mechanical time constant of the electrical machine). Then, important for the final results, the GWO parameters are introduced. They include the maximum number of iterations, size of population, number of optimized parameters and bounds for solution. After the above actions, the GWO population is initialized as a set of random numbers. Each value is evaluated by the previously declared objective function. Thus, the first best solutions are found. Then, the main loop starts. In each iteration, the elements of the data are recalculated. In the following step, all the solutions are tested again as parameters of the speed controller. The obtained controller gains are closer to the optimal. This information is used in the next step of the algorithm. Before starting the next iteration, the a GWO coefficient is updated, and the conditions ending the computation are checked. After the saving of all the operation's results, the final report is generated. Equations presenting the details of the calculations performed in the GWO are presented in the next paragraph.  (45) where: n GWO -the total number of samples and k-the number of analyzed samples; moreover: The parameters for cyclical changes of the coefficients of the processed data set are described using the following equations [48]: where: r 1 and r 2 are uniformly distributed random numbers.
In Equation (49), the a gwo is used. It is a coefficient narrowing the area of search for the best solutions (the values decrease from 2 to 0): In the next step, using values (47)-(50), the following expression is calculated: where: Xα-the best solution from the previous loop (in the first step, randomly selected solutions are used) and X GWO -the whole set of solutions. The achieved parameter is applied in: Again, (47)-(50) are recalculated for the equation: in which X β is the second optimal solution. Similarly, like above, X 2 is calculated: Finally, the procedure is repeated for X 3 . Once more, the equations for the parameters r 1 , r 2 , A GWO and C GWO are used for (assuming Xσ with the third optimal values): and Energies 2020, 13, 6541

of 25
The update of the population is calculated according to the formula (for the i-th iteration): In this application, the grey wolf optimizer is applied for the optimization of part of the parallel neural controller. More precisely, the fixed parameters of a classical PI controller are determined.

Analysis of Optimization Process
The calculations of the GWO algorithm are preformed iteratively. After each sequence of processing, the population is modified. In this section, the influence of those operations on the controller parameters and the achieved results is analyzed in several stages. From the results (Figure 3), it is possible to read significant calculation conditions, in particular, the maximum number of iterations (the first line also contains the starting point-before optimization) and the size of the group. However, additional information deals with the bounds of solutions. The lower limit was set to 0.05, and the upper possible value was 500. The tests present the control system's response to cyclic reversions. The reference speed at steady state is 25% of the nominal value. Half of each test is measured under the active work of the load machine. As mentioned before, the initial values of the speed controller parameters were chosen randomly (k p_init = 0.4663 and k i_init = 0.6136). The reference trajectory was not tracked precisely (Figure 3a). At each step, the GWO calculations obtained the improved solutions ( Figure 3b). The settling time was reduced, and a significant change was observed after t = 2.5 s (load switching). Overshoots were not observed. Finally, after 30 iterations, the following values were obtained: k p = 5.5892 and k i = 61.4973. The transient of the motor speed is satisfactory for those levels of controller parameters. Initially, the fluctuations of both gains were significant (Figure 3e). However, when analyzing the trend of changes in the final stage of processing, stabilization can be easily observed. It means that the group is approaching the optimal solution.
The transients shown in Figure 3c,d allow the observation of changes in the entire population during the subsequent calculation steps. The X-axis of the chart represents the individual number, while the Y-axis (upwards in the subsequent layers of the colormap) is related to the results in the following stages of the mathematical operations (equations presented in the previous section). Figure 3c shows the results for the gain in the proportional path of the controller, while the next one ( Figure 3d) presents a graph for the parameter of the integral element. Random numbers were assigned to the whole initial population of wolves. It should be clarified that the above-mentioned initial values of the potential controller parameters resulted from tests for subsequent values in the group. The settings corresponding to the smallest value of the objective function were adopted as the initial solutions (k p_init and k i_init ). The parameters in the entire space of the analyzed solutions are stabilized. It is important that in the intermediate stages of calculations, samples of larger (than the optimal values obtained in the last iteration) values are visible. It means that the population returns to the area of the best solutions, and then narrows down the searching for the optimum in this region.

Common Problems of Metaheuristic Methods Applied for Classical Controller Tuning
Most often, during tests of control structures for an electric drive (but also for other dynamic objects), the shape of the forcing signal is step or square. It allows testing the properties of the control system under dynamic changes of state variables. In the case of the mentioned reference speed signals, a characteristic phenomenon is observed during the optimization of the control structure parameters. It is obvious that the ideal tacking of the input transient cannot be achieved. It is related to the time constants of the electromagnetic torque-shaping loop and-the greatest one-the mechanical time constant. Calculating the speed error for each sample-in fact, the area between the reference value and the actual level of the signal-is considered. Closer analysis leads to the conclusion that the short-time peak (Figure 4a) can be thought of as a lower value of the calculated control error than, for practical reasons, the results of a properly optimized one ( Figure 3). However, it can be dangerous for closed-loop control. A high value of the short-time signal can lead to oscillations or instability. The second problem, in such a situation, can be related to damage to the shaft and the mechanical elements of the drive (jerks caused by the peak). It should also be noted that the above issue is triggered by large values of optimized parameters. High values of gains can amplify measurement noises. The use of algorithms based on biological observations often leads to the described problem. The following methods are used for the proper optimization process realized for sharp forcing signal shapes: The modification of command signals (the application of input filters or slope trajectories); The insertion of additional noise to the feedback paths; The alternative definition of the cost function.
The calculations of the GWO algorithm are preformed iteratively. After each sequence of processing, the population is modified. In this section, the influence of those operations on the controller parameters and the achieved results is analyzed in several stages. From the results ( Figure  3), it is possible to read significant calculation conditions, in particular, the maximum number of iterations (the first line also contains the starting point-before optimization) and the size of the group. However, additional information deals with the bounds of solutions. The lower limit was set to 0.05, and the upper possible value was 500. The tests present the control system's response to cyclic reversions. The reference speed at steady state is 25% of the nominal value. Half of each test is measured under the active work of the load machine. As mentioned before, the initial values of the speed controller parameters were chosen randomly (kp_init = 0.4663 and ki_init = 0.6136). The reference trajectory was not tracked precisely (Figure 3a). At each step, the GWO calculations obtained the improved solutions (Figure 3b). The settling time was reduced, and a significant change was observed after t = 2.5 s (load switching). Overshoots were not observed. Finally, after 30 iterations, the following values were obtained: kp = 5.5892 and ki = 61.4973. The transient of the motor speed is satisfactory for those levels of controller parameters. Initially, the fluctuations of both gains were significant (Figure 3e). However, when analyzing the trend of changes in the final stage of processing, stabilization can be easily observed. It means that the group is approaching the optimal solution. The transients shown in Figure 3c,d allow the observation of changes in the entire population during the subsequent calculation steps. The X-axis of the chart represents the individual number, while the Y-axis (upwards in the subsequent layers of the colormap) is related to the results in the following stages of the mathematical operations (equations presented in the previous section). Figure 3c shows the results for the gain in the proportional path of the controller, while the next one  Noise was added to the speed measurement path. Such action is inspired by the phenomenon described in [50]. Increasing the gain value in control systems can lead to better dynamic properties. However, in a real (hardware) application, there may be a problem with measuring the noise amplification (it affects the control error). In relation to the tuning of the controller using metaheuristic methods, the described phenomenon can be used to limit the excessive growth of the optimized values.    Figure 4 shows an example of the implementation and optimization of a PI controller used for a dynamic plant. The first method (Figure 4b) assumes forcing the speed according to a soft input signal [49]. It is simple to implement. In addition, the parameters of the input filter model or ramp slope affect the achieved gains. Here, the input signal-shaping element was defined using the following transmittance: where ξ r is the damping: coefficient and ω 0 is the reference resonant frequency. In the second case, an additional disturbance was introduced in the feedback loop (Figure 4c). Noise was added to the speed measurement path. Such action is inspired by the phenomenon described in [50]. Increasing the gain value in control systems can lead to better dynamic properties. However, in a real (hardware) application, there may be a problem with measuring the noise amplification (it affects the control error). In relation to the tuning of the controller using metaheuristic methods, the described phenomenon can be used to limit the excessive growth of the optimized values.
The last example takes into account definitions of the cost function ( Figure 4d) other than (45). The modified formula is shown below: where: u s -the control signal, and χ and ζ are constant parameters. In Equation (60), the last two components are characteristic elements. The first of them allows taking into account, during optimization, the influence of the error derivative value. Thus, rapid changes are reduced. Additionally, dynamic changes in the control signal are reduced [39]. According to this method, the effect of short-term overshoots (Figure 4a) is eliminated.
It should be noted that this is not a comparison, but a presentation of effective methods for avoiding the described problem ( Figure 4). All methods present a preset speed level obtained without overshoots. In the following tests, various starting points were assumed; this is visible in the values of the objective function. The speed control error, for the best solutions, is reduced, so the controller is properly tuned. It is worth paying attention to the overall level of the final values of the cost function in subsequent simulations. The values do not oscillate around zero in each case. The introduction of noise increases the numerical value of the error (even around the best results).
The results in the previous section were obtained for the model of the drive with IM. A combination of the above-described methods was adopted. Noise (uniform random numbers) and the input model (ω 0 = 15 s −1 , ξ r = 1) were used. The f c objective function was used in the optimization.

Starting Point of the Grey Wolf Optimizer
The initial assumptions have to be defined for the optimization problem. The starting point can have an influence on the final results. When applying metaheuristic algorithms, the initial values are most often selected as random numbers. It is a situation similar to that during the optimization of neural network weights (training). Initial randomization was also consistent with the assumptions of this project. Three rules were defined during the GWO optimization; the details are presented below.
The values of the speed controller gains were selected from the uniformly distributed pseudorandom numbers. This ensured a lack of the initial information about the problem. The parameters have to be positive. This is due to the structure of the controller (PI). The random number should be a fractional value (the calculation starting point is distant from the optimal solution). It seems to be the most difficult case to optimize.
In order to analyze the influence of the initial values of the GWO algorithm, additional tests were performed. The results are shown in Figure 5; the details are presented in Table 1. In subsequent tests, the principles described earlier were applied. However, the numbers obtained in the randomization process were re-scaled. In this way, significantly different initial conditions for the optimization algorithm were obtained. The following calculations of the GWO algorithm led to very similar gains for the optimized controller. This is an important feature of the implemented technique-the repeatability of the results. the optimal solution). It seems to be the most difficult case to optimize.
In order to analyze the influence of the initial values of the GWO algorithm, additional tests were performed. The results are shown in Figure 5; the details are presented in Table 1. In subsequent tests, the principles described earlier were applied. However, the numbers obtained in the randomization process were re-scaled. In this way, significantly different initial conditions for the optimization algorithm were obtained. The following calculations of the GWO algorithm led to very similar gains for the optimized controller. This is an important feature of the implemented technique-the repeatability of the results.  Figure 5. Results of the controller parameter optimization-influence of the initial value selection.

Simulations
The verification of the control method, described in this paper, was performed firstly in simulations. Both parts of the parallel speed controller described in the previous sections were combined. The described neural controller was used in the speed control loop of the DFOC method. The drive model, according to the scheme presented in Figure 1, was prepared. Five nodes in the radial layer of the neural network were applied. The parameters of the PI controller were set as described in the previous part of the article. The most important data of the control system are presented in Table 2. The fixed step size of the calculations was set to tc = 0.0001 s. The tests took 30 s. The reference trajectory forces the drive to cyclic reversion. The speed in steady state was 25% of the

Simulations
The verification of the control method, described in this paper, was performed firstly in simulations. Both parts of the parallel speed controller described in the previous sections were combined. The described neural controller was used in the speed control loop of the DFOC method. The drive model, according to the scheme presented in Figure 1, was prepared. Five nodes in the radial layer of the neural network were applied. The parameters of the PI controller were set as described in the previous part of the article. The most important data of the control system are presented in Table 2. The fixed step size of the calculations was set to t c = 0.0001 s. The tests took 30 s. The reference trajectory forces the drive to cyclic reversion. The speed in steady state was 25% of the nominal value. The values of the state variables were analyzed in a per unit system (all the saved data are divided by the nominal level). The starting part was realized without the active work of the load machine. Then, during the work of the drive, the load torque was added at time t = 23.8 s. The design parameters in Equation (42), the constant part defined by user, are represented here using one symbol, η. Two state variables were analyzed in the tests: the speed of the motor ω and the i sy component of the stator current. These signals are a reference to the cascade structure of the DC motor control (electromagnetic torque and the main controlled variable-speed). The first test was prepared for the nominal parameters of the drive. The purpose was the presentation of the correct work of the control structure. The training parameter of the neural network was equal to η = 0.09. The long-time period of drive operation is presented in Figure 6a. It is a practical validation of the stable work of the drive. The three next transients contain, for the easier analysis of the results, an enlarged fragment of the speed signal. The mentioned figures show the following stages of the test: the initial phase (Figure 6b), the tuned neural network (Figure 6c) and the switching of the load (Figure 6d). Precise control is observed. The reaction of the drive after the load acting is very short. Figure 6e shows the transient of current. The adaptation can be easily noticed. Improved after each reversion, reference speed tracking is possible because of the modification of the current shape in the control system (Figure 6f). a practical validation of the stable work of the drive. The three next transients contain, for the easier analysis of the results, an enlarged fragment of the speed signal. The mentioned figures show the following stages of the test: the initial phase (Figure 6b), the tuned neural network (Figure 6c) and the switching of the load (Figure 6d). Precise control is observed. The reaction of the drive after the load acting is very short. Figure 6e shows the transient of current. The adaptation can be easily noticed. Improved after each reversion, reference speed tracking is possible because of the modification of the current shape in the control system (Figure 6f).
For the part of the control structure related to speed, the most significant part is the mechanical part of the machine. In the previous trial, this parameter was at the level tm = tmn = 0.15 s. Now, the work of the control system was analyzed under variation from the nominal (Figure 7). The other conditions were the same as in the above test. If the value of this parameter is twice as large, the motor is heavier, the downcast in the speed signal is smaller (after load switching) and the temporary values of the current are higher (Figure 7a-c) than in the second (tm = 0.5tmn) case ( Figure  7d-f). Overall, the conclusion is as follows: the adaptation (modification of the weights) of the controller coefficients leads to the proper operation of the motor, even if the fluctuation of parameters occurs in the drive. The neural network can compensate for the changes in the mechanical time constant. Subsequent studies dealt with issues typical for neural controllers. In the first part of this section, the results (in the initial part of the drive acting) contain oscillations. This is a typical problem noted in applications of neural controllers. The reason is related to the initial values of the For the part of the control structure related to speed, the most significant part is the mechanical part of the machine. In the previous trial, this parameter was at the level t m = t mn = 0.15 s. Now, the work of the control system was analyzed under variation from the nominal (Figure 7). The other conditions were the same as in the above test. If the value of this parameter is twice as large, the motor is heavier, the downcast in the speed signal is smaller (after load switching) and the temporary values of the current are higher (Figure 7a-c) than in the second (t m = 0.5t mn ) case (Figure 7d-f). Overall, the conclusion is as follows: the adaptation (modification of the weights) of the controller coefficients leads to the proper operation of the motor, even if the fluctuation of parameters occurs in the drive. The neural network can compensate for the changes in the mechanical time constant.
Subsequent studies dealt with issues typical for neural controllers. In the first part of this section, the results (in the initial part of the drive acting) contain oscillations. This is a typical problem noted in applications of neural controllers. The reason is related to the initial values of the neural network coefficients. The weights are randomized. The results, presented in Figure 8a-c, were obtained for different initial conditions (subsequent draws). During the first period of the speed transient, the impact of such action is slightly visible. However, the system is stable and convergence (of the reference and actual speed) is quickly achieved. This does not affect the further operation of the system (after a Energies 2020, 13, 6541 18 of 25 few seconds, the response against the load is identical). The solution to such a problem is the initial pre-training of the neural network; then, the adaptive law starts with predefined values for the weights.
network. They are dependent on the training rate. The influence of the constant η is visible in Figure  8d-f. Small values of the learning parameter cause longer adaptation times, while increasing the value forces faster adaptation. However, a very high value of the training factor can cause overshoots and oscillations of the state variables. An increase in the constant coefficient used in adaptation increases the step of the optimal value search (it reduces the time for proper value calculation). However, the optimization algorithm may, in this case, omit the global optimum. Otherwise, a small value of η leads to not-very-large increments of weights in the neural network, and as a result, the precision of the calculations is higher. value forces faster adaptation. However, a very high value of the training factor can cause overshoots and oscillations of the state variables. An increase in the constant coefficient used in adaptation increases the step of the optimal value search (it reduces the time for proper value calculation). However, the optimization algorithm may, in this case, omit the global optimum.
Otherwise, a small value of η leads to not-very-large increments of weights in the neural network, and as a result, the precision of the calculations is higher.

Experiment
As a real implementation of a neural control system (the details are presented in previous sections), the experimental tests prepared for an induction motor are investigated in this section. The control algorithm, presented in Figure 1 (optimized using the grey wolf optimizer), was implemented in the digital signal processor of the dSPACE1103 card. The sampling time assumed in the data processing of the structure was set to tc = 0.0001 s. The signals were measured using an incremental encoder (36,000 pulses per rotation) and a current sensor. These elements were connected to the processor using an external board. In the subsequent stage, after the calculation of the neural controller and the following part of the DFOC, a control signal for the voltage inverter The dynamics of the adaptation algorithm have an impact on the parameters of the neural network. They are dependent on the training rate. The influence of the constant η is visible in Figure 8d-f. Small values of the learning parameter cause longer adaptation times, while increasing the value forces faster adaptation. However, a very high value of the training factor can cause overshoots and oscillations of the state variables. An increase in the constant coefficient used in adaptation increases the step of the optimal value search (it reduces the time for proper value calculation). However, the optimization algorithm may, in this case, omit the global optimum. Otherwise, a small value of η leads to not-very-large increments of weights in the neural network, and as a result, the precision of the calculations is higher.

Experiment
As a real implementation of a neural control system (the details are presented in previous sections), the experimental tests prepared for an induction motor are investigated in this section. The control algorithm, presented in Figure 1 (optimized using the grey wolf optimizer), was implemented in the digital signal processor of the dSPACE1103 card. The sampling time assumed in the data processing of the structure was set to t c = 0.0001 s. The signals were measured using an incremental encoder (36,000 pulses per rotation) and a current sensor. These elements were connected to the processor using an external board. In the subsequent stage, after the calculation of the neural controller and the following part of the DFOC, a control signal for the voltage inverter was generated. The main part of the laboratory set-up consisted of two electrical machines (a motor and load) connected using a rigid shaft ( Figure 9). The experimental tests were realized for the induction motor with a nominal power of 1.1 kW.

(d)
(e) (f) Figure 8. Transients of motor speed-influence of initial weight randomization (a-c) and influence of learning coefficient (d-f).

Experiment
As a real implementation of a neural control system (the details are presented in previous sections), the experimental tests prepared for an induction motor are investigated in this section. The control algorithm, presented in Figure 1 (optimized using the grey wolf optimizer), was implemented in the digital signal processor of the dSPACE1103 card. The sampling time assumed in the data processing of the structure was set to tc = 0.0001 s. The signals were measured using an incremental encoder (36,000 pulses per rotation) and a current sensor. These elements were connected to the processor using an external board. In the subsequent stage, after the calculation of the neural controller and the following part of the DFOC, a control signal for the voltage inverter was generated. The main part of the laboratory set-up consisted of two electrical machines (a motor and load) connected using a rigid shaft (Figure 9). The experimental tests were realized for the induction motor with a nominal power of 1.1 kW.  In the first scenario of the experimental tests, a square waveform was set as the command signal. The load was not turned on. As shown in Figure 10a, the adaptation of the internal coefficients of the neural network compensator leads to precise control. The control method could obtain the command speed (with acceptable error) in a relatively short period of time. Then, the work of the control structure under external disturbances was also analyzed ( Figure 11). In each upper half of the reference course, in the steady state, the load was switched on, and after a short time (about 0.5 s), it was disconnected. Comparing Figure 10b,d (and Figure 11b,d, respectively), a reduction in overshoots is easily noticeable. For both analyzed cases, the i sy current is also presented. In this configuration of the drive (DFOC), Energies 2020, 13, 6541 20 of 25 the dynamics of the changes and the shape of this signal are similar to the electromagnetic torque. Thus, during machine speed changes (e.g., the start of the motor), its value is increasing. Then, if the load is not active, only natural phenomena are obstacles (e.g., friction). As a result, the value of this component of the stator current is minimal (Figure 10e). However, more power is needed if the load is turned on; the step (increasing) of the current is visible (Figure 11e). The relationship between the components of the rotor flux also indicates the correct operation of the control system (Figures 10f and 11f).
obtain the command speed (with acceptable error) in a relatively short period of time. Then, the work of the control structure under external disturbances was also analyzed ( Figure 11). In each upper half of the reference course, in the steady state, the load was switched on, and after a short time (about 0.5 s), it was disconnected. Comparing Figure 10b,d (and Figure 11b,d, respectively), a reduction in overshoots is easily noticeable. For both analyzed cases, the isy current is also presented. In this configuration of the drive (DFOC), the dynamics of the changes and the shape of this signal are similar to the electromagnetic torque. Thus, during machine speed changes (e.g., the start of the motor), its value is increasing. Then, if the load is not active, only natural phenomena are obstacles (e.g., friction). As a result, the value of this component of the stator current is minimal (Figure 10e). However, more power is needed if the load is turned on; the step (increasing) of the current is visible (Figure 11e). The relationship between the components of the rotor flux also indicates the correct operation of the control system (Figures 10f and 11f). upper half of the reference course, in the steady state, the load was switched on, and after a short time (about 0.5 s), it was disconnected. Comparing Figure 10b,d (and Figure 11b,d, respectively), a reduction in overshoots is easily noticeable. For both analyzed cases, the isy current is also presented. In this configuration of the drive (DFOC), the dynamics of the changes and the shape of this signal are similar to the electromagnetic torque. Thus, during machine speed changes (e.g., the start of the motor), its value is increasing. Then, if the load is not active, only natural phenomena are obstacles (e.g., friction). As a result, the value of this component of the stator current is minimal (Figure 10e). However, more power is needed if the load is turned on; the step (increasing) of the current is visible (Figure 11e). The relationship between the components of the rotor flux also indicates the correct operation of the control system (Figures 10f and 11f). To evaluate the start of the drive with a different initial point of the neural part used in the speed controller, the tests of the plant were repeated. All the conditions of the tests were fixed, but the weights were randomized (for each benchmark). Figure 12 presents the repetitive actions of the drive. In the initial part (Figure 12b) of the transients, the shapes of the signals are divergent. The following sequences of the motor operations show improvement; for all the tests, the results are To evaluate the start of the drive with a different initial point of the neural part used in the speed controller, the tests of the plant were repeated. All the conditions of the tests were fixed, but the weights were randomized (for each benchmark). Figure 12 presents the repetitive actions of the drive. In the initial part (Figure 12b) of the transients, the shapes of the signals are divergent. The following sequences of the motor operations show improvement; for all the tests, the results are similar. The optimization algorithm, applied for the weight update, is at the same point for each case. However, the overshoots are still visible (Figure 12c). In the next few seconds, the problem is eliminated. The results are almost identical, and the accuracy of the speed control is very high (Figure 12d). Most of the mentioned points are typical problems during the application of control algorithms. However, by analyzing the achieved transients, the proper work of the drive (according to initial The previous results in this section of the article were obtained for the same conditions as those assumed in the simulations. Now, the influence of the η parameter on the dynamics of the drive was tested in the experiment. The results are presented in Figure 13. A periodic step command was sent to the drive. A quick response of the induction motor was observed. Additionally, the impact of the controller parameter adaptation was significant. The output of the speed controller was a reference signal to the torque control part. If this state variable was processed very fast (compared to the speed control loop) and without disturbances, the effect (changes in the current values in temporary states) is visible in the changes in current i sy (Figure 13d). Then, this signal influenced the speed transients ( Figure 13a). It is worth mentioning that the general observations are close to the simulations. A higher value of the constant parameter in the equation used for the weight recalculation can reduce the time of adaptation. However, this parameter should not be overstated. This can lead to a loss of stability. In real implementations, even before that limit, it can enlarge the noise appearing in the information from the sensors (Figure 13f).Two sections of this paper show the transients verifying the initial concept and theoretical deduction of the adaptive neural controller applied for the induction motor. Simulations and experimental studies were developed. During the research, efforts were made to ensure similar calculation conditions. These were simple to ensure using a digital signal processor implemented in the dSPACE card. Therefore, there are no significant differences between the main part of the code in both cases. The conditions of the simulations, solver method and sampling time were the same. When comparing the results from both parts of the tests, some additional comments should be noted. Slight differences can be observed (rising times, overshoots, etc.). This is related to the assumptions listed below: The simulations were performed for a model of the drive based on non-precise identification. Nonlinear elements were not taken into account in the simulation. The limitations of current were not considered in the calculations. The initial weights were randomized. Most of the mentioned points are typical problems during the application of control algorithms. However, by analyzing the achieved transients, the proper work of the drive (according to initial expectations) can be determined, and the potential for real implementation can be concluded. Most of the mentioned points are typical problems during the application of control algorithms. However, by analyzing the achieved transients, the proper work of the drive (according to initial expectations) can be determined, and the potential for real implementation can be concluded.

Conclusions
This publication presents the implementation of an adaptive speed controller (a combination of a PI controller with constant parameters and an on-line-trained radial basis function neural network) in an electric drive. The most important goal was to optimize the parameters of the classical part (k p and k i ). For this purpose, the grey wolf optimizer was applied. On the basis of the theoretical background and the obtained results, the conclusions presented below can be deduced.
It is possible to improve the work of the classical speed controller applied in the Direct Field Oriented Control structure using a neural compensator. Nature-inspired algorithms can be techniques for the auto-tuning of controllers implemented for composed, including nonlinear, plants. Starting from the random state of the population, after following modifications, optimal solutions (without complicated mathematical calculations) were found. The stable adaptation law, based on the Lyapunov theory, was successfully tested in a real application. The constant parameters used in the equation defining the modification of the weights in the RBFNN are important for the work of the speed controller (the dynamics of the control structure).