Torque prediction and error compensation method based on attention mechanism fusion of multi-modal features
By acquiring multimodal data through multiple sensors, utilizing attention mechanisms and improved time-series prediction models, and combining real-time error compensation, the problems of low accuracy and poor robustness in existing motor torque prediction are solved, achieving high-precision, real-time torque monitoring and fault early warning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TANGSHAN NANBAO ECONOMIC DEV ZONE AEROSPACE WANYUAN NEW ENERGY CO LTD
- Filing Date
- 2026-03-12
- Publication Date
- 2026-06-09
AI Technical Summary
Existing methods for predicting electric motor torque rely on single-mode data, resulting in low prediction accuracy, poor robustness, and a lack of real-time error compensation mechanisms. These methods are insufficient to meet the high-precision, real-time torque monitoring requirements in industrial scenarios.
Multimodal data is collected using multiple sensors, and adaptive fusion of multimodal features is achieved using an attention mechanism. An improved time-series prediction model (combining LSTM and Transformer) is used to improve prediction accuracy, and a real-time error compensation model is constructed to correct errors using a BP neural network.
It achieves high-precision torque prediction under complex working conditions, has real-time error compensation function, and improves the operating stability and fault early warning capability of motor.
Smart Images

Figure CN122174116A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electric motor torque detection and prediction technology, specifically to a torque prediction and error compensation method based on attention mechanism fusion of multimodal features. It is applicable to real-time torque monitoring, accurate prediction and error correction of various industrial electric motors, new energy vehicle drive motors, ship propulsion motors and other equipment, and can be widely used in intelligent manufacturing, rail transit, new energy, shipbuilding and other fields. Background Technology
[0002] As a core power source in industrial production, transportation, and new energy fields, the operating status of electric motors directly affects the stability, safety, and energy efficiency of the entire system. Torque, as a core performance parameter during the operation of an electric motor, directly reflects the motor's load, power output capacity, and overall health. Accurately obtaining the real-time torque value of an electric motor is of great significance for precise motor control, fault warning, and energy efficiency optimization.
[0003] Currently, there are two main methods for acquiring electric motor torque: direct measurement and indirect prediction. Direct measurement primarily uses torque sensors to directly acquire torque signals. This method offers high measurement accuracy but suffers from drawbacks such as high sensor cost, complex installation, susceptibility to environmental interference, and difficult maintenance. Especially in scenarios involving large industrial motors and high-speed motors, sensor installation and maintenance are limited by space and operating conditions, hindering large-scale application. Indirect prediction, on the other hand, collects other relevant signals during motor operation (such as current, vibration, and temperature) and uses algorithmic models to predict torque values. This method eliminates the need for dedicated torque sensors, offering low cost and easy installation, making it a current research hotspot in torque detection technology.
[0004] However, existing indirect torque prediction methods still have many shortcomings: First, most rely on single-modal data (such as using only current or vibration signals) for prediction. Single-modal data cannot fully reflect the operating state of the motor. When the motor is under complex operating conditions (such as load fluctuations, speed changes, and ambient temperature changes), the prediction accuracy will decrease significantly, and the robustness is poor. Second, multi-modal data fusion methods are relatively simple, mostly using traditional feature splicing and weighted summation methods. They cannot adaptively allocate weights according to the importance of each modal data under different operating conditions, resulting in insufficient effectiveness of fused features and affecting prediction accuracy. Third, the performance of time-series prediction models needs to be improved. Traditional time-series models such as LSTM and GRU are difficult to capture the long-distance dependencies of multi-modal fused features in the time dimension, and are prone to gradient vanishing or gradient exploding problems, resulting in large prediction errors. Fourth, there is a lack of effective error compensation mechanisms. The deviation between the prediction results and the actual values cannot be corrected in real time. Especially during long-term operation, with the influence of factors such as equipment aging and environmental changes, the error will continue to accumulate, making it difficult to meet the needs of high-precision torque monitoring.
[0005] In recent years, attention mechanisms have been widely used in multimodal fusion and temporal prediction. They can improve fusion performance and prediction accuracy by adaptively assigning weights to focus on features more relevant to the task. Meanwhile, with the development of deep learning technology, combining attention mechanisms with deep learning models to build efficient multimodal fusion and temporal prediction models has become an effective way to address the low accuracy and poor robustness of torque prediction. For example, existing technologies have attempted to use attention mechanisms to fuse bimodal data for torque prediction, but these still suffer from problems such as single fusion modality, incomplete feature extraction, and inability to compensate for errors in real time, making it difficult to meet the high-precision, real-time torque monitoring requirements of industrial scenarios.
[0006] Furthermore, in practical industrial applications, the operating conditions of electric motors are complex and variable. Factors such as load fluctuations, speed changes, ambient temperature variations, and equipment wear can all lead to increased torque prediction errors. Most existing methods do not consider the impact of these dynamic factors on the error and lack dynamic error compensation mechanisms, making it impossible to achieve real-time correction of prediction errors and limiting the practical application value of torque prediction methods. For example, an existing technology proposes a method for correcting motor output torque based on neural networks, but it only utilizes limited modal data such as current, temperature, and speed, without integrating key modes such as vibration and raw torque signals, and it does not employ an attention mechanism for adaptive fusion. Therefore, the accuracy and real-time performance of error correction still have room for improvement. Existing technologies also propose using neural network model fine-tuning for cutterhead torque prediction, but this mainly targets the cutterhead torque of tunneling equipment, does not involve multi-modal data fusion and time-series prediction of electric motors, and does not construct a real-time error compensation model, making it unable to adapt to the complex and variable operating conditions of electric motors.
[0007] Therefore, in order to address the shortcomings of existing technologies, developing a torque prediction method that can integrate multimodal data, utilize attention mechanisms to achieve adaptive feature fusion, combine improved time-series prediction models to enhance prediction accuracy, and possess real-time error compensation capabilities has become an urgent technical problem to be solved. Summary of the Invention
[0008] The purpose of this invention is to overcome the technical defects of existing torque prediction methods, such as reliance on single-modal data, low prediction accuracy, poor multimodal fusion effect, and lack of real-time error compensation mechanism. This invention provides a torque prediction and error compensation method based on attention mechanism to fuse multimodal features. It collects multimodal data through multiple sensors, uses attention mechanism to achieve adaptive fusion of multimodal features, improves torque prediction accuracy by combining an improved time-series prediction model, and constructs a real-time error compensation model to achieve dynamic correction of prediction errors, thus meeting the high-precision and real-time torque monitoring and control requirements in industrial scenarios.
[0009] The first aspect of this invention is to provide a torque prediction and error compensation method based on attention mechanism and fusion of multimodal features, comprising:
[0010] S1, Collect multimodal data and form a multimodal raw dataset, including: synchronously collecting torque raw signals, vibration signals, current signals and temperature signals during the operation of the electric motor through a multi-sensor module to obtain a multimodal raw dataset;
[0011] S2, preprocessing the multimodal data: denoising, normalizing, synchronizing and aligning the multimodal raw data in the multimodal raw dataset and processing outliers to eliminate noise interference, data redundancy and time misalignment, and obtain a standardized multimodal dataset;
[0012] S3, extracting and fusing multimodal features based on the preprocessed multimodal data, including: using an attention-based multimodal fusion algorithm to extract features from each modality in the standardized multimodal dataset, obtaining feature vectors for each modality, and then using adaptive allocation of attention weights to achieve efficient fusion of multimodal features and outputting a fused feature vector;
[0013] S4, Accurately predicting torque based on the fused feature vector, including: inputting the fused feature vector into an improved time-series prediction model, and outputting the predicted torque value of the motor through time-series feature enhancement and linear prediction;
[0014] S5, Real-time error compensation based on the predicted torque value of the motor, including: calculating the deviation between the predicted torque value of the motor and the actual measured torque value of the motor, constructing an error compensation model based on a BP neural network, combining the motor speed and load rate as auxiliary parameters, performing real-time error correction on the predicted torque value of the motor, and outputting the final accurate torque value.
[0015] S6 performs model monitoring and anomaly warning, including: real-time monitoring of the operating status of the prediction model and the error compensation model, identifying anomalies based on deviation thresholds, triggering warning and model optimization mechanisms; and identifying potential motor faults through feature changes and deviation fluctuations.
[0016] Preferably, the multi-sensor module of S1 includes a torque sensor, a vibration sensor, a current sensor, and a temperature sensor.
[0017] Preferably, S2 includes:
[0018] S21, Denoising processing is performed, including: using a wavelet thresholding denoising algorithm to denoise the original signals of each mode, selecting the db4 wavelet as the wavelet basis, and adaptively adjusting the number of decomposition layers according to the signal complexity: the torque signal, current signal, and temperature signal are decomposed into 3 layers, and the vibration signal is decomposed into 5 layers; the threshold function adopts an improved soft threshold function, the specific formula of which is as follows:
[0019] when hour, ;
[0020] when hour, ;
[0021] in, The first of the original signals One sampling point, These are the sampling points of the denoised signal. The noise reduction threshold, This is a correction factor (ranging from 0.05 to 0.15, with the optimal value being 0.1). Attenuation coefficient; noise reduction threshold The calculation formula is ,in For signal length, The standard deviation of noise. Through the noise estimation formula Calculation, where It is a median function;
[0022] S22, Outlier handling, including: using The criteria for identifying outliers are as follows:
[0023] (1) Calculate the mean of each modal data with standard deviation ;
[0024] (2) will exceed Data within the specified range is considered outlier;
[0025] (3) For each identified outlier, linear interpolation is used for replacement. The interpolation formula is:
[0026]
[0027] in, Replacement value for outlier, , These are the normal data adjacent to the outlier. , , These are outliers, , The corresponding data collection timestamp; if three or more abnormal values appear consecutively, it is determined to be a sensor fault or a data collection line fault, and a fault warning signal is immediately issued to remind staff to check and maintain, so as to ensure the continuity and reliability of data collection.
[0028] S23, perform synchronization alignment, including: using the acquisition timestamp of the original torque signal as a reference, use linear interpolation to perform time synchronization alignment of vibration signal, current signal, and temperature signal to ensure that each modal data corresponds one-to-one in the same time dimension, with an alignment accuracy of not less than 1ms;
[0029] S24, Normalization processing, including: using the min-max normalization algorithm to independently map each modal data to the [0,1] interval, thereby standardizing the data. The normalization formula is:
[0030]
[0031] in, This is the original data. This is the minimum value of the modal data. The maximum value of this modal data, The data is standardized after normalization. During the normalization process, the torque, vibration, current, and temperature signals are processed independently to preserve the relative characteristic relationships of each modal data.
[0032] Preferably, S3 includes:
[0033] S31, perform feature extraction, including:
[0034] (1) Feature extraction of the original torque signal, including: combining time-domain and frequency-domain features to fully reflect the static and dynamic characteristics of the torque signal, extracting a total of 13-dimensional features to form a torque feature vector. :
[0035] ① Temporal features, which are 8-dimensional:
[0036] a. Peak value: The maximum value of the torque signal within one sampling period, reflecting the maximum torque output capability;
[0037] b. Valley value: The minimum value of the torque signal within a sampling period, reflecting the minimum torque output capability;
[0038] c. Average value: The arithmetic mean of the torque signal within one sampling period, reflecting the average output level of the torque. The calculation formula is as follows: ,in For the first Torque value at each sampling point This represents the number of sampling points within the sampling period.
[0039] d. Variance: Reflects the degree of torque fluctuation. The larger the variance, the more severe the torque fluctuation and the more unstable the motor load. The calculation formula is as follows: ;
[0040] e. Kurtosis: Reflects the peak characteristics of the torque signal. A kurtosis > 3 indicates a sharp peak, which may correspond to a sudden change in motor load or a fault. The formula is as follows: ;
[0041] f. Skewness: Reflects the symmetry of the torque signal distribution. A positive skewness indicates a right-skewed signal distribution, and a negative skewness indicates a left-skewed signal distribution. It can reflect the imbalance of the torque load. The formula is as follows: ;
[0042] g. Pulse Index: The ratio of peak value to average value, reflecting the pulse characteristics of the torque signal. The larger the pulse index, the more pulse components exist in the torque signal. The calculation formula is as follows: ;
[0043] h. Waveform Index: The ratio of the effective value to the average value, reflecting the waveform shape of the torque signal. The closer the waveform index is to 1, the closer the torque signal is to a sine wave and the more stable the operation. The formula is as follows: ;
[0044] ② Frequency domain features, which are 5-dimensional. The time-domain torque signal is converted into a frequency-domain signal using Fast Fourier Transform, and the following features are extracted:
[0045] a. Peak value: The maximum amplitude value in the frequency domain signal, reflecting the intensity of the main frequency components of the torque signal;
[0046] b. Spectral mean: The arithmetic mean of the amplitude of the frequency domain signal, reflecting the overall strength of the frequency domain signal. The formula is as follows: ,in For the first Amplitude at each frequency point, This refers to the number of frequency points.
[0047] c. Spectral variance: Reflects the degree of fluctuation in frequency domain amplitude and the stability of frequency components. The formula is as follows: ;
[0048] d. Main frequency: The frequency corresponding to the peak value of the spectrum, which reflects the main frequency components of the torque signal and is closely related to the speed and load of the motor;
[0049] e. Frequency Band Energy: The frequency domain is divided into four bands: 0~10Hz, 10~50Hz, 50~100Hz, and 100~200Hz. The energy of each band is calculated to reflect the energy distribution of the torque signal in different frequency ranges. The formula for the energy of a single frequency band is: ;
[0050] (2) Feature extraction of vibration signal, including: feature extraction using wavelet packet decomposition, extracting a total of 128-dimensional features to form a vibration feature vector. :
[0051] Using the db4 wavelet as the wavelet envelope basis, with a decomposition level of 5, the vibration signal is decomposed into... For each wavelet packet node, energy, energy entropy, kurtosis, and skewness are calculated, and four feature parameters are extracted: energy, energy entropy, kurtosis, and skewness. The specific extraction of these four feature parameters for each node's signal is as follows:
[0052] ① Energy: The energy of each wavelet packet node signal reflects the strength of the signal in that frequency band. During a fault, the energy of the corresponding frequency band will change significantly. The formula is: ,in This is the sampled value of the signal at that node;
[0053] ② Energy entropy: Reflects the uniformity of energy distribution among wavelet packet nodes. A smaller energy entropy indicates that energy is concentrated in a few frequency bands, potentially indicating a motor malfunction. A larger energy entropy indicates a more uniform energy distribution and more stable motor operation. The calculation formula is as follows: ,in For the first The proportion of energy of each wavelet packet node to the total energy. ,in, For the first The energy of each wavelet packet node;
[0054] ③ Kurtosis: Reflects the peak characteristics of the signal at each wavelet packet node, and can identify the impulse components in the signal. The calculation formula is as follows: ,in, The average value of the node signal. The standard deviation of the node signal;
[0055] ④ Skewness: Reflects the symmetry of signal distribution at each wavelet packet node, and can reflect the degree of signal distortion. When a fault occurs, the signal skewness will change significantly. The calculation formula is as follows: ;
[0056] The four characteristic parameters of the 32 nodes are combined to form a 128-dimensional vibration feature vector. ;
[0057] (3) Feature extraction of current signal, including: using Fourier transform (FFT) to convert the time-domain current signal into a frequency-domain signal, extracting 5 frequency-domain features to form a current feature vector. It has 5 dimensions;
[0058] ① Fundamental amplitude: The amplitude of the fundamental current signal. The fundamental frequency is the rated frequency of the motor, 50Hz. The fundamental amplitude is closely related to the load of the motor. The greater the load, the greater the fundamental amplitude.
[0059] ② Fundamental frequency: The fundamental frequency of the current signal is 50Hz under normal operating conditions. When the motor speed changes or there is a fault, the fundamental frequency will shift.
[0060] ③Total harmonic distortion The calculation formula is: ,in This is the fundamental effective value. For the first RMS value of subharmonics;
[0061] ④ Harmonic amplitude: Extract the amplitude of the 2nd, 3rd, and 5th harmonics to reflect the characteristics of electrical faults;
[0062] ⑤ Total Harmonic Content: The total effective value of all harmonic components, expressed by the formula: = ;
[0063] (4) Feature extraction of temperature signal: The time-domain feature extraction method is used to extract 5-dimensional features to form a temperature feature vector. :
[0064] ① Average temperature: The arithmetic mean of temperatures over a sampling period, reflecting the average thermal state of the equipment. The formula is as follows: , For the first Temperature values at each sampling point;
[0065] ② Maximum temperature: The highest temperature during the sampling period, reflecting the peak heat load of the equipment;
[0066] ③ Minimum temperature: The lowest temperature within the sampling period, reflecting the range of temperature fluctuations;
[0067] ④ Temperature change rate: The ratio of the temperature difference between adjacent sampling points to the time difference, reflecting the rate of temperature change. The formula is: ,in, The sampling interval;
[0068] ⑤ Temperature fluctuation variance: reflects the degree of temperature fluctuation, and the formula is as follows: ;
[0069] S32, perform attention fusion: , , , The input attention fusion module achieves adaptive fusion of multimodal features through three steps: feature dimension unification, attention weight calculation, and feature weighted fusion, and outputs a fused feature vector. ,include:
[0070] S321, Unifying Feature Dimension, includes: using fully connected layers to map feature vectors from different modalities to the same dimension. To obtain feature vectors of uniform dimension , , , , respectively corresponding , , , The result after unifying the dimensions;
[0071] S322, Calculate attention weights, including: constructing a self-attention mechanism module, adaptively calculating attention weights based on the importance of each modal feature to torque prediction;
[0072] S323, perform feature fusion, including: based on the attention weight vector We perform weighted fusion of the feature vectors of each modality with a unified dimension to obtain a fused feature vector. The calculation formula is:
[0073] .
[0074] Preferably, step S4 employs an improved temporal prediction model, combining LSTM with Transformer to achieve accurate torque prediction through temporal feature enhancement. The model structure includes an input layer, a temporal feature enhancement layer, and a prediction output layer. The specific implementation process is as follows:
[0075] S41, Constructing the input layer includes: merging the fused feature vector... Construct a time-series input sequence by arranging the sequences in chronological order. ,in For time step;
[0076] S42, construct the temporal feature enhancement layer, which includes LSTM sub-layers and Transformer sub-layers, to implement temporal feature extraction and enhancement in steps:
[0077] S43, Construct the prediction output layer: This involves processing the enhanced temporal feature sequence... The input is a fully connected layer, which undergoes linear transformation and activation function processing to output the predicted torque value. ;
[0078] S44, perform model training, including:
[0079] S441. Dataset partitioning: The preprocessed standardized multimodal dataset is divided into training set, validation set and test set in a ratio of 7:2:1. The training set is used for model parameter updates, the validation set is used for hyperparameter tuning, and the test set is used for final accuracy verification.
[0080] S442. Model initialization: The Xavier normal initialization method is used to initialize the weight parameters of the LSTM sub-layer, Transformer sub-layer and fully connected layer to avoid the model not converging due to excessively large or small initial parameters; the initial learning rate is 0.001~0.01, the number of iterations is 100~500, and the batch size is 32~128.
[0081] S443. Model Training: Using the fused feature vector of the training set as input, and the corresponding actual torque measurement value as the label, mean squared error is used. As the loss function, the formula is:
[0082] ;
[0083] in, The number of training samples. This is the actual measured torque value. Predict torque values for the model;
[0084] The Adam optimization algorithm is used to iteratively update the model parameters. Every 10 iterations, the model performance is verified using the validation set, and the validation set loss is calculated. If the validation set loss does not decrease for 5 consecutive iterations, the training is stopped using an early stopping strategy to save the optimal model parameters and avoid overfitting.
[0085] S444, Model Testing, includes: inputting the fused feature vector of the test set into the optimal model, outputting the predicted torque value, calculating three accuracy evaluation metrics, and verifying the model performance.
[0086] ① Mean Absolute Error The formula is:
[0087]
[0088] Require ;
[0089] ② Root mean square error The formula is:
[0090] ;
[0091] Require ;
[0092] ③ Coefficient of determination The formula is:
[0093] ,in, The average value of the actual torque measurements is required. ;
[0094] When all three metrics meet the requirements, the model training is complete and it can be put into practical application; if they do not meet the requirements, adjust the model hyperparameters and retrain until the requirements are met.
[0095] Preferably, S5 includes:
[0096] S51, Constructing error samples includes: collecting the predicted torque values Compared with the actual torque measurement value deviation value Simultaneously, the fused feature vectors at the corresponding time points are collected. Motor speed The unit is r / min, load rate The unit is %. Construct an error sample set; the input of the error samples is... , dimension , To fuse feature vector dimensions, the output is a bias value. The sample size shall be no less than 1,000 groups;
[0097] S52, training error compensation model, including: dividing the error sample set into training and test sets in a 7:3 ratio, and setting the BP neural network parameters as follows: number of input layer nodes is... The system has 1-3 hidden layers, with 32-64 hidden units per layer. The output layer has 1 node and outputs the predicted error value. The activation function is the sigmoid function, and the loss function is the mean squared error. The formula is:
[0098] ;
[0099] in, The number of error samples. This is the actual deviation value. For the error prediction value'
[0100] S53, Real-time error compensation: The fused feature vector at the current moment... Motor speed Load rate Input error compensation model, output error prediction value The predicted torque value is corrected using the following formula to obtain the final accurate torque value. :
[0101] ;
[0102] S54, Model Adaptive Update, includes: collecting the latest bias values every 10-30 acquisition cycles. fusion feature vectors Rotation speed Load rate This forms new error samples; the error compensation model is incrementally trained to update the model parameters. The number of incremental training iterations is 10 to 30, and the learning rate is 0.0001 to 0.001.
[0103] Preferably, S6 includes:
[0104] S61, Model Operation Monitoring: Real-time monitoring of the operation status of the improved time-series prediction model and error compensation model, and calculation of predicted torque values. With the final precise torque value deviation Set the deviation threshold;
[0105] S62, Anomaly Warning: When When the value exceeds a preset threshold, an abnormal warning signal is issued, and abnormal data is recorded. The abnormal data includes multimodal raw data, fusion features, predicted values, and deviation values, which are used for subsequent model optimization. If the model experiences 5 consecutive abnormalities, the model retraining process is automatically triggered. The prediction model and error compensation model are retrained using the latest collected data to ensure model stability and prediction accuracy.
[0106] S63, Fault Diagnosis Extension, includes: identifying potential faults by analyzing the changing trends of multimodal eigenvectors and abnormal fluctuations in torque prediction deviations. These potential faults include bearing wear, rotor imbalance, winding short circuits, and abnormal loads.
[0107] The rate of change of the fused feature vector is calculated as follows:
[0108] ;
[0109] in, To fuse the feature vector at the current time step, The fused feature vector from the previous time step; when If the torque prediction deviation is greater than 1.0 N·m for 10 consecutive acquisition cycles, it is determined to be the corresponding fault type, and fault warning information is output to clarify the fault type, occurrence time and characteristic abnormal point, so as to provide a basis for equipment maintenance.
[0110] A second aspect of the present invention provides a torque prediction and error compensation system based on attention mechanism and multimodal feature fusion, for implementing the method of the first aspect, comprising:
[0111] The data acquisition and dataset module (101) is used to acquire multimodal data and form a multimodal raw dataset, including: synchronously acquiring torque raw signals, vibration signals, current signals and temperature signals during the operation of the electric motor through the multi-sensor module to obtain a multimodal raw dataset;
[0112] The multimodal data preprocessing module (102) is used to preprocess the multimodal data: to denoise, normalize, synchronize and align the multimodal raw data in the multimodal raw dataset, and handle outliers to eliminate noise interference, data redundancy and time misalignment, and obtain a standardized multimodal dataset.
[0113] The multimodal feature extraction module (103) is used to extract and fuse multimodal features based on the preprocessed multimodal data, including: using an attention-based multimodal fusion algorithm to extract features from each modality in the standardized multimodal dataset, obtaining feature vectors for each modality, and then using adaptive allocation of attention weights to achieve efficient fusion of multimodal features and output fused feature vectors;
[0114] The torque prediction module (104) is used to accurately predict torque based on the fused feature vector, including: inputting the fused feature vector into an improved time-series prediction model (LSTM combined with Transformer), and outputting the predicted torque value of the motor through time-series feature enhancement and linear prediction;
[0115] The real-time error compensation module (105) is used to perform real-time error compensation based on the predicted torque value of the motor, including: calculating the deviation between the predicted torque value of the motor and the actual measured torque value of the motor, constructing an error compensation model based on the BP neural network, combining the motor speed and load rate as auxiliary parameters, performing real-time error correction on the predicted torque value of the motor, and outputting the final accurate torque value.
[0116] The model monitoring and anomaly warning module (106) is used for model monitoring and anomaly warning, including: real-time monitoring of the operating status of the prediction model and the error compensation model, identifying anomalies based on the deviation threshold, triggering warning and model optimization mechanisms; and identifying potential motor faults through feature changes and deviation fluctuations.
[0117] A third aspect of the present invention provides an electronic device including a processor and a memory, the memory storing a plurality of instructions, the processor being configured to read the instructions and execute the method as described in the first aspect.
[0118] A fourth aspect of the present invention provides a computer-readable storage medium storing a plurality of instructions which can be read by a processor and executed as described in the first aspect.
[0119] The beneficial effects of the method and system of the present invention are as follows:
[0120] 1. Multimodal data fusion: It integrates four core modal data of torque, vibration, current and temperature to comprehensively reflect the operating status of the motor and solve the problems of low prediction accuracy and poor robustness of single modal data;
[0121] 2. Adaptive fusion of attention mechanisms: By allocating attention weights, key features are highlighted and irrelevant features are suppressed, thereby improving the effectiveness of fused features and adapting to torque prediction requirements under complex working conditions.
[0122] 3. Improved time series prediction model: The combination of LSTM and Transformer can capture both short-term time series dependencies and long-distance correlations, solving the problems of gradient vanishing and large prediction errors in traditional models;
[0123] 4. Real-time error compensation: An error compensation model is built based on a BP neural network, combined with auxiliary parameters such as rotational speed and load rate, to achieve dynamic correction of prediction deviation. It also has an adaptive update mechanism to ensure long-term prediction accuracy.
[0124] 5. High scalability: It can be extended to motor fault diagnosis, realizing the integration of "prediction-compensation-early warning-diagnosis" and enhancing the value of industrial applications. Attached Figure Description
[0125] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of the present invention, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0126] Figure 1 This is a flowchart of a torque prediction and error compensation method based on attention mechanism fusion of multimodal features provided in an embodiment of the present invention;
[0127] Figure 2 This is a diagram of the torque prediction and error compensation system based on attention mechanism fusion of multimodal features provided in an embodiment of the present invention.
[0128] Figure 3 This is a structural diagram of an electronic device provided according to an embodiment of the present invention. Detailed Implementation
[0129] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0130] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0131] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0132] like Figure 1As shown, the first aspect of the present invention is to provide a torque prediction and error compensation method based on attention mechanism and fusion of multimodal features, comprising:
[0133] S1, Collect multimodal data and form a multimodal raw dataset, including: synchronously collecting torque raw signals, vibration signals, current signals and temperature signals during the operation of the electric motor through a multi-sensor module to obtain a multimodal raw dataset;
[0134] S2, preprocessing the multimodal data: denoising, normalizing, synchronizing and aligning the multimodal raw data in the multimodal raw dataset and processing outliers to eliminate noise interference, data redundancy and time misalignment, and obtain a standardized multimodal dataset;
[0135] S3, extracting and fusing multimodal features based on the preprocessed multimodal data, including: using an attention-based multimodal fusion algorithm to extract features from each modality in the standardized multimodal dataset, obtaining feature vectors for each modality, and then using adaptive allocation of attention weights to achieve efficient fusion of multimodal features and outputting a fused feature vector;
[0136] S4, Accurately predicting torque based on the fused feature vector, including: inputting the fused feature vector into an improved time-series prediction model (combination of LSTM and Transformer), and outputting the predicted torque value of the motor through time-series feature enhancement and linear prediction;
[0137] S5, Real-time error compensation based on the predicted torque value of the motor, including: calculating the deviation between the predicted torque value of the motor and the actual measured torque value of the motor, constructing an error compensation model based on a BP neural network, combining the motor speed and load rate as auxiliary parameters, performing real-time error correction on the predicted torque value of the motor, and outputting the final accurate torque value.
[0138] S6 performs model monitoring and anomaly warning, including: real-time monitoring of the operating status of the prediction model and the error compensation model, identifying anomalies based on deviation thresholds, triggering warning and model optimization mechanisms; and identifying potential motor faults through feature changes and deviation fluctuations.
[0139] In a preferred embodiment, the multi-sensor module in S1 includes a torque sensor, a vibration sensor, a current sensor, and a temperature sensor. Each sensor undergoes rigorous selection and debugging to ensure the accuracy, synchronization, and stability of data acquisition, adapting to complex industrial conditions. Specific parameter settings are as follows:
[0140] 1. Torque Sensor: A strain gauge torque sensor is used, with a measurement range of 0~500 N·m, an accuracy class of 0.1, a sampling frequency of 100~500 Hz, and an output signal of 4~20mA analog signal. The linearity error is ≤±0.05%FS, the hysteresis error is ≤±0.05%FS, and the long-term stability is ≤±0.1%FS / year. It is installed using a flange connection, is compatible with motor output shaft diameters ranging from 20~50 mm, and has an IP67 protection rating. It can adapt to harsh industrial environments such as dust, humidity, and vibration, ensuring long-term stable acquisition of raw torque signals.
[0141] 2. Vibration Sensor: A piezoelectric accelerometer is used, with a measurement range of 0~50g, a frequency response of 10~1000Hz, a sampling frequency of 200~1000Hz, a sensitivity of 100mV / g, a nonlinear error ≤±1%FS, a lateral sensitivity ≤5%, and an output signal of ±5V voltage. The installation method is magnetic or threaded connection. The installation position is selected from vibration-sensitive parts such as the motor bearing end cover and the base. It accurately collects mechanical vibration signals during the operation of the motor, reflecting mechanical conditions such as bearing wear and rotor imbalance.
[0142] 3. Current sensor: A Hall current sensor is used, with a measurement range of 0~50A, an accuracy class of 0.2, a sampling frequency of 100~500Hz, an input method of through-core, an output signal of 0~5V voltage signal, a response time ≤1μs, an insulation voltage ≥2kV, and an operating temperature range of -40~85℃; it can accurately collect the three-phase stator current signal of the motor and reflect the electrical operating status of the motor, such as load changes and winding short circuits.
[0143] 4. Temperature sensor: A PT100 resistance temperature detector (RTD) sensor is used, with a measurement range of -50~150℃ and an accuracy class of A (accuracy formula is...). ,in (For temperature measurement), the sampling frequency is 50~200Hz, and the output signal is a resistance signal, which is converted into a 4~20mA analog signal through the signal conditioning module; the installation location is selected from key parts such as the stator winding, bearing, and frame of the motor, and the temperature change during the operation of the motor is collected to reflect the thermal state and aging degree of the equipment.
[0144] Each sensor is connected to the main control module (industrial-grade microcontroller or PLC) via an industrial-grade data acquisition card. The data acquisition card uses a 16-bit AD converter with a sampling rate of ≥1000Hz and ≥8 input channels. It supports synchronous acquisition of analog and digital signals with a synchronization error of no more than 1ms, ensuring the consistency of multimodal data in the time dimension. It also supports real-time data transmission and storage, and can store the acquired multimodal raw data to an SD card or cloud server for subsequent data traceability, model training and optimization.
[0145] In a preferred embodiment, step S2 is a core prerequisite for improving the accuracy of subsequent feature extraction and the performance of model prediction. It is used to eliminate noise interference, outliers, data redundancy, and time series misalignment in the original data, and to standardize the data of each modality. Specifically, it includes the following four sub-steps:
[0146] S21, Denoising processing is performed, including: During the operation of the motor, the acquired multimodal raw signals are subject to various interferences such as electromagnetic interference in the industrial environment, environmental noise, and sensor noise, resulting in signal distortion and affecting the accuracy of feature extraction and prediction. This invention uses a wavelet threshold denoising algorithm to denoise the raw signals of each mode. The wavelet basis is selected as the db4 wavelet (which has good time-frequency localization characteristics and can effectively separate signals and noise). The number of decomposition layers is adaptively adjusted according to the signal complexity: the torque signal, current signal, and temperature signal are decomposed into 3 layers, and the vibration signal (the most complex) is decomposed into 5 layers.
[0147] The threshold function uses an improved soft threshold function to solve the signal distortion and edge blurring problems of traditional soft threshold functions. It reduces denoising error through signal correction. The specific formula is as follows:
[0148] when hour, ;
[0149] when hour, ;
[0150] in, The first of the original signals One sampling point, These are the sampling points of the denoised signal. The noise reduction threshold, This is a correction factor (ranging from 0.05 to 0.15, with the optimal value being 0.1). Attenuation coefficient (range 0.1~0.3, optimal value 0.2); denoising threshold. The calculation formula is ,in For signal length, The standard deviation of noise. Through the noise estimation formula Calculation, where As a median function, this formula can quickly and accurately estimate the noise standard deviation in complex industrial noise environments, ensuring noise reduction effectiveness.
[0151] This denoising process can effectively remove high-frequency noise and random interference from various modal signals while preserving the effective characteristics of the signals. For example, after denoising the vibration signal, the impact characteristics caused by faults such as bearing wear and rotor imbalance can be clearly preserved. After denoising the current signal, the characteristics of load changes and electrical faults can be accurately reflected.
[0152] S22. Outlier Handling: Due to factors such as sensor malfunction, poor contact in the acquisition circuit, and sudden interference in the industrial field, outliers may exist in the acquired multimodal data. Outliers can seriously affect the model training and prediction accuracy; therefore, outlier identification and handling are necessary. This invention employs... The criteria for identifying outliers (applicable to multimodal data that approximately follows a normal distribution under normal operating conditions) are as follows:
[0153] (1) Calculate the mean of each modal data with standard deviation ;
[0154] (2) will exceed Data within the specified range is considered outlier;
[0155] (3) For each identified outlier, linear interpolation is used for replacement to avoid data loss and error introduction. Linear interpolation can accurately fit a reasonable value at the outlier position based on the normal data before and after the outlier, avoiding data loss caused by deleting outliers, and will not introduce new errors. The interpolation formula is:
[0156]
[0157] in, Replacement value for outlier, , These are the normal data adjacent to the outlier. , , These are outliers, , The corresponding collection timestamp.
[0158] If three or more abnormal values occur consecutively, it is determined to be a sensor fault or a data acquisition line fault, and a fault warning signal is immediately issued to remind staff to check and maintain the data to ensure the continuity and reliability of data acquisition.
[0159] S23, perform synchronization alignment, including: Due to differences in sampling frequency and response time among various sensors, the acquired multimodal data may be misaligned in the time dimension. Without synchronization alignment, the modal data will be mismatched during subsequent feature fusion, affecting the fusion effect and prediction accuracy. This invention uses the acquisition timestamp of the original torque signal as a benchmark and employs linear interpolation to perform time synchronization alignment of the vibration signal, current signal, and temperature signal, ensuring that each modal data corresponds one-to-one in the same time dimension, with an alignment accuracy of no less than 1ms.
[0160] Specific implementation process: Extract all acquisition timestamps of the raw torque signal. , For vibration, current, and temperature signals, the signal value corresponding to each torque signal's timestamp is calculated through linear interpolation based on its own acquisition timestamp, achieving synchronization alignment. An example is as follows: If the torque signal is in... The sampled value at that time Vibration signal in The sampled value at that time , The sampled value at that time ,but The vibration signal interpolation value at that time is:
[0161] ;
[0162] This achieves synchronous alignment of vibration and torque signals, and the synchronization alignment method for current and temperature signals is consistent with that for vibration signals. Through synchronous alignment processing, the temporal consistency of each modal data is ensured. The synchronization alignment method for current and temperature signals is consistent with that for vibration signals, enabling the subsequently extracted modal features to accurately reflect the operating state of the motor at the same moment, thus improving the effectiveness of multimodal fusion.
[0163] S24, Normalization processing, including: The dimensions and value ranges of the modal data differ significantly (e.g., torque signals range from 0 to 500 N·m, temperature signals from -50 to 150℃, and current signals from 0 to 50 A). Direct use of these data for feature fusion and model training would cause the model to become overly sensitive to data with large value ranges, affecting model convergence speed and prediction accuracy. This invention employs a min-max normalization algorithm to independently map each modal data to the [0,1] interval, achieving data standardization. The normalization formula is:
[0164]
[0165] in, This is the original data. This is the minimum value of the modal data. The maximum value of this modal data, This refers to the normalized, standardized data.
[0166] During normalization, torque, vibration, current, and temperature signals are processed independently, preserving the relative characteristics of each modal data. Example: The minimum value of the torque signal is... The maximum value is A certain sampling point After normalization The minimum value of the temperature signal is The maximum value is A certain sampling point After normalization Normalization results in a standardized multimodal dataset, eliminating the influence of dimensional differences and improving the efficiency of subsequent feature extraction and model training.
[0167] In a preferred embodiment, the attention-based multimodal fusion algorithm in S3 obtains effective features for each modality through targeted feature extraction, and then adaptively allocates attention weights to highlight features crucial for torque prediction and suppress irrelevant features, thereby achieving efficient fusion of multimodal features. Specifically, it includes a feature extraction module and an attention fusion module, and the implementation process is as follows:
[0168] S31, feature extraction is performed, including: different modal data reflect different dimensions of the motor's operating state (torque reflects power output, vibration reflects mechanical state, current reflects electrical state, and temperature reflects thermal state). Therefore, corresponding feature extraction methods need to be adopted for different modal data to ensure that the extracted features can comprehensively and accurately reflect the motor's operating state and provide effective feature support for torque prediction.
[0169] (1) Feature extraction of raw torque signal: The raw torque signal directly reflects the torque output of the motor. Its features include time-domain features and frequency-domain features. Time-domain features can reflect the static characteristics of the torque signal, while frequency-domain features can reflect the dynamic characteristics of the torque signal. Combining time-domain and frequency-domain features can comprehensively extract the effective information of the torque signal. Combining time-domain and frequency-domain features, the static and dynamic characteristics of the torque signal are comprehensively reflected. A total of 13-dimensional features are extracted to form the torque feature vector. :
[0170] ①Time-domain features (8 dimensions):
[0171] a. Peak value: The maximum value of the torque signal within one sampling period, reflecting the maximum torque output capability;
[0172] b. Valley value: The minimum value of the torque signal within a sampling period, reflecting the minimum torque output capability;
[0173] c. Average value: The arithmetic mean of the torque signal within one sampling period, reflecting the average output level of the torque. The calculation formula is as follows: ,in For the first Torque value at each sampling point This represents the number of sampling points within the sampling period.
[0174] d. Variance: Reflects the degree of torque fluctuation. The larger the variance, the more severe the torque fluctuation and the more unstable the motor load. The calculation formula is as follows: ;
[0175] e. Kurtosis: Reflects the peak characteristics of the torque signal. A kurtosis > 3 indicates a sharp peak, which may correspond to a sudden change in motor load or a fault. The formula is as follows: ;
[0176] f. Skewness: Reflects the symmetry of the torque signal distribution. A positive skewness indicates a right-skewed signal distribution, and a negative skewness indicates a left-skewed signal distribution. It can reflect the imbalance of the torque load. The formula is as follows: ;
[0177] g. Pulse Index: The ratio of peak value to average value, reflecting the pulse characteristics of the torque signal. The larger the pulse index, the more pulse components exist in the torque signal. The calculation formula is as follows: ;
[0178] h. Waveform Index: The ratio of the effective value to the average value, reflecting the waveform shape of the torque signal. The closer the waveform index is to 1, the closer the torque signal is to a sine wave and the more stable the operation. The formula is as follows: .
[0179] ② Frequency Domain Features (5-dimensional): The time-domain torque signal is converted into a frequency-domain signal using Fast Fourier Transform (FFT), and the following features are extracted:
[0180] a. Peak value: The maximum amplitude value in the frequency domain signal, reflecting the intensity of the main frequency components of the torque signal;
[0181] b. Spectral mean: The arithmetic mean of the amplitude of the frequency domain signal, reflecting the overall strength of the frequency domain signal. The formula is as follows: ,in For the first Amplitude at each frequency point, This refers to the number of frequency points.
[0182] c. Spectral variance: Reflects the degree of fluctuation in frequency domain amplitude and the stability of frequency components. The formula is as follows: ;
[0183] d. Main frequency: The frequency corresponding to the peak value of the spectrum, which reflects the main frequency components of the torque signal and is closely related to the speed and load of the motor;
[0184] e. Frequency Band Energy: The frequency domain is divided into four bands: 0~10Hz, 10~50Hz, 50~100Hz, and 100~200Hz. The energy of each band is calculated to reflect the energy distribution of the torque signal in different frequency ranges. The formula for the energy of a single frequency band is: ;
[0185] (2) Feature extraction of vibration signals: Vibration signals mainly reflect the mechanical state of the motor. Faults such as bearing wear, rotor imbalance, and loose frame can all cause changes in the characteristics of the vibration signal. Wavelet packet decomposition is used for feature extraction. Wavelet packet decomposition can decompose the vibration signal into different frequency bands and extract the features of each frequency band. Compared with traditional wavelet decomposition, it can extract the frequency domain features of the signal more comprehensively. Using wavelet packet decomposition to extract features can fully capture the frequency domain details of the vibration signal, which is suitable for mechanical fault feature recognition. A total of 128-dimensional features are extracted to form a vibration feature vector. :
[0186] Using the db4 wavelet as the wavelet envelope basis, with a decomposition level of 5, the vibration signal is decomposed into... For each wavelet packet node (frequency band), energy, energy entropy, kurtosis, and skewness are calculated, and four feature parameters (energy, energy entropy, kurtosis, and skewness) are extracted. Therefore, the vibration feature vector has a dimension of 32*4=128. The four feature parameters extracted for each node signal are as follows:
[0187] ① Energy: The energy of each wavelet packet node signal reflects the strength of the signal in that frequency band. During a fault, the energy of the corresponding frequency band will change significantly. The formula is: ,in (This refers to the sampled value of the signal at that node).
[0188] ② Energy entropy: Reflects the uniformity of energy distribution among wavelet packet nodes. A smaller energy entropy indicates that energy is concentrated in a few frequency bands, potentially indicating a motor malfunction. A larger energy entropy indicates a more uniform energy distribution and more stable motor operation. The calculation formula is as follows: ,in For the first The proportion of energy of each wavelet packet node to the total energy. ,in, For the first The energy of each wavelet packet node;
[0189] ③ Kurtosis: Reflects the peak characteristics of the signal at each wavelet packet node, and can identify the impact components in the signal (such as impact vibrations caused by bearing wear). The calculation formula is as follows: ,in, The average value of the node signal. The standard deviation of the node signal;
[0190] ④ Skewness: Reflects the symmetry of signal distribution at each wavelet packet node, and can reflect the degree of signal distortion. When a fault occurs, the signal skewness will change significantly. The calculation formula is as follows: .
[0191] The four characteristic parameters of the 32 nodes are combined to form a 128-dimensional vibration feature vector. .
[0192] (3) Feature extraction of current signal: The current signal mainly reflects the electrical state of the motor. Faults such as load changes, winding short circuits, and rotor bar breakage will cause changes in the characteristics of the current signal. Fourier transform (FFT) is used to convert the time-domain current signal into a frequency-domain signal, and five frequency-domain features are extracted to form the current feature vector. It has 5 dimensions;
[0193] ① Fundamental frequency amplitude: The amplitude of the fundamental frequency of the current signal. The fundamental frequency is the rated frequency of the motor (50Hz). The fundamental frequency amplitude is closely related to the load of the motor. The greater the load, the greater the fundamental frequency amplitude.
[0194] ② Fundamental frequency: The fundamental frequency of the current signal is 50Hz under normal operating conditions. When the motor speed changes or there is a fault, the fundamental frequency will shift.
[0195] ③Total harmonic distortion ( The ratio of the total effective value of all harmonic components to the effective value of the fundamental frequency reflects the degree of distortion of the current signal. A larger total harmonic distortion indicates poorer electrical performance of the motor, potentially indicating winding faults, inverter faults, or other problems. The calculation formula is as follows: ,in This is the fundamental effective value. For the first RMS value of subharmonics;
[0196] ④ Harmonic amplitude: Extract the amplitude of the 2nd, 3rd, and 5th harmonics (common harmonic components of motors) to reflect the characteristics of electrical faults;
[0197] ⑤ Total Harmonic Content: The total effective value of all harmonic components, expressed by the formula: = .
[0198] (4) Feature extraction of temperature signal: The time-domain feature extraction method is used to extract 5-dimensional features to form a temperature feature vector. :
[0199] ① Average temperature: The arithmetic mean of temperatures over a sampling period, reflecting the average thermal state of the equipment. The formula is as follows: , For the first Temperature values at each sampling point;
[0200] ② Maximum temperature: The highest temperature during the sampling period, reflecting the peak heat load of the equipment;
[0201] ③ Minimum temperature: The lowest temperature within the sampling period, reflecting the range of temperature fluctuations;
[0202] ④ Temperature change rate: The ratio of the temperature difference between adjacent sampling points to the time difference, reflecting the rate of temperature change. The formula is: ,in, The sampling interval;
[0203] ⑤ Temperature fluctuation variance: reflects the degree of temperature fluctuation, and the formula is as follows: .
[0204] S32, perform attention fusion: , , , The input attention fusion module achieves adaptive fusion of multimodal features through three steps: feature dimension unification, attention weight calculation, and feature weighted fusion, and outputs a fused feature vector. ,include:
[0205] S321, Unifying Feature Dimension, includes: using fully connected layers to map feature vectors from different modalities to the same dimension. , The value range is 64~256, and it is adaptively adjusted according to the model complexity to obtain a feature vector of uniform dimension. , , , (corresponding to respectively) , , , (Result after unifying dimensions).
[0206] S322, Calculate attention weights, including: constructing a self-attention mechanism module, adaptively calculating attention weights based on the importance of each modal feature to torque prediction, with the specific formula as follows:
[0207] The first step is to calculate the query matrix. Key matrix Value matrix :
[0208] ;
[0209] in, For the modal feature vectors after unifying the dimensions ( , , , ), , , These are the weight matrices for query, key, and value, respectively, with each matrix having a dimension of 1. .
[0210] The second step is to calculate the self-attention output:
[0211] ;
[0212] in, The normalization function ensures that the sum of the weights is 1; As a scaling factor, to avoid scaling due to dimension Too large The value is too large, which has an impact. Normalization effect.
[0213] The third step is to calculate the attention weight vectors for each modality. :
[0214] ;
[0215] in, For average pooling operation, the output weight vector It contains 4 weight values , , , These correspond to the attention weights for torque, vibration, current, and temperature characteristics, respectively, and satisfy the following conditions: .
[0216] S323, perform feature fusion, including: based on the attention weight vector We perform weighted fusion of the feature vectors of each modality with a unified dimension to obtain a fused feature vector. The calculation formula is:
[0217] ;
[0218] This fusion method can adaptively highlight key features for torque prediction (such as increased weighting of current and torque features when the load changes, and increased weighting of vibration features when there is a mechanical fault), thereby improving the effectiveness of the fused features.
[0219] As a preferred implementation, S4 employs an improved time-series prediction model (combining LSTM and Transformer) to address the problems of traditional time-series models struggling to capture long-distance dependencies and prone to gradient vanishing. Accurate torque prediction is achieved through time-series feature enhancement. The model structure includes an input layer, a time-series feature enhancement layer, and a prediction output layer. The specific implementation process is as follows:
[0220] S41, Constructing the input layer includes: merging the fused feature vector... Construct a time-series input sequence by arranging the sequences in chronological order. ,in The time step is 10 to 50, and can be adjusted according to the time series characteristics of the data. It is preferable to choose 20 to 30 to ensure that the model captures enough time series information.
[0221] S42, construct the temporal feature enhancement layer, which includes LSTM sub-layers and Transformer sub-layers, to implement temporal feature extraction and enhancement in steps:
[0222] ①LSTM sublayer: Responsible for extracting short-term dependencies of temporal features. The parameters are set as follows: 2 to 4 hidden layers (3 layers preferred), 64 to 256 hidden units per layer (128 preferred), sigmoid function (value range 0 to 1, controlling information transmission) for forget gate, input gate, and output gate, tanh function (value range -1 to 1, controlling cell state update) for cell state activation function, and dropout probability of 0.1 to 0.3 (0.2 preferred, to prevent overfitting).
[0223] Input time sequence Input LSTM sublayer, output time-series feature sequence ,in For the first The LSTM output features at each time step contain short-term time series information up to and including that time step.
[0224] ② Transformer sub-layer: Responsible for capturing long-distance dependencies of temporal features and making up for the shortcomings of the LSTM sub-layer. The parameters are set as follows: 4~8 multi-head attention heads (preferably 6 heads), attention hidden layer dimension 64~256 (consistent with the fusion feature dimension d), feedforward neural network (FFN) hidden layer dimension 256~512 (preferably 384), ReLU activation function is used (to alleviate gradient vanishing), dropout probability 0.1~0.3 (consistent with the LSTM sub-layer).
[0225] Time series feature sequences The input is a Transformer sublayer, which uses a multi-head attention mechanism to capture long-distance correlations between features at different time steps, and outputs an enhanced temporal feature sequence. Meanwhile, by using layer normalization and residual connections, the stability of model training is improved and gradient vanishing is avoided.
[0226] S43, Construct the prediction output layer: This involves processing the enhanced temporal feature sequence... The input is a fully connected layer, which undergoes linear transformation and activation function processing to output the predicted torque value. ;
[0227] Fully connected layer parameter settings: number of hidden units 64~128 (preferably 96), activation function is ReLU function, and output layer activation function is linear activation function (adapting to the continuous output characteristics of torque value); at the same time, a dropout layer (probability 0.2) is added to prevent model overfitting.
[0228] S44. Model training is performed, including: To ensure prediction accuracy, the model needs to undergo rigorous training and validation, the specific process of which is as follows:
[0229] S441. Dataset partitioning: The preprocessed standardized multimodal dataset is divided into training set, validation set, and test set in a 7:2:1 ratio. The training set is used for model parameter updates, the validation set is used for hyperparameter tuning, and the test set is used for final accuracy verification.
[0230] S442. Model initialization: The Xavier normal initialization method is used to initialize the weight parameters of the LSTM sub-layer, Transformer sub-layer and fully connected layer to avoid the model not converging due to excessively large or small initial parameters; the initial learning rate is 0.001~0.01 (preferably 0.005), the number of iterations is 100~500 (preferably 300), and the batch size is 32~128 (preferably 64).
[0231] S443, Model Training: Using the fused feature vector of the training set as input, and the corresponding actual torque measurement value as the label, the mean squared error is used. As the loss function, the formula is:
[0232] ;
[0233] in, The number of training samples. This is the actual measured torque value. Predict torque values for the model.
[0234] The Adam optimization algorithm is used to iteratively update the model parameters. The Adam algorithm combines momentum gradient descent and adaptive learning rate to improve training efficiency and convergence stability. Every 10 iterations, the model performance is verified using the validation set, and the validation set loss is calculated. If the validation set loss does not decrease for 5 consecutive iterations, the training is stopped using an early stopping strategy to save the optimal model parameters and avoid overfitting.
[0235] S444, Model Testing, includes: inputting the fused feature vector of the test set into the optimal model, outputting the predicted torque value, calculating three accuracy evaluation metrics, and verifying the model performance.
[0236] ①Mean absolute error ( ): This reflects the average deviation between the predicted value and the actual value, and the formula is:
[0237]
[0238] Require ;
[0239] ②Root mean square error ( (): Reflects the overall deviation between predicted and actual values, and is more sensitive to outliers. The formula is:
[0240] ;
[0241] Require ;
[0242] ③ Coefficient of determination ( The value () reflects the goodness of fit of the model; the closer it is to 1, the better the fit. The formula is:
[0243] ,in, The average value of the actual torque measurements is required. .
[0244] When all three metrics meet the requirements, the model training is complete and it can be put into practical application; if they do not meet the requirements, adjust the model hyperparameters (such as time step t, number of hidden units, and learning rate) and retrain until the requirements are met.
[0245] In a preferred embodiment, step S5 constructs an error compensation model based on a BP neural network, and combines auxiliary parameters such as motor speed and load rate to correct the predicted torque value in real time, eliminating prediction deviations and achieving accurate torque output. The specific implementation process is as follows:
[0246] S51, Constructing error samples includes: collecting the predicted torque values Compared with the actual torque measurement value deviation value Simultaneously, the fused feature vectors at the corresponding time points are collected. Motor speed (Unit: r / min), Load rate (unit:%, ), construct an error sample set. The input of the error samples is (dimension is) , (To fuse feature vector dimensions), the output is the bias value. The number of samples should be no less than 1,000 to ensure the reliability of model training.
[0247] S52, training error compensation model, including: dividing the error sample set into training and test sets in a 7:3 ratio, and setting the BP neural network parameters as follows: number of input layer nodes is... The number of hidden layers is 1-3 (2 layers preferred), with 32-64 hidden units per layer (48 preferred). The output layer has 1 node (output error prediction value). The activation function is the sigmoid function, and the loss function is the mean squared error. The formula is:
[0248] ;
[0249] in, The number of error samples. This is the actual deviation value. This is the predicted error value.
[0250] The optimization algorithm uses the Adam algorithm, with a learning rate of 0.001~0.01 (preferably 0.003), 100~300 iterations (preferably 200), and a batch size of 32~64 (preferably 48). Training continues until the model converges (the loss function value tends to stabilize, and the error on the test set is minimized). ), thus obtaining the trained error compensation model.
[0251] S53, Real-time error compensation: The fused feature vector at the current moment... Motor speed Load rate Input error compensation model, output error prediction value The predicted torque value is corrected using the following formula to obtain the final accurate torque value. :
[0252]
[0253] S54, Model Adaptive Update: To address error drift caused by factors such as equipment aging and environmental changes, the error compensation model is equipped with an adaptive update mechanism: every 10-30 data acquisition cycles (preferably 20 cycles), the latest deviation value is collected. fusion feature vectors Rotation speed Load rate New error samples are generated; incremental training is performed on the error compensation model to update the model parameters. The number of incremental training iterations is 10 to 30 (20 is preferred) and the learning rate is 0.0001 to 0.001 (0.0005 is preferred) to ensure the real-time performance and accuracy of error compensation.
[0254] In a preferred embodiment, S6 includes:
[0255] S61, Model Operation Monitoring: Real-time monitoring of the operation status of the improved time-series prediction model and error compensation model, and calculation of predicted torque values. With the final precise torque value deviation Set the deviation threshold (0.3~0.8 N·m, preferably 0.5 N·m).
[0256] S62, Anomaly Warning: When When the value exceeds the preset threshold, an abnormal warning signal (audio-visual warning) is issued, and abnormal data (including multimodal raw data, fusion features, predicted values, deviation values, etc.) is recorded for subsequent model optimization. If the model experiences 5 consecutive abnormalities, the model retraining process is automatically triggered, and the prediction model and error compensation model are retrained using the latest collected data to ensure model stability and prediction accuracy.
[0257] S63, Fault Diagnosis Extension: This method can be extended to motor fault diagnosis. By analyzing the changing trends of multimodal feature vectors and abnormal fluctuations in torque prediction deviation, potential faults (bearing wear, rotor imbalance, winding short circuit, abnormal load) can be identified.
[0258] Calculate the rate of change of the fused feature vector
[0259]
[0260] in, To fuse the feature vector at the current time step, (the fused feature vector from the previous time step); when If the torque prediction deviation is greater than 1.0 N·m for 10 consecutive acquisition cycles, it is determined to be the corresponding fault type, and fault warning information is output (clearly indicating the fault type, the time of occurrence, and the characteristic abnormal point) to provide a basis for equipment maintenance.
[0261] like Figure 2 As shown, a second aspect of the present invention provides a torque prediction and error compensation system based on attention mechanism and multimodal feature fusion, for implementing the method of the first aspect, comprising:
[0262] The data acquisition and dataset module (101) is used to acquire multimodal data and form a multimodal raw dataset, including: synchronously acquiring torque raw signals, vibration signals, current signals and temperature signals during the operation of the electric motor through the multi-sensor module to obtain a multimodal raw dataset;
[0263] The multimodal data preprocessing module (102) is used to preprocess the multimodal data: to denoise, normalize, synchronize and align the multimodal raw data in the multimodal raw dataset, and handle outliers to eliminate noise interference, data redundancy and time misalignment, and obtain a standardized multimodal dataset.
[0264] The multimodal feature extraction module (103) is used to extract and fuse multimodal features based on the preprocessed multimodal data, including: using an attention-based multimodal fusion algorithm to extract features from each modality in the standardized multimodal dataset, obtaining feature vectors for each modality, and then using adaptive allocation of attention weights to achieve efficient fusion of multimodal features and output fused feature vectors;
[0265] The torque prediction module (104) is used to accurately predict torque based on the fused feature vector, including: inputting the fused feature vector into an improved time-series prediction model (LSTM combined with Transformer), and outputting the predicted torque value of the motor through time-series feature enhancement and linear prediction;
[0266] The real-time error compensation module (105) is used to perform real-time error compensation based on the predicted torque value of the motor, including: calculating the deviation between the predicted torque value of the motor and the actual measured torque value of the motor, constructing an error compensation model based on the BP neural network, combining the motor speed and load rate as auxiliary parameters, performing real-time error correction on the predicted torque value of the motor, and outputting the final accurate torque value.
[0267] The model monitoring and anomaly warning module (106) is used for model monitoring and anomaly warning, including: real-time monitoring of the operating status of the prediction model and the error compensation model, identifying anomalies based on the deviation threshold, triggering warning and model optimization mechanisms; and identifying potential motor faults through feature changes and deviation fluctuations.
[0268] Application Examples
[0269] Example 1: Torque prediction and error compensation for a small industrial electric motor (rated power 5.5kW)
[0270] This embodiment applies to a small industrial motor (model Y132S-4, rated power 5.5kW, rated speed 1440r / min, rated torque 37.8N·m, rated current 11.6A) used to drive small conveying equipment. The operating condition is intermittent load (load rate 30%~80%), ambient temperature 15~35℃, and slight electromagnetic interference exists. The specific implementation steps are as follows:
[0271] 1. Multimodal data acquisition: The following sensors are selected, and the sampling frequencies are uniformly set as follows: torque 300Hz, vibration 500Hz, current 300Hz, temperature 100Hz, and synchronization error ≤1ms;
[0272] (1) Torque sensor: strain gauge type, model HCNJ-105, measuring range 0~100N·m, accuracy 0.1 grade, output 4~20mA, flange connection (compatible with shaft diameter 30mm), IP67 protection;
[0273] (2) Vibration sensor: piezoelectric type, model YD-105, measurement range 0~50g, frequency response 10~1000Hz, sensitivity 100mV / g, magnetically mounted on the bearing end cover;
[0274] (3) Current sensor: Hall effect type, model ACS712-20A, measurement range 0~20A, accuracy class 0.2, through-core type, output 0~5V;
[0275] (4) Temperature sensor: PT100, Class A accuracy, measurement range -50~150℃, installed on stator winding, output 4~20mA;
[0276] The data acquisition card is a USB-6216 (16-bit AD, sampling rate 1000Hz, 8-channel input), the main control module is a PLC (Siemens S7-1200), and the data is stored on an SD card.
[0277] 2. Data preprocessing:
[0278] (1) Denoising: Wavelet basis db4, torque, current and temperature signals decomposed into 3 layers, vibration signal decomposed into 5 layers; , , according to Calculate (N=10000, , );
[0279] (2) Outlier handling: 3σ criterion, ; outlier range Linear interpolation replacement for a single outlier;
[0280] (3) Synchronization alignment: Based on the torque signal timestamp, the vibration, current and temperature signals are interpolated and aligned with an accuracy of 0.8ms;
[0281] (4) Normalization: Torque , Current , ,temperature , .
[0282] 3. Feature Extraction and Fusion: The fused feature dimension d=128, and the attention weights are stabilized after training. , , , Highlighting torque and vibration characteristics.
[0283] 4. Torque prediction: Time step t=25, LSTM 3 layers, 128 hidden units, Transformer 6-head attention, FFN 384 hidden layers; training set 8400 sets, validation set 1800 sets, test set 600 sets. Post-training test set metrics: , , The requirements are met.
[0284] 5. Error Compensation: The BP neural network has an input dimension of 130 (128+2), 2 hidden layers with 48 units, 1200 training samples, and a test set. Rotational speed Predicted torque when load rate k=50% Error prediction Ultimately precise torque , and the actual measured value ( Deviation only .
[0285] 6. Monitoring and early warning: Deviation threshold There were no abnormal warnings during operation. The model was updated incrementally every 20 collection cycles (10s) and had good stability.
[0286] Example 2: Torque prediction and error compensation for medium-sized industrial electric motors (rated power 37kW)
[0287] This embodiment applies to a medium-sized industrial motor (rated power 37kW, rated speed 1480r / min, rated torque 242N·m, rated current 70A) of model Y200L-4, used for fan drive, operating under continuous load (load rate 60%~100%), ambient temperature 20~40℃, and moderate electromagnetic and mechanical interference. The specific implementation steps are as follows:
[0288] 1. Multimodal data acquisition: The following sensors are selected, with sampling frequencies of 500Hz for torque, 1000Hz for vibration, 500Hz for current, and 200Hz for temperature, and a synchronization error of ≤1ms.
[0289] (1) Torque sensor: strain gauge type, model HCNJ-106, measuring range 0~500N·m, accuracy 0.1 grade, output 4~20mA, flange connection (compatible with shaft diameter 45mm), IP67 protection;
[0290] (2) Vibration sensor: piezoelectric type, model YD-108, measurement range 0~50g, frequency response 10~1000Hz, sensitivity 100mV / g, threaded on the base;
[0291] (3) Current sensor: Hall effect type, model ACS758-100A, measurement range 0~100A, accuracy class 0.2, through-core type, output 0~5V;
[0292] (4) Temperature sensor: PT100, Class A accuracy, measurement range -50~150℃, installed on bearing and stator winding (2 sensors), output 4~20mA;
[0293] (5) The data acquisition card is PCI-6251 (16-bit AD, sampling rate 10000Hz, 16 inputs), the main control module is an industrial microcontroller (STM32H743), and the data is stored on the cloud server.
[0294] 2. Data preprocessing:
[0295] (1) Denoising: Wavelet basis db4, torque, current and temperature signals decomposed into 3 layers, vibration signal decomposed into 5 layers; , , according to Calculate (N=20000, , );
[0296] (2) Outlier handling: 3σ criterion, ; outlier range Linear interpolation replacement for a single outlier;
[0297] (3) Synchronous alignment: Based on the torque signal timestamp, the alignment accuracy is 0.5ms;
[0298] (4) Normalization: Torque , Current , ,temperature , .
[0299] 3. Feature Extraction and Fusion: The fused feature dimension d=256, and the attention weights are stabilized after training. , , , The vibration characteristics are prominent (the mechanical vibration of the fan is obvious).
[0300] 4. Torque prediction: Time step t=30, LSTM 3 layers, 256 hidden units, Transformer 8-head attention, FFN 512 hidden layers; training set 16800 sets, validation set 3600 sets, test set 1200 sets. Post-training test set metrics: , , The requirements are met.
[0301] 5. Error Compensation: The BP neural network has an input dimension of 258 (256+2), 2 hidden layers with 64 units, 2000 training samples, and a test set. Rotational speed Predicted torque when load rate k=80% Error prediction Ultimately precise torque , and the actual measured value ( Deviation only .
[0302] 6. Monitoring and early warning: Deviation threshold is 0.5 N·m. During operation, an early warning is triggered once due to instantaneous interference from the sensor. The system automatically recovers after recording abnormal data. The model is updated incrementally every 20 acquisition cycles (4s). The accuracy is stable during long-term operation.
[0303] Both embodiments verify the effectiveness of the method of the present invention, which can be adapted to industrial motors of different power and operating conditions, and the prediction accuracy and stability meet the requirements of industrial applications.
[0304] The present invention also provides a memory that stores multiple instructions for implementing the method as described in Embodiment 1.
[0305] like Figure 3 As shown, the present invention also provides an electronic device, including a processor 301 and a memory 302 connected to the processor 301. The memory 302 stores a plurality of instructions, which can be loaded and executed by the processor to enable the processor to perform methods as described in Embodiments 2 and 3.
[0306] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A torque prediction and error compensation method based on attention mechanism and fusion of multimodal features, characterized in that, include: S1, Collect multimodal data and form a multimodal raw dataset, including: synchronously collecting torque raw signals, vibration signals, current signals and temperature signals during the operation of the electric motor through a multi-sensor module to obtain a multimodal raw dataset; S2, preprocessing the multimodal data: denoising, normalizing, synchronizing and aligning the multimodal raw data in the multimodal raw dataset and processing outliers to eliminate noise interference, data redundancy and time misalignment, and obtain a standardized multimodal dataset; S3, extracting and fusing multimodal features based on the preprocessed multimodal data, including: using an attention-based multimodal fusion algorithm to extract features from each modality in the standardized multimodal dataset, obtaining feature vectors for each modality, and then using adaptive allocation of attention weights to achieve efficient fusion of multimodal features and outputting a fused feature vector; S4, Accurately predicting torque based on the fused feature vector, including: inputting the fused feature vector into an improved time-series prediction model, and outputting the predicted torque value of the motor through time-series feature enhancement and linear prediction; S5, Real-time error compensation based on the predicted torque value of the motor, including: calculating the deviation between the predicted torque value of the motor and the actual measured torque value of the motor, constructing an error compensation model based on a BP neural network, combining the motor speed and load rate as auxiliary parameters, performing real-time error correction on the predicted torque value of the motor, and outputting the final accurate torque value. S6 performs model monitoring and anomaly warning, including: real-time monitoring of the operating status of the prediction model and the error compensation model, identifying anomalies based on deviation thresholds, triggering warning and model optimization mechanisms; and identifying potential motor faults through feature changes and deviation fluctuations.
2. The torque prediction and error compensation method based on attention mechanism and multimodal feature fusion according to claim 1, characterized in that, The multi-sensor module of S1 includes a torque sensor, a vibration sensor, a current sensor, and a temperature sensor.
3. The torque prediction and error compensation method based on attention mechanism and multimodal feature fusion according to claim 2, characterized in that, S2 includes: S21, Denoising processing is performed, including: using a wavelet thresholding denoising algorithm to denoise the original signals of each mode, selecting the db4 wavelet as the wavelet basis, and adaptively adjusting the number of decomposition layers according to the signal complexity: the torque signal, current signal, and temperature signal are decomposed into 3 layers, and the vibration signal is decomposed into 5 layers; the threshold function adopts an improved soft threshold function, the specific formula of which is as follows: when hour, ; when hour, ; in, The first of the original signals One sampling point, These are the sampling points of the denoised signal. The noise reduction threshold, This is a correction factor (ranging from 0.05 to 0.15, with the optimal value being 0.1). Attenuation coefficient; noise reduction threshold The calculation formula is ,in For signal length, The standard deviation of noise. Through the noise estimation formula Calculation, where It is a median function; S22, Outlier handling, including: using The criteria for identifying outliers are as follows: (1) Calculate the mean of each modal data with standard deviation ; (2) will exceed Data within the specified range is considered outlier; (3) For each identified outlier, linear interpolation is used for replacement. The interpolation formula is: in, Replacement value for outlier. , These are the normal data adjacent to the outlier. , , These are outliers, , The corresponding data collection timestamp; if three or more abnormal values appear consecutively, it is determined to be a sensor fault or a data collection line fault, and a fault warning signal is immediately issued to remind staff to check and maintain, so as to ensure the continuity and reliability of data collection. S23, perform synchronization alignment, including: using the acquisition timestamp of the original torque signal as a reference, use linear interpolation to perform time synchronization alignment of vibration signal, current signal, and temperature signal to ensure that each modal data corresponds one-to-one in the same time dimension, with an alignment accuracy of not less than 1ms; S24, Normalization processing, including: using the min-max normalization algorithm to independently map each modal data to the [0,1] interval, thereby standardizing the data. The normalization formula is: in, This is the original data. This is the minimum value of the modal data. The maximum value of this modal data, The data is standardized after normalization. During the normalization process, the torque, vibration, current, and temperature signals are processed independently to preserve the relative characteristic relationships of each modal data.
4. The torque prediction and error compensation method based on attention mechanism and multimodal feature fusion according to claim 3, characterized in that, S3 includes: S31, perform feature extraction, including: (1) Feature extraction of the original torque signal, including: combining time domain and frequency domain features to fully reflect the static and dynamic characteristics of the torque signal, extracting a total of 13-dimensional features to form a torque feature vector. : ① Temporal features, which are 8-dimensional: a. Peak value: The maximum value of the torque signal within one sampling period, reflecting the maximum torque output capability; b. Valley value: The minimum value of the torque signal within a sampling period, reflecting the minimum torque output capability; c. Average value: The arithmetic mean of the torque signal within one sampling period, reflecting the average output level of the torque. The calculation formula is as follows: ,in For the first Torque value at each sampling point This represents the number of sampling points within the sampling period. d. Variance: Reflects the degree of torque fluctuation. The larger the variance, the more severe the torque fluctuation and the more unstable the motor load. The calculation formula is as follows: ; e. Kurtosis: Reflects the peak characteristics of the torque signal. A kurtosis > 3 indicates a sharp peak, which may correspond to a sudden change in motor load or a fault. The formula is as follows: ; f. Skewness: Reflects the symmetry of the torque signal distribution. A positive skewness indicates a right-biased signal distribution, and a negative skewness indicates a left-biased signal distribution. It can reflect the imbalance of the torque load. The formula is as follows: ; g. Pulse Index: The ratio of peak value to average value, reflecting the pulse characteristics of the torque signal. The larger the pulse index, the more pulse components exist in the torque signal. The calculation formula is as follows: ; h. Waveform Index: The ratio of the effective value to the average value, reflecting the waveform shape of the torque signal. The closer the waveform index is to 1, the closer the torque signal is to a sine wave and the more stable the operation. The formula is as follows: ; ② Frequency domain features, which are 5-dimensional. The time-domain torque signal is converted into a frequency-domain signal using Fast Fourier Transform, and the following features are extracted: a. Peak value of the spectrum: The maximum amplitude value in the frequency domain signal, reflecting the intensity of the main frequency components of the torque signal; b. Spectral Mean: The arithmetic mean of the amplitude of the frequency domain signal, reflecting the overall strength of the frequency domain signal. The formula is... ,in For the first Amplitude at each frequency point, This refers to the number of frequency points. c. Spectral variance: Reflects the degree of fluctuation in frequency domain amplitude and the stability of frequency components. The formula is as follows: ; d. Main frequency: The frequency corresponding to the peak value of the spectrum, which reflects the main frequency components of the torque signal and is closely related to the speed and load of the motor; e. Frequency Band Energy: The frequency domain is divided into four bands: 0~10Hz, 10~50Hz, 50~100Hz, and 100~200Hz. The energy of each band is calculated to reflect the energy distribution of the torque signal in different frequency ranges. The formula for the energy of a single frequency band is: ; (2) Feature extraction of vibration signal, including: feature extraction using wavelet packet decomposition, extracting a total of 128-dimensional features to form a vibration feature vector. : Using the db4 wavelet as the wavelet envelope basis, with a decomposition level of 5, the vibration signal is decomposed into... For each wavelet packet node, energy, energy entropy, kurtosis, and skewness are calculated, and four feature parameters are extracted: energy, energy entropy, kurtosis, and skewness. The specific extraction of these four feature parameters for each node's signal is as follows: ① Energy: The energy of each wavelet packet node signal reflects the strength of the signal in that frequency band. During a fault, the energy of the corresponding frequency band will change significantly. The formula is: ,in This is the sampled value of the signal at that node; ② Energy entropy: Reflects the uniformity of energy distribution among wavelet packet nodes. A smaller energy entropy indicates that energy is concentrated in a few frequency bands, potentially indicating a motor malfunction. A larger energy entropy indicates a more uniform energy distribution and more stable motor operation. The calculation formula is as follows: ,in For the first The proportion of energy of each wavelet packet node to the total energy. ,in, For the first The energy of each wavelet packet node; ③ Kurtosis: Reflects the peak characteristics of the signal at each wavelet packet node, and can identify the impulse components in the signal. The calculation formula is as follows: ,in, The average value of the node signal. The standard deviation of the node signal; ④ Skewness: Reflects the symmetry of signal distribution at each wavelet packet node, and can reflect the degree of signal distortion. When a fault occurs, the signal skewness will change significantly. The calculation formula is as follows: ; The four characteristic parameters of the 32 nodes are combined to form a 128-dimensional vibration feature vector. ; (3) Feature extraction of current signal, including: using Fourier transform (FFT) to convert the time-domain current signal into a frequency-domain signal, extracting 5 frequency-domain features to form a current feature vector. It has 5 dimensions; ① Fundamental amplitude: The amplitude of the fundamental current signal. The fundamental frequency is the rated frequency of the motor, 50Hz. The fundamental amplitude is closely related to the load of the motor. The greater the load, the greater the fundamental amplitude. ② Fundamental frequency: The fundamental frequency of the current signal is 50Hz under normal operating conditions. When the motor speed changes or there is a fault, the fundamental frequency will shift. ③Total harmonic distortion The calculation formula is: ,in This is the fundamental effective value. For the first RMS value of subharmonics; ④ Amplitude of each harmonic: Extract the amplitude of the 2nd, 3rd, and 5th harmonics to reflect the characteristics of electrical faults; ⑤ Total Harmonic Content: The total effective value of all harmonic components, expressed by the formula: = ; (4) Feature extraction of temperature signal: The time-domain feature extraction method is used to extract 5-dimensional features to form a temperature feature vector. : ① Average temperature: The arithmetic mean of temperatures over a sampling period, reflecting the average thermal state of the equipment. The formula is as follows: , For the first Temperature values at each sampling point; ② Maximum temperature: The highest temperature during the sampling period, reflecting the peak heat load of the equipment; ③ Minimum temperature: The lowest temperature within the sampling period, reflecting the range of temperature fluctuations; ④ Temperature change rate: The ratio of the temperature difference between adjacent sampling points to the time difference, reflecting the rate of temperature change. The formula is: ,in, The sampling interval; ⑤ Temperature fluctuation variance: reflects the degree of temperature fluctuation, and the formula is as follows: ; S32, perform attention fusion: , , , The input attention fusion module achieves adaptive fusion of multimodal features through three steps: feature dimension unification, attention weight calculation, and feature weighted fusion, and outputs a fused feature vector. ,include: S321, Unifying Feature Dimension, includes: using fully connected layers to map feature vectors from different modalities to the same dimension. To obtain feature vectors of uniform dimension , , , , respectively corresponding , , , The result after unifying the dimensions; S322, Calculate attention weights, including: constructing a self-attention mechanism module, and adaptively calculating attention weights based on the importance of each modal feature to torque prediction; S323, perform feature fusion, including: based on the attention weight vector We perform weighted fusion of the feature vectors of each modality with a unified dimension to obtain a fused feature vector. The calculation formula is: 。 5. The torque prediction and error compensation method based on attention mechanism and multimodal feature fusion according to claim 4, characterized in that, The S4 model employs an improved temporal prediction model, combining LSTM with Transformer to achieve accurate torque prediction through temporal feature enhancement. The model structure includes an input layer, a temporal feature enhancement layer, and a prediction output layer. The specific implementation process is as follows: S41, Constructing the input layer includes: merging the fused feature vector... Construct a time-series input sequence by arranging the sequences in chronological order. ,in For time step; S42, construct the temporal feature enhancement layer, which includes LSTM sub-layers and Transformer sub-layers, to implement temporal feature extraction and enhancement in steps: S43, Construct the prediction output layer: This involves processing the enhanced temporal feature sequence... The input is a fully connected layer, which undergoes linear transformation and activation function processing to output the predicted torque value. ; S44, perform model training, including: S441. Dataset partitioning: The preprocessed standardized multimodal dataset is divided into training set, validation set and test set in a ratio of 7:2:
1. The training set is used for model parameter updates, the validation set is used for hyperparameter tuning, and the test set is used for final accuracy verification. S442. Model initialization: The Xavier normal initialization method is used to initialize the weight parameters of the LSTM sub-layer, Transformer sub-layer and fully connected layer to avoid the model not converging due to excessively large or small initial parameters; the initial learning rate is 0.001~0.01, the number of iterations is 100~500, and the batch size is 32~128. S443. Model Training: Using the fused feature vector of the training set as input, and the corresponding actual torque measurement value as the label, mean squared error is used. As the loss function, the formula is: ; in, The number of training samples. This is the actual measured torque value. Predict torque values for the model; The Adam optimization algorithm is used to iteratively update the model parameters. Every 10 iterations, the model performance is verified using the validation set, and the validation set loss is calculated. If the validation set loss does not decrease for 5 consecutive iterations, the training is stopped using an early stopping strategy to save the optimal model parameters and avoid overfitting. S444, Model Testing, includes: inputting the fused feature vector of the test set into the optimal model, outputting the predicted torque value, calculating three accuracy evaluation metrics, and verifying the model performance. ① Mean Absolute Error The formula is: Require ; ② Root mean square error The formula is: ; Require ; ③ Coefficient of determination The formula is: ,in, The average value of the actual torque measurements is required. ; When all three metrics meet the requirements, the model training is complete and it can be put into practical application; if they do not meet the requirements, adjust the model hyperparameters and retrain until the requirements are met.
6. The torque prediction and error compensation method based on attention mechanism fusion of multimodal features according to claim 5, characterized in that, S5 includes: S51, Constructing error samples includes: collecting the predicted torque values Compared with the actual torque measurement value deviation value Simultaneously, the fused feature vectors at the corresponding time points are collected. Motor speed The unit is r / min, load rate The unit is %. Construct an error sample set; the input of the error samples is... , dimension , To fuse feature vector dimensions, the output is a bias value. The sample size shall be no less than 1,000 groups; S52, training error compensation model, including: dividing the error sample set into training and test sets in a 7:3 ratio, and setting the BP neural network parameters as follows: number of input layer nodes is... The system has 1-3 hidden layers, with 32-64 hidden units per layer. The output layer has 1 node and outputs the predicted error value. The activation function is the sigmoid function, and the loss function is the mean squared error. The formula is: ; in, The number of error samples. This is the actual deviation value. For the error prediction value' S53, Real-time error compensation: The fused feature vector at the current moment... Motor speed Load rate Input error compensation model, output error prediction value The predicted torque value is corrected using the following formula to obtain the final accurate torque value. : ; S54, Model Adaptive Update, includes: collecting the latest bias values every 10-30 acquisition cycles. fusion feature vectors Rotation speed Load rate This forms new error samples; the error compensation model is incrementally trained to update the model parameters. The number of incremental training iterations is 10 to 30, and the learning rate is 0.0001 to 0.
001.
7. The torque prediction and error compensation method based on attention mechanism fusion of multimodal features according to claim 6, characterized in that, S6 includes: S61, Model Operation Monitoring: Real-time monitoring of the operation status of the improved time-series prediction model and error compensation model, and calculation of predicted torque values. With the final precise torque value deviation Set the deviation threshold; S62, Anomaly Warning: When When the value exceeds a preset threshold, an abnormal warning signal is issued, and abnormal data is recorded. The abnormal data includes multimodal raw data, fusion features, predicted values, and deviation values, which are used for subsequent model optimization. If the model experiences 5 consecutive abnormalities, the model retraining process is automatically triggered. The prediction model and error compensation model are retrained using the latest collected data to ensure model stability and prediction accuracy. S63, Fault Diagnosis Extension, includes: identifying potential faults by analyzing the changing trends of multimodal eigenvectors and abnormal fluctuations in torque prediction deviations. These potential faults include bearing wear, rotor imbalance, winding short circuits, and abnormal loads. The rate of change of the fused feature vector is calculated as follows: ; in, To fuse the feature vector at the current time step, The fused feature vector from the previous time step; when If the torque prediction deviation is greater than 1.0 N·m for 10 consecutive acquisition cycles, it is determined to be the corresponding fault type, and fault warning information is output to clarify the fault type, occurrence time and characteristic abnormal point, so as to provide a basis for equipment maintenance.
8. A torque prediction and error compensation system based on attention mechanism and fusion of multimodal features, used to implement the method according to any one of claims 1-7, characterized in that, include: The data acquisition and dataset module (101) is used to acquire multimodal data and form a multimodal raw dataset, including: synchronously acquiring torque raw signals, vibration signals, current signals and temperature signals during the operation of the electric motor through the multi-sensor module to obtain a multimodal raw dataset; The multimodal data preprocessing module (102) is used to preprocess the multimodal data: to denoise, normalize, synchronize and align the multimodal raw data in the multimodal raw dataset, and handle outliers to eliminate noise interference, data redundancy and time misalignment, and obtain a standardized multimodal dataset. The multimodal feature extraction module (103) is used to extract and fuse multimodal features based on the preprocessed multimodal data, including: using an attention-based multimodal fusion algorithm to extract features from each modality in the standardized multimodal dataset, obtaining feature vectors for each modality, and then using adaptive allocation of attention weights to achieve efficient fusion of multimodal features and output fused feature vectors; The torque prediction module (104) is used to accurately predict torque based on the fused feature vector, including: inputting the fused feature vector into an improved time-series prediction model (LSTM combined with Transformer), and outputting the predicted torque value of the motor through time-series feature enhancement and linear prediction; The real-time error compensation module (105) is used to perform real-time error compensation based on the predicted torque value of the motor, including: calculating the deviation between the predicted torque value of the motor and the actual measured torque value of the motor, constructing an error compensation model based on the BP neural network, combining the motor speed and load rate as auxiliary parameters, performing real-time error correction on the predicted torque value of the motor, and outputting the final accurate torque value. The model monitoring and anomaly warning module (106) is used for model monitoring and anomaly warning, including: real-time monitoring of the operating status of the prediction model and the error compensation model, identifying anomalies based on the deviation threshold, triggering warning and model optimization mechanisms; and identifying potential motor faults through feature changes and deviation fluctuations.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing multiple instructions, and the processor being used to read the instructions and execute the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions, which can be read by a processor and executed as described in any one of claims 1-7.