A new energy main drive motor stator turning detection method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QINGDAO AIPU INTELLIGENT INSTR
- Filing Date
- 2026-04-22
- Publication Date
- 2026-08-07
AI Technical Summary
传统方法通常采用“连续多个状态一致即确认转向”的判定策略,在此类振荡场景下会导致在转向确认与取消之间反复切换,输出结果高频跳变,影响电机控制的稳定性
1、针对转子位于两个霍尔传感器之间时出现的半导通、半关断或跳变不同步等非预期状态,本发明通过汉明距离计算将非预期状态归入与其最接近的预期状态,使发明能够识别并正确处理临界区域的非标准信号,避免因状态无法识别导致的逻辑锁死,显著提高了转向判断的准确性。
Smart Images

Figure CN122533477A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motor rotor rotation detection technology, specifically a method for detecting the stator rotation of a new energy main drive motor. Background Technology
[0002] In vector control of electric motors, accurately acquiring the real-time position and direction of rotation of the rotor is fundamental to achieving precise commutation and closed-loop speed control. Traditional rotor direction detection methods typically employ three Hall effect sensors installed at 120-degree electrical angles apart. These sensors detect changes in rotor magnetic pole polarity and output three square wave signals with a 120-degree phase difference, which are then compared with preset forward and reverse rotation signals to determine the motor's direction of rotation. However, this traditional method has the following technical shortcomings in practical applications: Ideally, the Hall sensor outputs a standard square wave signal, and the three Hall signals transition in a fixed sequence as the rotor rotates. However, when the rotor is located in the magnetic field threshold boundary region between two Hall sensors, the Hall sensors are not ideal switches, exhibiting unexpected states such as partial conduction, partial shutdown, or one signal transitioning while the other has not. Traditional methods require strict transition edge triggering conditions, which may lead to logic lock-up in the critical region due to the inability to meet sampling conditions, resulting in the inability to output a valid direction determination result.
[0003] Traditional methods rely on comparing the currently acquired voltage level with a preset reference sequence to determine the direction of rotation. However, in the critical metastable region, the actual acquired voltage level may be closer to the Hamming distance of the next state in forward rotation and farther from the Hamming distance of the previous state in reverse rotation, even though the actual direction of rotor movement may be reverse. Traditional methods, based on only a single state match, cannot distinguish the inconsistency between the geometric distance of the voltage level and the physical distance of the direction of movement, easily leading to misjudgment of direction.
[0004] Due to physical factors such as installation angle deviations and response delay differences in Hall sensors, it is difficult to achieve perfect synchronization among multiple Hall sensors. During high-speed rotation, the originally sequential state sequence may become disordered or repetitive, such as oscillations like 4→5→4→5. Traditional methods typically employ a "confirm direction by confirming multiple consecutive consistent states" strategy. In such oscillating scenarios, this leads to repeated switching between direction confirmation and cancellation, resulting in high-frequency jumps in the output and affecting the stability of motor control. Summary of the Invention
[0005] The purpose of this invention is to provide a method for detecting the stator rotation of a new energy main drive motor, so as to solve the problems mentioned in the prior art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: In a first aspect, the present invention provides a method for detecting the stator steering of a new energy main drive motor, comprising: Hall sensors are evenly arranged circumferentially on the inner wall of the motor stator. After the motor is powered on and rotates, the binary parallel signals output by each Hall sensor are collected in real time and recorded in chronological order as the original state sequence. The state transition sequence of the Hall sensors when the motor rotates forward and in reverse is established as the forward rotation reference sequence and the reverse rotation reference sequence, respectively. The original state sequence is compressed to obtain a reduced state sequence. When an unexpected state appears in the reduced state sequence, the unexpected state is assigned to the nearest expected state to obtain a corrected state sequence. Set the direction confidence integral variable and adjust it according to the transition direction between adjacent states in the corrected state sequence; during the low-speed self-calibration rotation of the motor, compare the corrected state sequence with the forward rotation reference sequence and the reverse rotation reference sequence respectively, and select one of the reference sequences as the dynamic reference sequence and store it according to the comparison result; The corrected state sequence is compared with the dynamic baseline sequence to calculate the real-time matching degree; The motor direction is determined by combining the direction confidence integral variable and the real-time matching degree.
[0007] In conjunction with the first aspect, in a first implementation of the first aspect of this application, the step of uniformly arranging Hall sensors circumferentially on the inner wall of the motor stator includes: N switch-type Hall sensors are arranged at equal angular intervals on a flexible circuit board, which is attached to the inner wall of the motor stator.
[0008] In conjunction with the first aspect, in the second implementation of the first aspect of this application, after the motor is powered on and rotates, the binary parallel signals output by each Hall sensor are collected in real time and recorded in chronological order as an original state sequence, including: The output levels of all Hall sensors are simultaneously acquired at a preset sampling frequency. At each sampling moment, an N-bit binary number and a corresponding sampling point are obtained. These are recorded sequentially according to the sampling time sequence to form the original state sequence; where N is the total number of Hall sensors.
[0009] In conjunction with the first aspect, in the third implementation of the first aspect of this application, the step of establishing the state transition sequence of the Hall sensor during motor forward rotation and motor reverse rotation, respectively, as the forward rotation reference sequence and the reverse rotation reference sequence, includes: During one revolution of the motor in a uniform forward direction, the N-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the forward rotation reference sequence; during one revolution of the motor in a uniform reverse direction, the N-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the reverse rotation reference sequence.
[0010] In conjunction with the first aspect, in the fourth implementation of the first aspect of this application, the compression processing of the original state sequence to obtain the reduced state sequence includes: Traverse the original state sequence and remove consecutively repeated identical states to obtain a deduplication sequence. For the first state S(i-1), the second state S(i), and the third state S(i+1) that are adjacent in time order in the deduplication sequence, if every bit of the binary number of S(i-1) and S(i+1) is equal, and at least one bit of the binary number of S(i) and S(i-1) is different, it is determined to be a short-time oscillatory jump. The number of consecutive sampling points actually occupied by S(i) in the original state sequence is obtained as the oscillation width. When the oscillation width is less than the preset oscillation width threshold, S(i-1), S(i), and S(i+1) are merged and compressed into a single steady-state node S(i-1). When the oscillation width is greater than or equal to the preset oscillation width threshold, the compression is abandoned and S(i-1), S(i), and S(i+1) are retained as valid transition sequences. The compressed or retained results are arranged in the original time order to obtain the reduced state sequence.
[0011] In conjunction with the first aspect, in the fifth implementation of the first aspect of this application, the step of assigning the unexpected state to the closest expected state when an unexpected state appears in the reduced state sequence to obtain a corrected state sequence includes: The unexpected state is a state that does not belong to the forward reference sequence or the reverse reference sequence, and the expected state is a state that belongs to the forward reference sequence or the reverse reference sequence. The unexpected state needs to be included. For each unexpected state X in the reduced state sequence, calculate the Hamming distance between the corresponding unexpected state and each reference state Y in the forward and reverse reference sequences, respectively, using the following formula: ; Where X represents the unexpected state, Y represents the baseline state, and N represents the total number of Hall sensors. i Y is the i-th binary number representing an unexpected state. i The i-th binary number of the baseline state; From all the reference states in the forward and reverse reference sequences, the reference state with the smallest Hamming distance is selected as the target for the unexpected state. When there are multiple reference states with the smallest Hamming distance, the reference state that appears earliest in the corresponding reference sequence is selected as the target. Each unexpected state in the reduced state sequence is replaced with its target, while the expected state remains unchanged. The corrected state sequence is obtained after arranging them in the original order.
[0012] In conjunction with the first aspect, in the sixth implementation of the first aspect of this application, the setting of the directional confidence integral variable, adjusted according to the transition direction between adjacent states in the corrected state sequence, includes: The transition direction is the direction in which the preceding state jumps to the following state in the corrected state sequence in chronological order. Set the initial value of the direction confidence integral variable C to 0; for the state pairs formed by the preceding and following states that are adjacent in time in the corrected state sequence, traverse the forward reference sequence. When there is a position such that the state at the corresponding position is equal to the preceding state and the state at the next position is equal to the following state, determine that the corresponding state pair exists in the forward reference sequence; traverse the reverse reference sequence. When there is a position such that the state at the corresponding position is equal to the preceding state and the state at the next position is equal to the following state, determine that the corresponding state pair exists in the reverse reference sequence. When the state pair exists only in the forward reference sequence, add a preset forward step size to the direction confidence integral variable C; when the state pair exists only in the reverse reference sequence, subtract a preset reverse step size from the direction confidence integral variable C; when the state pair exists in both the forward and reverse reference sequences, the direction confidence integral variable C remains unchanged; when the state pair does not exist in any reference sequence, multiply the direction confidence integral variable C by a preset attenuation factor; output the adjusted direction confidence integral variable C1.
[0013] In conjunction with the first aspect, in the seventh implementation of the first aspect of this application, the step of comparing the corrected state sequence with the forward rotation reference sequence and the reverse rotation reference sequence respectively during the low-speed self-calibration rotation of the motor, and selecting one of the reference sequences as the dynamic reference sequence and storing it based on the comparison result, includes: The control motor rotates at a preset low speed for one revolution, and the corrected state sequence obtained during the rotation is recorded as the calibration state sequence, with a length denoted as L. The first matching degree M1 between the calibration state sequence and the forward reference sequence is calculated, where M1 is the maximum value of the longest common subsequence length of the calibration state sequence and the forward reference sequence divided by L and the length of the forward reference sequence. The second matching degree M2 between the calibration state sequence and the reverse reference sequence is calculated, where M2 is the maximum value of the longest common subsequence length of the calibration state sequence and the reverse reference sequence divided by L and the length of the reverse reference sequence. M1 and M2 are compared. When M1 is greater than or equal to M2, the forward reference sequence is selected as the dynamic reference sequence. When M1 is less than M2, the reverse reference sequence is selected as the dynamic reference sequence. The selected dynamic reference sequence is stored in non-volatile memory.
[0014] In conjunction with the first aspect, in the eighth implementation of the first aspect of this application, the step of comparing the corrected state sequence with the dynamic reference sequence and calculating the real-time matching degree includes: A sliding window of preset length is used to align the corrected state sequence with the dynamic reference sequence in time. At each window position, the number A of the corrected state sequence and the dynamic reference sequence that are consistent at the same position is counted. A is divided by the window length to obtain the instantaneous matching degree of the corresponding alignment position. The instantaneous matching degrees of the most recent consecutive alignment positions are filtered by a moving average, and the filtered arithmetic mean is used as the real-time matching degree m1.
[0015] In conjunction with the first aspect, in the ninth implementation of the first aspect of this application, the step of comprehensively determining the motor direction based on the direction confidence integral variable and the real-time matching degree includes: The formula for calculating the rate of change ΔC of the integral variable of directional confidence is: ; Where C1 is the adjusted direction confidence integral variable, k is the index number of the current sampling point, and T is the total number of sampling points within the preset rate of change window; The formula for calculating the rate of change Δm of real-time matching degree is: ; Where m1 is the real-time matching degree, k is the index number of the current sampling point, and T is the total number of sampling points within the preset rate of change window; When ΔC is greater than the preset forward rotation threshold and Δm is greater than the preset matching threshold, the motor rotation is determined to be forward; when ΔC is less than the preset reverse rotation threshold and Δm is greater than the preset matching threshold, the motor rotation is determined to be reverse; otherwise, the rotation direction is determined to be uncertain. When the direction is determined to be uncertain, the uncertainty duration is accumulated, and the uncertainty duration is increased by the length of one sampling period for each sampling period. When the motor direction is determined to be forward or reverse, the uncertainty duration is reset to 0. When the uncertainty duration is greater than the preset timeout threshold, the adjusted direction confidence integral variable C1 is cleared to zero, and the motor is controlled to rotate uniformly for one revolution at a preset low speed. Based on the new calibration state sequence obtained during the rotation, the first matching degree between the new calibration state sequence and the forward reference sequence and the second matching degree between the new calibration state sequence and the reverse reference sequence are recalculated. The dynamic reference sequence is updated and stored in non-volatile memory, and the new dynamic reference sequence is used to continue to determine the direction.
[0016] Compared with the prior art, the beneficial effects of the present invention are: 1. In response to unexpected states such as half-on, half-off, or asynchronous switching that occur when the rotor is located between two Hall sensors, this invention uses Hamming distance calculation to classify the unexpected state into the closest expected state. This enables the invention to identify and correctly process non-standard signals in the critical region, avoid logic lock-up caused by the inability to identify the state, and significantly improve the accuracy of steering judgment.
[0017] 2. To address the directional ambiguity caused by the inconsistency between the distance of the level state and the direction of physical motion, this invention sets a direction confidence integral variable, adjusts it according to the transition direction between adjacent states in the corrected state sequence, and uses historical trends to replace instantaneous state matching, effectively overcoming the possible directional misjudgment that may occur in a single state comparison, making the turning identification results more stable and reliable.
[0018] 3. To address signal oscillations caused by differences in response delays among multiple Hall sensors, this invention identifies and merges short-term oscillation jumps through compression processing. Simultaneously, it introduces real-time matching degree and direction confidence integral variables for collaborative judgment, eliminating repeated confirmation and cancellation of steering results caused by signal oscillations and solving the problem of high-frequency jumps in output results. Attached Figure Description
[0019] Figure 1 This is a schematic diagram illustrating the steps of a new energy main drive motor stator steering detection method according to the present invention; Figure 2 This is a flowchart of a new energy main drive motor stator steering detection method according to the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Example: Figures 1-2 As shown, the present invention provides a technical solution. like Figure 1 A schematic diagram illustrating the steps of a method for detecting the stator steering of a new energy main drive motor shows that this invention provides a method for detecting the stator steering of a new energy main drive motor, comprising: Step S100: Hall sensors are evenly arranged circumferentially on the inner wall of the motor stator; after the motor is powered on and rotates, the binary parallel signals output by each Hall sensor are collected in real time and recorded in chronological order as the original state sequence; the state transition sequence of the Hall sensors when the motor rotates forward and in reverse is established respectively as the forward rotation reference sequence and the reverse rotation reference sequence. Specifically, N switch-type Hall sensors are arranged at equal angular intervals on a flexible circuit board, which is attached to the inner wall of the motor stator.
[0022] The output levels of all Hall sensors are simultaneously acquired at a preset sampling frequency. At each sampling moment, an N-bit binary number and a corresponding sampling point are obtained. These are recorded sequentially according to the sampling time sequence to form the original state sequence. Here, N is the total number of Hall sensors. The time interval between two adjacent sampling moments is one sampling period.
[0023] During one revolution of the motor in a uniform forward direction, the N-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the forward rotation reference sequence; during one revolution of the motor in a uniform reverse direction, the N-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the reverse rotation reference sequence.
[0024] In one specific embodiment, a certain type of new energy main drive motor is used as the test object. This motor is an 8-pole permanent magnet synchronous motor with a rated speed of 6000 rpm. Eight switch-type Hall sensors are evenly arranged circumferentially on the inner wall of the motor stator, i.e., N=8, with a spatial angle of 45 degrees between any two adjacent Hall sensors. The eight Hall sensors are embedded in a flexible circuit board at equal angular intervals, and the flexible circuit board is tightly attached to the inner wall of the motor stator to ensure uniform air gap between each Hall sensor and the rotor magnetic pole. The output levels of the eight Hall sensors are simultaneously acquired at a preset sampling frequency of 10kHz. Each sampling moment yields an 8-bit binary number, for example, the binary number acquired at a certain sampling moment is 10110010, where each bit corresponds to the output level of one Hall sensor, with 1 representing a high level and 0 representing a low level. The data is recorded sequentially according to the sampling time sequence to form an original state sequence, recording the total number of samples acquired so far. The time interval between two adjacent sampling moments is 0.1 milliseconds, i.e., one sampling period.
[0025] During one mechanical rotation of the motor at a constant speed of 600 rpm (10% of the rated speed), the 8-bit binary numbers output by the Hall sensor were recorded in chronological order to obtain the forward rotation reference sequence. Actual measurements showed that 16 states were collected for one rotation, i.e., M=16. The forward rotation reference sequence is: [10000111, 11000011, 11100001, 11110000, 01111000, 00111100, 00011110, 00001111, 10000111, 11000011, 11100001, 11110000, 01111000, 00111100, 00011110, 000011110, 000011111]. Similarly, during the process of the motor rotating in reverse at a constant speed of 600 rpm for one revolution of the mechanical angle, the 8-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the reversal reference sequence. The reversal reference sequence is: [11110000, 11100001, 11000011, 10000111, 00001111, 00011110, 00111100,01111000, 11110000, 11110000, 11100001, 11000011, 10000111, 00001111, 00001111, 00011110,00111100, 0111100].
[0026] Step S200: Compress the original state sequence to obtain a reduced state sequence; when an unexpected state appears in the reduced state sequence, assign the unexpected state to the nearest expected state to obtain a corrected state sequence. Specifically, the original state sequence is traversed, and consecutively repeated identical states are removed. Specifically, for any two adjacent states, if every bit of the binary number of the two states is equal, they are determined to be consecutively repeated states. The latter state is removed and the former state is retained to obtain the deduplication sequence. For the first state S(i-1), the second state S(i), and the third state S(i+1) that are adjacent in time order in the deduplication sequence, if every bit of the binary number of S(i-1) and S(i+1) is equal, and at least one bit of the binary number of S(i) and S(i-1) is different, it is determined to be a short-time oscillatory jump. The number of consecutive sampling points actually occupied by S(i) in the original state sequence is obtained as the oscillation width. When the oscillation width is less than the preset oscillation width threshold, S(i-1), S(i), and S(i+1) are merged and compressed into a single steady-state node S(i-1). When the oscillation width is greater than or equal to the preset oscillation width threshold, the compression is abandoned and S(i-1), S(i), and S(i+1) are retained as valid transition sequences. The compressed or retained results are arranged in the original time order to obtain the reduced state sequence.
[0027] The unexpected state is a state that does not belong to the forward reference sequence or the reverse reference sequence, and the expected state is a state that belongs to the forward reference sequence or the reverse reference sequence. The unexpected state needs to be included. For each unexpected state X in the reduced state sequence, calculate the Hamming distance between the corresponding unexpected state and each reference state Y in the forward and reverse reference sequences, respectively, using the following formula: ; Where X represents the unexpected state, Y represents the baseline state, and N represents the total number of Hall sensors. i Y is the i-th binary number representing an unexpected state. i The i-th binary number of the baseline state; From all the reference states in the forward and reverse reference sequences, the reference state with the smallest Hamming distance is selected as the target for the unexpected state. When there are multiple reference states with the smallest Hamming distance, the reference state that appears earliest in the corresponding reference sequence is selected as the target. Each unexpected state in the reduced state sequence is replaced with its target, while the expected state remains unchanged. The corrected state sequence is obtained after arranging them in the original order.
[0028] In one specific embodiment, suppose the original state sequence collected by the motor within a certain time period is: [10000111, 10000111, 11000011, 11100001, 11100001, 11110000, 01111000, 00111100, 00111100, 00011110, 00001111]. Traversing this original state sequence, firstly, consecutively repeating identical states are removed. Two adjacent 10000111 are determined to be consecutively repeating states, and the next one is removed; two adjacent 11100001 are determined to be consecutively repeating states, and the next one is removed; two adjacent 00111100 are determined to be consecutively repeating states, and the next one is removed. The resulting deduplication sequence is: [10000111, 11000011, 11100001, 11110000, 01111000, 00111100, 00011110, 00001111]. For any three adjacent states in the deduplication sequence, check for short-term oscillatory transitions. For example, consider the first state S(i-1) = 10000111, the second state S(i) = 11000011, and the third state S(i+1) = 11100001. Since S(i-1) and S(i+1) are not equal, the oscillation condition is not met. Continuing the traversal, no oscillatory transitions in the A→B→A pattern are found, therefore no compression is needed, and the deduplication sequence is the reduced state sequence.
[0029] In another scenario, the motor oscillates in the critical region, with the original state sequence being: [10000111,11000011, 11100001, 11110000, 01111000, 01111000, 00111100, 0111100, 00111100, 00111100, 00011110, 00001111]. After deduplication, the deduplicated sequence is: [10000111, 11000011,11100001, 11110000, 01111000, 00111100, 0111100, 00111100, 00011110, 00001111]. The deduplication sequence was detected to contain the sequence 01111000→00111100→01111000, where the 5th to 7th positions satisfy S(i-1)=S(i+1)=01111000, and S(i)=00111100 is not equal to S(i-1), thus indicating a short-term oscillation jump. The number of consecutive sampling points actually occupied by the second state 00111100 in the original state sequence was obtained. In the original sequence, 00111100 appeared consecutively once, with an oscillation width of 1. Assuming a preset oscillation width threshold of 3, since the oscillation width of 1 is less than the threshold of 3, the three states were merged and compressed into a single steady-state node 01111000. The compressed reduced state sequence is: [10000111, 11000011, 11100001, 11110000, 01111000, 01111000, 00011110, 00001111]. Further deduplication yields: [10000111, 11000011, 11100001, 11110000, 01111000, 00011110, 00001111]. If the oscillation width is greater than or equal to the threshold (e.g., if 00111100 appears 5 times consecutively in the original sequence, the oscillation width is 5, which is greater than or equal to the threshold of 3), then compression is abandoned, and three states are retained as valid transition sequences.
[0030] Next, we perform state inclusion processing. Suppose an unexpected state X=10100001 appears in the reduced state sequence. This state does not belong to either the forward reference sequence or the reverse reference sequence. We calculate the Hamming distance between X and each reference state in the forward reference sequence, and the Hamming distance between X and each reference state in the reverse reference sequence. Taking the state F=11110000 in the forward reference sequence as an example, the Hamming distance is calculated as follows: X=10100001, F=11110000, comparing bit by bit: 1st bit 1=1 (same), 2nd bit 0≠1 (different), 3rd bit 1=1 (same), 4th bit 0≠1 (different), 5th bit 0=0 (same), 6th bit 0=0 (same), 7th bit 0=0 (same), 8th bit 1≠0 (different). The number of different bits is 3, so d=3. Calculate the Hamming distance between X and all reference states sequentially. The minimum distance is 1, corresponding to the reference state Y = 11100001. Therefore, X is assigned to 11100001. Replace all unexpected states in the reduced state sequence with those assigned to the target state, while keeping the expected states unchanged. Arrange the states in their original order to obtain the corrected state sequence.
[0031] Step S300: Set the direction confidence integral variable and adjust it according to the transition direction between adjacent states in the corrected state sequence; during the low-speed self-calibration rotation of the motor, compare the corrected state sequence with the forward rotation reference sequence and the reverse rotation reference sequence respectively, and select one of the reference sequences as the dynamic reference sequence and store it according to the comparison result; Specifically, the transition direction is the direction in which the preceding state jumps to the following state in the corrected state sequence in chronological order; Set the initial value of the direction confidence integral variable C to 0; for the state pairs formed by the preceding and following states that are adjacent in time in the corrected state sequence, traverse the forward reference sequence. When there is a position such that the state at the corresponding position is equal to the preceding state and the state at the next position is equal to the following state, determine that the corresponding state pair exists in the forward reference sequence; traverse the reverse reference sequence. When there is a position such that the state at the corresponding position is equal to the preceding state and the state at the next position is equal to the following state, determine that the corresponding state pair exists in the reverse reference sequence. When the state pair exists only in the forward reference sequence, add a preset forward step size to the direction confidence integral variable C; when the state pair exists only in the reverse reference sequence, subtract a preset reverse step size from the direction confidence integral variable C; when the state pair exists in both the forward and reverse reference sequences, the direction confidence integral variable C remains unchanged; when the state pair does not exist in any reference sequence, multiply the direction confidence integral variable C by a preset attenuation factor; output the adjusted direction confidence integral variable C1.
[0032] The control motor rotates at a preset low speed for one revolution, and the corrected state sequence obtained during the rotation is recorded as the calibration state sequence, with a length denoted as L. The first matching degree M1 between the calibration state sequence and the forward reference sequence is calculated, where M1 is the maximum value of the longest common subsequence length of the calibration state sequence and the forward reference sequence divided by L and the length of the forward reference sequence. The second matching degree M2 between the calibration state sequence and the reverse reference sequence is calculated, where M2 is the maximum value of the longest common subsequence length of the calibration state sequence and the reverse reference sequence divided by L and the length of the reverse reference sequence. M1 and M2 are compared. When M1 is greater than or equal to M2, the forward reference sequence is selected as the dynamic reference sequence. When M1 is less than M2, the reverse reference sequence is selected as the dynamic reference sequence. The selected dynamic reference sequence is stored in non-volatile memory.
[0033] In one specific embodiment, the corrected state sequence is set as: [10000111, 11000011, 11100001, 11110000, 01111000, 00011110, 00001111]. The initial value of the direction confidence integral variable C is set to 0. The state pairs formed by adjacent states in the corrected state sequence are traversed: the first state pair (10000111, 11000011): traversing the forward reference sequence, 10000111→11000011 is found at positions 1-2, indicating its existence in the forward reference sequence; traversing the reverse reference sequence, this state pair is not found. Therefore, the state pair only exists in the forward reference sequence, and C1 = C + forward step size is executed. Assuming the preset forward step size is 1, then C1 = 1. The second state pair (11000011, 11100001): Similarly, this state pair exists only in the forward reference sequence, so C1=2. The third state pair (11100001, 11110000): Exists only in the forward reference sequence, so C1=3. The fourth state pair (11110000, 01111000): Exists only in the forward reference sequence, so C1=4. The fifth state pair (00111100, 00011110): This state pair exists in both the forward and reverse reference sequences (positions 5-6 in the forward sequence and 4-5 in the reverse sequence), so it is determined to exist in both and remains unchanged, C1=4. The sixth state pair (00011110, 00001111): Exists only in the forward reference sequence, so C1=5. The adjusted direction confidence integral variable is output as C1=5. If an invalid state pair is found, for example, the state pair (01111000, 11110000) does not exist in any reference sequence, then C1 = C × λ is executed. Assuming the preset attenuation factor λ = 0.9, then C1 = 5 × 0.9 = 4.5.
[0034] Next, low-speed self-calibration is performed. The motor is controlled to rotate at a constant speed of 600 rpm (10% of the rated speed) for one revolution, and the corrected state sequence obtained during the rotation is recorded as the calibration state sequence. Let the length of the calibration state sequence be L=16, the length of the forward reference sequence be M=16, and the length of the reverse reference sequence be M=16. The longest common subsequence length between the calibration state sequence and the forward reference sequence is calculated to be 15, then the first matching degree M1=0.9375. The longest common subsequence length between the calibration state sequence and the reverse reference sequence is calculated to be 14, then the second matching degree M2=0.875. Since M1=0.9375 is greater than M2=0.875, the forward reference sequence is selected as the dynamic reference sequence and stored in non-volatile memory.
[0035] Step S400: Compare the corrected state sequence with the dynamic reference sequence and calculate the real-time matching degree; Specifically, a sliding window of preset length is used to align the corrected state sequence with the dynamic reference sequence in time. At each window position, the number A of times the corrected state sequence and the dynamic reference sequence have the same state at the same position is counted. Specifically, for each position within the window, the count is incremented by 1 when the state of the corrected state sequence at the corresponding position is equal to the state of the dynamic reference sequence at the corresponding position; otherwise, no increment is made. A is divided by the window length to obtain the instantaneous matching degree of the corresponding alignment position. The instantaneous matching degrees of the most recent consecutive alignment positions are filtered by a moving average, and the filtered arithmetic mean is used as the real-time matching degree m1.
[0036] In one specific embodiment, the corrected state sequence is set as: [10000111, 11000011, 11100001, 11110000, 01111000, 00011110, 00001111], and the dynamic reference sequence is a forward rotation reference sequence: [10000111, 11000011, 11100001, 11110000, 01111000, 00111100, 00011110, 00001111, 10000111, ...]. A sliding window with a preset length of 4 is used to align the corrected state sequence with the dynamic reference sequence in time. First window position (k=1): The state within the corrected state sequence window is [10000111, 11000011, 11100001, 11110000], and the state within the dynamic baseline sequence window is [10000111, 11000011, 11100001, 11110000]. All four positions have the same state, A=4, and the instantaneous matching degree is 1.0. Second window position (k=2): The state within the corrected state sequence window is [11000011, 11100001, 11110000, 01111000], and the state within the dynamic baseline sequence window is [11000011, 11100001, 11110000, 01111000]. All four positions have the same state, A=4, and the instantaneous matching degree is 1.0. The third window position (k=3): the state in the corrected state sequence window is [11100001, 11110000, 01111000, 00011110], and the state in the dynamic baseline sequence window is [11100001, 11110000, 01111000, 00111100]. The first three positions are consistent, and the fourth position 00011110 ≠ 00111100. A=3, and the instantaneous matching degree is 0.75. The fourth window position (k=4): The state within the corrected state sequence window is [11110000, 01111000, 00011110,00001111], and the state within the dynamic baseline sequence window is [11110000, 01111000, 00111100, 00011110]. The first position is consistent, the second position is consistent, the third position 00011110 ≠ 00111100, and the fourth position 00001111 ≠ 00011110. A=2, and the instantaneous matching degree is 0.5. Assuming the moving average filter window length K=3, the real-time matching degree at the current time t=4 is calculated to be 0.75.
[0037] Step S500: Determine the motor direction based on the direction confidence integral variable and the real-time matching degree.
[0038] Specifically, the rate of change ΔC of the directional confidence integral variable is calculated using the following formula: ; Where C1 is the adjusted direction confidence integral variable, k is the index number of the current sampling point, and T is the total number of sampling points within the preset rate of change window; The formula for calculating the rate of change Δm of real-time matching degree is: ; Where m1 is the real-time matching degree, k is the index number of the current sampling point, and T is the total number of sampling points within the preset rate of change window; When ΔC is greater than the preset forward rotation threshold and Δm is greater than the preset matching threshold, the motor rotation is determined to be forward; when ΔC is less than the preset reverse rotation threshold and Δm is greater than the preset matching threshold, the motor rotation is determined to be reverse; otherwise, the rotation direction is determined to be uncertain. When the direction of rotation is determined to be uncertain, the uncertainty duration is accumulated, and the uncertainty duration is increased by the length of one sampling period for each sampling period. When the motor direction is determined to be forward or reverse, the uncertainty duration is reset to 0. When the uncertainty duration is greater than the preset timeout threshold, the adjusted direction confidence integral variable C1 is cleared to zero. Under the condition that the motor is stationary or allowed to perform low-speed self-test, the motor is controlled to rotate uniformly for one revolution at the preset low speed. Based on the new calibration state sequence obtained during the rotation, the first matching degree between the new calibration state sequence and the forward reference sequence and the second matching degree between the new calibration state sequence and the reverse reference sequence are recalculated. The dynamic reference sequence is updated and stored in non-volatile memory. The new dynamic reference sequence is used to continue to determine the direction of rotation.
[0039] In one specific embodiment, let the current sampling point index k=100, the adjusted direction confidence integral variable C1(100)=5, the total number of sampling points within the preset rate of change window is 10, and C1(90)=3. Calculate the rate of change ΔC of the direction confidence integral variable as 0.2. Let the real-time matching degree m1(100)=0.75, m1(90)=0.5, and calculate the rate of change Δm of the real-time matching degree as 0.025. Let the preset forward rotation threshold be 0.1, the preset reverse rotation threshold be -0.1, and the preset matching threshold be 0.02. Since ΔC=0.2 is greater than 0.1, and Δm=0.025 is greater than 0.02, the motor rotation is determined to be forward.
[0040] In another scenario, if ΔC = -0.15 is less than -0.1, and Δm = 0.03 is greater than 0.02, then the motor rotation is determined to be reverse. If ΔC = 0.05 (absolute value less than 0.1) or Δm = 0.01 (less than 0.02), then the rotation is determined to be uncertain. When the rotation is determined to be uncertain, the uncertain duration is accumulated. Assuming the current uncertain duration is 50 milliseconds, and it increases by 0.1 milliseconds for each sampling period (0.1 milliseconds), then after 10 sampling periods, the uncertain duration becomes 51 milliseconds. Assuming the preset timeout threshold is 100 milliseconds, since 51 milliseconds is less than 100 milliseconds, monitoring continues. If the uncertain duration continues to increase to more than 100 milliseconds, the adjusted direction confidence integral variable C1 is cleared to zero. Under the condition that the motor is stationary or allowed to perform low-speed self-test, the motor is controlled to rotate at a constant speed of 600 rpm for one revolution. Based on the new calibration state sequence obtained during the rotation, the first matching degree between the new calibration state sequence and the forward reference sequence and the second matching degree with the reverse reference sequence are recalculated. The dynamic reference sequence is updated and stored in non-volatile memory. The new dynamic reference sequence is used to continue to determine the direction.
[0041] like Figure 2 The flowchart of a method for detecting the stator steering of a new energy main drive motor is shown. This invention provides a method for detecting the stator steering of a new energy main drive motor, comprising: Hall sensors are evenly distributed on the inner wall of the motor stator. After the motor is powered on and rotates, binary parallel signals are acquired in real time and recorded in chronological order as the original state sequence. The state transition sequences for forward and reverse rotation are established as the forward reference sequence and the reverse reference sequence, respectively. The original state sequence is compressed, removing continuous repetitive states and merging short-time oscillating transitions to obtain the reduced state sequence. Unexpected states are those that do not belong to either the forward or reverse reference sequence. Unexpected states in the reduced state sequence are assigned to the expected states with the closest Hamming distance to obtain the corrected state sequence. A direction confidence integral variable is set with an initial value of 0. For state pairs consisting of adjacent states in the corrected state sequence, adjustments are made according to their presence in the reference sequence: if they only exist in the forward reference sequence, a positive step size is added; if they only exist in the reverse reference sequence, a negative step size is subtracted; if they exist in both, they remain unchanged; if they do not exist in any reference sequence, they are multiplied by a decay factor.
[0042] The control motor rotates at a preset low speed for one revolution. The corrected state sequence is used as the calibration state sequence, and its matching degree with the forward and reverse reference sequences is calculated separately. The one with the higher matching degree is selected as the dynamic reference sequence and stored in non-volatile memory. A sliding window is used to align the corrected state sequence with the dynamic reference sequence, and the instantaneous matching degree is calculated by counting the number of consistent states. The real-time matching degree is obtained by moving average filtering.
[0043] Calculate the rate of change of the direction confidence integral variable and the rate of change of the real-time matching degree. If the rate of change of the direction confidence integral variable is greater than a preset forward turning threshold and the rate of change of the real-time matching degree is greater than a preset matching threshold, the direction is determined to be forward; if the rate of change of the direction confidence integral variable is less than a preset reverse turning threshold and the rate of change of the real-time matching degree is greater than a preset matching threshold, the direction is determined to be reverse; otherwise, the direction is determined to be uncertain. When the direction is determined to be uncertain, the uncertainty duration is accumulated. When the uncertainty duration exceeds a preset timeout threshold, the direction confidence integral variable is cleared to zero, the self-calibration step is re-executed, and the direction determination continues using a new dynamic reference sequence.
[0044] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A method for detecting the steering direction of a new energy main drive motor stator, characterized in that, include: Hall sensors are evenly arranged circumferentially on the inner wall of the motor stator; after the motor is powered on and rotates, the binary parallel signals output by each Hall sensor are collected in real time and recorded as the original state sequence in chronological order. Establish the state transition sequence of the Hall sensor when the motor rotates forward and reverses, respectively, as the reference sequence for forward rotation and the reference sequence for reverse rotation; The original state sequence is compressed to obtain a reduced state sequence. When an unexpected state appears in the reduced state sequence, the unexpected state is assigned to the nearest expected state to obtain a corrected state sequence. Set a directional confidence integral variable, which is adjusted according to the transition direction between adjacent states in the corrected state sequence; During the low-speed self-calibration rotation of the motor, the corrected state sequence is compared with the forward rotation reference sequence and the reverse rotation reference sequence respectively. Based on the comparison results, one of the reference sequences is selected as the dynamic reference sequence and stored. The corrected state sequence is compared with the dynamic baseline sequence to calculate the real-time matching degree; The motor direction is determined by combining the direction confidence integral variable and the real-time matching degree.
2. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, The method of uniformly arranging Hall sensors circumferentially on the inner wall of the motor stator includes: N switch-type Hall sensors are arranged at equal angular intervals on a flexible circuit board, which is attached to the inner wall of the motor stator.
3. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, After the motor is powered on and rotates, the binary parallel signals output by each Hall sensor are collected in real time and recorded in chronological order as the original state sequence, including: The output levels of all Hall sensors are simultaneously acquired at a preset sampling frequency. At each sampling moment, an N-bit binary number and a corresponding sampling point are obtained. These are recorded sequentially according to the sampling time sequence to form the original state sequence; where N is the total number of Hall sensors.
4. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, The step of establishing the state transition sequence of the Hall sensor during motor forward and reverse rotation, respectively, as the forward rotation reference sequence and the reverse rotation reference sequence, includes: During one revolution of the motor in a uniform forward direction, the N-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the forward rotation reference sequence; during one revolution of the motor in a uniform reverse direction, the N-bit binary numbers output by the Hall sensor are recorded in chronological order to obtain the reverse rotation reference sequence.
5. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, The compression process of the original state sequence to obtain the reduced state sequence includes: Traverse the original state sequence and remove consecutively repeated identical states to obtain a deduplication sequence. For the first state S(i-1), the second state S(i), and the third state S(i+1) that are adjacent in time order in the deduplication sequence, if every bit of the binary number of S(i-1) and S(i+1) is equal, and at least one bit of the binary number of S(i) and S(i-1) is different, it is determined to be a short-time oscillatory jump. The number of consecutive sampling points actually occupied by S(i) in the original state sequence is obtained as the oscillation width. When the oscillation width is less than the preset oscillation width threshold, S(i-1), S(i), and S(i+1) are merged and compressed into a single steady-state node S(i-1). When the oscillation width is greater than or equal to the preset oscillation width threshold, the compression is abandoned and S(i-1), S(i), and S(i+1) are retained as valid transition sequences. The compressed or retained results are arranged in the original time order to obtain the reduced state sequence.
6. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, When an unexpected state appears in the reduced state sequence, the unexpected state is assigned to the nearest expected state to obtain a corrected state sequence, including: The unexpected state is a state that does not belong to the forward reference sequence or the reverse reference sequence, and the expected state is a state that belongs to the forward reference sequence or the reverse reference sequence. The unexpected state needs to be included. For each unexpected state X in the reduced state sequence, calculate the Hamming distance between the corresponding unexpected state and each reference state Y in the forward and reverse reference sequences, respectively, using the following formula: ; Where X represents the unexpected state, Y represents the baseline state, and N represents the total number of Hall sensors. i Y is the i-th binary number representing an unexpected state. i The i-th binary number of the baseline state; From all the reference states in the forward and reverse reference sequences, the reference state with the smallest Hamming distance is selected as the target for the unexpected state. When there are multiple reference states with the smallest Hamming distance, the reference state that appears earliest in the corresponding reference sequence is selected as the target. Each unexpected state in the reduced state sequence is replaced with its target, while the expected state remains unchanged. The corrected state sequence is obtained after arranging them in the original order.
7. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, The setting of the directional confidence integral variable, adjusted according to the transition direction between adjacent states in the corrected state sequence, includes: The transition direction is the direction in which the preceding state jumps to the following state in the corrected state sequence in chronological order. Set the initial value of the direction confidence integral variable C to 0; for the state pairs formed by the preceding and following states that are adjacent in time in the corrected state sequence, traverse the forward reference sequence. When there is a position such that the state at the corresponding position is equal to the preceding state and the state at the next position is equal to the following state, determine that the corresponding state pair exists in the forward reference sequence; traverse the reverse reference sequence. When there is a position such that the state at the corresponding position is equal to the preceding state and the state at the next position is equal to the following state, determine that the corresponding state pair exists in the reverse reference sequence. When the state pair exists only in the forward reference sequence, add a preset forward step size to the direction confidence integral variable C; when the state pair exists only in the reverse reference sequence, subtract a preset reverse step size from the direction confidence integral variable C; when the state pair exists in both the forward and reverse reference sequences, the direction confidence integral variable C remains unchanged; when the state pair does not exist in any reference sequence, multiply the direction confidence integral variable C by a preset attenuation factor; output the adjusted direction confidence integral variable C1.
8. The method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, During the low-speed self-calibration rotation of the motor, the corrected state sequence is compared with the forward rotation reference sequence and the reverse rotation reference sequence, respectively. Based on the comparison results, one of the reference sequences is selected as the dynamic reference sequence and stored, including: The control motor rotates at a preset low speed for one revolution, and the corrected state sequence obtained during the rotation is recorded as the calibration state sequence, with a length denoted as L. The first matching degree M1 between the calibration state sequence and the forward reference sequence is calculated, where M1 is the maximum value of the longest common subsequence length of the calibration state sequence and the forward reference sequence divided by L and the length of the forward reference sequence. The second matching degree M2 between the calibration state sequence and the reverse reference sequence is calculated, where M2 is the maximum value of the longest common subsequence length of the calibration state sequence and the reverse reference sequence divided by L and the length of the reverse reference sequence. M1 and M2 are compared. When M1 is greater than or equal to M2, the forward reference sequence is selected as the dynamic reference sequence. When M1 is less than M2, the reverse reference sequence is selected as the dynamic reference sequence. The selected dynamic reference sequence is stored in non-volatile memory.
9. A method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, The step of comparing the corrected state sequence with the dynamic reference sequence and calculating the real-time matching degree includes: A sliding window of preset length is used to align the corrected state sequence with the dynamic reference sequence in time. At each window position, the number A of the corrected state sequence and the dynamic reference sequence that are consistent at the same position is counted. A is divided by the window length to obtain the instantaneous matching degree of the corresponding alignment position. The instantaneous matching degrees of the most recent consecutive alignment positions are filtered by a moving average, and the filtered arithmetic mean is used as the real-time matching degree m1.
10. A method for detecting the stator steering of a new energy main drive motor according to claim 1, characterized in that, The step of comprehensively determining the motor direction based on the direction confidence integral variable and the real-time matching degree includes: The formula for calculating the rate of change ΔC of the integral variable of directional confidence is: ; Where C1 is the adjusted direction confidence integral variable, k is the index number of the current sampling point, and T is the total number of sampling points within the preset rate of change window; The formula for calculating the rate of change Δm of real-time matching degree is: ; Where m1 is the real-time matching degree, k is the index number of the current sampling point, and T is the total number of sampling points within the preset rate of change window; When ΔC is greater than the preset forward rotation threshold and Δm is greater than the preset matching threshold, the motor rotation is determined to be forward; when ΔC is less than the preset reverse rotation threshold and Δm is greater than the preset matching threshold, the motor rotation is determined to be reverse; otherwise, the rotation direction is determined to be uncertain. When the direction is determined to be uncertain, the uncertainty duration is accumulated, and the uncertainty duration is increased by the length of one sampling period for each sampling period. When the motor direction is determined to be forward or reverse, the uncertainty duration is reset to 0. When the uncertainty duration is greater than the preset timeout threshold, the adjusted direction confidence integral variable C1 is cleared to zero, and the motor is controlled to rotate uniformly for one revolution at a preset low speed. Based on the new calibration state sequence obtained during the rotation, the first matching degree between the new calibration state sequence and the forward reference sequence and the second matching degree between the new calibration state sequence and the reverse reference sequence are recalculated. The dynamic reference sequence is updated and stored in non-volatile memory, and the new dynamic reference sequence is used to continue to determine the direction.