Current and position synchronization method and device, equipment and storage medium
By capturing the edge timestamps of current and position using a timer, the problem of low synchronization accuracy between current and angle is solved, achieving high-precision synchronization of current and position, reducing costs, and minimizing torque ripple and efficiency loss.
Patent Information
- Application Number
- CN202511769218.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-02-24
AI Technical Summary
In existing technologies, current and angle synchronization suffers from low synchronization accuracy, especially when the PWM frequency changes, which leads to inconsistent time intervals between current sampling and angle sampling, resulting in torque ripple and reduced efficiency. Furthermore, the ADC module's timestamp compensation accuracy is insufficient or it lacks timestamp functionality.
The system generates current sampling trigger signals and position sampling synchronization signals using a timer, captures the timestamps of the edges, and synchronizes the current and position based on the timestamps. It utilizes the high clock frequency of the advanced timer to achieve high-precision synchronization, and is suitable for ADC modules with or without timestamp functionality.
It improves the synchronization accuracy of current and position, reduces costs, achieves efficient synchronization under PWM frequency variations, and reduces torque ripple and efficiency loss.
Smart Images

Figure CN121559942A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of motor control technology, and in particular to a method, apparatus, device and storage medium for synchronizing current and position. Background Technology
[0002] PWM variable frequency control is an advanced modulation strategy in motor drive systems. Its core lies in dynamically adjusting the PWM switching frequency according to operating conditions to optimize efficiency, reduce losses, suppress noise, or adapt to different speed requirements. Typically, the resolver angle acquisition frequency is fixed. Changing the PWM frequency causes the time interval between current and angle sampling to vary within each PWM cycle. This asynchrony can lead to runaway decoupling control, resulting in severe torque ripple and a significant drop in efficiency. Therefore, current and angle synchronization is crucial. Current and angle synchronization means synchronizing the timing of the current and angle sampling, ensuring zero timing deviation between them.
[0003] The existing solutions use timestamps generated by the ADC sampling module to synchronize current and angle. However, ADC modules with timestamp functionality require more complex circuit designs and are more expensive. Furthermore, the external clock frequency of ADC modules is usually not very high, leading to insufficient timestamp compensation accuracy. Some ADC modules do not include timestamp functionality and cannot achieve current and angle synchronization through ADC timestamps.
[0004] Therefore, how to solve the above-mentioned technical defects has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, device, and storage medium for synchronizing current and position, which can improve synchronization accuracy and reduce cost.
[0006] To address the aforementioned technical problems, this application provides a method for synchronizing current and position, comprising:
[0007] A current sampling trigger signal is generated using a timer;
[0008] The timer captures the timestamp of the first target edge in the current sampling trigger signal; the time of the first target edge is the time of current sampling.
[0009] The timer generates a position sampling synchronization signal;
[0010] The timestamp of the second target edge in the position sampling synchronization signal is captured by the customizer; the time of the second target edge is the time of position sampling.
[0011] Synchronize the current and position based on the timestamps of the first and second target edges.
[0012] In some embodiments, the synchronization current and position include, based on the timestamps of the first target edge and the second target edge:
[0013] The difference between the timestamp of the first target edge and the timestamp of the second target edge is used to obtain the timestamp to be compensated.
[0014] Determine the rotor speed;
[0015] The first target angle is determined based on the timestamp to be compensated and the speed.
[0016] The second target angle is determined based on the angle obtained from the first target angle and the position sampling; the second target angle is at the same time as the current sampling.
[0017] In some embodiments, determining the rotor speed includes:
[0018] The angles at the preceding and following sampling time points are determined based on the resolver position feedback signal;
[0019] The rotor speed is determined based on the angles at the preceding and following sampling time points and the time difference between them.
[0020] In some embodiments, capturing the timestamp of the first target edge in the current sampling trigger signal via the timer includes:
[0021] The timer captures the timestamp of the rising edge of the current sampling trigger signal.
[0022] In some embodiments, capturing the timestamp of the second target edge in the position sampling synchronization signal via the customizer includes:
[0023] The timestamp of the rising edge in the position sampling synchronization signal is captured by the customizer.
[0024] In some embodiments, determining the second target angle based on the first target angle and the angle obtained from position sampling includes:
[0025] The angle obtained by sampling the position is added to the first target angle to obtain the second target angle.
[0026] In some embodiments, it also includes:
[0027] The timer generates a pulse width modulation signal; the pulse width modulation signal is used to control the full-bridge drive.
[0028] To address the aforementioned technical problems, this application also provides a current and position synchronization device, comprising:
[0029] The first generation unit generates a current sampling trigger signal through a timer;
[0030] The first capture unit is configured to capture the timestamp of the first target edge in the current sampling trigger signal via the timer; the time of the first target edge is the time of current sampling.
[0031] The second generation unit is used to generate a position sampling synchronization signal through the timer;
[0032] The second capture unit is used to capture the timestamp of the second target edge in the position sampling synchronization signal through the customizer; the time of the second target edge is the time of position sampling.
[0033] The synchronization unit is used to synchronize the current and position based on the timestamps of the first target edge and the second target edge.
[0034] To address the aforementioned technical problems, this application also provides an electronic device, comprising:
[0035] Memory, used to store computer programs;
[0036] A processor for executing the computer program to implement the current and position synchronization method as described above.
[0037] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the current and position synchronization method described above.
[0038] The current and position synchronization method provided in this application includes: generating a current sampling trigger signal via a timer; capturing a timestamp of a first target edge in the current sampling trigger signal via the timer; the time of the first target edge being the time of current sampling; generating a position sampling synchronization signal via the timer; capturing a timestamp of a second target edge in the position sampling synchronization signal via the timer; the time of the second target edge being the time of position sampling; and synchronizing current and position based on the timestamps of the first and second target edges.
[0039] As can be seen, the current and position synchronization method provided in this application captures the timestamps of current and position sampling through a timer. Compared to schemes that generate timestamps using an ADC module with timestamp functionality, the timer's clock speed is often higher, allowing for more accurate timestamps and thus improving synchronization accuracy. Furthermore, the timer is less expensive than an ADC module with timestamp functionality. Even for ADC modules without timestamp functionality, the current and position synchronization method provided in this application can achieve high-precision synchronization of current and position.
[0040] The current and position synchronization device, equipment, and computer-readable storage medium provided in this application all have the aforementioned technical effects. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the prior art and embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 A schematic flowchart illustrating a current and position synchronization method provided in an embodiment of this application;
[0043] Figure 2 A signal timing diagram provided in an embodiment of this application;
[0044] Figure 3 A schematic diagram of a current and position synchronization device provided in an embodiment of this application;
[0045] Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0046] The core of this application is to provide a method, apparatus, device, and storage medium for synchronizing current and position, which can improve synchronization accuracy and reduce costs.
[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0048] Please refer to Figure 1 , Figure 1This is a flowchart illustrating a current and position synchronization method provided in an embodiment of this application. (Refer to...) Figure 1 As shown, the method includes:
[0049] S101: Generates a current sampling trigger signal via a timer;
[0050] S102: The timestamp of the first target edge in the current sampling trigger signal is captured by the timer; the time of the first target edge is the time of current sampling.
[0051] S103: Generate a position sampling synchronization signal using the timer;
[0052] S104: Capture the timestamp of the second target edge in the position sampling synchronization signal using the customizer; the time of the second target edge is the time of position sampling.
[0053] S105: Synchronize the current and position based on the timestamp of the first target edge and the timestamp of the second target edge.
[0054] In some embodiments, it also includes:
[0055] The timer generates a pulse width modulation signal; the pulse width modulation signal is used to control the full-bridge drive.
[0056] Devices used for motor control typically include advanced timers and ADC (analog-to-digital converter) modules. Therefore, the advanced timer can capture the timestamps for current sampling and position sampling. The ADC module does not need to have timestamp functionality.
[0057] The advanced timer can generate three PWM signals with dead time for controlling the full-bridge drive. For example... Figure 2 As shown, Figure 2 One of the PWM signals is listed below. In actual motor control, the frequency of the PWM signal is adjusted according to the control algorithm.
[0058] refer to Figure 2 As shown, the advanced timer generates a current sampling trigger signal (i.e., Figure 2 The current sampling TRIG signal is shown in the diagram. The period of the current sampling trigger signal is synchronized with the period of the PWM signal. The trigger point for current sampling can typically be located at the center of the PWM signal. For example, Figure 2 The location of the current sampling is marked in the middle.
[0059] refer to Figure 2 As shown, the advanced timer generates a position sampling synchronization signal. The period of the position sampling synchronization signal is the same as the period of the resolver position feedback signal. The period of the resolver position feedback signal is fixed.
[0060] The difference between the PWM signal period and the position feedback period causes the time difference between current sampling and position sampling to be inconsistent within each period. For example... Figure 2 As shown, T1 and Since T2 is inconsistent, it cannot be compensated by a fixed offset. Therefore, it is necessary to obtain the accurate difference between the sampling time of the current and the sampling time of the position in order to synchronize the current and the position based on the difference.
[0061] The advanced timer's internal channels can use the same clock as a reference. Furthermore, the advanced timer can capture the timestamps of signal edges through direct connection to internal channel signals. The clock frequency of these timestamps is the timer's clock frequency, which is several times higher than the peripheral frequency of the ADC module. Internally, the timer can directly connect the current sampling trigger signal and the position sampling synchronization signal to the input signal. It detects the timestamp of the first target edge in the current sampling trigger signal and the timestamp of the second target edge in the position sampling synchronization signal through the input channel. The ADC module samples the current at the first target edge and the position (rotor position) at the second target edge.
[0062] In some embodiments, capturing the timestamp of the first target edge in the current sampling trigger signal via the timer includes:
[0063] The timer captures the timestamp of the rising edge of the current sampling trigger signal.
[0064] In some embodiments, capturing the timestamp of the second target edge in the position sampling synchronization signal via the customizer includes:
[0065] The timestamp of the rising edge in the position sampling synchronization signal is captured by the customizer.
[0066] refer to Figure 2 As shown, the advanced timer can directly connect the current sampling trigger signal and the position sampling synchronization signal to the input signal. It detects the rising edge of both the current sampling trigger signal and the position sampling synchronization signal through the input channel. Simultaneously, the advanced timer can record the time of each rising edge, allowing timestamps T1, T2, T3, and T4 to be obtained through its internal capture channel. The ADC module samples the current at the rising edge of the current sampling trigger signal and samples the position at the rising edge of the position sampling synchronization signal.
[0067] Synchronize the current and position based on the timestamps of the first and second target edges.
[0068] In some embodiments, the synchronization current and position include, based on the timestamps of the first target edge and the second target edge:
[0069] The difference between the timestamp of the first target edge and the timestamp of the second target edge is used to obtain the timestamp to be compensated.
[0070] Determine the rotor speed;
[0071] The first target angle is determined based on the timestamp to be compensated and the speed.
[0072] The second target angle is determined based on the angle obtained from the first target angle and the position sampling; the second target angle is at the same time as the current sampling.
[0073] In some embodiments, determining the second target angle based on the first target angle and the angle obtained from position sampling includes:
[0074] The angle obtained by sampling the position is added to the first target angle to obtain the second target angle.
[0075] For example, refer to Figure 2 As shown, the difference between the current sampling timestamp T1 and the position sampling timestamp T2 is obtained. T1, multiply the motor speed by At time T1, the first target angle is obtained. The first target angle is added to the angle obtained from the position sampling to obtain the second target angle. The second target angle is the rotor position at time T2.
[0076] The difference between the current sampling timestamp T4 and the position sampling timestamp T3 is obtained. T2, multiply the motor speed by At time T2, the first target angle is obtained. The first target angle is added to the angle obtained from the position sampling to obtain the second target angle. At this time, the second target angle is the rotor position at time T4.
[0077] In some embodiments, determining the rotor speed includes:
[0078] The angles at the preceding and following sampling time points are determined based on the resolver position feedback signal;
[0079] The rotor speed is determined based on the angles at the preceding and following sampling time points and the time difference between them.
[0080] The angle at the sampling time point is calculated based on the resolver position feedback signal. The rotor speed is then calculated by differentiating the angle from the previous sampling time point. This speed is multiplied by... T, and then synchronizes current sampling and position sampling through linear compensation.
[0081] In summary, the current and position synchronization method provided in this application captures the timestamps of current and position sampling using a timer. Compared to schemes that generate timestamps using an ADC module with timestamp functionality, the timer's clock speed is often higher, allowing for more precise timestamps and thus improving synchronization accuracy. Furthermore, the timer is less expensive than an ADC module with timestamp functionality. Even for ADC modules without timestamp functionality, the current and position synchronization method provided in this application can achieve high-precision synchronization of current and position.
[0082] This application also provides a current and position synchronization device, which is described below and can be referred to in conjunction with the method described above. Please refer to... Figure 3 , Figure 3 This is a schematic diagram of a current and position synchronization device provided in an embodiment of this application, combined with... Figure 3 As shown, the device includes:
[0083] The first generation unit 10 generates a current sampling trigger signal through a timer;
[0084] The first capture unit 20 is used to capture the timestamp of the first target edge in the current sampling trigger signal through the timer; the time of the first target edge is the time of current sampling.
[0085] The second generation unit 30 is used to generate a position sampling synchronization signal through the timer;
[0086] The second capture unit 40 is used to capture the timestamp of the second target edge in the position sampling synchronization signal through the customizer; the time of the second target edge is the time of position sampling.
[0087] Synchronization unit 50 is used to synchronize current and position based on the timestamp of the first target edge and the timestamp of the second target edge.
[0088] Based on the above embodiments, as a specific implementation method, the synchronization unit 50 includes:
[0089] The calculation subunit is used to subtract the timestamp of the first target edge from the timestamp of the second target edge to obtain the timestamp to be compensated.
[0090] The speed determination subunit is used to determine the speed of the rotor;
[0091] The first determining subunit is used to determine the first target angle based on the timestamp to be compensated and the speed;
[0092] The second determining subunit is used to determine the second target angle based on the first target angle and the angle obtained by sampling the position; the second target angle is at the same time as the current sampling.
[0093] Based on the above embodiments, as a specific implementation method, the speed determination subunit is used for:
[0094] The angles at the preceding and following sampling time points are determined based on the resolver position feedback signal;
[0095] The rotor speed is determined based on the angles at the preceding and following sampling time points and the time difference between them.
[0096] Based on the above embodiments, as a specific implementation method, the first capturing unit 20 is used for:
[0097] The timer captures the timestamp of the rising edge of the current sampling trigger signal.
[0098] Based on the above embodiments, as a specific implementation method, the second capturing unit 40 is used for:
[0099] The timestamp of the rising edge in the position sampling synchronization signal is captured by the customizer.
[0100] Based on the above embodiments, as a specific implementation method, the second determining subunit is used for:
[0101] The angle obtained by sampling the position is added to the first target angle to obtain the second target angle.
[0102] Based on the above embodiments, as a specific implementation method, it further includes:
[0103] The third generation unit is used to generate a pulse width modulation signal through the timer; the pulse width modulation signal is used to control the full-bridge drive.
[0104] The current and position synchronization device provided in this application captures the timestamps of current and position sampling through a timer. Compared to solutions that generate timestamps using an ADC module with timestamp functionality, the timer's clock speed is often higher, allowing for more accurate timestamps and thus improving synchronization accuracy. Furthermore, the timer is less expensive than an ADC module with timestamp functionality. Even for ADC modules without timestamp functionality, the current and position synchronization device provided in this application can achieve high-precision synchronization of current and position.
[0105] This application also provides an electronic device, referenced... Figure 4 As shown, the device includes a memory 1 and a processor 2.
[0106] Memory 1 is used to store computer programs;
[0107] Processor 2 is used to execute computer programs to perform the following steps:
[0108] A current sampling trigger signal is generated using a timer;
[0109] The timer captures the timestamp of the first target edge in the current sampling trigger signal; the time of the first target edge is the time of current sampling.
[0110] The timer generates a position sampling synchronization signal;
[0111] The timestamp of the second target edge in the position sampling synchronization signal is captured by the customizer; the time of the second target edge is the time of position sampling.
[0112] Synchronize the current and position based on the timestamps of the first and second target edges.
[0113] For a description of the equipment provided in this application, please refer to the above method embodiments; further details will not be provided here.
[0114] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the following steps:
[0115] A current sampling trigger signal is generated using a timer;
[0116] The timer captures the timestamp of the first target edge in the current sampling trigger signal; the time of the first target edge is the time of current sampling.
[0117] The timer generates a position sampling synchronization signal;
[0118] The timestamp of the second target edge in the position sampling synchronization signal is captured by the customizer; the time of the second target edge is the time of position sampling.
[0119] Synchronize the current and position based on the timestamps of the first and second target edges.
[0120] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0121] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.
[0122] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant details can be found in the method section.
[0123] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0124] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0125] The present application provides a detailed description of the current and position synchronization method, apparatus, device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present application. The descriptions of these embodiments are merely illustrative and are intended to aid in understanding the method and core concepts of the present application. It should be noted that those skilled in the art can make various improvements and modifications to the present application without departing from its principles, and these improvements and modifications also fall within the protection scope of the present application.
Claims
1. A method for synchronizing current and position, characterized in that, include: A current sampling trigger signal is generated using a timer; The timer captures the timestamp of the first target edge in the current sampling trigger signal; The moment of the first target edge is the moment of current sampling; The timer generates a position sampling synchronization signal; The timestamp of the second target edge in the position sampling synchronization signal is captured by the customizer; the time of the second target edge is the time of position sampling. Synchronize the current and position based on the timestamps of the first and second target edges.
2. The synchronization method according to claim 1, characterized in that, Based on the timestamps of the first and second target edges, the synchronization current and position include: The difference between the timestamp of the first target edge and the timestamp of the second target edge is used to obtain the timestamp to be compensated. Determine the rotor speed; The first target angle is determined based on the timestamp to be compensated and the speed. The second target angle is determined based on the angle obtained from the first target angle and the position sampling; the second target angle is at the same time as the current sampling.
3. The synchronization method according to claim 2, characterized in that, Determining the rotor speed includes: The angles at the preceding and following sampling time points are determined based on the resolver position feedback signal; The rotor speed is determined based on the angles at the preceding and following sampling time points and the time difference between them.
4. The synchronization method according to claim 2, characterized in that, Determining the second target angle based on the angle obtained from the first target angle and position sampling includes: The angle obtained by sampling the position is added to the first target angle to obtain the second target angle.
5. The synchronization method according to claim 1, characterized in that, The timestamp for capturing the first target edge in the current sampling trigger signal via the timer includes: The timer captures the timestamp of the rising edge of the current sampling trigger signal.
6. The synchronization method according to claim 1, characterized in that, The timestamp for capturing the second target edge in the position sampling synchronization signal via the customizer includes: The timestamp of the rising edge in the position sampling synchronization signal is captured by the customizer.
7. The synchronization method according to claim 1, characterized in that, Also includes: The timer generates a pulse width modulation signal; the pulse width modulation signal is used to control the full-bridge drive.
8. A synchronization device for current and position, characterized in that, include: The first generation unit generates a current sampling trigger signal through a timer; The first capture unit is configured to capture the timestamp of the first target edge in the current sampling trigger signal via the timer; The moment of the first target edge is the moment of current sampling; The second generation unit is used to generate a position sampling synchronization signal through the timer; The second capture unit is used to capture the timestamp of the second target edge in the position sampling synchronization signal through the customizer; The time of the second target edge is the time of position sampling; The synchronization unit is used to synchronize the current and position based on the timestamps of the first target edge and the second target edge.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the current and position synchronization method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the current and position synchronization method as described in any one of claims 1 to 7.