Abstract: This paper analyzes the impact of power frequency changes on the digital measurement accuracy of calculating the effective value of electricity and the reasons for the sampling frequency error. The method of using the high-speed input interface of the microcontroller Intel80C196 and the software timer to implement sampling frequency tracking is given. Hardware circuit structure and software block diagram.
Keywords: Sampling frequency synchronous microcontroller
With the development of computer technology, automatic power devices such as power meter relay protection are becoming more and more intelligent. Most of these devices use AC sampling. Most of the AC sampling process is: the voltage (or current) from the secondary circuit of the system is sent to the appropriate voltage of the A/D through the secondary PT (or CT), etc., and then the CPU controls the A/D to sample at a certain rate. The frequency is converted from analog to digital to obtain discrete sampling data. After discrete Fourier transform (DFT), the effective value of the fundamental wave and each harmonic value are calculated to realize other functions. The DFT calculation process is as follows:
If a discrete sampling system samples N samples per cycle, the effective value, real part effective value, and imaginary part effective value of its fundamental voltage (or current) are:
Where N——the number of sampling points per week;
Xn——The nth sample value.
The condition that the above calculation can accurately express the effective value is that the N sampling points of each weekly wave are evenly distributed in each power frequency cycle. However, in power automatic devices, the sampling frequency is mostly accomplished by setting the frequency division coefficient of the CPU timer. The clock source of the timer is determined by the crystal oscillator of the CPU system, and the sampling frequency is fixed. However, even if the sampling frequency that meets the above calculation requirements has been calculated based on the accurate power frequency (50Hz), because the frequency of the power system changes, and during the detection of fault recording devices and relay protection device products, It is necessary to assess the response of the device when the frequency changes. For example, in the relevant national testing standards, it is necessary to check the response of the wave recording device under low-frequency conditions. Therefore, data collected according to a fixed sampling frequency will inevitably have errors in the calculation results, which may cause a decrease in measurement accuracy or malfunction of the automatic device.
1 The impact of frequency changes on calculated values
The frequency here refers to both the sampling frequency and the power frequency of the power system, because changes in either of them will affect the calculation of the effective value after sampling. Assume that the sampling frequency is fixed at 1kHz (that is, corresponding to a 50Hz signal with 20 sampling points per wave), the effective value of the signal is 60V, corresponding to an equal-amplitude input quantity with a frequency of 46 to 54Hz, refer to formulas (1) and (2) , (3) Carry out full-cycle Fourier filtering for calculation, and the relative error of the results is shown in Table 1.
Obviously, changes in frequency have a greater impact on calculating the effective value. The reason for this problem is that the N sampling points of each weekly wave are not evenly distributed in each power frequency cycle. To solve this problem, the "parameter self-optimization equal-interval synchronous sampling method" is given in the literature [1]. It should be said that this method is very suitable for slow instrument detection devices. However, because the calculation process is relatively complex, and the number of sampling points and frequency of each wave are changing, the timeliness requirements are high, and the discrete sampling data cannot be processed in a background processing device (such as a power system dynamic recording device), which cannot meet the requirements. Therefore, when the accuracy meets the requirements, only one of the methods can be used: fix the number of sampling points, adjust the sampling interval in a timely manner according to the timely power frequency cycle measured by the microcontroller. At present, a considerable number of power automatic devices use Intel80C196 microcontroller as the CPU. This article uses Intel80C196 as an example to introduce the method of implementing sampling frequency tracking.
2 Hardware circuit composition and implementation principle
Considering that the frequency of the system does not change very quickly, in order to adjust the sampling frequency in a timely manner as the system power frequency changes, we can first measure the count value Tc corresponding to the previous cycle of the system frequency (in units of the timer clock cycle of the microcontroller system , the same below), and then calculate the count value Tsj of each sampling interval in a timely manner according to the number of sampling points per week (N):
Interval count value:
Then sampling with Tsj as the period can achieve timely tracking of the sampling frequency. In order to realize this process, the circuit structure shown in Figure 1 is planned to be used: the A-phase voltage from the bus voltage transformer is step-down isolated by a small PT, low-pass filtered, shaped into a square wave by a zero comparator, and sent through an optocoupler. Go to the high-speed input interface HSI.0 of Intel80C196, use the rising edge of the square wave to trigger the high-speed input interrupt, and measure the count value Tc of each power frequency cycle. After analysis and calculation by the microcontroller, the sampling interval Tsj is obtained through equation (4). Set the software timer interrupt with Tsj as the time interval. Perform data acquisition control, etc. in the software timer interrupt to complete timely tracking of the sampling frequency.
3 Software process
When designing software, you should make full use of the features of the 80C196 microcontroller: high-speed input (HSI) interface and software timer. The former is used to detect the rising edge of the square wave after shaping, and uses high-speed input interrupts to measure the system cycle. The latter is used to generate a software timer interrupt with a calculated timely sampling interval Ts as a period for A/D acquisition control.
The software consists of two parts: the main program, the high-speed input (HSI) interrupt program and the HS0 software timer interrupt. The flow charts are shown in Figures 2 to 4.
The main program mainly completes initialization and other application functions. During initialization, the default count value Td of the sampling time interval should be set. It is mainly used when the frequency of the power system cannot be measured correctly due to abnormal power used for frequency measurement. This default value is used as the sampling interval count Tsc, that is, Tsj = Td. The calculation method of this default value can refer to the following example:
Assume that the system frequency is 50Hz (that is, the period is 20000μs);
The number of sampling points per week is 20;
The system crystal oscillator of 80C196 is 16MHz, and using timer 1 as the time base, the counting period is 1μs, see literature [2].
Then the time between sampling points is:
20000μs/20=1000μs
The default count value for the sampling interval is:
Td=1000μs/1μs=1000
The high-speed input interrupt program first reads the current high-speed input count value Tnew, calculates the difference from the last count value Told, and obtains the appropriate power frequency cycle Tc, and then judges the value range of Tc to confirm the validity of the value. When judging the effectiveness of Tc, you can refer to the following method: consider the frequency fluctuation range of the general system, such as the corresponding Tc range of 45 to 55 Hz and determine it by the difference between the two measured values (because the normal system frequency cannot mutate). Finally, use equation (4) and consider the 20 state cycles required to enter the interrupt program to calculate the timely sampling interval Tsj.
After entering the HS0 software timer interrupt, the first thing to do is to preset the time Tsj for the next interrupt. Then perform the control of A/D conversion and other processing required for each sampling interval. It should be noted that since the software timer interrupt priority is higher than the high-speed input interrupt, the sampling control will not be affected by the high-speed input interrupt. In addition, the A/D control here can be the on-chip A/D inside the 80C196, or it can control the extended A/D. It depends on actual needs.
The sampling frequency synchronization method proposed in this article has been successfully used in the microcomputer power fault recorder and RTU automatic device we developed. The measured results of using sampling frequency tracking in the oscilloscope are shown in Table 2. Although the calculation result error is larger than that of the method in literature [1], it is all within the allowable range of general device errors (<0.5%). It can effectively offset the impact of power system frequency changes on the device measurement accuracy. Therefore, it can meet the general requirements. Instrumentation requirements. It has the characteristics of simple tracking and adjustment and strong timeliness, and is a relatively practical method. Automatic devices using other CPUs can use similar principles to achieve synchronous tracking of sampling frequencies.
Previous article:Low-illumination CCD image acquisition and noise preprocessing
Next article:Accuracy analysis of virtual test system
- Popular Resources
- Popular amplifiers
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- How does a magnetostrictive sensor work? What is the working principle of a magnetostrictive sensor?
- What types of posts can become featured posts?
- Several important parameters of RF switches
- MAX6675 temperature instability
- The pitfalls of first contact with sensortile.box
- Award-winning live broadcast: Hidden costs of isolation system design
- UA level constant current source output chip
- Issues with changing MAC when batch flashing blueNRG-1 with BlueNRG-X Flasher Utility
- EEWORLD University Hall ---- Lao Wu's MCU Practice_NO.1 Project Practice
- [NXP Rapid IoT Review] + Rapid IoT Studio online IDE