Configuration software protocol processing method and system

By converting protocol files into metadata description files and generating target language codes, the difficulty in maintaining and expanding configuration software when supporting multiple communication protocols is solved, efficient automated processing is achieved, and the maintainability of configuration software is improved. and development efficiency.

CN112417515BActive Publication Date: 2024-09-24GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011262681.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2024-09-24
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

When existing configuration software supports multiple communication protocols, specific codes need to be written for each protocol, which makes maintenance and expansion difficult, inefficient, and difficult to achieve automated processing.

Method used

Convert protocol files into metadata description files, establish protocol models, and translate them into target language codes according to target application scenarios to improve automation, maintainability, and development efficiency.

Benefits of technology

Through metadata description and automated translation, the automation level of protocol processing is improved, the maintainability and development efficiency of configuration software are improved, and the dependence on manual coding is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112417515B
    Figure CN112417515B
Patent Text Reader

Abstract

The present invention discloses a configuration software protocol processing method and system, the method comprising: converting a protocol file to be processed into a protocol metadata description file, wherein metadata is used to describe protocol features corresponding to various variables of the protocol file; the configuration software loads the protocol metadata description file and establishes a protocol model corresponding to the protocol metadata description file; and according to a target application scenario, the protocol model is translated into a corresponding target language code. The technical solution of the present invention can improve the maintainability and development efficiency of the configuration software.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of configuration software, and in particular to a configuration software protocol processing method and system. Background Art

[0002] Applications developed by general configuration software work in a variety of industrial control scenarios and need to support hundreds of communication protocols. These protocols are often encoded in binary, and protocol support is one of its most important functions. Configuration software needs to write specific code to handle it so that it can support it. Generally speaking, each protocol stack is stable, but the data part varies according to the usage scenario (for example, complying with the Modbus protocol only means complying with the same protocol stack, such as function code, data type, etc.; but the data part of the Modbus protocol in each application scenario is ever-changing, and different manufacturers or integrators can define it according to their own needs).

[0003] If specific codes are written for each protocol, the configuration software will be difficult to maintain and expand. Modifying the code at will will also consume huge manpower and time, and the efficiency will be very low, making it difficult to achieve automated protocol processing.

[0004] In order to maintain the scalability of the configuration software in terms of protocol support, a plug-in is usually used, that is, a special plug-in is used to implement support for a certain protocol, and the plug-in uses code to specifically handle the encoding and decoding of each communication byte. This method maintains the scalability of the configuration software in terms of the protocol, but because it requires manual writing of lines of code, it will be affected by the quality of the coder, resulting in low efficiency and low degree of automation. Summary of the invention

[0005] The purpose of the present invention is to solve the technical problem in the prior art that specific codes are written for each protocol, which makes configuration software difficult to maintain and expand. The present invention proposes a configuration software protocol processing method and system.

[0006] In an embodiment of the present invention, a configuration software protocol processing method is provided, which includes:

[0007] Loading a protocol metadata description file converted from a protocol file to be processed, wherein the protocol metadata description file uses metadata to describe protocol features corresponding to various variables of the protocol file;

[0008] Establishing a protocol model corresponding to the protocol metadata description file;

[0009] According to the target application scenario, the protocol model is translated into the corresponding target language code.

[0010] In an embodiment of the present invention, the protocol features of each variable in the protocol file include: variable name, data type, address in the communication frame, data category, data calculation rule, device category, device description, protocol frame type, and protocol stack.

[0011] In the embodiment of the present invention, the configuration software protocol processing method further includes:

[0012] The tamper-proof mark of the protocol metadata description file is checked to verify the integrity of the protocol file metadata description file.

[0013] In the embodiment of the present invention, before generating the protocol processing code of the target application scenario, the method further includes:

[0014] The protocol model is displayed and managed in the configuration software.

[0015] In the embodiment of the present invention, the configuration software protocol processing method further includes:

[0016] Convert the protocol file to be processed into a protocol metadata description file.

[0017] In an embodiment of the present invention, a configuration software protocol processing system is also provided, which includes:

[0018] A protocol loading module, used to load a protocol metadata description file converted from a protocol file to be processed, wherein the protocol metadata description file uses metadata to describe protocol features corresponding to various variables of the protocol file;

[0019] A protocol model building module, used to build a protocol model corresponding to the protocol metadata description file;

[0020] The target code generation module is used to translate the protocol model into corresponding target language code according to the target application scenario.

[0021] In an embodiment of the present invention, the protocol features of each variable in the protocol file include: variable name, data type, address in the communication frame, data category, data calculation rule, device category, device description, protocol frame type, and protocol stack.

[0022] In the embodiment of the present invention, the configuration software protocol processing system further includes:

[0023] The security detection module is used to check the anti-tampering mark of the protocol metadata description file to verify the integrity of the protocol file metadata description file.

[0024] In the embodiment of the present invention, the configuration software protocol processing system further includes:

[0025] The protocol model management module is used to display the protocol model in the configuration software for users to view and manage.

[0026] In the embodiment of the present invention, the configuration software protocol processing system further includes:

[0027] The protocol conversion module is used to convert the protocol file to be processed into a protocol metadata description file.

[0028] Compared with the prior art, in the configuration software protocol processing method and system of the present invention, the protocol file to be processed is converted into a protocol metadata description file and sent to the configuration software. In the protocol metadata description file, metadata is used to describe the protocol characteristics corresponding to each variable of the protocol file. The configuration software reads the protocol metadata description file, establishes a protocol model corresponding to the protocol metadata description file, and translates the protocol model into the corresponding target language code according to the target application scenario, thereby improving the degree of automated processing of the protocol, improving the maintainability of the configuration software, and improving development efficiency and quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a flow chart of a configuration software protocol processing method according to an embodiment of the present invention.

[0030] Figure 2 It is a structural diagram of a configuration software protocol processing system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] like Figure 1 As shown, in an embodiment of the present invention, a configuration software protocol processing method is provided, which includes steps S1-S8, which are described below respectively.

[0032] Step S1: abstracting various variables of the protocol files from multiple protocol files, and using a common protocol metadata file to describe the protocol features corresponding to various variables in each protocol file.

[0033] It should be noted that the protocol data for general industrial control can be abstracted into three objects: device class, protocol frame and data unit. The device class contains device-specific attributes, which are expressed as data units. The data unit represents the specific meaning of each device communication data, such as a certain byte represents the ambient temperature. The data unit is encapsulated by a protocol frame. The protocol features corresponding to each variable of the protocol file include: variable name, data type, address in the communication frame, data category, data calculation rules, device category, device description, protocol frame type, and protocol stack. In this way, each variable in the protocol file can be abstracted, and metadata can be used to describe each variable, so as to convert each protocol file into a general protocol metadata file. The protocol metadata file can be a csv file or a json file, which is not limited by the present invention.

[0034] Step S2: Convert the protocol file to be processed into a protocol metadata description file.

[0035] It should be noted that, since in the embodiment of the present invention, the configuration software does not directly process the protocol file, before the configuration software processes the protocol file, it is necessary to perform preprocessing to convert the protocol file to be processed into a protocol metadata description file. The process of converting the protocol file to be processed into a protocol metadata description file includes variable name merging (for example, in the protocol file to be processed, a certain byte is used to represent the high bit of the variable, and another byte is used to represent the low bit of the same variable. When converting, the two bytes can be merged and a variable represented by two bytes can be used), data type inference (for example, some protocol files only uniformly state that the variables of the protocol are unsigned numbers or signed numbers, or each variable is described separately. When converted into variable metadata, this information needs to be completed), and calculation rule parsing (for example, in the protocol file, it is stipulated that the transmission value = actual value * multiplier + offset. When converted into a metadata file, it is necessary to parse out the variable metadata such as multiplier and offset).

[0036] Step S3: The configuration software loads the protocol metadata description file.

[0037] It should be noted that before processing the protocol file, the configuration software does not directly load the protocol file, but loads the protocol metadata description file corresponding to the protocol file. Since the protocol metadata description file has a universal format, the format of the protocol metadata description file is pre-stored in the configuration software, and it can be directly parsed.

[0038] Step S4: The configuration software checks the anti-tampering mark of the protocol metadata description file to verify the integrity of the protocol file metadata description file.

[0039] It should be noted that in order to prevent the protocol metadata description file from being tampered with or data loss, after loading the protocol metadata description file, the configuration software checks the tamper-proof mark of the protocol metadata description file to verify the integrity of the protocol metadata description file. The tamper-proof mark can be a check value obtained by hash calculation.

[0040] Step S5: The configuration software establishes a protocol model corresponding to the protocol metadata description file in the memory.

[0041] It should be noted that, since the protocol metadata description file describes the protocol features corresponding to each variable, in the protocol model, the value of each variable can be parsed according to the protocol features corresponding to each variable; and, according to the communication frame type in the metadata and the position of each variable in the communication frame, the related variables can be aggregated into a certain communication frame according to the position; and according to the device type in the metadata, the related variables can be aggregated into a certain type of device object.

[0042] Step S6: Display and manage the protocol model in the configuration software.

[0043] It should be noted that after the protocol model is established in the configuration software, it can be displayed to the user for viewing and management.

[0044] Step S7: According to the target application scenario, the protocol model is translated into corresponding target language code.

[0045] It should be noted that the type of communication frame is defined in each protocol stack. Generally, a specific communication frame represents a specific function. Based on the type of communication frame, according to the aggregated variable set, each variable is automatically translated into the processing (encoding / decoding) code one by one. For example, the first variable A of a communication frame is a 16-bit unsigned number (2 bytes), and its calculation rule is transmission value = actual value * 10 + 40. It is divided into two directions: encoding and decoding. Encoding means expressing the actual value of the variable as binary data of the communication frame; decoding means parsing the actual value of the variable from the specific data in the communication frame. For variable A, its encoding process is to first convert the actual value into the transmission value through the calculation rule, and then encode it into a two-byte unsigned number according to the data type. Finally, according to its frame type and position in the frame (for example, A is the first variable of a communication frame), it is placed at the byte position 0 in the frame and occupies two bytes continuously (bytes 0 and 1); otherwise, bytes 0 and 1 of the frame are taken continuously, and parsed into the actual value of the variable through type conversion and calculation rules. Traverse the model of the communication frame and perform corresponding encoding / decoding code translation one by one.

[0046] It is worth noting that a person skilled in the art can understand that the steps or part of the steps of implementing the above method can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment, and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0047] like Figure 2 As shown, in an embodiment of the present invention, a configuration software protocol processing system is also provided, which includes a protocol conversion module 1, a protocol loading module 2, a security detection module 3, a protocol model building module 4, a protocol model management module 5 and a target code generation module 6.

[0048] The protocol conversion module 1 is used to convert the protocol file to be processed into a protocol metadata description file, in which metadata is used to describe the protocol features corresponding to each variable of the protocol file. The protocol features of each variable in the protocol file include: variable name, data type, address in the communication frame, data category, data calculation rule, device category, device description, protocol frame type, protocol stack. The process of converting the protocol file to be processed by the protocol conversion module 1 into a protocol metadata description file includes: variable name merging, data type inference and calculation rule parsing.

[0049] The protocol loading module 2 is used to load the protocol metadata description file.

[0050] The security detection module 3 is used to check the anti-tampering mark of the protocol metadata description file to verify the integrity of the protocol file metadata description file.

[0051] The protocol model building module 4 is used to build a protocol model corresponding to the protocol metadata description file.

[0052] The protocol model management module 5 is used to display the protocol model in the configuration software for users to view and manage.

[0053] The target code generation module 6 is used to translate the protocol model into corresponding target language code according to the target application scenario.

[0054] It should be noted that in the above-mentioned configuration software protocol processing system, the information interaction, execution process and other contents between the modules / units are based on the same concept as the configuration software protocol processing method provided in the embodiment of the present invention, and its implementation process and the technical effects brought about are the same as those of the configuration software protocol processing method. For specific contents, please refer to the relevant description of the configuration software protocol processing method, which will not be repeated here.

[0055] To sum up, in the configuration software protocol processing method and system of the present invention, the protocol file to be processed is converted into a protocol metadata description file and sent to the configuration software. In the protocol metadata description file, metadata is used to describe the protocol characteristics corresponding to each variable of the protocol file. The configuration software reads the protocol metadata description file, establishes a protocol model corresponding to the protocol metadata description file, and translates the protocol model into the corresponding target language code according to the target application scenario, thereby improving the degree of automated processing of the protocol, improving the maintainability of the configuration software, and improving development efficiency and quality.

[0056] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A configuration software protocol processing method, characterized in that: include: Loading a protocol metadata description file converted from a protocol file to be processed, wherein the protocol metadata description file uses metadata to describe protocol features corresponding to various variables of the protocol file; The protocol features of each variable in the protocol file include: variable name, data type, address in the communication frame, data calculation rule, device category, device description, protocol frame type, and protocol stack with communication frame type defined; Establish a protocol model corresponding to the protocol metadata description file, in which the value of each variable is parsed according to the protocol characteristics corresponding to each variable; according to the communication frame type of the metadata and the position of each variable in the communication frame, the related variables are aggregated into a certain communication frame according to the position; according to the device category of the metadata, the related variables are aggregated into a certain type of device object; According to the target application scenario, the protocol model is translated into the corresponding target language code.

2. The configuration software protocol processing method according to claim 1, characterized in that: Also includes: The tamper-proof mark of the protocol metadata description file is checked to verify the integrity of the protocol metadata description file.

3. The configuration software protocol processing method according to claim 1, characterized in that: Before generating the protocol processing code for the target application scenario, it also includes: The protocol model is displayed and managed in the configuration software.

4. The configuration software protocol processing method according to claim 1, characterized in that: Also includes: Convert the protocol file to be processed into a protocol metadata description file.

5. A configuration software protocol processing system, characterized in that: include: A protocol loading module, used to load a protocol metadata description file converted from a protocol file to be processed, wherein the protocol metadata description file uses metadata to describe protocol features corresponding to various variables of the protocol file; The protocol features of each variable in the protocol file include: variable name, data type, address in the communication frame, data calculation rule, device category, device description, protocol frame type, and protocol stack with communication frame type defined; A protocol model building module is used to build a protocol model corresponding to the protocol metadata description file; in the protocol model, according to the communication frame type of the metadata and the position of each variable in the communication frame, the related variables are aggregated into a certain communication frame according to the position; according to the device category of the metadata, the related variables are aggregated into a certain type of device object; The target code generation module is used to translate the protocol model into corresponding target language code according to the target application scenario.

6. The configuration software protocol processing system as claimed in claim 5, characterized in that: Also includes: The security detection module is used to check the anti-tampering mark of the protocol metadata description file to verify the integrity of the protocol metadata description file.

7. The configuration software protocol processing system as claimed in claim 5, characterized in that: Also includes: The protocol model management module is used to display the protocol model in the configuration software for users to view and manage.

8. The configuration software protocol processing system as claimed in claim 5, characterized in that: Also includes: The protocol conversion module is used to convert the protocol file to be processed into a protocol metadata description file.