Temperature compensation method and system for magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filter
By combining PSO-LSSVM with adaptive Kalman filtering, a temperature compensation model and a noise covariance mapping table are constructed, which solves the nonlinear drift and noise suppression problems of magnetoelectric angular displacement sensors in a wide temperature range, and realizes high-precision and stable angular displacement measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANXI MECHANICAL & ELECTRICAL DESIGN & RES INST CO LTD
- Filing Date
- 2026-05-12
- Publication Date
- 2026-06-09
AI Technical Summary
Existing temperature compensation methods for magnetoelectric angular displacement sensors cannot simultaneously meet the requirements of accurately fitting nonlinear temperature drift, adaptively suppressing noise based on temperature, and tracking high-speed rotation angle changes, resulting in insufficient measurement accuracy and stability.
A temperature compensation method based on PSO-LSSVM and adaptive Kalman filtering is adopted. By constructing a sample dataset, optimizing the hyperparameters of the LSSVM model, establishing a temperature-measurement noise covariance mapping table, and combining it with an adaptive Kalman filter for filtering and updating, accurate compensation of magnetic induction intensity and voltage signal is achieved.
It significantly improves the measurement accuracy and anti-interference capability of magnetoelectric angular displacement sensors in a wide temperature range, reduces output error, and improves measurement stability and response speed in complex environments.
Smart Images

Figure CN122170748A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of precision measurement and sensor signal processing technology, specifically to a temperature compensation method and system for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering. Background Technology
[0002] Magnetoelectric angular displacement sensors, with their significant advantages such as small size, compact structure, strong resistance to contamination, and low manufacturing cost, are widely used in precision position measurement fields such as industrial machine tools, servo motors, and robot joints. The working principle of this type of sensor is to detect changes in the rotating magnetic field using a Hall effect sensor, thereby outputting a corresponding voltage signal. Finally, the rotational position of the rotor is calculated based on this voltage signal, achieving accurate detection of angular displacement.
[0003] Temperature stability is one of the core performance indicators of magnetoelectric angular displacement sensors. With the continuous development of modern industrial technology, especially in high-end fields such as military industry, more stringent requirements have been put forward for magnetoelectric angular displacement sensors. They not only need to have a wide operating temperature range (usually -40℃ to 125℃), but also need to have a strong ability to adapt to complex environments to ensure that stable and accurate angular displacement measurement can still be achieved under extreme temperature conditions.
[0004] However, in practical applications, the magnetic field acquisition accuracy of magnetoelectric angular displacement sensors is easily affected by ambient temperature, resulting in significant fluctuations. The problems caused by this are as follows:
[0005] 1. Sensitivity Drift: The sensitivity of the Hall / magnetoresistive element changes with temperature, causing the amplitude of the output voltage signal to drift.
[0006] 2. Zero-point drift: The DC bias (i.e., zero point) of the output signal will drift with temperature changes, introducing a fixed angle measurement error;
[0007] 3. Phase error: For sensors that output quadrature signals, temperature changes may cause the orthogonality of the two signals to deteriorate, resulting in phase error;
[0008] IV. Increased electronic noise: Under high temperature conditions, the electronic noise of the sensor and subsequent circuits will increase significantly, resulting in a decrease in the signal-to-noise ratio and further affecting the measurement accuracy.
[0009] Currently, while various methods exist for temperature compensation of magnetoelectric angular displacement sensors, they generally suffer from significant limitations, failing to meet the demands of modern industry for high-precision and high-stability measurements. Specifically, these limitations manifest in the following ways: amplitude normalization methods can only compensate for temperature variations in signal amplitude, failing to address measurement deviations caused by zero-point drift and phase errors; polynomial fitting methods, while computationally simple and easy to implement, struggle to accurately fit complex nonlinear curves during temperature drift, resulting in limited compensation accuracy; lookup table methods, while achieving high compensation accuracy, require substantial storage resources and cannot smooth dynamic noise, impacting dynamic measurement performance; and fixed-parameter Kalman filtering methods cannot adapt to the dynamic characteristics of sensor noise changes with temperature and are prone to angular hysteresis in high-speed rotor rotation scenarios, leading to decreased measurement accuracy.
[0010] In summary, existing temperature compensation methods for magnetoelectric angular displacement sensors all have their own shortcomings, making it difficult to simultaneously meet the comprehensive requirements of accurately fitting nonlinear temperature drift, adaptively suppressing noise based on temperature, and tracking high-speed rotation angle changes. Therefore, there is an urgent need to develop a novel temperature compensation method for magnetoelectric angular displacement sensors to overcome existing technological bottlenecks, improve the measurement accuracy and environmental adaptability of magnetoelectric angular displacement sensors over a wide temperature range, and meet the application needs of high-end fields such as industrial machine tools and military applications. Summary of the Invention
[0011] To address the shortcomings of the existing technologies, this invention provides a temperature compensation method and system for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, thereby solving the problem that existing technologies cannot simultaneously satisfy the requirements of accurately fitting nonlinear temperature drift, adaptively suppressing noise based on temperature, and tracking high-speed rotation angle changes.
[0012] The first aspect of this invention provides a temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, comprising the following steps:
[0013] S1. Under multiple standard magnetic induction intensity conditions, collect the original voltage signals output by the Hall sensor at different ambient temperatures, and record the corresponding ambient temperature and the true value of magnetic induction intensity to construct a sample dataset.
[0014] S2. Divide all samples in the sample dataset into training set and validation set according to the proportion, where each sample includes the original voltage signal, ambient temperature and true value of magnetic induction intensity;
[0015] S3. Construct an initial LSSVM nonlinear compensation model based on Least Squares Support Vector Machine (LSSVM), and use Particle Swarm Optimization (PSO) algorithm to adaptively optimize the hyperparameters in the initial LSSVM nonlinear compensation model to obtain the optimal hyperparameter combination. The hyperparameters to be optimized include regularization parameters. and kernel parameters ;
[0016] S4. Substitute the optimal hyperparameter combination into the initial LSSVM nonlinear compensation model, and retrain the initial LSSVM nonlinear compensation model based on all samples in the sample dataset to obtain the target LSSVM nonlinear compensation model.
[0017] S5. Use the target LSSVM nonlinear compensation model to predict all samples in the sample dataset, obtain the prediction residuals corresponding to each sample, and statistically analyze the prediction residuals according to the preset temperature range to construct a temperature-measurement noise covariance mapping table.
[0018] S6. During online operation, the original voltage signal and ambient temperature at the current moment are acquired and input into the target LSSVM nonlinear compensation model to obtain the preliminary compensation estimate of the magnetic flux density. Then, combined with the ambient temperature at the current moment and the temperature-measurement noise covariance mapping table, the adaptive Kalman filter is used for filtering and updating to obtain the final compensation output at the current moment. The final compensation output at the current moment includes the final compensation estimate of the magnetic flux density and the final compensation estimate of the voltage output.
[0019] Preferably, the mathematical model of the original voltage signal output by the Hall sensor is as follows:
[0020]
[0021] In the formula, The original voltage signal is nonlinearly varied with ambient temperature T and the actual magnetic flux density B. The zero-point voltage that varies nonlinearly with ambient temperature T. The sensitivity varies non-linearly with ambient temperature T, and B is the true magnetic flux density acting on the Hall sensor. It follows a normal distribution, where n is the noise term. With a mean of 0 and a variance of Gaussian white noise;
[0022] The initial LSSVM nonlinear compensation model uses the original voltage signal and ambient temperature as input data, and the predicted magnetic flux density as output data. The input data is expressed in the following form: , The original voltage signal is given, and T represents the ambient temperature. The symbol is the transpose; the decision function of the initial LSSVM nonlinear compensation model is shown in the following equation:
[0023]
[0024] In the formula, This represents the output at the current moment, i.e., the predicted magnetic field strength; N is the number of samples. For Lagrange multipliers, It is a natural exponential function; This is the input vector at the current moment, i.e., the actual input vector during prediction. ; Let b be the input vector of the i-th sample in the training set, where i is the sample index and b is the bias term.
[0025] Preferably, the steps for adaptively optimizing the hyperparameters in the initial LSSVM nonlinear compensation model using the Particle Swarm Optimization (PSO) algorithm are as follows:
[0026] S31. Initialize the particle swarm, where each particle position represents a set of hyperparameter combinations. , );
[0027] S32. In each iteration, for each particle, the initial LSSVM nonlinear compensation model is trained separately using the training set, and the root mean square error (RMSE) of the prediction is calculated using the validation set as the fitness value of the particle.
[0028] S33. Update particle velocity and position, and proceed to the next iteration until a preset termination condition is met, at which point the optimization stops. The preset termination condition is either reaching the maximum number of iterations or all particles having a fitness value less than a preset fitness threshold. The particle velocity update formula is shown below:
[0029]
[0030] In the formula, , Let be the velocity vector of the j-th particle at generation t+1 and t. For inertial weights, , For learning factors; , The coefficients are randomized within the range [0,1]. Let be the individual historical best position of the j-th particle. Let be the position vector of the j-th particle in generation t. The optimal position for the group;
[0031] S34. After stopping the search for optimization, select the particle with the smallest fitness value among all particles, and take the hyperparameter combination corresponding to this particle as the optimal hyperparameter combination.
[0032] Preferably, step S5 specifically includes:
[0033] S51. Use the target LSSVM nonlinear compensation model to predict all samples in the sample dataset and obtain the predicted value of magnetic induction intensity for each sample.
[0034] S52. Based on the true value and predicted value of magnetic induction intensity for each sample, the prediction residual for each sample is obtained, as shown in the following formula:
[0035]
[0036] In the formula, Let be the prediction residual for the i-th sample. Let be the true value of the magnetic field strength of the i-th sample. Let be the predicted value of the magnetic flux density for the i-th sample;
[0037] S53. Divide the temperature range into multiple temperature ranges according to the preset interval, and assign each sample to the corresponding temperature range based on the ambient temperature of the sample.
[0038] S54. For each temperature range, calculate the variance of the prediction residuals of all samples within that range, and use this variance as the estimated value of the measurement noise covariance for the corresponding temperature range. The formula for calculating the estimated value of the measurement noise covariance for each temperature range is as follows:
[0039]
[0040] In the formula, This is the estimated value of the measurement noise covariance for the m-th temperature interval. Let be the number of samples in the m-th temperature interval. Let be the prediction residual of the i-th sample within the m-th temperature interval. Let be the mean residual of all samples within the m-th temperature interval. To prevent the matrix from having singularly small positive numbers;
[0041] S55. Establish a correspondence between each temperature range and its corresponding estimated measurement noise covariance value to form a temperature-measurement noise covariance mapping table.
[0042] Preferably, the state equation of the adaptive Kalman filter is a random walk model, as shown in the following equation:
[0043]
[0044] In the formula, , Let k and k-1 be the actual magnetic flux density state quantities. Let Q be the process noise at time k-1, and let Q be the process noise covariance.
[0045] Among them, the process noise covariance is determined by comparing the tracking response speed, hysteresis and stability corresponding to different process noise covariances based on the actual dynamic change characteristics of the magnetic field through multiple sets of experiments.
[0046] Preferably, the process noise covariance Q = 100.0.
[0047] Preferably, step S6 specifically includes:
[0048] S61. Based on the filtering results of the previous time step, namely the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the previous time step, calculate the prior prediction of the magnetic flux density and the prior prediction of the error covariance at the current time step, as shown in the following formula:
[0049]
[0050]
[0051] In the formula, Let be the prior predicted value of the magnetic field strength at time k. Let be the posterior estimate of the magnetic field strength at time k-1. Let be the prior predicted value of the error covariance at time k. This is the posterior estimate of the error covariance at time k-1;
[0052] S62. Based on the current ambient temperature, obtain the estimated value of the measurement noise covariance corresponding to the current ambient temperature from the temperature-measurement noise covariance mapping table.
[0053] S63. Based on the prior predicted value of the error covariance at the current moment and the estimated value of the measurement noise covariance corresponding to the ambient temperature at the current moment, calculate the Kalman gain at the current moment, as shown in the following formula:
[0054]
[0055] In the formula, The Kalman gain at time k, Let k be the estimated value of the measurement noise covariance corresponding to the ambient temperature at time k.
[0056] S64. Using the preliminary compensated magnetic flux density estimate at the current moment as the observed value, obtain the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the current moment based on the Kalman gain at the current moment, as shown in the following formula:
[0057]
[0058]
[0059] In the formula, Let be the posterior estimate of the magnetic field strength at time k. The value of the magnetic flux density after initial compensation at time k is the estimated value. Let be the posterior estimate of the error covariance at time k;
[0060] S65. The posterior estimate of the magnetic field strength at the current moment is used as the final compensated estimate of the magnetic field strength at the current moment, i.e. ;
[0061] S66. Based on the preset magnetic flux density-voltage conversion relationship, convert the final compensated magnetic flux density estimate at the current moment into the final compensated voltage output estimate at the current moment, wherein the preset magnetic flux density-voltage conversion relationship is:
[0062]
[0063] In the formula, This represents the final compensated voltage output estimate at time k. The zero-point voltage is at a reference temperature of 25°C. Sensitivity at a reference temperature of 25°C. This is the final compensated estimate of the magnetic flux density at time k;
[0064] S67. Use the final compensated magnetic flux density estimate and the final compensated voltage output estimate at the current time as the final compensated output at the current time. At the same time, save the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the current time for use in the next sampling time.
[0065] Preferably, based on the current ambient temperature, the estimated measurement noise covariance value corresponding to the current ambient temperature is obtained from the temperature-measurement noise covariance mapping table using the method of "interval center value matching + linear interpolation". Specifically:
[0066] If the ambient temperature at the current moment is equal to the center value of any temperature range, then the estimated measurement noise covariance value corresponding to that temperature range is the estimated measurement noise covariance value at the current moment, where the center value of the temperature range is the arithmetic mean of the lower limit and the upper limit of the temperature range.
[0067] If the current ambient temperature is not equal to the center value of any temperature interval, then the smaller and larger adjacent center values are determined. The measurement noise covariance estimates corresponding to the temperature intervals containing these two adjacent center values are obtained, and linear interpolation is used to calculate the measurement noise covariance estimate for the current moment. The smaller adjacent center value is the largest interval center value that is less than the current ambient temperature, and the larger adjacent center value is the smallest interval center value that is greater than the current ambient temperature. The linear interpolation calculation formula is shown below:
[0068]
[0069] In the formula, Let be the estimated measurement noise covariance value corresponding to the ambient temperature at time k. This represents the estimated measurement noise covariance for the temperature range containing smaller adjacent center values. Let k be the ambient temperature. For smaller neighboring center values, For larger neighboring center values, This is the estimated measurement noise covariance value corresponding to the temperature range where the larger adjacent center values are located.
[0070] Preferably, the Hall sensor is a dual-channel orthogonal Hall sensor. For each of the two Hall channels, a corresponding target LSSVM nonlinear compensation model and a temperature-measurement noise covariance mapping table are constructed. Subsequently, for each Hall channel, nonlinear compensation is performed using its corresponding target LSSVM nonlinear compensation model to obtain its corresponding preliminary compensated magnetic flux density estimate. Then, based on its corresponding temperature-measurement noise covariance mapping table, the preliminary compensated magnetic flux density estimate, and the ambient temperature, an adaptive Kalman filter is used for filtering and updating to obtain its corresponding final compensated magnetic flux density estimate. Finally, based on the final compensated magnetic flux density estimates of the two Hall channels, the angular displacement detection angle is obtained, and the calculation formula is shown below:
[0071]
[0072] In the formula, Let k be the angular displacement detection angle at time k. This represents the final compensated estimate of the magnetic flux density at time k in the first Hall effect. This is the final compensated estimate of the magnetic flux density at time k of the second Hall effect.
[0073] A second aspect of the present invention provides a temperature compensation system for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, used to perform a temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, comprising:
[0074] The Hall sensor unit is used to detect the magnetic flux density at the current moment and output the corresponding raw voltage signal, which is then transmitted to the MCU unit.
[0075] The temperature acquisition unit is used to acquire the ambient temperature of the Hall sensor unit at the current moment and transmit it to the MCU unit;
[0076] The MCU unit includes a storage module and a processing module. The storage module stores the target LSSVM nonlinear compensation model and the temperature-measurement noise covariance mapping table. The processing module receives the raw voltage signal and ambient temperature at the current moment and inputs them into the target LSSVM nonlinear compensation model to obtain the preliminary compensated magnetic flux density estimate. Then, based on the preliminary compensated magnetic flux density estimate, the temperature-measurement noise covariance mapping table, and the ambient temperature at the current moment, it uses an adaptive Kalman filter to perform filtering and updating to obtain the final compensation output at the current moment.
[0077] The power supply unit is used to power the Hall sensor unit, temperature acquisition unit, and MCU unit.
[0078] Compared with the prior art, the present invention has the following beneficial effects:
[0079] 1. This invention constructs an initial LSSVM nonlinear compensation model based on Least Squares Support Vector Machine (LSSVM), fully utilizing the excellent nonlinear approximation and generalization capabilities of LSSVM. Subsequently, the key parameters of the initial LSSVM nonlinear compensation model are automatically optimized globally using the Particle Swarm Optimization (PSO) algorithm. This avoids parameter bias and low modeling efficiency caused by manual trial and error, and converges to the globally optimal parameter combination in a shorter time. This accurately fits the sensitivity drift characteristics of the magnetoelectric angular displacement sensor over a wide temperature range, significantly suppressing temperature-induced nonlinear errors. Experimental results show that the root mean square error (RMSE) of the magnetoelectric angular displacement sensor output after compensation by this method is reduced by more than 90% compared to before compensation, significantly improving the measurement accuracy and output consistency of the magnetoelectric angular displacement sensor across the entire operating temperature range.
[0080] 2. This invention constructs a temperature-measurement noise covariance mapping table, enabling the adaptive Kalman filter to adaptively adjust the observation noise and filter gain according to the real-time temperature conditions. This achieves dynamic matching of noise suppression strategies, i.e., automatically enhancing the filtering smoothing effect in high-temperature and high-noise environments to effectively suppress environmental interference; and improving the system response speed under low-temperature steady-state conditions, balancing filtering smoothness and measurement real-time performance. This significantly improves the anti-interference capability and output stability of the magnetoelectric angular displacement sensor in complex temperature change scenarios.
[0081] 3. This invention improves the dynamic response performance and signal tracking bandwidth of the adaptive Kalman filter to rapidly changing magnetic field signals by optimizing and matching the process noise covariance Q value. This enables the adaptive Kalman filter to quickly capture and follow the instantaneous changes and dynamic disturbances of the magnetic field signal, effectively improving the phase lag and dynamic distortion problems of traditional fixed parameter filters. It ensures that the magnetoelectric angular displacement sensor still has excellent tracking accuracy and response characteristics under dynamic measurement conditions, and expands the application range of the magnetoelectric angular displacement sensor in dynamic angular displacement detection scenarios. Attached Figure Description
[0082] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0083] Figure 1 This is a sensitivity response curve of the A1301 Hall sensor under different ambient temperatures in an embodiment of the present invention;
[0084] Figure 2 This is a flowchart of the temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering in this invention.
[0085] Figure 3 This is a schematic representation of the temperature-measurement noise covariance mapping in an embodiment of the present invention;
[0086] Figure 4 This is a curve showing the dynamic variation characteristics of the core parameters of the adaptive Kalman filter in a wide temperature range of -50℃ to 125℃ in an embodiment of the present invention.
[0087] Figure 5 This is a comparison chart of the real, uncompensated, and compensated magnetic induction intensity curves in this invention.
[0088] Figure 6 This is a comparison chart of the original voltage signal curves in this invention: the original voltage signal without compensation and the original voltage signal after compensation.
[0089] Figure 7 This is a structural diagram of the temperature compensation system for the magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering in this invention. Detailed Implementation
[0090] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. 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.
[0091] 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. The terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, unless otherwise explicitly specified and limited, the terms "installed," "connected," and "linked" 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.
[0092] like Figure 1 As shown, this application takes the common A1301 Hall sensor as an example. Within the typical operating temperature range of -40℃ to 125℃, its sensitivity exhibits a significant nonlinear drift with changes in ambient temperature. From... Figure 1 It is evident that as the ambient temperature rises from approximately -40℃ to 125℃, the sensitivity of the A1301 Hall sensor, regardless of whether it is in the UA or LH package, generally shows an increasing trend. This sensitivity fluctuation caused by ambient temperature leads to significant errors in the measurement of magnetic induction intensity, severely affecting the accuracy and long-term stability of the sensor's angular displacement measurement. Therefore, this application aims to effectively compensate for this nonlinear temperature drift to eliminate the influence of ambient temperature on the measurement results and improve the accuracy of the final measurement.
[0093] When a conventional encoder is working, the Hall sensor collects the magnetic flux density value of the motor rotor and converts it into a raw voltage signal, which is then output to the MCU unit. The MCU unit calculates the obtained raw voltage signal to obtain the rotational position of the rotor and feeds it back to the motor controller. The motor controller implements closed-loop regulation based on this position signal and outputs corresponding position control commands to the motor to complete the motor position servo control.
[0094] This invention, based on the traditional encoder signal acquisition and processing architecture, adds ambient temperature data, a target LSSVM nonlinear compensation model, and a temperature-measurement noise covariance mapping table. Its working principle is as follows: First, the MCU unit acquires the current raw voltage signal and ambient temperature as input. The temperature-affected magnetic flux density value is initially corrected using a preset target LSSVM nonlinear compensation model, resulting in a preliminary compensated estimate of the magnetic flux density. Second, based on the preliminary compensated estimate of the magnetic flux density, the temperature-measurement noise covariance mapping table, and the current ambient temperature, an adaptive Kalman filter is used for filtering and updating to obtain the final compensated estimate of the magnetic flux density, which is then converted into the final compensated estimate of the voltage output. This weakens or eliminates the measurement drift caused by changes in ambient temperature, thereby achieving high-precision measurement of the magnetoelectric angular displacement sensor over a wide temperature range.
[0095] It should be emphasized that after obtaining the final compensated voltage output estimate in this method, the subsequent position calculation and motor control process can be implemented using conventional encoder processing procedures in this field.
[0096] like Figure 2 As shown, the first aspect of this invention provides a temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, comprising the following steps:
[0097] S1. Under multiple standard magnetic induction intensity conditions, collect the original voltage signals output by the Hall sensor at different ambient temperatures, and record the corresponding ambient temperature and the true value of magnetic induction intensity to construct a sample dataset.
[0098] It should be noted that the standard magnetic induction intensity condition is a known magnetic induction intensity condition provided by a standard magnetic field generating device or a high-precision calibration device.
[0099] In this application, the ambient temperature range is set to -50℃ to 125℃. This range covers typical application scenarios of Hall sensors in low-temperature start-up, normal-temperature operation, and high-temperature extreme conditions, to ensure that the sample dataset can fully reflect the characteristics of the Hall sensor across the entire temperature range.
[0100] It should be noted that although the typical operating temperature range of Hall sensors is usually -40℃ to 125℃, a wider range of ambient temperature was deliberately used in this application to verify the robustness of the method.
[0101] In this application, the mathematical model of the original voltage signal output by the Hall sensor is as follows:
[0102]
[0103] In the formula, The original voltage signal is nonlinearly varied with ambient temperature T and the actual magnetic flux density B. The zero-point voltage is nonlinearly variable with ambient temperature T. The sensitivity varies non-linearly with ambient temperature T, and B is the true magnetic flux density acting on the Hall sensor. It follows a normal distribution, where n is the noise term. With a mean of 0 and a variance of Gaussian white noise.
[0104] S2. Divide all samples in the sample dataset into training set and validation set according to the proportion, where each sample includes the original voltage signal, ambient temperature and true value of magnetic induction intensity.
[0105] In this embodiment of the application, all samples in the sample dataset are divided into a training set and a validation set in a ratio of 8:2.
[0106] S3. Construct an initial LSSVM nonlinear compensation model based on Least Squares Support Vector Machine (LSSVM), and use Particle Swarm Optimization (PSO) algorithm to adaptively optimize the hyperparameters in the initial LSSVM nonlinear compensation model to obtain the optimal hyperparameter combination. The hyperparameters to be optimized include regularization parameters. and kernel parameters .
[0107] In this application, the initial LSSVM nonlinear compensation model uses the original voltage signal and ambient temperature as input data, and the predicted magnetic flux density as output data. The input data is expressed in the following form: , The original voltage signal is given, and T represents the ambient temperature. This is the transpose symbol.
[0108] In this application, the decision function of the initial LSSVM nonlinear compensation model is shown in the following equation:
[0109]
[0110] In the formula, This represents the output at the current moment, i.e., the predicted magnetic field strength; N is the number of samples. For Lagrange multipliers, It is a natural exponential function; This is the input vector at the current moment, i.e., the actual input vector during prediction. ; Let b be the input vector of the i-th sample in the training set, where i is the sample index and b is the bias term.
[0111] In this application, the specific steps for adaptively optimizing the hyperparameters in the initial LSSVM nonlinear compensation model using the particle swarm optimization algorithm (PSO) are as follows:
[0112] S31. Initialize the particle swarm, where each particle position represents a set of hyperparameter combinations. , ).
[0113] S32. In each iteration, for each particle, the initial LSSVM nonlinear compensation model is trained separately using the training set, and the root mean square error (RMSE) of the prediction is calculated using the validation set as the fitness value of the particle.
[0114] S33. Update particle velocity and position, and proceed to the next iteration until a preset termination condition is met, at which point the optimization stops. The preset termination condition is either reaching the maximum number of iterations or all particles having a fitness value less than a preset fitness threshold. The particle velocity update formula is shown below:
[0115]
[0116] In the formula, , Let be the velocity vector of the j-th particle at generation t+1 and t. For inertial weights, , For learning factors; , The coefficients are randomized within the range [0,1]. Let be the individual historical best position of the j-th particle. Let be the position vector of the j-th particle in generation t. This is the optimal position for the group.
[0117] In this embodiment, the number of particles is 30, the maximum number of iterations is 50, and the inertia weight is... The fitness score is 0.8, and the preset fitness threshold is 10. -6 .
[0118] S34. After stopping the search for optimization, select the particle with the smallest fitness value among all particles, and take the hyperparameter combination corresponding to this particle as the optimal hyperparameter combination.
[0119] It should be noted that in Least Squares Support Vector Machine (LSSVM), the regularization parameter... It can balance model complexity and fitting error, preventing overfitting and thus improving generalization ability; kernel parameters Controlling the radial basis function kernel width affects the model's nonlinear mapping capability. Both the radial basis function kernel width and the learning factor c1 and c2 have the greatest impact on the performance of the Least Squares Support Vector Machine (LSSVM). Other parameters, such as learning factors c1 and c2, have a relatively smaller impact on LSSVM. Therefore, to simplify the parameter optimization process and reduce computational complexity, this application uses the Particle Swarm Optimization (PSO) algorithm to optimize the hyperparameters in the initial LSSVM nonlinear compensation model, focusing the optimization efforts on the regularization parameter. and kernel parameters These are the two key hyperparameters; the remaining hyperparameters are set using empirical values.
[0120] S4. Substitute the optimal hyperparameter combination into the initial LSSVM nonlinear compensation model, and retrain the initial LSSVM nonlinear compensation model based on all samples in the sample dataset to obtain the target LSSVM nonlinear compensation model.
[0121] S5. Use the target LSSVM nonlinear compensation model to predict all samples in the sample dataset, obtain the prediction residuals corresponding to each sample, and statistically analyze the prediction residuals according to the preset temperature range to construct a temperature-measurement noise covariance mapping table.
[0122] In this application, step S5 specifically includes:
[0123] S51. Use the target LSSVM nonlinear compensation model to predict all samples in the sample dataset and obtain the predicted value of magnetic induction intensity for each sample.
[0124] S52. Based on the true value and predicted value of magnetic induction intensity for each sample, the prediction residual for each sample is obtained, as shown in the following formula:
[0125]
[0126] In the formula, Let be the prediction residual for the i-th sample. Let be the true value of the magnetic field strength of the i-th sample. Let be the predicted value of the magnetic flux density for the i-th sample.
[0127] S53. Divide the temperature range into multiple temperature ranges according to the preset interval, and assign each sample to the corresponding temperature range based on the ambient temperature of the sample.
[0128] S54. For each temperature range, calculate the variance of the prediction residuals of all samples within that range, and use this variance as the estimated value of the measurement noise covariance for the corresponding temperature range. The formula for calculating the estimated value of the measurement noise covariance for each temperature range is as follows:
[0129]
[0130] In the formula, This is the estimated value of the measurement noise covariance for the m-th temperature interval. Let be the number of samples in the m-th temperature interval. Let be the prediction residual of the i-th sample within the m-th temperature interval. Let be the mean residual of all samples within the m-th temperature interval. To prevent the matrix from having singular, extremely small positive numbers.
[0131] In the embodiments of this application, =10 -6 .
[0132] S55. Establish a correspondence between each temperature range and its corresponding estimated measurement noise covariance value to form a temperature-measurement noise covariance mapping table.
[0133] The temperature-measurement noise covariance mapping representation constructed in this application is intended to be as follows: Figure 3 As shown in the embodiment of this application, the preset temperature range is divided into intervals of 5°C, forming a series of continuous temperature ranges.
[0134] S6. During online operation, the original voltage signal and ambient temperature at the current moment are acquired and input into the target LSSVM nonlinear compensation model to obtain the preliminary compensation estimate of the magnetic flux density. Then, combined with the ambient temperature at the current moment and the temperature-measurement noise covariance mapping table, the adaptive Kalman filter is used for filtering and updating to obtain the final compensation output at the current moment. The final compensation output at the current moment includes the final compensation estimate of the magnetic flux density and the final compensation estimate of the voltage output.
[0135] In this application, the state equation of the adaptive Kalman filter is a random walk model, as shown in the following equation:
[0136]
[0137] In the formula, , Let k and k-1 be the actual magnetic flux density state quantities. Let Q be the process noise at time k-1, and let Q be the process noise covariance.
[0138] It should be noted that the terms "true magnetic flux density acting on the Hall sensor," "true magnetic flux density value of the sample," and "true magnetic flux density state quantity" used in this application are semantically similar but have different substantive meanings. Specifically, the true magnetic flux density acting on the Hall sensor is an objectively existing physical value, which is the object to be measured in the Hall sensor measurement system; the true magnetic flux density value of the sample is a benchmark reference value provided by a high-precision standard device during the calibration and model training phases, used to construct the dataset and serve as a label for model training; and the true magnetic flux density state quantity is the state variable to be estimated in the adaptive Kalman filter, which achieves noise suppression and optimal state estimation through filtering recursion.
[0139] Preferably, the process noise covariance is determined based on the actual dynamic change characteristics of the magnetic field, by comparing the tracking response speed, hysteresis and stability corresponding to different process noise covariances through multiple sets of experiments.
[0140] In this application, the process noise covariance Q = 100.0.
[0141] In this application, by setting the state equation of the adaptive Kalman filter as a random walk model, it can adapt to the characteristics of rapid changes in the magnetic field under high-speed rotation. At the same time, by optimizing the process noise covariance to 100.0, the response speed and tracking ability of the adaptive Kalman filter to dynamically changing signals can be improved, enabling the adaptive Kalman filter to quickly follow the sudden changes in the magnetic field. This avoids the angle lag and phase delay problems caused by the traditional fixed parameter Kalman filter due to the process noise setting being too small, and significantly improves the dynamic measurement accuracy under high-speed rotation conditions.
[0142] It should be noted that the optimized selection of the process noise covariance in this application fully considers the dynamic characteristics of the actual magnetic field. Since the actual magnetic field is not static but undergoes continuous dynamic change, its variation is complex and difficult to predict accurately. This places extremely high demands on the setting of the process noise covariance in the tracking algorithm. To accurately determine the most suitable process noise covariance, this application conducted a series of comparative experiments. During the experiments, different process noise covariances were set, and corresponding tracking algorithms were used to simulate the tracking of the actual magnetic field. By meticulously recording the performance indicators of the tracking algorithm in each set of experiments, including key parameters such as tracking response speed, hysteresis, and stability, a comprehensive and in-depth comparative analysis of the tracking effect under different process noise covariances was conducted. Experimental results show that when Q is 100.0, the adaptive Kalman filter achieves a better balance between tracking response speed, hysteresis, and stability. Therefore, in this embodiment, the preferred process noise covariance Q is 100.0.
[0143] In this application, step S6 specifically includes:
[0144] S61. Based on the filtering results of the previous time step, namely the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the previous time step, calculate the prior prediction of the magnetic flux density and the prior prediction of the error covariance at the current time step, as shown in the following formula:
[0145]
[0146]
[0147] In the formula, Let be the prior predicted value of the magnetic field strength at time k. Let be the posterior estimate of the magnetic field strength at time k-1. Let be the prior predicted value of the error covariance at time k. This is the posterior estimate of the error covariance at time k-1.
[0148] S62. Based on the current ambient temperature, obtain the estimated value of the measurement noise covariance corresponding to the current ambient temperature from the temperature-measurement noise covariance mapping table.
[0149] In this embodiment of the application, based on the current ambient temperature, the estimated value of the measurement noise covariance corresponding to the current ambient temperature is obtained from the temperature-measurement noise covariance mapping table using the method of "interval center value matching + linear interpolation". Specifically:
[0150] If the ambient temperature at the current moment is equal to the center value of any temperature range, then the estimated measurement noise covariance value corresponding to that temperature range is the estimated measurement noise covariance value at the current moment, where the center value of the temperature range is the arithmetic mean of the lower limit and the upper limit of the temperature range.
[0151] If the current ambient temperature is not equal to the center value of any temperature interval, then the smaller and larger adjacent center values are determined. The measurement noise covariance estimates corresponding to the temperature intervals containing these two adjacent center values are obtained, and linear interpolation is used to calculate the measurement noise covariance estimate for the current moment. The smaller adjacent center value is the largest interval center value that is less than the current ambient temperature, and the larger adjacent center value is the smallest interval center value that is greater than the current ambient temperature. The linear interpolation calculation formula is shown below:
[0152]
[0153] In the formula, Let be the estimated measurement noise covariance value corresponding to the ambient temperature at time k. This represents the estimated measurement noise covariance for the temperature range containing smaller adjacent center values. Let k be the ambient temperature. For smaller neighboring center values, For larger neighboring center values, This is the estimated measurement noise covariance value corresponding to the temperature range where the larger adjacent center values are located.
[0154] In this embodiment of the application, multiple consecutive temperature ranges with a preset temperature interval of 5℃ are included, such as -2.5℃~2.5℃, 2.5℃~7.5℃, 7.5℃~12.5℃, 12.5℃~17.5℃, 17.5℃~22.5℃, etc., where the center values of these temperature ranges are [0, 5, 10, 15, 20, ...], and the estimated values of the measurement noise covariance corresponding to these temperature ranges are [0.25, 0.28, 0.34, 0.39, 0.41, ...].
[0155] If the ambient temperature at the current moment is 5℃, this value corresponds exactly to the center value of the interval between 2.5℃ and 7.5℃. In this case, the measurement noise covariance estimate corresponding to this temperature interval, i.e., 0.28, is directly selected as the measurement noise covariance estimate at the current moment.
[0156] If the current ambient temperature is 12.8℃, and this value is not equal to the center value of any interval, then determine the smaller adjacent center value (i.e., 10) and the larger adjacent center value (i.e., 15). Then, use the measurement noise covariance estimates corresponding to the temperature intervals containing these two adjacent center values to perform linear interpolation. At this point, the measurement noise covariance estimate for the current time is = =0.37.
[0157] Preferably, if the ambient temperature at the current moment is less than the center value of the minimum temperature range, then the measurement noise covariance estimate corresponding to the minimum temperature range is taken as the measurement noise covariance estimate at the current moment; if the ambient temperature at the current moment is greater than the center value of the maximum temperature range, then the measurement noise covariance estimate corresponding to the maximum temperature range is taken as the measurement noise covariance estimate at the current moment.
[0158] S63. Based on the prior predicted value of the error covariance at the current moment and the estimated value of the measurement noise covariance corresponding to the ambient temperature at the current moment, calculate the Kalman gain at the current moment, as shown in the following formula:
[0159]
[0160] In the formula, The Kalman gain at time k, Let be the estimated value of the measurement noise covariance corresponding to the ambient temperature at time k.
[0161] like Figure 4As shown, this application plots the dynamic variation characteristics of the core parameters of the adaptive Kalman filter—Kalman gain and measurement noise covariance estimates—over a wide temperature range of -50℃ to 125℃. From... Figure 4 It is evident that the estimated measurement noise covariance gradually increases with rising ambient temperature. This trend closely matches the physical characteristic of increased output noise in Hall effect angular displacement sensors at high temperatures, achieving real-time adaptive matching of the estimated measurement noise covariance to the actual noise level of the sensor. The Kalman gain and the estimated measurement noise covariance form a negative correlation, remaining stably constrained within the range of 0.88 to 0.97 throughout the entire process, dynamically adjusting synchronously with rising ambient temperature. This adaptive adjustment mechanism enables the adaptive Kalman filter to maintain high response speed under low-temperature, low-noise conditions and enhance noise suppression capability under high-temperature, high-noise conditions. It fundamentally solves the inherent contradiction of "response speed and noise suppression capability being mutually exclusive" in traditional fixed-parameter Kalman filters, verifying the effectiveness and robustness of the adaptive Kalman filter used in this method within a wide temperature range of -50℃ to 125℃, providing solid support for high-precision measurement of magnetoelectric angular displacement sensors across the entire temperature range.
[0162] S64. Using the preliminary compensated magnetic flux density estimate at the current moment as the observed value, obtain the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the current moment based on the Kalman gain at the current moment, as shown in the following formula:
[0163]
[0164]
[0165] In the formula, Let be the posterior estimate of the magnetic field strength at time k. The value of the magnetic flux density after initial compensation at time k is the estimated value. Let be the posterior estimate of the error covariance at time k.
[0166] S65. The posterior estimate of the magnetic field strength at the current moment is used as the final compensated estimate of the magnetic field strength at the current moment, i.e. .
[0167] S66. Based on the preset magnetic flux density-voltage conversion relationship, convert the final compensated magnetic flux density estimate at the current moment into the final compensated voltage output estimate at the current moment, wherein the preset magnetic flux density-voltage conversion relationship is:
[0168]
[0169] In the formula, This represents the final compensated voltage output estimate at time k. The zero-point voltage is at a reference temperature of 25°C. Sensitivity at a reference temperature of 25°C. This is the final compensated estimate of the magnetic flux density at time k.
[0170] S67. Use the final compensated magnetic flux density estimate and the final compensated voltage output estimate at the current time as the final compensated output at the current time. At the same time, save the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the current time for use in the next sampling time.
[0171] In this application, the Hall sensor is a dual-channel orthogonal Hall sensor. For each of the two Hall channels, a corresponding target LSSVM nonlinear compensation model and a temperature-measurement noise covariance mapping table are constructed. Subsequently, for each Hall channel, nonlinear compensation is performed using its corresponding target LSSVM nonlinear compensation model to obtain its corresponding preliminary compensated magnetic flux density estimate. Then, based on its corresponding temperature-measurement noise covariance mapping table, the preliminary compensated magnetic flux density estimate, and the ambient temperature, an adaptive Kalman filter is used for filtering and updating to obtain its corresponding final compensated magnetic flux density estimate. Finally, based on the final compensated magnetic flux density estimates of the two Hall channels, the angular displacement detection angle is obtained, and the calculation formula is shown below:
[0172]
[0173] In the formula, Let k be the angular displacement detection angle at time k. This represents the final compensated estimate of the magnetic flux density at time k in the first Hall effect. This is the final compensated estimate of the magnetic flux density at time k of the second Hall effect.
[0174] It should be noted that the embodiment of this application does not impose a unique limitation on the definition of the ratio of the estimated magnetic flux density of the two Hall signals after final compensation at time k. In practical applications, technicians can set which signal is used as the numerator and which signal as the denominator according to specific needs. The key is that the correspondence between the numerator and denominator must remain consistent within the same operating system to ensure the uniformity of the calculation logic.
[0175] To verify the effectiveness of this method, 2000 sets of samples were collected in an environment ranging from -50℃ to 125℃. Simulation tests were then conducted, with the simulation environment temperature range set to -50℃ to 125℃, consistent with the sample's ambient temperature range. Simulation results show that, within the full temperature range of -50℃ to 125℃, after compensation using this method, the root mean square error (RMSE) of the magnetic induction intensity decreased from 45.67G before compensation to 3.24G, a reduction of 92.9%. Simultaneously, the deviation of the original voltage signal output by the magnetoelectric angular displacement sensor improved by 93.5%, fully verifying the accurate compensation effect of this method for nonlinear temperature drift, its adaptive noise suppression capability, and its excellent measurement accuracy.
[0176] Furthermore, this application also constructs a comparison chart of real, uncompensated, and compensated magnetic induction intensity curves, such as... Figure 5 As shown. From Figure 5 It is evident that the uncompensated magnetic flux density curve deviates significantly from the true magnetic flux density curve, especially at the peaks and troughs. In contrast, the compensated magnetic flux density curve constructed using the temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering provided in this application closely matches the true magnetic flux density curve. This demonstrates that the proposed method effectively suppresses magnetic flux density drift caused by temperature changes and significantly improves the accuracy of magnetic field reconstruction.
[0177] Simultaneously, this application also constructs a comparison chart of the original voltage signal curves, both uncompensated and compensated, as shown below. Figure 6 As shown. From Figure 6 It is evident that the uncompensated original voltage signal curve deviates significantly from the true original voltage signal curve, with notable errors at the peaks and troughs. In contrast, the compensated original voltage signal curve constructed using the temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering provided in this application closely matches the true original voltage signal curve. This further demonstrates that the proposed method can effectively suppress the original voltage drift caused by temperature changes, significantly improving the stability and accuracy of the system output.
[0178] like Figure 7 As shown, the second aspect of the present invention provides a temperature compensation system for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, used to perform a temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, including:
[0179] The Hall sensor unit is used to detect the magnetic flux density at the current moment and output the corresponding raw voltage signal, which is then transmitted to the MCU unit.
[0180] The temperature acquisition unit is used to acquire the ambient temperature of the Hall sensor unit at the current moment and transmit it to the MCU unit;
[0181] The MCU unit includes a storage module and a processing module. The storage module stores the target LSSVM nonlinear compensation model and the temperature-measurement noise covariance mapping table. The processing module receives the raw voltage signal and ambient temperature at the current moment and inputs them into the target LSSVM nonlinear compensation model to obtain the preliminary compensated magnetic flux density estimate. Then, based on the preliminary compensated magnetic flux density estimate, the temperature-measurement noise covariance mapping table, and the ambient temperature at the current moment, it uses an adaptive Kalman filter to perform filtering and updating to obtain the final compensation output at the current moment.
[0182] The power supply unit is used to power the Hall sensor unit, temperature acquisition unit, and MCU unit.
[0183] It should be emphasized that the Hall sensor unit and the temperature acquisition unit in this application have the same acquisition frequency.
[0184] In this embodiment, the Hall sensor unit uses an A1301 Hall sensor, and the MCU unit uses a PIC32MK0512MCF064 32-bit MCU chip as the core controller. The power supply unit uses a URH2405 series power module and a low-voltage regulator NCV1117ST33T3G to provide 5V and 3.3V power supply voltages to the MCU unit and the entire circuit system. The temperature acquisition unit uses a thermistor, which is arranged close to the Hall sensor unit. After being converted into a voltage signal by a voltage divider circuit or a bridge circuit, it is amplified by a signal amplification circuit based on INA330AIDGST and then input to the MCU unit.
[0185] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, characterized in that, Includes the following steps: S1. Under multiple standard magnetic induction intensity conditions, collect the original voltage signals output by the Hall sensor at different ambient temperatures, and record the corresponding ambient temperature and the true value of magnetic induction intensity to construct a sample dataset. S2. Divide all samples in the sample dataset into training set and validation set according to the proportion, where each sample includes the original voltage signal, ambient temperature and true value of magnetic induction intensity; S3. Construct an initial LSSVM nonlinear compensation model based on Least Squares Support Vector Machine (LSSVM), and use Particle Swarm Optimization (PSO) algorithm to adaptively optimize the hyperparameters in the initial LSSVM nonlinear compensation model to obtain the optimal hyperparameter combination. The hyperparameters to be optimized include regularization parameters. and kernel parameters ; S4. Substitute the optimal hyperparameter combination into the initial LSSVM nonlinear compensation model, and retrain the initial LSSVM nonlinear compensation model based on all samples in the sample dataset to obtain the target LSSVM nonlinear compensation model. S5. Use the target LSSVM nonlinear compensation model to predict all samples in the sample dataset, obtain the prediction residuals corresponding to each sample, and statistically analyze the prediction residuals according to the preset temperature range to construct a temperature-measurement noise covariance mapping table. S6. During online operation, the original voltage signal and ambient temperature at the current moment are acquired and input into the target LSSVM nonlinear compensation model to obtain the preliminary compensation estimate of the magnetic flux density. Then, combined with the ambient temperature at the current moment and the temperature-measurement noise covariance mapping table, the adaptive Kalman filter is used for filtering and updating to obtain the final compensation output at the current moment. The final compensation output at the current moment includes the final compensation estimate of the magnetic flux density and the final compensation estimate of the voltage output.
2. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 1, characterized in that, The mathematical model of the original voltage signal output by the Hall sensor is shown below: , In the formula, The original voltage signal is nonlinearly varied with ambient temperature T and the actual magnetic flux density B. The zero-point voltage that varies nonlinearly with ambient temperature T. The sensitivity varies non-linearly with ambient temperature T, and B is the true magnetic flux density acting on the Hall sensor. It follows a normal distribution, where n is the noise term. With a mean of 0 and a variance of Gaussian white noise; The initial LSSVM nonlinear compensation model uses the original voltage signal and ambient temperature as input data, and the predicted magnetic flux density as output data. The input data is expressed in the following form: , The original voltage signal is given, and T represents the ambient temperature. The symbol is the transpose; the decision function of the initial LSSVM nonlinear compensation model is shown in the following equation: , In the formula, This represents the output at the current moment, i.e., the predicted magnetic field strength; N is the number of samples. For Lagrange multipliers, It is a natural exponential function; This is the input vector at the current moment, i.e., the actual input vector during prediction. ; Let b be the input vector of the i-th sample in the training set, where i is the sample index and b is the bias term.
3. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 1, characterized in that, The specific steps for adaptively optimizing the hyperparameters in the initial LSSVM nonlinear compensation model using the particle swarm optimization algorithm (PSO) are as follows: S31. Initialize the particle swarm, where each particle position represents a set of hyperparameter combinations. , ); S32. In each iteration, for each particle, the initial LSSVM nonlinear compensation model is trained separately using the training set, and the root mean square error (RMSE) of the prediction is calculated using the validation set as the fitness value of the particle. S33. Update particle velocity and position, and proceed to the next iteration until a preset termination condition is met, at which point the optimization stops. The preset termination condition is either reaching the maximum number of iterations or all particles having a fitness value less than a preset fitness threshold. The particle velocity update formula is shown below: , In the formula, , Let be the velocity vector of the j-th particle at generation t+1 and t. For inertial weights, , For learning factors; , The coefficients are randomized within the range [0,1]. Let be the individual historical best position of the j-th particle. Let be the position vector of the j-th particle in generation t. The optimal position for the group; S34. After stopping the search for optimization, select the particle with the smallest fitness value among all particles, and take the hyperparameter combination corresponding to this particle as the optimal hyperparameter combination.
4. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 1, characterized in that, Step S5 is as follows: S51. Use the target LSSVM nonlinear compensation model to predict all samples in the sample dataset and obtain the predicted value of magnetic induction intensity for each sample. S52. Based on the true value and predicted value of magnetic induction intensity for each sample, the prediction residual for each sample is obtained, as shown in the following formula: , In the formula, Let be the prediction residual for the i-th sample. Let be the true value of the magnetic field strength of the i-th sample. Let be the predicted value of the magnetic flux density for the i-th sample; S53. Divide the temperature range into multiple temperature ranges according to the preset interval, and assign each sample to the corresponding temperature range based on the ambient temperature of the sample. S54. For each temperature range, calculate the variance of the prediction residuals of all samples within that range, and use this variance as the estimated value of the measurement noise covariance for the corresponding temperature range. The formula for calculating the estimated value of the measurement noise covariance for each temperature range is as follows: , In the formula, This is the estimated value of the measurement noise covariance for the m-th temperature interval. Let be the number of samples in the m-th temperature interval. Let be the prediction residual of the i-th sample within the m-th temperature interval. Let be the mean residual of all samples within the m-th temperature interval. To prevent the matrix from having singularly small positive numbers; S55. Establish a correspondence between each temperature range and its corresponding estimated measurement noise covariance value to form a temperature-measurement noise covariance mapping table.
5. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 1, characterized in that, The state equation of the adaptive Kalman filter is a random walk model, as shown in the following equation: , In the formula, , Let k and k-1 be the actual magnetic flux density state quantities. Let Q be the process noise at time k-1, and let Q be the process noise covariance. Among them, the process noise covariance is determined by comparing the tracking response speed, hysteresis and stability corresponding to different process noise covariances based on the actual dynamic change characteristics of the magnetic field through multiple sets of experiments.
6. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 5, characterized in that, The process noise covariance Q = 100.
0.
7. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 5, characterized in that, Step S6 is as follows: S61. Based on the filtering results of the previous time step, namely the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the previous time step, calculate the prior prediction of the magnetic flux density and the prior prediction of the error covariance at the current time step, as shown in the following formula: , , In the formula, Let be the prior predicted value of the magnetic field strength at time k. Let be the posterior estimate of the magnetic field strength at time k-1. Let be the prior predicted value of the error covariance at time k. Let be the posterior estimate of the error covariance at time k-1; S62. Based on the current ambient temperature, obtain the estimated value of the measurement noise covariance corresponding to the current ambient temperature from the temperature-measurement noise covariance mapping table. S63. Based on the prior predicted value of the error covariance at the current moment and the estimated value of the measurement noise covariance corresponding to the ambient temperature at the current moment, calculate the Kalman gain at the current moment, as shown in the following formula: , In the formula, The Kalman gain at time k, Let k be the estimated value of the measurement noise covariance corresponding to the ambient temperature at time k. S64. Using the preliminary compensated magnetic flux density estimate at the current moment as the observed value, obtain the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the current moment based on the Kalman gain at the current moment, as shown in the following formula: , , In the formula, Let be the posterior estimate of the magnetic field strength at time k. The value of the magnetic flux density after initial compensation at time k is the estimated value. Let be the posterior estimate of the error covariance at time k; S65. The posterior estimate of the magnetic field strength at the current moment is used as the final compensated estimate of the magnetic field strength at the current moment, i.e. ; S66. Based on the preset magnetic flux density-voltage conversion relationship, convert the final compensated magnetic flux density estimate at the current moment into the final compensated voltage output estimate at the current moment, wherein the preset magnetic flux density-voltage conversion relationship is: , In the formula, This represents the final compensated voltage output estimate at time k. The zero-point voltage is at a reference temperature of 25°C. Sensitivity at a reference temperature of 25°C. This is the final compensated estimate of the magnetic flux density at time k; S67. Use the final compensated magnetic flux density estimate and the final compensated voltage output estimate at the current time as the final compensated output at the current time. At the same time, save the posterior estimate of the magnetic flux density and the posterior estimate of the error covariance at the current time for use in the next sampling time.
8. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 7, characterized in that, Based on the current ambient temperature, the estimated measurement noise covariance value corresponding to the current ambient temperature is obtained from the temperature-measurement noise covariance mapping table using the method of "interval center value matching + linear interpolation". Specifically: If the ambient temperature at the current moment is equal to the center value of any temperature range, then the estimated measurement noise covariance value corresponding to that temperature range is the estimated measurement noise covariance value at the current moment, where the center value of the temperature range is the arithmetic mean of the lower limit and the upper limit of the temperature range. If the current ambient temperature is not equal to the center value of any temperature interval, then the smaller and larger adjacent center values are determined. The measurement noise covariance estimates corresponding to the temperature intervals containing these two adjacent center values are obtained, and linear interpolation is used to calculate the measurement noise covariance estimate for the current moment. The smaller adjacent center value is the largest interval center value that is less than the current ambient temperature, and the larger adjacent center value is the smallest interval center value that is greater than the current ambient temperature. The linear interpolation calculation formula is shown below: , In the formula, Let be the estimated measurement noise covariance value corresponding to the ambient temperature at time k. This represents the estimated measurement noise covariance for the temperature range containing smaller adjacent center values. Let k be the ambient temperature. For smaller neighboring center values, For larger neighboring center values, This is the estimated measurement noise covariance value corresponding to the temperature range where the larger adjacent center values are located.
9. The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering according to claim 1, characterized in that, The Hall sensor is a dual-channel orthogonal Hall sensor. For each of the two Hall channels, a corresponding target LSSVM nonlinear compensation model and a temperature-measurement noise covariance mapping table are constructed. Subsequently, for each Hall effect sensor, nonlinear compensation is performed using its corresponding target LSSVM nonlinear compensation model to obtain its preliminary compensated magnetic flux density estimate. Then, based on its corresponding temperature-measurement noise covariance mapping table, the preliminary compensated magnetic flux density estimate, and the ambient temperature, an adaptive Kalman filter is used for filtering and updating to obtain its final compensated magnetic flux density estimate. Finally, based on the final compensated magnetic flux density estimates of both Hall effect sensors, the angular displacement detection angle is obtained, calculated as follows: , In the formula, Let k be the angular displacement detection angle at time k. This represents the final compensated estimate of the magnetic flux density at time k in the first Hall effect. This is the final compensated estimate of the magnetic flux density at time k of the second Hall effect.
10. A temperature compensation system for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering, characterized in that, The temperature compensation method for a magnetoelectric angular displacement sensor based on PSO-LSSVM and adaptive Kalman filtering as described in any one of claims 1-9 includes: The Hall sensor unit is used to detect the magnetic flux density at the current moment and output the corresponding raw voltage signal, which is then transmitted to the MCU unit. The temperature acquisition unit is used to acquire the ambient temperature of the Hall sensor unit at the current moment and transmit it to the MCU unit; The MCU unit includes a storage module and a processing module. The storage module stores the target LSSVM nonlinear compensation model and the temperature-measurement noise covariance mapping table. The processing module receives the raw voltage signal and ambient temperature at the current moment and inputs them into the target LSSVM nonlinear compensation model to obtain the preliminary compensated magnetic flux density estimate. Then, based on the preliminary compensated magnetic flux density estimate, the temperature-measurement noise covariance mapping table, and the ambient temperature at the current moment, it uses an adaptive Kalman filter to perform filtering and updating to obtain the final compensation output at the current moment. The power supply unit is used to power the Hall sensor unit, temperature acquisition unit, and MCU unit.