High-precision harmonic metering method based on special metering chip and ARM processor
Through the combination of a dedicated metering chip and an ARM processor, the sampling frequency and calibration of harmonic information are dynamically adjusted, and the problems of low harmonic metering accuracy and large calculation volume in the existing technology are solved, high-precision harmonic metering is realized, and the algorithm is simplified. And reduce costs.
Patent Information
- Application Number
- CN202411639561.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2024-12-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing harmonic measurement methods are large in calculation and high in cost. Due to the fence effect and spectrum dispersion caused by fixed sampling frequency, it is difficult to improve the harmonic measurement accuracy, which affects the safety of the power grid and the absorption of new energy grid connection.
Using a high-precision harmonic metering method based on a dedicated metering chip and an ARM processor, the fundamental wave and harmonics are processed separately, and the sampling frequency is dynamically adjusted using the fundamental frequency output by the dedicated metering chip, and combined with the FFT calculation of the ARM processor, harmonics are achieved. Synchronous sampling and calibration of wave information eliminates the fence effect and improves metrology accuracy.
High-precision harmonic metering is realized, the accuracy of fundamental metering is maintained, the spectrum dispersion is reduced, the algorithm is simplified, the calculation is reduced, and the harmonic metering is not required to be calibrated separately, and the process of existing power meters is not affected.
Abstract
Description
Technical Field
[0001] The invention relates to a high-precision harmonic measurement method and belongs to the field of electrical instruments. Background Art
[0002] As more and more distributed renewable energy power generation scenarios are connected to the grid, the proportion of harmonics in the power grid is increasing. According to the analysis of distributed photovoltaic grid connection by State Grid Shandong Electric Power Company in early 2023, the total harmonic distortion rate of voltage caused by distributed photovoltaic grid connection is close to 2%, and the total harmonic distortion rate of current is as high as 40%, reaching a very high proportion. The higher the harmonic content, the more likely it is to cause problems such as failure of electrical equipment and malfunction of relay protection, affecting the safe and reliable operation of the power grid. Therefore, eliminating the impact of harmonics is an important measure to ensure the grid connection and absorption of new energy, and harmonic metering is an important assessment basis. It has not yet been included in the metering and charging of the power grid. In addition to the reasons of measurement standards and specifications, harmonic metering technology is also a key issue.
[0003] At present, the harmonic measurement methods are all obtained through FFT, wavelet transform and other methods to obtain the parameters of harmonic frequency, and use windowing, interpolation and other algorithms to improve the accuracy. The amount of calculation is very large, and the product cost and energy consumption are relatively high. In addition, the basic frequency of the power grid is changing. The sampling data obtained by using a fixed sampling frequency causes a fence effect because the frequency point to be measured deviates from the sampling frequency point. The intuitive feeling is that the energy is dispersed. The general method to reduce the fence effect is to increase the sampling frequency or double the complementary data, which greatly increases the amount of calculation, and still cannot be improved to a large extent. Summary of the invention
[0004] In order to overcome the above-mentioned deficiencies in the prior art, the present invention proposes a high-precision harmonic measurement method based on a dedicated measurement chip and an ARM processor.
[0005] The high-precision harmonic measurement method based on a dedicated measurement chip and an ARM processor is characterized in that: fundamental wave measurement and harmonic measurement are processed separately, the fundamental wave measurement is completed by a dedicated measurement chip, and the harmonic measurement is completed by an ARM processor. The specific process is as follows: the sampling signal is connected to the dedicated metering chip to obtain the fundamental information, and the sampling signal is simultaneously connected to the ARM processor to obtain the harmonic information. The ARM processor uses its own multi-channel ADC to synchronously sample the signal and calculate each harmonic component V through FFT. n ,I n And amplitude calibration, obtain the calibrated voltage and current harmonic components V nc ,I nc , and the phase difference between the voltage and current of each harmonic φ n , where n represents the harmonic order, During FFT calculation, when each round of sampling is completed, the fundamental frequency value f0 is read from the dedicated metering chip, and the sampling frequency value f0 of the next round of sampling is dynamically adjusted. s , so that the sampling frequency value f s is M times the fundamental frequency f0, then the sampling frequency f s Keep synchronous changes with the fundamental frequency f0 to ensure that the center frequency f of each harmonic n Overlaps with the frequency sampling points of FFT, M is the number of sampling points per cycle, M=2 k , k is an integer, During calibration, the fundamental voltage and fundamental current output by the dedicated metering chip are used as standard values to adjust the fundamental voltage, fundamental current and harmonic voltage and current values calculated by FFT. The fundamental voltage and fundamental current values output by the dedicated metering chip are recorded as V 00 ,I 00 , the fundamental voltage and fundamental current values calculated by the ARM processor through FFT are V 01 ,I 01 , voltage ratio C v =V 00 / V 01 , current ratio C i =I 00 / I 01 , then the calibrated harmonic voltage V nc =C v ×V n , each harmonic current after calibration I nc =C i ×I n , the instantaneous power P of each harmonic n =1 / 2×V nc ×I nc ×cos(φ n ).
[0006] Where V n is the voltage amplitude of the nth harmonic, I n is the current amplitude of the nth harmonic, V nc is the current amplitude of the nth harmonic after calibration, I nc is the current amplitude of the nth harmonic after calibration.
[0007] As a preference, the sampling frequency value f s The adjustment is achieved by modifying the timer Timer3. Timer3 is an automatically reloadable timer in the ARM processor. It is configured to automatically trigger ADC sampling when overflow occurs. It includes two parameters, one is the prescaler coefficient Prescaler, and the other is the automatic reload value Period. f s= F / 2 / (Prescaler × Period) , Then Prescaler × Period = F / 2 / f s =F / 2 / (M×f0), Where F is the main frequency of the ARM processor.
[0008] Preferably, the influence of background noise is eliminated by setting the starting threshold of each harmonic of voltage and current. When it is lower than the threshold, the corresponding harmonic data is set to 0.
[0009] The beneficial effects of the present invention are as follows: 1) the metering accuracy of the dedicated metering chip in terms of the fundamental wave of electric energy is maintained; 2) the sampling frequency is dynamically adjusted using the fundamental frequency value output by the dedicated metering chip, thereby eliminating the fence effect and reducing the spectrum dispersion, the algorithm is simple, and the harmonic metering accuracy is improved; 3) the fundamental wave data of the dedicated metering chip is used to automatically calibrate the harmonic data of each order, and there is no need to perform separate calibration for harmonic measurement, which does not affect the process of the existing electric energy meter. DETAILED DESCRIPTION
[0010] The present invention introduces a high-precision harmonic measurement method realized by combining the RN8209D dedicated metering chip and the STM32F407ARM processor. The fundamental wave measurement and harmonic wave measurement are processed separately, the fundamental wave measurement is completed by the dedicated metering chip, and the harmonic wave measurement is completed by the ARM processor. For a three-phase meter, a dedicated three-phase metering chip can be used, and the harmonic measurement is performed once per phase with reference to the single-phase method. The dedicated metering chip is specifically for fundamental wave measurement, and has been developed for more than 20 years. The technology is very mature, the external circuit design case is also standardized, and the fundamental wave measurement is relatively accurate.
[0011] RN8209D is a high-precision single-phase metering chip. Its energy metering, voltage and current measurement accuracy can reach better than ±0.1%, the frequency allocation rate is up to 0.001Hz, the internal voltage and current RMS registers default update speed is 0.293 seconds, and the frequency register default update speed is 0.64 seconds. Register data can be read through UART or SPI communication.
[0012] STM32F407 is a cost-effective ARM processor based on Cortex-M4F architecture, with a maximum main frequency of 168MHz, 3 12-bit analog / digital converters (ADCs), each ADC has up to 16 external channels, and the fastest conversion speed is 2.4MHz, that is, the conversion time is 0.41 microseconds. The chip has built-in single-precision floating-point operation FPU hardware, and with the DSP library function of the development tool, it can quickly and efficiently implement FFT operations. According to the test, 256, 512, and 1024-point FFTs take about 133, 246, and 616 microseconds respectively.
[0013] At present, in the harmonic analysis research of the power industry, the highest harmonic is 63rd order. Calculated with the fundamental wave of 50Hz, the 63rd order harmonic is 3150Hz. According to the Nyquist sampling theorem, the minimum sampling frequency is required to be above 6300Hz, which is much lower than the ADC conversion speed of STM32F407 of 2.4MHz. The processor meets the performance requirements in sampling. When the sampling frequency is 6300Hz, the time for a round of sampling of 1024 points is 162.54 milliseconds. When N=1024 points FFT is used, the operation time for a round is 616 microseconds. Each time two groups of FFTs of voltage and current are processed, the processor time occupancy rate = 616×2 / 162540=0.76%. Therefore, the sampling frequency can be increased to improve the accuracy. From the above introduction of the RN8209D dedicated metering chip and the STM32F407 processor and the basic performance requirements for harmonic metering, it can be seen that the combination of RN8209D+STM32F407 can ensure the fundamental wave metering accuracy and the computing power requirements of harmonic metering. The specific implementation is as follows.
[0014] The voltage and current sampling signals are connected to the RN8209D metering chip and the corresponding sampling pins of ADC1 and ADC2 of the STM32F407ARM processor. The ADC sampling parameters are configured and the DMA function of the ARM processor is used to directly save the sampling results to the RAM. The ADC is automatically started by the Timer3 timer. The sampled voltage and current data are automatically generated in the RAM. When 1024 sampling points are reached, the FFT calculation is called through the interrupt to obtain the harmonic components V of the voltage and current. n ,I n , and the phase difference between the voltage and current of each harmonic φ n , where n represents the harmonic order. Because the voltage and current are sampled synchronously, there is no phase difference caused by the sampling circuit itself. n is the voltage amplitude of the nth harmonic, I n is the current amplitude of the nth harmonic.
[0015] In general sampling analysis, the sampling frequency is fixed. For example, if the fundamental wave is 50Hz and 256 points are sampled per cycle, a fixed sampling frequency of 12800Hz is used for sampling calculation. This method can accurately analyze each harmonic signal when the fundamental wave is exactly 50Hz. However, when the fundamental wave deviates from 50Hz, the harmonic frequency deviates from the frequency sampling point of FFT, which will produce a fence effect and frequency leakage. The corresponding harmonic spectrum is scattered on both sides of the center frequency, which may cause a large deviation between the frequency sampling point (peak point) and the harmonic frequency, and the spectrum dispersion leads to a decrease in the harmonic amplitude, which cannot truly reflect the harmonic components.
[0016] In order to improve the accuracy of harmonic measurement, a sampling frequency method that changes synchronously with the actual fundamental frequency is used to solve the above-mentioned fence problem and leakage problem. M=256 points are sampled per cycle. When each round of sampling is completed, the fundamental frequency value f0 is read from the dedicated metering chip, and the sampling frequency value f0 of the next round is adjusted. s It is M times the fundamental frequency f0. Sampling frequency f s Synchronous change with the fundamental frequency f0 can ensure the center frequency f of each harmonic n Overlapping with the frequency sampling points of FFT eliminates the fence effect and improves the accuracy of harmonic measurement. After FFT operation, a complex number sequence is formed, and each point represents a frequency, which is the frequency sampling point. The sampling time of a 1024-point signal of a round of FFT is about 0.08 seconds. 1024 points are equivalent to 4 cycles. The frequency of a 50Hz power grid is 0.02 seconds, and 4 cycles correspond to 0.08 seconds, which is less than the frequency refresh time of the dedicated metering chip of 0.64 seconds. Therefore, the sampling frequency f can be guaranteed. s Follow the changes of fundamental frequency f0 in time.
[0017] The fundamental frequency f0 of the power grid fluctuates slowly within a certain range. It can be considered unchanged within a small time range, and there will be no impact of rapid frequency jumps. Each round lasts only about 0.08 seconds (1024 points, 256 points per cycle, 4 cycles), which can be understood as the front and rear wheels will not change. Sampling frequency value f s The adjustment is achieved by modifying the timer Timer3, which is an automatically reloadable timer and can be configured to automatically trigger ADC sampling when overflow occurs. It includes two parameters, one is the prescaler coefficient Prescaler, and the other is the automatic reload value Period.
[0018] f s = F / 2 / (Prescaler × Period) (Formula 1) Prescaler ×Period = F / 2 / f s = F / 2 / (M×f0) (Formula 2) Where F is the main frequency of the ARM processor. When F=168MHz and M=256, if the fundamental frequency fluctuates between 49 and 51Hz, the corresponding value of Prescaler×Period can be adjusted between 6434 and 6696. Both Prescaler and Period are 16-bit registers. If the adjustment value does not exceed the maximum value of the register, 65535, you can set Prescaler=1 and adjust Period between 6434 and 6696 to meet the requirements.
[0019] Every increase or decrease of Period by 1 corresponds to a change of the fundamental frequency f0 of about 0.008Hz, which has a sufficiently high response accuracy.
[0020] As a measuring device, error calibration is a must-do task. Harmonic measurement also requires a certain degree of accuracy. However, if each harmonic is calibrated one by one, the work is very difficult. At present, harmonic measurement has not yet been used as a basis for charging and the technology is not mature enough. Simplifying the error adjustment work of harmonic measurement is a must. In fact, the error comes from two parts. One is the hardware error from the sampling circuit and ADC, and the other is the error caused by the sampling speed and algorithm, such as frequency offset, fence effect, frequency leakage, etc. The latter is related to the design and has little to do with the specific product. The optimal design can be achieved, such as the sampling frequency f based on the fundamental frequency f0 mentioned above. s Adjustment, increase the number of sampling per cycle, etc. The former is related to the actual situation of each product and needs to be automatically adjusted according to the product.
[0021] We know that the voltage and current sampling signals of the metering chip and the ARM processor are from the same source, so theoretically the fundamental voltage and current values calculated by the metering chip and the ARM processor should be equal. Therefore, the fundamental voltage and fundamental current values of the metering chip can be used for calibration to eliminate the sampling circuit differences between the dedicated metering chip and the ARM processor.
[0022] The fundamental voltage and current values output by the dedicated metering chip are V 00 ,I 00 , the fundamental voltage and fundamental current values calculated by the ARM processor through FFT are V 01 ,I 01 , voltage ratio C v =V 00 / V 01 , current ratio C i =I 00 / I 01 , then the calibrated harmonic voltage V nc =C v ×V n , each harmonic current after calibration I nc =C i ×I n The instantaneous power P of each harmonic n =1 / 2×V nc ×I nc ×cos(φ n ), where 1 / 2 is the voltage and current amplitude converted into effective value, the voltage and current phase difference of each harmonic is φ nIt has nothing to do with the sampling circuit deviation, but only with the time deviation of ADC conversion. Because synchronous conversion is used, no calibration is required. nc is the current amplitude of the nth harmonic after calibration, I nc is the current amplitude of the nth harmonic after calibration.
[0023] The circuit noise floor of electronic products cannot be completely eliminated. At present, the energy meters that only measure fundamental electric energy are all equipped with a starting current, and the signal below the starting current is directly set to 0 to eliminate the influence of the bottom noise. Because the fundamental voltage is also the working power supply, the value is relatively large, and there is no starting voltage setting to 0. However, there should be a starting threshold for harmonic voltage and current. When it is lower than the threshold, the corresponding harmonic data is set to 0, thereby eliminating the influence of the circuit bottom noise. This design is very practical in application. For example, when the energy meter is unloaded, that is, when the user is not using electricity, there should be no metering data. If there is data, the instantaneous value can still be explained to the user, and the cumulative value is the basis for charging, which cannot be explained to the user, and the cumulative value is the cumulative measurement that may be affected by the bottom noise.
[0024] Calculate the instantaneous power P of each harmonic through the harmonic components and phase difference of voltage and current n , electric energy is the interval integral of power over time. For each round of FFT calculation, the instantaneous electric energy W of each harmonic in the current round is n =N / M×P n / f0, the electric energy indication of each harmonic is the accumulation of the instantaneous electric energy of the harmonic, E n =∑W n Because the fundamental frequency f0 is real-time changing data output from a dedicated metering chip, rather than a fixed 50Hz or 60Hz, the measurement is more accurate.
[0025] According to national standards, the frequency error of level 2 meters does not exceed ±0.5%, and the frequency error of level 1 meters and above does not exceed ±0.3%. The accuracy of the actual dedicated metering chip output is much better than the national standard, so the metering accuracy of harmonics can be guaranteed.
[0026] From the above analysis, it can be seen that the solution selected by the present invention solves the problem of algorithm accuracy of harmonic measurement by dynamically adjusting the sampling frequency, and realizes the calibration of harmonic measurement by using the accurate value of the fundamental wave output of the dedicated metering chip. The algorithm involved in the invention is simple, has high accuracy, and does not require separate calibration for harmonic measurement, and does not affect the process of existing electric energy meters.
[0027] The above analysis is for single-phase harmonic measurement. The metering chip is replaced with a three-phase dedicated metering chip, and the three-phase sampling is processed phase by phase according to the above single-phase sampling method, that is, the harmonic measurement data of each item can be obtained by executing it once on phases ABC, and finally a phase-to-phase accumulation processing is performed. When the requirements of the Nyquist sampling theorem are met, the time for single-phase FFT processing only takes up 0.76% of the processor time, and the three-phase calculation including the addition of phase-to-phase accumulation processing only takes up 2.3% of the processor time. The processor has enough time to handle other tasks, and still has enough ability to increase the sampling frequency to improve the measurement accuracy. Therefore, this solution only needs to replace the three-phase metering chip and a small amount of program copying to achieve three-phase harmonic measurement.
Claims
1. A high-precision harmonic measurement method based on a dedicated measurement chip and an ARM processor, characterized in that: Fundamental wave measurement and harmonic wave measurement are processed separately. Fundamental wave measurement is completed by a dedicated measurement chip, and harmonic wave measurement is completed by an ARM processor. The specific process is as follows: the sampling signal is connected to the dedicated metering chip to obtain the fundamental information, and the sampling signal is simultaneously connected to the ARM processor to obtain the harmonic information. The ARM processor uses its own multi-channel ADC to synchronously sample the signal and calculate each harmonic component V through FFT. n ,I n And amplitude calibration, obtain the calibrated voltage and current harmonic components V nc ,I nc , and the phase difference between the voltage and current of each harmonic φ n , where n represents the harmonic order, During FFT calculation, when each round of sampling is completed, the fundamental frequency value f0 is read from the dedicated metering chip, and the sampling frequency value f0 of the next round of sampling is dynamically adjusted. s , so that the sampling frequency value f s is M times the fundamental frequency f0, then the sampling frequency f s Keep synchronous changes with the fundamental frequency f0 to ensure that the center frequency f of each harmonic n Overlaps with the frequency sampling points of FFT, M is the number of sampling points per cycle, M=2 k , k is an integer, During calibration, the fundamental voltage and fundamental current output by the dedicated metering chip are used as standard values to adjust the fundamental voltage, fundamental current and harmonic voltage and current values calculated by FFT. The fundamental voltage and fundamental current values output by the dedicated metering chip are recorded as V 00 ,I 00 , the fundamental voltage and fundamental current values calculated by the ARM processor through FFT are V 01 ,I 01 , voltage ratio C v =V 00 / V 01 , current ratio C i =I 00 / I 01 , then the calibrated harmonic voltage V nc =C v ×V n , each harmonic current after calibration I nc =C i ×I n , the instantaneous power P of each harmonic n =1 / 2×V nc ×I nc ×cos(φ n ).
2. The high-precision harmonic measurement method based on a dedicated measurement chip and an ARM processor according to claim 1 is characterized in that: Sampling frequency value f s The adjustment is achieved by modifying the timer Timer3. Timer3 is an automatically reloadable timer in the ARM processor. It is configured to automatically trigger ADC sampling when overflow occurs. It includes two parameters, one is the prescaler coefficient Prescaler, and the other is the automatic reload value Period. f s = F / 2 / (Prescaler × Period) , Then Prescaler × Period = F / 2 / f s =F / 2 / (M × f0), Where F is the main frequency of the ARM processor.
3. The high-precision harmonic measurement method based on a dedicated measurement chip and an ARM processor according to claim 1 is characterized in that: The influence of background noise can be eliminated by setting the starting threshold of each harmonic of voltage and current. When it is lower than the threshold, the corresponding harmonic data is set to 0.
Citation Information
Patent Citations
Impact load electric energy metering method
CN101055299A
Precision-metrology intelligent ammeter
CN103033681A
Intelligent metering system and intelligent metering method on basis of Blackman-harris window spectrum correction
CN103454490A
Real-time high-precision power harmonic analysis method and device
CN103969508A
Real-time high-accuracy power harmonic analysis method
CN103983849A
