A Detection Method and Device for PWMi

By dividing the PWM frequency interval and configuring appropriate sampling rate and breakpoint marks, the current sampling accuracy and timeliness in PWM control are solved, and balanced sampling of high-frequency and low-frequency parts is achieved, ensuring accurate calculation of the current signal and fast feedback.

CN115078814BActive Publication Date: 2025-07-04ZHUZHOU JIACHENG TECH DEV CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210642560.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2025-07-04
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

In the PWM control, the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency cannot be balanced, which affects the calculation accuracy of the current sampling signal, and the instantaneous impact response on the current sampling waveform cannot meet the control timeliness requirements.

Method used

The range of PWM frequency values ​​is divided into several interval frequency segments in order of frequency from small to large. Different current signal acquisition units ADC current signal sampling rates are configured for different interval frequency segments. The update interrupt point marks the start and end points of the PWM period to ensure a moderate number of sampling points. The outliers are removed through the 3σ principle and the sliding mean processing is performed to calculate the true effective value of the current.

Benefits of technology

The sampling balance between the high-frequency part and the low-frequency part of the PWM waveform frequency is realized, which ensures the calculation accuracy of the current sampling signal, meets the control timeliness requirements, and reduces the fluctuations in the calculation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115078814B_ABST
    Figure CN115078814B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for detecting PWMi, which relates to the technical field of PWM current detection and calculation. When performing detection and calculation, the sampling rate of the current signal acquisition unit ADC is configured according to the interval frequencies divided by the PWM frequency value, ensuring that the number of sampling points within one PWM period is controllable. Considering the problem of a moderate number of sampling points within one period and a large PWM frequency span, the range of the PWM frequency value is divided into several interval frequency segments in ascending order of frequency, balancing the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency. This can not only ensure accuracy but also does not require too much storage space. For the sampling points, a precise starting point of one PWM period is determined in the form of an identifier, and the detection result is obtained quickly, avoiding the defect of poor real-time performance in the method of taking a large number of averages to reduce the fluctuation of the calculation result. A detection device for PWMi is also proposed, which can realize the real-time information acquisition and detection of current and meet the requirements of control timeliness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of PWM current detection and calculation, and more particularly, to a method and device for detecting PWMi. Background Art

[0002] With the continuous emergence of advanced power electronics technologies, the application fields of electronic devices have become increasingly extensive, the types of load electrical equipment have also become more and more, the requirements for control technologies have become higher and higher, and the application of pulse width modulation technology (PWM) in industrial control is very extensive. For example, PWM signals are used to control temperature, control the opening of proportional valves, control the speed of motors, control the steering of servos, etc. To achieve precise control, the detection of current is an important part of it.

[0003] PWMi refers to the current generated when the square-wave voltage of PWM modulation acts on the load; among them, the load can be any type of load such as resistor / capacitor / inductor, such as motors, proportional valves, etc. Then, through the current input and conversion circuit, current detection is performed through signal feedback. Since the waveform of PWM modulation is output by the controller, but the load current is unknown, and real-time information of the current is required for acquisition and detection during PID control, and then feedback control is performed. In addition, the controller also needs to collect the current to judge states such as overcurrent, open circuit, and short circuit. Therefore, accurate detection of the current is a basic requirement. However, it can be seen from the actual current waveform or the sampled waveform that the waveform of PWM is prone to distortion, but the periodicity of PWM remains unchanged. It is more appropriate that the number of sampling points within one period is between 40 and 100. In this way, both the accuracy can be guaranteed and too much storage space is not required. A new digital PWM converter low-delay current sampling method is disclosed in the prior art. The current signal is sampled twice at the initial point and the midpoint of a single PWM period. The sampling result at the midpoint is subtracted from the sampling result at the initial point to obtain the current change amount. The current obtained by sampling at the midpoint is added to the current change amount to predict the current at the initial point of the next PWM period, and the predicted value is used as the real-time current feedback signal to achieve low-delay current sampling. However, the span of the actually required PWM frequency (15Hz - 1000Hz) is too large. When setting a fixed sampling rate, on the one hand, if the sampling rate takes the intermediate value, the low-frequency part requires too much storage space, and more DMA buffs are needed to fill the data of one period. Branch judgments need to be made for each frequency, which is very cumbersome and error-prone, and the readability and maintainability of the program are poor; on the other hand, the number of sampling points in one period of the high-frequency part is too small, which will affect the calculation accuracy of the subsequent current sampling signal; when the sampling rate takes a smaller value, the problem of the high-frequency part will be more serious, and when the sampling rate takes a larger value, the problem of the low-frequency part will be aggravated. In addition, when the load is an electronic load, an abnormally large value will appear in the instantaneous impulse response on the current sampling waveform. Tiny clock drifts during sampling will randomly sample at different positions of this large value (clock drift is an objectively existing problem), resulting in large fluctuations in the finally calculated current value. The prior art generally performs a large number of averages to reduce the fluctuations in the calculation results. However, when using the detected current value for PID control, the real-time result needs to be calculated quickly, and a large number of averages take hundreds of milliseconds to the second level, which cannot meet the timeliness requirements of control. Summary of the Invention

[0004] To solve the problems that when using PWM for control currently, on the one hand, the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency cannot be balanced, affecting the calculation accuracy of the current sampling signal, and on the other hand, under PWM modulation, the instantaneous impact response on the current sampling waveform cannot meet the requirements of control timeliness, the present invention proposes a detection method and device for PWMi, which balances the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency, ensures the calculation accuracy of the current sampling signal for each period, and meets the requirements of control timeliness.

[0005] To achieve the above technical effects, the technical solution of the present invention is as follows:

[0006] A detection method for PWMi, the method includes the following steps:

[0007] Set the range of PWM frequency values, and divide the range of PWM frequency values into several interval frequency segments in ascending order of frequency;

[0008] Configure different current signal acquisition unit ADC current signal sampling rates for different interval frequency segments; determine the i-th update interrupt generated by PWM and correspondingly mark it as the starting point of the i-th cycle of the PWM waveform, and based on this starting point, correspondingly mark the sampling start point a of the current signal acquisition unit ADC;

[0009] Determine the (i + 1)-th update interrupt generated by PWM and correspondingly mark it as the end point of the i-th cycle of the PWM waveform, and based on this starting point, correspondingly mark the sampling end point b of the current signal acquisition unit ADC;

[0010] According to the current signal sampling rates configured for different interval frequency segments, calculate the number of current signal sampling points between the sampling start point a and the sampling end point b for each cycle, and record all the current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b;

[0011] Based on all the current signal sampling values, calculate the true root mean square value of the current.

[0012] In this technical solution, the sampling rate of the current signal acquisition unit ADC is configured according to the divided interval frequencies of the PWM frequency value, ensuring that the number of sampling points within one PWM cycle is controllable. Considering the problem of an appropriate number of sampling points within one cycle and a large PWM frequency span, the range of PWM frequency values is divided into several interval frequency segments in ascending order of frequency, balancing the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency, which can not only ensure the accuracy but also does not require too much storage space.

[0013] Preferably, the range of the PWM frequency value is 15 Hz - 1 kHz. Starting from 15 Hz, in ascending order up to 1 kHz, several interval frequency segments are divided based on the condition that the number of current signal sampling points satisfies 30 - 100. When configuring different current signal sampling rates for different interval frequency segments, a clock source is configured, and the sampling rate is configured based on the clock source.

[0014] Preferably, when calculating the number of current signal sampling points between the sampling start point a and the sampling end point b for each cycle according to the current signal sampling rate configured for different interval frequency segments, let the j-th interval frequency segment be ω j , and the current signal sampling rate configured for this interval frequency segment be H. Then the number of current signal sampling points q for each cycle is:

[0015] q = H / ω j

[0016] When the current signal sampling rate H and ω j cannot be divided evenly, q is determined by rounding down.

[0017] Preferably, when recording all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b, the 3σ principle is used to remove abnormal current signal sampling values, and a moving average process is performed on the values at the positions of instantaneous impact currents.

[0018] Preferably, based on all current signal sampling values, the formula for calculating the true root mean square value of the current satisfies:

[0019]

[0020] where, I rms represents the true root mean square value of the current, I k is the k-th current signal sampling value, and N is the number of current signal sampling points.

[0021] This application also proposes a detection device for PWMi. The detection device includes:

[0022] A PWM generation chip, on which a PWM output terminal and a current signal acquisition unit ADC are provided. The PWM output terminal is connected to a load, and a PWM-modulated square wave voltage is output to act on the load to generate a current;

[0023] Current input conversion unit. The input end of the current input conversion unit is connected to the line connecting the PWM output end and the load. The output end of the current input conversion unit is connected to the current signal acquisition unit ADC. The current input conversion unit collects the current analog signal on the line connecting the PWM output end and the load, and processes and converts the current analog signal into a form that matches the requirements of the current signal acquisition unit ADC. The current signal acquisition unit ADC converts the current analog signal into a current digital signal and transmits it to the chip body of the PWM generation chip for detection and processing.

[0024] The PWMi detection device proposed in this technical solution can realize real-time information acquisition and detection of current with the help of the PWM generation chip and the current signal acquisition unit ADC, which is convenient for feedback control.

[0025] Preferably, the PWM generation chip is any chip that can generate PWM waveforms.

[0026] Preferably, the load is an inductive load or a resistive load or a capacitive load.

[0027] Here, different load types can cause different changes in the current waveform generated by the PWM acting on the load, and various current problems are likely to occur. For example, current distortion occurs on the inductive load, and the distortion is related to the frequency of the PWM waveform. And in the adjustable electronic load, inrush current will be generated. Therefore, there are certain problems in the current detection and calculation of PWMi.

[0028] Preferably, the PWM generation chip is also provided with an ADC / DMA data copy processing unit and a true RMS current calculation unit. The ADC / DMA data copy processing unit and the true RMS current calculation unit are both located on the chip body of the PWM generation chip. The ADC / DMA data copy processing unit is respectively connected to the current signal acquisition unit ADC and the current calculation unit. The ADC / DMA data copy processing unit is used to determine the i-th update interrupt generated by the PWM and mark it as the starting point of the i-th cycle of the PWM waveform. Based on this starting point, the sampling start point a of the current signal acquisition unit ADC is correspondingly marked. And it is used to determine the (i + 1)-th update interrupt generated by the PWM and mark it as the end point of the i-th cycle of the PWM waveform. Based on this starting point, the sampling end point b of the current signal acquisition unit ADC is correspondingly marked. The ADC / DMA data copy processing unit repeatedly copies and records all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b and transmits them to the true RMS current calculation unit. The true RMS current calculation unit calculates the true RMS current based on all current signal sampling values.

[0029] Here, considering that different currents are generated when the PWM waveform acts on different loads and the current problems are also different, but its periodicity remains unchanged. Using the update breakpoint as a marker, on the one hand, it can correspondingly solve the instantaneous mutation, and on the other hand, it can accurately calculate the current in one period and quickly obtain accurate results. Compared with not marking the head and tail of one period or not finding an accurate period and using a large number of average values for calculation, which cannot meet the real-time requirement, the method of avoiding taking a large number of averages to reduce the fluctuation of the calculation result by means of identification has the defect of poor real-time performance. It can calculate the effective value of the stable current within 1 - 2 periods to meet the control requirements.

[0030] Preferably, the buffer of the ADC / DMA data copy processing unit has an upper limit. When repeatedly copying and recording all the current signal sampling values corresponding to each period between the sampling start point a and the sampling end point b, if the buffer length is not enough, the head and tail pointers of the circular buffer of the ADC / DMA data copy processing unit are spliced.

[0031] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0032] The present invention proposes a detection method and device for PWMi. The sampling rate of the current signal acquisition unit ADC is configured according to the divided interval frequencies of the PWM frequency value to ensure that the number of sampling points within one PWM period is controllable. Considering the problem of the appropriate number of sampling points within one period and the large span of the PWM frequency, the range of the PWM frequency value is divided into several interval frequency segments in the order of frequency from small to large, balancing the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency. It can not only ensure the accuracy but also does not require too much storage space. For the sampling points, a precise starting point of one PWM period is determined by means of identification, and the detection result is quickly obtained to avoid the defect of poor real-time performance of the method of taking a large number of averages to reduce the fluctuation of the calculation result. In addition, a detection device for PWMi is proposed. With the help of the PWM generation chip and the current signal acquisition unit ADC, it can realize the real-time information acquisition and detection of the current and meet the control timeliness requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It shows a schematic flow chart of the detection method for PWMi proposed in Embodiment 1 of the present invention;

[0034] Figure 2 It shows a schematic structural diagram of the detection device for PWMi proposed in Embodiment 2 of the present invention;

[0035] Figure 3 It shows a schematic diagram of the current waveform when the PWM waveform acts on an inductive load proposed in Embodiment 2 of the present invention;

[0036] Figure 4Schematic diagram of the current waveform when the PWM waveform proposed in Embodiment 2 of the present invention acts on an adjustable electronic load;

[0037] Figure 5 Schematic diagram showing that the ADC / DMA data copy processing unit proposed in Embodiment 3 of the present invention uses the update interrupt processing generated by PWM to represent the sampling of the current signal acquisition unit ADC. Detailed implementation manners

[0038] The drawings are only for illustrative purposes and should not be construed as limitations on this patent;

[0039] For better illustration of this embodiment, some parts of the drawings are omitted, enlarged or reduced, which do not represent the actual size;

[0040] For those skilled in the art, it is understandable that some well-known content descriptions in the drawings may be omitted.

[0041] The technical solutions of the present invention will be further described below with reference to the drawings and embodiments.

[0042] The description of the positional relationship in the drawings is only for illustrative purposes and should not be construed as limitations on this patent;

[0043] Embodiment 1

[0044] As Figure 1 shown, a flow schematic diagram of a calculation method of PWMi is proposed in this embodiment. Refer to Figure 1 , the method includes the following steps:

[0045] S1. Set the range of PWM frequency values, and divide the range of PWM frequency values into several interval frequency segments in ascending order of frequency;

[0046] S2. Configure different current signal sampling rates for different interval frequency segments; determine the i-th update interrupt generated by PWM and correspondingly mark it as the starting point of the i-th cycle of the PWM waveform. Based on this starting point, correspondingly mark the starting point a of the sampling of the current signal acquisition unit ADC;

[0047] S3. Determine the (i + 1)-th update interrupt generated by PWM and correspondingly mark it as the end point of the i-th cycle of the PWM waveform. Based on this starting point, correspondingly mark the end point b of the sampling of the current signal acquisition unit ADC;

[0048] S4. According to the current signal sampling rates configured for different interval frequency segments, calculate the number of current signal sampling points between the sampling starting point a and the sampling end point b of each cycle, and record all the current signal sampling values corresponding to each cycle between the sampling starting point a and the sampling end point b;

[0049] S5. Calculate the true RMS value of the current based on all the sampled values of the current signal.

[0050] In addition, there are large "spikes" on the signal collected by the current signal acquisition unit ADC, and a large DC component is superimposed on the signal. Before calculating the current, the signal needs to be processed. First, the DC component is removed, and then low-pass filtering is performed. Here are two methods to remove the DC component. One method is to grab the data, directly calculate the DC value in Matlab, and then directly subtract this DC value in the program. The advantage of this method is that it saves the processing resources of STM32G491. The disadvantage is that for the boards of different projects, the engineering value of the DC component needs to be obtained again each time. Another method is to traverse the minimum value of each period and then subtract this value from each sampling point. (For the PWM waveform, the low level can be defaulted to 0. If the lowest part is a positive number other than 0, then a DC component is superimposed on the signal.) The disadvantage of this scheme is that it is not applicable to the case of 100% duty cycle. It is necessary to first calculate the DC component using signals with other duty cycles, record it in memory, and then use it. Here, the first scheme is adopted to remove the DC component.

[0051] PWM can be decomposed into the fundamental frequency sine wave and multiple harmonics. The main energy is concentrated in the sine wave of the fundamental frequency, and the spikes are mainly high-frequency components. The spikes and a small amount of multiple harmonics can be filtered out, which can make the calculation result more stable.

[0052] After calculating the true RMS value of the current for one period, it is better to perform mean filtering. Among the 100 calculated values, the fluctuation of the calculated value for a single period is approximately 10 mA. After performing 5-point mean filtering, the fluctuation can be reduced to about 3 mA, that is, it takes a total of 5 PWM periods; taking the PWM frequency of 500 Hz as an example, 5 periods are 10 ms, and more accurate results can be obtained, while meeting both accuracy and real-time performance.

[0053] In this embodiment, the range of the PWM frequency value is 15 Hz - 1 kHz (which is a relatively common requirement for PWM waveforms). Therefore, there is a span of nearly 100 times. If only one current signal acquisition unit ADC sampling rate is configured to meet all frequencies, there will be fewer sampling points for the high-frequency part, resulting in a large fluctuation in the calculated results, while there will be more sampled values for the low-frequency part, consuming a large amount of internal storage resources of the STM32G491 chip; and with a single sampling rate, it is not convenient to perform unified processing, there will be many branches, and the readability and maintainability of the program are not very good. Therefore, starting from 15 Hz, in ascending order until 1 kHz, based on the current signal sampling points as close as possible to 30 - 100, that is, a specific number of sampling points are selected within the range of 30 - 100 per cycle for the calculation of the true effective value, and it is divided into several interval frequency segments; for example, at a sampling rate of 45 KHz, 45 points are taken for the calculation of PWM 1 kHz, and when the sampling rate is 6.422 KHz and the PWM frequency is 100 Hz, 64 points are taken for the calculation. When configuring different current signal sampling rates for different interval frequency segments, first configure the clock source, and configure the sampling rate based on the clock source. In this embodiment, referring to Table 1, the clock source configured for the current signal acquisition unit ADC is:

[0054] Table 1:

[0055] 25M 5M 320M 160M 5M Source M N P ADC Prescaler Crystal Oscillator / 5 *64 / 2 / 32

[0056] The configuration parameters of the clock source configured for the current signal acquisition unit ADC are shown in Table 2.

[0057] Table 2

[0058]

[0059]

[0060] There are only a few optional sampling rates for the current signal acquisition unit ADC of the STM32G491 chip. Taking the first item as an example: According to the clock source configuration, for the first item, at "Sampling rate configuration 5M / 37 (configuration value is 24.5 cycles)", the sampling rate is configured as: 5M / 37 / 3 = 45.045 KHz. The rest will not be elaborated. It can be seen from the "Sampling points" column in Table 2 that under the clock source configuration, the current signal sampling points at each sampling rate satisfy 30 - 100. When actually operating, the calculated number of points is rounded down. When calculating the current signal sampling points between the sampling start point a and the sampling end point b per cycle according to the current signal sampling rate configured for different interval frequency segments, let the jth interval frequency segment be ω j , and the current signal sampling rate configured for this interval frequency segment is H, then the number of current signal sampling points q per cycle is:

[0061] q = H / ω j

[0062] When the current signal sampling rate H and ω j cannot be divided evenly, q is determined by rounding down;

[0063] When recording all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b, the 3σ principle is used to remove abnormal current signal sampling values, and the values at the positions of instantaneous impact currents are processed by moving average.

[0064] The three-sigma criterion is also known as the Pauta criterion. It first assumes that a set of test data contains only random errors, calculates the standard deviation through calculation and processing, determines an interval with a certain probability, and believes that any error exceeding this interval does not belong to random error but gross error, and the data containing this error should be excluded.

[0065] In the normal distribution, σ represents the standard deviation and μ represents the mean.

[0066] The 3σ principle is as follows:

[0067] The probability that the numerical distribution is in (μ - σ, μ + σ) is 0.6826

[0068] The probability that the numerical distribution is in (μ - 2σ, μ + 2σ) is 0.9545

[0069] The probability that the numerical distribution is in (μ - 3σ, μ + 3σ) is 0.9973[2]

[0070] It can be considered that the values of Y are almost all concentrated in the interval (μ - 3σ, μ + 3σ), and the possibility of exceeding this range is only less than 0.3%.

[0071] That is:

[0072] P(|x - μ| > 3σ) ≤ 0.003

[0073] Population standard deviation:

[0074] After simulation, it is found that the threshold of μ + 3σ is slightly on the high side. After debugging, it is more appropriate to use a threshold greater than 3 times the average value to remove outliers in the final engineering value.

[0075] Based on all current signal sampling values, the formula for calculating the true RMS value of the current satisfies:

[0076]

[0077] Among them, I rms represents the true RMS value of the current, I kis the sampling value of the k-th current signal, and N is the number of sampling points of the current signal.

[0078] Embodiment 2

[0079] This embodiment proposes a detection device for PWMi. The structural diagram of the detection device is shown in Figure 2 , as Figure 2 shown. The detection device includes:

[0080] A PWM generation chip is provided with a PWM output terminal and a current signal acquisition unit ADC. The PWM output terminal is connected to the load, and the PWM-modulated square wave voltage is output to act on the load to generate current.

[0081] A current input conversion unit. The input end of the current input conversion unit is connected to the connection line between the PWM output terminal and the load. The output end of the current input conversion unit is connected to the current signal acquisition unit ADC. The current input conversion unit collects the current analog signal on the connection line between the PWM output terminal and the load, and processes and converts the current analog signal into a form that matches the requirements of the current signal acquisition unit ADC. The current signal acquisition unit ADC converts the current analog signal into a current digital signal and transmits it to the chip body of the PWM generation chip for detection and processing.

[0082] The PWM generation chip can be any chip that can generate a PWM waveform. In this embodiment, the PWM generation chip is STM32G491. The PWM output terminal of STM32G491 generates a PWM waveform, which acts on the load, and then is transmitted to the current signal acquisition unit ADC through the current input conversion unit. The current signal acquisition unit ADC converts the current analog signal into a current digital signal and transmits it to the chip body of the PWM generation chip for detection and processing. The current conversion unit refers to a small chip - a shunt monitor, which converts the current signal into a voltage signal that can be collected by the PWM generation chip. INA193AIDBVT is used in this embodiment. Overall, the detection device for PWMi can realize real-time information acquisition and detection of current with the help of the PWM generation chip and the current signal acquisition unit ADC, which is convenient for feedback control.

[0083] The load can also be resistive, inductive, or capacitive. In this embodiment, an inductive load and an adjustable electronic load are selected for illustration.

[0084] The current detection line of the oscilloscope is directly clamped on the connection line between the PWM output terminal and the load, and the inductive load is connected. The PWM waveform and the PWMi waveform on the inductive load are as Figure 3 shown. The upper waveform is the PWMi waveform on the inductive load, and the lower waveform is the PWM waveform output from the PWM output terminal of the PWM generation chip. The frequency is 500 Hz and the duty cycle is 50%. ByFigure 3 It can be seen that the current waveform on the inductive load has been distorted.

[0085] Directly clamp the oscilloscope current probe on the connection line between the PWM output terminal and the adjustable electronic load, connect the adjustable electronic load, and the PWM waveform and the PWMi waveform on the adjustable electronic load are as Figure 4 shown. When the PWM output terminal is connected to the adjustable electronic load, there is a large inrush current at the rising edge of the PWM, and the duration varies according to different current conversion circuits, ranging from dozens of microseconds to hundreds of microseconds. The waveform at the high level of the PWM is not a flat waveform either, but a rising slanted waveform.

[0086] In summary, different load types can cause different changes in the current waveform generated by the PWM acting on the load. Therefore, various current problems are likely to occur, such as current distortion on the inductive load, and the distortion is related to the frequency of the PWM waveform. An inrush current will be generated on the adjustable electronic load. Therefore, there are certain problems in both the current detection and calculation of PWMi. When the load is an adjustable electronic load, there will be an abnormally large value in the instantaneous impulse response on the waveform, and tiny clock drifts during sampling will randomly sample at different positions of this large value, resulting in large fluctuations in the finally calculated current value. If a large number of averages are performed, the fluctuations in the calculation result can be reduced. However, when the detected current value is required for PID control, a real-time result needs to be calculated quickly. After a large number of averages, it has reached several hundred milliseconds to the second level, which cannot meet the control requirements.

[0087] Embodiment 3

[0088] In this embodiment, based on the detection of PWMi in Embodiments 1 and 2, an ADC / DMA data copy processing unit and a true RMS current calculation unit are further provided on the PWM generation chip. Both the ADC / DMA data copy processing unit and the true RMS current calculation unit are located on the chip body of the PWM generation chip. The ADC / DMA data copy processing unit is respectively connected to the current signal acquisition unit ADC and the current calculation unit. The ADC / DMA data copy processing unit is used to determine the i-th update interrupt generated by PWM and correspondingly mark it as the starting point of the i-th cycle of the PWM waveform. Based on this starting point, the sampling start point a of the current signal acquisition unit ADC is correspondingly marked. And it is used to determine the (i + 1)-th update interrupt generated by PWM and correspondingly mark it as the end point of the i-th cycle of the PWM waveform. Based on this starting point, the sampling end point b of the current signal acquisition unit ADC is correspondingly marked. It repeats copying and recording all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b and transmits them to the true RMS current calculation unit. The true RMS current calculation unit calculates the true RMS current based on all current signal sampling values. The schematic diagram of the ADC / DMA data copy processing unit using the update interrupt processing of PWM to represent the sampling of the current signal acquisition unit ADC is as Figure 5 shown. Using the update interrupt point for marking, firstly, it can correspondingly solve the instantaneous mutation. Secondly, it can accurately calculate the current of one cycle and quickly obtain accurate results. Compared with not marking the head and tail of one cycle or not finding an accurate cycle and using a large number of average values for calculation, which cannot meet the real-time requirement. By identifying the precise starting point of a PWM cycle in this way, the detection result can be quickly obtained, avoiding the defect of poor real-time performance of the method of taking a large number of averages to reduce the fluctuation of the calculation result. It can calculate the stable current RMS value within 1 - 2 cycles to meet the control requirements.

[0089] The buffer of the ADC / DMA data copy processing unit has an upper limit. When repeating copying and recording all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b, if the buffer length is insufficient, the head and tail pointers of the ADC / DMA data copy processing unit's circular buffer are spliced.

[0090] The embodiments are only examples for clearly explaining the present invention and are not limitations on the implementation manners of the present invention. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to enumerate all implementation manners here. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A detection method for PWMi, characterized in that, The method includes the following steps: Set the range of PWM frequency values, and divide the range of PWM frequency values into several interval frequency segments in ascending order of frequency; Configure different current signal acquisition unit ADC current signal sampling rates for different interval frequency segments; determine the i-th update interrupt generated by PWM and correspondingly mark it as the starting point of the i-th cycle of the PWM waveform. Based on this starting point, correspondingly mark the sampling start point a of the current signal acquisition unit ADC; Determine the (i + 1)-th update interrupt generated by PWM and correspondingly mark it as the end point of the i-th cycle of the PWM waveform. Based on this starting point, correspondingly mark the sampling end point b of the current signal acquisition unit ADC; calculate the number of current signal sampling points between the sampling start point a and the sampling end point b for each cycle according to the current signal sampling rates configured for different interval frequency segments, and record all the current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b; Calculate the true RMS value of the current based on all the current signal sampling values.

2. The detection method of PWMi according to claim 1, wherein The range of PWM frequency values is 15 Hz - 1 kHz. Starting from 15 Hz, in ascending order until 1 kHz, divide it into several interval frequency segments based on the condition that the number of current signal sampling points satisfies 30 - 100; when configuring different current signal sampling rates for different interval frequency segments, configure the clock source and perform sampling rate configuration based on the clock source.

3. The detection method of PWMi according to claim 2, characterized in that, When calculating the number of current signal sampling points between the sampling start point a and the sampling end point b in each cycle according to the current signal sampling rate configured for different interval frequency bands, let the j-th interval frequency band be ω j , and the current signal sampling rate configured for this interval frequency band is H. Then the number of current signal sampling points q in each cycle is: q = H / ω j When the current signal sampling rate H and ω j cannot be divided evenly, q is determined by rounding down.

4. The detection method of PWMi according to claim 3, characterized in that, When recording all the current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b, use the 3σ principle to remove abnormal current signal sampling values and perform a moving average process on the values at the positions of instantaneous impact currents.

5. The detection method of PWMi according to claim 4, characterized in that The formula for calculating the true RMS value of the current based on all the current signal sampling values satisfies: Among them, I rms represents the true RMS value of the current, and I k is the k-th sampled value of the current signal, and N is the number of sampling points of the current signal.

6. A detection device for PWMi, characterized in that, The detection device includes: A PWM generation chip, on which there is a PWM output terminal and a current signal acquisition unit ADC. The PWM output terminal is connected to a load, and a PWM-modulated square wave voltage is output to act on the load to generate a current; A current input conversion unit, the input end of which is connected to the connection line between the PWM output terminal and the load, and the output end of which is connected to the current signal acquisition unit ADC. The current input conversion unit collects the current analog signal on the connection line between the PWM output terminal and the load, and processes and converts the current analog signal into a form matching the requirements of the current signal acquisition unit ADC; the current signal acquisition unit ADC converts the current analog signal into a current digital signal and transmits it to the chip body of the PWM generation chip for detection and processing; An ADC / DMA data copy processing unit and a true RMS current calculation unit are also provided on the PWM generation chip. The ADC / DMA data copy processing unit and the true RMS current calculation unit are both located on the chip body of the PWM generation chip. The ADC / DMA data copy processing unit is respectively connected to the current signal acquisition unit ADC and the current calculation unit. The ADC / DMA data copy processing unit is used to determine the i-th update interrupt generated by the PWM and mark it as the starting point of the i-th cycle of the PWM waveform. Based on this starting point, the sampling start point a of the current signal acquisition unit ADC is correspondingly marked. And it is used to determine the (i + 1)-th update interrupt generated by the PWM and mark it as the end point of the i-th cycle of the PWM waveform. Based on this starting point, the sampling end point b of the current signal acquisition unit ADC is correspondingly marked. It repeatedly copies and records all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b and transmits them to the true RMS current calculation unit. The true RMS current calculation unit calculates the true RMS current based on all current signal sampling values.

7. The detection device of PWMi according to claim 6, wherein The PWM generation chip is any chip that can generate a PWM waveform.

8. The detection device of PWMi according to claim 6, characterized in that The load is an inductive load, a resistive load, or a capacitive load.

9. The detection device of PWMi according to claim 6, wherein, The buffer of the ADC / DMA data copy processing unit has an upper limit. When repeatedly copying and recording all current signal sampling values corresponding to each cycle between the sampling start point a and the sampling end point b, if the buffer length is insufficient, the head and tail pointers of the circular buffer of the ADC / DMA data copy processing unit are spliced.

Citation Information

Patent Citations

  • System and control method for reducing noise of permanent magnet synchronous motor

    CN102594254A