Dynamic position estimation and compensation method in case of loss of Hall signal of brush driving skylight

By using adaptive filtering and real-time speed compensation methods, the problem of sunroof position estimation error caused by Hall signal loss was solved, achieving stable position estimation and compensation even in the case of Hall signal loss, thus improving the accuracy and anti-interference capability of sunroof control.

CN121664052APending Publication Date: 2026-03-13HANGZHOU XIANGBIN ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In automotive sunroof control, large position estimation errors caused by the loss of Hall signals can lead to safety hazards such as the sunroof failing to close completely or overtraveling.

Method used

By employing adaptive filtering for de-jittering, real-time speed compensation, and dynamic window detection, the motion direction is identified and speed is analyzed using the edge time difference of the motor voltage sequence, motor current sequence, and dual-channel square wave signal groups. An edge window sequence group is generated to detect lost signals and perform position compensation.

Benefits of technology

Stable position estimation was achieved even in the event of Hall signal loss, improving the accuracy and robustness of sunroof position control and avoiding overtravel and misalignment problems caused by signal loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121664052A_ABST
    Figure CN121664052A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic position estimation and compensation method when a brush driving skylight Hall signal is lost, and the method comprises the steps: carrying out the adaptive filtering jitter removal and edge marking of a dual-path Hall signal group of a brush motor, and obtaining a dual-path square signal group; performing motion direction identification and rotating speed analysis on the brush motor according to the edge time difference of the double-path square wave signal group to obtain motor rotating speed information; performing edge prediction on the two-way square wave signal group based on the motor rotating speed information to obtain an analysis edge sequence group, and generating an edge window sequence group based on the analysis edge sequence group; carrying out lost signal detection and lost signal positioning on the real-time Hall signal group obtained in real time according to the edge window sequence group to obtain a lost position set; and acquiring real-time position information of the skylight, and performing dynamic position compensation on the real-time position information according to the rotating speed information of the motor and the lost position set to obtain compensation position information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automotive sunroof control technology, and in particular to a method for dynamic position estimation and compensation when the Hall signal of a brushed sunroof is lost. Background Technology

[0002] The sunroof controller is a core component controlling the opening and closing, ventilation, and sunshade of the sunroof. Common sunroof controllers use a brushed Hall effect motor to drive the sunroof's movement. By detecting the magnetic poles of the brushed motor, the controller determines the current direction and distance of the sunroof's movement, thus accurately controlling the sunroof to open and close at a designated position. However, under conditions of vehicle vibration or loose / aged wiring harnesses, the motor's Hall effect signal may be intermittently lost due to wiring harness vibration or poor contact. This causes a deviation between the actual position of the sunroof and the controller's calculated position, potentially leading to safety hazards such as the sunroof failing to close completely or overtravel. Summary of the Invention

[0003] (a) Technical problems to be solved To address the shortcomings of existing technologies, this invention provides a dynamic position estimation and compensation method for brushed sunroofs when Hall signals are lost. This method has the advantages of adaptive filtering and de-jittering, real-time speed compensation, and dynamic window detection, and solves the problem of large position estimation errors caused by Hall signal loss, voltage fluctuations, and load changes in automotive sunroof control.

[0004] (II) Technical Solution To achieve the above objectives, the present invention provides the following technical solution: This invention provides a method for dynamic position estimation and compensation when the Hall signal of a brushed sunroof is lost, comprising the following steps: A method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof, characterized in that the method includes: The brushed motor of the sunroof is sampled in real time to obtain a dual-channel Hall signal group, and the dual-channel Hall signal group is subjected to adaptive filtering, jitter reduction and edge marking to obtain a dual-channel square wave signal group. The motor voltage sequence and motor current sequence of the brushed motor are obtained, and the motion direction and speed of the brushed motor are identified and analyzed based on the motor voltage sequence, the motor current sequence and the edge time difference of the dual square wave signal group to obtain the motor speed information. Based on the motor speed information, edge prediction is performed on the dual-channel square wave signal group to obtain an analysis edge sequence group, and an edge window sequence group is generated based on the analysis edge sequence group. Based on the edge window sequence group, the dual-channel Hall signal group is used to detect and locate lost signals, thereby obtaining a set of lost locations; The real-time position information of the sunroof is obtained, and dynamic position compensation is performed on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information.

[0005] According to a preferred embodiment of the present invention, the step of performing adaptive filtering and de-jittering and edge marking on the dual-channel Hall signal group to obtain a dual-channel square wave signal group includes: The electrical signal variance of the dual-channel Hall signal group is calculated to obtain the signal variance group; A set of filter coefficients and a set of filter windows corresponding to the set of filter coefficients are generated based on the signal variance set. The dual-channel Hall signal group is filtered and de-jittered according to the filter coefficient group and the filter window group to obtain a dual-channel de-jittered signal group. The signal slope of the dual-channel de-jitter signal group is calculated based on the differential method, and the edge of the dual-channel de-jitter signal group is marked according to the signal slope calculation result to obtain the dual-channel square wave signal group.

[0006] According to another preferred embodiment of the present invention, the step of identifying the motion direction and analyzing the speed of the brushed motor based on the motor voltage sequence, the motor current sequence, and the edge time difference of the dual-channel square wave signal group to obtain motor speed information includes: The edge signals in the dual-channel square wave signal group are timestamp extracted to obtain an edge timestamp sequence group, and the standard square wave period of the dual-channel square wave signal group is calculated based on the edge timestamp sequence group. The direction of motion of the brushed motor is identified based on the standard square wave period, the edge timestamp sequence group, and the installation positions of the two Hall sensors in the brushed motor, thereby obtaining the motor rotation direction. The edge timestamp sequence is merged into a dual-edge timestamp sequence according to the time sequence. The time difference between two consecutive dual-edge timestamps in the dual-edge timestamp sequence is calculated according to the sequence number to obtain the time difference sequence. The stability of the time difference sequence is screened using a preset time-domain sliding window to obtain a stable time difference sequence group, and the mean of the stable time difference sequence group is used as the edge time difference. The motor reference speed is calculated based on the edge time difference, and the motor reference speed is compensated and updated according to the stable time difference sequence group, the motor voltage sequence, and the motor current sequence to obtain the real-time speed sequence; The real-time speed sequence and the motor rotation direction are combined to form motor speed information.

[0007] According to another preferred embodiment of the present invention, the step of identifying the motion direction of the brushed motor based on the standard square wave period, the edge timestamp sequence group, and the installation positions of the two Hall sensors in the brushed motor to obtain the motor rotation direction includes: The earliest edge timestamp sequence in the edge timestamp sequence group is selected as the first edge timestamp sequence, and the other edge timestamp sequence in the edge timestamp sequence group is selected as the second edge timestamp sequence. The edge timestamp with the smallest sequence number in the first edge timestamp sequence is taken as the first edge timestamp, and the edge type of the first edge timestamp is taken as the target edge type. The edge timestamp with the same type as the target edge and the smallest sequence number in the second edge timestamp sequence is taken as the second edge timestamp, and the time difference between the second edge timestamp and the first edge timestamp is taken as the dual-path time difference. The phase difference between the two channels is calculated based on the standard square wave period and the time difference between the two channels. The Hall sensor corresponding to the first edge timestamp sequence in the brushed motor is used as the first Hall sensor, and the Hall sensor corresponding to the second edge timestamp sequence in the brushed motor is used as the second Hall sensor. Obtain the forward position angle difference and the reverse position angle difference between the first Hall sensor and the second Hall sensor; When the dual-path phase difference is closer to the positive position angle difference, the rotation direction of the brushed motor is determined to be positive rotation. When the phase difference between the two paths is closer to the angle difference between the opposite positions, the direction of rotation of the brushed motor is determined to be the opposite direction.

[0008] According to another preferred embodiment of the present invention, the step of compensating and updating the motor reference speed based on the stable time difference sequence group, the motor voltage sequence, and the motor current sequence to obtain the real-time speed sequence includes: The average value of the voltage corresponding to the stable time difference sequence group in the motor voltage sequence is taken as the stable voltage, and the average value of the current corresponding to the stable time difference sequence group in the motor current sequence is taken as the stable current. Select one voltage from the motor voltage sequence as the target voltage, and take the current corresponding to the target voltage in the motor current sequence as the target current; The target effective voltage is calculated based on the target voltage and the target current, and the stable effective voltage is calculated based on the stable voltage and the stable current. The ratio of the target effective voltage to the stable effective voltage is used as a compensation coefficient. The motor reference speed is updated using the compensation coefficient to obtain the real-time speed, and all real-time speeds are aggregated into a real-time speed sequence.

[0009] According to another preferred embodiment of the present invention, the step of performing edge prediction on the dual-channel square wave signal group based on the motor speed information to obtain an analysis edge sequence group includes: The reference edge timestamps are extracted from each of the dual-channel square wave signals in the dual-channel square wave signal group to obtain the reference edge timestamp group. Based on the real-time speed sequence in the motor speed information, square wave edge prediction is performed on the dual-channel square wave signal group to obtain the analysis edge time difference sequence. Based on the motor rotation direction in the motor speed information and the analysis edge time difference sequence, the reference edge timestamp group is extended to obtain the analysis edge sequence group.

[0010] According to another preferred embodiment of the present invention, the step of detecting and locating lost signals in the dual-channel Hall signal group based on the edge window sequence group to obtain a set of lost locations includes: Each edge window in the edge window sequence group is selected as a target edge window, and the target edge window is used to determine whether there is an edge signal in the corresponding position of the dual Hall signal group. If so, return to the step of selecting each edge window in the edge window sequence group as the target edge window; If not, it is determined that the dual Hall signal group has signal loss within the target edge window, and the window midpoint of the target edge window is taken as the loss position; Until the target edge window is the last edge window in the edge window sequence group, all lost positions are aggregated into a lost position set.

[0011] According to another preferred embodiment of the present invention, the step of performing dynamic position compensation on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information includes: The real-time speed sequence and the motor rotation direction are extracted from the motor speed information; The signal loss duration is extracted from the dual-channel Hall signal group based on the set of lost locations. The real-time speeds corresponding to the lost position set in the real-time speed sequence are aggregated into a lost signal speed set, and the mean of the lost signal speed set is used as the reference lost signal speed. The number of lost rotations is calculated based on the signal loss duration and the rotation speed of the reference lost signal, and the sunroof movement error is calculated based on the number of lost rotations. The sunroof movement direction is determined based on the motor rotation direction. The real-time position information is then compensated based on the sunroof movement direction and the sunroof movement error to obtain compensated position information.

[0012] According to another preferred embodiment of the present invention, the step of extracting the signal loss duration from the dual-channel Hall signal group based on the loss location set includes: Each lost position in the lost position set is selected as the target lost position. The first edge signal in the dual-channel Hall signal group before the lost position is taken as the pre-loss edge signal, and the first edge signal in the dual-channel Hall signal group after the lost position is taken as the post-loss edge signal. The time difference between the lost trailing edge signal and the lost preceding edge signal is taken as the loss time difference; The lost position group comprises all lost positions located between the lost trailing edge signal and the lost preceding edge signal. The total number of lost locations in the target lost location group is taken as the number of target lost signals, and the target loss duration is calculated based on the number of target lost signals and the loss time difference; Filter out all lost locations in the target lost location group from the lost location set, and return to the step of selecting lost locations in the lost location set one by one as the target lost location; Until the set of lost locations becomes empty, the sum of the durations of all target loss is taken as the signal loss duration.

[0013] To achieve at least one of the above-mentioned objectives, the present invention further provides a dynamic position estimation and compensation system for a brushed sunroof when the Hall signal is lost. The system includes an edge marking module, a rotational speed analysis module, an edge prediction module, a lost signal detection module, and a position compensation module, wherein: The edge marking module is used to sample the brushed motor of the sunroof in real time to obtain a dual-channel Hall signal group, and to perform adaptive filtering, de-jittering and edge marking on the dual-channel Hall signal group to obtain a dual-channel square wave signal group. The speed analysis module is used to acquire the motor voltage sequence and motor current sequence of the brushed motor, and to identify the motion direction and analyze the speed of the brushed motor based on the motor voltage sequence, the motor current sequence and the edge time difference of the dual square wave signal group to obtain the motor speed information. The edge prediction module is used to perform edge prediction on the dual-channel square wave signal group based on the motor speed information, obtain the analysis edge sequence group, and generate the edge window sequence group based on the analysis edge sequence group. The lost signal detection module is used to perform lost signal detection and lost signal location on the dual-channel Hall signal group according to the edge window sequence group, and obtain a set of lost positions. The position compensation module is used to obtain the real-time position information of the sunroof, and to perform dynamic position compensation on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information.

[0014] The present invention further provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described method for dynamic position estimation and compensation when a brushed sunroof Hall signal is lost.

[0015] (III) Beneficial Effects Compared with the prior art, the present invention provides a method and system for dynamic position estimation and compensation when the Hall signal of a brushed sunroof is lost, which has the following beneficial effects: This method for dynamic position estimation and compensation when the Hall signal of a brushed drive sunroof is lost utilizes edge timestamp sequences to calculate the square wave period and phase difference, enabling accurate differentiation of rotation direction without additional hardware. By using a time-domain sliding window to filter the stability of the time difference sequence, abnormal edges can be filtered out under electromagnetic noise or mechanical vibration conditions, thereby obtaining a stable and reliable edge time difference and improving the accuracy of the reference speed. By introducing an effective voltage compensation model based on voltage and current, speed deviations caused by power supply fluctuations or load changes can be corrected in real time, allowing the speed estimation to reflect the true dynamic behavior of the motor and improving the accuracy and robustness of speed calculation.

[0016] This method for dynamic position estimation and compensation when the Hall signal of a brushed drive sunroof is lost uses edge window sequence groups to detect and locate the lost signal of dual Hall signals. It can accurately identify the actual missing state of the Hall signal edge by edge, and make reasonable estimates of the unmeasurable real time point. By predicting the edge of the dual square wave signals based on motor speed information and further generating edge window sequence groups, an accurate timing reference model can be built before the Hall signal is actually lost. By calculating the edge time difference through real-time speed sequence, the prediction model can adapt to the motor cycle changes caused by factors such as voltage fluctuations and slight load changes. It realizes edge-by-edge comparison of the actual Hall signal and detection of lost signals, thereby improving stability in the case of Hall signal failure and avoiding control problems such as overtravel and misalignment caused by signal loss.

[0017] This method for dynamic position estimation and compensation when the Hall signal of a brushed sunroof is lost achieves dynamic compensation for the real-time position information of the sunroof by coupling the motor speed, Hall square wave signal and lost position sequence. Even if the Hall signal jumps, jitters or is intermittently lost, the true displacement can still be inferred from the instantaneous speed and rotation direction of the motor. This makes the sunroof position calculation independent of continuous and complete Hall pulses, improves the anti-interference capability of the system, and can achieve high-precision position recovery without adding additional sensors, thus improving the accuracy of sunroof position compensation. Attached Figure Description

[0018] Figure 1 The diagram shows a flowchart of a method for dynamic position estimation and compensation when the Hall signal of a brushed sunroof is lost, according to the present invention.

[0019] Figure 2 The diagram shown is a schematic representation of the phase difference between two channels of a dual-channel square wave signal group according to an embodiment of the present invention.

[0020] Figure 3 The diagram shown is a schematic diagram of the time difference sequence corresponding to the dual-channel square wave signal group in one embodiment of the present invention.

[0021] Figure 4 The diagram shown is a schematic diagram of a single-channel signal loss in one embodiment of the present invention.

[0022] Figure 5 The diagram shown is a schematic diagram of a dual-channel signal loss in one embodiment of the present invention.

[0023] Figure 6 The diagram shown is a schematic diagram of lost signal detection in one embodiment of the present invention. Detailed Implementation

[0024] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious modifications will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.

[0025] It is understood that the term "a" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple, and the term "a" should not be understood as a limitation on the number.

[0026] Example 1: Please combine Figure 1This invention discloses a method for dynamic position estimation and compensation when the Hall signal of a brushed sunroof is lost. The method includes the following steps: The brushed motor of the sunroof is sampled in real time to obtain a dual-channel Hall signal group. The dual-channel Hall signal group is then subjected to adaptive filtering, jitter reduction, and edge marking to obtain a dual-channel square wave signal group.

[0027] The brushed motor refers to a DC brushed motor used to drive the sunroof of a car. By driving the rotor of the brushed motor to rotate, the sunroof of the car can be closed. The dual-channel Hall signal group consists of two square wave signals with a phase difference generated by two Hall elements inside the brushed motor. When the brushed motor is working, the two Hall elements are driven by the magnetic poles of the rotor, thereby generating a dual-channel Hall signal group with a certain spatial angle difference. In the embodiment, the Hall channels of the brushed motor can be sampled in real time through the general purpose input / output interface (GPIO) or timer of the car sunroof controller to obtain the dual-channel Hall signal group.

[0028] Specifically, the adaptive filtering and de-jittering of the dual-channel Hall signal group to obtain the dual-channel square wave signal group includes: The electrical signal variance of the dual-channel Hall signal group is calculated to obtain the signal variance group; A set of filter coefficients and a set of filter windows corresponding to the set of filter coefficients are generated based on the signal variance set. The dual-channel Hall signal group is filtered and de-jittered according to the filter coefficient group and the filter window group to obtain a dual-channel de-jittered signal group. The signal slope of the dual-channel de-jitter signal group is calculated based on the differential method, and the edge of the dual-channel de-jitter signal group is marked according to the signal slope calculation result to obtain the dual-channel square wave signal group.

[0029] The calculation of electrical signal variance includes sampling each signal in the dual-channel Hall signal group according to a preset sampling interval, calculating the variance of the sampled signal, and pooling the variances of the two channels into a signal variance group. The generation of a filter coefficient group and a corresponding filter window group based on the signal variance group includes: generating a filter coefficient group inversely proportional to the signal variance group; and generating a filter window group with a window size directly proportional to the signal variance group. For example, the reciprocal of the sum of a constant term and twice the signal variance can be used as the filter coefficient, and the sum of a constant term and eight times the signal variance can be used as the window size of the filter window.

[0030] Specifically, the step of filtering and de-jittering the dual-channel Hall signal group according to the filter coefficient group and the filter window group to obtain a dual-channel de-jittering signal group includes: determining whether the window size of the filter window is greater than a preset window threshold; if so, then performing de-jittering by median filtering combined with the corresponding filter coefficients; if not, then performing de-jittering by moving average filtering combined with the corresponding filter coefficients. Edge marking refers to determining the corresponding signal as an edge signal when the absolute value of the slope in the signal slope calculation result is greater than a preset slope threshold, and determining the type of edge signal based on the sign of the slope. That is, when the sign of the slope is positive, it is determined to be a rising edge signal; when the sign of the slope is negative, it is determined to be a falling edge signal. The type and position of the edge signal are then marked in the dual-channel de-jittering signal group.

[0031] By evaluating the variance of the dual Hall signals of the brushed motor, the stability of each signal can be quantified, achieving adaptive matching between filter strength and signal stability, thus improving the anti-glitch capability for high-noise signals. It also maintains higher response sensitivity for stable signals. By dynamically selecting the filtering algorithm based on a window threshold, the filtering algorithm can be dynamically switched between strong and weak interference scenarios, ensuring sufficient de-jittering while avoiding response lag. Precise edge marking is achieved through differential slope, facilitating subsequent direction recognition and speed analysis, enhancing signal stability and accuracy, and improving the reliability of speed analysis and sunroof position control.

[0032] The motor voltage sequence and motor current sequence of the brushed motor are obtained, and the motion direction and speed of the brushed motor are identified and analyzed based on the motor voltage sequence, the motor current sequence and the edge time difference of the dual square wave signal group to obtain the motor speed information.

[0033] The motor voltage sequence is the driving voltage applied to the motor terminals by the sunroof controller during a certain period of time. The motor current sequence is the actual operating current of the brushed motor during that period of time. The motor voltage sequence can be obtained by the brushed motor controller through an analog-to-digital converter, or by a Hall current sensor or a low-resistance sampling resistor. The motor speed information includes the real-time speed sequence and the motor rotation direction.

[0034] In detail, the step of identifying the motion direction and analyzing the speed of the brushed motor based on the motor voltage sequence, the motor current sequence, and the edge time difference of the dual-channel square wave signal group to obtain motor speed information includes: The edge signals in the dual-channel square wave signal group are timestamp extracted to obtain an edge timestamp sequence group, and the standard square wave period of the dual-channel square wave signal group is calculated based on the edge timestamp sequence group. The direction of motion of the brushed motor is identified based on the standard square wave period, the edge timestamp sequence group, and the installation positions of the two Hall sensors in the brushed motor, thereby obtaining the motor rotation direction. The edge timestamp sequence is merged into a dual-edge timestamp sequence according to the time sequence. The time difference between two consecutive dual-edge timestamps in the dual-edge timestamp sequence is calculated according to the sequence number to obtain the time difference sequence. The stability of the time difference sequence is screened using a preset time-domain sliding window to obtain a stable time difference sequence group, and the mean of the stable time difference sequence group is used as the edge time difference. The motor reference speed is calculated based on the edge time difference, and the motor reference speed is compensated and updated according to the stable time difference sequence group, the motor voltage sequence, and the motor current sequence to obtain the real-time speed sequence; The real-time speed sequence and the motor rotation direction are combined to form motor speed information.

[0035] The calculation of the standard square wave period of the dual-channel square wave signal group based on the edge timestamp sequence group includes: selecting the edge timestamp sequence in the edge timestamp sequence group one by one, calculating the time difference between edge timestamps of different edge types in the edge timestamp sequence, taking twice the time difference as the square wave period, collecting all the periods into a square wave period set, and taking the mode of the square wave period set as the standard square wave period. The edge type refers to rising edge type or falling edge type.

[0036] Specifically, the step of identifying the motion direction of the brushed motor based on the standard square wave period, the edge timestamp sequence group, and the installation positions of the two Hall sensors in the brushed motor to obtain the motor rotation direction includes: The earliest edge timestamp sequence in the edge timestamp sequence group is selected as the first edge timestamp sequence, and the other edge timestamp sequence in the edge timestamp sequence group is selected as the second edge timestamp sequence. The edge timestamp with the smallest sequence number in the first edge timestamp sequence is taken as the first edge timestamp, and the edge type of the first edge timestamp is taken as the target edge type. The edge timestamp with the same type as the target edge and the smallest sequence number in the second edge timestamp sequence is taken as the second edge timestamp, and the time difference between the second edge timestamp and the first edge timestamp is taken as the dual-path time difference. The phase difference between the two channels is calculated based on the standard square wave period and the time difference between the two channels. The Hall sensor corresponding to the first edge timestamp sequence in the brushed motor is used as the first Hall sensor, and the Hall sensor corresponding to the second edge timestamp sequence in the brushed motor is used as the second Hall sensor. Obtain the forward position angle difference and the reverse position angle difference between the first Hall sensor and the second Hall sensor; When the dual-path phase difference is closer to the positive position angle difference, the rotation direction of the brushed motor is determined to be positive rotation. When the phase difference between the two paths is closer to the angle difference between the opposite positions, the direction of rotation of the brushed motor is determined to be the opposite direction.

[0037] Specifically, calculating the dual-channel phase difference based on the standard square wave period and the dual-channel time difference involves dividing the dual-channel time difference by the standard square wave period and multiplying the quotient by 360 degrees to obtain the dual-channel phase difference. The positive position angle difference refers to calculating the angle difference between the two Hall sensors in the positive direction of the brushed motor's rotation, and the negative position angle difference refers to calculating the angle difference between the two Hall sensors in the negative direction of the brushed motor's rotation. Figure 2 The diagram shows the phase difference between the two channels of a dual-channel square wave signal group. OUTA and OUTB correspond to two dual-channel square wave signals in the dual-channel square wave signal group, respectively. The phase difference between OUTA and OUTB is 90 degrees, and the angle difference between the positive positions of the first Hall sensor and the second Hall sensor is 90 degrees. Therefore, the rotation direction of the brushed motor is determined to be positive.

[0038] Reference Figure 3 The diagram shows a time difference sequence corresponding to a dual-path square wave signal group. T1-T7 represent the time differences in the stable time difference sequence group. For example, T1 is the time difference between the dual-path edge timestamp (number 2) and the dual-path edge timestamp (number 1) in the dual-path edge timestamp sequence; T2 is the time difference between the dual-path edge timestamp (number 3) and the dual-path edge timestamp (number 2) in the dual-path edge timestamp sequence. The step of using a preset time-domain sliding window to filter the stability of the time difference sequence to obtain a stable time difference sequence group refers to using a time-domain sliding window in the time difference sequence... The time difference sequence is calculated by sliding the time across the time domain using stability algorithms such as mean square error. The time difference sequence within several consecutive time domain sliding windows with high stability is taken as the stable time difference sequence. The window length of the time domain sliding window can be twice the standard square wave period. By calculating the time difference sequence, the edge signals of the two dual square wave signals in the dual square wave signal group can be mapped and compared, making it easier to discover the pattern of square wave signal transition. This is more refined than the traditional signal pattern recognition based on square wave period and improves the accuracy of subsequent motor speed calculation.

[0039] Specifically, the motor reference speed can be calculated based on the edge time difference using the following formula.

[0040] in, This refers to the motor's base speed. This represents the number of Hall effect edges generated when the brushed motor completes one revolution; here, it is 4. It is the edge time difference.

[0041] Specifically, the step of compensating and updating the motor reference speed based on the stable time difference sequence group, the motor voltage sequence, and the motor current sequence to obtain the real-time speed sequence includes: The average value of the voltage corresponding to the stable time difference sequence group in the motor voltage sequence is taken as the stable voltage, and the average value of the current corresponding to the stable time difference sequence group in the motor current sequence is taken as the stable current. Select one voltage from the motor voltage sequence as the target voltage, and take the current corresponding to the target voltage in the motor current sequence as the target current; The target effective voltage is calculated based on the target voltage and the target current, and the stable effective voltage is calculated based on the stable voltage and the stable current. The ratio of the target effective voltage to the stable effective voltage is used as a compensation coefficient. The motor reference speed is updated using the compensation coefficient to obtain the real-time speed, and all real-time speeds are aggregated into a real-time speed sequence.

[0042] Specifically, when the sunroof of a car is closed by a brushed motor, the current and voltage of the brushed motor may change, which will affect the motor speed. Therefore, it is necessary to reflect the speed change through a real-time speed sequence. The stable current is the current at the same time point as the stable voltage. Calculating the target effective voltage based on the target voltage and the target current means multiplying the target current by a preset motor coil resistance to obtain the voltage drop, and subtracting the voltage drop from the target voltage to obtain the target effective voltage. The motor coil resistance is a constant. The method for calculating the stable effective voltage is the same as the method for calculating the target effective voltage, and will not be repeated here. The real-time speed is obtained by compensating and updating the motor reference speed using the compensation coefficient by multiplying the motor reference speed by the compensation coefficient.

[0043] By calculating the square wave period and phase difference using edge timestamp sequences, the rotation direction can be accurately distinguished without additional hardware. By using a time-domain sliding window to screen the time difference sequence for stability, abnormal edges can be filtered out under electromagnetic noise or mechanical vibration conditions, thereby obtaining a stable and reliable edge time difference and improving the accuracy of the reference speed. By introducing an effective voltage compensation model based on voltage and current, speed deviations caused by power supply fluctuations or load changes can be corrected in real time, enabling speed estimation to reflect the true dynamic behavior of the motor and improving the accuracy and robustness of speed calculation.

[0044] Based on the motor speed information, edge prediction is performed on the dual-channel square wave signal group to obtain an analysis edge sequence group, and an edge window sequence group is generated based on the analysis edge sequence group.

[0045] The edge window sequence group is a window sequence used to monitor and determine whether an edge signal appears in the Hall signal of the brushed motor. By generating the edge window sequence group, it is possible to detect lost signals in the Hall signal.

[0046] In this embodiment of the invention, the step of performing edge prediction on the dual-channel square wave signal group based on the motor speed information to obtain an analysis edge sequence group includes: The reference edge timestamps are extracted from each of the dual-channel square wave signals in the dual-channel square wave signal group to obtain the reference edge timestamp group. Based on the real-time speed sequence in the motor speed information, square wave edge prediction is performed on the dual-channel square wave signal group to obtain the analysis edge time difference sequence. Based on the motor rotation direction in the motor speed information and the analysis edge time difference sequence, the reference edge timestamp group is extended to obtain the analysis edge sequence group.

[0047] The reference edge timestamp is the edge timestamp of the first complete square wave in the dual-channel square wave signal. The reference edge timestamp includes the rising edge timestamp and falling edge timestamp of the first square wave. The square wave edge prediction refers to calculating the edge time difference of the square wave based on the real-time speed sequence. The edge extension refers to extending the next edge timestamp of the same type by adding the corresponding edge time difference according to the direction of motor rotation, starting from the reference edge timestamp. The generation of the edge window sequence group based on the analysis edge sequence group refers to generating an edge signal detection window with a window size proportional to the real-time speed at the corresponding position of each edge in the analysis edge sequence group in the dual-channel Hall signal group.

[0048] By performing edge prediction on dual-channel square wave signals based on motor speed information and further generating edge window sequence groups, an accurate timing reference model can be constructed before the Hall signal is actually lost. By calculating the edge time difference through real-time speed sequence, the prediction model can adapt to motor cycle changes caused by factors such as voltage fluctuations and slight load changes. At the same time, edge extension is performed in combination with rotation direction, which can continuously generate the edge positions that should appear in the future, forming a continuous and complete predicted edge sequence. By setting a dynamically sized edge detection window at the predicted edge position, edge-by-edge comparison of the actual Hall signal can be realized, which facilitates subsequent detection of lost signals.

[0049] The loss signal detection and location are performed on the dual Hall signal group based on the edge window sequence group to obtain the loss location set.

[0050] Among these issues, when the car is bumpy or the wiring harness is loose or aging, the Hall signal of the brushed motor may be lost intermittently due to wiring harness vibration or poor contact.

[0051] In this embodiment of the invention, the step of detecting and locating lost signals in the dual-channel Hall signal group based on the edge window sequence group to obtain a set of lost locations includes: Each edge window in the edge window sequence group is selected as a target edge window, and the target edge window is used to determine whether there is an edge signal in the corresponding position of the dual Hall signal group. If so, return to the step of selecting each edge window in the edge window sequence group as the target edge window; If not, it is determined that the dual Hall signal group has signal loss within the target edge window, and the window midpoint of the target edge window is taken as the loss position; Until the target edge window is the last edge window in the edge window sequence group, all lost positions are aggregated into a lost position set.

[0052] Please refer to Figure 4 and Figure 5 In practical use, two types of signal loss will occur, including single-channel signal loss and dual-channel signal loss. Figure 4 This is a schematic diagram when a single-channel signal is lost. Figure 5 This is a diagram illustrating the situation when both signals are lost. Please refer to it. Figure 6 This is a schematic diagram of lost signal detection in one embodiment of the present invention, wherein L1-L5 is the edge window sequence and M1-M5 is the lost position.

[0053] In detail, after performing loss signal detection and loss signal localization on the dual-channel Hall signal group according to the edge window sequence group to obtain the loss position set, the present invention further includes: determining whether the loss position in the loss position set exists only in a single Hall signal in the dual-channel Hall signal group; if so, the signal loss type is determined to be single-channel signal loss; if not, the signal loss type is determined to be dual-channel signal loss.

[0054] By performing loss signal detection and location on dual-channel Hall signals based on edge window sequence groups, the actual missing state of the Hall signal can be accurately identified edge by edge. This enables reasonable estimation of unmeasurable real time points, not only identifying intermittent Hall anomalies caused by bumps, loose wiring, etc., but also outputting a continuous set of missing positions, providing a precise range of missing segments for subsequent position compensation modules. This improves stability in the event of Hall signal failure and avoids control problems such as overtravel and misalignment caused by signal loss.

[0055] The real-time position information of the sunroof is obtained, and dynamic position compensation is performed on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information.

[0056] The real-time position information of the sunroof is calculated by the system based on the Hall signal of the brushed motor when the brushed motor is working normally. In actual use, errors may occur due to the loss of Hall signal.

[0057] Specifically, the step of dynamically compensating the real-time position information based on the motor speed information and the lost position set to obtain compensated position information includes: The real-time speed sequence and the motor rotation direction are extracted from the motor speed information; The signal loss duration is extracted from the dual-channel Hall signal group based on the set of lost locations. The real-time speeds corresponding to the lost position set in the real-time speed sequence are aggregated into a lost signal speed set, and the mean of the lost signal speed set is used as the reference lost signal speed. The number of lost rotations is calculated based on the signal loss duration and the rotation speed of the reference lost signal, and the sunroof movement error is calculated based on the number of lost rotations. The sunroof movement direction is determined based on the motor rotation direction. The real-time position information is then compensated based on the sunroof movement direction and the sunroof movement error to obtain compensated position information.

[0058] Specifically, the signal loss duration is the duration of the square wave period corresponding to the set of lost positions in the dual-channel Hall signal group. Extracting the signal loss duration from the dual-channel Hall signal group based on the set of lost positions includes: Each lost position in the lost position set is selected as the target lost position. The first edge signal in the dual-channel Hall signal group before the lost position is taken as the pre-loss edge signal, and the first edge signal in the dual-channel Hall signal group after the lost position is taken as the post-loss edge signal. The time difference between the lost trailing edge signal and the lost preceding edge signal is taken as the loss time difference; The lost position group comprises all lost positions located between the lost trailing edge signal and the lost preceding edge signal. The total number of lost locations in the target lost location group is taken as the number of target lost signals, and the target loss duration is calculated based on the number of target lost signals and the loss time difference; Filter out all lost locations in the target lost location group from the lost location set, and return to the step of selecting lost locations in the lost location set one by one as the target lost location; Until the set of lost locations becomes empty, the sum of the durations of all target loss is taken as the signal loss duration.

[0059] The step of calculating the target loss duration based on the number of target lost signals and the loss time difference refers to calculating a loss duration coefficient based on the number of target lost signals, and multiplying the loss duration coefficient by the loss time difference to obtain the target loss duration. The loss duration coefficient can be a coefficient where the numerator is the number of target lost signals and the denominator is the number of target lost signals plus one. By using the loss duration coefficient to correct the loss time difference, it can be ensured that the target loss duration corresponds to a complete square wave period, thereby improving the accuracy of position compensation.

[0060] In detail, calculating the number of lost rotations means multiplying the signal loss duration by the reference lost signal speed to obtain the number of lost rotations, and calculating the sunroof movement error based on the number of lost rotations means finding the unit movement distance of the sunroof when the brushed motor rotates one revolution, and multiplying the number of lost rotations by the unit movement distance to obtain the sunroof movement error.

[0061] By coupling the motor speed, Hall square wave signal, and lost position sequence for calculation, dynamic compensation of the sunroof's real-time position information is achieved. Even if the Hall signal jumps, jitters, or is intermittently lost, the actual displacement can still be inferred from the instantaneous speed and rotation direction of the motor. This makes the sunroof position calculation independent of continuous and complete Hall pulses, improving the system's anti-interference capability. High-precision position recovery can be achieved without adding additional sensors, thus improving the accuracy of sunroof position compensation.

[0062] Example 2: This invention discloses a dynamic position estimation and compensation system for a brushed sunroof when the Hall signal is lost. The system includes an edge marking module, a rotational speed analysis module, an edge prediction module, a lost signal detection module, and a position compensation module, wherein: The edge marking module is used to sample the brushed motor of the sunroof in real time to obtain a dual-channel Hall signal group, and to perform adaptive filtering, de-jittering and edge marking on the dual-channel Hall signal group to obtain a dual-channel square wave signal group. The speed analysis module is used to acquire the motor voltage sequence and motor current sequence of the brushed motor, and to identify the motion direction and analyze the speed of the brushed motor based on the motor voltage sequence, the motor current sequence and the edge time difference of the dual square wave signal group to obtain the motor speed information. The edge prediction module is used to perform edge prediction on the dual-channel square wave signal group based on the motor speed information, obtain the analysis edge sequence group, and generate the edge window sequence group based on the analysis edge sequence group. The lost signal detection module is used to perform lost signal detection and lost signal location on the dual-channel Hall signal group according to the edge window sequence group, and obtain a set of lost positions. The position compensation module is used to obtain the real-time position information of the sunroof, and to perform dynamic position compensation on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information.

[0063] The processes described above with reference to the flowcharts in the embodiments disclosed in this invention can be implemented as computer software programs. The embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs the functions defined in the methods of this application. It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wire segments, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless segments, wire segments, optical fibers, RF, etc., or any suitable combination thereof.

[0064] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0065] Those skilled in the art should understand that the embodiments of the present invention described above and shown in the accompanying drawings are merely examples and do not limit the present invention. The purpose of the present invention has been fully and effectively achieved. The functions and structural principles of the present invention have been shown and explained in the embodiments. Without departing from the stated principles, the implementation of the present invention may have any variations or modifications.

Claims

1. A method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof drive, characterized in that, The method includes: The brushed motor of the sunroof is sampled in real time to obtain a dual-channel Hall signal group, and the dual-channel Hall signal group is subjected to adaptive filtering, jitter reduction and edge marking to obtain a dual-channel square wave signal group. The motor voltage sequence and motor current sequence of the brushed motor are obtained, and the motion direction and speed of the brushed motor are identified and analyzed based on the motor voltage sequence, the motor current sequence and the edge time difference of the dual square wave signal group to obtain the motor speed information. Based on the motor speed information, edge prediction is performed on the dual-channel square wave signal group to obtain an analysis edge sequence group, and an edge window sequence group is generated based on the analysis edge sequence group. Based on the edge window sequence group, the dual-channel Hall signal group is used to detect and locate lost signals, thereby obtaining a set of lost locations; The real-time position information of the sunroof is obtained, and dynamic position compensation is performed on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information.

2. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 1, characterized in that, The adaptive filtering and de-jittering of the dual-channel Hall signal group, along with edge marking, to obtain a dual-channel square wave signal group includes: The electrical signal variance of the dual-channel Hall signal group is calculated to obtain the signal variance group; A set of filter coefficients and a set of filter windows corresponding to the set of filter coefficients are generated based on the signal variance set. The dual-channel Hall signal group is filtered and de-jittered according to the filter coefficient group and the filter window group to obtain a dual-channel de-jittered signal group. The signal slope of the dual-channel de-jitter signal group is calculated based on the differential method, and the edge of the dual-channel de-jitter signal group is marked according to the signal slope calculation result to obtain the dual-channel square wave signal group.

3. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 1, characterized in that, The step of identifying the motion direction and analyzing the speed of the brushed motor based on the motor voltage sequence, the motor current sequence, and the edge time difference of the dual-channel square wave signal group to obtain motor speed information includes: The edge signals in the dual-channel square wave signal group are timestamp extracted to obtain an edge timestamp sequence group, and the standard square wave period of the dual-channel square wave signal group is calculated based on the edge timestamp sequence group. The direction of motion of the brushed motor is identified based on the standard square wave period, the edge timestamp sequence group, and the installation positions of the two Hall sensors in the brushed motor, thereby obtaining the motor rotation direction. The edge timestamp sequence is merged into a dual-edge timestamp sequence according to the time sequence. The time difference between two consecutive dual-edge timestamps in the dual-edge timestamp sequence is calculated according to the sequence number to obtain the time difference sequence. The stability of the time difference sequence is screened using a preset time-domain sliding window to obtain a stable time difference sequence group, and the mean of the stable time difference sequence group is used as the edge time difference. The motor reference speed is calculated based on the edge time difference, and the motor reference speed is compensated and updated according to the stable time difference sequence group, the motor voltage sequence, and the motor current sequence to obtain the real-time speed sequence; The real-time speed sequence and the motor rotation direction are combined to form motor speed information.

4. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 3, characterized in that, The step of identifying the motion direction of the brushed motor based on the standard square wave period, the edge timestamp sequence group, and the installation positions of the two Hall sensors in the brushed motor to obtain the motor rotation direction includes: The earliest edge timestamp sequence in the edge timestamp sequence group is selected as the first edge timestamp sequence, and the other edge timestamp sequence in the edge timestamp sequence group is selected as the second edge timestamp sequence. The edge timestamp with the smallest sequence number in the first edge timestamp sequence is taken as the first edge timestamp, and the edge type of the first edge timestamp is taken as the target edge type. The edge timestamp with the same type as the target edge and the smallest sequence number in the second edge timestamp sequence is taken as the second edge timestamp, and the time difference between the second edge timestamp and the first edge timestamp is taken as the dual-path time difference. The phase difference between the two channels is calculated based on the standard square wave period and the time difference between the two channels. The Hall sensor corresponding to the first edge timestamp sequence in the brushed motor is used as the first Hall sensor, and the Hall sensor corresponding to the second edge timestamp sequence in the brushed motor is used as the second Hall sensor. Obtain the forward position angle difference and the reverse position angle difference between the first Hall sensor and the second Hall sensor; When the dual-path phase difference is closer to the positive position angle difference, the rotation direction of the brushed motor is determined to be positive rotation. When the phase difference between the two paths is closer to the angle difference between the opposite positions, the direction of rotation of the brushed motor is determined to be the opposite direction.

5. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 3, characterized in that, The step of compensating and updating the motor reference speed based on the stable time difference sequence group, the motor voltage sequence, and the motor current sequence to obtain the real-time speed sequence includes: The average value of the voltage corresponding to the stable time difference sequence group in the motor voltage sequence is taken as the stable voltage, and the average value of the current corresponding to the stable time difference sequence group in the motor current sequence is taken as the stable current. Select one voltage from the motor voltage sequence as the target voltage, and take the current corresponding to the target voltage in the motor current sequence as the target current; The target effective voltage is calculated based on the target voltage and the target current, and the stable effective voltage is calculated based on the stable voltage and the stable current. The ratio of the target effective voltage to the stable effective voltage is used as a compensation coefficient. The motor reference speed is updated using the compensation coefficient to obtain the real-time speed, and all real-time speeds are aggregated into a real-time speed sequence.

6. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 1, characterized in that, The method of performing edge prediction on the dual-channel square wave signal group based on the motor speed information to obtain an analysis edge sequence group includes: The reference edge timestamps are extracted from each of the dual-channel square wave signals in the dual-channel square wave signal group to obtain the reference edge timestamp group. Based on the real-time speed sequence in the motor speed information, square wave edge prediction is performed on the dual-channel square wave signal group to obtain the analysis edge time difference sequence. Based on the motor rotation direction in the motor speed information and the analysis edge time difference sequence, the reference edge timestamp group is extended to obtain the analysis edge sequence group.

7. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 1, characterized in that, The step of detecting and locating lost signals in the dual-channel Hall signal group based on the edge window sequence group to obtain a set of lost signal locations includes: Each edge window in the edge window sequence group is selected as a target edge window, and the target edge window is used to determine whether there is an edge signal in the corresponding position of the dual Hall signal group. If so, return to the step of selecting each edge window in the edge window sequence group as the target edge window; If not, it is determined that the dual Hall signal group has signal loss within the target edge window, and the window midpoint of the target edge window is taken as the loss position; Until the target edge window is the last edge window in the edge window sequence group, all lost positions are aggregated into a lost position set.

8. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 1, characterized in that, The step of performing dynamic position compensation on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information includes: The real-time speed sequence and the motor rotation direction are extracted from the motor speed information; The signal loss duration is extracted from the dual-channel Hall signal group based on the set of lost locations. The real-time speeds corresponding to the lost position set in the real-time speed sequence are aggregated into a lost signal speed set, and the mean of the lost signal speed set is used as the reference lost signal speed. The number of lost rotations is calculated based on the signal loss duration and the rotation speed of the reference lost signal, and the sunroof movement error is calculated based on the number of lost rotations. The sunroof movement direction is determined based on the motor rotation direction. The real-time position information is then compensated based on the sunroof movement direction and the sunroof movement error to obtain compensated position information.

9. The method for dynamic position estimation and compensation when Hall signal is lost in a brushed sunroof according to claim 8, characterized in that, Extracting the signal loss duration from the dual-channel Hall signal group based on the loss location set includes: Each lost position in the lost position set is selected as the target lost position. The first edge signal in the dual-channel Hall signal group before the lost position is taken as the pre-loss edge signal, and the first edge signal in the dual-channel Hall signal group after the lost position is taken as the post-loss edge signal. The time difference between the lost trailing edge signal and the lost preceding edge signal is taken as the loss time difference; The lost position group comprises all lost positions located between the lost trailing edge signal and the lost preceding edge signal. The total number of lost locations in the target lost location group is taken as the number of target lost signals, and the target loss duration is calculated based on the number of target lost signals and the loss time difference; Filter out all lost locations in the target lost location group from the lost location set, and return to the step of selecting lost locations in the lost location set one by one as the target lost location; Until the set of lost locations becomes empty, the sum of the durations of all target loss is taken as the signal loss duration.

10. A dynamic position estimation and compensation system for a brushed sunroof when Hall signal is lost, characterized in that, The system includes an edge marking module, a rotational speed analysis module, an edge prediction module, a lost signal detection module, and a position compensation module, wherein: The edge marking module is used to sample the brushed motor of the sunroof in real time to obtain a dual-channel Hall signal group, and to perform adaptive filtering, de-jittering and edge marking on the dual-channel Hall signal group to obtain a dual-channel square wave signal group. The speed analysis module is used to acquire the motor voltage sequence and motor current sequence of the brushed motor, and to identify the motion direction and analyze the speed of the brushed motor based on the motor voltage sequence, the motor current sequence and the edge time difference of the dual square wave signal group to obtain the motor speed information. The edge prediction module is used to perform edge prediction on the dual-channel square wave signal group based on the motor speed information, obtain the analysis edge sequence group, and generate the edge window sequence group based on the analysis edge sequence group. The lost signal detection module is used to perform lost signal detection and lost signal location on the dual-channel Hall signal group according to the edge window sequence group, and obtain a set of lost positions. The position compensation module is used to obtain the real-time position information of the sunroof, and to perform dynamic position compensation on the real-time position information based on the motor speed information and the lost position set to obtain compensated position information.