Protocol function block encapsulation method, device, equipment, medium and product
By configuring the protocol function blocks, standardizing field mapping and disassembling, and generating text configuration files, the problem of low universality of the protocol function blocks was solved, cross-company compatibility was achieved, and the work efficiency of engineers was improved.
Patent Information
- Application Number
- CN202310151730.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-02-22
AI Technical Summary
In the existing technology, the versatility of protocol function blocks is low, resulting in incompatibility between configuration software and runtime software of different companies, hindering the development of the industrial control industry.
By configuring the protocol function block, processing and disassembling the standardized field mapping, generating a text configuration file, and using the data dictionary to establish a unique mapping relationship, the standardized encapsulation of the protocol function block is achieved.
The versatility of protocol function blocks has been improved, allowing text configuration files generated by one company to be recognized and parsed by runtime software from other companies, improving the work efficiency of engineers and promoting the development of the industrial control industry.
Smart Images

Figure CN116455988B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, apparatus, device, medium and product for encapsulating a protocol function block. Background Art
[0002] The industrial control industry utilizes a variety of communication protocols, such as Modbus, HART, and FF, released by different countries and companies. To use these protocol function blocks for inter-device communication, various parameters are typically configured using configuration software on a computer, creating what's known in the industry as a configuration file. This binary configuration file is then downloaded to the runtime software for parsing, and the runtime software completes the designated communication tasks. Because configuration software and runtime software must ensure consistency across the board—specifically, the protocol type, link parameters, and semantic specifications defined by the configuration software—this consistency is reflected within the industry in the fact that configuration software and runtime software are typically developed and provided by the same company. Even for the configuration and operation of the same communication protocol, the configuration file generated by one company's product configuration cannot be recognized and parsed by another company's runtime software. This results in a lack of universality in the protocol function blocks, hindering the development of the industrial control industry. Summary of the Invention
[0003] The object of the present invention is to provide a method, device, equipment, medium and product for encapsulating a protocol function block, so as to solve the technical problem of low versatility of the protocol function block.
[0004] In a first aspect, the present application provides a method for encapsulating a protocol function block, comprising:
[0005] configuring the protocol function block to obtain a configured protocol function block;
[0006] Performing a mapping process of standardized fields on the configuration protocol function block, and disassembling the configuration protocol function block to obtain the disassembled configuration protocol function block;
[0007] The disassembled configuration protocol function blocks are encapsulated to obtain a text configuration file.
[0008] In one embodiment of the present application, the protocol function block is configured to obtain a configured protocol function block, including:
[0009] Configuration software configures the protocol function block, wherein the protocol function block is stored in a real-time database of the configuration software;
[0010] Selecting a plurality of the protocol function blocks from the real-time database;
[0011] The input terminal and the output terminal of each of the protocol function blocks are connected based on the order of the data flow, and the protocol function block is configured to obtain the configured protocol function block.
[0012] In one embodiment of the present application, the configuration protocol function block is disassembled to obtain the disassembled configuration protocol function block, including:
[0013] Identifying each of the configuration protocol function blocks one by one, and assigning each of the configuration protocol function blocks a first global number;
[0014] Continue to identify whether the input terminals and output terminals of each of the configuration protocol function blocks are all connected end to end in sequence, and assign second global numbers to the corresponding opposite ends of the input terminals and output terminals to obtain the disassembled configuration protocol function blocks, wherein the opposite end of the input terminal is the output terminal of the first adjacent configuration protocol function block, and the opposite end of the output terminal is the input terminal of the second adjacent configuration protocol function block.
[0015] In one embodiment of the present application, a data dictionary is used to perform mapping processing of standardized fields on the configuration protocol function block;
[0016] The disassembled configuration protocol function block is encapsulated to obtain a text configuration file, including:
[0017] a type code identifying the first global number;
[0018] Finding the data structure of the disassembled configuration protocol function block in the data dictionary based on the type code, and filling the preset attribute parameter values of the configuration protocol function block into the data structure, wherein:
[0019] Continue to sequentially fill the first global number and the second global number into the data structure to complete the construction of the data structure and complete the initialization of the data structure;
[0020] Convert the values of the data structures that have been constructed and initialized into key-value pairs in JSON format, and store them in a text form as a string to obtain a string text file of a single JSON data object;
[0021] The disassembly and encapsulation operations are cyclically performed on all the configuration protocol function blocks, and finally a character string text file including multiple JSON data objects is formed, that is, the text configuration file is obtained.
[0022] In one embodiment of the present application, the data dictionary is a two-dimensional data structure, which defines various parameter rules of mainstream functions in the communication protocol. Each row of the two-dimensional data structure represents various information after the protocol function block is instantiated. The protocol function block and the data dictionary establish a unique mapping relationship through the index value.
[0023] In one embodiment of the present application, the various parameter rules include: port number, baud rate, data bits, stop bits, parity bit, function code, data address and data value in port initialization.
[0024] In a second aspect, the present application further provides a protocol function block encapsulation device, comprising:
[0025] A configuration module, configured to configure the protocol function block to obtain a configuration protocol function block;
[0026] a disassembly module, configured to perform a mapping process on the standardized fields of the configuration protocol function block, disassemble the configuration protocol function block, and obtain the disassembled configuration protocol function block;
[0027] The encapsulation module is used to encapsulate the disassembled configuration protocol function block to obtain a text configuration file.
[0028] In a third aspect, the present application further provides an electronic device, comprising a processor, a memory, and a communication bus;
[0029] The communication bus is used to connect the processor and the memory;
[0030] The processor is used to execute the computer program stored in the memory to implement the above-mentioned protocol function block encapsulation method.
[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is used to enable a computer to execute the above-mentioned protocol function block encapsulation method.
[0032] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the above-mentioned protocol function block encapsulation method when executed by a processor.
[0033] By adopting the above technical solution, the present application can achieve the following beneficial technical effects: the present application proposes a method, device, equipment, medium and product for encapsulating a protocol function block, wherein the method configures the protocol function block to obtain a configuration protocol function block; performs mapping processing on the configuration protocol function block for standardized fields, disassembles the configuration protocol function block to obtain the disassembled configuration protocol function block; and encapsulates the disassembled configuration protocol function block to obtain a text configuration file. The present application improves the versatility of the protocol function block by encapsulating the protocol function block into a text configuration file. The text configuration file generated by the product configuration of one company can be recognized and parsed by the runtime software of other companies at the same time, providing convenience for engineers when applying the protocol function block, effectively improving the work efficiency of engineers, and thus promoting the development of the industrial control industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is a flow chart of a method for encapsulating a protocol function block provided in one embodiment of the present application;
[0035] Figure 2 is a flow chart of a method for configuring the protocol function block provided in an embodiment of the present application;
[0036] Figure 3 is a flow chart of a method for disassembling the configuration protocol function block provided in an embodiment of the present application;
[0037] Figure 4 is a flow chart of a method for encapsulating the disassembled configuration protocol function block provided in an embodiment of the present application;
[0038] Figure 5 This is a framework diagram of a protocol function block encapsulation device provided in one embodiment of the present application;
[0039] Figure 6 It is a structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0040] The following describes the embodiments of the present application through specific examples. Those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0041] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. Therefore, the illustrations only show the components related to the present application and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout may also be more complicated.
[0042] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it will be obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0043] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0044] The industrial control industry utilizes a variety of communication protocols, such as Modbus, HART, and FF, released by different countries and companies. To use these protocol function blocks for inter-device communication, various parameters are typically configured using configuration software on a computer, creating what's known in the industry as a configuration file. This binary configuration file is then downloaded to the runtime software for parsing, and the runtime software completes the designated communication tasks. Because configuration software and runtime software must ensure consistency across the board—that is, the protocol type, link parameters, and semantic specifications defined by the configuration software—this consistency is reflected in the industry as configuration software and runtime software typically being developed and provided by the same company. Even for the configuration and operation of the same communication protocol, the configuration file generated by one company's product configuration cannot be recognized and parsed by another company's runtime software. This results in poor versatility in the protocol function blocks, inconvenience for engineers, and hinders the development of the industrial control industry.
[0045] See Figure 1 , which is a flow chart of the encapsulation method of the protocol function block provided in one embodiment of the present application.
[0046] like Figure 1 As shown, the encapsulation method of the protocol function block includes the following steps:
[0047] S101, configuring the protocol function block to obtain a configured protocol function block;
[0048] The configuration software allows you to freely configure the protocol type, link parameters, and semantic specifications. Configuration methods include graphical user interface configuration and manual scripting. Graphical user interface configuration allows you to edit communication parameters in a pop-up window based on the selected standard communication protocol type and its specifications. Manual scripting allows you to edit communication parameters in a text editor using the JSON data exchange format and key / value pairs.
[0049] S102: performing a mapping process on the standardized fields of the configuration protocol function block, and disassembling the configuration protocol function block to obtain the disassembled configuration protocol function block;
[0050] Load the data dictionary. The data dictionary is a two-dimensional data structure that defines various parameter rules for mainstream functions in industrial control communication protocols, such as the port number, baud rate, data bits, stop bits, and parity bits in port initialization, as well as the function code, data address, and data value in data reading and writing. Each row in the two-dimensional data structure represents various information after a function block function is instantiated. The function block function and the data dictionary establish a unique mapping relationship through the index value. For example, for a protocol function block that needs to read the Siemens S7-200 PLC register address 40001 through the Modbus RTU protocol 03 command, the data dictionary will include the following key records of information such as manufacturer, model, protocol, function code, register, and length:
[0051] primary key Index value …… Manufacturer model protocol Function code register length ……
[0052] Use the data dictionary to map standardized fields to configured protocol function blocks or handwritten scripts. Each protocol function block configuration is broken down into attribute columns in the data dictionary. For example, in the example above, "Manufacturer: Siemens," "Model: S7-200," "Protocol: Modbus RTU," and so on.
[0053] S103, encapsulating the disassembled configuration protocol function block to obtain a text configuration file;
[0054] The above disassembled content is assembled into a text configuration file in JSON format. Finally, the text configuration file is downloaded to the runtime computer disk. After the runtime software loads the data dictionary, it parses the text configuration file and completes the communication task.
[0055] See Figure 2 , which is a flow chart of a method for configuring the protocol function block provided in one embodiment of the present application.
[0056] like Figure 2 As shown, the method for configuring the protocol function block includes the following steps:
[0057] Step S201: Configuration software configures the protocol function block, wherein the protocol function block is stored in a real-time database of the configuration software. Step S202: Select multiple protocol function blocks from the real-time database. Step S203: Connect the input terminal and output terminal of each protocol function block based on the order of the data flow, configure the protocol function block, and obtain the configured protocol function block.
[0058] In the configuration software, users select the required algorithm function block (i.e., protocol function block) from the real-time database by dragging and dropping the mouse according to the needs of process monitoring, and then connect the input terminals and output terminals of the protocol function block in the order of data flow to complete the configuration programming of the process monitoring algorithm.
[0059] See Figure 3 , is a flow chart of a method for disassembling the configuration protocol functional block provided in an embodiment of the present application.
[0060] like Figure 3 As shown, the method for disassembling the configuration protocol function block includes the following steps:
[0061] Step S301: Identify each of the configuration protocol function blocks one by one, and assign a first global number to each of the configuration protocol function blocks;
[0062] When saving a configuration algorithm, each function block used is first identified and assigned a first global number, usually in the form of: ADD:2. Where ADD is the function block type, 2 is the function block type number, and ADD:2 represents the second addition function block.
[0063] Step S302: Continue to identify whether the input terminals and output terminals of each of the configuration protocol function blocks are all connected end to end, and assign second global numbers to the corresponding opposite ends of the input terminals and output terminals to obtain the disassembled configuration protocol function blocks, wherein the opposite end of the input terminal is the output terminal of the first adjacent configuration protocol function block, and the opposite end of the output terminal is the input terminal of the second adjacent configuration protocol function block.
[0064] Then identify whether the terminals of each protocol function block are connected and assign a global number to the other end, usually in the form of: In2(DIV:1-Out1), indicating that the second input terminal is connected and is connected to the value of the first output terminal of the first division function block.
[0065] See Figure 4 , is a flow chart of a method for encapsulating the disassembled configuration protocol functional block provided in one embodiment of the present application.
[0066] like Figure 4 As shown, the method for encapsulating the disassembled configuration protocol function block includes the following steps:
[0067] S401. Identify the type code of the first global number; S402. Find the data structure of the configuration protocol function block after disassembly in the data dictionary based on the type code, and fill the attribute parameter values preset in the configuration protocol function block into the data structure;
[0068] Perform an algorithmic data dictionary search on the type code in the first global number of the identified protocol function block, find the data structure of the protocol function block of this type in the data dictionary, and fill in the other attribute parameter values assigned to the protocol function block during manual configuration into the data structure, such as the execution cycle Timer, the upper limit warning to HighValue, the lower limit warning value LowValue, etc.
[0069] S403: Continue to sequentially fill the first global number and the second global number into the data structure to complete the construction of the data structure and complete the initialization of the data structure;
[0070] The identified first global number and second global number are also filled into the above data structure, and the construction and initialization of a data structure are completed.
[0071] S404, converting the values of the data structures that have been constructed and initialized into key-value pairs in JSON format, and storing them in text form as strings, to obtain a string text file of a single JSON data object; S405, cyclically performing the disassembly and encapsulation operations on all the configuration protocol function blocks, ultimately forming a string text file including multiple JSON data objects, that is, obtaining the text configuration file;
[0072] The values in this data structure are converted into key-value pairs in JSON format, such as "Timer: 5," which indicates a five-millisecond execution cycle, and stored as strings. This unpacking and unpacking operation is repeated for all protocol function blocks in the configuration algorithm, ultimately creating a string text file containing several JSON objects, enabling the clear text storage of the process monitoring algorithm.
[0073] See Figure 5 , which is a framework diagram of the encapsulation device of the protocol function block provided in one embodiment of the present application.
[0074] like Figure 5 As shown, the protocol function block encapsulation device 500 includes a configuration module 501 , a disassembly module 502 , and an encapsulation module 503 .
[0075] The configuration module 501 is configured to configure the protocol function block to obtain a configuration protocol function block; the disassembly module 502 is configured to perform mapping processing on the standardized fields of the configuration protocol function block, disassemble the configuration protocol function block, and obtain the disassembled configuration protocol function block; the encapsulation module 503 is configured to encapsulate the disassembled configuration protocol function block to obtain a text configuration file.
[0076] In one embodiment, the configuration module 501 is configured to:
[0077] Configuration software configures the protocol function block, wherein the protocol function block is stored in a real-time database of the configuration software; a plurality of the protocol function blocks are selected from the real-time database; an input terminal and an output terminal of each of the protocol function blocks are connected based on a data flow sequence, and the protocol function block is configured to obtain the configured protocol function block.
[0078] In one embodiment, the disassembly module 502 is configured to:
[0079] Each of the configuration protocol function blocks is identified one by one, and a first global number is assigned to each of the configuration protocol function blocks. Further identification is performed to determine whether the input terminals and output terminals of each of the configuration protocol function blocks are all connected end to end in sequence, and second global numbers are assigned to the corresponding opposite ends of the input terminals and output terminals, thereby obtaining the disassembled configuration protocol function blocks, wherein the opposite end of the input terminal is the output terminal of the first adjacent configuration protocol function block, and the opposite end of the output terminal is the input terminal of the second adjacent configuration protocol function block.
[0080] In one embodiment, the encapsulation module 503 is configured to:
[0081] Identify the type code of the first global number; find the data structure of the configuration protocol function block after disassembly in the data dictionary based on the type code, and fill the preset attribute parameter values of the configuration protocol function block into the data structure; continue to fill the first global number and the second global number into the data structure in sequence to complete the construction of the data structure and complete the initialization of the data structure; convert the values of the data structures that have been constructed and initialized into key-value pair data in JSON format, and store them in text form in the form of strings to obtain a string text file of a single JSON data object; cyclically perform the disassembly and encapsulation operations on all the configuration protocol function blocks to finally form a string text file including multiple JSON data objects, that is, to obtain the text configuration file.
[0082] In one embodiment, the data dictionary in the encapsulation module 503 is a two-dimensional data structure, which defines various parameter rules of mainstream functions in the communication protocol. Each row of the two-dimensional data structure represents various information after the protocol function block is instantiated. The protocol function block and the data dictionary establish a unique mapping relationship through the index value.
[0083] In one embodiment, the various parameter rules involved in the data dictionary in the encapsulation module 503 include: port number, baud rate, data bit, stop bit, parity bit, function code, data address and data value in port initialization.
[0084] In this embodiment, the encapsulation device of the protocol function block is essentially provided with multiple modules for executing the method in the above embodiment. The specific functions and technical effects can be referred to the above method embodiment and will not be repeated here.
[0085] See Figure 6 , is a structural diagram of an electronic device provided in one embodiment of the present application.
[0086] like Figure 6 As shown, the electronic device 600 includes a processor 601, a memory 602 and a communication bus 603;
[0087] The communication bus 603 is used to connect the processor 601 and the memory 602;
[0088] The processor 601 is configured to execute the computer program stored in the memory 602 to implement one or more methods in the above-mentioned embodiment 1.
[0089] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, the computer program being used to cause a computer to execute any one of the methods in the above-mentioned embodiment 1.
[0090] An embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute the instructions (instructions) of the steps included in embodiment 1 of the embodiment of the present application.
[0091] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor device, apparatus, or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution device, apparatus, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or convey a program for use by or in conjunction with an instruction execution apparatus, device, or device. The program code contained on the computer-readable medium may be conveyed using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0092] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0093] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0094] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in each of the above embodiments.
[0095] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the method and computer program product according to the public embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based device that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0096] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical concepts disclosed in this application shall be covered by the claims of this application.
Claims
1. A method for encapsulating a protocol function block, characterized in that: include: configuring the protocol function block to obtain a configured protocol function block, wherein the configured protocol function block includes a plurality of the protocol function blocks; Performing a mapping process on the configuration protocol function block using standardized fields, and disassembling the configuration protocol function block to obtain the disassembled configuration protocol function blocks, wherein each of the disassembled configuration protocol function blocks has a first global number, and an input terminal and an output terminal of each of the disassembled configuration protocol function blocks have a corresponding opposite-end second global number; Encapsulating the disassembled configuration protocol function blocks to obtain a text configuration file; Using a data dictionary to perform mapping processing on standardized fields of the configuration protocol function block; The disassembled configuration protocol function block is encapsulated to obtain a text configuration file, including: a type code identifying the first global number; Finding the data structure of the disassembled configuration protocol function block in the data dictionary based on the type code, and filling the attribute parameter values preset by the configuration protocol function block into the data structure; Continue to sequentially fill the first global number and the second global number into the data structure to complete the construction of the data structure and complete the initialization of the data structure; Convert the values of the data structures that have been constructed and initialized into key-value pairs in JSON format, and store them in a text form as a string to obtain a string text file of a single JSON data object; The disassembly and encapsulation operations are cyclically performed on all the configuration protocol function blocks, and finally a character string text file including multiple JSON data objects is formed, that is, the text configuration file is obtained.
2. The method for encapsulating a protocol function block according to claim 1, wherein: The protocol function block is configured to obtain a configuration protocol function block, including: Configuration software configures the protocol function block, wherein the protocol function block is stored in a real-time database of the configuration software; Selecting a plurality of the protocol function blocks from the real-time database; The input terminal and the output terminal of each of the protocol function blocks are connected based on the order of the data flow, and the protocol function block is configured to obtain the configured protocol function block.
3. The method for encapsulating a protocol function block according to claim 2, wherein: The configuration protocol function block is disassembled to obtain the disassembled configuration protocol function block, including: Identifying each of the configuration protocol function blocks one by one, and assigning each of the configuration protocol function blocks a first global number; Continue to identify whether the input terminals and output terminals of each of the configuration protocol function blocks are all connected end to end in sequence, and assign second global numbers to the corresponding opposite ends of the input terminals and output terminals to obtain the disassembled configuration protocol function blocks, wherein the opposite end of the input terminal is the output terminal of the first adjacent configuration protocol function block, and the opposite end of the output terminal is the input terminal of the second adjacent configuration protocol function block.
4. The method for encapsulating a protocol function block according to claim 1, wherein: The data dictionary is a two-dimensional data structure that defines various parameter rules for mainstream functions in the communication protocol. Each row of the two-dimensional data structure represents various information after the protocol function block is instantiated. The protocol function block and the data dictionary establish a unique mapping relationship through the index value.
5. The method for encapsulating a protocol function block according to claim 4, wherein: The various parameter rules include: port number, baud rate, data bit, stop bit, check bit, function code, data address and data value in port initialization.
6. A device for encapsulating a protocol function block, characterized in that: include: A configuration module, configured to configure the protocol function block to obtain a configuration protocol function block, wherein the configuration protocol function block includes a plurality of the protocol function blocks; a disassembly module, configured to perform a mapping process on the standardized fields of the configuration protocol function block, disassemble the configuration protocol function block to obtain the disassembled configuration protocol function blocks, wherein each of the disassembled configuration protocol function blocks has a first global number, and each input terminal and output terminal of the disassembled configuration protocol function block has a corresponding opposite-end second global number; An encapsulation module is used to encapsulate the disassembled configuration protocol function block to obtain a text configuration file; The disassembly module is specifically used to perform mapping processing of standardized fields on the configuration protocol function block using a data dictionary; The encapsulation module is specifically used to identify the type code of the first global number; based on the type code, find the data structure of the configuration protocol function block corresponding to the disassembly in the data dictionary, and fill the preset attribute parameter values of the configuration protocol function block into the data structure; continue to fill the first global number and the second global number into the data structure in sequence to complete the construction of the data structure and complete the initialization of the data structure; convert the values of the data structures that have been constructed and initialized in succession into key-value pair data in JSON format, and store them in text form in the form of strings to obtain a string text file of a single JSON data object; cyclically perform the disassembly and encapsulation operations on all the configuration protocol function blocks, and finally form a string text file including multiple JSON data objects, that is, obtain the text configuration file.
7. An electronic device, characterized in that: Includes processor, memory and communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the protocol function block encapsulation method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that A computer program is stored thereon, and the computer program is used to enable a computer to execute the protocol function block encapsulation method according to any one of claims 1 to 5.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for encapsulating the protocol function block according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Soft PLC configuration development method based on XML technology
CN108681444A
Soft PLC configuration software generation system based on FPGA platform
CN110376959A