Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

Smart test

Hardware and software realization method of power quality monitoring and recording analyzer

With the continuous expansion of the scale of the power system and the continuous increase of modern equipment, especially the application of a large number of non-linear power loads, such as semiconductor rectifiers, inverters, electric arc furnaces, electrified railways, various semiconductor voltage regulation and frequency conversion devices, and household appliances, etc. , The voltage waveform of the power grid is distorted, causing serious interference and pollution to the power quality. Power supply companies and power users are paying more and more attention to the issue of power supply quality in consideration of safety production and economic benefits. Therefore, it is necessary to monitor and record various power supply parameters of the power grid and analyze the power quality of the power grid.

This paper proposes a design scheme of power quality monitoring and recording analyzer based on STM32F4 embedded smart meter mode, which integrates basic power measurement, power measurement, power quality analysis, power monitoring and recording, event alarm and event recording. It can be used for single-phase measurement as well as multi-phase measurement in three-wire and four-wire distribution networks. It can accurately and reliably record various power parameters and provide important data for evaluating the power status of the factory and the quality of the distribution network. STM32F4 is a 32-bit high-efficiency digital signal controller based on the ARM Cortex-M4 core. It supports single-precision floating-point arithmetic instructions and enhanced DSP processing instructions, and has outstanding dynamic power control and rich on-chip resources, which facilitates hardware design and The hardware cost is reduced, the design is simpler and more reliable, and it has higher application value.

The overall design scheme of power quality monitoring, analyzing and recording instrument
The power quality monitoring and recording analyzer is designed according to the power quality related standards formulated by the country, and the system block diagram is shown in Figure 1. The system collects voltage and current through the signal sampling AD conversion module. After the digital signal controller obtains the sampling data, it calculates and analyzes real-time electrical parameters, displays the results on the TFT LCD screen, and triggers the corresponding logic control according to the calculated parameters. SD card, NAND FLASH and ferroelectric memory record parameters, provide 4 analog output interfaces, 1 RS485 interface and 1 Ethernet interface to transmit data, provide USB interface to transfer historical data, reserve DB9 printing interface to expand the micro The printer prints out the historical data curve.

Main functions of the system
1. Basic power measurement
It can measure voltage, current, active power, reactive power, apparent power, power factor and frequency.
2. Harmonic measurement
It can measure voltage and current harmonic content up to 63 times.
3. Demand measurement
Interval type and slip type are optional.
4. Electric energy measurement.
Multi-rate active energy/reactive energy/apparent energy can be measured.
5. Power quality analysis
It can analyze phase shift angle/phase angle/total harmonic distortion voltage/total harmonic distortion current/voltage harmonic/current harmonic/distortion current intensity/asymmetric voltage/current, etc.
6. Power monitoring and recording
It can monitor and record the load curve, apparent/active/reactive power average value/minimum/maximum value and other power parameters.
7. Event alarm and event record
Alarm parameters can be set for each power, including the maximum number of events/priority control/selectable alarm level, etc., and you can choose whether to record.

Hardware Design Scheme of Power Quality Monitoring, Recording and Analyzer
1. Introduction to STM32 F4 digital signal controller
The system is based on STMicroelectronics' outstanding STM32F407ZET6 high-performance microcontroller based on ARM Cortex M4 as its core. Its operating frequency is 168MHz, integrated single-cycle DSP instructions and single-precision floating-point arithmetic unit, built-in 512MB flash memory and 192KB SRAM has a wealth of on-chip peripherals, including FSMC (variable static memory controller), SDIO interface, USB interface, Ethernet interface, I2C interface, UART interface and internal clock used in this system. Compared with similar microprocessors on the market, it has the advantages of strong functions, low price, and convenient development and use.

2. Data acquisition module design
The front-end sampling circuit is shown in Figure 2 and Figure 3. The voltage and current sampling uses high-precision voltage and current transformers, which are small in size, high in precision, fully enclosed, and have strong isolation and withstand voltage capabilities. After the transformer converts the voltage and current into a small signal, it is sent to the AD chip for conversion through a second-order low-pass filter. The AD chip selects the high-precision 16-bit AD chip ADS8568SPMR, the reference voltage is 2.5V, and the 8-channel synchronous sampling, the conversion rate meets the system's demand for fast sampling conversion, and the signal-to-noise ratio reaches 91.5dB.
Front-end sampling circuit (1)
Figure 2 Front-end sampling circuit (1)
Front-end sampling circuit (2)
Figure 3 Front-end sampling circuit (2)
3. Storage design
The system storage is divided into the following four parts:
① NAND FLASH selects Samsung K9F1G08U0D, which is connected to BANK2 of the microcontroller FSMC, with 128MB large-capacity storage space for storing pictures, system parameters and various events, and also for power recording when the system lacks an SD card.
②The SD card adopts the on-chip SDIO interface of the microcontroller to store historical power record data, and can support a maximum capacity of 4GB.
③U disk storage is realized through the physical layer chip USB3300-EZK and the on-chip USB peripherals of the microcontroller, which is used for data transfer and on-site upgrade of programs, libraries, and parameters.
④FRAM ferroelectric memory FM24C64B, which is connected to the microcontroller through the I2C bus, is used to store real-time energy data and provide power-off memory function for electricity recording.

4. Display module design
The system uses a 3.5 in 16-bit color TFT LCD screen as the display output, with a resolution of 320×240, which can clearly display data and curves. Use RA8875 as a display driver chip, provide a low-cost 8080 parallel microcontroller interface, built-in 768kB display memory, support 2D BTE engine can handle the conversion and transmission of a large number of graphics data, and built-in geometric graphics acceleration engine, which can save a lot of money Time for users to develop software and improve the execution efficiency of microcontroller software.

5. Communication module design
The system uses RS485 and Ethernet two physical media for networking communication. The RS485 communication interface adopts high-speed optocoupler for isolation, and the stable communication baud rate can reach up to 38.4 Kbit/s, and the interface is protected against overvoltage through transient suppression diodes, as shown in Figure 4.
Overvoltage protection circuit
Figure 4 Overvoltage protection circuit
The Ethernet communication interface adopts on-chip Ethernet peripherals through simplified media independent interface (RMII) and external fast physical layer LAN8720 A chip. The RJ45 interface integrates a signal transformer with a voltage ratio of 1:1 to achieve signal isolation protection and improve communication The anti-jamming performance, the specific implementation principle is shown in Figure 5.
Ethernet communication interface circuit
Figure 5 Ethernet communication interface circuit
Software design scheme of power quality monitoring, recording and analyzing instrument
1. The overall design of the system software
The software design is based on the RealView MDK4.23 development platform, and debug code is connected to the target board through JLINK V8. The system flow chart is shown in Figure 6. The software is mainly composed of the following modules:
①Initialization and self-checking module
Responsible for the initialization and self-checking of each functional module and all parameters of the system. The system parameters are self-checked by the sum check method with check factor, and there are two backup areas. When the parameter check error occurs, the backup parameters will be obtained. Both backup parameters are invalid, and the system will alarm and display the fault code to minimize the probability of system errors.
②Key processing
Responsible for the analysis of 6 function keys, and perform corresponding operations through the analysis results.
③Event management module
Responsible for the management of all periodic and sudden events, including calculation of power parameters, display processing, clock signal processing, storage management, logic control, transmission output and print output, etc.
④RS485 communication processing
Responsible for the receiving, unpacking and sending of communication data, using the standard Modbus-RTU protocol.
⑤Ethernet communication processing
Responsible for polling processing of Ethernet status, and processing UDP and TCP data messages, which also use Modbus RTU protocol.
⑥Interrupt handler
Responsible for fast AD sampling, RS485 communication data receiving and sending, and logic processing.

2. Sampling data processing
①Calculation of basic power parameters
The system performs synchronous sampling on the input voltage and current signals to avoid phase errors caused by asynchronous sampling. Sampling 256 points per cycle, that is, the sampling frequency is 12800 Hz. In order to monitor each cycle in real time, the processor must complete the calculation of the electric quantity within one cycle to ensure that the recording can be started when there is a sudden change in voltage and current, and the data of 4 cycles before the fault and 5 cycles after the fault are recorded.

The formula for calculating the effective value of voltage and current is
, Where x[n] is an array of discrete sampling values of voltage and current; N=256 is the number of sampling points per cycle, the same below.
The active power calculation formula is
, Where u[n] is the voltage sampling value array; i[n] is the current sampling value array. Reactive power calculation methods are divided into two methods: cross-phase 90° reactive power and natural reactive power, which can be selected through system parameters. Other basic parameters can be calculated by the above parameters, so I won't repeat them.

②Calculation of power quality parameters
Harmonic measurement is very important in power quality analysis. When performing digital sampling spectrum analysis, due to the fluctuation of grid frequency, if fixed frequency sampling is used, it will cause non-full-period sampling and cause spectrum leakage. The range of harmonics measured by the system is 1-63 harmonics. The measurement error caused by the high-order harmonic spectrum leakage is often small, and the spectrum leakage of the fundamental wave has a greater impact on the adjacent low-order harmonics. Therefore, this system uses software Frequency tracking technology adjusts the sampling period in real time according to the measured frequency to ensure the integrity of the sampling period, so that the harmonic accuracy calculated by FFT can meet the international Class B requirements.

In order to distinguish between transient phenomena and harmonics, each measurement result can be an average value within 3s. The calculation formula is
, Where Uhk is the root-mean-square value of the h-th harmonic measured at the kth time in 3s; m≥6 is the number of evenly spaced measurements in 3s.
The formula for calculating voltage harmonic content rate is
, In the formula, U1 is the fundamental wave voltage; Uh is the hth harmonic voltage.
Voltage total harmonic distortion rate
, Where H is a specific order of harmonics, and 63 is here.
Corresponding current parameters can be deduced by analogy. In addition, the system can also provide current and voltage crest factor, current K factor and other parameters as a reference for the quality of power.

3. Electricity record
The system can record the measured basic power parameters, and the recording interval is fixed at 1s. The system continuously writes the recorded data to the ferroelectric memory (the data will be supplemented when the power is turned on after the power is off), and when the data volume reaches 4kB bytes, it will be written to the NAND FLASH in the form of a file. If the NAND FLASH storage space is already If it is full, it will be written into the external memory SD card. If the SD card is not detected, the NAND FLASH space will be covered cyclically.

This article introduces the hardware and software implementation methods of Changhui Meter's power quality monitoring and recording analyzer. Adopt STM32F4 microprocessor with DSP and floating point operation unit and 16-bit high-speed synchronous sampling AD chip to ensure the processing speed and data sampling speed of the system, provide comprehensive and high-precision power grid parameters, and make full use of the microprocessor On-chip resources provide abundant and flexible external interfaces, which not only reduces hardware costs and R&D investment, but also facilitates users' use. In short, the system has the advantages of comprehensive functions, accurate measurement, convenient operation and easy installation, and has a very broad application prospect.

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code