[go: up one dir, main page]

CN115078814A - PWMi detection method and device - Google Patents

PWMi detection method and device Download PDF

Info

Publication number
CN115078814A
CN115078814A CN202210642560.1A CN202210642560A CN115078814A CN 115078814 A CN115078814 A CN 115078814A CN 202210642560 A CN202210642560 A CN 202210642560A CN 115078814 A CN115078814 A CN 115078814A
Authority
CN
China
Prior art keywords
current
pwm
sampling
current signal
adc
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210642560.1A
Other languages
Chinese (zh)
Inventor
黄妮
朱逸武
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuzhou Jiacheng Technology Development Co ltd
Original Assignee
Zhuzhou Jiacheng Technology Development Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuzhou Jiacheng Technology Development Co ltd filed Critical Zhuzhou Jiacheng Technology Development Co ltd
Priority to CN202210642560.1A priority Critical patent/CN115078814A/en
Publication of CN115078814A publication Critical patent/CN115078814A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R19/00Arrangements for measuring currents or voltages or for indicating presence or sign thereof
    • G01R19/25Arrangements for measuring currents or voltages or for indicating presence or sign thereof using digital measurement techniques
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R19/00Arrangements for measuring currents or voltages or for indicating presence or sign thereof
    • G01R19/02Measuring effective values, i.e. root-mean-square values

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Measurement Of Current Or Voltage (AREA)

Abstract

The invention provides a method and a device for detecting PWMi, which relate to the technical field of PWM current detection calculation, when in detection calculation, the sampling rate of an ADC (analog-to-digital converter) of a current signal acquisition unit is configured according to divided interval frequencies of PWM frequency values, the controllable number of sampling points in a PWM period is ensured, the problems of moderate number of sampling points in a period and large PWM frequency span are considered, the range of the PWM frequency values is divided into a plurality of interval frequency sections according to the sequence of small and large frequencies, the sampling of the high-frequency part and the low-frequency part of PWM waveform frequency is balanced, the precision can be ensured, too large storage space is not needed, an accurate starting point of the PWM period is determined in an identification mode aiming at the sampling points, the detection result is rapidly obtained, the defect of poor real-time performance caused by taking a large amount of average to reduce the fluctuation of the calculation result is avoided, and a device for detecting the PWMi is also provided, the current real-time information acquisition and detection can be realized, and the control timeliness requirement is met.

Description

PWMi detection method and device
Technical Field
The invention relates to the technical field of PWM current detection calculation, in particular to a PWMi detection method and a PWMi detection device.
Background
With the continuous emergence of advanced power electronic technology, the application field of electronic equipment becomes wider and wider, the types of load electric equipment are more and more, the requirement on control technology is higher and higher, and the application of Pulse Width Modulation (PWM) technology in industrial control is very wide, for example, the detection of current is an important part in controlling temperature, controlling the opening degree of a proportional valve, controlling the rotating speed of a motor, controlling the steering of a steering engine and the like by using a PWM signal.
PWMi refers to the current generated by the action of the square wave voltage modulated by PWM on a load; wherein, the load can be any type of load of resistance/capacitance/inductance, such as motor, proportional valve, etc., then through current input and conversion circuit, and then through signal recovery to detect current, because the PWM modulated waveform is output by the controller, but the load current is unknown, and the PID control needs the real-time information of current to collect and detect, then feedback control, in addition, the controller also needs to collect current to judge the states of overcurrent, open circuit, short circuit, etc., so it is a more basic requirement to accurately detect current, however, the PWM waveform is easy to distort from the actual current waveform or the sampled waveform, but the periodicity of PWM is not changed, the sampling point in one period is between 40-100, thus it can ensure the precision, and needs not too large storage space, the prior art discloses a new type digital PWM converter low delay current sampling method, the method comprises the steps of sampling current signals at an initial point and a middle point of a single PWM period twice, subtracting a sampling result of the middle point from a sampling result of the initial point to obtain a current variation, adding the current obtained by sampling the middle point to the current variation, predicting the current of the initial point of the next PWM period, and using a predicted value as a real-time current feedback signal to realize low-delay current sampling, wherein the span of actually required PWM frequency (15Hz-1000Hz) is too large, and when a fixed sampling rate is set, on one hand, if the sampling rate takes the middle value, the low-frequency part needs too much storage space and needs more DMA buffs to fill up the data of one period, and each frequency needs to be subjected to branch judgment, so that the method is very complicated, is easy to make mistakes, and has poor readability and maintainability of a program; on the other hand, too few sampling points in one period of the high-frequency part can influence the calculation accuracy of subsequent current sampling signals; when the sampling rate is smaller, the problem of the high frequency part is more serious, and when the sampling rate is larger, the problem of the low frequency is aggravated. In addition, when the load is an electronic load, an abnormal super-large value can appear in the instant impulse response on the current sampling waveform, and the tiny clock drifts can be randomly sampled at different positions of the super-large value during sampling (the clock drifts are the objective problems), so that the finally calculated current value has large fluctuation.
Disclosure of Invention
The invention provides a method and a device for detecting a PWMi (pulse width modulation) to solve the problems that the sampling of a high-frequency part and a low-frequency part of a PWM (pulse width modulation) waveform frequency cannot be balanced and the calculation accuracy of a current sampling signal is influenced on the one hand and the instantaneous impulse response on the current sampling waveform cannot meet the requirement for controlling timeliness on the other hand when the current is controlled by the PWM.
In order to achieve the technical effects, the technical scheme of the invention is as follows:
a method of detecting PWMi, the method comprising the steps of:
setting the range of the PWM frequency value, and dividing the range of the PWM frequency value into a plurality of interval frequency sections according to the sequence of the frequency from small to large;
configuring different current signal sampling rates of an ADC (analog to digital converter) current signal acquisition unit for different interval frequency sections; determining the ith update interruption generated by PWM and correspondingly marking as the starting point of the ith period of the PWM waveform, and correspondingly marking the sampling starting point a of the ADC of the current signal acquisition unit by taking the starting point as the reference;
determining the (i + 1) th update interruption generated by PWM and correspondingly marking as the end point of the ith period of the PWM waveform, and correspondingly marking the sampling end point b of the current signal acquisition unit ADC by taking the start point as the reference;
calculating the number of current signal sampling points between a sampling starting point a and a sampling ending point b of each period according to current signal sampling rates configured in different interval frequency sections, and recording all current signal sampling values corresponding to each period between the sampling starting point a and the sampling ending point b;
and calculating the true effective value of the current based on all the current signal sampling values.
In the technical scheme, the sampling rate of the current signal acquisition unit ADC is configured according to the division interval frequency of the PWM frequency value, the controllable number of sampling points in a PWM period is ensured, the problems of moderate number of sampling points in a period and large PWM frequency span are considered, the range of the PWM frequency value is divided into a plurality of interval frequency sections according to the frequency from small to large, the sampling of the high-frequency part and the low-frequency part of the PWM waveform frequency is balanced, the precision can be ensured, and too large storage space is not needed.
Preferably, the range of the PWM frequency value is 15Hz-1kHz, starting from 15Hz, and starting from small to large to 1kHz, the PWM frequency value is divided into a plurality of interval frequency sections by taking the number of current signal sampling points to meet the standard of 30-100; when different current signal sampling rates are configured for different interval frequency bands, a clock source is configured, and the sampling rate configuration is carried out based on the clock source.
Preferably, when the number of current signal sampling points between the sampling start point a and the sampling end point b of each period is calculated according to the current signal sampling rates configured in the different interval frequency segments, the jth interval frequency segment is set as ω j And if the current signal sampling rate configured in the interval frequency segment is H, the number q of current signal sampling points per period is as follows:
q=H/ω j
at current signal sampling rates H and omega j When the integer division can not be carried out, q is determined in a mode of rounding down.
Preferably, when recording all current signal sample values corresponding to each period between the sampling start point a and the sampling end point b, the abnormal current signal sample value is removed by using the 3 σ principle, and the value of the position of the instantaneous impact current is subjected to sliding average processing.
Preferably, based on all current signal sample values, the formula for calculating the true effective value of the current satisfies:
Figure BDA0003684774680000031
wherein, I rms Representing the true effective value of the current, I k The number of sampling points of the current signal is N, which is the sampling value of the current signal at the kth time.
The present application further proposes a detection device of a PWMi, the detection device comprising:
the PWM generating chip is provided with a PWM output end and a current signal acquisition unit ADC, the PWM output end is connected with a load, and square wave voltage modulated by PWM is output to act on the load to generate current;
the input end of the current input conversion unit is connected to a connecting line of the PWM output end and the load, the output end of the current input conversion unit is connected with the current signal acquisition unit ADC, the current input conversion unit acquires current analog signals on the connecting line of the PWM output end and the load and processes and converts the current analog signals into a form matched with 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 the current digital signal to the chip body of the PWM generation chip for detection processing.
The PWMi detection device provided by the technical scheme can realize real-time information acquisition and detection of current by means of the PWM generating chip and the current signal acquisition unit ADC, and is convenient for feedback control.
Preferably, the PWM generating chip is any chip capable of generating a PWM waveform.
Preferably, the load is an inductive load, a resistive load or a capacitive load.
In this case, different load types may cause different changes of the current waveform generated by the PWM acting on the load, which easily causes various current problems, such as current distortion on the inductive load, which is related to the frequency of the PWM waveform, and a surge current will be generated on the adjustable electronic load, so that there is a certain problem in the current detection and calculation of PWMi.
Preferably, the PWM generating chip is further provided with an ADC/DMA data copy processing unit and a current true effective value calculating unit, both of which are located on the chip body of the PWM generating chip, the ADC/DMA data copy processing unit is connected to the current signal collecting unit ADC and the current calculating unit, respectively, the ADC/DMA data copy processing unit is configured to determine the ith update interrupt generated by PWM and mark the start point as the ith period of the PWM waveform correspondingly, mark the sampling start point a of the current signal collecting unit ADC correspondingly with the start point as the reference, determine the (i + 1) th update interrupt generated by PWM and mark the end point as the ith period of the PWM waveform correspondingly, mark the sampling end point b of the current signal collecting unit ADC correspondingly with the start point as the reference, and repeatedly copying and recording all current signal sampling values corresponding to each period between the sampling starting point a and the sampling ending point b, and transmitting the current signal sampling values to a current true effective value calculating unit, wherein the current true effective value calculating unit calculates a current true effective value based on all the current signal sampling values.
The current generated by PWM waveforms acting on different loads is different, the current problem is also different, but the periodicity is unchanged, the updated break point is used for marking, firstly, instantaneous sudden change is correspondingly solved, secondly, the current of one period can be accurately calculated, accurate results are quickly obtained, compared with the method that the head and the tail of one period are not marked or an accurate period is not found, a large amount of average values are adopted for calculation, the requirement on real-time performance cannot be met, the defect that the method that the fluctuation of the calculation result is reduced by taking a large amount of average values in an identification mode is poor in real-time performance is overcome, and the stable current effective value can be calculated in 1-2 periods to meet the control requirement.
Preferably, the buffer of the ADC/DMA data copy processing unit has an upper limit, and when the buffer length is insufficient between the repeated copy record sampling start point a and the sampling end point b corresponding to all current signal sampling values of each period, the head and tail pointers of the cyclic buffer of the ADC/DMA data copy processing unit are spliced.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the invention provides a detection method and a device of PWMi, which configures the sampling rate of a current signal acquisition unit ADC according to the divided interval frequency of PWM frequency values to ensure that the number of sampling points in a PWM period is controllable, considers the problems of moderate number of sampling points in a period and large PWM frequency span, divides the range of the PWM frequency values into a plurality of interval frequency sections according to the sequence of small frequency and large frequency, balances the sampling of the high frequency part and the low frequency part of PWM waveform frequency, not only can ensure the precision, but also does not need too large storage space, determines a precise starting point of the PWM period in a marking mode aiming at the sampling points, and rapidly obtains the detection result to avoid the defect of poor real-time performance of taking a large amount of average to reduce the fluctuation of the calculation result, in addition, provides the detection device of PWMi, and can realize the real-time information acquisition and detection of the current by means of a PWM generating chip and the current signal acquisition unit ADC, and meets the requirement of controlling timeliness.
Drawings
Fig. 1 shows a schematic flow chart of a PWMi detection method proposed in embodiment 1 of the present invention;
fig. 2 is a schematic structural view of a PWMi detection device proposed in embodiment 2 of the present invention;
fig. 3 is a schematic diagram showing a current waveform of a PWM waveform applied to an inductive load according to embodiment 2 of the present invention;
fig. 4 is a schematic diagram showing the current waveform applied to the adjustable electronic load by the PWM waveform proposed in embodiment 2 of the present invention;
fig. 5 is a schematic diagram showing the ADC/DMA data copy processing unit according to embodiment 3 of the present invention, wherein the sampling of the current signal acquisition unit ADC is represented by PWM generated update interrupt processing.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent;
for better illustration of the present embodiment, certain parts of the drawings may be omitted, enlarged or reduced, and do not represent actual dimensions;
it will be understood by those skilled in the art that certain well-known descriptions of the figures may be omitted.
The technical solution of the present invention is further described below with reference to the accompanying drawings and examples.
The positional relationships depicted in the drawings are for illustrative purposes only and are not to be construed as limiting the present patent;
example 1
As shown in fig. 1, the present embodiment proposes a flow chart schematic diagram of a PWMi calculating method, and referring to fig. 1, the method includes the following steps:
s1, setting a range of PWM frequency values, and dividing the range of the PWM frequency values into a plurality of interval frequency sections according to the sequence of frequency from small to large;
s2, configuring different current signal sampling rates of an ADC (analog to digital converter) current signal acquisition unit for different interval frequency sections; determining the ith update interruption generated by PWM and correspondingly marking as the starting point of the ith period of the PWM waveform, and correspondingly marking the sampling starting point a of the ADC by using the starting point as a reference;
s3, determining the (i + 1) th update interruption generated by PWM and correspondingly marking the update interruption as the end point of the ith period of the PWM waveform, and correspondingly marking the sampling end point b of the current signal acquisition unit ADC by taking the start point as a reference;
s4, calculating the number of current signal sampling points between a sampling starting point a and a sampling end point b of each period according to the current signal sampling rate configured in the frequency segments of different intervals, and recording all current signal sampling values corresponding to each period between the sampling starting point a and the sampling end point b;
and S5, calculating a current true effective value based on all current signal sampling values.
In addition, a large 'burr' exists on the signal acquired by the current signal acquisition unit ADC, a large direct current is superposed on the signal, the signal needs to be processed before the current calculation, the direct current is removed, and then low-pass filtering is performed. Two methods for removing direct current are provided, one is to capture data, directly calculate direct current in Matlab, and then directly subtract the direct current value in a program, and the method has the advantages of saving processing resources of STM32G491 and having the defect that direct current engineering values are required to be obtained again for boards of different projects each time. Another approach is to traverse the minimum value for each period and then subtract that value from each sample point. (the PWM waveform may default to a value of 0 at a low level-the lowest part is a positive number other than 0, and a direct current is superimposed on the signal.) this solution has the disadvantage of not being suitable for the 100% duty cycle case. The signals with other duty ratios are required to be used for calculating the direct current and recording the direct current in a memory before use. The first scheme is used here to remove the direct current.
PWM can decompose cost frequency sine wave and with many times of harmonic waves, main energy still concentrates on the sine wave of this frequency, and the burr is mainly the high frequency component, can filter burr and a small amount of many times of harmonic waves, can let the result of calculation more steady.
After the current true effective value of one period is calculated, average filtering is preferably carried out, the calculated value of a single period is counted to be about 10mA fluctuation in 100 calculated values, and the fluctuation can be reduced to about 3mA after 5 points of average filtering is carried out, namely 5 PWM periods are consumed; taking the PWM frequency of 500Hz as an example, and 5 periods of 10ms, a relatively accurate result can be obtained, and the precision and the real-time performance are simultaneously met.
In this embodiment, the range of the PWM frequency value is 15Hz-1kHz (which is a general requirement for PWM waveform), so that there is a span close to 100 times, if only one kind of ADC sampling rate of the current signal acquisition unit is configured to satisfy all frequencies, there are few partial sampling points with high frequency, resulting in large fluctuation of the calculated result, and partial sampling values with low frequency are too many, which consumes internal storage resources of the STM32G491 chip; under the condition of single sampling rate, uniform processing is not convenient, a plurality of branches are generated, and the readability and maintainability of the program are not good. Therefore, starting from 15Hz, the current signal sampling points are counted from small to large to 1kHz, the number of the sampling points of the current signal is taken as the reference when the sampling points meet 30-100 as much as possible, namely, a specific number of sampling points are selected in the range of 30-100 in each period to calculate the true effective value, and the true effective value is divided into a plurality of interval frequency sections; for example, under a sampling rate of 45KHz, 45 points are taken for calculating PWM 1KHz, when the sampling rate is 6.422KHz, the PWM frequency is 100Hz, 64 points are taken for calculating, when different current signal sampling rates are configured for different interval frequency segments, a clock source is firstly configured, and the sampling rate configuration is performed based on the clock source, in this embodiment, referring to table 1, the clock source configured by the current signal acquisition unit ADC is:
table 1:
25M 5M 320M 160M 5M
source M N P ADC pre-division frequency
Crystal oscillator /5 *64 /2 /32
The configuration parameters of the clock source configured by the current signal acquisition unit ADC are shown in table 2.
TABLE 2
Figure BDA0003684774680000071
Figure BDA0003684774680000081
The sampling rate of the current signal acquisition unit ADC of the STM32G491 chip is only selectable in a few ways, taking the first item as an example: according to the clock source configuration, the first item is under the condition of 'sampling rate configuration 5M/37 (configuration value is 24.5 cycles)', the sampling rate is configured as follows: 5M/37/3 is 45.045KHz, the rest is not repeated, and can be known from the column of "sampling points" in Table 2, under the configuration of a clock source, the number of current signal sampling points under each sampling rate satisfies 30-100, the calculated number of the current signal sampling points is rounded down during actual operation, and when the number of the current signal sampling points between the sampling start point a and the sampling end point b in each period is calculated according to the current signal sampling rates configured in different interval frequency sections, the j-th interval frequency section is set as omega j If the sampling rate of the current signal configured in the interval frequency band is H, the number q of current signal sampling points per period is:
q=H/ω j
at current signal sampling rates H and omega j When the integer division cannot be carried out, determining q in a downward rounding mode;
and when all current signal sampling values corresponding to each period between the sampling starting point a and the sampling ending point b are recorded, removing abnormal current signal sampling values by using a 3 sigma principle, and performing sliding average processing on the position value of the instantaneous impact current.
The three sigma criterion is also called Lauda criterion, which is that firstly, a group of detection data is supposed to only contain random errors, the detection data is calculated to obtain standard deviation, an interval is determined according to a certain probability, the errors exceeding the interval are considered not to belong to the random errors but to be coarse errors, and the data containing the errors are rejected.
In a normal distribution, σ represents the standard deviation and μ represents the mean.
The 3 sigma principle is as follows:
the probability of the numerical distribution in (. mu. - σ,. mu. + σ) is 0.6826
The probability of the numerical distribution in (μ -2 σ, μ +2 σ) is 0.9545
The probability of the numerical distribution in (mu-3 sigma, mu +3 sigma) is 0.9973[2]
It is considered that the values of Y are almost entirely concentrated in the (μ -3 σ, μ +3 σ) range, and the possibility of exceeding this range is only less than 0.3%.
Namely:
P(|x-μ|>3σ)≤0.003
total standard deviation:
Figure BDA0003684774680000091
after simulation, the threshold of mu +3 sigma is found to be slightly higher, and after debugging, the threshold of which the final engineering value is more than 3 times of the average value is more suitable for removing the abnormal value.
Based on all current signal sampling values, the formula for calculating the true effective value of the current meets the following requirements:
Figure BDA0003684774680000092
wherein, I rms Representing the true effective value of the current, I k The number of sampling points of the current signal is N, which is the sampling value of the current signal at the kth time.
Example 2
The present embodiment proposes a PWMi detection device, the structure of which is shown in fig. 2, and as shown in fig. 2, the detection device includes:
the PWM generating chip is provided with a PWM output end and a current signal acquisition unit ADC, the PWM output end is connected with a load, and square wave voltage modulated by PWM is output to act on the load to generate current;
the input end of the current input conversion unit is connected to a connecting line of the PWM output end and the load, the output end of the current input conversion unit is connected with the current signal acquisition unit ADC, the current input conversion unit acquires current analog signals on the connecting line of the PWM output end and the load and processes and converts the current analog signals into a form matched with 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 the current digital signal to the chip body of the PWM generation chip for detection processing.
The PWM generating chip can be any chip capable of generating PWM waveforms, in the embodiment, the PWM generating chip is STM32G491, a PWM output end of the STM32G491 generates PWM waveforms, the PWM waveforms are applied to a load and then transmitted to the current signal acquisition unit ADC through the current input conversion unit, the current signal acquisition unit ADC converts current analog signals into current digital signals and transmits the current digital signals to a chip body of the PWM generating chip for detection and processing, the current conversion unit refers to a small chip-shunt monitoring meter and converts the current signals into voltage signals which can be acquired by the PWM generating chip, the INA193AIDBVT is used in the embodiment, the whole detection device of the PWMi generates the chip and the current signal acquisition unit ADC through the PWM, real-time information acquisition and detection of the current can be realized, and feedback control is facilitated.
The load may be resistive, inductive, or capacitive, and in this embodiment, an inductive load and an adjustable electronic load are also used for description.
The oscilloscope current detection line is directly clamped on a connecting line of a PWM output end and a load, an inductive load is connected, the PWM waveform and the waveform of the PWMi on the inductive load are shown in figure 3, wherein the upper end waveform is the waveform of the PWMi on the inductive load, the lower end waveform is the PWM waveform output by the PWM output end of the PWM generation chip, the frequency is 500Hz, the duty ratio is 50%, and the current waveform on the inductive load is distorted as can be seen from figure 3.
The oscilloscope current detection is directly clamped on a connecting line of a PWM output end and an adjustable electronic load and connected into the adjustable electronic load, the PWM waveform and the waveform of PWMi on the adjustable electronic load are as shown in figure 4, when the PWM output end is connected on the adjustable electronic load, a large impact current exists at the rising edge of PWM, the duration time is different according to different current conversion circuits, and the duration time is different from dozens of microseconds to hundreds of microseconds. The PWM high level is not a flat waveform, but a ramp-up waveform.
As can be seen from the above, different load types may cause different changes of the current waveform generated by the PWM acting on the load, and therefore, various current problems are easily generated, such as current distortion on the inductive load, which is related to the frequency of the PWM waveform, and a rush current is generated on the adjustable electronic load, so that there is a certain problem in the current detection and calculation of PWMi. If the load is an adjustable electronic load, an abnormal super-large value exists in instantaneous impulse response on a waveform, micro clock drift can be randomly sampled at different positions of the super-large value during sampling, so that the finally calculated current value has large fluctuation, the fluctuation reduction of the calculation result can be realized if a large amount of average is carried out, but if the PID control is carried out by using the detected current value, a real-time result needs to be rapidly calculated, and after the large amount of average, the real-time result reaches hundreds of milliseconds to seconds, so that the control requirement cannot be met.
Example 3
In this embodiment, based on the detection of PWMi in embodiments 1 and 2, an ADC/DMA data copy processing unit and a current true effective value calculating unit are further disposed on the PWM generating chip, and both the ADC/DMA data copy processing unit and the current true effective value calculating unit are disposed on the chip body of the PWM generating chip, the ADC/DMA data copy processing unit is respectively connected to the current signal collecting unit ADC and the current calculating unit, the ADC/DMA data copy processing unit is configured to determine the ith update interrupt generated by PWM and correspondingly mark the starting point of the ith period of the PWM waveform, mark the sampling starting point a of the current signal collecting unit ADC with the starting point as a reference, and determine the (i + 1) update interrupt generated by PWM and correspondingly mark the ending point of the ith period of the PWM waveform with the starting point as a reference, and correspondingly mark the sampling ending point b of the current signal collecting unit ADC with the starting point as a reference, the method comprises the steps of repeatedly copying and recording all current signal sampling values corresponding to each period between a sampling starting point a and a sampling ending point b, transmitting the current signal sampling values to a current true effective value calculating unit, calculating a current true effective value based on all current signal sampling values by the current true effective value calculating unit, representing sampling of an ADC (analog to digital converter)/DMA (direct memory access) data copying and processing unit by an updating interruption process generated by PWM (pulse width modulation) as shown in figure 5, marking by using an updating interruption point, correspondingly solving instant sudden change, accurately calculating the current of one period, quickly obtaining an accurate result, marking a head and a tail of the period or not finding an accurate period, calculating by adopting a large amount of average values, failing to meet the requirement of real-time, determining an accurate starting point of the PWM period in a marking mode, and quickly obtaining a detection result, the defect that the method of reducing fluctuation of a calculation result by taking a large amount of average is poor in real-time performance is overcome, and the stable current effective value can be calculated in 1-2 periods so as to meet the control requirement.
And when the buffer of the ADC/DMA data copying processing unit has an upper limit, and when all current signal sampling values corresponding to each period between the repeated copying record sampling starting point a and the sampling end point b are insufficient, the length of the buffer is insufficient, and head and tail pointers of the cyclic buffer of the ADC/DMA data copying processing unit are spliced.
The examples are given solely for the purpose of clearly illustrating the invention and are not intended to limit the practice of the invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.

Claims (10)

1. A method of detecting PWMi, the method comprising the steps of:
setting the range of the PWM frequency value, and dividing the range of the PWM frequency value into a plurality of interval frequency sections according to the sequence of the frequency from small to large;
configuring different current signal sampling rates of an ADC (analog to digital converter) current signal acquisition unit for different interval frequency sections; determining the ith update interruption generated by PWM and correspondingly marking as the starting point of the ith period of the PWM waveform, and correspondingly marking the sampling starting point a of the ADC by using the starting point as a reference;
determining the (i + 1) th update interruption generated by PWM and correspondingly marking as the end point of the ith period of the PWM waveform, and correspondingly marking the sampling end point b of the current signal acquisition unit ADC by taking the start point as the reference; calculating the number of current signal sampling points between a sampling starting point a and a sampling ending point b of each period according to current signal sampling rates configured in different interval frequency sections, and recording all current signal sampling values corresponding to each period between the sampling starting point a and the sampling ending point b;
and calculating the true effective value of the current based on all the current signal sampling values.
2. The PWMi detection method of claim 1, wherein the PWM frequency value ranges from 15Hz to 1kHz, starting from 15Hz, and starting from the small and large values to 1kHz, and is divided into a plurality of interval frequency segments by taking the number of current signal sampling points satisfying 30-100 as a reference; when different current signal sampling rates are configured for different interval frequency bands, a clock source is configured, and the sampling rate configuration is carried out based on the clock source.
3. The method of claim 2, wherein when the number of current signal sampling points from the sampling start point a to the sampling end point b of each period is calculated according to the current signal sampling rates configured in different interval frequency bands, the jth interval frequency band is set as ω j And if the current signal sampling rate configured in the interval frequency segment is H, the number q of current signal sampling points per period is as follows:
q=H/ω j
at current signal sampling rates H and omega j When the integer division can not be carried out, q is determined in a mode of rounding down.
4. The PWMi detection method of claim 3, wherein when recording all current signal sample values corresponding to each period between the sampling start point a and the sampling end point b, removing abnormal current signal sample values by using a 3 σ principle, and performing a sliding average process on a value of a position of the instantaneous inrush current.
5. The PWMi detection method of claim 4, wherein the formula for calculating the true effective value of the current based on all current signal sample values satisfies:
Figure FDA0003684774670000021
wherein, I rms Representing the true effective value of the current, I k The number of sampling points of the current signal is N, which is the sampling value of the current signal at the kth time.
6. A detection apparatus for PWMi, the detection apparatus comprising:
the PWM generating chip is provided with a PWM output end and a current signal acquisition unit ADC, the PWM output end is connected with a load, and square wave voltage modulated by PWM is output to act on the load to generate current;
the input end of the current input conversion unit is connected to a connecting line of the PWM output end and the load, the output end of the current input conversion unit is connected with the current signal acquisition unit ADC, the current input conversion unit acquires current analog signals on the connecting line of the PWM output end and the load and processes and converts the current analog signals into a form matched with 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 the current digital signal to the chip body of the PWM generation chip for detection processing.
7. The PWMi detection apparatus according to claim 6, wherein the PWM generation chip is any chip capable of generating a PWM waveform.
8. The PWMi detection apparatus of claim 6, wherein the load is an inductive load, a resistive load, or a capacitive load.
9. The device for detecting the PWMi of claim 6, wherein the PWM generating chip is further provided with an ADC/DMA data copy processing unit and a current true effective value calculating unit, the ADC/DMA data copy processing unit and the current true effective value calculating unit are both located on a chip body of the PWM generating chip, the ADC/DMA data copy processing unit is respectively connected with the ADC and the current calculating unit, the ADC/DMA data copy processing unit is used for determining the ith update interruption generated by the PWM and correspondingly marking as the starting point of the ith period of the PWM waveform, the starting point is used as the reference, the sampling starting point a of the ADC is correspondingly marked, the i +1 th update interruption generated by the PWM and correspondingly marking as the ending point of the ith period of the PWM waveform, and the starting point is used as the reference, and (3) corresponding to the sampling end point b of the ADC of the marked current signal acquisition unit, repeatedly copying and recording all current signal sampling values corresponding to each period between the sampling start point a and the sampling end point b, and transmitting the current signal sampling values to the current true effective value calculation unit, wherein the current true effective value calculation unit calculates the current true effective value based on all the current signal sampling values.
10. The PWMi detection device according to claim 9, wherein the buffer of the ADC/DMA data copy processing unit has an upper limit, and when the buffer length is insufficient for repeatedly copying all current signal sample values corresponding to each period from the sampling start point a to the sampling end point b, the head and tail pointers of the cyclic buffer of the ADC/DMA data copy processing unit are spliced.
CN202210642560.1A 2022-06-08 2022-06-08 PWMi detection method and device Pending CN115078814A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210642560.1A CN115078814A (en) 2022-06-08 2022-06-08 PWMi detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210642560.1A CN115078814A (en) 2022-06-08 2022-06-08 PWMi detection method and device

Publications (1)

Publication Number Publication Date
CN115078814A true CN115078814A (en) 2022-09-20

Family

ID=83251965

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210642560.1A Pending CN115078814A (en) 2022-06-08 2022-06-08 PWMi detection method and device

Country Status (1)

Country Link
CN (1) CN115078814A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115963312A (en) * 2023-02-03 2023-04-14 电子科技大学 Periodic waveform statistical parameter measuring method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115963312A (en) * 2023-02-03 2023-04-14 电子科技大学 Periodic waveform statistical parameter measuring method and device
CN115963312B (en) * 2023-02-03 2023-08-08 电子科技大学 Method and device for measuring statistical parameters of periodic waveform

Similar Documents

Publication Publication Date Title
Karimi-Ghartemani et al. Measurement of harmonics/inter-harmonics of time-varying frequencies
CN110838828B (en) Method for demodulating inductive proximity sensor
CN109633253B (en) Circuit and method for realizing voltage transient signal detection based on FPGA
CN102393484A (en) Device for detecting stability of current
CN108593022A (en) A kind of Transient Electromagnetic flow transmitter based on differential interference compensation
CN107179440A (en) A kind of sub-synchronous oscillation m-Acetyl chlorophosphonazo extracting method of online adaptive frequency change
CN103092248A (en) Feedforward control method and device
CN114509598B (en) Automatic detection method and system for zero crossing point of fundamental wave voltage
CN115078814A (en) PWMi detection method and device
CN110231581A (en) Accumulator internal resistance measuring circuit and measurement method
CN111579866A (en) Signal frequency testing method and device
CN118663538B (en) Impedance matching method based on ultrasonic piezoelectric transducer frequency dynamic tracking
CN107430164A (en) The measuring circuit and measuring method of electrical component and the part for monitoring electrical component
CN107703365A (en) Power inductance dynamic equivalent inductance value test system and its method of testing
CN216013510U (en) Extra-high voltage pipe gallery circuit contact resistance test system
CN210243800U (en) Internal resistance measuring circuit of storage battery
CN210604927U (en) Processing power supply testing device of linear cutting control system
DE102017118910A1 (en) System and method for supply current shaping
CN119246964B (en) Transmission tower grounding resistance value measurement system and method based on multi-frequency measurement
CN113608011A (en) A DC high voltage measuring device with self-calibration function and its operation method
CN106066429B (en) A kind of exchange short pulse signal RMS to DC method
Vermeulen et al. Off-line identification of an open-loop automatic voltage regulator using pseudo-random binary sequence perturbations
CN103817404A (en) Manual electric arc welder three-phase electricity phase loss detection method and device
CN114327238B (en) Rotary transformer signal conditioning circuit and conditioning method
CN102354951A (en) Temperature protection circuit and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination