Tutorials to .com

Tutorials to .com » Mechine » Dsp » DNP3.0 in DSP-based realization of the FTU

DNP3.0 in DSP-based realization of the FTU

Print View , by: iSee ,Total views: 26 ,Word Count: 2003 ,Date: Sun, 23 Aug 2009 Time: 4:02 AM

DNP (Distributed Network Protocol, the Statute of distributed network) is launched HARRIS a remote communication protocol, is the power system automation products on the market a mainstream communication protocol. It can be used as a FTU (Feeder Terminal Unit, Feeder Terminal Unit) and the distribution network between the main station of the Statute, but also as a master RTU and scheduling between the Statute. Since most of our distribution automation (DA) products support DNP3.0, to make our products more of compatibility and standards, FTU there is a need for DNP3.0 as part of its distribution network and the communication between the main station of the Statute.

FTU as a distribution automation system (DAS) in the important part, in addition to assume the most basic tasks of measurement and control, but also with the central sub-station or master station to communicate. FTU computer also has some protection, they are generally part of its core high-grade 16-bit or 32-bit single-chip microcomputer. However, in the case of the exchange of samples, single-chip computing U, I RMS, as well as P, Q and other parameters are often unable to, resulting in less real-time. Although it can be through the use of the main - from structure to solve, but it no doubt increase the cost. dsp (digital signal processor) is precisely a mathematical calculation (such as Fast Fourier Transform) and good, though inferior to its single-chip control functions, but only be responsible for monitoring all the way FTU column switch, they are in such a monitoring and control volume limited circumstances, if not in situ conservation of function, a DSP can do, or completely. TMS320F206 (hereinafter referred to as F206) is the production of TI's TMS320C2000 family of companies in the mainstream of a DSP, it is 16-bit fixed-point DSP, can be applied to motor control and industrial automation and electric power industries, prices close to the ordinary 16-bit single-chip microcomputer. TMS320F206 in a FTU as the core, supplemented by A / D converter and other peripheral devices to complete the monitoring and control, parameters such as computation and communication tasks.

DNP3.0 frame format as a result of the basic unit is the 8-bit integer (BYTE byte), while the F206 is a 16-bit data bus and addressing the basis of the word (WORD) for the unit, and provided by TI c language there is no 8-bit integer, so F206 platform DNP3.0 to achieve when there is a 8 / 16 issue of conversion. In addition, the majority of DSP using an external UART (Universal Asynchronous Receiver Transmitter) serial communication to achieve. This article focuses on how to ensure clear and efficient procedures under the premise of the use of F206-chip asynchronous serial DNP3.0 to realize the communication protocol for serial communication.

DNP3.0 in DSP-based realization of the FTU

About 1 DNP3.0 [4 ~ 5]

DNP3.0 to pure software communication protocols, and its structure as shown in Figure 1. It is based on the IEC 870-5 standard, the use of the ISO seven three-tier model: the physical layer, data link layer and application layer, the structure of the agreement to strengthen the structure. This hierarchical structure makes the reliability of data transmission greatly enhanced, but also to facilitate modular programming. Generally use the common physical layer of the RS232 or RS485; link layer using CRC checksum; In order to meet the longer packet transmission, but also adds a pseudo-transport layer. It can send data at the application layer will be a longer text, divided into a number of reported short-frame multi-frame and then send the other hand, when receiving the short frame assembled into a complete application layer messages.

2 System Hardware

2.1 Structure Diagram

Hardware block diagram shown in Figure 2.

2.2 F206-chip asynchronous serial port, introduced [2 ~ 3]

F206-chip with an 8-bit full-duplex asp (Asynchronous SerialPort, asynchronous serial port), to be completed in parallel data and serial data conversion, and can generate hardware interrupt can be shielded TXRXINT. Related to a total of 6 external pins: Send-side TX, the receiver RX, IO0, IO1, IO2, I03, generally use only the TX and RX is sufficient (in addition to a ground wire).

And programming the chip a total of 16 registers 4: send and receive asynchronous data register ADTR, asynchronous serial port control register AS-PCR, I / O status register IOSR, baud rate divisor register BRD, are mapped to I / O space. ADTR for read / write registers, high-hang 8 to 0, to write ADTR send serial data to start. ASPCR used to control the way the work of serial port, BIT8 Send Interrupt Mask for TIM, BIT7 receive Interrupt Mask for RIM, BIT6 Choice to stop STB. IOSR reflect the work of the state of the serial, BITll instructions for sending register empty bit THRE, BIT8 ready to receive data bit DR. BRD for the baud rate generator, BRD value = CLKOUTl frequency / (16 × baud rate).

It is worth noting that, F206-chip universal asynchronous serial port with a slightly different serial port. It supports the most common bit of a start, 8 data bits, 1 or 2 stop bits. Also not to support some special format, such as 6 or 7 data bits, stop bits, etc. 1.5. In order to meet the scene of possible means of communication should also be extended all the way over the Universal Asynchronous Receiver Transmitter (UART), in this case the use of TI's single-channel asynchronous serial TLl6C550. There are many such chips on the article introduced shall not repeat them here.

DNP3.0 in DSP-based realization of the FTU

3 software

3.1 programming language

DSP using C++ language to develop procedures to improve the readability and portability is not only good, but also greatly accelerate the pace of development. However, using C language to achieve better control of some hardware to facilitate the compilation, and not as good as real-time compilation [1]. Therefore the use of procedures in the C language compilation directly embedded communication module to complete the preparation process, with the exception of a very small number of non-use of assembly language, the vast majority of the use of C language.

3.2 Data structure definition

As a result of the F206 for the 16-bit data bus, therefore the C language to provide TI (hereinafter referred to as TI C) with the standard C language data type is slightly different. char, unsigned char, int and short are 16-bit, enum for 16. Accordingly, sizeof (int) and sizeof (short) the results of 1, not 2, this point is particularly important when calculating the frame length, used to standard C programming staff must pay particular attention to.

DNP3.0 frame format as a result of the basic unit is the byte, and the TI C did not this year; according to the type of structure types with specific data structure definition, are based on the word (WORD) aligned, DNP3.0 Therefore only data format BYTE is defined as the 16-bit unsigned integer WORD, the WORD will DNP3.0 defined as 32-bit unsigned integer DWORD. Will each receive data bytes are stored to a low of 8 characters, send check every word, when only the low 8-bit, so that while half of wasted memory space, but the programming easier, and higher efficiency.

DNP3.0 hierarchy in accordance with the definition of the three structures - the link layer DL_LAYER, transport layer application layer T_LAYER and APP_LAYER, each structure and then the corresponding layer in accordance with the provisions of DNP3.0 field corresponding to each member of the definition of can be. If the link layer, including header and data block n, the initial header also includes the word length, such as the control field byte, control byte and bit by bit, including functional code, the direction of bit and frame count and so on. Link-layer structure is defined as:

(1) DL Layer Control word

typedef struct{
WORD b0-3_FuncCode:4,/**/
b4_FCV:1 /**/
b5_FCB:1, /**/
b6_PRM:l /**/
b7_DIR:1; /**/
}DL_CONTROL;

(2) DL Layer header

typedef struct{
DWORD dwStart; /**/
WORD wLength; /**/
DL_CONTROL DLCtrl; /**/
DWORD dwDest; /**/
DWORD dwSource; /**/
DWORD dwCRC; /**/
}DL_HEADER;

(3) DL-storey block

typedef struct{
WORD awUserData[l6] /**/
DWORD dwCRC; /**/
}DL_DATABLOCK;

3.3 The flow chart

DNP3.0 detailed provisions of the agreement has been the level of structure and function of each layer, as long as the procedures consistent with the hierarchy will be very clear, only in accordance with the programming of data between these levels flow to the preparation of the corresponding function. The corresponding physical layer transceiver serial interrupt subroutine, link layer, transport layer and application layer in the reception and transmission at the time of a function to deal with in order to correspond to the full-duplex serial port work. Among them, the link layer receiver processing as shown in Figure 3.

DNP3.0 in DSP-based realization of the FTU

3.4 ASP procedures

Register definition 3.4.1 ASP

ioport unsigned portFFF4;
#define ADTR portFFF4 /**/
ioport unsigned portFFF5;
#define ASPCR poaFFF5 /**/
ioport unsigned portFFF6;
#define IOSR poaFFF6 /*I/O*/
ioport unsigned portFFF7;
#define BRD portFFF7 /**/

3.4.2 Initialization ASP

void InitASP(){ /**/
ASPCR=0xE080; /*RIM=1L:,
STB=0:*/
IOSR=0xl800; /*THRE=1:ADTR*/
BRD=0x0020; /*20MHz/38400bps*/
}

3.4.3 Asynchronous Serial groan off service subroutine

void interrupt aspint(){
if((IOSR & 0x0l00)==0x0l00){
Recv();} /**/
if((IOSR & 0x0400)==0x0400){
……;} /**/
if((IOSR & 0x0800)==0x0800){
Send();} /**/
*IFR=0x20; /**/;
asm("clrc INTM") /*/;
}

As a result of the F206-chip serial port as a communications tool that makes full use of DSP-chip peripherals, communication module not only higher reliability, and simple interface, ASP control and reading and writing can be completed through a number of registers very convenient. Using the methods described in this article prepared for the statute to DNP3.0 Subroutine process of communication clear and consistent with the requirements of modular. Since the site has been put into trial operation, the entire communication module work stable and reliable and able to respond quickly to the request of the main station, take the initiative to report data promptly and accurately. However, with the development of fieldbus technology, FTU should have at least one field bus interfaces (such as CAN bus interface). This does not guarantee the quality of communication, but also can simplify the communication protocol (only the application layer can be a), this should be a FTU communication development.


Digital Signal Processing Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.