A distribution network terminal IEC104 protocol analysis method

By decomposing the IEC104 protocol into multiple modules and using an SQLite database to store description information, the problems of low efficiency and high cost of parsing the IEC104 protocol in distribution network terminals are solved, achieving efficient and flexible message parsing and transmission.

CN117176838BActive Publication Date: 2026-11-27HENAN XJ INTELLIGENT CONTROL TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311200900.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2026-11-27
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

The existing IEC104 protocol parsing process for distribution network terminals is inefficient, costly, and inflexible, requiring frequent program modifications to adapt to configuration changes.

Method used

The IEC104 protocol is virtualized into service modules, protocol setting modules, link modules, and device modules, and descriptive information is stored in an SQLite database. Message data is obtained and parsed through SQL operation commands to achieve modular parsing.

Benefits of technology

It improves the software compatibility of distribution network terminals, reduces maintenance workload, improves parsing efficiency, and supports efficient sending of response messages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117176838B_ABST
    Figure CN117176838B_ABST
Patent Text Reader

Abstract

The application relates to a kind of parsing methods of distribution network terminal IEC104 protocol, belong to network protocol analysis technical field.The application is decomposed to distribution network terminal IEC104 protocol, and virtually becomes multiple modules, and each module is described with corresponding description information, and then the complete dependence problem of distribution network terminal IEC104 protocol on program configuration is solved;when any information in the service module, protocol setting module, link module and equipment module of the IEC104 protocol of distribution network terminal changes, only the corresponding description information needs to be modified, then the terminal initialization analysis is provided, the source code program of distribution network terminal does not need to be modified, the compatibility of distribution network terminal software is improved, and the operation and maintenance workload is greatly reduced, and the analysis efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for parsing the IEC104 protocol of a distribution network terminal, belonging to the field of network protocol parsing technology. Background Technology

[0002] IEC104 is short for IEC60870-5-101 Network Access, which is a standard transmission protocol set adopted by DL / T634.5104 Telecontrol Equipment and Systems Part 5-104. It is an international standard developed by the International Electrotechnical Commission and is one of the most widely used network communication protocols in the field of distribution network automation technology.

[0003] The modeling and parsing of the IEC104 protocol used in distribution network terminals generally adopts a fixed configuration, which is inflexible. When the high and low byte order, the number of bytes in the information body address, or the number of remote data points in the IEC104 protocol of the distribution network terminal changes, it is often necessary to modify the program or add interface programs to solve the problem, which consumes a lot of manpower and material resources and greatly increases the cost of distribution network operation and maintenance. Summary of the Invention

[0004] The purpose of this invention is to provide a method for parsing the IEC104 protocol of a distribution network terminal, so as to solve the problems of low efficiency and high cost in the current parsing process.

[0005] To solve the above-mentioned technical problems, this invention provides a method for parsing the IEC104 protocol of a distribution network terminal, the method comprising the following steps:

[0006] 1) Virtualize the IEC104 protocol of the distribution network terminal into a protocol model containing a service module, a protocol setting module, a link module, and a device module, describe each module, and store the description information in a specified file;

[0007] 2) When the distribution terminal is powered on, it first obtains the number of services from the description information of the service module. When the number of services is not zero, it then obtains the protocol setting information corresponding to the service from the description information of the protocol setting module. Then, it determines the network link information corresponding to the service from the description information of the link module. Finally, it obtains the device information corresponding to the service from the description information of the device module.

[0008] 3) When a message data according to the IEC104 protocol is received, each byte of the message is queried in sequence. The frame length and control field are parsed out according to the obtained protocol setting information. The message with a frame length that meets the requirements and a control field that conforms to the standard is stored. The address of the stored message is parsed out according to the protocol setting information. The validity of the message is determined according to the address of the device mounted in the service. Then, according to the globally stored protocol setting information, the message type and the data content carried by the message are parsed out to realize the message parsing.

[0009] This invention decomposes the IEC104 protocol of the distribution network terminal into multiple virtual modules, and describes each module with corresponding descriptive information. This solves the problem of the distribution network terminal's complete dependence on the predetermined program configuration for the IEC104 protocol. When any information in the service module, protocol setting module, link module, or device module of the IEC104 protocol of the distribution network terminal changes, only the corresponding descriptive information needs to be modified for the distribution network terminal to initialize and parse. There is no need to modify the source code program of the distribution network terminal, which improves the compatibility of the distribution network terminal software, greatly reduces the workload of operation and maintenance, and improves parsing efficiency.

[0010] Furthermore, when the parsed message requires a response message, the data to be sent is obtained from the device information in the detailed description information of the device module, the data is filled in according to the globally stored protocol settings information, encapsulated into a complete IEC104 message, and then sent out.

[0011] The present invention can also obtain the data to be sent based on the device information in the detailed description information of the device module when a response message needs to be sent, and encapsulate the message according to the protocol setting information stored globally, so as to send the response message efficiently.

[0012] Furthermore, this method uses an SQLite database to describe and store each module.

[0013] This invention uses an SQLite database to store the description information of each module, which facilitates information storage and retrieval and further improves the efficiency of parsing.

[0014] Furthermore, the specified file contains multiple data tables, each used to store description information for each module. Each data table is independent of the others and has a unique table name and identification code.

[0015] Furthermore, in the corresponding data table, each row of the service module description information represents a service information. The data tables containing the specification setting module and link module description information correspond one-to-one with the data tables containing the service module description information. Each row of service information has corresponding specification setting information and link information, which are associated through a unique identification code.

[0016] This invention uses different data tables to store the description information of the corresponding modules, which facilitates the management of the description information of each module; and uses a unique identification code to associate the description information of each module.

[0017] Furthermore, the method also includes extracting the data to be sent when it is necessary to actively send a message, filling the data according to the globally stored protocol setting information and link device information, encapsulating it into a complete IEC104 message, and sending the message out.

[0018] Furthermore, the description information of the service module includes an identification code, name, and port number; the description information of the protocol setting module includes an identification code, timeout, transmission delay, byte order, frame upload mode, number of bytes, and active upload cycle; the description information of the link module includes an identification code, name, network port IP address, terminal ID, and terminal address; and the description information of the device module includes an identification code, name, data type, and information body address.

[0019] Furthermore, step 2) uses SQL operation commands to obtain the description information of each module. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the IEC104 protocol model of the virtual distribution network terminal of this invention;

[0021] Figure 2 This is a schematic diagram illustrating the service module in this invention;

[0022] Figure 3 This is a schematic diagram illustrating the specification setting module in this invention;

[0023] Figure 4 This is a schematic diagram illustrating the linking module in this invention;

[0024] Figure 5 This is a schematic diagram illustrating the device module in this invention;

[0025] Figure 6 This is a flowchart of the specification parsing process used in this invention. Detailed Implementation

[0026] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0027] This invention virtualizes the IEC104 protocol of the distribution network terminal into a protocol model containing a service module, a protocol setting module, a link module, and a device module. Each module is described, and the description information is stored in a designated file. When the distribution network terminal powers on, it sequentially retrieves the corresponding description information from the service module, protocol setting module, link module, and device module. When it receives IEC104 protocol message data, it sequentially queries each byte of the message, parses the frame length and control field based on the obtained protocol setting information, and stores messages with frame lengths meeting requirements and control fields conforming to the standard. It then parses the address of the stored message according to the protocol setting information and determines the message validity based on the device address mounted in the service. Finally, based on the globally stored protocol setting information, it parses the message type and the data content carried in the message, thus achieving message parsing. A detailed explanation follows.

[0028] 1. Generate a virtual model of the IEC104 specification.

[0029] Based on the actual network port usage of the distribution network terminal, the IEC104 protocol of the distribution network terminal is virtualized into one or more protocol models. This model has four modules, such as... Figure 1 As shown, the modules are: Service Module, Protocol Setting Module, Link Module, and Device Module. Each module is assigned a unique identifier, which allows them to establish communication and jointly perform IEC 104 protocol functions. Generally, multiple virtual protocol models can be mounted on a single network port, but it's preferred to virtualize only one model per port. When multiple virtual models are needed, different identification codes can be used to distinguish and add them.

[0030] 2. Describe each module and store the description information of each module in the specified file.

[0031] SQLite is a lightweight relational database technology that supports the SQL language and provides operations on any data type format. It has functions such as creating, deleting, and updating databases, as well as querying, modifying, and adding data records. SQLite database technology is efficient, flexible, and highly reliable.

[0032] Therefore, this embodiment uses an SQLite database as the designated file. The description files of each module are stored in the SQLite database in DB format. For ease of management, the description information of each module is stored in an independent data table. In this embodiment, four data tables are established in the SQLite database to store the description information of the storage service module, protocol setting module, link module, and device module, respectively.

[0033] like Figure 2As shown, the description information of the service module includes key information such as identification code (ser_id), name, and port number, as shown in the first row of Table 1; the specific data of the service module is shown in the second row of Table 1 for reference.

[0034] Table 1

[0035] ser_id name port 1 IEC104 0

[0036] A detailed description of the specification settings module is as follows: Figure 3 As shown, the description information includes the identifier (ser_id), timeout (t_time), transmission delay (delay_time), byte order (byte_order), frame upload mode (send_mode), address byte count (comaddr_byte_num), data body byte count (inf_byte_num), and active upload period (cyc_time), as shown in the first row of Table 2. The specific data of the protocol settings are shown in the second row of Table 2.

[0037] Table 2

[0038] ser_id t0_time t1_time t2_time t3_time delay_time byte_order send_mode comaddr_byte_num inf_byte_num cyc_time 1 30 15 10 20 50 0 1 2 3 60

[0039] Link modules such as Figure 4 As shown, its description information packet includes identification code (ser_id), name (name), network interface IP address (ip), terminal ID (dev_id), and terminal address (addr), as shown in the first row of Table 3. The specific data of the link is shown in the second row of Table 3.

[0040] Table 3

[0041] ser_id name IP dev_id addr 1 IEC104 192.168.1.101 1 1

[0042] The detailed description of the device module is as follows: Figure 5 As shown, the description information includes the identifier (dev_id), name (name), data type (type), and information body address (inf), as shown in the first row of Table 4. The specific data of the device is shown in the second row and subsequent rows of Table 4.

[0043] Table 4

[0044] dev_id name type inf 1 L01Ua 0 0x4001 1 … … … 1 L01DI1 1 0x0001 1 … … … 1 L01ym1 2 0x6001 1 … … … 1 L01yk1 3 0x4001 1 … … … 1 L01overItime 4 0x8021

[0045] The four data tables are independent of each other and have unique table names and unique identifiers. The descriptive information between the modules can be linked through these unique identifiers to jointly complete the functions of the IEC 104 protocol. The descriptive information of the service module is represented as tabular data in the DB file. A table can have multiple rows, and each row represents a service information. The descriptive information of the protocol setting module and the linking module are in the tables, and they correspond one-to-one with the service module tables. That is, each row of service information must have corresponding protocol setting information and corresponding linking information, which are identified and associated through unique identifiers. The descriptive information of the device module is in the tables and is associated with the linking module through an identifier.

[0046] 3. When the distribution network terminal is powered on, it sequentially obtains the corresponding description information from the description information of the service module, protocol setting module, link module and device module.

[0047] When the distribution network terminal is powered on, the terminal software parses the DB file. Using the SQL query function, it queries the service modules in the DB file to determine the specific number of services according to the IEC 104 protocol. If the service quantity is not zero, it indicates that the distribution network terminal needs to establish IEC 104 protocol services. The software then queries the protocol setting module to obtain the byte count, high / low byte order, timeout, and other attribute settings of the IEC 104 protocol (refer to the description of the protocol setting module for details). Next, it queries the link module to determine the network link information for the IEC 104 protocol service, including the master station IP, number of links, and terminal address. Finally, it queries the device module, sequentially querying telemetry, telesignaling, remote control, telepulse, and setting data, recording key information such as type and data body address, and storing this information in the internal memory of the distribution network terminal's running program. This DB file parsing process must be performed in the order of service modules, protocol setting module, link module, and device module. If the service quantity of a service module is determined to be zero, the subsequent processes are unnecessary.

[0048] 4. Analyze the IEC104 specification.

[0049] The message parsing program processes messages in real time according to the protocol model. The first step reads the service modules from the model; a successful read establishes an IEC104 service. The second step reads the protocol setting module, refines the service based on the protocol settings, and globally stores the protocol settings for use in message parsing and transmission. The third step reads the link module and mounts the link under the IEC104 service. The fourth step reads the device module and mounts the device under the link. The fifth step starts the IEC104 service program. One service module can correspond to multiple link modules, and one link module can correspond to multiple device modules. Reading the link module information is a crucial step in associating service modules with device modules, acting as a bridge.

[0050] like Figure 6 As shown, upon receiving a message, each byte of the message is queried sequentially. Based on the IEC 104 protocol standard and the protocol settings information read by the program, the frame length and control field are first parsed to determine if the message frame is complete. If it is not a complete message, reception continues; if the control field does not meet the standard requirements, the message is discarded. Only complete and correct messages are parsed. Next, the address is parsed, and the message validity is determined based on the address of the device mounted in the service. Then, based on the globally stored protocol settings information, the message type, data carried in the message, etc., are parsed. For different message types, the corresponding parsing program is called, and a message response is generated. When it is necessary to actively send or respond to a message, the data to be sent is first extracted from the program. Then, based on the globally stored protocol settings information and the linked device information, the data is filled in and encapsulated into a complete IEC 104 message frame, and finally, the message is sent out.

[0051] For example, if a general call message is parsed from the master station, the necessary telemetry and telecontrol data are retrieved from the IEC104 virtual model of the distribution network terminal based on the key byte information such as the public address and call qualifier in the message, and packaged into a specific message frame, which is then sent to the master station. When no event occurs, frame data is sent periodically according to the period configured in the model; when there is a sudden change in data, frame data will also be sent automatically.

Claims

1. A method for parsing the IEC104 protocol in a distribution network terminal, characterized in that, The method includes the following steps: 1) The IEC104 protocol of the distribution network terminal is virtualized into a protocol model with service modules, protocol setting modules, link modules, and device modules. Each module is described and the description information is stored independently in an SQLite database. The modules are associated with each other through a unique identifier. The description information of the protocol setting module and the link module is in a table, which corresponds one-to-one with the table of the service module. The description information of the service module includes service information; the description information of the protocol setting module includes protocol setting information; the description information of the link module includes network link information; and the description information of the device module includes device data. 2) When the distribution terminal is powered on, it first obtains the number of services from the description information of the service module. When the number of services is not zero, it then obtains the protocol setting information corresponding to the service from the description information of the protocol setting module. Then, it determines the network link information corresponding to the service from the description information of the link module. Finally, it obtains the device information corresponding to the service from the description information of the device module. 3) When receiving message data according to the IEC104 protocol, each byte of the message is queried sequentially. The frame length and control field are parsed out according to the obtained protocol setting information. Messages with frame lengths that meet the requirements and control fields that conform to the standard are stored. The address of the stored message is parsed out according to the protocol setting information. The validity of the message is determined according to the address of the device mounted in the service. Then, according to the globally stored protocol setting information, the message type and the data content carried by the message are parsed out to realize the message parsing.

2. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 1, characterized in that, When the parsed message requires a response message, the data to be sent is obtained from the device information in the device module's detailed description information, the data is filled in according to the globally stored protocol settings information, encapsulated into a complete IEC104 message, and then sent out.

3. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 1 or 2, characterized in that, This method uses an SQLite database to describe each module, and the description files of each module are stored in the SQLite database in DB format.

4. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 3, characterized in that, The unique identifier is the identification code.

5. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 4, characterized in that, Each row of the service module description information in the corresponding data table represents a service information. The data tables containing the specification setting module and link module description information are one-to-one with the data tables containing the service module description information. Each row of service information has corresponding specification setting information and link information, which are associated through a unique identification code.

6. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 1, characterized in that, The method also includes extracting the data to be sent when it is necessary to actively send a message, filling the data according to the globally stored protocol settings information and link device information, encapsulating it into a complete IEC104 message, and sending the message out.

7. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 1, characterized in that, The description information of the service module includes identification code, name, and port number; the description information of the protocol setting module includes identification code, timeout, transmission delay, byte order, frame upload mode, number of bytes, and active upload period; the description information of the link module includes identification code, name, network port IP address, terminal ID, and terminal address; the description information of the device module includes identification code, name, data type, and information body address.

8. The method for parsing the IEC104 protocol of a distribution network terminal according to claim 3, characterized in that, Step 2) uses SQL operation commands to obtain the description information of each module.

Citation Information

Patent Citations

  • Embedded device CAN protocol analysis method based on XML technology

    CN107888595A