Power quality is the standard to measure the quality of power grid. Power quality problems include sag, swell, spikes, harmonic distortion and electrical noise, among which harmonic distortion has the greatest impact on power quality. Therefore, the design of this system is to analyze the harmonic distortion. There are many researches in this area, and the corresponding equipment has been developed. In the past, most of the distribution network monitoring equipment used 51 and 96 Series MCU as the processor, which can not meet the requirements of power system in terms of accuracy and speed. In addition, it used ti’s DSP as the processor, and cooperated with ADC to complete the system design. ADI has listed ADE7753, ADE7758 and other special chips for power measurement, and successfully applied them to the power grid. Recently, ADI company has launched a high-performance combination, namely DSP + ADC power measurement scheme. This monitoring system is realized by this combination.
Figure 1 block diagram of system hardware design
Figure 2 software block diagram
Introduction to ADC
AD73360 is a special power quality monitoring IC developed by Adi company. Compared with the general ADC, AD73360 has the following advantages: six independent A / D conversion channels, which not only do not interfere with each other, but also strictly ensure the sampling synchronization; high precision, six 16 bit conversion precision conversion channels are very suitable for the needs of power quality monitoring. The sampling rate can be programmed in the range of 8kHz, 16KHz and 32kHz, which can adapt to a wide range. AD73360 provides DC / AC and single ended / differential input modes to adapt to different situations. It adopts serial interface and is easy to connect with DSP chip. No matter from the accuracy, speed, number of sampling channels or the realization of synchronous sampling, the use of AD73360 in power monitoring system is an ideal choice.
Brief introduction of DSP
Hardware circuit design
The hardware design of the whole system takes adsp2191m and AD73360 as the core, and is completed with peripheral circuit. The block diagram of hardware design is shown in Figure 1.
As can be seen from Figure 1, the hardware design of the system is very simple, and there is no most troublesome synchronization circuit and the expansion of system storage space. This is because AD73360 can achieve multi-channel synchronous conversion, which eliminates the design of synchronous holding circuit. Adsp2191m has 64K ram, which can meet the requirements of system design. In the hardware design of the system, the sensor is used to convert the power signal of distribution network parameters into the input signal of ADC, and then send it to AD73360 for synchronous sampling. The converted sampling data is transmitted to DSP processor through synchronous serial port for data processing, harmonic analysis and other operations. Finally, the processor sends the analysis results to LCD for display, and sends them to PC through serial port for corresponding processing. Flash is used to store system code.
In the whole system design, flash and LCD are the basic system expansion, and asynchronous serial port is the basic development. Here we only introduce the connection between DSP processor and ADC. They must pass through the serial interface. Adsp2191m is a 6-wire serial mode, while AD73360 is a 5-wire serial mode. The difference between them is that the former’s serial clock is divided into serial port sending clock and serial port receiving clock, which are independent of each other, while the latter is combined into two. Comparing the timing chart, we can find that the timing of the two is basically the same, but in order to control AD73360, the processor must be able to meet the following requirements: the working mode of the serial port can be set to the external clock mode, the word length of the serial port can reach 16bit, each word sent and received has a synchronous frame signal, for the processor, the received synchronous frame signal is the input signal, and the sent synchronous frame signal is the input signal The frame synchronization signal is generated in the previous clock cycle of the high bit of the serial port word, and the frame synchronization signal is highly effective. As a similar processor of AD73360, adsp2191m can easily meet the above requirements by setting.
Figure 3 Comparison of hardware system analysis and theoretical analysis
System software design the software design of the system is complex, which is divided into a / D sampling control, LCD control, serial port transmission, data processing and harmonic analysis algorithm. The whole software block diagram is shown in Figure 2. Among them, the harmonic analysis algorithm has the largest amount of code and is the most important, which is used to analyze the power quality of distribution network; flash driver code is used to drive stm29w040, which is not used in system monitoring, but used to download program code. In the language selection of system development code, DSP assembly language and C language are combined, with C language as the main language and assembly language as the auxiliary language. 219x_ int_ tab.asm File processing: before introducing the whole system process, first introduce 219x_ int_ tab.asm Documents. When the software main function exists in the C file, 219x_ int_ tab.asm The file system defaults to be a part of the project and initializes the interrupt vector of the project. When the interrupt occurs, the program pointer jumps to the corresponding position of the file, and passes the___ lib_ int_ The determiner function is used to find the entry of interrupt service program. Once the entry of interrupt service program is not found, it will cause program deadlock and cannot run normally. However, it is more complex to implement interrupt function with C language. In order to improve the speed of system development and reduce the system code, 219x should be used in system development_ int_ tab.asm The function can be completed by modifying the interrupt vector table in and giving the interrupt service program entry directly to the interrupt vector table. The development tool of the system software is viusaldsp + + 3.0. In the software design, the most important is the design of harmonic analysis algorithm. Because it is the core of software design, it not only has a large amount of code, but also is one of the decisive factors of system measurement accuracy. In this scheme, the mature FFT (fast Fourier algorithm) is used as the harmonic analysis algorithm of the system. At the same time, in order to suppress the fence effect and spectrum leakage of FFT algorithm, Hanning window and interpolation algorithm are added. Because of the large amount of code, the source code is not given here. In the software design of the system, two interrupts are used: synchronous serial port sending interrupt and synchronous serial port receiving interrupt. The former is used to configure AD73360, and the latter is used to read the converted sampling data from AD73360. Their code is not detailed here. In addition, the system also develops asynchronous serial port, programmable mark pin and LCD control waiting, which makes the whole system more intelligent and humanized. I will not introduce them one by one here.
Comparison between system analysis and software analysis
After the development of the system, in order to test the results of system analysis, the method of comparison with software analysis is used. The original data in time domain is imported into Matlab software, and a group of corresponding time domain waveform, amplitude spectrum and phase spectrum can be obtained by analyzing the data with FFT algorithm in the software. By comparing these figures with the corresponding figures obtained from the system hardware analysis in the DSP system, we can see the difference between the hardware system analysis and the theoretical analysis. Figure 3 is a comparison of these figures. The original data analyzed by DSP hardware system and MATLAB software are the same, but their analysis methods are different: one is the algorithm of system development, the other is the tool of software, so we can audit the reliability of the algorithm of development system by comparison. It can be seen that in the comparison diagram, the waveform, amplitude and phase spectrum of the time domain signal obtained by the development system are quite consistent with the analysis results of MATLAB software. Limited to space, the final analysis data is no longer detailed. In order to compare the credibility of the system, the method of multiple analysis can be used. Through the analysis and comparison of data, it can be seen that although different analysis systems are used, the error of the two results is very small and basically the same, which indicates that the hardware monitoring results of the system have considerable reliability.
Taking AD73360 and adsp2191m processor as the hardware core of the system, the system has the following characteristics:
1. The hardware design of the system is simple, easy to implement and low cost.
2. The system has no external expansion SRAM, so the hardware requirement is relatively low.
3. The system software can be easily upgraded by using DSP processor without interface resources.
4. The software design of the system adopts the combination of assembly and C language and windowed interpolation FFT algorithm, which can improve the speed of code development and the overall measurement accuracy of the system. From the comparison results, the scheme meets the requirements of power system, has high reliability, and can at least meet the real-time sampling of 160 points per cycle.
Editor in charge: GT