Magnetic sensor control system with original point positioning and limiting functions

By dynamically adjusting the reference magnetic field data and adaptive tolerance threshold, the magnetic sensor control system is solved, and the problem of positioning error accumulation caused by installation deviation in the intelligent curtain system is realized, high-precision origin judgment and limit control are achieved, and the stability and reliability of the system are improved.

CN120377736APending Publication Date: 2025-07-25HOPU TECH (NINGBO) CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510744453.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing magnetic sensor control system has a problem of cumulative positioning errors in the smart curtain system, especially the slight deviation of the magnet from the sensor position caused by installation deviation, resulting in a slight deviation of the curtain opening and closing position every time the curtain is opened and closed, which affects the user experience and may cause motor damage or curtain jamming, increasing the frequency of system maintenance.

Method used

A dynamic magnetic field tracking module, a trend offset correction module, a positioning verification module and a limit judgment control module are introduced. By dynamically adjusting the reference magnetic field data, sliding statistical error change curve and adaptive tolerance threshold, continuous perception and adaptive correction of magnetic field changes are achieved, ensuring the robustness and accuracy of origin judgment.

Benefits of technology

It significantly reduces the dependence on installation accuracy, solves the problem of misjudgment caused by slight offset of the guide rail or sensor response drift, improves the robustness of the origin judgment and the anti-interference ability of the system, and reduces maintenance costs and failure rates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120377736A_ABST
    Figure CN120377736A_ABST
Patent Text Reader

Abstract

The invention provides a magnetic sensor control system with original point positioning and limiting functions, and relates to the technical field of data processing, and the system comprises a dynamic magnetic field tracking module which is used for receiving real-time magnetic field data detected by a magnetic sensor, setting reference magnetic field data, and calculating a first difference value between the real-time magnetic field data and the reference magnetic field data; the trend deviation correction module is used for carrying out sliding statistics to form an error change curve and selecting a main correction function from a preset error change function group through goodness of fit evaluation; generating an offset compensation amount according to the predicted value of the main correction function, and dynamically adjusting the reference magnetic field data; the positioning verification module is used for calculating a second difference value in combination with the current real-time magnetic field data and performing judgment; the limiting judgment control module is used for sending a stop control instruction to the motor driving module when the successful signal is judged; according to the invention, autonomy and accuracy of magnetic sensor control are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and particularly to a magnetic sensor control system with origin positioning and limit functions. Background Art

[0002] In the prior art, magnetic sensors are widely used in position detection systems, especially in electric slide rails, intelligent curtains, and automatic door control systems, to realize position perception and limit control of moving devices. The common method is to sense the strength of the magnetic field by setting the relative position change between multiple fixed magnets and the magnetic sensor, so as to judge whether the device reaches the predetermined position. After receiving the magnetic sensor signal, the system controller determines whether the current position is the starting point or the end point based on the magnetic field threshold, and realizes start / stop or direction adjustment through the motor control module.

[0003] However, in the application of intelligent curtain systems, the common detection method based on fixed magnets has the problem of cumulative positioning error. Specifically, if the relative position between the magnet and the sensor is slightly shifted due to installation deviation of the curtain rail, the system is prone to misjudge the "origin" position, resulting in a slight deviation in the position of the curtain opening and closing each time, affecting the user experience. More seriously, if the limit position is misrecognized, the motor will continue to output, which may cause motor damage or curtain jamming, increasing the system maintenance frequency. This problem is particularly significant in the cumulative offset after multiple starts and stops. Summary of the Invention

[0004] The purpose of the present invention is to provide a magnetic sensor control system with origin positioning and limit functions, aiming to solve the problems mentioned in the background art.

[0005] To solve the above technical problems, the technical solution of the present invention is as follows:

[0006] A magnetic sensor control system with origin positioning and limit functions, the system includes:

[0007] A dynamic magnetic field tracking module, configured to receive real-time magnetic field data detected by a magnetic sensor and set reference magnetic field data; calculate a first difference according to the reference magnetic field data and the current real-time magnetic field data to form magnetic offset data;

[0008] A trend offset correction module, configured to perform sliding statistics on the magnetic offset data to form an error change curve, and select a main correction function from a preset error change function group through goodness-of-fit evaluation; generate an offset compensation amount according to the predicted value of the main correction function, dynamically adjust the reference magnetic field data, and form a dynamic origin magnetic field reference value;

[0009] The positioning verification module is used to calculate the second difference value according to the dynamic origin magnetic field reference value and the current real-time magnetic field data; when the second difference value is lower than the set adaptive tolerance threshold value in multiple consecutive detection cycles, the position of the moving component is determined to be the origin position, and a judgment success signal is generated; otherwise, the second difference value is fed back to the trend offset correction module to correct the dynamic origin magnetic field reference value;

[0010] The limit judgment control module is used to send a stop control instruction to the motor drive module according to the judgment success signal.

[0011] Preferably, the dynamic magnetic field tracking module comprises:

[0012] The real-time magnetic field data receiving submodule is used to continuously receive the real-time magnetic field data detected by the magnetic sensor to form magnetic field data;

[0013] The multi-source data evaluation submodule is used to perform sliding segmentation and volatility analysis on the magnetic field data of the most recent preset detection cycle number, identify multiple stable segments of magnetic field data whose fluctuation range or variance is lower than the preset stability threshold, and remove the stable segments with abnormal disturbances in combination with external disturbance information to form a candidate reference magnetic value set;

[0014] The reference value optimization submodule is used to calculate the variance of the candidate reference magnetic value set, generate a stability score, and select the magnetic value with the best score as the reference magnetic field data;

[0015] The difference generation submodule is used to perform a difference operation based on the current real-time magnetic field data and the reference magnetic field data, calculate the first difference, and form magnetic offset data.

[0016] Preferably, the trend deviation correction module includes:

[0017] The error curve generation submodule is used to perform continuous sliding statistics on the magnetic offset data and construct an error change curve to describe the change trend of the magnetic offset data over time;

[0018] The main function selection submodule is used to fit the error change curve with multiple preset error change functions, and evaluate the matching degree of each function based on the goodness of fit index, and select the error change function with the best fit as the main correction function;

[0019] The reference value update submodule is used to generate an offset compensation value according to the current prediction value of the main correction function, and perform weighted fusion with the reference magnetic field data to form a dynamic origin magnetic field reference value;

[0020] The model parameter adjustment submodule is used to receive the second difference, calculate the corresponding residual in combination with the predicted value of the main correction function, and adjust the fitting parameters of the main correction function or the length of the sliding time window according to the residual.

[0021] Preferably, the positioning verification module includes:

[0022] A trend tolerance generation sub-module, configured to receive a dynamic origin magnetic field reference value and current real-time magnetic field data, calculate a second difference, and set an adaptive tolerance threshold in combination with the fitting change slope and current change amplitude of the second difference;

[0023] A continuous trend determination sub-module, configured to compare the second difference with the adaptive tolerance threshold in each detection period during a plurality of consecutive detection periods; when the consecutive detection periods meet the difference constraint condition, output a determination success signal;

[0024] A local adjustment feedback sub-module, configured to, when there are some detection periods that do not meet the difference constraint condition but do not reach the preset upper limit of consecutive times, feedback the second difference to the trend offset correction module for the model parameter adjustment sub-module to update the parameters;

[0025] A structure adjustment feedback sub-module, configured to send a main correction function update request to the trend offset correction module after the number of consecutive times of not meeting the difference constraint condition reaches the preset upper limit of consecutive times, so as to re-select a better error change function to correct the origin reference value.

[0026] Preferably, the multi-source data evaluation sub-module includes:

[0027] A sliding segmentation generation unit, configured to perform time division on the magnetic field data within the recent preset number of detection periods to form a plurality of consecutive magnetic field data sub-segments;

[0028] A stability judgment unit, configured to calculate the fluctuation range or variance of each magnetic field data sub-segment, and mark the data sub-segments with a fluctuation lower than the preset stability threshold as magnetic field data stable segments;

[0029] A perturbation rejection unit, configured to identify and reject the data segments with abnormal perturbation responses based on the external perturbation information corresponding to the stable segments, to form a set of magnetic field data stable segments;

[0030] A candidate mean extraction unit, configured to calculate the mean magnetic field value for each magnetic field data stable segment according to the set of magnetic field data stable segments, to form a set of candidate reference magnetic values.

[0031] Preferably, the main function selection sub-module includes:

[0032] An error fitting processing unit, configured to receive the error change curve output by the error curve generation sub-module, and fit the curve with a plurality of preset error change functions respectively to obtain the fitting output data corresponding to each function;

[0033] The goodness-of-fit evaluation unit is used to calculate the sum of squared residuals and the coefficient of determination of each error change function respectively according to the fitting output data, and perform weighted fusion to form a goodness-of-fit score value;

[0034] The function selection execution unit is used to select the error change function with the highest score as the main correction function according to the goodness-of-fit score value, and output it to the reference value update sub-module.

[0035] Preferably, the model parameter adjustment sub-module includes:

[0036] The residual calculation unit is used to receive the second difference and combine the current predicted value of the main correction function to calculate its corresponding residual value;

[0037] The residual trend analysis unit is used to perform sliding statistics on the residual values of multiple consecutive periods to generate residual change trend data;

[0038] The parameter adjustment execution unit is used to dynamically adjust the fitting parameters or the sliding time window length of the main correction function according to the residual change trend data, and output the adjusted main correction function to the reference value update unit.

[0039] Preferably, the trend tolerance generation sub-module includes:

[0040] The difference sequence generation unit is used to record the second differences within multiple consecutive detection periods to form a second difference sequence;

[0041] The change amplitude measurement unit is used to calculate the change amplitude of the second difference in the current period compared with the previous period according to the second difference sequence;

[0042] The slope fitting unit is used to fit the second difference sequence to obtain a fitting change slope;

[0043] The threshold setting unit is used to calculate and output the adaptive tolerance threshold of the current period according to the current change amplitude and the fitting change slope.

[0044] Preferably, the goodness-of-fit evaluation unit includes:

[0045] The residual statistics sub-unit is used to calculate the fitting residuals between the error change curve and each error change function point by point, and form a residual vector;

[0046] The coefficient of determination calculation sub-unit is used to calculate the coefficient of determination value of each error change function according to the residual vector and in combination with the total variation of the error change curve;

[0047] The weighted score generation sub-unit is used to perform weighted fusion on the sum of squared residuals and the coefficient of determination corresponding to each error change function to generate a goodness-of-fit score value.

[0048] Preferably, the residual trend analysis unit includes:

[0049] A weighted sliding processing sub-unit, configured to assign decreasing weights to the residual values in multiple consecutive detection cycles in chronological order, and perform weighted sliding average processing to form first trend data;

[0050] A trend turning point judgment sub-unit, configured to identify whether there is a reverse inflection point in the residual trend according to the change direction in adjacent time periods in the first trend data, and generate a trend turning point flag signal when it is detected that the trend changes from continuous rise to fall or from fall to rise;

[0051] A multi-scale fusion sub-unit, configured to construct second trend data and third trend data respectively within a preset short-period window and a preset long-period window, and perform fusion comparison on the two to generate a comprehensive trend index of the residual change;

[0052] A trend output sub-unit, configured to merge the trend turning point flag signal and the comprehensive trend index to form residual change trend data.

[0053] The above solution of the present invention has at least the following beneficial effects:

[0054] By setting a dynamic magnetic field tracking module, a trend offset correction module, a positioning verification module, and a limit judgment and control module, continuous perception, adaptive correction, and reliable positioning of magnetic field changes are achieved, making the origin judgment more robust, and effectively solving the problem of position misjudgment caused by slight offset of the guide rail or sensor response drift in the prior art.

[0055] During the dynamic magnetic field tracking process, the system not only continuously receives the real-time magnetic field data of the magnetic sensor, but also actively sets and updates the reference magnetic field data, so that the positioning reference no longer depends on the initial static magnet position. This design significantly reduces the dependence on installation accuracy, and is especially suitable for scenarios where it is difficult to precisely control the installation process, such as intelligent curtains and electric slide rails. The reference magnetic field data is no longer a fixed threshold, but is dynamically updated with the operating state of the system, and can still provide a stable reference basis in the presence of magnetic field disturbances or installation deviations.

[0056] The trend offset correction module constructs an error change curve for the magnetic offset data by means of sliding time statistics, and captures the systematic drift trend caused by multiple starts and stops or long-term operation. Once the trend is identified, the system can calculate the compensation amount through the predicted value generated by the main correction function, and use it to adjust the reference magnetic field data in real time, avoiding the origin judgment logic from failing due to offset. This "reference self-adaptive" correction mechanism is scarce in the current technology, and is especially suitable for solving the progressive error accumulation that occurs after long-term use of the curtain guide rail.

[0057] The positioning verification module realizes the accurate confirmation of the current origin position through the detection mechanism of the second difference. Through the adaptive tolerance threshold and the continuous detection period judgment mechanism, it not only enhances the robustness to abnormal data, but also avoids the misoperations that may be caused by misjudging the origin. Compared with the traditional method that relies on a fixed magnetic threshold for judgment, this mechanism can still maintain a high-precision judgment ability in the face of uncontrollable factors such as external magnetic interference, mechanical aging, and environmental temperature changes.

[0058] Finally, the limit judgment control module responds to the origin determination result for control, and the system can achieve timely motor shutdown to prevent overshoot operation or jamming caused by misidentifying the limit position. It is especially applicable to the curtain system, avoiding problems such as the motor repeatedly hitting the curtain box, track jamming, or controller overheating caused by "misjudging the end point", and greatly reducing the maintenance cost and failure rate.

[0059] In summary, the present invention effectively solves the core problems of insufficient accuracy, weak anti-interference ability, and error accumulation during long-term use in the traditional magnetic threshold determination method by introducing a four-stage positioning architecture of "dynamic reference - trend correction - multi-period confirmation - limit control", and has significant advantages in stability, reliability, and application adaptability. It is particularly suitable for systems such as curtains, sliding rails, and door controls that are sensitive to origin errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 is a block diagram of a magnetic sensor control system with origin positioning and limit functions provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0061] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.

[0062] As Figure 1 shown, an embodiment of the present invention provides a magnetic sensor control system with origin positioning and limit functions, and the system includes:

[0063] A dynamic magnetic field tracking module, configured to receive real-time magnetic field data detected by a magnetic sensor and set reference magnetic field data; calculate a first difference based on the reference magnetic field data and the current real-time magnetic field data to form magnetic offset data, and the magnetic offset data is used to reflect the positioning error caused by rail offset or sensor response drift.

[0064] A trend offset correction module is used to perform sliding statistics on magnetic offset data to form an error change curve, and select a main correction function from a preset group of error change functions through goodness-of-fit evaluation; generate an offset compensation amount according to the predicted value of the main correction function, dynamically adjust the reference magnetic field data, and form a dynamic origin magnetic field reference value;

[0065] A positioning verification module is used to calculate a second difference according to the dynamic origin magnetic field reference value and in combination with the current real-time magnetic field data; when the second difference is lower than a set adaptive tolerance threshold in multiple consecutive detection cycles, it is determined that the position where the moving member is located is the origin position, and a determination success signal is formed, otherwise the second difference is fed back to the trend offset correction module to achieve correction of the dynamic origin magnetic field reference value;

[0066] A limit judgment control module is used to send a stop control instruction to the motor drive module according to the determination success signal.

[0067] In the embodiment of the present invention, by setting a dynamic magnetic field tracking module, a trend offset correction module, a positioning verification module, and a limit judgment control module, a magnetic sensor control system with high-precision origin positioning and adaptive limit functions is constructed. During the operation of the device, the magnetic sensor continuously collects real-time magnetic field data, and in combination with the reference magnetic field data set in the initial stage of the system, the first difference between the current magnetic environment and the stable reference state can be calculated. This difference is the magnetic offset data, which can reflect the positioning error caused by the displacement of the mechanical guide rail or the drift of the magnetic sensor response over time. The introduction of this magnetic offset data solves the problem that the traditional magnetic positioning system cannot dynamically sense small displacement changes.

[0068] Subsequently, through the trend offset correction module, sliding statistical processing is performed on the magnetic offset data, and an error change curve evolving with time can be constructed. The system will fit and match this curve with multiple preset error change functions, and select the function model with the best matching degree as the main correction function according to the goodness of fit. Then, through the predicted output of the main correction function, the offset compensation amount is calculated, and the original reference magnetic field data is dynamically adjusted to form a more reliable dynamic origin magnetic field reference value. The mechanism of dynamically updating the reference value can effectively cancel the drift error accumulated during the long-term operation of the system, making the positioning reference timely and robust.

[0069] To achieve precise control of origin determination, during multiple consecutive detection cycles, the positioning verification module compares the real-time magnetic field data with the dynamic origin magnetic field reference value and dynamically generates an adaptive tolerance threshold. This threshold combines the error change trend and the current detection error fluctuation amplitude, and can adaptively adjust the judgment tolerance under different operating states. When the second difference within consecutive cycles continuously falls below the tolerance threshold, a successful determination signal can be output to accurately confirm that the current position of the moving component is the origin, avoiding misjudgment caused by short-term fluctuations. Finally, based on this signal, the system sends a stop control instruction to the motor drive module to complete the limit control.

[0070] Integrating the above processes, the entire system can dynamically update the reference value, correct the error based on the trend fitting model, and achieve highly reliable origin positioning and limit control by combining multi-cycle adaptive judgment, significantly improving the practicability and stability of the magnetic sensor control system in complex application scenarios.

[0071] Among them, the moving component is: a component installed at positions such as rails, brackets, and guiding structures and capable of moving along a certain path, such as a slider, a transverse movement component, a carrier, etc.

[0072] In a preferred embodiment of the present invention, the dynamic magnetic field tracking module includes:

[0073] A real-time magnetic field data receiving sub-module, which is used to continuously receive the real-time magnetic field data detected by the magnetic sensor to form magnetic field data;

[0074] A multi-source data evaluation sub-module, which is used to perform sliding segmentation and volatility analysis on the magnetic field data of the most recent preset number of detection cycles, identify multiple stable segments of magnetic field data whose fluctuation range or variance is lower than the preset stability threshold, and combine external disturbance information to eliminate the stable segments with abnormal disturbances to form a candidate reference magnetic value set;

[0075] A reference value optimization sub-module, which is used to calculate the variance of the candidate reference magnetic value set, generate a stability score, and select the magnetic value with the best score as the reference magnetic field data;

[0076] A difference generation sub-module, which is used to perform a difference operation on the current real-time magnetic field data and the reference magnetic field data to calculate the first difference and form magnetic offset data.

[0077] In the embodiment of the present invention, after introducing the multi-source data evaluation sub-module and the reference value optimization sub-module, the dynamic magnetic field tracking module has a higher ability to generate reference magnetic field data. Based on the continuous real-time magnetic field data, the system performs sliding segmentation analysis on the data within a number of past detection cycles, and identifies multiple stable segments, which have lower variance or fluctuation range than the set threshold and have high stability. This process eliminates abnormal data segments caused by instantaneous disturbances or system jitters, ensuring a stable source of candidate data.

[0078] Combined with external disturbance information, such as parameters like temperature and vibration, further cross-check the identified stable segments to exclude pseudo-stable data segments that have small surface fluctuations but are actually affected by strong external disturbances. On this basis, the reference value optimization sub-module calculates the internal variance of the candidate magnetic values, constructs a stability scoring model, and finally selects a set of magnetic values with the optimal stability as the reference magnetic field data. This reference value obtained through the dual determination of "historical data stability" and "disturbance adaptability" can not only improve the reference accuracy of origin judgment but also enhance the adaptability of the reference magnetic field data to changes in on-site working conditions.

[0079] Among them, the reference value optimization sub-module is used to judge the stability based on the fluctuation degree of each group of magnetic field data in the candidate reference magnetic value set, and select the reference value most suitable as the reference magnetic field data, specifically including:

[0080] The candidate reference magnetic value set consists of multiple segments of historical magnetic field data with small magnetic field fluctuations within a specific time. The system performs statistical calculation of the data variance for each group of magnetic value sequences to reflect the stability degree of this segment of data. To achieve quantitative scoring of the variance results, the system sorts the variance values of each group of data in ascending order and assigns scoring weights, so that the sequence with a smaller variance obtains a higher score. To enhance robustness, a disturbance correlation index can also be introduced to measure the stability of the magnetic value sequence under the background of external disturbances (such as temperature and electromagnetic interference) and evaluate its correlation degree with the interference source. Finally, the overall stability scoring value is determined by weighted fusion of the stability score and the disturbance index. The magnetic value with the highest scoring value is selected as the current reference magnetic field data and used as the reference point for the first difference operation to ensure stronger anti-offset ability and repeatability for origin judgment.

[0081] In a preferred embodiment of the present invention, the trend offset correction module includes:

[0082] An error curve generation sub-module, which is used to perform continuous sliding statistics on the magnetic offset data and construct an error change curve to describe the change trend of the magnetic offset data over time;

[0083] The main function selection sub-module is used to fit the error change curve with multiple preset error change functions, evaluate the matching degree of each function based on the goodness-of-fit index, and select the error change function with the best fitting degree as the main correction function;

[0084] The reference value update sub-module is used to generate an offset compensation amount according to the current predicted value of the main correction function, and perform weighted fusion with the reference magnetic field data to form a dynamic origin magnetic field reference value;

[0085] The model parameter adjustment sub-module is used to receive the second difference, calculate the corresponding residual in combination with the predicted value of the main correction function, and adjust the fitting parameters or the sliding time window length of the main correction function according to the residual.

[0086] In the embodiment of the present invention, by constructing an error curve generation sub-module, a main function selection sub-module, a reference value update sub-module, and a model parameter adjustment sub-module, the system's ability in trend offset correction is significantly improved. The system first performs sliding statistics on the time series magnetic offset data to construct a continuous error curve describing the change of error over time. Then, multiple error change function models are introduced, including but not limited to linear functions, quadratic functions, and weighted moving average models, and these functions are compared with the error change curve by fitting.

[0087] During the comparison process, the system calculates the goodness of fit of the fitting results of each function, including the sum of squared residuals and the coefficient of determination, to form a goodness-of-fit index set. The system selects the most matching function as the main correction function according to the scoring result, and then generates an offset compensation value through the predicted output of the main correction function to correct the reference magnetic field data in real time and output a dynamic origin magnetic field reference value. To maintain the continuous effectiveness of the correction model, the system also continuously adjusts the fitting weight or time window according to the residual information between the second difference and the predicted value of the main correction function in subsequent cycles to realize adaptive update of the model parameters and enhance the system's dynamic response ability and prediction accuracy.

[0088] Among them, the error curve generation sub-module is used to establish a dynamic trend representation of the magnetic offset evolving over time based on the continuous magnetic offset data, so as to provide a reference for subsequent modules to perform error trend modeling and correction. Specifically, it includes:

[0089] The magnetic offset data is composed of a sequence of differences between the current real-time magnetic field data and the set reference magnetic field data, and is continuously recorded in multiple detection cycles. The error curve generation sub-module performs a sliding window process on this sequence, that is, a certain number of consecutive magnetic offset values are divided into multiple time periods, and statistical summarization is performed within each time period to form a description of the change in magnetic offset at different time positions. Subsequently, the system organizes these change amounts in chronological order to form a trend curve reflecting the change of error over time. To enhance the expression of progressive drift, this trend curve can be processed by smoothing means such as moving average or weighted filtering to reduce the interference of high-frequency disturbances. The generation result of the error change curve will be used to fit and compare with multiple preset error change functions, and dynamic correction operations will continue to be performed in the model with the best matching degree.

[0090] Among them, the reference value update sub-module is used to dynamically adjust the original reference magnetic field data based on the output result of the main correction function to generate a dynamic origin magnetic field reference value that better fits the actual system offset trend, specifically including:

[0091] The main correction function is a function model selected from multiple error change functions that best matches the current error change curve, and its output value represents the trend prediction result of the system at the current moment in the dimension of magnetic offset. The reference value update sub-module receives this predicted value and regards it as the "correction amount" required by the current system. This correction amount is weighted and fused with the historically set reference magnetic field data to generate a new round of dynamic origin magnetic field reference value for positioning judgment. In this fusion process, the weight ratio can be adjusted according to the goodness-of-fit score of the main correction function. For example, when the goodness-of-fit score is relatively high, a higher weight is given to the correction amount to strengthen the correction effect; when the goodness-of-fit is relatively low, more weight is given to the original reference value to prevent incorrect correction. The finally output dynamic origin magnetic field reference value will be used for the next round of difference operation to continuously correct the origin drift problem of the system caused by environmental, mechanical errors or response drift, and achieve the ability to maintain a long-term stable positioning reference.

[0092] In a preferred embodiment of the present invention, the positioning verification module includes:

[0093] A trend tolerance generation sub-module, which is used to receive the dynamic origin magnetic field reference value and the current real-time magnetic field data, calculate the second difference, and set an adaptive tolerance threshold in combination with the fitting change slope and the current change amplitude of the second difference;

[0094] A continuous trend determination sub-module, which is used to compare the second difference with the adaptive tolerance threshold in each detection cycle in multiple consecutive detection cycles; when the consecutive detection cycles meet the difference constraint conditions, an adjudication success signal is output;

[0095] A local adjustment feedback sub-module, which is used to feedback the second difference to the trend offset correction module when there are some detection cycles that do not meet the difference constraint condition but do not reach the upper limit of the preset continuous number of times, so that the model parameter adjustment sub-module can update the parameters;

[0096] A structure adjustment feedback sub-module, which is used to send a main correction function update request to the trend offset correction module after the number of consecutive times of not meeting the difference constraint condition reaches the upper limit of the preset continuous number of times, so as to re-select a better error change function to correct the origin reference value.

[0097] In an embodiment of the present invention, a positioning verification module is introduced in the system construction and divided into a trend tolerance generation sub-module, a continuous trend determination sub-module, a local adjustment feedback sub-module, and a structure adjustment feedback sub-module, so that the system has high adaptability and fault tolerance in the origin positioning judgment. First, after the trend tolerance generation sub-module obtains the current real-time magnetic field data and the dynamic origin magnetic field reference value, it calculates the second difference in real time. This difference directly reflects the deviation between the current position and the reference origin. On this basis, the system further extracts the change slope of the second difference in a short period, and combines the change amplitude information of the difference in each period to dynamically set an adaptive tolerance threshold. This setting method is different from the traditional fixed threshold mode and can effectively avoid error misjudgment caused by fluctuations in the operating environment or changes in the system state.

[0098] In each detection cycle, the continuous trend determination sub-module compares the second difference with the tolerance threshold of this cycle, and outputs a position determination signal when multiple consecutive cycles meet the threshold condition, confirming that the current position is the origin position. Compared with the traditional one-time judgment mechanism, this multi-cycle judgment mechanism significantly improves the fault tolerance and robustness. If there are some abnormalities in the continuous detection cycles but the critical failure condition is not reached, the local adjustment feedback sub-module can feedback the second difference in this stage to the trend offset correction module to assist subsequent model fine-tuning and maintain the stable operation of the overall system. When the system continuously detects that the judgment condition is not met and reaches the set number of times limit, the structure adjustment feedback sub-module is activated, and by triggering a main correction function update request, it guides the trend offset correction module to re-select a better error change function to achieve the structural adjustment of the reference model.

[0099] This positioning verification mechanism has hierarchical and progressive verification capabilities, can dynamically adjust the tolerance and model structure according to the error trend, effectively prevent the problem of origin recognition failure caused by sudden disturbances, short-term drifts or environmental disturbances, and significantly enhance the origin recognition accuracy and stability of the magnetic sensor control system in a complex dynamic environment.

[0100] In a preferred embodiment of the present invention, the multi-source data evaluation sub-module includes:

[0101] A sliding segmented generation unit for time - dividing magnetic field data within the most recent preset number of detection periods to form multiple consecutive sub - segments of magnetic field data;

[0102] A stability judgment unit for calculating the fluctuation range or variance of each sub - segment of magnetic field data and marking the sub - segments of data with a value lower than the preset stability threshold as stable segments of magnetic field data;

[0103] A disturbance rejection unit for identifying and rejecting data segments with abnormal disturbance responses based on external disturbance information corresponding to the time periods of the stable segments to form a set of stable segments of magnetic field data;

[0104] A candidate mean extraction unit for calculating the mean magnetic field values of the stable segments of magnetic field data respectively according to the set of stable segments of magnetic field data to form a set of candidate reference magnetic values.

[0105] In the embodiment of the present invention, a multi - source data evaluation sub - module is set in the dynamic magnetic field tracking module, and is refined into a sliding segmented generation unit, a stability judgment unit, a disturbance rejection unit and a candidate mean extraction unit, enabling the system to have the ability to automatically extract reference magnetic values from historical data. The sliding segmented generation unit divides the original magnetic field data into multiple sub - segments in chronological order through a preset detection period window, maintaining continuity and taking into account the locality of data processing. This method has higher adaptability compared with overall averaging or static sampling.

[0106] The stability judgment unit independently calculates the fluctuation range or variance of each sub - segment, marks the sub - segments with values lower than the set threshold as stable segments, and excludes the influence of data noise caused by unstable fluctuations. To further enhance the anti - interference ability against external environmental disturbances, the system introduces a disturbance rejection unit. Combining external disturbance monitoring data such as vibration, temperature, and acceleration, it cross - validates the time periods corresponding to the marked stable segments and rejects the magnetic field data segments that have a strong correlation with external changes. This mechanism prevents pseudo - stable segments that "seem stable but are actually affected by disturbances" from entering the candidate set, thus ensuring data quality.

[0107] Finally, the candidate mean extraction unit calculates the mean magnetic field values of each disturbance - adaptable stable segment to generate a set of candidate reference magnetic values. Compared with taking a single - point data as the reference value, mean processing improves the robustness and reduces the impact of accidental errors on the overall reference value. The above process constitutes a complete benchmark data extraction scheme with a multi - dimensional evaluation mechanism, improving the quality of the benchmark magnetic field data and further enhancing the accuracy of the subsequent difference calculation and error correction modules.

[0108] Among them, the stability judgment unit is used to identify the steady - state data segments in the sub - segments of magnetic field data, and its judgment basis is whether the fluctuation range or variance of the data segment is lower than the set threshold, specifically including:

[0109] First, the system divides the continuous magnetic field data stream into multiple data sub - segments of fixed length in chronological order. Each sub - segment corresponds to the magnetic field change state within a short period of time. Then, this unit performs volatility analysis on each data sub - segment in turn. Volatility analysis refers to calculating the difference between the maximum and minimum values of all magnetic field values in this data sub - segment to obtain the magnetic field fluctuation amplitude of this sub - segment; or by calculating the sum of the squared deviation values of all magnetic field data points in this sub - segment relative to their mean value, and then dividing by the number of data points to obtain the mean square error. Subsequently, the above - mentioned fluctuation amplitude or variance value is compared with the stability threshold preset by the system. If it is less than the threshold, it is determined to be in a stable state. The purpose of this operation is to screen out the time segments during the system operation in a non - disturbed environment with a relatively stable magnetic field distribution, which serves as the basis for constructing the candidate set of reference magnetic values in the following steps.

[0110] Among them, the disturbance rejection unit is used to further eliminate the segments that may be affected by external disturbances from the identified stable segments of magnetic field data to ensure the purity and robustness of the candidate reference magnetic values. Specifically, it includes:

[0111] After receiving multiple stable segments output from the stability judgment unit, this unit will synchronously call the external disturbance information acquisition module in the system. The external disturbance information mainly includes disturbance variables at the environmental and system levels such as temperature, humidity, voltage fluctuation, electromagnetic interference, and motor working state synchronously recorded in the current time period. The system performs correlation analysis on the magnetic field data characteristics in this stable segment and the above - mentioned disturbance data. Specifically, by calculating the time - series correlation, change synchrony between the magnetic field values in this stable segment and the disturbance index, or by judging through a set abnormal disturbance threshold, if the disturbance value during the stable segment exceeds the threshold or shows an abnormal mutation trend, this data segment is determined to have a disturbance response and is not retained. Through this step, it effectively avoids the misjudgment caused by external disturbance interference being mistaken for magnetic field stability, ensuring the physical stability and environmental adaptability of the data in the candidate reference magnetic value set.

[0112] In a preferred embodiment of the present invention, the main function selection sub - module includes:

[0113] The error fitting processing unit is used to receive the error change curve output by the error curve generation sub - module, and fit this curve with multiple preset error change functions respectively to obtain the fitting output data corresponding to each function;

[0114] The goodness - of - fit evaluation unit is used to calculate the sum of squared residuals and the coefficient of determination of each error change function respectively according to the fitting output data, and perform weighted fusion to form a goodness - of - fit score value;

[0115] The function selection execution unit is used to select the error change function with the highest score as the main correction function according to the goodness - of - fit score value and output it to the reference value update sub - module.

[0116] In the embodiments of the present invention, the main function of selecting sub-modules plays a core role in the trend offset correction module. By designing an error fitting processing unit, a goodness-of-fit evaluation unit, and a function selection execution unit, the system has a flexible function model adaptation and high-precision function evaluation mechanism in the error modeling and trend correction stages. The error fitting processing unit first receives the time series error change curve output by the error curve generation sub-module and fits it one by one with multiple preset error change functions built into the system. Through this process, not only can simple linear trends be modeled, but also complex non-linear or piecewise changing trends can be effectively addressed.

[0117] The goodness-of-fit evaluation unit calculates two basic fitting metrics, namely the sum of squared residuals and the coefficient of determination, respectively, based on the fitting output results of each function, and generates a unified goodness-of-fit score value by introducing a weighted fusion mechanism. In this process, the scoring mechanism fully considers the balance between fitting accuracy and function expression ability, avoiding the problem that low-residual but high-complexity models dominate.

[0118] The function selection execution unit selects the optimal model according to the scoring results and pushes it to the reference value update sub-module as the main correction function. Compared with the traditional single-model fixed correction strategy, the dynamic modeling ability of this module can significantly improve the system's response ability to error trend changes, especially showing higher accuracy and flexibility in the presence of non-linear drift or long-period trend changes in the operating environment.

[0119] Among them, the error fitting processing unit is used to fit the error change curve formed by the error curve generation sub-module with a set of preset error change functions, so as to provide a basic fitting result for subsequent goodness-of-fit evaluation, specifically including:

[0120] The error change curve refers to the trend line of magnetic offset data changing over time in consecutive detection cycles, usually existing in the form of discrete points. The fitting processing unit receives this sequence of discrete points and applies several types of function models to fit them respectively. These function models are predefined in the system and at least include a linear function (reflecting the linear drift trend), a quadratic function (reflecting the acceleration change trend), and a moving weighted function (applicable to local smooth change scenarios). For each function model, the system performs a fitting operation, that is, by adjusting the model parameters, making the function curve as close as possible to the discrete points of the error change curve. This fitting process can adopt the least square deviation optimization method to minimize the total error of the fitting result. The fitting results corresponding to each model will be recorded, including the fitted function expression, the values of each parameter, and statistics such as the residuals in the fitting process. The above results serve as the input basis for subsequent goodness-of-fit evaluation to compare the description capabilities of different functions for the error trend and select the optimal model for reference magnetic field correction. By parallel processing the fitting processes of multiple function models, this module ensures good modeling flexibility and adaptability for complex magnetic offset trends.

[0121] In a preferred embodiment of the present invention, the model parameter adjustment sub-module includes:

[0122] A residual calculation unit, configured to receive the second difference and combine the current predicted value of the main correction function to calculate its corresponding residual value;

[0123] A residual trend analysis unit, configured to perform a moving statistics on the residual values of multiple consecutive cycles to generate residual change trend data;

[0124] A parameter adjustment execution unit, configured to dynamically adjust the fitting parameters of the main correction function or the length of the moving time window according to the residual change trend data, and output the adjusted main correction function to the reference value update unit.

[0125] In the embodiment of the present invention, the introduction of the model parameter adjustment sub-module, which is subdivided into a residual calculation unit, a residual trend analysis unit, and a parameter adjustment execution unit, significantly improves the adaptive update ability of the error compensation model during operation. First, the residual calculation unit, while receiving the second difference, obtains the predicted value of the main correction function in the current cycle, and the difference between the two constitutes the model residual. The residual is an important indicator for measuring the fitting accuracy of the model and has the function of immediately reflecting the prediction deviation of the model.

[0126] Subsequently, the residual trend analysis unit performs a sliding window statistical process on the residual values of multiple consecutive periods to form a trend sequence. Through trend analysis, it is possible to observe whether the error correction model continuously deviates from the target output in the medium and short term, avoiding misjudgment problems of making adjustments based solely on instantaneous deviations. In addition, this module performs denoising and smoothing processing on the residual sequence to ensure that the trend information is more stable and reliable, providing an accurate basis for downstream parameter adjustment.

[0127] The parameter adjustment execution unit makes a dynamic response based on the residual trend data. When the residual shows a continuous increasing trend, it automatically activates the parameter correction mechanism to adjust the fitting parameters (such as weight coefficients), the sliding time window length, or the prediction compensation coefficient of the main correction function. The parameter adjustment is not limited to single variable adjustment, but can be jointly optimized in a multi-parameter space, thereby realizing the reconstruction and optimization of the main correction function. This automatic, gradual, and controlled model update method effectively extends the model usage cycle, improves its stability and adaptability in a dynamic magnetic environment, and enables the overall system to maintain a high-precision origin recognition ability in the face of error accumulation during long-term operation.

[0128] Among them, the residual calculation unit is used to calculate the difference between the magnetic offset value predicted by the current main correction function and the second difference actually detected by the system. This difference is the residual, specifically including:

[0129] The system first inputs the current time or cycle number through the selected main correction function in the trend offset correction module in the current detection cycle to obtain the corresponding predicted magnetic offset value. Subsequently, this unit obtains the actual second difference within the current detection cycle from the positioning verification module, that is, the offset between the current real-time magnetic field data and the dynamic origin magnetic field reference value. Then, the residual calculation unit performs a calculation operation, that is, subtracting the predicted value of the main correction function from the actual second difference to obtain a numerical difference, which is the residual. To further improve the robustness, the system can perform absolute value processing or square processing on this residual to emphasize its deviation degree and weaken the cancellation effect of the positive and negative directions on subsequent analysis. By performing this residual calculation operation on consecutive detection cycles, the system will obtain a set of residual data sequences as the basic input for subsequent fitting parameter update and trend judgment.

[0130] Among them, the parameter adjustment execution unit is used to adjust the fitting parameters or the sliding time window length of the current main correction function according to the residual change trend within consecutive periods to improve the adaptability of the model to the magnetic offset trend, specifically including:

[0131] This unit first receives the residual trend data generated by the residual trend analysis unit, including information such as the average level of the residuals in the recent several cycles, the upward or downward trend, and the inflection points of the trend change. Based on this data, the system determines whether there is an "overfitting" or "underfitting" phenomenon in the current main correction function. For example, when the residual value continuously increases and the direction is stable, it may mean that the fitting function fails to effectively track the error curve, then it is necessary to increase the function complexity (such as adding higher-order terms) or shorten the time window to enhance the sensitivity. On the contrary, if the residuals fluctuate violently, it may be caused by overfitting of the model resulting in excessive sensitivity, and it is necessary to reduce the parameter complexity or expand the time window to enhance the stability. According to the above judgment, this unit ensures that the main correction function can respond to the magnetic field change trend in real time by adjusting the slope coefficient, constant term, and weight parameter in the fitting function, or dynamically expanding or reducing the length of the sliding time window, avoiding the phenomenon of long-term model deviation, thereby improving the accuracy of the system origin positioning.

[0132] In a preferred embodiment of the present invention, the trend tolerance generation sub-module includes:

[0133] The difference sequence generation unit is used to record the second differences in multiple consecutive detection cycles to form a second difference sequence;

[0134] The change amplitude measurement unit is used to calculate the change amplitude of the second difference in the current cycle compared with the previous cycle according to the second difference sequence;

[0135] The slope fitting unit is used to fit the second difference sequence to obtain a fitting change slope;

[0136] The threshold setting unit is used to calculate and output the adaptive tolerance threshold of the current cycle according to the current change amplitude and the fitting change slope.

[0137] In the embodiment of the present invention, the trend tolerance generation sub-module plays a key role in the positioning verification module. Through the combined action of the difference sequence generation unit, the change amplitude measurement unit, the slope fitting unit, and the threshold setting unit, a dynamic and self-adjustable tolerance management mechanism is realized. First, the difference sequence generation unit records the second differences in multiple consecutive detection cycles to form a time series structure. This sequence not only reflects the single-point deviation, but also provides a time-series data basis for subsequent dynamic trend evaluation.

[0138] Based on this sequence, the change amplitude measurement unit further calculates the change between the second difference in the current detection period and the value in the previous period, obtaining a fluctuation degree index to characterize the error jump characteristics in the short term. Meanwhile, the slope fitting unit performs fitting processing on the entire difference sequence, usually using methods such as linear least squares fitting, and outputs a trend slope to describe whether the error value shows a trend of intensification or mitigation. Combining the two dimensions of change amplitude and fitting slope, the system can determine whether the error is in a stable decline, jitter, or growth state.

[0139] Finally, the threshold setting unit synthesizes the above two input indicators to generate an adaptive tolerance threshold for the current period. This threshold changes dynamically according to the actual operating state, and can avoid the judgment deviation problem of being too strict or too loose for fixed thresholds in some periods. Through this mechanism, the system has a composite tolerance evaluation ability of "error sensitivity" and "trend discrimination ability", significantly enhancing the robustness and response flexibility of the origin position determination.

[0140] Among them, the slope fitting unit is used to establish a trend line of the change of the difference over time based on the second difference sequence within multiple consecutive detection periods, and estimate the change slope of the trend line to reflect the current error growth or convergence rate. Specifically, it includes:

[0141] This unit first records the second differences within multiple consecutive periods and arranges them in chronological order to form a difference sequence. Then, the system uses a fitting method (such as least squares fitting) to perform linear trend modeling on this sequence, fitting a straight line that approximately represents the change trend of the difference. After fitting, the system extracts the slope value of the fitted straight line, which is the change slope of the difference. A positive slope indicates that the error is increasing, a negative slope indicates that the error tends to decrease, and a slope close to zero indicates that the error is basically stable. Through this slope value, the system can reflect whether the system is in an error accumulation stage, a stable stage, or a rapid correction stage, providing a basis for setting an appropriate tolerance range. To enhance the anti-noise performance, this unit can introduce a moving average preprocessing operation or smooth and correct outliers to improve the stability and accuracy of slope fitting.

[0142] Among them, the threshold setting unit is used to comprehensively generate an adaptive tolerance threshold for the current period based on the change slope output by the slope fitting unit and the change amplitude of the second difference in the current detection period. Specifically, it includes:

[0143] The system first receives the current cycle slope value output by the slope fitting unit, combines the change amount between the second differences of the previous cycle and the current cycle, and calculates the difference fluctuation amplitude. This amplitude reflects the sensitivity degree of the current system deviation, and the slope value reflects the trend direction. This unit sets a set of non-linear mapping rules or look-up table strategies based on the absolute value of the slope and the fluctuation amplitude, and selects a suitable tolerance threshold from them. For example, when the change amplitude is small and the slope approaches zero, a smaller tolerance threshold can be set to improve the positioning accuracy; on the contrary, if the slope changes suddenly or fluctuates violently, the tolerance range needs to be expanded to avoid misjudgment. This unit can also introduce minimum and maximum tolerance limits to avoid tolerance distortion caused by extreme data, so as to achieve double guarantees for the system's dynamic adaptability and positioning stability.

[0144] In a preferred embodiment of the present invention, the goodness-of-fit evaluation unit includes:

[0145] A residual statistics sub-unit, which is used to calculate the fitting residuals between the error change curve and each error change function point by point, and form a residual vector;

[0146] A coefficient of determination calculation sub-unit, which is used to calculate the coefficient of determination value of each error change function according to the residual vector and in combination with the total variation of the error change curve;

[0147] A weighted score generation sub-unit, which is used to perform weighted fusion on the sum of squared residuals and the coefficient of determination corresponding to each error change function to generate a goodness-of-fit score value.

[0148] In the embodiment of the present invention, a residual trend analysis unit is constructed in the model parameter adjustment sub-module, and is further refined into a weighted sliding processing sub-unit, a trend turning point judgment sub-unit, a multi-scale fusion sub-unit and a trend output sub-unit, which can perform multi-dimensional real-time evaluation on the model prediction performance. The weighted sliding processing sub-unit assigns time-decreasing weights to the residual values of multiple consecutive cycles to construct a trend data sequence. This method ensures that the recent residuals have more analysis weights, so that the output result is more sensitive to the current system state.

[0149] The trend turning point judgment sub-unit is based on this trend data sequence to identify the change direction of the residual trend. Once a turning point from continuous increase to decrease or from decrease to increase is detected, a trend turning point flag signal is generated. This signal can be used as a trigger basis for system warning or model re-evaluation, has a fast response ability, and is suitable for dealing with model distortion problems caused by sudden disturbances.

[0150] To enhance the stability and global insight ability of trend analysis, the multi-scale fusion subunit designs two analysis windows with different lengths to construct short-term and long-term trend data respectively. By comparing the two, it can identify both rapid fluctuations and slow-changing trends simultaneously, improving the adaptability of the model in different dynamic scenarios. The trend output subunit then outputs the turning signal and the fused trend result uniformly, serving as the direct input basis for updating the function parameters in the trend offset correction module.

[0151] Overall, this module has the advantages of trend prediction, fluctuation inflection point identification, scale balance, and high stability, providing data support for the continuous optimization of the main correction function and effectively preventing the accumulation of positioning errors caused by overfitting or lag response of the error model.

[0152] In a preferred embodiment of the present invention, the weighted score generation subunit includes:

[0153] A log inverse residual scoring unit, which takes the reciprocal of the sum of the squared residuals of each error change function after adding a very small positive number and performs a logarithmic process to calculate the first score value;

[0154] A coefficient of determination extraction unit, which extracts the coefficient of determination of the error change function as the second score value;

[0155] A complexity penalty term calculation unit, which calculates the ratio of the function fitting order to the current fitting time window length to obtain the model complexity factor, and simultaneously performs weighted fusion on the ratio of the number of parameters to the number of fitting points to obtain the penalty factor;

[0156] A weighted score synthesis unit, which performs weighted fusion according to the first score value, the second score value, the model complexity factor, and the penalty factor to calculate the goodness-of-fit score value of each function : ;

[0157] Wherein, is the sum of the squared residuals of the th error change function, is the reciprocal of the total sum of squared residuals, that is , is the coefficient of determination of the th error change function, is a very small positive number introduced to prevent the denominator from being zero, is the fitting order of the th error change function, such as 1 for a linear function and 2 for a quadratic function, is the time window length of the current error change curve, is the reciprocal of the preset maximum time window length for normalization, is the The number of parameters of an error change function is the total number of fitting points, i.e., the number of sampling points within the sliding window , , , , are adjustable weight coefficients, satisfying , , ; , where is the actual magnetic offset data value at the th time point; is the fitting value of a certain error change function at the th time point, is the normalization reference unit of magnetic field strength (such as the maximum range or device resolution); this formula represents the sum of squares of all prediction errors, and the smaller the value, the better the function fitting effect; , where is the mean value of the actual magnetic offset data; the numerator part is the sum of squared residuals; the denominator part is the total variation (total sum of squares); the value range of the coefficient of determination is [0, 1], and the closer it is to 1, the better the fitting effect.

[0158] In the embodiments of the present invention, a log reciprocal residual difference score numerator unit, a coefficient of determination extraction sub-unit, a complexity penalty term calculation sub-unit, and a weighted score synthesis sub-unit are introduced, providing a multi-dimensional, fine-grained, and adjustable mathematical scoring mechanism for goodness-of-fit evaluation.

[0159] First, the log reciprocal residual difference score numerator unit takes the sum of squared residuals corresponding to each error change function as input, performs reciprocal processing first and then takes the logarithm to obtain the first score value. By compressing extreme value fluctuations through the logarithmic function and enhancing the discrimination of functions with low sum of squared residuals, it is beneficial to select the candidate function with the smallest fitting error.

[0160] The coefficient of determination extraction sub-unit directly uses the fitting coefficient of determination as the second score value, representing the proportion of the function fitting result in the total variation of the explained error change curve, thereby reflecting the overall goodness of fit.

[0161] The complexity penalty term calculation sub-unit is designed in two parts: one is the ratio of the function fitting order to the length of the sliding time window, reflecting the complexity of the model under the given data window and preventing overfitting of high-order models; the other is the ratio of the number of model parameters to the number of fitting points, generating a penalty factor through weighted fusion. This factor is used to balance the contradiction between fitting accuracy and structural simplicity.

[0162] The weighted scoring synthesis subunit performs a weighted combination on the above three core dimension values and outputs the final goodness-of-fit scoring value. This scoring value not only reflects the accuracy of function fitting but also takes into account the model generalization ability and structural efficiency.

[0163] Among them, in this formula , , are determined as follows:

[0164] (I) Static setting (suitable for initial deployment):

[0165] The recommended values are as follows: : Pay more attention to the fitting error itself (suitable for highly sensitive scenarios); : More inclined to the model stability and interpretability of the coefficient of determination; : Moderately penalize complex models to prevent overfitting.

[0166] This configuration is suitable for deployment and debugging in the initial stage, stable and reliable, and the calculation is simple.

[0167] (II) Empirical optimization setting (recommended method):

[0168] By correlating the three factor values of multiple fitting functions with the actual error in the historical data records of system operation, the weight combination is inversely deduced through methods such as least squares fitting, linear regression, or support vector machine, so as to minimize the origin determination error. This method has strong adaptability and versatility.

[0169] Suggested process:

[0170] Set multiple weight combinations (for example interval value);

[0171] Use each combination to calculate on the historical error curve;

[0172] Use sorting and the actual error effect for correlation evaluation;

[0173] Select the optimal combination as the current weight parameter.

[0174] (III) Dynamic adaptive setting (used for high-end intelligent control systems):

[0175] Associate , with dynamic data such as external disturbance changes and model refitting frequency, introduce strategies such as neural networks, fuzzy control, or Bayesian optimization, and adjust the weights according to the current state of the system, so as to improve the adaptability of the model scoring mechanism to sudden errors.

[0176] For example: when the system detects frequent changes in disturbances, increase the weight (more emphasizing residual control); when the system is running stably, increase the weight (emphasizing the interpretability of long-term trends); if the function order or the number of fitting points is too large, automatically increase the penalty coefficient.

[0177] In addition, 、 the above method can also be adopted.

[0178] In a preferred embodiment of the present invention, the residual trend analysis unit includes:

[0179] A weighted sliding processing subunit, configured to assign decreasing weights to the residual values in multiple consecutive detection periods in chronological order, and perform weighted sliding average processing to form first trend data;

[0180] A trend turning point judgment subunit, configured to identify whether a reverse inflection point appears in the residual trend according to the change direction in adjacent time periods in the first trend data, and generate a trend turning point flag signal when it is detected that the trend changes from continuous increase to decrease or from decrease to increase;

[0181] A multi-scale fusion subunit, configured to construct second trend data and third trend data within a preset short-period window and a preset long-period window respectively, and perform fusion comparison on the two to generate a comprehensive trend index of residual change;

[0182] A trend output subunit, configured to merge the trend turning point flag signal and the comprehensive trend index to form residual change trend data.

[0183] In the embodiment of the present invention, the residual trend analysis unit is further refined into a weighted sliding processing subunit, a trend turning point judgment subunit, a multi-scale fusion subunit, and a trend output subunit, significantly enhancing the system's perception ability and response ability to the change trend of model errors. The weighted sliding processing subunit first assigns weights to the residual values in the time dimension, giving priority to the near-period residuals and weakening the influence of the far-period. This processing method effectively filters out the high-frequency noise components in the residuals by constructing a weighted sliding average sequence, making the trend analysis result more stable.

[0184] The trend turning point judgment subunit is used to detect the key time nodes of trend changes. If the weighted trend data shows monotonic changes (such as increasing or decreasing) in multiple consecutive periods, and a reverse change occurs in the current period, a turning point flag signal is generated. This mechanism realizes the system's ability to adaptively identify sudden changes in the performance of the error model without the need for external artificial threshold setting. For the prediction deviation that may be caused by external disturbances or model aging, this module provides a timely feedback path.

[0185] The multi-scale fusion subunit design has two sliding time windows, which generate short-term trend data and long-term trend data respectively. The short cycle is used to capture local fluctuations, and the long cycle is used to model slow-changing trends. The two complement each other. During the fusion process, a weighted average or trend consistency scoring mechanism can be adopted to synthesize the two types of trend indicators into a more representative residual change trend indicator, improving the comprehensiveness and robustness of the determination.

[0186] The trend output subunit is responsible for uniformly organizing the trend inflection point signal and the multi-scale fusion trend indicator, and outputting them to the model parameter adjustment sub-module as the core trigger basis for its adjustment logic. Thus, the dynamic update of the entire correction function is not only based on the static residual size, but also introduces trend structural judgment, enhancing the anti-offset ability and algorithm stability of the system under long-term operation and complex environments.

[0187] Among them, the weighted sliding processing subunit is used to perform weight-decreasing processing on the residual values recorded within multiple consecutive detection cycles in chronological order to highlight the influence of the recent residual change trend and suppress the interference of past cycles. Specifically, it includes:

[0188] The system first sets a sliding window of a preset length and collects the residual values of each cycle within this window. Subsequently, a corresponding weight is assigned to each cycle's residual value, and this weight decreases in reverse chronological order. For example, the weight of the latest cycle is the largest, and the weight of the earliest cycle is the smallest. Then, each residual value is multiplied by its corresponding weight, and all the weighted residual values are added together and divided by the sum of the weights to obtain the weighted sliding mean of the current cycle. This mean is called the first trend data, representing the residual change direction and intensity of the system within the current detection window. By introducing the weighted processing mechanism, the sensitivity to the recent trend can be improved, and the lag effect that old data may bring can be effectively weakened.

[0189] Among them, the trend turning point judgment subunit is used to detect whether there is a reverse change in the first trend data from rising to falling or from falling to rising, so as to identify the important inflection points that occur during the system error correction process. Specifically, it includes:

[0190] For each newly added residual value in a detection period, the system updates the first trend data once and compares it with the first trend data of the previous period. If there is a change in the direction of the current trend data compared to the previous value (such as from positive to negative or from negative to positive), a "trend turn" can be determined. This subunit further confirms the significance of the turn through the reverse mode of the continuous trend. For example, it is required that the same-direction trend be maintained for at least two periods after the reversal before it is determined as a valid turning point. Once the turning point is confirmed, this unit immediately outputs a trend turn flag signal for subsequent residual trend analysis and parameter adjustment of the main correction function, ensuring that the system can respond quickly when detecting a sudden change in the error trend.

[0191] Among them, the multi-scale fusion subunit is used to generate trend data under sliding windows of different time scales respectively, and comprehensively judge the stability and volatility of residual changes by comparing the similarities and differences between short-term trends and long-term trends, specifically including:

[0192] The system simultaneously maintains two sliding time windows: one is used to calculate short-period trend data (such as the most recent 5 detection periods), and the other is used to calculate long-period trend data (such as the most recent 15 detection periods). The data inside each window is generated into corresponding second trend data and third trend data through the above-mentioned weighted sliding processing. Subsequently, this unit conducts a comparative analysis of the two, observing whether their change directions are consistent, whether the fluctuation amplitudes are synchronized, and whether there are features such as trend divergence or enhanced consistency. If the short-term trend changes sharply but the long-term trend is stable, it indicates a short-term disturbance; conversely, if both are consistent, it indicates a high trend credibility. Through this dual-scale comparison method, the system can more comprehensively understand the error trend and provide multi-dimensional support for the trend adjustment strategy.

[0193] Among them, the trend output subunit is used to combine and process the trend turn flag signal generated by the trend turn judgment subunit and the comprehensive trend index formed by the multi-scale fusion subunit to form residual change trend data and output it to the model parameter adjustment sub-module, specifically including:

[0194] This unit first determines whether there is a turn flag signal currently. If so, it takes it as one of the important triggering conditions for trend changes. Then, this unit combines the numerical strength and trend direction of the comprehensive trend index to form a complete description of trend characteristics, including but not limited to: whether the current residual change intensifies, whether it tends to be stable, whether a structural reversal occurs, etc. Finally, this information is encoded into residual change trend data and output to the model parameter adjustment sub-module to determine whether to adjust the parameters of the main correction function, the prediction window, or the compensation strategy. Through this unified output mechanism of the residual trend data, the system ensures that trend analysis has a continuous effect in the control link and guarantees the response accuracy and stability during the origin positioning process.

[0195] The above are the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A magnetic sensor control system with origin positioning and limit functions, characterized in that, The system includes: A dynamic magnetic field tracking module, which is used to receive real-time magnetic field data detected by a magnetic sensor and set reference magnetic field data; calculate a first difference based on the reference magnetic field data and the current real-time magnetic field data to form magnetic offset data; A trend offset correction module, which is used to perform sliding statistics on the magnetic offset data to form an error change curve, and select a main correction function from a preset group of error change functions through goodness-of-fit evaluation; generate an offset compensation amount according to the predicted value of the main correction function, dynamically adjust the reference magnetic field data, and form a dynamic origin magnetic field reference value; A positioning verification module, which is used to calculate a second difference according to the dynamic origin magnetic field reference value and in combination with the current real-time magnetic field data; when the second difference is lower than a set adaptive tolerance threshold in multiple consecutive detection periods, determine that the position where the moving member is located is the origin position, form a determination success signal, otherwise feedback the second difference to the trend offset correction module to achieve correction of the dynamic origin magnetic field reference value; A limit judgment control module, which is used to send a stop control instruction to the motor drive module according to the determination success signal.

2. The magnetic sensor control system with origin positioning and limiting functions according to claim 1, characterized in that The dynamic magnetic field tracking module includes: A real-time magnetic field data receiving sub-module, which is used to continuously receive real-time magnetic field data detected by a magnetic sensor to form magnetic field data; A multi-source data evaluation sub-module, which is used to perform sliding segmentation and volatility analysis on the magnetic field data in the recent preset number of detection periods, identify multiple stable segments of magnetic field data whose fluctuation range or variance is lower than the preset stability threshold, and combine external disturbance information to eliminate the stable segments with abnormal disturbances to form a candidate reference magnetic value set; A reference value optimization sub-module, which is used to calculate the variance of the candidate reference magnetic value set, generate a stability score, and select the magnetic value with the best score as the reference magnetic field data; A difference generation sub-module, which is used to perform a difference operation according to the current real-time magnetic field data and the reference magnetic field data, calculate the first difference, and form magnetic offset data.

3. A magnetic sensor control system with origin positioning and limiting functions according to claim 1, characterized in that, The trend offset correction module includes: An error curve generation sub-module, which is used to perform continuous sliding statistics on the magnetic offset data to construct an error change curve for describing the change trend of the magnetic offset data over time; A main function selection sub-module, which is used to fit the error change curve with a preset number of error change functions, evaluate the matching degree of each function based on the goodness-of-fit index, and select the error change function with the best goodness of fit as the main correction function; A reference value update sub-module, which is used to generate an offset compensation amount according to the current predicted value of the main correction function, and perform weighted fusion with the reference magnetic field data to form a dynamic origin magnetic field reference value; A model parameter adjustment sub-module, which is used to receive the second difference, calculate the corresponding residual in combination with the predicted value of the main correction function, and adjust the fitting parameters of the main correction function or the length of the sliding time window according to the residual.

4. A magnetic sensor control system with origin positioning and limiting functions according to claim 3, characterized in that The positioning verification module includes: A trend tolerance generation sub-module, which is used to receive the dynamic origin magnetic field reference value and the current real-time magnetic field data, calculate the second difference, and set an adaptive tolerance threshold in combination with the fitting change slope and the current change amplitude of the second difference; A continuous trend determination sub-module, which is used to compare the second difference in each detection period with the adaptive tolerance threshold in multiple consecutive detection periods; when consecutive detection periods meet the difference constraint condition, it outputs a determination success signal; A local adjustment feedback sub-module, which is used to feedback the second difference to the trend offset correction module when there are some detection periods that do not meet the difference constraint condition but do not reach the preset upper limit of consecutive times, for the model parameter adjustment sub-module to update the parameters; A structure adjustment feedback sub-module, which is used to send a main correction function update request to the trend offset correction module after the number of consecutive times of not meeting the difference constraint condition reaches the preset upper limit of consecutive times, so as to re-select a better error change function to correct the origin reference value.

5. A magnetic sensor control system with origin positioning and limiting functions according to claim 2, characterized in that The multi-source data evaluation sub-module includes: A sliding segmentation generation unit, which is used to perform time division on the magnetic field data within the recent preset number of detection periods to form multiple consecutive magnetic field data sub-segments; A stability judgment unit, which is used to calculate the fluctuation range or variance of each magnetic field data sub-segment, and mark the data sub-segments lower than the preset stability threshold as magnetic field data stable segments; A disturbance rejection unit, which is used to identify and reject the data segments with abnormal disturbance responses based on the external disturbance information corresponding to the stable segments, and form a set of magnetic field data stable segments; A candidate mean extraction unit, which is used to calculate the magnetic field value mean of each magnetic field data stable segment according to the set of magnetic field data stable segments, and form a set of candidate reference magnetic values.

6. A magnetic sensor control system with origin positioning and limiting functions according to claim 3, characterized in that, The main function selection sub-module includes: An error fitting processing unit, which is used to receive the error change curve output by the error curve generation sub-module, and fit the curve with a preset multiple error change functions respectively to obtain the fitting output data corresponding to each function; A goodness-of-fit evaluation unit, which is used to calculate the sum of squared residuals and the coefficient of determination of each error change function respectively according to the fitting output data, and perform weighted fusion to form a goodness-of-fit score value; A function selection execution unit, which is used to select the error change function with the highest score as the main correction function according to the goodness-of-fit score value, and output it to the reference value update sub-module.

7. A magnetic sensor control system with origin positioning and limiting functions according to claim 6, characterized in that, The model parameter adjustment sub-module includes: A residual calculation unit, which is used to receive the second difference and combine the current predicted value of the main correction function to calculate its corresponding residual value; A residual trend analysis unit, which is used to perform sliding statistics on the residual values of multiple consecutive periods to generate residual change trend data; A parameter adjustment execution unit, which is used to dynamically adjust the fitting parameters of the main correction function or the sliding time window length according to the residual change trend data, and output the adjusted main correction function to the reference value update unit.

8. A magnetic sensor control system with origin positioning and limiting functions according to claim 4, characterized in that The trend tolerance generation sub-module includes: A difference sequence generation unit, which is used to record the second differences in multiple consecutive detection periods to form a second difference sequence; A change amplitude measurement unit, which is used to calculate the change amplitude of the second difference in the current period compared with the previous period according to the second difference sequence; A slope fitting unit, which is used to fit the second difference sequence to obtain a fitting change slope; A threshold setting unit, which is used to calculate and output the adaptive tolerance threshold of the current period according to the current change amplitude and the fitting change slope.

9. A magnetic sensor control system with origin positioning and limiting functions according to claim 6, characterized in that, The goodness-of-fit evaluation unit includes: A residual statistics sub-unit, configured to calculate the fitting residuals between the error change curve and each error change function point by point, and form a residual vector; A coefficient of determination calculation sub-unit, configured to calculate the coefficient of determination value of each error change function according to the residual vector in combination with the total variation of the error change curve; A weighted score generation sub-unit, configured to perform weighted fusion on the sum of squared residuals corresponding to each error change function and the coefficient of determination to generate a goodness-of-fit score value.

10. A magnetic sensor control system with origin positioning and limiting functions according to claim 7, characterized in that, The residual trend analysis unit includes: A weighted sliding processing sub-unit, configured to assign decreasing weights to the residual values in multiple consecutive detection periods in chronological order, and perform weighted sliding average processing to form first trend data; A trend turning point judgment sub-unit, configured to identify whether a reverse inflection point appears in the residual trend according to the change direction of adjacent time periods in the first trend data, and generate a trend turning point flag signal when it is detected that the trend changes from continuous increase to decrease or from decrease to increase; A multi-scale fusion sub-unit, configured to construct second trend data and third trend data respectively within a preset short-period window and a preset long-period window, and perform fusion comparison on the two to generate a comprehensive trend index of the residual change; A trend output sub-unit, configured to merge the trend turning point flag signal and the comprehensive trend index to form residual change trend data.

Citation Information

Cited By

  • Displacement sensor signal correction method of transverse displacement unlocking coupling system

    CN120995354A

  • A displacement sensor signal correction method for a lateral displacement unlocking coupling system

    CN120995354B

  • Data acquisition verification system of miniature data acquisition instrument

    CN121278615A

  • A data acquisition and verification system for a miniature data acquisition instrument

    CN121278615B