CN110830466B - Method and device for framing DL/T645 protocol message based on XML - Google Patents
- ️Fri Jan 28 2022
CN110830466B - Method and device for framing DL/T645 protocol message based on XML - Google Patents
Method and device for framing DL/T645 protocol message based on XML Download PDFInfo
-
Publication number
- CN110830466B CN110830466B CN201911064856.4A CN201911064856A CN110830466B CN 110830466 B CN110830466 B CN 110830466B CN 201911064856 A CN201911064856 A CN 201911064856A CN 110830466 B CN110830466 B CN 110830466B Authority
- CN
- China Prior art keywords
- frame
- message
- field
- node
- array Prior art date
- 2019-11-04 Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 29
- 238000009432 framing Methods 0.000 title claims abstract description 17
- 238000003491 array Methods 0.000 claims description 39
- 238000012545 processing Methods 0.000 claims description 16
- 230000006870 function Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 3
- 238000004590 computer program Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/03—Protocol definition or specification
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/26—Special purpose or proprietary protocols or architectures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Communication Control (AREA)
Abstract
The application provides a method and a device for framing a DL/T645 protocol message based on XML. The method comprises the following steps: after receiving a message sent by a remote end, reading an XML document of the message, and determining structural information of the message according to the XML document of the message; analyzing frame field nodes in the frame message nodes according to the structural information of the message to obtain attribute values of the frame field nodes; and then creating a character array, assigning values to the character array according to the attribute values of the frame field nodes to form a target message, and sending the target message to a destination address. Therefore, no matter whether the DL/T645 protocol message is self-defined by a manufacturer or not, the DL/T645 protocol message can be framed, so that the structure of the DL/T645 protocol message is uniformly described, and the deviation in understanding partial content of the DL/T645 protocol is avoided.
Description
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for framing a DL/T645 protocol packet based on XML.
Background
The communication protocol of the multifunctional electric energy meter with the electric power industry standard DL/T645 is a communication protocol for unifying and standardizing the data exchange between the multifunctional electric energy meter and the data acquisition terminal equipment, so that electric energy meter manufacturers and power consumption information acquisition terminal manufacturers can perform information interaction with unified standards, thereby avoiding the repeated investment of equipment, simplifying the work flow of power consumption information acquisition of an electric power department, and accelerating the marketing modernization and the measurement standard standardization construction of the electric power department.
After the communication protocol of the DL/T645 electric energy meter is promulgated, most electric energy meters contain the DL/T645 protocol, but part of electric energy meters only contain custom protocols of manufacturers, and the understanding of part of contents of the DL/T645 protocol is prone to deviation. Therefore, it is necessary to describe the structure of the DL/T645 protocol packet uniformly, which requires framing the DL/T645 protocol packet.
Disclosure of Invention
The application provides a method and a device for framing a DL/T645 protocol message based on XML, which can be used for framing a self-defined DL/T645 protocol message.
In a first aspect, an embodiment of the present application provides a method for framing a DL/T645 protocol packet based on XML, where the method includes:
after receiving a message sent by a remote end, reading an XML document of the message;
determining the structure information of the message according to the XML document of the message;
analyzing frame field nodes in frame message nodes according to the structural information of the message to obtain attribute values of the frame field nodes;
creating a character array;
according to the attribute value of the frame field node, carrying out assignment on the character array to form a target message;
and sending the target message to a destination address.
Optionally, the structure information of the packet includes a protocol name, a protocol uplink and downlink identifier, a number of frame formats, and structure information of a plurality of frame format packet nodes of the packet; the number of the frame message nodes is consistent with the number of the frame formats.
Optionally, the structure information of the frame packet node includes a value of a frame type identifier node, a value of a byte number of a frame node, and structure information of a frame field.
Optionally, the structure information of the frame field includes attribute information of a plurality of fields.
Optionally, the attribute information of the field includes at least one of a position of the frame sequence in which the field is located, a length of bytes occupied by the field, a field name, a number of types of field functions, a field code, and a meaning of the field code.
Optionally, before analyzing the frame field node in the frame packet node according to the structure information of the packet and obtaining the attribute value of the frame field node, the method further includes:
creating an array of a plurality of frame types; the number of the array of the frame type is consistent with the number of the frame formats, and the array of the frame type is used for storing the structural information of the frame message node.
Optionally, analyzing a frame field node in the frame packet node according to the structure information of the packet to obtain an attribute value of the frame field node, including:
for a first frame message node, selecting an array of a target frame type from the arrays of a plurality of frame types, and assigning the value of the frame type identification node and the value of the frame byte number node to the array of the target frame type; the first frame message node is any one of the plurality of frame message nodes;
creating a plurality of variable arrays under the array of the target frame type; the number of the variable arrays is consistent with that of the fields, and the variable arrays are used for storing attribute information of the fields;
aiming at a first field, selecting a target variable array from a plurality of variable arrays, and assigning the position of a frame sequence where the field is located, the length of bytes occupied by the field, the field name, the field function type number, the field code and the meaning of the field code to the target variable array; the first field is any one of the plurality of fields;
and determining the attribute value of the frame field node according to the array of the assigned target frame type and the array of the assigned target variable.
Optionally, the creating a character array includes:
selecting a frame message node to be framed;
selecting a target assigned frame type array corresponding to the frame message node to be framed from the multiple assigned frame type arrays;
and creating a character array according to the value of the frame byte number node in the array of the frame type after the target assignment.
Optionally, the assigning the character array according to the attribute value of the frame field node to form a target packet includes:
selecting a field to be framed from the frame message node to be framed;
selecting a target assigned variable array corresponding to the field of the frame to be framed from the assigned variable data;
and assigning the character array according to the attribute information in the variable array after the target assignment to form a target message.
Optionally, before forming the target packet, the method further includes:
and converting the assigned character array into a byte array.
In a second aspect, an embodiment of the present application provides an apparatus for framing a DL/T645 protocol packet based on XML, where the apparatus includes:
the receiving unit is used for receiving a message sent by a far end;
the reading unit is used for reading the XML document of the message;
the processing unit is used for determining the structural information of the frame message node according to the XML document of the message; analyzing frame field nodes in the frame message nodes according to the structural information of the frame message nodes to obtain attribute values of the frame field nodes;
a creating unit for creating a character array;
the processing unit is also used for assigning the character array according to the attribute value of the frame field node to form a target message;
and the sending unit is used for sending the target message to a destination address.
Optionally, the structure information of the packet includes a protocol name, a protocol uplink and downlink identifier, a number of frame formats, and structure information of a plurality of frame format packet nodes of the packet; the number of the frame message nodes is consistent with the number of the frame formats.
Optionally, the structure information of the frame packet node includes a value of a frame type identifier node, a value of a byte number of a frame node, and structure information of a frame field.
Optionally, the structure information of the frame field includes attribute information of a plurality of fields.
Optionally, the attribute information of the field includes at least one of a position of the frame sequence in which the field is located, a length of bytes occupied by the field, a field name, a number of types of field functions, a field code, and a meaning of the field code.
Optionally, the processing unit is further configured to:
creating an array of a plurality of frame types; the number of the array of the frame type is consistent with the number of the frame formats, and the array of the frame type is used for storing the structural information of the frame message node.
Optionally, the processing unit is specifically configured to:
for a first frame message node, selecting an array of a target frame type from the arrays of a plurality of frame types, and assigning the value of the frame type identification node and the value of the frame byte number node to the array of the target frame type; the first frame message node is any one of the plurality of frame message nodes; and, creating a plurality of variable arrays under the array of the target frame type; the number of the variable arrays is consistent with that of the fields, and the variable arrays are used for storing attribute information of the fields; and aiming at the first field, selecting a target variable array from the multiple variable arrays, and assigning the position of a frame sequence where the field is located, the length of bytes occupied by the field, the field name, the field function type number, the field code and the meaning of the field code to the target variable array; the first field is any one of the plurality of fields; and determining the attribute value of the frame field node according to the array of the assigned target frame type and the array of the assigned target variable.
Optionally, the creating unit is specifically configured to:
selecting a frame message node to be framed; selecting a target assigned frame type array corresponding to the frame message node of the frame to be framed from the multiple assigned frame type arrays; and creating a character array according to the value of the frame byte number node in the array of the frame type after the target assignment.
Optionally, the processing unit is specifically configured to:
selecting a field to be framed from the frame message node to be framed;
selecting a target assigned variable array corresponding to the field of the frame to be framed from the assigned variable data;
and assigning the character array according to the attribute information in the variable array after the target assignment to form a target message.
Optionally, the processing unit is further configured to:
and converting the assigned character array into a byte array.
Therefore, in the embodiment of the application, the structural information of the message node is determined by reading the XML document of the message, the frame field node in the frame message node is analyzed to obtain the attribute value of the frame field node, then the character array is created, and the character array is assigned according to the attribute value of the frame field node to form the target message. By adopting the method, the DL/T645 protocol message can be framed no matter whether the DL/T645 protocol message is self-defined by a manufacturer, so that the structure of the DL/T645 protocol message is uniformly described, and the deviation of understanding the partial content of the DL/T645 protocol is avoided.
Drawings
Fig. 1 is a schematic flowchart corresponding to a method for framing a DL/T645 protocol packet based on XML according to an embodiment of the present application;
fig. 2 is a tree directory structure diagram of an XML document of a DL/T645 protocol packet according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a framing device for a DL/T645 protocol packet based on XML according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Fig. 1 exemplarily shows a flow diagram corresponding to a method for framing a DL/T645 protocol packet based on XML according to an embodiment of the present application. As shown in fig. 1, the method specifically comprises the following steps:
step 101, after receiving a message sent by a remote end, reading an XML document of the message.
Step 102, determining the structure information of the message according to the XML document of the message.
And 103, analyzing the frame field nodes in the frame message nodes according to the structure information of the message to obtain the attribute values of the frame field nodes.
Step 104, create a character array.
And 105, assigning the character array according to the attribute value of the frame field node to form a target message.
And step 106, sending the target message to a destination address.
Therefore, in the embodiment of the application, the structural information of the message node is determined by reading the XML document of the message, the frame field node in the frame message node is analyzed to obtain the attribute value of the frame field node, then the character array is created, and the character array is assigned according to the attribute value of the frame field node to form the target message. By adopting the method, the DL/T645 protocol message can be framed no matter whether the DL/T645 protocol message is self-defined by a manufacturer, so that the structure of the DL/T645 protocol message is uniformly described, and the deviation of understanding the partial content of the DL/T645 protocol is avoided.
In step 101 and step 102, the structure of the DL/T645 protocol packet is described in the following XML:
six child nodes may be included in one < frames > node. The first three child nodes are a specification name node (i.e., < name > node), a specification up-down identification node (i.e., < Sendmachanism > node), and a frame format number node (i.e., < frame > node), respectively. Since there are 3 types of DL/T645 reduced packet frame formats, the structure information (i.e., < frame > nodes) describing each packet node in detail is all from the fourth node to the sixth node.
Each frame packet node (i.e., < frame > node) may contain three nodes, respectively, a frame type identifier node (i.e., < frameType > node), a frame byte number node (i.e., < frameLength > node), and a frame field node (i.e., < framebody > node).
Each frame field node (i.e., < framebody > node) may contain a plurality of field nodes (i.e., < Subdata > node), which may contain six node attributes, respectively, the position (position) of the frame sequence in which the field is located, the length (length) of the field in bytes, the field name (extension), the number of field function types (Functiontype), the field code (code), and the meaning (mean) of the field code.
In order to more clearly describe the XML document of the message, it is described below with reference to fig. 2. Fig. 2 exemplarily shows a tree directory structure diagram of an XML document of a DL/T645 protocol packet according to an embodiment of the present application.
As can be seen from fig. 2, the structure information of the frame packet node may include a protocol name of the packet, protocol uplink and downlink identifiers, a number of frame formats, and structure information of a plurality of frame packet nodes. The number of the frame message nodes and the number of the frame formats can be consistent.
The structure information of the frame message node may include a value of a frame type identification node, a value of a byte number of the frame, and structure information of a frame field.
The structure information of the frame field may include attribute information of a plurality of fields. The attribute information of the field may include at least one of a position of a frame sequence in which the field is located, a length of bytes occupied by the field, a field name, a number of kinds of functions of the field, a field code, and a meaning of the field code.
Before step 103 is performed, arrays of multiple frame types may be created. The number of the frame type arrays can be consistent with the number of the frame formats, and the frame type arrays can be used for storing the structural information of the frame message nodes.
Taking the structure shown in FIG. 2 as an example, an array of three frame types may be created. The first array of frame type is used for storing the structural information of the frame message node 1, the second array of frame type is used for storing the structural information of the frame message node 2, and the third array of frame type is used for storing the structural information of the frame message node 3.
In step 103, for the first frame packet node, selecting an array of a target frame type from the arrays of the plurality of frame types, and assigning a value of a frame type identifier node and a value of a frame byte number node to the array of the target frame type. The first frame message node is any one of a plurality of frame message nodes.
A plurality of variable arrays are created under the array of the target frame type. And the number of the variable arrays is consistent with that of the fields, and the variable arrays are used for storing the attribute information of the fields.
And aiming at the first field, selecting a target variable array from the multiple variable arrays, and assigning the position of a frame sequence where the field is located, the length of bytes occupied by the field, the field name, the field function type number, the field code and the meaning of the field code to the target variable array. Wherein the first field is any one of a plurality of fields.
And determining the attribute value of the frame field node according to the array of the assigned target frame type and the array of the assigned target variable.
For example, the array of frame types created is denoted by fm, and fm [ N ] is a description of the link layer packet types for the DL/T645 specification, an array used in writing framing algorithms. Wherein, N represents the (N + 1) th message type, and N is an array subscript and starts counting from 0. DL/T645 defines three messages (i.e., frame message node 1, frame message node 2, and frame message node 3 shown in fig. 2), so three subscripts 0, 1, and 2 are used here.
Taking the frame message node 1 shown in fig. 2 as an example, the selected target frame node is fm [0], and then the value of the frame byte number node < frameLength > and the number of sub-nodes of the frame field node < framebody > are obtained and respectively assigned to the frameLength and framebody member variables in the target frame node fm [0 ]. A plurality of variable arrays are created under fm [0], representing fb [0], fb [1] … … fb [ m ], respectively, where m is the number of fields. For field 1 shown in FIG. 2, corresponding to fb [0], and so on, field 2 corresponds to fb [1] … …, and field m corresponds to fb [ m ]. Taking field 1 as an example, attribute information (i.e. the position of the frame sequence in which the field is located, the length of the byte occupied by the field, the field name, the number of field functions, the field code, and the meaning of the field code) obtained in field 1 is respectively assigned to array fb [0] in fm [0], and other fields can also be respectively assigned to fb [1] … … fb [ m ] in a similar manner, so that the frame message node 1 of the DL/T645 protocol message is analyzed.
For the frame message node 2 and the frame message node 3, the above-described method may be adopted for assignment, which is not described in detail.
In step 104, frame message nodes to be framed need to be selected first, then an array of target assigned frame types corresponding to the frame message nodes to be framed can be selected from the arrays of the plurality of assigned frame types, and character arrays are created according to the values of the number of frame bytes nodes in the array of the target assigned frame types.
Specifically, according to which frame format a frame of the DL/T645 protocol packet to be grouped belongs to, a corresponding frame format element fm [ n ] may be selected in the group fm, that is, any one of fm [0], fm [1], and fm [2] is selected; furthermore, a character array is created based on the number of bytes fm [ n ]. framelength contained in the frame of the frame format.
In step 105, a field to be framed may be selected from a frame message node to be framed, then a target-assigned variable array corresponding to the field to be framed may be selected from the plurality of assigned variable data, and then the character array is assigned according to each attribute information in the target-assigned variable array to form a target message.
Specifically, the corresponding framebody structure type elements fm [ n ]. fb [ m-1] can be selected in fm [ n ] in sequence according to the sequence number of each frame attribute in the frame structure in the frame format; and then according to the position fm [ n ]. fb [ m-1]. position of the byte corresponding to each frame attribute in the frame format structure in the frame sequence, giving the corresponding code corresponding characters to the elements in the character array in sequence.
Further, before the target message is formed, the assigned character array can be converted into a byte array, so that a complete frame is formed and can be sent.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Fig. 3 exemplarily shows a schematic structural diagram of a framing apparatus for a DL/T645 protocol packet based on XML according to an embodiment of the present application. As shown in fig. 3, the apparatus has a function of implementing the framing method for the DL/T645 protocol packet based on XML, and the function may be implemented by hardware, or by hardware executing corresponding software. The apparatus may include: a receiving
unit301, a
reading unit302, a
processing unit303, a creating
unit304 and a sending
unit305.
A receiving
unit301, configured to receive a message sent by a remote end;
a
reading unit302, configured to read an XML document of a message;
a
processing unit303, configured to determine structural information of a frame packet node according to the XML document of the packet; analyzing frame field nodes in the frame message nodes according to the structural information of the frame message nodes to obtain attribute values of the frame field nodes;
a creating
unit304 for creating a character array;
the
processing unit303 is further configured to assign a value to the character array according to the attribute value of the frame field node to form a target packet;
a sending
unit305, configured to send the target packet to a destination address.
Optionally, the structure information of the packet includes a protocol name, a protocol uplink and downlink identifier, a number of frame formats, and structure information of a plurality of frame format packet nodes of the packet; the number of the frame message nodes is consistent with the number of the frame formats.
Optionally, the structure information of the frame packet node includes a value of a frame type identifier node, a value of a byte number of a frame node, and structure information of a frame field.
Optionally, the structure information of the frame field includes attribute information of a plurality of fields.
Optionally, the attribute information of the field includes at least one of a position of the frame sequence in which the field is located, a length of bytes occupied by the field, a field name, a number of types of field functions, a field code, and a meaning of the field code.
Optionally, the
processing unit303 is further configured to:
creating an array of a plurality of frame types; the number of the array of the frame type is consistent with the number of the frame formats, and the array of the frame type is used for storing the structural information of the frame message node.
Optionally, the
processing unit303 is specifically configured to:
for a first frame message node, selecting an array of a target frame type from the arrays of a plurality of frame types, and assigning the value of the frame type identification node and the value of the frame byte number node to the array of the target frame type; the first frame message node is any one of the plurality of frame message nodes; and, creating a plurality of variable arrays under the array of the target frame type; the number of the variable arrays is consistent with that of the fields, and the variable arrays are used for storing attribute information of the fields; and aiming at the first field, selecting a target variable array from the multiple variable arrays, and assigning the position of a frame sequence where the field is located, the length of bytes occupied by the field, the field name, the field function type number, the field code and the meaning of the field code to the target variable array; the first field is any one of the plurality of fields; and determining the attribute value of the frame field node according to the array of the assigned target frame type and the array of the assigned target variable.
Optionally, the creating
unit304 is specifically configured to:
selecting a frame message node to be framed; selecting a target assigned frame type array corresponding to the frame message node of the frame to be framed from the multiple assigned frame type arrays; and creating a character array according to the value of the frame byte number node in the array of the frame type after the target assignment.
Optionally, the
processing unit303 is specifically configured to:
selecting a field to be framed from the frame message node to be framed;
selecting a target assigned variable array corresponding to the field of the frame to be framed from the assigned variable data;
and assigning the character array according to the attribute information in the variable array after the target assignment to form a target message.
Optionally, the
processing unit303 is further configured to:
and converting the assigned character array into a byte array.
In an exemplary embodiment, a computer-readable storage medium is further provided, in which a computer program or an intelligent contract is stored, and the computer program or the intelligent contract is loaded and executed by a node to implement the transaction processing method provided by the above-described embodiment. Alternatively, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Those skilled in the art will clearly understand that the techniques in the embodiments of the present application may be implemented by way of software plus a required general hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present application.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (8)
1.一种基于XML的DL/T645规约报文的组帧方法,其特征在于,所述方法包括:1. a framing method based on the DL/T645 statute message of XML, is characterized in that, described method comprises: 接收到远端发送的报文后,读取报文的XML文档;After receiving the message sent by the remote end, read the XML document of the message; 根据所述报文的XML文档,确定报文的结构信息,所述报文的结构信息包括所述报文的规约名称、规约上下行标识、帧格式个数和多个帧报文节点的结构信息,所述帧报文节点的个数与所述帧格式个数一致;According to the XML document of the message, the structure information of the message is determined, and the structure information of the message includes the protocol name of the message, the protocol uplink and downlink identifiers, the number of frame formats, and the structure of multiple frame message nodes. information, the number of the frame message nodes is consistent with the number of the frame format; 创建多个frame类型的数组,所述frame类型的数组的个数与所述帧格式个数一致,所述frame类型的数组用于存储所述帧报文节点的结构信息;Create a plurality of frame type arrays, the number of the frame type arrays is consistent with the frame format number, and the frame type arrays are used to store the structure information of the frame message node; 根据所述报文的结构信息和所述多个frame类型的数组,对帧报文节点中的帧字段节点进行解析,得到帧字段节点的属性值;According to the structure information of the message and the arrays of the multiple frame types, the frame field node in the frame message node is analyzed to obtain the attribute value of the frame field node; 创建字符数组;create an array of characters; 根据帧字段节点的属性值,对所述字符数组进行赋值,形成目标报文;According to the attribute value of the frame field node, assign value to the character array to form a target message; 将所述目标报文发送至目的地址。Send the target message to the destination address. 2.根据权利要求1所述的方法,其特征在于,所述帧报文节点的结构信息包括帧类型标识节点的值、帧字节数节点的值和帧字段的结构信息。2 . The method according to claim 1 , wherein the structure information of the frame message node includes the value of the frame type identification node, the value of the frame byte number node, and the structure information of the frame field. 3 . 3.根据权利要求2所述的方法,其特征在于,所述帧字段的结构信息包括多个字段的属性信息。3. The method according to claim 2, wherein the structure information of the frame field comprises attribute information of a plurality of fields. 4.根据权利要求3所述的方法,其特征在于,所述字段的属性信息包括字段所在帧序列的位置、字段所占字节的长度、字段名、字段功能种类数、字段代码和字段代码的含义中的至少一项。4. The method according to claim 3, wherein the attribute information of the field comprises the position of the frame sequence where the field is located, the length of the byte occupied by the field, the field name, the number of field function types, the field code and the field code at least one of the meanings of . 5.根据权利要求4所述的方法,其特征在于,根据所述报文的结构信息和所述多个frame类型的数组,对帧报文节点中的帧字段节点进行解析,得到帧字段节点的属性值,包括:5. The method according to claim 4, wherein, according to the structure information of the message and the arrays of the multiple frame types, the frame field node in the frame message node is parsed to obtain the frame field node property values, including: 针对第一帧报文节点,从多个frame类型的数组中选取目标frame类型的数组,将所述帧类型标识节点的值和所述帧字节数节点的值赋值给所述目标frame类型的数组;所述第一帧报文节点为所述多个帧报文节点中的任意一个;For the first frame message node, select the array of the target frame type from the arrays of multiple frame types, and assign the value of the frame type identification node and the value of the frame byte number node to the target frame type. array; the first frame message node is any one of the multiple frame message nodes; 在所述目标frame类型的数组下创建多个变量数组;所述变量数组的个数与所述字段的个数一致,所述变量数组用于存储所述字段的属性信息;Create a plurality of variable arrays under the array of the target frame type; the number of the variable arrays is consistent with the number of the fields, and the variable arrays are used to store the attribute information of the fields; 针对第一字段,从多个变量数组中选取目标变量数组,将所述字段所在帧序列的位置、字段所占字节的长度、字段名、字段功能种类数、字段代码和字段代码的含义赋值给所述目标变量数组;所述第一字段为所述多个字段中的任意一个;For the first field, select the target variable array from multiple variable arrays, and assign the position of the frame sequence where the field is located, the length of the bytes occupied by the field, the field name, the number of field function types, the field code and the meaning of the field code. to the target variable array; the first field is any one of the multiple fields; 根据赋值后的目标frame类型的数组和赋值后的目标变量数组,确定所述帧字段节点的属性值。The attribute value of the frame field node is determined according to the assigned target frame type array and the assigned target variable array. 6.根据权利要求5所述的方法,其特征在于,所述创建字符数组,包括:6. The method according to claim 5, wherein the creating a character array comprises: 选取待组帧的帧报文节点;Select the frame packet node to be framed; 从多个赋值后的frame类型的数组中选取与所述待组帧的帧报文节点相对应的目标赋值后的frame类型的数组;From the array of the frame type after multiple assignments, select the array of the frame type after the target assignment corresponding to the frame message node to be framed; 根据所述目标赋值后的frame类型的数组中所述帧字节数节点的值,创建字符数组。A character array is created according to the value of the frame byte number node in the frame type array after the target is assigned. 7.根据权利要求6所述的方法,其特征在于,所述根据帧字段节点的属性值,对所述字符数组进行赋值,形成目标报文,包括:7. The method according to claim 6, wherein, according to the attribute value of the frame field node, the character array is assigned a value to form a target message, comprising: 从所述待组帧的帧报文节点中选取待组帧的字段;Select the field to be framed from the frame message node to be framed; 从多个赋值后的变量数据中选取与所述待组帧的字段相对应的目标赋值后的变量数组;From the variable data after multiple assignments, select the variable array after the target assignment corresponding to the field to be framed; 根据所述目标赋值后的变量数组中各属性信息,对所述字符数组进行赋值,形成目标报文。According to each attribute information in the variable array after the target is assigned, the character array is assigned to form a target message. 8.一种基于XML的DL/T645规约报文的组帧装置,其特征在于,所述装置包括:8. A device for framing a DL/T645 protocol message based on XML, wherein the device comprises: 接收单元,用于接收到远端发送的报文;The receiving unit is used to receive the message sent by the remote end; 读取单元,用于读取报文的XML文档;The reading unit is used to read the XML document of the message; 处理单元,用于根据所述报文的XML文档,确定帧报文节点的结构信息;还用于创建多个frame类型的数组;以及,根据帧报文节点的结构信息和所述多个frame类型的数组,对所述帧报文节点中的帧字段节点进行解析,得到帧字段节点的属性值;a processing unit, configured to determine the structure information of the frame message node according to the XML document of the message; also used to create an array of multiple frame types; and, according to the structure information of the frame message node and the multiple frames an array of types, parses the frame field node in the frame message node, and obtains the attribute value of the frame field node; 创建单元,用于创建字符数组;Creation unit, used to create a character array; 所述处理单元,还用于根据帧字段节点的属性值,对所述字符数组进行赋值,形成目标报文;The processing unit is further configured to assign values to the character array according to the attribute value of the frame field node to form a target message; 发送单元,用于将所述目标报文发送至目的地址。A sending unit, configured to send the target message to a destination address.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911064856.4A CN110830466B (en) | 2019-11-04 | 2019-11-04 | Method and device for framing DL/T645 protocol message based on XML |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911064856.4A CN110830466B (en) | 2019-11-04 | 2019-11-04 | Method and device for framing DL/T645 protocol message based on XML |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110830466A CN110830466A (en) | 2020-02-21 |
CN110830466B true CN110830466B (en) | 2022-01-28 |
Family
ID=69552274
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911064856.4A Active CN110830466B (en) | 2019-11-04 | 2019-11-04 | Method and device for framing DL/T645 protocol message based on XML |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110830466B (en) |
Families Citing this family (3)
* Cited by examiner, † Cited by third partyPublication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111404902B (en) * | 2020-03-08 | 2022-05-10 | 苏州浪潮智能科技有限公司 | Method and device for realizing serial communication message matching based on database |
CN112035040B (en) * | 2020-08-31 | 2023-04-07 | 北京润科通用技术有限公司 | Interface variable information processing method and device |
CN114338747B (en) * | 2021-12-31 | 2023-07-25 | 四川启睿克科技有限公司 | Cloud scene control system and method supporting device to report data messages in self-defined mode |
Family Cites Families (6)
* Cited by examiner, † Cited by third partyPublication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7853621B2 (en) * | 2005-11-23 | 2010-12-14 | Oracle International Corp. | Integrating medical data and images in a database management system |
CN103123646B (en) * | 2012-12-11 | 2015-11-04 | 北京航空航天大学 | Conversion method and device for automatically converting XML documents into OWL documents |
US9996976B2 (en) * | 2014-05-05 | 2018-06-12 | Avigilon Fortress Corporation | System and method for real-time overlay of map features onto a video feed |
CN105472044B (en) * | 2016-01-26 | 2019-11-12 | 云南电网有限责任公司电力科学研究院 | An XML-based mapping method between DL/T645 and GOOSE |
CN106603502A (en) * | 2016-11-21 | 2017-04-26 | 云南电网有限责任公司电力科学研究院 | XML-based IEC 60870-5-104 and GOOSE conversion method |
CN108920437A (en) * | 2018-07-12 | 2018-11-30 | 中国工程物理研究院计算机应用研究所 | The method that XML document is converted into html format document based on XSL |
-
2019
- 2019-11-04 CN CN201911064856.4A patent/CN110830466B/en active Active
Non-Patent Citations (1)
* Cited by examiner, † Cited by third partyTitle |
---|
《基于XML的DL/T645协议与GOOSE的映射研究》;刘名扬等;《信息技术》;20161231;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110830466A (en) | 2020-02-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110830466B (en) | 2022-01-28 | Method and device for framing DL/T645 protocol message based on XML |
US10666718B2 (en) | 2020-05-26 | Dynamic data transport between enterprise and business computing systems |
CN110022289B (en) | 2022-07-05 | Data transmission method, device and system |
CN104144156B (en) | 2018-09-21 | Message processing method and device |
CN113079198B (en) | 2022-07-01 | Method and device for converting cloud platform interface protocol |
CN109460220B (en) | 2022-04-12 | Message predefined code generation method and device, electronic equipment and storage medium |
US7620700B2 (en) | 2009-11-17 | Communication system implementing a plurality of communication apparatuses as communication client and communication server for exchanging operation requests and operation responses |
CN105472044B (en) | 2019-11-12 | An XML-based mapping method between DL/T645 and GOOSE |
CN105991564A (en) | 2016-10-05 | Message processing method and device |
CN114500690A (en) | 2022-05-13 | Interface data processing method and device, electronic equipment and storage medium |
CN115242896A (en) | 2022-10-25 | Dynamic message analysis method and device, electronic equipment and computer readable storage medium |
JP4477008B2 (en) | 2010-06-09 | Method and system for transfer of communication network management information |
CN107800552B (en) | 2020-11-27 | Data interaction method and device |
CN116016345B (en) | 2024-10-18 | Network flow restoration method based on custom protocol description language |
CN113051202A (en) | 2021-06-29 | Interface adaptation method, device, electronic equipment and computer readable storage medium |
CN114866472A (en) | 2022-08-05 | Method and system for realizing open source community access in multi-mode network |
CN117714564B (en) | 2024-04-23 | Universal DLT645 protocol analysis method and device based on java language |
CN115134380A (en) | 2022-09-30 | Data transmission method and device, electronic equipment and storage medium |
CN115168365B (en) | 2022-12-02 | Data storage method and device, electronic equipment and storage medium |
US11216424B2 (en) | 2022-01-04 | Dynamically rendering an application programming interface for internet of things applications |
CN115001931B (en) | 2024-07-23 | Message processing method, device, equipment, medium and program product |
CN110839022A (en) | 2020-02-25 | Vehicle-mounted control software communication protocol analysis method based on xml language |
CN110674130A (en) | 2020-01-10 | Data transmission method |
CN104158903B (en) | 2018-05-01 | The coding method of OAM protocol stacks and system |
CN107635009A (en) | 2018-01-26 | Method of servicing, system, request of data device and the data supplying device of middleware |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
2020-02-21 | PB01 | Publication | |
2020-02-21 | PB01 | Publication | |
2020-03-17 | SE01 | Entry into force of request for substantive examination | |
2020-03-17 | SE01 | Entry into force of request for substantive examination | |
2022-01-28 | GR01 | Patent grant | |
2022-01-28 | GR01 | Patent grant |