Motor current acquisition method and device

By employing pulse width modulation control in motor current acquisition, the average motor current is periodically acquired and calculated, thus solving the problem of low CPU utilization and achieving efficient utilization of CPU resources as well as accuracy and stability of current acquisition.

CN116879743BActive Publication Date: 2026-06-19BEIJING JINGWEI HIRAIN TECH CO INC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING JINGWEI HIRAIN TECH CO INC
Filing Date
2023-07-18
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

The existing motor current acquisition method results in low CPU utilization, mainly due to the excessive CPU resource consumption of the ADC continuous acquisition method.

Method used

The pulse width modulation control method is adopted to periodically collect the motor current value and calculate the average value of n current values. The length of the collection period is greater than the motor drive period, and the product of the collection period and n is less than or equal to the maximum current collection delay time.

Benefits of technology

By extending the current acquisition time, the CPU time occupied by the ADC acquisition is reduced, the CPU utilization is improved, and the accuracy and stability of current acquisition are maintained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116879743B_ABST
    Figure CN116879743B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for acquiring motor current. The method includes: periodically acquiring the current value of the motor, with each acquisition cycle used to acquire one current value of the motor; and, when n current values ​​are acquired, calculating the average of the n current values ​​to obtain the average current of the motor; wherein the length of the acquisition cycle is greater than the length of the motor's drive cycle, n is an integer greater than 1, and the product of the length of the acquisition cycle and n is less than or equal to the maximum current acquisition delay time. This application can improve CPU utilization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of electronic technology, and in particular relates to a method and device for collecting motor current. Background Technology

[0002] With the development of automotive electronics, body control systems are becoming increasingly common. Most existing body control systems drive corresponding motor loads, such as window motors, sunroof motors, tailgate motors, side door motors, and various lock motors. Due to the need for functions such as speed control, anti-pinch protection, thermal protection, and diagnostics, current acquisition of these motor loads is crucial.

[0003] Currently, motor current is acquired using a continuous analog-to-digital converter (ADC). This ADC acquisition method is relatively simple to process in software and provides accurate motor current readings, which can meet the functional requirements of motor development.

[0004] However, because continuous ADC acquisition performs ADC conversions at the highest speed currently configured, it excessively consumes the Central Processing Unit (CPU). Taking the existing NXP MCU-S32k146 as an example, with a 2 MHz clock source and a 12-bit ADC for continuous acquisition, the ADC completes a conversion approximately every 200 microseconds (µs). This means that there will be an interrupt caused by the completion of an ADC conversion approximately every 200µs. The data processing in the interrupt after each ADC conversion takes nearly 40µs. In other words, after starting to acquire the current of a certain motor, the CPU needs to spend about one-fifth (40µs / 200µs) of its time processing the ADC of that motor, resulting in excessive CPU consumption and low CPU utilization. Summary of the Invention

[0005] This application provides a method and apparatus for acquiring motor current, which can solve the problem of low CPU utilization caused by existing current acquisition methods.

[0006] In a first aspect, embodiments of this application provide a method for acquiring motor current, wherein the motor is driven by pulse width modulation control, and the method includes:

[0007] The current value of the motor is periodically collected, with each collection cycle used to collect one current value of the motor;

[0008] If n current values ​​are collected, the average value of the n current values ​​is calculated to obtain the average current value of the motor.

[0009] Wherein, the length of the acquisition period is greater than the length of the motor drive period, n is an integer greater than 1, and the product of the length of the acquisition period and n is less than or equal to the maximum current acquisition delay time.

[0010] Secondly, embodiments of this application provide a motor current acquisition device, wherein the motor is driven by pulse width modulation control, and the device includes:

[0011] The acquisition module is used to periodically acquire the current value of the motor, and each acquisition cycle is used to acquire one current value of the motor;

[0012] The calculation module is used to calculate the average value of the n current values ​​collected to obtain the average current value of the motor.

[0013] Wherein, the length of the acquisition period is greater than the length of the motor drive period, n is an integer greater than 1, and the product of the length of the acquisition period and n is less than or equal to the maximum current acquisition delay time.

[0014] Thirdly, embodiments of this application provide a motor current acquisition device, the device including: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the motor current acquisition method as described in the first aspect.

[0015] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the motor current acquisition method as described in the first aspect.

[0016] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the motor current acquisition method as described in the first aspect.

[0017] In this embodiment, since the motor is driven by PWM control, the motor current has periodic characteristics. Based on this, the motor current value can be periodically acquired, and the average of the n acquired current values ​​can be calculated to obtain an average current value, completing one ADC conversion. Each acquisition cycle acquires one current value from the motor, and the length of the acquisition cycle is greater than the length of the motor's drive cycle. n is an integer greater than 1, and the product of the acquisition cycle length and n is less than or equal to the maximum current acquisition delay time. In this way, while ensuring the acquisition time of the n current values ​​meets the maximum current acquisition delay time, the acquisition of the n current values ​​can be distributed across multiple drive cycles, extending the acquisition time of the n current values ​​and thus extending the ADC conversion time. This reduces the CPU time occupied by ADC acquisition and improves CPU utilization. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the motor drive provided in an embodiment of this application;

[0020] Figure 2 This is a schematic diagram of the motor current provided in an embodiment of this application;

[0021] Figure 3 This is a flowchart of the motor current acquisition method provided in the embodiments of this application;

[0022] Figure 4 This is one of the schematic diagrams of current acquisition results provided in the embodiments of this application;

[0023] Figure 5 This is a second schematic diagram of the current acquisition results provided in the embodiments of this application;

[0024] Figure 6 This is the third schematic diagram of the current acquisition results provided in the embodiments of this application;

[0025] Figure 7 This is the fourth schematic diagram of the current acquisition results provided in the embodiments of this application;

[0026] Figure 8 This is the fifth schematic diagram of the current acquisition results provided in the embodiments of this application;

[0027] Figure 9 This is the sixth schematic diagram of the current acquisition results provided in the embodiments of this application;

[0028] Figure 10 This is the seventh schematic diagram of the current acquisition results provided in the embodiments of this application;

[0029] Figure 11 This is the eighth schematic diagram of the current acquisition results provided in the embodiments of this application;

[0030] Figure 12 This is the ninth schematic diagram of the current acquisition results provided in the embodiments of this application;

[0031] Figure 13 This is the tenth schematic diagram of the current acquisition results provided in the embodiments of this application;

[0032] Figure 14 This is a structural diagram of the motor current acquisition device provided in the embodiments of this application;

[0033] Figure 15 This is a structural diagram of the motor current acquisition device provided in the embodiments of this application. Detailed Implementation

[0034] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0035] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0036] The motor current acquisition method of this application embodiment can be applied to vehicles, and further, to the vehicle body controller. In one optional implementation, it can be run by embedded software of a chip in the body controller, and the chip can be a microcontroller or a system-on-a-chip (SoC) chip, etc.

[0037] In this embodiment, the motor can be a window motor, sunroof motor, tailgate motor, side door motor, various lock motors, etc. The motor is driven by Pulse Width Modulation (PWM) control. With this driving method, the motor current exhibits a certain periodicity following the characteristics of the driving voltage. For ease of understanding, please refer to [link to relevant documentation]. Figure 1 ,exist Figure 1 In this context, PWM is neither 0 nor 100%.

[0038] For currents with periodic characteristics, the most direct way to obtain the average current is to sample the current at multiple points within one period, such as sampling... Figure 2 The results are then summed and averaged. However, for most motor drive frequencies, the time of one drive cycle is generally 50-100us, while the time to complete one ADC conversion is generally on the order of 100us. Therefore, it is not feasible to collect enough points in one cycle for averaging.

[0039] Based on this, the present application proposes a new method for acquiring motor current, which can transform the method of averaging current at multiple points within one cycle into the method of averaging current at multiple points within multiple cycles based on the current cycle characteristics. In other words, the work of acquiring multiple points within one cycle is distributed and completed within multiple cycles.

[0040] The motor current acquisition method provided in this application will be described in detail below with reference to the accompanying drawings, through some embodiments and application scenarios.

[0041] See Figure 3 , Figure 3 This is a flowchart of the motor current acquisition method provided in the embodiments of this application.

[0042] like Figure 3 As shown, the motor current acquisition method may include the following steps:

[0043] Step 301: Periodically collect the current value of the motor. Each collection cycle is used to collect one current value of the motor.

[0044] Step 302: After collecting n current values, calculate the average value of the n current values ​​to obtain the average current value of the motor.

[0045] In this embodiment, an ADC conversion is performed after every n current values ​​are collected, and the average of the n current values ​​is calculated to obtain an average current value of the motor. Steps 301 and 302 are illustrated using a single ADC conversion as an example. In practical applications, multiple ADC conversions can be achieved by repeating steps 301 and 302.

[0046] In practice, the n current values ​​required to complete one ADC conversion can be acquired using a periodic acquisition method, acquiring one current value in each acquisition cycle.

[0047] In this embodiment, the length of the acquisition cycle is greater than the length of the motor drive cycle. In this way, the acquisition of the n current values ​​required to complete one ADC conversion can be distributed across multiple drive cycles. This extends the acquisition time of the n current values, thereby extending the ADC conversion time. This reduces the CPU time occupied by ADC acquisition and improves CPU utilization.

[0048] n is an integer greater than 1, which can be preset or calculated based on the length of the acquisition period. Understandably, the larger n is, the more accurate the average current value of the motor will be, but the greater the delay in acquiring the average current value.

[0049] To ensure that the acquisition of the average current meets the functional requirements of the motor, this application introduces a maximum current acquisition delay time. The maximum current acquisition delay time characterizes how often the system needs to acquire the average current for calculations related to motor speed control, anti-pinch functions, etc., thus meeting the motor's functional requirements. The maximum current acquisition delay time can be preset according to the motor's functional requirements, such as 10 milliseconds (ms) or 20 ms.

[0050] The length of the acquisition period and n must satisfy the following condition: the product of the acquisition period length and n is less than or equal to the maximum current acquisition delay time. This ensures that the average current value of the motor meets the motor's functional requirements, thereby improving the effectiveness of the average current acquisition.

[0051] It is understood that, in the embodiments of this application, any combination of the length of the acquisition period and n that satisfies the first condition can be used to obtain the average current of the motor. The first condition includes:

[0052] The length of the acquisition cycle is greater than the length of the motor drive cycle;

[0053] n is an integer greater than 1;

[0054] The product of the length of the acquisition period and n is less than or equal to the maximum delay time of current acquisition.

[0055] In some embodiments, the periodic acquisition of current values ​​can be achieved through a timer. The timer duration can be the length of the acquisition period. Each time the timer expires, a current value can be acquired, and the timer can be reset.

[0056] The motor current acquisition method in this embodiment utilizes PWM control of the motor, resulting in a periodic current characteristic. Based on this, the motor current value can be periodically acquired, and the average of the n acquired current values ​​is calculated to obtain a single average current value, completing one ADC conversion. Each acquisition cycle acquires one current value from the motor, and the length of the acquisition cycle is greater than the length of the motor's drive cycle. n is an integer greater than 1, and the product of the acquisition cycle length and n is less than or equal to the maximum current acquisition delay time. This allows the acquisition of n current values ​​to be distributed across multiple drive cycles, extending the acquisition time of the n current values ​​and consequently extending the ADC conversion time. This reduces the CPU time occupied by ADC acquisition and improves CPU utilization.

[0057] In some embodiments, before periodically acquiring the current value of the motor, the method may further include:

[0058] The length of the acquisition period and n are determined by the first formula (1), which is:

[0059] n×T s ≤t delay ≤(n+1)×T s (1)

[0060] Among them, T s It is the length of the acquisition period, t delay It is the maximum delay time for current acquisition.

[0061] In this embodiment, the relationship between the length of the acquisition period and n must satisfy:

[0062] The product of the acquisition period length and n is less than or equal to the maximum current acquisition delay time;

[0063] The product of the length of the acquisition period and (n+1) is greater than or equal to the maximum delay time of current acquisition.

[0064] In this way, the maximum value of n that satisfies the first condition can be obtained, which can enrich the current values ​​collected for calculating the average current, thereby improving the accuracy of obtaining the average current.

[0065] As can be seen from the foregoing, T s >T dIn some embodiments, T s For T d Integer multiples of T. In this embodiment, since T s For T d Integer multiples of the current value will result in the acquisition of the same current value at different driving cycles, leading to a single sampled current value. Therefore, to enrich the sampled current values, in some embodiments, before periodically acquiring the motor's current value, the method may further include:

[0066] The length of the acquisition cycle is determined by the target formula, which includes a second formula, and the second formula (2) is:

[0067] T s %T d ≠0 (2)

[0068] Among them, T s T is the length of the acquisition period. d % is the length of the motor's drive cycle, and % is the modulo operator, which can also be represented as mod.

[0069] In this embodiment, T s %T d ≠0, indicating T s Divide by T d The remainder is not equal to 0, that is, T s Not for T d Integer multiples of.

[0070] In this way, the acquisition period has a certain offset from the driving period, which allows the acquired current value to be the current value at different points in the driving period. This enriches the sampled current value and improves the accuracy and stability of the current average value acquisition.

[0071] Furthermore, in some embodiments, the target formula may further include a third formula, wherein the third formula (3) is:

[0072] (n×T s )%T d =0 (3)

[0073] In this embodiment, (n×T) s )%T d =0, indicating (n×T) s Divide by T d The remainder is 0, that is, (n×T) s ) is T d Integer multiples of.

[0074] For ease of understanding, the following example is provided:

[0075] Assuming driving period T d The sampling period is 2010us, n is 10, and the sampling value is 100us. Therefore, the sampling points for the current values ​​are: 0, 2010us, 4020us, 6030us, 8040us, 10050us, 12060us, 14070us, 16080us, 18090us, 20100us…

[0076] Because the motor's drive PWM is periodic, the current also exhibits periodicity. Therefore, the current at 2010µs is the same as the current at 10µs, the current at 4020µs is the same as the current at 20µs, and so on... the current at 18090µs is the same as the current at 90µs, the current at 20100µs is the same as the current at 0µs, and so on. Calculating the average of the first 10 collected current values ​​is equivalent to averaging the current at time T... d The average current was calculated for one 100µs cycle, and so on.

[0077] This allows the acquisition of the n current values ​​required to complete one ADC conversion to be distributed across different points in different drive cycles, which can further improve the current values ​​obtained from rich sampling, thereby improving the accuracy and stability of the current average value acquisition.

[0078] In some embodiments, the current value is acquired by a target chip, and before periodically acquiring the current value of the motor, the method may further include:

[0079] Based on the characteristic information of the target chip and the clock source, determine the minimum value of the acquisition cycle length.

[0080] In this embodiment, T is further defined. s The minimum value of T. s The minimum value of T is determined by the characteristic information of the target chip and the clock source. In other words, for different target chips, T s The minimum value can be different. The characteristic information of the target chip can include the target chip's model, version number, etc.

[0081] Using the above method, the characteristic information of the target chip and the clock source are used to determine T. s The minimum value of T is obtained, thus allowing a given T to be determined. s This satisfies the operating requirements of the target chip, thereby improving the reliability of current acquisition.

[0082] In this embodiment, the motor's operating state can include a driven state and a non-driven state. In the driven state, the motor can be driven using PWM control, and the current value is periodic. In the non-driven state, the motor is not driven, and the current value is generally 0.

[0083] In some embodiments, the length of the current acquisition period can be independent of the motor's operating state. That is, the length of the current acquisition period is constant regardless of the motor's operating state, which simplifies the current acquisition logic.

[0084] However, in practical applications, the controller does not drive the motor most of the time. At this time, the motor has no driving current, and the collected current is generally used for circuit diagnostics. Therefore, current sampling does not need to be so frequent. In this case, continuing to use the same sampling cycle as during driving will result in low CPU utilization. Based on this, in some embodiments, before periodically sampling the motor current value, the method further includes:

[0085] Determine the operating state of the motor, which is either a driving state or a non-driving state;

[0086] Based on the operating status, determine the target length of the acquisition cycle;

[0087] Wherein, when the motor is in a driving state, the target length is a first length, and when the motor is in a non-driving state, the target length is a second length, and the second length is greater than the first length;

[0088] The periodic acquisition of the motor's current value includes:

[0089] The current value of the motor is periodically collected, with the target length as one collection cycle.

[0090] In this embodiment, the length of the current value acquisition period is related to the motor's operating state; that is, the length of the acquisition period when the motor is in driving mode is different from the length of the acquisition period when the motor is not in driving mode. Furthermore, the length of the acquisition period when the motor is not in driving mode can be longer than the length of the acquisition period when the motor is in driving mode. This can further improve CPU utilization.

[0091] In some embodiments, the determination of the second length may depend on the determination of the first length. In this embodiment, the first length can be determined in the manner described above, and the second length can be obtained by adding a preset value to the first length.

[0092] In other embodiments, determining the target length of the acquisition period based on the operating state includes:

[0093] Based on the operating status, determine the maximum delay time for current acquisition;

[0094] The target length of the acquisition period is determined based on the maximum delay time of the current acquisition.

[0095] Wherein, the maximum delay time for current acquisition in the non-driving state of the motor is greater than the maximum delay time for current acquisition in the driving state.

[0096] In this embodiment, a maximum current acquisition delay time can be preset for different operating states of the motor. Then, the length of the acquisition cycle for each operating state can be obtained by using the maximum current acquisition delay time for each operating state.

[0097] In practice, the maximum current acquisition delay time set for the non-driving state can be greater than the maximum current acquisition delay time set for the driving state. This allows the determined second length to be greater than the first length.

[0098] The above method allows for flexible setting of the first and second lengths, thereby improving CPU utilization.

[0099] In some embodiments, when the motor is in a driving state, the periodic acquisition of the motor's current value includes:

[0100] The n current values ​​are collected during at least two drive cycles of the motor.

[0101] In this embodiment, the n current values ​​required to complete one ADC conversion are distributed across multiple drive cycles of the motor for acquisition. This extends the ADC conversion time and improves CPU utilization.

[0102] Furthermore, the step of collecting the n current values ​​during at least two drive cycles of the motor may include:

[0103] In each driving cycle, a current value is collected; or,

[0104] A current value is collected every two drive cycles.

[0105] For easier understanding, please refer to [link / reference]. Figure 2 .

[0106] In some alternative implementations, it is possible to, for example Figure 2 As shown in the "diamond" shape, the current value of one point is collected in each driving cycle.

[0107] In some alternative implementations, it is possible to, for example... Figure 2 As shown in the "fork" shape, the current value of one point is collected every two drive cycles.

[0108] It should be noted that the various optional implementation methods described in the embodiments of this application can be combined with each other or implemented individually without conflict, and the embodiments of this application do not limit this.

[0109] The motor current acquisition method provided in this application embodiment, compared with the existing continuous acquisition method of ADC, can significantly reduce the CPU usage of current acquisition through reasonable timed acquisition; at the same time, the validity of the acquired current value itself is equally reliable, and its stability is even better.

[0110] The following verification results are based on a driving frequency of 20kHz (T) d =50us), with the same power supply voltage and the same motor load, n=10, the current acquisition results obtained under different acquisition modes.

[0111] one, Figure 4 These are current acquisition results obtained using different acquisition methods under the condition of 20% duty cycle drive and keeping the load environment consistent. Figure 5 These are current acquisition results obtained using different acquisition methods under the condition of 50% duty cycle drive and keeping the load environment consistent. Figure 6 These are current acquisition results obtained using different acquisition methods under the condition of 80% duty cycle drive and keeping the load environment consistent. Figures 4 to 6 In the graph, the vertical axis represents the acquired Ad value (which is converted to the current value through a fixed conversion relationship), and the horizontal axis represents the time axis. From top to bottom and from left to right, the graphs show data for 1000µs periodic acquisition, 1010µs periodic acquisition, 1020µs periodic acquisition, and continuous acquisition (200µs).

[0112] like Figures 4 to 6 As shown, after the current stabilizes, the current acquisition results of different acquisition methods are all around 2160±10, and there is no significant difference in overall accuracy and curve changes.

[0113] As can be seen, under the driving conditions of 20%, 50%, and 80% duty cycle, the overall results of continuous acquisition, 1000us period acquisition, 1010us period acquisition, and 1020us period acquisition are basically consistent, indicating that the periodic acquisition method can also achieve the accuracy and real-time performance of continuous acquisition.

[0114] two, Figure 7 These are current acquisition results obtained using different acquisition methods under the condition of 20% duty cycle drive and keeping the load environment consistent. Figure 8 These are current acquisition results obtained using different acquisition methods under the condition of 50% duty cycle drive and keeping the load environment consistent. Figure 9These are current acquisition results obtained using different acquisition methods under the condition of 80% duty cycle drive and keeping the load environment consistent. Figures 7 to 9 In the graph, the vertical axis represents the acquired Ad value (which is converted to the current value through a fixed conversion relationship), and the horizontal axis represents the time axis. From top to bottom and from left to right, the graphs show data for 1000µs periodic acquisition, 1010µs periodic acquisition, 1020µs periodic acquisition, and continuous acquisition (200µs).

[0115] like Figures 4 to 6 As shown in the curve fluctuations, the results of periodic acquisition are significantly less volatile than those of continuous acquisition. Furthermore, the stability of the results acquired at 1010µs and 1020µs is significantly better than that of the results acquired at 1000µs.

[0116] It is evident that the results of periodic acquisition are more stable than those of continuous acquisition.

[0117] III. Comparison of periodic data collection for those that meet the condition ((n*Ts)%Td=0 and Ts%Td!=0) and those that do not meet the condition ((n*Ts)%Td=0 and Ts%Td!=0).

[0118] Overall, the results from both approaches are not significantly different. Figure 10 and Figure 11 The current data were collected 10 times each at 1000µs and 1010µs cycles under the same duty cycle and load conditions. Overall, the Ad values ​​collected by both methods were between 2150 and 2200, with little difference.

[0119] However, in terms of the stability of the mean results, the results collected with a period of 1010us that meet the condition ((n*Ts)%Td=0 and Ts%Td!=0) are significantly better than the results collected with a period of 1000us. Figure 12 and Figure 13 As shown, the fluctuation range of the data graph collected at 1000us is significantly greater than that of the data graph collected at 1010us.

[0120] IV. Table 1 shows the mean and variance of the results collected over a 1000µs period, and Table 2 shows the mean and variance (STD) of the results collected over a 1010µs period.

[0121] Table 1: Mean and variance of data collected over a 1000µs period

[0122]

[0123] Table 2: Mean and variance of data collected over a 1010µs period

[0124]

[0125] The data in Tables 1 and 2 clearly show that the results of the 1010us period acquisition are much more stable than those of the 1000us period acquisition. The variance of the data acquired at 1000us is mostly between 1.9 and 3.2, while the variance of the data acquired at 1010us is between 1.6 and 2.4.

[0126] In summary, the periodic acquisition based on the embodiments of this application can greatly reduce CPU load. Using the continuous acquisition scheme, ADC acquisition occupies up to 20% of the CPU. If a 1010us periodic acquisition is used, the CPU occupancy of ADC acquisition can be less than 5% (40us / 1010us), and the data stability will be better.

[0127] In addition, when the motor load is not driven, the timer can be set to a longer duration, since there is normally no current at this time. Current acquisition is mainly used for circuit diagnosis, and the real-time requirements are much smaller than those for speed control and anti-pinch functions during driving. This can further reduce the overall CPU usage.

[0128] Based on the motor current acquisition method provided in the above embodiments, this application also provides specific implementation methods for the motor current acquisition device. Please refer to the following embodiments.

[0129] See Figure 14 The motor current acquisition device provided in this application embodiment may include:

[0130] The acquisition module 1401 is used to periodically acquire the current value of the motor, and each acquisition cycle is used to acquire one current value of the motor;

[0131] The calculation module 1402 is used to calculate the average value of the n current values ​​when n current values ​​are collected, so as to obtain the average current value of the motor.

[0132] Wherein, the length of the acquisition period is greater than the length of the motor drive period, n is an integer greater than 1, and the product of the length of the acquisition period and n is less than or equal to the maximum current acquisition delay time.

[0133] In some embodiments, the apparatus further includes:

[0134] The first determining module is used to determine the length of the acquisition period and n using a first formula, wherein the first formula is:

[0135] n×T s ≤t delay ≤(n+1)×T s

[0136] Among them, T s It is the length of the acquisition period, t delay It is the maximum delay time for current acquisition.

[0137] In some embodiments, the apparatus further includes:

[0138] The second determining module is used to determine the length of the acquisition period through a target formula, wherein the target formula includes a second formula, which is:

[0139] T s %T d ≠0

[0140] Among them, T s T is the length of the acquisition period. d is the length of the motor's drive cycle, and % is the modulo operator.

[0141] In some embodiments, the target formula further includes a third formula, which is:

[0142] (n×T s )%T d =0

[0143] In some embodiments, the apparatus further includes:

[0144] The third determining module is used to determine the minimum value of the acquisition cycle length based on the characteristic information of the target chip and the clock source.

[0145] In some embodiments, the apparatus further includes:

[0146] The fourth determining module is used to determine the operating state of the motor, wherein the operating state is a driving state or a non-driving state;

[0147] The fifth determining module is used to determine the target length of the acquisition cycle based on the operating status;

[0148] Wherein, when the motor is in a driving state, the target length is a first length, and when the motor is in a non-driving state, the target length is a second length, and the second length is greater than the first length;

[0149] The periodic acquisition of the motor's current value includes:

[0150] The current value of the motor is periodically collected, with the target length as one collection cycle.

[0151] In some embodiments, the fifth determining module includes:

[0152] The first determining unit is used to determine the maximum delay time of current acquisition based on the operating state.

[0153] The second determining unit is used to determine the target length of the acquisition period based on the maximum delay time of the current acquisition;

[0154] Wherein, the maximum delay time for current acquisition in the non-driving state of the motor is greater than the maximum delay time for current acquisition in the driving state.

[0155] In some embodiments, the acquisition module is specifically used for:

[0156] The n current values ​​are collected during at least two drive cycles of the motor.

[0157] In some embodiments, the acquisition module is specifically used for:

[0158] In each driving cycle, a current value is collected; or,

[0159] A current value is collected every two drive cycles.

[0160] The motor current acquisition device provided in this application embodiment can realize all the processes implemented by the motor current acquisition device in the method embodiment. To avoid repetition, it will not be described again here.

[0161] Figure 15 The hardware structure diagram of motor current acquisition provided in the embodiment of this application is shown.

[0162] The motor current acquisition device may include a processor 1501 and a memory 1502 storing computer program instructions.

[0163] Specifically, the processor 1501 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0164] Memory 1502 may include mass storage for data or instructions. For example, and not limitingly, memory 1502 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 1502 may include removable or non-removable (or fixed) media. Where appropriate, memory 1502 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 1502 is non-volatile solid-state memory.

[0165] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.

[0166] The processor 1501 reads and executes computer program instructions stored in the memory 1502 to implement any of the motor current acquisition methods in the above embodiments.

[0167] In one example, the motor current acquisition device may also include a communication interface 1503 and a bus 1504. For example, Figure 15 As shown, the processor 1501, memory 1502, and communication interface 1503 are connected through bus 1504 and complete communication with each other.

[0168] The communication interface 1503 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0169] Bus 1504 includes hardware, software, or both, that couples components of a motor current acquisition device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 1504 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0170] In addition, in conjunction with the motor current acquisition method in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the motor current acquisition methods in the above embodiments.

[0171] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0172] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0173] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0174] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0175] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A method for acquiring motor current, characterized in that, The motor is driven by pulse width modulation control, and the method includes: The current value of the motor is periodically collected, with each collection cycle used to collect one current value of the motor; If n current values ​​are collected, the average value of the n current values ​​is calculated to obtain the average current value of the motor. Wherein, the length of the acquisition period is greater than the length of the motor drive period, n is an integer greater than 1, and the product of the length of the acquisition period and n is less than or equal to the maximum current acquisition delay time.

2. The method according to claim 1, characterized in that, Before periodically collecting the current value of the motor, the method further includes: The length of the acquisition period and n are determined by a first formula, which is: n×T s ≤t delay ≤(n+1)×T s Among them, T s It is the length of the acquisition period, t delay It is the maximum delay time for current acquisition.

3. The method according to claim 1, characterized in that, Before periodically collecting the current value of the motor, the method further includes: The length of the acquisition period is determined by a target formula, which includes a second formula: T s %T d ≠0 Among them, T s T is the length of the acquisition period. d is the length of the motor's drive cycle, and % is the modulo operator.

4. The method according to claim 3, characterized in that, The target formula also includes a third formula, which is: (n×T s )%T d =0。 5. The method according to claim 1, characterized in that, The current value is acquired by the target chip. Before periodically acquiring the current value of the motor, the method further includes: Based on the characteristic information of the target chip and the clock source, determine the minimum value of the acquisition cycle length.

6. The method according to any one of claims 1 to 5, characterized in that, Before periodically collecting the current value of the motor, the method further includes: Determine the operating state of the motor, which is either a driving state or a non-driving state; Based on the operating status, determine the target length of the acquisition cycle; Wherein, when the motor is in a driving state, the target length is a first length, and when the motor is in a non-driving state, the target length is a second length, and the second length is greater than the first length; The periodic acquisition of the motor's current value includes: The current value of the motor is periodically collected, with the target length as one collection cycle.

7. The method according to claim 6, characterized in that, Determining the target length of the acquisition cycle based on the operating status includes: Based on the operating status, determine the maximum delay time for current acquisition; The target length of the acquisition period is determined based on the maximum delay time of the current acquisition. Wherein, the maximum delay time for current acquisition in the non-driving state of the motor is greater than the maximum delay time for current acquisition in the driving state.

8. The method according to claim 1, characterized in that, When the motor is in a driving state, the periodic acquisition of the motor's current value includes: The n current values ​​are collected during at least two drive cycles of the motor.

9. The method according to claim 8, characterized in that, The acquisition of the n current values ​​during at least two drive cycles of the motor includes: In each driving cycle, a current value is collected; or, A current value is collected every two drive cycles.

10. A motor current acquisition device, characterized in that, The motor is driven by pulse width modulation control, and the device includes: The acquisition module is used to periodically acquire the current value of the motor, and each acquisition cycle is used to acquire one current value of the motor; The calculation module is used to calculate the average value of the n current values ​​collected to obtain the average current value of the motor. Wherein, the length of the acquisition period is greater than the length of the motor drive period, n is an integer greater than 1, and the product of the length of the acquisition period and n is less than or equal to the maximum current acquisition delay time.