# Patent

## Title
Method for making 32-bit addressing of SV data by utilizing FPGA

## Abstract

This invention relates to a method for making 32-bit addressing of SV data by utilizing FPGA, which may be applied to processing digital sampling data in an equipment of an intelligent substation. Specifically, the method includes the following steps: FPGA receiving naked SV data packages generated based on IEEE802.3 standard; analyzing data structure of Ethernet frame; based on characteristics of the Ethernet frame of the SV data, the SV data of the network byte sequence being reorganized by utilizing ASN.1 coding rules, so that the SV data being converted into a data that can be directly accessed by 32-bit addressing processors. As a result, SV data decoding efficiency is improved greatly. This invention may make the decoding efficiency of 32-bit addressing processor improved by 5-10 times, thus solve problem of declined efficiency due to processing network byte order by splitting and reorganization.

## Background
FIELD OF THE INVENTION
The present invention relates to digital technology in Smart Substation process layer, especially to SV data based on the ASN.1 coding rules.
BACKGROUND OF THE INVENTION
SV (sampling value) means digital sampling data transmitted on process layer of a smart substation in an intelligent grid. For SV Ethernet data based on Ethernet IEEE802.3, its sampling frequency of transmission is equal to or greater than 4000 Hz/s. This requires that the recipient has strong data processing ability.
The existing technologies mainly use an ordinary 8 bit addressing processor, which makes ASN.1 (Abstract Syntax Notation One) feature recognition and decoding bit by bit according to IEC61850-9-2 protocol. The decoding efficiency is not satisfactory. Furthermore, the data processing ability of the 8-bit addressing processor is far less than that of a specific DSP data processor with 32-bit addressing.
It requires that all data addresses should be aligned as per 32-bit format if 32-bit addressing is adopted and a DSP with large on-chip cache is used. In this way, the data to be processed can be read out in one read cycle. To achieve this, the SV Ethernet data conforming to IEC61850-9-2 protocol should be split and reorganized to form 32-bit aligned data by a method of programming DSP application software. However, this method not only increases the complexity and difficulty of the DSP application software, but also causes a dramatic decline in decoding efficiency, which leads to a poor overall performance of the SV data processing.
SUMMARY OF THE INVENTION
In order to overcome the deficiencies described above, the present invention provides a method of making 32-bit addressing of the SV data by using a FPGA (Field-Programmable Gate Array). It is to add a FPGA before a high-performance DSP with 32-bit addressing so as to split and reorganize the SV data according to IEC61850-9-2 protocol, thus to provide direct 32-bit addressable data to DSP. As a result, the data processing capability of the DSP is fully taken advantage of.
The present invention is to use a FPGA to align and reorganize Ethernet frame headers as per 32-bit according to SV data characteristics of IEC61850-9-2 protocol; the Application Protocol Data Unit (APDU) of the SV data is reorganized according to characteristics of the coding rules of ASN.1 thus 32-bit aligned data is formed; after that, the data is read out by the DSP with 32-bit addressing.
The present invention provides a method of making 32-bit addressing of the SV data by using a FPGA, in which the FPGA converts the received SV data conforming to IEC61850-9-2 protocol into data that may be read directly by 32-bit addressing processor. The method comprises the following steps:
(1) using a FPGA to receive Ethernet data;
(2) the FPGA screening the received data through Ethernet message type code; a data with message type code of 0x88BA refers to SV data, which is further processed through the following steps (3) and (4);
(3) memory units aligned in 32 bits being allocated for saving contents of Ethernet frame header in the SV data, data being copied during which data less than 32 bits is extended by filling 0, which is then saved in a memory; In the saved data, media access control data occupies three 32-bit units, while other data occupies one 32-bit unit; The contents of the Ethernet frame header include the following data: media access control data (MAC), priority and tags (Priority & tagged), datagram type code (Ethertype), application identity (APPID), length (Length), and reserved word (Reserved);
(4) Application protocol data unit (APDU) in the SV data is being reorganized by using 32-bit alignment, which is achieved by: according to the IEC61850-9-2 protocol, the application protocol data unit in the SV data consists of a number of data units created based on Abstract Syntax Notation One (i.e. ASN.1) coding rules; the tag and length information of each data unit created based on the ASN.1 coding rules are used to create a 32-bit data and one memory unit aligned in 32 bits is allocated to save it; data value is stored starting from next 32-bit memory unit; if any data unit created based on the ASN.1 coding rules is embedded in the data value, the foresaid procedure is repeated;
(5) The SV data reorganized through the steps (3) and (4) being transmitted to and read out by data processer DSP, wherein all the reorganized SV data are 32-bit aligned and stored.
The beneficial effects of the present invention are as follows:
The SV data being reorganized as 32-bit aligned one by FPGA may maximize the performance of DSP and greatly simplify the complexity and difficulty of DSP application software. The present invention may make the decoding efficiency of 32-bit addressing processor improved by 5-10 times, thus solve the problem of efficiency decline due to processing network byte order by splitting and reorganization.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows a flow chart of the method according to one embodiment of the present disclosure;
FIG. 2 shows a SV message frame format in IEC61850-9-2 protocol;
FIG. 3 shows a format of APDU of the SV data (each data unit created based on the ASN.1 coding rules); and
FIG. 4 shows the ASN.1 coding rules in IEC61850-9-2 protocol.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
The disclosure will be explained more fully below in connection with a preferred embodiment and with reference to the drawings.
The FPGA data flow of the method of utilizing FPGA to achieve 32-bit addressing for SV data is shown in FIG. 1, which includes five parts: (I) receiving Ethernet message; (II) screening SV (sampling value) data from Ethernet message; (III) making frame headers of SV Ethernet message 32-bit aligned and reorganized; (IV) making APDU of SV Ethernet message 32-bit aligned and reorganized; (V) outputting reorganized SV Ethernet message.
(I) Receiving Ethernet Message;
FPGA reads Ethernet message based on IEEE802.3 protocol from Ethernet physical layer chip PHY through media access control (MAC).
(II) Screening SV (Sampling Value) Data from Ethernet Message;
There are many kinds of Ethernet messages based on IEEE802.3. IEEE copyright registration organization registered an Ethernet type code based on ISO/IEC 8802-3 MAC sub layer, wherein Ethernet type code of the SV message is 0x88BA. FPGA screens SV data by the Ethernet type code.
Since the SV Ethernet message consists of message frame header and application protocol data unit APDU (see FIG. 2), the two parts adopt different strategies for 32-bit alignment and reorganization of data. 32-bit data alignment and reorganization of the two parts is illustrated as follows.
(III) Making Frame Headers of SV Ethernet Message 32-Bit Aligned and Reorganized;
Memory units aligned in 32 bits are allocated for saving contents of Ethernet frame header in the SV data, data being copied during which data less than 32 bits is extended by filling 0, which is then saved in a memory; In the saved data, media access control data occupies three 32-bit units, while other data occupies one 32-bit unit; The contents of the Ethernet frame header include the following data: media access control data (MAC), priority and tags (Priority & tagged), datagram type code (Ethertype), application identity (APPID), length (Length), and reserved word (Reserved).
(IV) Making APDU of SV Ethernet Message 32-Bit Aligned and Reorganized;
Application protocol data unit APDU (see FIG. 3) consists of a plurality of data units according to the ASN.1 coding rules. The most important part of the present invention is that the application protocol data unit in the SV data is reorganized by using 32-bits alignment according to ASN.1 coding features, which reorganizes each data unit as 32-bit aligned data. Abstract Syntax Notation One (ASN.1) is a symbol used to describe information exchange between application communication programs, of which a basic format is TLV group. A TLV represents value of a variable: <Tag, Length, Value> and may be nested (see FIG. 4). In the present invention, a 32-bit data is composed of tag and length information of each data unit created based on the ASN.1 coding rules and one memory unit aligned in 32 bits is allocated to save it; data value of each data unit created based on the ASN.1 coding rules is stored starting from next 32-bit memory unit. Any data unit created based on the ASN.1 coding rules and embedded in the data value will be 32-bit aligned and reorganized again as per the above procedure. Each reorganized data unit according to the ASN.1 coding rules is described as:















typedef struct {



 uint32  tag:8;



 uint32  bytes_num:16;



 uint32  dwords_num:8;



 uint32  value[0...255];



} tAsn1Buff;










Among them, tag is “Tag” of the data unit according to ASN.1 coding rules, which accounts for the first 8 bits of the first 32-bit data; bytes_num is “Length” of the original data of the data unit according to ASN.1 coding rules, which accounts for the next 16 bits of the first 32-bit data; dwords_num is number of 32-bit memory units needed to store the data unit according to ASN.1 coding rules, which accounts for the last 8 bits of the first 32-bit data; value[0 . . . 255] is “Value” of the data unit according to ASN.1 coding rules. During this process, data less than 32 bits is extended by filling 0. Furthermore, if any data unit created based on the ASN.1 coding rules is embedded in the data value, it will be processed as per the described method.
(V) Outputting Reorganized SV Ethernet Message
The reorganized data is stored in FPGA memory and FPGA tells data processor DSP to read the data.

## Claims

1. A method for making 32-bit addressing of Sampling Value (SV) data by using a Field Programmable Gate Array (FPGA), in which the FPGA converts the received SV data conforming to IEC61850-9-2 protocol into data that may be read directly by 32-bit addressing processor, wherein the method comprises the following steps:
(1) using the FPGA to receive Ethernet data;
(2) the FPGA screening the received data through Ethernet message type code; a data with message type code of 0x88BA refers to SV data, which is further processed through the following steps;
(3) memory units aligned in 32 bits being allocated for saving contents of Ethernet frame header in the SV data, data being copied during which data less than 32 bits is extended by filling 0, which is then saved in a memory; In the saved data, media access control data occupies three 32-bit units, while other data occupies one 32-bit unit; The contents of the Ethernet frame header include the following data: media access control data (MAC), priority and tags (Priority & tagged), datagram type code (Ethertype), application identity (APPID), length (Length), and reserved word (Reserved);
(4) application protocol data unit (APDU) in the SV data being reorganized by using 32-bit alignment, which is achieved by: according to the IEC61850-9-2 protocol, the application protocol data unit in the SV data consists of a number of data units created based on Abstract Syntax Notation One (ASN.1) coding rules; the tag and length information of each data unit created based on the ASN.1 coding rules are used to create a 32-bit data and one memory unit aligned in 32 bits is allocated to save it, wherein data for each of the tag information and length information is 32 bits; data value is stored starting from next 32-bit memory unit; if any data unit created based on the ASN.1 coding rules is embedded in the data value, the foresaid procedure is repeated;
(5) The SV data reorganized through the steps (3) and (4) being transmitted to and read by data processer DSP, wherein all the reorganized SV data are 32-bit aligned and stored.

2. The method according to claim 1, wherein the SV data is converted into 32-bit aligned data according to the ASN.1 coding rules so as to be read directly by 32-bit addressing processor for processing digital sampling value conforming to IEC61850-9-2 protocol.