Share this

Measurement of non-sinusoidal average power based on microcontroller

2026-04-06 07:36:51 · · #1
Abstract This paper introduces the average power measurement principle of non-sinusoidal periodic current circuit. A hardware circuit containing an analog-to-digital converter and a microcontroller is designed, and the software design block diagram is given. The corresponding program is written in assembly language and tested and verified on the Wave simulator. Keywords: average power, non-sinusoidal circuit, analog-to-digital converter, microcontroller 1 Introduction At present, the AC-DC conversion circuits of electronic devices such as color displays and color TVs basically use switching power supplies. Since the input part of the switching power supply adopts diode rectification and capacitor filtering, although the input voltage is a sine wave, the current wave is distorted into a narrow pulse with a large amplitude (Figure 1). The input current waveform can be approximated as a rectangular wave. [IMG=Input current waveform]/uploadpic/THESIS/2007/12/2007121409132877180Q.jpg[/IMG] Most of the existing power measurement instruments are designed for power frequency sine waves. When measuring non-sinusoidal circuits containing high-order harmonics, the error is large [1]. The average power (i.e., active power) defined in circuit theory as P = UIcosθ can no longer accurately express the actual power consumed by the circuit load. Power measurement mainly includes (1) the time-division multiplier method [2] and the digital measurement method using a microcontroller. The non-sinusoidal average power measurement method introduced in this paper differs from the methods described in the literature, but it can also accurately measure the average power of the actual circuit. 2 Measurement Principle Time-Division Multiplier Method For AC/DC converter circuits, when the input current i(t) is a non-sinusoidal periodic waveform, the current contains a fundamental component and a considerable number of higher harmonic components. Fourier decomposition of the current waveform in Figure 1 yields the following equation: [IMG=Formula]/uploadpic/THESIS/2007/12/2007121409222576211O.jpg[/IMG] [IMG=Formula]/uploadpic/THESIS/2007/12/20071214091334352016.jpg[/IMG] Because only voltages and currents of the same frequency can generate average power, when the input voltage contains only the fundamental frequency (50Hz), its effective value U = U1 (fundamental frequency). Therefore, the average input power P value except for P1 is 0, which is the average power of the non-sinusoidal periodic current circuit. [IMG=average power]/uploadpic/THESIS/2007/12/2007121409134055543I.jpg[/IMG] Based on the above formula, it is necessary to measure the effective value of the input voltage, the effective value of the fundamental frequency (50Hz) of the input current, and the phase difference θ1 between the fundamental frequency of the input current and the input voltage, respectively, and then calculate the true average power. 3 System Hardware Circuit Structure The overall schematic diagram of the hardware circuit is shown in Figure 2. Since voltage and current transformers are used to obtain the two required analog signals, two input channels are selected for the A/D converter. During the A/D conversion time, the maximum signal change amplitude should be less than the quantization error of the A/D converter. The longer the conversion time, the lower the highest frequency of the signal that does not affect the conversion accuracy, which will greatly limit the operating frequency range of the A/D converter [4]. Therefore, to increase the allowable operating frequency of the analog signal while meeting the conversion accuracy requirements, a sample-and-hold circuit LF398 is used before the A/D converter. LF398 has the characteristics of high sampling speed and low holding voltage drop rate. When the external holding capacitor is 0.01μF, its output voltage drop rate is 3mV/s [4]. As an analog-to-digital converter, ADC0809 is a CMOS successive approximation type, microprocessor compatible 8-channel 8-bit A/D converter. When the analog input voltage range is 0~5V, a single +5V power supply can be used. In this design, the positive reference terminal Ref(+) of the ADC0809 is connected to the reference voltage of 5.12V along with the power supply VCC, and Ref(-) is connected to the ground terminal GND. The least significant bit represents the input voltage value. In the A/D conversion program, current is sampled first, followed by voltage. To sample the current and voltage values ​​at the same time, a delay circuit must be added to the voltage sampling channel. The two signals obtained from the voltage and current transformers are first converted to ±2.5V AC voltage, and then filtered by a 50Hz bandpass filter and a level shifting circuit to ensure that the input of the A/D converter is an analog voltage of 0-5V. At the start of the conversion, the EOC terminal of the ADC0809 is low, and it becomes high at the end of the conversion. The control terminal of the sample-and-hold circuit samples when it is high and holds when it is low. Therefore, the EOC terminal of the ADC0809 is used as the control terminal of the LF398, and the control signal of the ADC0809 comes from the microcontroller (Figure 2). [IMG=Fig. 2]/uploadpic/THESIS/2007/12/2007121409140260887I.jpg[/IMG] 4 Software Design 4.1 Determination of the Number of Sampling Points N In order to make the sampled discrete signal consistent with the original analog signal, according to the sampling theorem, the sampling frequency f should not be less than 5 to 10 times the signal frequency. N analog points are uniformly sampled within one period Ts, then the sampling period is . The oscillation frequency of the 80C51 microcontroller is set to 6MHz, then the ALE output is 1MHz, which is divided by two and used as the clock CLK (500kHz) of the ADC0809. One conversion takes 28μs [4]. As can be seen from the following program, each time two channels are sampled simultaneously, it takes about 260μs. Each channel can sample up to 76.9 points in one period (20ms). Considering that a sampling period that is too short would require high speed from the overall circuit, while a period that is too long would affect the accuracy of cosθ1, a balance is struck between these two aspects. Sampling is performed every 5° within one power frequency cycle. With N set to 72, the sampling frequency for the two signals is 3.6kHz. 4.2 Program Flowchart The program flowchart is shown in Figure 3. [IMG=Program Flowchart]/uploadpic/THESIS/2007/12/2007121409141865128K.jpg[/IMG] 4.3 A/D Conversion Main Program As shown in Figure 2, the ALE of the 80C51 is used as the clock CLK of the ADC0809. The start signal START of the A/D converter and the 8-channel analog input address enable signal ALE are provided by the microcontroller's write signal WR and address decoding output signal logic. The ADC0809 is used as an I/O expansion port of the 80C51 microcontroller. P2.6 is active low as the chip select signal, so the address channels IN0 and IN1 are BFF8H and BFF9H respectively. Since this design has two inputs, B and C are grounded. Each time an output instruction is executed, one channel is selected to initiate an A/D conversion. After the microcontroller initiates the A/D conversion, it waits for 128μs before reading the conversion result from the ADC0809. The conversion procedure is as follows: [IMG=Conversion Procedure]/uploadpic/THESIS/2007/12/2007121409142429368K.jpg[/IMG] MOVX@DPTR, A; Start IN1 input ACALL WAIT; Switch to delay subroutine MOVX A, @DPTR; Read voltage data MOV@R1, A; Store in buffer INCR1; Modify A/D conversion result storage address DJNZR2 LOOP1; If all A/D samples are completed, execute sequentially downwards, otherwise switch to LOOP1 Delay subroutine WAIT: MOV R3, #3EH; Delay 128μs DELAY: DJNZR3, DELAY RET 5 Conclusion Based on this, online simulation tests were conducted on the Wave simulator. The turns ratio of the current transformer and voltage transformer, and the amplification factor of the 50Hz bandpass filter circuit are all considered in the program design for solving the effective values ​​of voltage and current. The cosθ1 value is stored in the data storage area in advance. To ensure that the current and voltage values ​​are sampled within one cycle, the time setting of the delay program needs to be continuously corrected. To verify the test results, under the conditions of pure resistive and inductive loads of the switching power supply, the phase difference and effective value are monitored by connecting a CA8020 (20MHz) dual-trace oscilloscope and an EM2172 AC voltmeter after the 50Hz bandpass filter. The results show that the measured data is relatively accurate and fast, and has a high cost performance. It can be promoted for use as a laboratory digital power meter. References 1 Tang Tongyi, Lu Yaohai. The influence of distorted waveforms in power frequency power grids on the operation of some general instruments. Electrical Measurement and Instrumentation, 1983 (7) 2 Ren Guohai, Shang Hong et al. Development of non-sinusoidal power meter. 3. Cheng Zhaoji, He Qing. Measurement of non-sinusoidal electrical parameters by microcomputer sampling. Journal of Zhejiang University, 1992(5): 574-579. 4. Xie Jianying, Jia Qing. Microcomputer Control Technology. Beijing: National Defense Industry Press, 2001.
Read next

CATDOLL 136CM Vivian (Customer Photos)

Height: 136cm Weight: 23.3kg Shoulder Width: 31cm Bust/Waist/Hip: 60/54/68cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm An...

Articles 2026-02-22
CATDOLL 136CM Mila

CATDOLL 136CM Mila

Articles
2026-02-22
CATDOLL 115CM Alice TPE

CATDOLL 115CM Alice TPE

Articles
2026-02-22