Digital twin of mechatronic drive based on the optimal control model of BLDC motor

This paper presents a digital twin of a mechatronic drive based on a brushless DC (BLDC) motor model based on a nonlinear discrete optimal control model. Some parameters of a BLDC motor, such as resistance and inductance of windings, magnetic flux, viscous friction coefficient in bearings, angular velocity and electromagnetic moment, can change due to both degradation of structural elements and external forces. Simulation by a complete enumeration of the values of the parameters of the mechatronic device with a certain step will make it possible to adapt the program of the control device to changing operating conditions according to the criterion of minimizing the control energy by changing the parameters of the state matrices and control of the digital twin. As a result, the accuracy of the movement of the mechatronic device along the given trajectory will increase due to the greater correspondence of the control parameters to the real object.


Introduction
Currently, in connection with the development in industry of complex and capital-intensive production systems, accidents on which can lead to significant losses due to expensive repairs, and the significant development of data transmission facilities, computer technology and storage devices for large amounts of data, the concept of digital twins has appeared. [1][2][3][4][5]. Behind this concept lies an approach based on forecasting methods, for example, the residual resource of elements of complex systems [1][2][3][4][5]. Methods and mathematical models for such forecasting, based on the methods of mathematical statistics, were widely developed in the 20th century. Now this approach, based on recording a large amount of measurement data in the database, makes it possible to form training samples of conditionally "suitable", that is, those capable of fulfilling a functional purpose with a high probability, and conditionally "unusable elements of systems that can lead to an accident. the entire system soon and must be replaced immediately. Another approach involves modeling the parameters of the control algorithm in order to adapt it to changing operating conditions both due to material degradation and environmental changes.
The purpose of the digital twin is determined in accordance with [1][2][3][4][5] as a software model, with the help of which it is possible to determine the degree of conformity of the control model incorporated in the control program of the mechatronic device and the real parameters of the drive. If during the operation of the mechatronic device the parameters change due to the degradation of the nodes, then during control the errors of the output parameter (angular speed of the drive) will increase. To ensure the specified accuracy of the angular speed of the drive, an algorithm for adapting the control program is proposed based on modeling the state and control matrices [6][7][8][9][10][11][12][13][14][15][16][17][18].
This paper presents a mathematical model of a digital twin for a BLDC motor, as an element of a production line, and optimally controlled using a nonlinear algorithm. Modeling the operating conditions from the model will allow the controller to adapt to changing operating conditions.

Mathematical model of mechatronic drive
It is known that the optimal control in the state space is represented by the following model in discrete form, when the matrix Ak, Bk, Ck are constant at times k, k=0,1,2,3,… [11].
where xk, xk+1 are state vectors on the trajectory of motion, Ak, Bk, Ck -matrices of state, control and measurement, yk is the measured output state of the system, T is the sampling time.
Let us represent (1) in the classical form We find solution (2) as a solution to the matrix equation, i.e. the state score will be calculated as: ( The optimal solution (3) with the view (4) is found in the form of [12][13][14][15][16][17]: where Kk is the Cauchy matrix, which can be found by solving the Riccati equation [16,17]: where Q and G are positive arbitrarily defined matrices. The matrices Q and G are chosen positive definite, since affect only the scale of the solution. We will select these matrices by selection or modeling [16,17].
The quality criterion that minimizes the energy of control and displacement, in this case, is a quadratic form: The control process assumes adjusting the matrix Ak at each control step. In the initial serviceable state of the mechatronic device, only one element will change in this matrix. This element contains a variable load moment, which is calculated according to the data of the information-measuring system in terms of the BLDC motor shaft as where ε(k) is the angular acceleration reduced to the BLDC motor shaft, which is necessary to return to the trajectory set during control; J is the moment of inertia of the mechatronic device reduced to the electric drive shaft. Let the accuracy of the trajectory execution by the mechatronic device be given as δmax, determined by the tolerances for the manufacture of the components of the mechatronic device and the permissible environmental parameters of the functioning of this mechatronic device. The control device at the moment of loss of controllability according to the criterion of an increase in the trajectory errors above the given δmax or the impossibility of performing control due to the exceeding of the passport values of the parameters of the electric motor starts the algorithm for modeling the state and control matrices on the digital twin.
The program for modeling the state and control matrices of the digital twin can be placed on a high-performance external processor that receives data from the memory, into which the control unit of the mechatronic device places the current state and control matrices at regular intervals while moving along a certain trajectory segment. On the other hand, if the frequency of control measurements is large, and the processor power of the control device is sufficient, then simulation of the state and control matrices can be implemented in the background on the device itself.
The following algorithm is proposed for modeling the state and control matrices on a digital twin to ensure the minimum control energy for a given accuracy of the angular speed of the drive. 5. The calculated trajectory during simulation will be equal to Constant elements of control and state matrices do not change during brute-force simulation. A dynamic model of the BLDC motor was developed in a rotating coordinate system (d, q), oriented along the magnetic axis of the rotor. Based on the second Kirchhoff's law, an equation has been compiled that describes the electrical part of the BLDC motor in the d, q coordinate system rotating at the rotor speed ω: where ̅̅̅ = − is the resulting voltage vector on the stator winding; , are active resistance and total inductance of the stator phase; Ф ̅̅̅̅ = Ф + Ф is the magnetic flow vector of the BLDC motor; ̅ is voltage drop caused by the stator magnetic flux; Ф ̅̅̅̅ is voltage drop caused by the main magnetic flux of the BLDC motor, which is created by the rotor.
Let us represent a model of a mechatronic drive based on a BLDC motor in the form (1,2), taking C=E: is the planned value of the angular speed; θ(k+1) is the planned value of the angular position of the motor shaft; T is sampling interval, time between k+1 and k samples; R is the active resistance of the stator winding of the BLDC motor; Lq, Ld are inductance of the BLDC motor stator along the q and d axes; p is the number of pairs of poles of the BLDC motor; ψ is the magnetic flux induced by permanent magnets in the stator winding; F is coefficient of viscous friction in the BLDC motor; J is moment of inertia; M(k) is the electromagnetic moment of the BLDC motor; are projection of the stator current on the d-axis, projection of the stator current on the q axis, the angular velocity, angular displacement of the BLDC motor at time k+1; uq, ud are stator voltage projections on the q and d axes; The novelty of the discrete BLDC motor model is the presence of a variable load moment in the state matrix at each step of the simulation, calculated according to the required moment for movement along a given trajectory, based on the measured trajectory. Then the state matrix of the BLDC motor model will be equal to Control matrix is: Variable in the process of operation and simulated components R, L for the state matrix (15) and L for the control matrix (16) of the BLDC motor model.

BLDC motor simulation results
Let us calculate the control and state matrices for the BLDC motor JK42BLS01. The parameters of the BLDC motor JK42BLS01 are shown in table 1.
Let's set the measurement matrix C in the form of a unit matrix, we get: where is the vector of measurement errors that can be simulated by a pseudo-random number generator. In this experiment, the vector of control errors is taken equal to zero.
The BLDC motor JK42BLS01 was simulated in the MatLab program. Time T=0.001 sec. Figure 1 shows the projections of the voltage vector Ud, Uq of the BLDC motor stator, calculated on the basis of the Riccati equation in the MatLab program. Figure 2 shows the projections of the control currents id and iq.  The selection of the elements of the state and control matrices according to the algorithm as a result of modeling and the recording of these values into the control algorithm at the control object will ensure the adaptation of the control program to changing operating conditions.

Conclusion
This paper presents a digital twin of a mechatronic drive based on a BLDC motor model based on a nonlinear discrete and optimal control model. Simulation on a digital twin by a