Motor control apparatus and timestamp compensation method therefor

By introducing a timestamp compensation method into the motor control device, the problem of inconsistent angle and current sampling periods was solved, achieving precise current control and stability of the permanent magnet synchronous motor and improving control accuracy.

WO2026044449A1PCT designated stage Publication Date: 2026-03-05DELTA ELECTRONICS INC(CN)
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/114493
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2026-03-05

AI Technical Summary

Technical Problem

In the control of permanent magnet synchronous motors, the inconsistency between the angle and current sampling period leads to inaccurate control, affecting the stability and accuracy of current control.

Method used

By introducing a timestamp compensation method into the motor control device, the timing relationship between current and angle sampling is determined by the count value and a specific flag interval. The angle parameter is compensated to ensure synchronization. An angle sensing device and a current sensing device sample at specific periods, and the angle parameter is corrected by judging the timestamp and flag interval.

Benefits of technology

This improves the accuracy and stability of current control in permanent magnet synchronous motors, avoiding control instability caused by inaccurate angle parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024114493_05032026_PF_FP_ABST
    Figure CN2024114493_05032026_PF_FP_ABST
Patent Text Reader

Abstract

A motor control apparatus and a timestamp compensation method therefor. The motor control apparatus is used for controlling a driving circuit to drive a motor to operate, and the motor control apparatus comprises a control module, an angle sensing apparatus and a current sensing apparatus, wherein the control module counts a plurality of first specific periods and a plurality of second specific periods, so as to provide within each first specific time period a count value that increases with time, and sets a timestamp, a specific flag interval and a specific interrupt service routine; the angle sensing apparatus is used for sampling an angle parameter of the motor on the basis of an angle-decoding interrupt service routine and at a first time of each first specific period; the current sensing apparatus is used for sampling a current parameter of the driving circuit on the basis of a current interrupt service routine and at a second time of each second specific period; and the control module compensates for the angle parameter on the basis of various interrupt service routines and the timestamp.
Need to check novelty before this filing date? Find Prior Art

Description

Motor control device and its timestamp compensation method Technical Field

[0001] This invention relates to a motor control device and its operating method, and more particularly to a motor control device with timestamp compensation and its timestamp compensation method. Background Technology

[0002] Induction motors are widely used due to their simple construction, easy maintenance, and low cost. However, under the same power conditions, permanent magnet synchronous motors (PMSMs) have advantages such as small size, light weight, and high efficiency. Currently, most electric vehicles use PMSMs. However, to control PMSMs more accurately, it is generally necessary to continuously sample the angle and current of the PMSM to precisely control it. Therefore, the shaft angle position feedback and current sampling parts play a crucial role in the entire motor control system architecture. Because in the entire motor control system, to achieve vector control of the drive circuit, the sampling of the motor shaft angle position and current must be synchronized. If asynchrony occurs, poor overall control performance is likely to result.

[0003] Therefore, typical motor control devices first need to analyze these feedback signals to obtain the angle. However, due to the limitations of the internal controller's hardware, the calculation cycle during angle calculation differs from the current sampling cycle. This discrepancy between the angle calculation cycle and the current sampling cycle prevents them from being acquired synchronously, resulting in a difference between the current angle at the current sampling point and the angle obtained during the original angle sampling cycle. Consequently, the motor control device cannot provide precise current control.

[0004] Therefore, how to design a motor control device and its timestamp compensation method to provide a judgment mechanism to identify the electrical angle algorithm corresponding to various situations, so as to avoid the motor current being unable to be accurately controlled or being unstable, is a major research topic that the creators of this case intend to conduct.

[0005] Summary of the Invention

[0006] To address the aforementioned problems, the present invention provides a motor control device to overcome the limitations of known technologies. Therefore, the motor control device of the present invention is used to control a drive circuit to drive a motor, and the motor control device includes a control module, an angle sensing device, and a current sensing device. The control module counts a plurality of first specific cycles and a plurality of second specific cycles, and provides a count value that increases over time in each first specific cycle, wherein the control module sets a specific flag interval. The angle sensing device samples the angle parameters of the motor rotor according to an angle resolution interruption procedure at a first time in each first specific cycle. The current sensing device samples the current parameters provided by the drive circuit according to a current interruption procedure at a second time in each second specific cycle, and the control module sets a timestamp at the trigger point of each second specific cycle, thereby initiating the specific flag interval. The control module compensates for the angle parameters based on the specific flag interval in which the current interruption procedure is located, the timestamp, and the timing of the angle resolution interruption procedure, the current interruption procedure, and the specific interruption procedure.

[0007] To address the aforementioned problems, the present invention provides a timestamp compensation method for a motor control device, overcoming the limitations of known technologies. Therefore, the motor control device of the present invention is used to control a drive circuit to drive a motor, and the motor control device includes an angle sensing device and a current sensing device. The timestamp compensation method includes the following steps: counting a plurality of first specific cycles and a plurality of second specific cycles, providing a count value that increases over time in each first specific cycle, and setting a specific flag interval. At a first time in each first specific cycle, controlling the angle sensing device to sample the angle parameters of the motor rotor according to an angle resolution interruption procedure. At a second time in each second specific cycle, controlling the current sensing device to sample the current parameters provided by the drive circuit according to a current interruption procedure, setting a timestamp at the trigger point of each second specific cycle, and initiating the specific flag interval accordingly. Compensating the angle parameters based on the specific flag interval where the current interruption procedure is located, the timestamp, and the timing of the angle resolution interruption procedure, the current interruption procedure, and the specific interruption procedure.

[0008] The main purpose and effect of this disclosure is that the control module of this disclosure determines whether the count value corresponding to the second time triggered after the timestamp is greater than the count value corresponding to the timestamp, and performs corresponding control accordingly. In this way, the electric angle algorithm corresponding to the motor system in various situations can be identified, avoiding the situation where the current of the motor cannot be accurately controlled or the control is unstable due to the current angle parameters obtained by the control module being inaccurate.

[0009] To gain a deeper understanding of the techniques, means, and effects employed by this invention to achieve its intended purpose, please refer to the following detailed description and accompanying drawings. It is believed that the purpose, features, and characteristics of this invention can be understood in a thorough and specific manner from these drawings. However, the accompanying drawings are provided for reference and illustration only and are not intended to limit this invention. Attached Figure Description

[0010] Figure 1A is a circuit block diagram of the motor system disclosed herein;

[0011] Figure 1B is a schematic diagram of the angle signal conversion method disclosed herein;

[0012] Figure 1C is a timing diagram of the actual operation of the control module disclosed herein;

[0013] Figure 2A is a timing diagram of the operation of the motor system disclosed in this invention under a specific scenario;

[0014] Figure 2B is a timing diagram of the operation of the motor system disclosed herein under another specific scenario;

[0015] Figure 2C is a schematic diagram of the current waveform of the motor system disclosed in this invention under another specific scenario;

[0016] Figure 3A is a timing diagram of the operation of the motor system disclosed in this invention under the first scenario;

[0017] Figure 3B is a timing diagram of the operation of the motor system disclosed in this invention under the second scenario;

[0018] Figure 3C is a timing diagram of the operation of the motor system disclosed in this invention under the third scenario;

[0019] Figure 3D is the timing diagram of the operation of the motor system disclosed in this invention under the fourth scenario;

[0020] Figure 3E is the timing diagram of the operation of the motor system disclosed in this invention under the fifth scenario;

[0021] Figure 4A is a schematic diagram of the interruption procedure push status disclosed herein;

[0022] Figure 4B is a flowchart of the first embodiment of the timestamp compensation method for the motor control device disclosed herein; and

[0023] Figure 4C is a flowchart of the second embodiment of the timestamp compensation method for the motor control device disclosed herein.

[0024]

Symbol Explanation

[0025] The technical content and detailed description of the present invention are explained below with reference to the accompanying drawings:

[0026] Please refer to Figure 1A, which is a circuit block diagram of the motor system disclosed herein. The motor system 100 includes a motor 200, a drive circuit 300, and a motor control device 400, with the motor control device 400 primarily used to control the drive circuit 300 to drive the motor 200. Specifically, the motor control device 400 includes a control module 1, an angle sensing device 2, and a current sensing device 3. One end of the drive circuit 300 receives an input power supply Pin, and the other end is coupled to the motor 200. The angle sensing device 2 samples the rotor angle parameter Pt of the motor 200 to provide an angle signal St to the control module 1 based on the angle parameter Pt. The current sensing device 3 samples the current parameters Ia, Ib, and Ic (i.e., A-phase, B-phase, and C-phase currents) provided to the motor 200 by the drive circuit 300 to provide a current signal Si to the control module 1 based on the current parameters Ia, Ib, and Ic. The control module 1 receives the angle signal St and the current signal Si, and provides a pulse width modulation (PWM) signal to the drive circuit 300 based on the angle signal St and the current signal Si. The drive circuit 300 converts the input power supply Pin into the output power supply Po according to the pulse width modulation signal PWM, so as to provide the output power supply Po to control the operation of the motor 200.

[0027] The drive circuit 300 is preferably an inverter to convert the DC input power Pin into the AC output power Po. The angle sensing device 2 is preferably a deflector or similar device for sensing the angle of the motor 200, and the control module 1 may include, for example, but not limited to, an analog-to-digital converter (ADC1) to convert the angle signal St into a suitable format. Therefore, the control module 1 can sample the angle signal St through, for example, but not limited to, a deflection interrupt routine (R-ISR), and provide it to the control unit 10 inside the control module 1 for interpretation and calculation, so that the control unit 10 can know the angle parameter Pt. When the angle sensing device 2 is a deflector, the deflector is axially connected to the shaft of the motor 200, so as to sample the angle parameter Pt by driving the shaft of the motor 200. Similarly, the current signal Si provided by the current sensing device 3 can be converted into a suitable format by, for example, but not limited to, an analog-to-digital converter ADC 2. The control module 1 can sample the current signal Si by, for example, but not limited to, a current interrupt program, and provide it to the control unit 10 inside the control module 1 for interpretation and calculation, so that the control unit 10 can know the current parameters Ia, Ib, and Ic. Among them, the obtained angle parameter Pt may differ from the actual angle of the motor 200 at present. This disclosure mainly compensates for this error by means of compensation so that the result calculated by the control unit 10 is close to the actual value (more details will be provided later, and will not be repeated here).

[0028] Among them, the analog-to-digital converters ADC1 and ADC2 are preferably Delta-Sigma analog-to-digital converters (DSADCs) for more precise signal conversion, but are not limited to this. Therefore, the control unit 10 can generate a pulse width modulation signal PWM based on the angle signal St and the current signal Si, and adjust the pulse width modulation signal PWM accordingly (e.g., but not limited to frequency, pulse width, etc.) based on the changes in the angle signal St and the current signal Si. Therefore, the control module can control the drive circuit 300 by providing the pulse width modulation signal PWM, so as to drive the motor 200 to operate and adjust the speed of the motor 200.

[0029] Referring to Figure 1B, which is a schematic diagram of the angle signal conversion method disclosed herein, when the analog-to-digital converter ADC1 completes one full carrier cycle (Time count; TC1), an interrupt event is generated to trigger the angle resolution interrupt routine R-ISR to process the Sin and Cos signals of a single full cycle. After processing, a complete Sin and Cos carrier cycle yields an angle parameter Pt (i.e., a point on the envelope). Due to the limitations of control module 1, the frequency of a full carrier cycle cannot be an integer (e.g., but not limited to, 32*64 / 20M = 102.4us, approximately 9.765kHz). Therefore, the frequency processed by the angle resolution interrupt routine R-ISR cannot be synchronized with or be a multiple of the operating frequency of control unit 10.

[0030] Referring to Figure 1C, this is a timing diagram of the actual operation of the control module disclosed herein. Control module 1 counts multiple first specific cycles TC1 (i.e., one complete carrier cycle), and provides a count value CV that increases over time in each first specific cycle TC1. The first specific cycle TC1 primarily triggers the analog-to-digital converter ADC1 to complete conversion to the output signal during the angle control cycle. At the first time T1-1 to T1-3 after the trigger point of the first specific cycle TC1 (i.e., one complete carrier cycle, for example, but not limited to 9.765kHz), an interrupt event is generated to trigger the angle interrupt routine R-ISR, and the angle parameters Pt1 to Pt3 of the rotor of motor 200 are sampled in the angle interrupt routine R-ISR. Furthermore, control unit 10 also has multiple self-counting second specific cycles TC2. The second specific cycles TC2 primarily trigger the analog-to-digital converter ADC2 to complete conversion to the output signal during the PWM control cycle, and control unit 10 primarily uses the PWM control cycle to periodically adjust the pulse width modulation signal PWM. When the time reaches the second specific period TC2 (e.g., but not limited to 10kHz) trigger point, the second time T2-1 to T2-3 is generated to trigger the current interruption program A-ISR, and the current parameters Ia1 to Ia3, Ib1 to Ib3, and Ic1 to Ic3 are provided to the motor 200 by the current interruption program A-ISR sampling drive circuit 300.

[0031] The angle parameters Pt1~Pt3 and the current parameters Ia1~Ia3, Ib1~Ib3, Ic1~Ic3 cannot be synchronized due to their different sampling frequencies (i.e., 9.765kHz and 10kHz). This is mainly because the frequencies of the angle interruption program R-ISR and the current interruption program A-ISR are not equal or multiples of each other, resulting in an unstable time relationship between the two interrupt programs. Therefore, the angle parameters Pt1~Pt3 obtained at the time points when acquiring the current parameters Ia1~Ia3, Ib1~Ib3, Ic1~Ic3 are actually deviated angles. This will cause the current supplied to the motor 200 (i.e., current parameters Ia, Ib, Ic) to be unable to be accurately controlled or to be unstable. Figures 2A and 2B will be used as illustrative examples below. In the specific scenario shown in Figure 2A, because the frequencies of the angle interruption procedure R-ISR and the current interruption procedure A-ISR are not equal or multiples of each other, the current interruption procedure A-ISR is executed twice during a certain first specific cycle TC1_A. This will result in not only an angle lag problem, but also that during the second second time T2-2 of the first specific cycle TC1_A, the current angle parameter obtained by the control unit 10 is still the angle parameter Pt1 from the first time T1-1, meaning the angle has not been updated. Consequently, the current of the motor 200 will be unable to be accurately controlled or will be unstable.

[0032] To avoid this situation, this disclosure estimates the angular displacement Δθ = ω * Δt by measuring the rotational speed and the time difference between the two points of synchronization. This time difference is obtained using a timestamp TP. Specifically, referring to Figure 1C, a timestamp TP is set at the trigger point of each second specific cycle TC2, and this timestamp TP is saved to a temporary register (not shown) in control module 1 during each current interrupt procedure A-ISR for reference. Therefore, although the first specific cycle TC1 and the second specific cycle TC2 are not identical (i.e., 9.765 kHz and 10 kHz) and cannot be synchronized, the current angle parameter Pt1' at timestamp TP can be estimated using the time difference Td between the angle parameter Pt1 and the timestamp TP. Thus, the current current parameters Ia2, Ib2, and Ic2, along with the current angle parameter Pt1' at the same time point, can be obtained, providing precise current control.

[0033] In addition, this disclosure provides a judgment mechanism to identify the electrical angle algorithm corresponding to various scenarios. Specifically, since the control module 1, besides sampling the angle and current when the motor 200 is running, may also have other specific interrupt procedures (such as, but not limited to, external communication, data transmission, etc., which can be preset by the control module 1) during the operation of the motor 200. These occasional specific interrupt procedures may happen to be triggered before or after the angle resolution interrupt procedure R-ISR or the current interrupt procedure A-ISR, causing them to overlap with the angle resolution interrupt procedure R-ISR or the current interrupt procedure A-ISR that should have been executed.

[0034] Specifically, in another specific scenario as shown in Figure 2B, when a specific interrupt routine ISR is being processed and it overshadows the current interrupt routine A-ISR and the de-interrupt routine R-ISR that were originally scheduled to execute, the current interrupt routine A-ISR will be delayed. Therefore, after the specific interrupt routine ISR finishes, the overshadowed current interrupt routine A-ISR should then be executed, but because the de-interrupt routine R-ISR has also been generated and is waiting for the specific interrupt routine ISR to finish, it will be delayed.

[0035] Generally, the angle interrupt routine R-ISR has a higher priority than the current interrupt routine A-ISR, and the current interrupt routine A-ISR has a higher priority than other specific interrupt routines (e.g., but not limited to, external communication, data transmission, etc.). Therefore, when the above interrupt routines occur simultaneously, the priority is, in order, angle interrupt routine R-ISR, current interrupt routine A-ISR, and other specific interrupt routines. Conversely, when the above interrupt routines do not occur simultaneously, the one that occurs first is executed first. Therefore, when angle interrupt routine R-ISR and current interrupt routine A-ISR occur simultaneously, control module 1 executes angle interrupt routine R-ISR first, causing current interrupt routine A-ISR to be delayed until after angle interrupt routine R-ISR ends (i.e., it is delayed until the position of A-ISR'). When current interrupt routine A-ISR' is executed, the current angle parameter Pt2' it obtains may be incorrect. That is, the time difference Td between the angle parameter Pt2 and the timestamp TP incorrectly estimates the current angle parameter Pt2' under the timestamp TP. Therefore, referring to the current waveform diagram in Figure 2C, the current angle parameter Pt2' and current parameters Ia2, Ib2, and Ic2 obtained at A-ISR' will cause the current waveform provided by the drive circuit 300 to the motor 200 to be distorted as shown in the dashed box, resulting in unstable control.

[0036] Therefore, this disclosure provides a judgment mechanism to identify the electrical angle algorithm corresponding to various scenarios to avoid the situations shown in Figures 2A-2B. The main judgment mechanism is that the control module 1 determines whether the count value CV corresponding to the second time T2 is greater than the count value corresponding to the timestamp TP of the triggering time of the previous second specific cycle TC2, and performs corresponding control accordingly. Furthermore, this judgment mechanism is mainly based on the control module 1 summarizing five possible scenarios during the operation of the motor 200, which will be described one by one below.

[0037] In Figures 3A-3E, control module 1 can set a first specific flag interval 0 from the end of the second time T2 to the end of the next first time T1, and set a second specific flag interval 1 from the end of the first time T1 to the end of the next second time T2. Therefore, in addition to setting a timestamp TP at the trigger point of each second specific cycle TC2, control module 1 can also start the first specific flag interval 0 according to the timestamp TP. Before control module 1 determines whether the count value CV corresponding to the second time T2 is greater than the count value corresponding to the previous timestamp TP, control module 1 can first determine whether the second time T2 is triggered in the first specific flag interval 0. When control module 1 determines that the second time T2 is triggered in the first specific flag interval 0, it means that the current interrupt program A-ISR is executed twice between the two angle interrupt programs R-ISR. This means that the period from the end of the current interruption procedure A-ISR to the beginning of the corner-breaking interruption procedure R-ISR is the first specific flag interval 0. If the current interruption procedure A-ISR is encountered in the first specific flag interval 0, it will not change to the second specific flag interval 1, but will remain in the first specific flag interval 0. Conversely, the period from the beginning of the corner-breaking interruption procedure R-ISR to the end of the current interruption procedure A-ISR is the second specific flag interval 1. If the corner-breaking interruption procedure R-ISR is encountered in the second specific flag interval 1, it will not change to the first specific flag interval 0, but will remain in the second specific flag interval 1.

[0038] Therefore, by marking specific flag intervals, the control module 1 can accurately determine whether the current angle parameters Pt1' and Pt2' under the timestamp TP are outdated or updated to the wrong point, and can compensate to the correct point to improve the accuracy of angle estimation. Furthermore, because this disclosure uses specific flag interval markings, the control module 1 can primarily compensate for the angle parameter Pt based on the specific flag interval (0 or 1) where the current interrupt procedure A-ISR is located, the timestamp TP, and the timing of the angle resolution interrupt procedure R-ISR, the current interrupt procedure A-ISR, and the specific interrupt procedure ISR, thereby improving the accuracy of angle estimation.

[0039] Figure 3A is a timing diagram of the operation of the motor system disclosed herein under the first scenario, in conjunction with Figures 1A to 2C. Figure 3A shows the most common scenario encountered by the control module 1 during the operation of the motor 200. Each first specific cycle TC1 includes the trigger point of the second specific cycle TC2, and is marked with a timestamp TP. When the control module 1 determines that the count value CV corresponding to the second time T2 is greater than the count value corresponding to the timestamp TP of the trigger point of the previous second specific cycle TC2, the control module 1 calculates the current angle parameter as the previous angle parameter Pt of the second time T2 plus the angle displacement parameter. Furthermore, the angle displacement parameter is the angle displacement amount corresponding to the time difference Td (i.e., the second time difference) between the trigger point of the first specific cycle TC1 where the previous angle parameter Pt is located and the timestamp TP of the same first specific cycle TC1.

[0040] Taking Figure 3A as an example, the current angle parameter obtained at the second time T2-2 is the sum of the previous angle parameter Pt1 and the angle displacement parameter. Furthermore, the two second times T2-1 and T2-2 include a first time T1-1, and the timestamp TP2 is triggered in the second specific flag interval 1, so its current angle parameter Pt1' should lag behind the angle parameter Pt1. Therefore, the angle displacement parameter is the angle displacement amount corresponding to the time difference Td2 between the trigger point TC1_t of the first specific period TC1-2 where the previous angle parameter Pt1 is located and the timestamp TP2 of the same first specific period TC1-2. The angle displacement amount can be obtained by converting the time difference Td2 using Δθ=ω*Δt, and Δt can be obtained by dividing the time difference Td2 by the clock of the control unit 10 itself. Therefore, at the second time T2-2, the current angle parameter Pt1' and the current current parameters Ia2, Ib2, and Ic2 can be obtained. Based on the current angle parameter Pt1' and the current parameters Ia2, Ib2, and Ic2, the pulse width modulation signal PWM provided to the drive circuit 300 is adjusted so as to control the motor 200 through the pulse width modulation signal PWM.

[0041] Figure 3B is a timing diagram of the operation of the motor system disclosed herein in the second scenario, in conjunction with Figures 1A to 3A. In Figure 3B, the control module 1 further determines whether the count value CV is reset during the operation period t0 to t1 of the second time T2. When the count value CV is reset, the control module 1 calculates the current angle parameter as the sum of the previous angle parameter Pt of the second time T2 and the angle displacement parameter. Furthermore, the angle displacement parameter is the angle displacement amount corresponding to the time difference Td between the trigger time of the first specific period TC1 where the previous angle parameter Pt is located and the timestamp TP of the same first specific period TC1.

[0042] Taking Figure 3B as an example, when the count value CV is reset, it signifies the end of the first specific cycle TC1-2. This situation typically occurs because a timestamp TP3 is generated during the execution of a specific interrupt routine (ISR) (i.e., a specific interrupt period). However, because the ISR has not yet completed, the triggering of the second time period T2-3 is delayed until the ISR is finished. Then, when the ISR finishes (i.e., the specific interrupt period ends), the first specific cycle TC1-2 happens to end. Therefore, control module 1 will set the trigger point TC1_t for the first specific cycle TC1-3 within a short period, causing the second time period T2-3 to execute just before the trigger point TC1_t is generated. Thus, as soon as the second time period T2-3 begins, the trigger point TC1_t set by control module 1 can be read immediately (meaning that the count value CV is reset during the operation period t0~t1 of the second time period T2-3), and the first time period T1-3 only begins execution after the second time period T2-3 ends.

[0043] Therefore, the current angle parameter obtained at the second time T2-3 is the sum of the previous angle parameter Pt2 and the angle displacement parameter. Furthermore, the two second times T2-2 and T2-3 include a first time T1-2, and the timestamp TP3 is triggered in the second specific flag interval 1, so the current angle parameter Pt2' should lag behind the angle parameter Pt2. Therefore, the angle displacement parameter is the angle displacement corresponding to the time difference Td2 between the trigger point TC1_t of the first specific period TC1-2 where the previous angle parameter Pt2 is located and the timestamp TP3 of the same first specific period TC1-2. Thus, at the second time T2-3, the current angle parameter Pt2' and the current current parameters Ia3, Ib3, and Ic3 can be obtained, and the pulse width modulation (PWM) signal provided to the drive circuit 300 can be adjusted according to the current angle parameter Pt2' and the current parameters Ia3, Ib3, and Ic3 to control the motor 200.

[0044] Figure 3C is a timing diagram of the operation of the motor system disclosed in this invention under the third scenario, in conjunction with Figures 1A-3B. In Figure 3C, when the control module 1 determines that the count value CV corresponding to the second time T2 is not greater than the count value CV corresponding to the timestamp TP of the triggering time of the previous second specific cycle TC2, the control module 1 calculates the current angle parameter as the previous angle parameter Pt of the second time T2 minus the angle displacement parameter. Furthermore, the angle displacement parameter is the angle displacement amount corresponding to the time difference Td (i.e., the first time difference) between the total time of the previous first specific cycle TC1 and the time difference Td between the triggering time TC1_t of the previous first specific cycle TC1 and the timestamp TP of the triggering time of the previous second specific cycle TC2. It is worth mentioning that in one embodiment, the difference between the first time difference and the second time difference is that the second time difference is the difference between the triggering time TC1_t of the first specific cycle TC1 and the timestamp TP, while the first time difference is exactly the opposite; therefore, they are distinguished as "first" and "second".

[0045] The situation described in Figure 3C typically occurs when, during the execution of a specific interrupt routine (ISR) (i.e., a specific interrupt period), a timestamp TP2 is generated first, followed by the trigger point TC1_t. After the ISR completes (i.e., the specific interrupt period ends), the first time interval T1-2 with higher priority begins execution, causing the second time interval T2-2 to be continuously delayed until the first time interval T1-2 ends. Therefore, the count value CV corresponding to the second time interval T2 is not greater than the count value CV corresponding to the timestamp TP. Thus, the current angle parameter obtained at the second time interval T2-2 is the previous angle parameter Pt2 minus the angle displacement parameter. Furthermore, the two second times T2-1 and T2-2 include two first times T1-1 and T1-2, and the timestamp TP2 is triggered in the second specific flag interval 1, so its current angle parameter Pt2' should logically precede the angle parameter Pt2. Therefore, the angular displacement parameter is the angular displacement corresponding to the total time of the previous first specific cycle TC1-2 and the time difference Td2 between the trigger point TC1_t of the previous first specific cycle TC1-2 and the previous timestamp TP2. Thus, at the second time T2-2, the current angle parameter Pt2' and the current current parameters Ia2, Ib2, and Ic2 can be obtained, and the pulse width modulation signal PWM provided to the drive circuit 300 can be adjusted according to the current angle parameter Pt2' and the current parameters Ia2, Ib2, and Ic2, so as to control the motor 200 through the pulse width modulation signal PWM.

[0046] Figure 3D is the timing diagram of the motor system disclosed in this invention under the fourth scenario, in conjunction with Figures 1A to 3C. The reason for the occurrence of scenario 3D is usually that the second time T2-2 is the position where the analog-to-digital converter ADC1 completes its conversion, at which point the current interrupt procedure A-ISR just generates a trigger event. Due to the processing mechanism of the control unit 10, the trigger point TC1_t of the first specific cycle TC1-2 has not yet been generated within a short period, causing the low-priority second time T2-2 to be inserted and start execution first. If the judgment mechanism of this disclosure is not used, the second time T2-2 at this time will only obtain the old angle parameter Pt1 and the just-reset timestamp TP2 because the electrical angle has not been updated, thus calculating an incorrect electrical angle. Therefore, this disclosure can identify various scenarios by introducing the first specific flag interval 0 and the second specific flag interval 1, plus the angle resolution interrupt procedure R-ISR, the current interrupt procedure A-ISR, the count value CV, and the timestamp TP, and provide corresponding electrical angle algorithms to correct the angle parameter Pt according to each scenario. In this way, the control module 1 can achieve precise control.

[0047] Therefore, taking Figure 3D as an example, when control module 1 determines that the second time T2-2 is triggered in the first specific flag interval 0 and the count value CV is reset, it indicates that the first specific cycle TC1-1 has ended. Therefore, control module 1 calculates the current angle parameter as the angle parameter Pt1 before the second time T2-2 plus the angle displacement parameter. Furthermore, the first time is not included in the two second times T2-1 and T2-2, and the timestamp TP2 is triggered in the first specific flag interval 0, so its current angle parameter Pt1' should lag behind the angle parameter Pt1. Therefore, the angle displacement parameter is the angle displacement corresponding to the total time of the previous specific cycle TC1-1. Thus, in the second time T2-2, the current angle parameter Pt1' and the current current parameters Ia2, Ib2, and Ic2 can be obtained, and the pulse width modulation signal PWM provided to the drive circuit 300 is adjusted according to the current angle parameter Pt1' and the current parameters Ia2, Ib2, and Ic2, so as to control the motor 200 through the pulse width modulation signal PWM.

[0048] Figure 3E is the timing diagram of the motor system disclosed in this invention under the fifth scenario, in conjunction with Figures 1A-3D. In Figure 3E, control module 1 also determines that the second time T2 is triggered in the first specific flag interval 0, which means that the current interruption procedure A-ISR is executed twice between the two angle interruption procedures R-ISR. However, the difference between Figure 3E and Figure 3D is that when the count value CV in Figure 3E is not reset, it means that the first specific cycle TC1-1 has not yet ended. Therefore, control module 1 does not need to use the total time of the previous specific cycle TC1-1 to calculate the current angle parameter. Therefore, when control module 1 determines that the second time T2-2 is triggered in the first specific flag interval 0 and the count value CV has not been reset, control module 1 calculates the current angle parameter as the previous angle parameter Pt1 of the second time T2-2 plus the angle displacement parameter. Furthermore, the first time is not included in the two second times T2-1 and T2-2, and the timestamp TP2 is triggered in the first specific flag interval 0, so its current angle parameter Pt1' should lag behind the angle parameter Pt1. Therefore, the angle displacement parameter is the angle displacement corresponding to the time difference Td1 between the trigger time TC1_t of the first specific period TC1-1 in which the previous angle parameter Pt1 is located and the timestamp TP2 of the same first specific period TC1-1. Thus, in the second time T2-2, the current angle parameter Pt1' and the current current parameters Ia2, Ib2, and Ic2 can be obtained, and the pulse width modulation signal PWM provided to the drive circuit 300 can be adjusted according to the current angle parameter Pt1' and the current parameters Ia2, Ib2, and Ic2, so as to control the motor 200 through the pulse width modulation signal PWM.

[0049] Please refer to Figure 4A, which is a schematic diagram of the interrupt program pushover situation disclosed herein, and also refer to Figures 1-3E. Figure 4A mainly describes the situation arising from the control module 1 inserting a specific interrupt event (i.e., a specific interrupt ISR), causing the corner interrupt program R-ISR and the current interrupt program A-ISR to pushover during a specific interrupt period. Furthermore, the corner interrupt program R-ISR or the current interrupt program A-ISR is triggered only after the specific interrupt period ends, resulting in a situation where the corner interrupt program R-ISR and the current interrupt program A-ISR largely overlap. One such situation is that when the corner interrupt program R-ISR and the current interrupt program A-ISR nearly overlap, the control module 1 must wait for the analog-to-digital converter ADC1 to convert before generating the corner interrupt program R-ISR. However, during this process, the current interrupt program A-ISR is set and triggered slightly faster than the corner interrupt program R-ISR. Therefore, a specific interrupt ISR is slightly pushed to the current interrupt routine A-ISR, and the current interrupt routine A-ISR in turn pushes to the cornering interrupt routine R-ISR (as shown in the dashed box). On the other hand, the situation where the cornering interrupt routine R-ISR pushes to the current interrupt routine A-ISR is similar, and will not be described in detail here.

[0050] The aforementioned pushing situation mainly occurs in the second scenario shown in Figure 3B and the fourth scenario shown in Figure 3D. The main reason is that when control module 1 inserts a specific interrupt event (i.e., a specific interrupt ISR), the decoupling interrupt procedure R-ISR and the current interrupt procedure A-ISR largely overlap. However, control module 1 can prevent the above-mentioned pushing situation from occurring by configuring the specific interrupt ISR. Therefore, based on Figures 3A to 3E, the following flowcharts of the timestamp compensation methods for the two different motor control devices shown in Figures 4B and 4C can be summarized.

[0051] Specifically, in Figure 4B, control module 1 can prevent the pushing situation described in Figure 4A from occurring by configuring a specific interrupt ISR, thus eliminating the scenarios in Figures 3B and 3D. Therefore, the process in Figure 4B includes the second time being triggered (S100). When the second time T2 is triggered, it means that control module 1 wants to obtain the angle parameter Pt and current parameters Ia, Ib, and Ic at the previous timestamp TP. Therefore, step (S200) is entered to determine whether the count value corresponding to the second time is greater than the count value corresponding to the previous timestamp. When the determination result of step (S200) is "yes", the operation mode corresponding to Figures 3A and 3E is executed. That is, the current angle parameter is calculated as the previous angle parameter of the second time plus the angle displacement parameter (S400). Furthermore, the angle displacement parameter is the angle displacement amount corresponding to the time difference Td between the trigger time of the first specific period TC1 where the previous angle parameter Pt is located and the timestamp TP of the same first specific period TC1.

[0052] Conversely, if the judgment result of step (S200) is "no", then the operation method in Figure 3C applies. That is, the current angle parameter is calculated as the previous angle parameter of the second time minus the angle displacement parameter (S420). Furthermore, the angle displacement parameter is the angle displacement amount corresponding to the time difference Td between the total time of the previous first specific period TC1 and the timestamp TP between the trigger time point TC1_t of the previous first specific period TC1 and the trigger time point TC2 of the previous second specific period.

[0053] On the other hand, in Figure 4C, the pushing situation described in Figure 4A may occur if the control module 1 is not configured with a specific interrupt ISR. Therefore, Figure 4C summarizes the flow of the five scenarios in Figures 3A to 3E, including triggering the second time (S100). Then, it is determined whether the second time is triggered within the first specific flag interval (S120). When the determination result of step (S120) is "yes", it means that the current interrupt program A-ISR is executed twice between the two angle interrupt programs R-ISR. Therefore, step (S140) is entered to determine whether the count value is reset during the operation period of the second time. When the determination result of step (S140) is "yes", it corresponds to the operation mode in Figure 3D. That is, the current angle parameter is calculated as the previous angle parameter of the second time plus the angle displacement parameter (S440). And, the angle displacement parameter is the angle displacement amount corresponding to the total time of the previous specific cycle TC1-1. Conversely, if the judgment result of step (S140) is "no", then the operation method in Figure 3E applies. That is, the current angle parameter is calculated by adding the previous angle parameter at the second time to the angle displacement parameter (S400). The specific details are described in Figure 4B and will not be repeated here.

[0054] On the other hand, when the judgment result of step (S120) is "No", it means that the current interruption procedure A-ISR is executed only once between the two interruption procedures R-ISR. Therefore, step (S200) is entered to determine whether the count value corresponding to the second time is greater than the count value corresponding to the previous timestamp. When the judgment result of step (S200) is "Yes", step (S400) is entered according to the operation mode of Figure 3A. Conversely, when the judgment result of step (S200) is "No", step (S160) is entered to determine whether the count value is reset during the operation period of the second time. When the judgment result of step (S160) is "Yes", step (S400) is entered according to the operation mode of Figure 3B. Conversely, when the judgment result of step (S160) is "No", step (S420) is entered according to the operation mode of Figure 3C, the specific content of which has been described in Figure 4B and will not be repeated here.

[0055] However, the above description is only a detailed description and accompanying drawings of preferred embodiments of the present invention, but the features of the present invention are not limited thereto and are not intended to limit the present invention. The scope of the present invention should be determined by the claims. All embodiments that conform to the spirit of the claims of the present invention and similar variations thereof should be included in the scope of the present invention. Any variations or modifications that can be easily conceived by those skilled in the art within the field of the present invention can be covered by the scope of the claims of this application.

Claims

1. A motor control device, characterized in that, A device for controlling a drive circuit to drive a motor, wherein the motor control device includes: A control module counts multiple first specific cycles and multiple second specific cycles, and provides a count value that increases over time in each first specific cycle, wherein the control module sets a specific flag interval; An angle sensing device is used to sample an angle parameter of the motor according to an angle interruption procedure at a first time in each first specific cycle; A current sensing device is used to sample a current parameter provided by the drive circuit according to a current interruption procedure at a second time in each second specific cycle, and the control module sets a timestamp at the trigger point of each second specific cycle to start the specific flag interval accordingly; and The control module compensates for the angle parameter based on the specific flag interval where the current interruption procedure is located, the timestamp, and the timing of the angle interruption procedure, the current interruption procedure, and a specific interruption procedure.

2. The motor control device according to claim 1, characterized in that, The control module determines whether the count value corresponding to the second time is greater than the count value corresponding to the timestamp of the trigger point of the previous second specific cycle. When the determination result is no, the control module calculates a current angle parameter of the motor as the previous angle parameter of the second time minus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a total time of the previous first specific cycle and a first time difference between the trigger point of the previous first specific cycle and the previous timestamp.

3. The motor control device according to claim 1, characterized in that, When the judgment result is yes, the control module calculates a current angle parameter as the previous angle parameter of the second time plus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a second time difference between the trigger time point of the first specific period in which the previous angle parameter is located and the timestamp of the same first specific period.

4. The motor control device according to claim 1, characterized in that, When the judgment result is negative, the control module further determines whether the count value is reset during the operation period of the second time. When the count value is reset, the control module calculates a current angle parameter as the previous angle parameter of the second time plus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a second time difference between the trigger time point of the first specific cycle in which the previous angle parameter is located and the timestamp of the same first specific cycle.

5. The motor control device according to claim 1, characterized in that, The control module sets the specific flag interval from the end of the second time to the end of the next first time. Before the control module determines whether the count value corresponding to the second time is greater than the count value corresponding to the previous timestamp, the control module determines that the second time is triggered in the specific flag interval and the count value is reset. The control module calculates a current angle parameter as the previous angle parameter of the second time plus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a total time of the previous specific period.

6. The motor control device according to claim 5, characterized in that, When the control module determines that the second time is triggered in the specific flag interval and the count value has not been reset, the control module calculates the current angle parameter as the previous angle parameter of the second time plus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a second time difference between the trigger time point of the first specific period in which the previous angle parameter is located and the timestamp of the same first specific period.

7. The motor control device according to claim 1, characterized in that, At the second time following the timestamp, the control module adjusts a pulse width modulation signal provided to the drive circuit based on a current angle parameter and a current parameter, so as to control the motor through the pulse width modulation signal.

8. The motor control device according to claim 1, characterized in that, When the control module determines that the desired time point for providing the first time or the second time is within a specific interruption period, the control module will provide the first time or the second time after the specific interruption period ends.

9. The motor control device according to claim 1, characterized in that, The plurality of first specific periods are not entirely the same as the plurality of second specific periods.

10. The motor control device according to claim 1, characterized in that, The angle sensing device is a deflector, and the deflector shaft is connected to a rotating shaft of the motor to sample the angle parameter and provide an angle signal.

11. A timestamp compensation method for a motor control device, characterized in that, The motor control device is used to control a drive circuit to drive a motor to operate, and the motor control device includes an angle sensing device and a current sensing device. The timestamp compensation method includes the following steps: Count multiple first specific periods and multiple second specific periods, and provide a count value that increases over time in each first specific period, and set a specific flag interval; At a first moment in each first specific cycle, the angle sensing device is controlled to sample an angle parameter of the motor according to an angle interruption procedure; At a second time in each second specific cycle, the current sensing device samples a current parameter provided by the drive circuit according to a current interruption procedure, and sets a timestamp at the trigger point of each second specific cycle to start the specific flag interval. and The angle parameter is compensated based on the specific flag interval in which the current interrupt procedure is located, the timestamp, and the timing of the angle interrupt procedure, the current interrupt procedure, and a specific interrupt procedure.

12. The timestamp compensation method according to claim 11, characterized in that, It also includes the following steps: (a) Determine whether the count value corresponding to the second time is greater than the count value corresponding to a timestamp of the trigger time of the previous second specific period; (b1) Determine if step (a) is incorrect; and (c1) Calculate a current angle parameter of the motor as the previous angle parameter of the second time minus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a total time of the previous first specific cycle and a first time difference between the trigger point of the previous first specific cycle and the previous timestamp.

13. The timestamp compensation method according to claim 11, characterized in that, It also includes the following steps: (b2) Determine if step (a) is true; and (c2) Calculate a current angle parameter of the motor as the previous angle parameter of the second time plus an angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a second time difference between the trigger time of the first specific cycle in which the previous angle parameter is located and the timestamp of the same first specific cycle.

14. The timestamp compensation method according to claim 13, characterized in that, The following steps are included after step (b1): (c3) Determine whether the count value was reset during an operation period of the second time; (d1) Determine if step (c3) is true; and (e1) Execute step (c2).

15. The timestamp compensation method according to claim 14, characterized in that, The following steps are included after step (c3): (d2) Determine if step (c3) is incorrect; and (e2) Execute step (c1).

16. The timestamp compensation method according to claim 13, characterized in that, The following steps are included before step (a): (a01) The period from the end of the second time period to the end of the first time period is set as the specific flag interval; (a02) Determine whether the second time interval is triggered within the specific flag interval; and (a03) Determine if step (a02) is true, and execute step (a).

17. The timestamp compensation method according to claim 13, characterized in that, The following steps are included after step (a02): (f1) Determine whether the count value was reset during an operation period of the second time; (g1) Determine if step (f1) is true; and (h1) The current angle parameter is calculated as the previous angle parameter of the second time plus the angle displacement parameter, and the angle displacement parameter is the angle displacement amount corresponding to a total time of the previous specific period.

18. The timestamp compensation method according to claim 17, characterized in that, The following steps are included after step (f1): (g2) Determine if step (f1) is incorrect; and (h2) Perform step (b2).

19. The timestamp compensation method according to claim 11, characterized in that, It also includes the following steps: At the second time after the timestamp is provided, a pulse width modulation signal provided to the drive circuit is adjusted according to a current angle parameter and a current parameter of the motor, so as to control the operation of the motor through the pulse width modulation signal.

20. The timestamp compensation method according to claim 11, characterized in that, It also includes the following steps: (i1) Determine the time point during which the first time or the second time is to be provided is within a specific interruption period; and (i2) Provide the first time or the second time after the specific interruption period ends.

Citation Information

Patent Citations

  • Angle compensation method and system for permanent magnet synchronous motor controller

    CN113179072A

  • Work vehicle with motor, and control method for motor

    JP2016039659A

  • Method and Apparatus for Increased Current Stability in a PWM Drive

    US20100320948A1

  • Rotating electric machine control system

    US20150333671A1

  • Control device of power conversion device

    US20190190423A1