CN-122001264-A - Motor dynamic filtering method based on wavelet transformation
Abstract
The invention discloses a motor dynamic filtering method based on wavelet transformation, which relates to the technical field of motor control and signal processing and comprises the following steps of S1, collecting an original angular velocity signal of a motor encoder and dynamically storing the original angular velocity signal into a data curve; S2, carrying out frequency analysis on the data curve to determine the maximum frequency and the target frequency, S3, selecting a wavelet function, constructing a binary tree frequency division structure based on the maximum frequency and the target frequency, taking the logarithm through the ratio of the maximum frequency to the target frequency, and rounding down. According to the motor dynamic filtering method based on wavelet transformation, data frequency domain decomposition and reconstruction are realized through wavelet transformation, real-time processing requirements and data fidelity are effectively balanced, the problems of hysteresis and data distortion of the traditional filtering method in real time are avoided, frequency band components are precisely controlled by utilizing a binary tree frequency division structure, a target frequency band is enhanced or weakened through adjustment of wavelet coefficients, and frequency domain processing accuracy is improved.
Inventors
- GONG WANGMING
- QIAN YUNZHI
- LU CHANG
Assignees
- 奇瑞汽车股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260108
Claims (10)
- 1. The motor dynamic filtering method based on wavelet transformation is characterized by comprising the following steps of: S1, acquiring an original angular velocity signal of a motor encoder and dynamically storing the original angular velocity signal into a data curve; s2, carrying out frequency analysis on the data curve, and determining the maximum frequency and the target frequency; s3, selecting a wavelet function, constructing a binary tree frequency division structure based on the maximum frequency and the target frequency, taking the logarithm through the ratio of the maximum frequency to the target frequency, rounding down, and calculating the maximum frequency of frequency division; s4, determining initial parameters of a scale function and a detail function according to the maximum frequency division times; S5, performing discrete convolution on the scale function and the detail function and the data curve respectively, and calculating the scale coefficient and the detail coefficient of each level of frequency band; s6, adjusting scale factors and detail factors according to filtering requirements; S7, based on the hierarchical relation of the two branches, multiplying the adjusted scale coefficient and the adjusted detail coefficient with corresponding functions respectively, summing the multiplied scale coefficient and the adjusted detail coefficient, and executing a discrete deconvolution data curve; S8, repeating the steps S5 to S7, and realizing continuous filtering through dynamic movement of the data window.
- 2. The method for dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S1 comprises: When the original angular velocity signal of the motor encoder is acquired, a bottom API interface, a CAN bus interface or an SPI interface is adopted to realize real-time acquisition of the signal, and the acquisition process is matched with the movement working condition of the motor; in the dynamic storage process, if a sliding window mechanism is selected, the latest acquired original angular velocity signal data with preset quantity is reserved in the window, and when the acquisition of the new signal data is completed, the window automatically eliminates the same quantity of data which enters the window at earliest; if a data chain mechanism is selected, sequentially accessing the acquired original angular velocity signal data into the tail end of the chain according to time sequence, and simultaneously removing the data exceeding a preset time range from the starting end of the chain; and forming a data curve through the dynamic storage mode.
- 3. The method of dynamic filtering of a motor based on wavelet transform according to claim 2, wherein said S1 further comprises: When a data curve is formed by dynamic storage, preprocessing the collected original angular velocity signal of the motor encoder, and eliminating abnormal isolated data points in the signal; In the preprocessing process, firstly comparing the numerical value difference between each data point and the adjacent data points before and after the data point, if the difference exceeds a preset range, further judging the change trend of a plurality of data points before and after the data point, if only the data point deviates from the trend, judging the data point as an abnormal isolated data point and eliminating the abnormal isolated data point, and meanwhile adopting the average value of the adjacent normal data point to fill the data gap after eliminating.
- 4. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S2 comprises: Performing frequency analysis on the data curve formed in the step S1, and identifying frequency components corresponding to angular velocity fluctuation in the data curve through time domain-to-frequency domain conversion analysis based on time sequences and angular velocity values of all data points in the data curve which are dynamically stored; when the maximum frequency is determined, screening out the frequency with the maximum value in all frequency components; When the target frequency is determined, the frequency range to be processed is definitely determined by combining the interference characteristics under the motor motion working condition, and the center frequency or the key frequency of the frequency range is set as the target frequency.
- 5. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S3 comprises: selecting a type with high real-time calculation speed and excellent local response performance when selecting a wavelet function; when constructing a binary tree frequency division structure, taking the maximum frequency determined by S2 as the upper frequency limit of an original signal layer, setting the frequency range of the original signal layer to be 0 to the maximum frequency, then carrying out layer-by-layer decomposition on the original signal layer, wherein the first layer decomposition divides the original signal layer into a low frequency band and a high frequency band, the low frequency band is one half of the maximum frequency, and the high frequency band is one half of the maximum frequency to the maximum frequency; The second layer of decomposition is divided into a new low frequency band and a new high frequency band according to the proportion of one half of each frequency band aiming at the low frequency band and the high frequency band of the first layer, and the decomposition is continued until a certain frequency band obtained completely contains the target frequency determined by S2; When the maximum frequency of frequency division is calculated, the ratio of the maximum frequency to the target frequency is calculated, logarithmic operation based on 2 is carried out on the ratio, and the operation result is subjected to lower rounding processing, so that the obtained integer is the maximum frequency of frequency division.
- 6. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S4 comprises: determining initial parameters of a scale function and a detail function according to the maximum frequency of frequency division, wherein the initial length is set to be the power of the maximum frequency of frequency division of 2; The amplitude height is set as the ratio of 1 to the square root of the initial length; parameter setting of the scale function meets the matching requirement of the data trend; the parameters of the detail function are set as reference scale functions, the latter half of the scale function is symmetrical to the negative half shaft of the Y axis along the X axis to form the basic form of the detail function, and meanwhile, the time sequence characteristics of the detail function can be recorded through parameter setting.
- 7. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S5 comprises: Before performing discrete convolution operation on the scale function and the data curve, respectively storing the scale function and the data curve in an array form, wherein each element of the data curve array corresponds to an angular velocity value of a time point, and each element of the scale function array corresponds to a value of the function at different positions; in the convolution operation process, starting from the initial position of the data curve array, taking a data segment with the same length as the scale function array, multiplying each element of the data segment by the element of the corresponding position of the scale function array one by one, and summing all multiplication results to obtain the scale coefficient corresponding to the position; Performing discrete convolution operation on the detail function and the data curve by adopting the same array storage mode and operation logic to obtain detail coefficients of corresponding positions; After the coefficient calculation of a single position is completed, if the sliding window is adopted to store data, the window is moved backwards by one bit along the time axis of the data curve, if the data chain is adopted to store data, the chain is moved forwards by one bit along the time axis, and the convolution operation process is repeated at a new position until the calculation of scale coefficients and detail coefficients of all positions of the data curve is completed.
- 8. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S6 comprises: before adjusting each coefficient according to the filtering requirement, firstly determining the source of data fluctuation under the motor motion working condition, if the fluctuation is mainly caused by high-frequency interference, adjusting the detail coefficient corresponding to the high frequency band, and weakening the high-frequency interference by reducing the numerical value of the detail coefficient of the high frequency band; If the overall trend of the data curve needs to be enhanced, adjusting the scale coefficient corresponding to the low frequency band, and enhancing the low frequency band data trend by increasing the numerical value of the scale coefficient of the low frequency band; The change amplitude of the coefficient needs to be controlled in the adjustment process.
- 9. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S7 comprises: When discrete deconvolution operation is executed based on the hierarchical relationship of the binary tree frequency division, processing is started from the highest hierarchy of the frequency division structure, the scale coefficient after the hierarchy adjustment is multiplied by the corresponding scale function to obtain the restored data of the scale component of the hierarchy, and meanwhile, the detail coefficient after the hierarchy adjustment is multiplied by the corresponding detail function to obtain the restored data of the detail component of the hierarchy; adding the scale component restoration data and the detail component restoration data of the highest level to obtain comprehensive restoration data of the level; The next-highest level is processed downwards, the same multiplication and summation logic is adopted, the coefficients after the adjustment of the next-highest level are multiplied by the corresponding functions and then summed, the comprehensive reduction data of the next-highest level is obtained, and the comprehensive reduction data of the next-highest level and the comprehensive reduction data of the last level are integrated; And processing downwards layer by layer according to the logic until the coefficient and function operation and data integration of all frequency division levels are completed, and obtaining a complete adjusted data curve.
- 10. The method of dynamic filtering of a motor based on wavelet transform according to claim 1, wherein said S8 comprises: When the continuous filtering is realized by repeating the steps S5 to S7, the synchronism of the movement of a data window and the data acquisition is maintained, and after the data acquisition of the original angular velocity signal of the new motor encoder is completed and updated to a dynamic storage structure, the discrete convolution operation of the step S5 is immediately triggered, and the corresponding scale coefficient and detail coefficient are calculated for the position where the new data is located; after the coefficient calculation is completed, the newly obtained coefficient is adjusted according to the adjustment rule of S6; And then performing S7 discrete deconvolution operation, combining the adjusted new coefficient with a corresponding function, restoring the adjusted data of the new data position, and merging the adjusted data into the existing restored data curve.
Description
Motor dynamic filtering method based on wavelet transformation Technical Field The invention relates to the technical field of motor control and signal processing, in particular to a motor dynamic filtering method based on wavelet transformation. Background In the motor movement working condition, various interferences easily cause the data such as the angular speed and the like uploaded to a program by the motor to have severe fluctuation, the data are used as the core basis of program judgment logic and threshold calculation, and the stability of the data directly influences the accuracy and the reliability of motor control, so that the influence of the data fluctuation is reduced on the premise of minimum distortion through filtering treatment. Based on the core thought of Fourier transform, wavelet transform is based on wavelet function of signal convergence, time domain information of data can be decomposed according to frequency and corresponding wavelet coefficients are recorded, specific frequency band components are enhanced or weakened through adjusting coefficients, and then the data are recombined through inverse transformation, so that technical direction adapting to motion working conditions is provided for dynamic data filtering. The current common methods for processing the data fluctuation under the motion working condition comprise value removal average, interpolation smoothing, exponential coefficient smoothing, data curve fitting and the like, the methods slow down abrupt fluctuation by adjusting data points, but have obvious lag in real-time performance, the data fitting also needs to accurately control the precision, and otherwise, the distortion risk is easy to increase. The common Fourier transform is based on a sine function, time domain information is completely lost when waveform data are processed, similar component waveforms with different time sequences cannot be restored, a large number of coefficients are introduced to cause complex calculation due to the influence of Gibbs phenomenon at a data mutation position, meanwhile, the traditional frequency division mode mostly adopts a similar two-frequency division mode, complete frequency division is difficult to realize on data with extremely low frequency and approximate frequency, and the filtering effect is deviated from the expected frequency. In this regard, we propose a motor dynamic filtering method based on wavelet transform. Disclosure of Invention In order to solve the technical problems, the technical scheme provides a motor dynamic filtering method based on wavelet transformation, which solves the problems that the conventional methods such as value-removing average, interpolation smoothing and the like are lagged in real time, distortion risks are easy to increase if the accuracy of data fitting is improper, time domain information is lost in common Fourier transformation, calculation is complex due to the fact that a large number of coefficients are needed in a data mutation part due to Gibbs phenomenon, the traditional frequency division is difficult to completely divide the data which is over-low in frequency and approximate in frequency, and the filtering effect is deviated from the expected value. In order to achieve the above purpose, the invention adopts the following technical scheme: a motor dynamic filtering method based on wavelet transformation comprises the following steps: S1, acquiring an original angular velocity signal of a motor encoder and dynamically storing the original angular velocity signal into a data curve; s2, carrying out frequency analysis on the data curve, and determining the maximum frequency and the target frequency; s3, selecting a wavelet function, constructing a binary tree frequency division structure based on the maximum frequency and the target frequency, taking the logarithm through the ratio of the maximum frequency to the target frequency, rounding down, and calculating the maximum frequency of frequency division; s4, determining initial parameters of a scale function and a detail function according to the maximum frequency division times; S5, performing discrete convolution on the scale function and the detail function and the data curve respectively, and calculating the scale coefficient and the detail coefficient of each level of frequency band; s6, adjusting scale factors and detail factors according to filtering requirements; S7, based on the hierarchical relation of the two branches, multiplying the adjusted scale coefficient and the adjusted detail coefficient with corresponding functions respectively, summing the multiplied scale coefficient and the adjusted detail coefficient, and executing a discrete deconvolution data curve; S8, repeating the steps S5 to S7, and realizing continuous filtering through dynamic movement of the data window. Preferably, the S1 includes: When the original angular velocity signal of the motor encoder is acquired, a bottom API interface, a