A data-driven method for analyzing and modeling internal disturbances of electric motors
The nonlinear model inside the motor is fitted through the deep neural network structure, and the problems of motor modeling complexity and data error are solved, and the fitting ability and modeling accuracy are improved.
Patent Information
- Application Number
- CN202310834525.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2043-07-07
AI Technical Summary
The prior art has problems such as difficult to simulate in internal modeling of motors, large errors in measured data, and weak nonlinear fitting capabilities.
Using a deep neural network-based method, the structure including 4-layer 1D convolutional encoder, 1-layer channel attention mechanism layer, 4-layer 1D deconvolution network decoder and 4-layer bidirectional long and short word memory model is designed, and the deep neural training is trained. The network is used to fit the nonlinear model inside the motor.
Accurate fit and model the complex mechanisms inside the motor are realized, nonlinear fitting ability is improved, and errors between simulation data and measured data are reduced.
Smart Images

Figure CN116822089B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of motor modeling, and in particular relates to a data-driven method for analyzing and modeling the internal disturbance of a motor. Background Art
[0002] Data-driven models have brought great changes to the robotics industry and automation industry, such as unmanned vehicle trajectory prediction, fuel cell simulation, motor fault identification, bearing vibration simulation, motor simulation control, etc., a series of parameters that are difficult to measure in the real environment, such as the motor output load, can also reflect the impact of nonlinear disturbances in the reducer on the control performance. At present, the main method based on mathematical models is to establish the kinematic and dynamic equations of the motor to achieve motor parameter identification, but the above algorithm has three defects:
[0003] 1. The internal mechanism of the motor is extremely complex and difficult to simulate through a single model.
[0004] 2. There are many unknown influencing factors in the measured data, and the error between the measured data and the simulated data is large.
[0005] 3. The algorithm has weak nonlinear fitting ability. Summary of the invention
[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and to provide a data-driven method for analyzing and modeling the internal disturbance of a motor.
[0007] The present invention is implemented as follows: a data-driven method for analyzing and modeling the internal disturbance of a motor comprises the following steps:
[0008] S01. Design a deep neural network structure for motor internal disturbance analysis and modeling method:
[0009] The deep neural network structure includes 4 layers of 1D convolution encoders, 1 layer of channel attention mechanism layer, 4 layers of 1D deconvolution network decoders, and 4 layers of bidirectional long and short word memory models BiLSTM as jump link connectors to connect the encoder and decoder;
[0010] The convolution process of the convolutional neural network of the convolutional encoder includes: G represents the feature to be processed, that is, the input of the convolutional network, F is the specific convolution kernel, C is the convolution output result, and the zero padding operation is not considered. The neural network inputs an image of size n×n, and after filtering with a convolution kernel of f×f, (n-f+1) is obtained. 2 The output of G and C, each cell corresponds to a neuron node, and the value of a neuron node in the next layer comes from the weighted sum of multiple nodes in the previous layer;
[0011] The deconvolution neural network convolution process of the deconvolution network decoder is the inverse operation of the convolution encoder;
[0012] The channel attention mechanism layer obtains the global information of space or channel through pooling, and uses the fully connected network to learn the redistribution weights, where the calculation of the fully connected network is: ω i 、x i The weights corresponding to the input and the connection line correspond one to one, and θ is the threshold corresponding to the activation neuron. is the activation function;
[0013] S02, training the above deep neural network: comprising the following steps:
[0014] A01. Determine the loss function:
[0015] in, For network output, It is simulation data or measured data;
[0016] A02, Forward propagation: Input the training image, and after passing through several hidden layers, use the loss function to calculate the error value between the output result and the actual data value;
[0017] A03, Error Back Propagation:
[0018] in, represents the weight value between the jth neuron in the lth layer and the kth neuron in the l-1th layer, is the bias corresponding to the jth neuron in the lth layer, is the output of the jth neuron in the layer, σ(·) is the activation function;
[0019] in, is the input value of the jth neuron in the lth layer;
[0020] by Represents the gradient value of the overall loss value to the input value of the jth neuron in the last layer l of the network, because for The value obtained after activation, according to the chain rule:
[0021]
[0022] Considering all neurons in layer l simultaneously using matrix or vector form, we have:
[0023]
[0024] The symbol ⊙ represents the Hadamard product. Different from the last layer l, the input value of a single neuron in the hidden layer l comes from multiple neurons in the previous layer (l-1), so:
[0025]
[0026] Represented in matrix or vector form:
[0027]
[0028] Among them, δ L is the output of this layer, (ω l+1 ) T is the weight, δ l-1 is the lower layer output, and z is the prediction result;
[0029] Calculate the gradient of w, b, where:
[0030]
[0031] Use the gradient descent algorithm to update the gradient values of parameters w and b, that is:
[0032] Wherein, η is the learning rate; the network parameters are trained to realize the data-driven internal disturbance analysis and modeling method of the motor;
[0033] S03, code implementation: The data set includes simulation data and measured data. The simulation data is obtained through the original motor internal disturbance analysis and modeling algorithm simulation, and the measured data is obtained based on the measured motor;
[0034] S04. Experiment: Make experimental data graphs based on network output and measured data to determine modeling accuracy.
[0035] Furthermore, before the loss value of the deep neural network converges, the deep neural network will continue to repeat A02: forward propagation and A03: error back propagation until the model is trained.
[0036] Furthermore, in step S03, the deep neural network part can also be implemented by pytorch code, and then by:
[0037] import matlab;
[0038] import matlab.engine;
[0039] import time;
[0040] import numpy as np;
[0041] import matplotlib.pyplot as plt;
[0042] eng=matlab.engine.start_matlab();
[0043] Call Matlab's Simulink model;
[0044] Furthermore, in step S04, in order to better quantify the experimental results, the mean square error MSE, the mean absolute percentage error SMAPE and the coefficient of determination R2 are used to calculate:
[0045]
[0046] The present invention provides a data-driven method for analyzing and modeling the internal disturbance of a motor:
[0047] 1. Use a data-driven approach to fit the extremely complex mechanisms inside the motor through a deep neural network;
[0048] 2. Use the simulation data of the original algorithm as pre-training data, use part of the measured data as training data, and part as test data to fit the gap between the simulation data and the measured data;
[0049] 3. A deep neural network structure with an 8-layer 1D convolution-1D deconvolution structure, a 4-layer bidirectional long and short word memory model BiLSTM, and a 1-layer attention mechanism structure is used to nonlinearly fit the internal model of the motor. It has strong nonlinear fitting capabilities and can accurately model. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] The following drawings are only intended to illustrate and explain the present invention, and are not intended to limit the scope of the present invention.
[0052] Figure 1 It is a schematic diagram of the deep neural network structure provided by the present invention.
[0053] Figure 2 It is a schematic diagram of the convolution process of the convolutional neural network of the convolutional encoder provided by the present invention.
[0054] Figure 3 It is a model schematic diagram of the channel attention mechanism layer provided by the present invention.
[0055] Figure 4 It is an experimental data graph of the network output provided by the present invention.
[0056] Figure 5 It is an experimental data diagram of the measured data provided by the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0058] See also Figure 1-Figure 5 , is a data-driven method for analyzing and modeling the internal disturbance of a motor disclosed in the invention, comprising the following steps:
[0059] S01. Design deep neural network structure:
[0060] The deep neural network structure includes 4 layers of 1D convolution encoders, whose convolution kernels are 1X1, 1 layer of channel attention mechanism layer, 4 layers of 1D deconvolution network decoders, whose convolution kernels are also 1X1, and 4 layers of bidirectional long and short word memory models BiLSTM as jump link connectors to connect the encoder and decoder, such as Figure 1 Specifically, the deep neural network structure is designed according to the universal approximation theorem, which has strong nonlinear fitting ability and can solve the gradient explosion and gradient disappearance problems in the subsequent neural network training process; at the same time, the introduction of the jump link connector also helps the encoder process the semantic features in the decoder, and also helps the decoder process the encoder's information.
[0061] The convolution process of the convolutional neural network of the convolutional encoder includes: G represents the feature to be processed, that is, the input of the convolutional network, F is the specific convolution kernel, C is the convolution output result, and the zero padding operation is not considered. The neural network inputs an image of size n×n, and after filtering with a convolution kernel of f×f, (n-f+1) is obtained. 2 The output of G and C, each cell corresponds to a neuron node, and the value of a neuron node in the next layer comes from the weighted sum of multiple nodes in the previous layer, such as Figure 2 As shown. It should be noted that the weights between network neurons are shared, and neurons in C are only directly associated with some neurons of the input value, that is, CNN can extract local features of the image. As the number of connections is greatly reduced, the total number of weight parameters decreases, and the spatial complexity of the network is reduced accordingly.
[0062] The deconvolution neural network convolution process of the deconvolution network decoder is the inverse operation of the convolution encoder.
[0063] The channel attention mechanism layer is specifically an efficient strategy for how neural networks calculate abstract features, allocating neural network computing resources to more important feature expressions. It is a redistribution of the spatial channels of a neural network. It usually requires obtaining global information and then obtaining distribution weights. It does not require additional supervisory information, but only learns weights by self-learning, and can be easily added to the network. Specifically, it uses pooling to obtain global information of space or channels, and uses a fully connected network to learn the redistribution weights, where the calculation of the fully connected network is: ω i 、x i The weights corresponding to the input and the connection line correspond one to one, and θ is the threshold corresponding to the activation neuron. is the activation function.
[0064] S02. Training a deep neural network: including the following steps:
[0065] A01. Determine the loss function:
[0066] in, For network output, It is simulation data or measured data;
[0067] The training process of a deep neural network is actually the process of learning all the parameters in the network based on minimizing the loss function. It is data-driven. After determining the loss function, the complete training mainly includes two parts: forward propagation and error back propagation.
[0068] A02, Forward propagation: The training image is input, and after passing through several hidden layers, the loss function is used to calculate the error value between the output result and the actual data value.
[0069] A03, Error Back Propagation:
[0070] in, represents the weight value between the jth neuron in the lth layer and the kth neuron in the l-1th layer, is the bias corresponding to the jth neuron in the lth layer, is the output of the jth neuron in the layer, σ(·) is the activation function;
[0071] in, is the input value of the jth neuron in the lth layer;
[0072] by Represents the gradient value of the overall loss value to the input value of the jth neuron in the last layer l of the network, because for The value obtained after activation, according to the chain rule:
[0073]
[0074] Considering all neurons in layer l simultaneously using matrix or vector form, we have:
[0075]
[0076] The symbol ⊙ represents the Hadamard product. Different from the last layer l, the input value of a single neuron in the hidden layer l comes from multiple neurons in the previous layer (l-1), so:
[0077]
[0078] Represented in matrix or vector form:
[0079]
[0080] Among them, δ L is the output of this layer, (ω l+1 ) T is the weight, δ l-1 is the lower layer output, and z is the prediction result;
[0081] Calculate the gradient of ω, b, where:
[0082]
[0083] Use the gradient descent algorithm to update the gradient values of parameters w and b, that is:
[0084] Among them, η is the learning rate, which trains the network parameters to realize the data-driven internal disturbance analysis and modeling method of the motor.
[0085] Before the loss value of the deep neural network converges, the deep neural network will continue to repeat A02: forward propagation and A03: error back propagation until the model is trained.
[0086] S03. Code implementation: The data set includes simulation data and measured data. The simulation data is obtained by simulating the original motor internal disturbance analysis and modeling algorithm, and the measured data is obtained based on the measured motor. In addition, another additional data set can be used. The deep neural network part is implemented by pytorch, and then by:
[0087] import matlab;
[0088] import matlab.engine;
[0089] import time;
[0090] import numpy as np;
[0091] import matplotlib.pyplot as plt;
[0092] eng=matlab.engine.start_matlab();
[0093] Call Matlab's Simulink model;
[0094] S04. Experiment: Make experimental data graphs based on network output and measured data to determine modeling accuracy.
[0095] Specifically, the simulation results, network results and motor measured results are analyzed using the corresponding current meter Current (A) and torque meter Torque (Nm), as shown in the following figure: Figure 4-5 shown.
[0096] In order to better quantify the experimental results, the mean square error MSE, mean absolute percentage error SMAPE and determination coefficient R2 are used to calculate according to the experimental data graph:
[0097]
[0098] The final experimental results are as follows:
[0099]
[0100] It can be seen from the experimental data table that the data-driven motor internal disturbance analysis and modeling method of the present invention has greatly improved over the original algorithm. The data-driven motor fitting modeling method of the present invention only needs to collect the simulation data and part of the actual data of the motor to train a deep learning model without considering the complex internal parameters of the motor. It can accurately and automatically model by relying on a deep neural network.
[0101] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A data-driven method for analyzing and modeling internal disturbances of electric motors. Features: The steps include: S01. Design a deep neural network structure based on data-driven motor internal disturbance analysis and modeling method: The deep neural network structure includes 4 layers of 1D convolution encoders, 1 layer of channel attention mechanism layer, 4 layers of 1D deconvolution network decoders, and 4 layers of bidirectional long and short word memory models BiLSTM as jump link connectors to connect the encoder and decoder; The convolution process of the convolutional neural network of the convolutional encoder includes: G represents the feature to be processed, that is, the input of the convolutional network, F is the specific convolution kernel, C is the convolution output result, and the zero padding operation is not considered. The neural network inputs an image of size n×n, and after filtering with a convolution kernel of size f×f, The output of G and C, each cell corresponds to a neuron node, and the value of a neuron node in the next layer comes from the weighted sum of multiple nodes in the previous layer; The deconvolution neural network convolution process of the deconvolution network decoder is the inverse operation of the convolution encoder; The channel attention mechanism layer obtains the global information of space or channel through pooling, and uses the fully connected network to learn the redistribution weights, where the calculation of the fully connected network is: , , The weights corresponding to the input and the connection lines correspond one to one, is the threshold corresponding to the activation of the neuron, is the activation function; S02, training the above deep neural network: comprising the following steps: A01. Determine the loss function: ,in, For network output, is the simulated data or measured data, N is the number of samples, and T is the time; A02, Forward propagation: Input the training image, and after passing through several hidden layers, use the loss function to calculate the error value between the output result and the actual data value; A03, Error Back Propagation: ,in, Indicates Tier The neuron and Layer The weights between neurons, For the Tier The bias corresponding to each neuron is For the Tier The output of a neuron, is the activation function; ,in, For the Tier The input value of each neuron; by Represents the overall loss value for the last layer of the network No. The gradient value generated by the neuron input value is for The value obtained after activation, according to the chain rule: ; Use matrix or vector form to convert Considering all neurons in the layer simultaneously, we have: ; The symbol Represents the Hadamard product, which is different from the last layer , hidden layer The input value of a single neuron in comes from multiple previous layers ( -1) neurons, so: ; Represented in matrix or vector form: ; in, is the output of this layer, is the weight, is the lower layer output, and z is the prediction result; calculate The gradient value of , where: ; Use the gradient descent algorithm to adjust the parameters The gradient value is updated, that is: ,in, is the learning rate; the network parameters are trained to realize the internal disturbance analysis and modeling method of the motor based on data-driven; S03, code implementation: The data set includes simulation data and measured data. The simulation data is obtained through the original motor internal disturbance analysis and modeling algorithm simulation, and the measured data is obtained based on the measured motor; S04. Experiment: Make experimental data graphs based on network output and measured data to determine modeling accuracy.
2. A data-driven method for analyzing and modeling internal disturbances of a motor according to claim 1, Features: Before the loss value of the deep neural network converges, the deep neural network will continue to repeat A02: forward propagation and A03: error back propagation until the model is trained.
3. A method for analyzing and modeling internal disturbances of a motor based on data drive according to claim 1, Features: In step S03, the deep neural network part can also implement the code through pytorch and call the Simulink model of Matlab.
4. A method for analyzing and modeling internal disturbances of a motor based on data drive according to claim 1, Features: In step S04, in order to better quantify the experimental results, the mean square error MSE, the mean absolute percentage error SMAPE and the coefficient of determination R2 are used to calculate: ; ; 。
