Method for automatically generating configuration program of SAMA graph

Through the method of automatically generating configuration programs based on SAMA diagrams, using the improved DT-DETR model and graph theory algorithms, the complexity and multi-line merging problems of existing tools in converting SAMA diagrams are solved, and fast and accurate Configuration program generation improves the design efficiency and accuracy of the control system.

CN118626072AActive Publication Date: 2024-09-10HANGZHOU DIANZI UNIV

Patent Information

Application Number
CN202410659099.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-09-10
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

Existing automation tools require user manual intervention when converting SAMA diagrams into configuration programs. They have limited ability to handle complex logical relationships and lack of unified standards, resulting in insufficient design efficiency and accuracy. Multi-line parallel problems affect configuration program generation.

Method used

Using the method of automatically generating configuration programs based on SAMA diagrams, through the steps of preprocessing, project file parsing, error checking, connection relationship establishment and XML storage, combined with the improved DT-DETR model, graph theory algorithms and geometric calculations, legend recognition is achieved Accurate analysis and correction of connection relationships reduces the workload of engineers and improves design efficiency.

Benefits of technology

It realizes the rapid and accurate conversion of SAMA diagrams into configuration programs, reduces the workload of engineers, improves the design and implementation efficiency of the control system, and enhances the accuracy and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626072A
    Figure CN118626072A
Patent Text Reader

Abstract

The invention discloses a method for automatically generating a configuration program based on an SAMA graph, which comprises the following steps: step 1, a preprocessing process: identifying and analyzing SAMA graph legend files of different sources and predefined legend code segment files, matching legends and code segments, and storing the matched legends and code segments as a component library; step 2, project file analysis and information extraction: reading a real SAMA graph, analyzing the project file of the SAMA graph, and obtaining legend and line segment information; step 3, error checking and correction: analyzing the layout and the structure in the SAMA graph, and providing a correction prompt to correct the error; step 4, identifying a connection relationship among legends in the SAMA graph, and storing the connection relationship as a graph-like structure; and 5, traversing the graphic structure, converting the converted graphic structure into an XML format, and storing the converted graphic structure. According to the method, the SAMA graph can be converted into the corresponding configuration program more quickly and accurately, so that the workload of engineers is reduced, and the design and implementation efficiency of a control system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automation control technology, and in particular to the design and implementation of control systems in the field of industrial automation, and specifically to a method for automatically generating a configuration program based on a SAMA diagram, which is used for the design and implementation of an automation control system. Background Art

[0002] In the field of industrial automation, control system design and implementation are crucial. Traditionally, engineers usually rely on manual programming to implement the functions of the control system. Among them, SAMA (Sequential Function Chart and Function Block Diagram) diagram is a commonly used tool to describe control logic and functions. However, manual programming has some disadvantages, such as time-consuming, error-prone, and difficult to maintain.

[0003] With the development of computer technology, the use of automation tools is becoming increasingly popular. Automation tools can greatly improve the efficiency and accuracy of control system design. At present, there are some automation tools on the market that can convert graphical descriptions into corresponding configuration programs. However, these existing tools usually require manual intervention by users, cannot fully automate the conversion, and have limited processing capabilities for complex logical relationships. In addition, SAMA diagrams, as a commonly used graphical description method, lack unified standards among different instrument companies, which also brings certain difficulties to the development and application of automation tools. In addition, in the process of drawing, there may be problems with multiple lines being paralleled, which will cause difficulties for automation tools in parsing graphical descriptions, thereby affecting the generation of configuration programs. Therefore, although automation tools have certain advantages in improving the efficiency of control system design, they still need further improvement in handling complex logic and standard specifications.

[0004] Therefore, a new method is needed to solve these problems and improve the efficiency and accuracy of control system design. The present invention is proposed to address this demand and aims to provide an automatic conversion method based on SAMA diagram, so that users can convert SAMA diagram into corresponding configuration programs more quickly and accurately, thereby reducing the workload of engineers and improving the design and implementation efficiency of control systems. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention proposes a method for automatically generating a configuration program based on a SAMA diagram, so that users can convert the SAMA diagram into a corresponding configuration program more quickly and accurately, thereby reducing the workload of engineers and improving the design and implementation efficiency of the control system.

[0006] In order to solve the above technical problems, the technical solution of the present invention is:

[0007] A method for automatically generating a configuration program based on a SAMA diagram comprises the following steps:

[0008] Step 1, preprocessing process: identify and parse SAMA diagram legend files and predefined legend code segment files from different sources, match the legends and code segments, and save them as components;

[0009] Step 2: Engineering file analysis and information extraction: read the real SAMA diagram, analyze the engineering file of the SAMA diagram, and obtain the legend and line segment information;

[0010] Step 3, Error checking and correction: Analyze the layout and structure in the SAMA diagram and provide correction hints to correct the errors;

[0011] Step 4: Establish and save connection relationships: Identify the connection relationships between the various legends in the SAMA diagram and save them as a graph structure, including nodes and connection lines;

[0012] Step 5: Convert to XML for storage: traverse the graph structure, convert the data of the graph structure into XML format, and store it.

[0013] Preferably, when matching the legend with the code segment in step 1, the legend is identified by the improved DT-DETR model to obtain different types of legends, and the legends and the corresponding code segments are stored in the component library by type classification.

[0014] As the preferred method, the improved DT-DETR model mainly includes the following optimizations: the RepGhostELAN module is designed to replace the original basicblock module. The introduction of the RepGhostELAN module reduces the number of network parameters and computational complexity by designing a lightweight network, so that the model can ensure recognition accuracy while greatly improving the computational efficiency; the BiForme attention mechanism is introduced to pay more attention to the feature information related to the SAMA diagram legend at different scales. The BiForme attention mechanism captures the key features of the legend at multiple scales while maintaining its lightweight, and does not bring significant computational burden to the model, thus ensuring the efficiency and accuracy of the model; MPDIou is used to replace the original GIoU. The introduction of MPDIou improves the robustness of the detection model for SAMA diagram legend recognition, so that the model can still accurately recognize various types of legends under complex backgrounds. Through the above improvements, the DT-DETR model not only improves the accuracy and robustness when identifying the legends in the SAMA diagram, but also significantly reduces the consumption of computing resources and improves the overall recognition efficiency.

[0015] Preferably, in step 2, the method for parsing the engineering file of the SAMA diagram is:

[0016] First, traverse all entity information in the SAMA graph;

[0017] Then, the legend is identified based on the specific identification or attributes of the entity information. The specific steps are as follows:

[0018] a. Analyze each entity information and extract its type, identifier and other relevant attributes;

[0019] b. Match the extracted information with the predefined component library to determine whether the entity information belongs to a specific component;

[0020] Secondly, extract the relevant attributes and functional descriptions of the identified legends, including but not limited to name, type, connection relationship, etc.;

[0021] Finally, based on the identified legend, the legend and line segment information are generated. The specific steps are as follows:

[0022] a. Draw the corresponding legend according to the position and connection relationship of the legend;

[0023] b. Extract and draw the connecting line segments between the legends to complete the analysis of the entire SAMA diagram.

[0024] Preferably, the entity information includes graphic elements, text descriptions, and block types.

[0025] Preferably, in step 2, in the process of parsing the engineering file of the SAMA diagram, the basic graphics that are not legends are combined according to the graphics combination algorithm, and the legend obtained after the combination is compared with the component library. If they match, the combination is saved.

[0026] Preferably, in step 3, the analysis method of the layout and structure in the SAMA diagram is:

[0027] Use data structures and algorithms in various programming languages ​​to check whether each recognized legend already exists in the component library to determine the recognition status of the legend in the system. Specifically, data structures such as hash tables or sets can be used to store the existing legends in the component library, and during the recognition process, each recognized legend is checked to see whether it exists in the component library;

[0028] Use graph theory algorithms to check if there are multiple line segments between two legends to ensure that the connection relationship is clear and accurate. Specifically, you can use algorithms such as depth-first search (DFS) or breadth-first search (BFS) to start from one legend and gradually traverse the connected line segments to determine whether there are multiple line segments.

[0029] The distance formula from a point to a line segment in geometric calculation is used to analyze the line segment position and determine whether the line segment is on the corresponding legend. Specifically, for a given line segment and legend, the shortest distance from each point on the line segment to the legend is first calculated, and then these distances are compared with the preset threshold. If the shortest distance is within the threshold range, the line segment can be considered to be on the legend, otherwise it is marked as an error.

[0030] Preferably, the specific method of step 4 is as follows:

[0031] Step 4.1: For the identified connection relationships, clearly mark the input and output of each legend to facilitate subsequent logic processing and program generation;

[0032] Step 4.2: Save the attribute information of each connection for more detailed analysis and optimization in subsequent processing;

[0033] Step 4.3: Visualize the connection relationship;

[0034] Step 4.4: For each legend input and output, perform a matching check to ensure that the data types and formats of the input ports and output ports match to avoid incompatible or incorrect connections.

[0035] Preferably, the attribute information includes connection type, connection mode and connection channel, wherein the connection type includes logical connection and data stream connection, and the connection mode includes serial and parallel.

[0036] Preferably, in step 3, the correction step includes error correction and prompting based on the learned knowledge base and rules.

[0037] Preferably, the error checking and correction step further includes automatically arranging and optimizing the identified graphics to improve the efficiency and performance of the configuration program.

[0038] Preferably, the step of establishing and saving the connection relationship further includes verifying and optimizing the identified connection relationship to ensure the correctness and stability of the converted configuration program.

[0039] Preferably, the step of converting to XML storage further includes compressing and encrypting the generated XML file to protect intellectual property rights and program security.

[0040] The present invention has the following characteristics and beneficial effects:

[0041] By adopting the above technical solution, the system can accurately obtain the legend and line segment information in the SAMA diagram by using the precise identification and analysis of the SAMA diagram in the preprocessing process, as well as the deep analysis and information extraction of the SAMA diagram engineering file. Through the clear identification of the legend and the position analysis of the line segment, the system can determine the connection relationship between the legend and the line segment, including the case of multiple line segments. In this way, the user can convert the SAMA diagram into the corresponding configuration program more quickly and accurately during the conversion to the configuration program. This process greatly reduces the workload of engineers and improves the design and implementation efficiency of the control system. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0043] Figure 1 A flowchart of a method for automatically generating a configuration program from a SAMA diagram provided in an embodiment of the present application;

[0044] Figure 2 A flowchart of the process of engineering file parsing and information extraction provided in one embodiment of the present application;

[0045] Figure 3 A flowchart of the combination and correction of graphics provided in one embodiment of the present application;

[0046] Figure 4 A flowchart of establishing and saving a connection relationship provided in an embodiment of the present application;

[0047] Figure 5 A SAMA diagram legend file provided for an embodiment of the present application;

[0048] Figure 6 A typical example of a SAMA diagram provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0050] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings.

[0051] On the contrary, the present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention as defined by the claims. Further, in order to make the public have a better understanding of the present invention, some specific details are described in detail in the detailed description of the present invention below. Those skilled in the art can fully understand the present invention without the description of these details.

[0052] In view of the limitations and shortcomings of the prior art in converting SAMA diagrams into configuration programs, the present invention proposes an innovative solution. The following are specific embodiments: Figure 1 , which is a flowchart of a method for automatically generating a configuration program from a SAMA diagram of the present application, and the method at least comprises the following steps:

[0053] S1: Preprocessing

[0054] The input SAMA diagram legend files are scanned and analyzed one by one to accurately identify different types of legends, match the legends and code snippets, and store them in the component library by type classification. At the same time, the predefined legend code snippet files are read to ensure that they correspond to the component library.

[0055] Furthermore, when matching the legend with the code segment, the legend is identified through the improved DT-DETR model to obtain different types of legends, and the legends and corresponding code segments are stored in the component library by type classification. Specifically, the improved DT-DETR model mainly includes the following optimizations: the RepGhostELAN module is designed to replace the original basicblock module. The introduction of the RepGhostELAN module reduces the number of network parameters and the amount of calculation by designing a lightweight network, so that the model can ensure the recognition accuracy while greatly improving the operation efficiency; the BiForme attention mechanism is introduced to pay more attention to the feature information related to the SAMA diagram legend at different scales. The BiForme attention mechanism captures the key features of the legend at multiple scales while maintaining its lightweight, which will not bring significant computational burden to the model, ensuring the efficiency and accuracy of the model; MPDIou is used to replace the original GIoU. The introduction of MPDIou improves the robustness of the detection model for SAMA diagram legend recognition, so that the model can still accurately recognize various types of legends under complex backgrounds. Through the above improvements, the DT-DETR model not only improves the accuracy and robustness when identifying legends in SAMA diagrams, but also significantly reduces the consumption of computing resources and improves the overall recognition efficiency.

[0056] S2: Engineering file analysis and information extraction

[0057] In-depth analysis of SAMA diagram engineering files, accurate extraction of various legends and line segment information, providing rich and reliable data support for subsequent processing and analysis of the system, ensuring accuracy and completeness.

[0058] Specifically, Figure 2 As shown, step S2 includes the following sub-steps:

[0059] S201: Traversing entity information

[0060] Traverse all entity information in the SAMA diagram one by one, which may include graphic elements, text descriptions, block types, etc. By traversing the entity information, the system can fully understand the structure and content of the SAMA diagram;

[0061] S202: Identify the legend

[0062] First, legends are identified. These legends usually have a specific appearance and function, and are used to represent various functional blocks or modules in the control system. During the identification process, the system will extract relevant attributes and functional descriptions for subsequent processing and identification;

[0063] S203: Processing basic graphics

[0064] Processing of non-legend basic graphics. These basic graphics may include various shapes, lines or other geometric elements, which may not belong to the predefined legend. The system will combine these basic graphics and compare them with the legend library. If a matching legend is found, the system will save these combinations for subsequent use. This process helps to identify and process various graphic elements in the SAMA diagram, so as to more accurately convert them into components and functional modules of the configuration program.

[0065] S3: Error checking and correction

[0066] The layout and structure of the SAMA diagram are analyzed in detail to ensure the accuracy and rationality of the graphic combination. Subsequently, correction tips are provided to guide the user to make necessary corrections for possible errors or irregularities to ensure that the final conversion result is accurate. Correction tips may cover aspects such as graphic position adjustment, symbol replacement, and logical relationship optimization to maximize the quality and readability of the SAMA diagram.

[0067] Further, such as Figure 3 As shown, step S3 includes the following sub-steps:

[0068] S301: component library status check

[0069] Check each legend one by one to verify whether it has been recorded in the component library. This step ensures that the system can correctly identify and process each block during processing, avoiding duplicate additions or processing of existing blocks.

[0070] Specifically, data structures and algorithms in various programming languages ​​are used to check whether each recognized legend already exists in the component library to determine the recognition status of the legend in the system. Specifically, data structures such as hash tables or sets can be used to store the existing legends in the component library, and during the recognition process, each recognized legend is checked to see whether it exists in the component library.

[0071] S302: Connection relationship analysis

[0072] Analyze the connection between the two legends in the SAMA diagram in detail, including the possible existence of multiple line segments. The goal of this step is to ensure that the connection is clear and accurate to prevent confusion or errors in the transfer of information.

[0073] Specifically, algorithms in graph theory are used to check whether there may be multiple line segments between two legends to ensure the clarity and accuracy of the connection relationship. Specifically, algorithms such as depth-first search (DFS) or breadth-first search (BFS) can be used to start from one legend and gradually traverse the line segments connected to it to determine whether there are multiple-headed line segments.

[0074] S303: Line segment position verification

[0075] Use the point-to-line distance formula in geometric calculations to analyze the line segment position and determine whether the line segment is on the corresponding legend. For each line segment, verify whether its position matches the corresponding block. By checking the shortest distance from each point on the line segment to the legend, and then comparing these distances with the preset threshold, determine its accuracy, mark any line segment that does not match the block to identify and correct possible errors.

[0076] Specifically, for a given line segment and legend, the shortest distance from each point on the line segment to the legend is first calculated, and then these distances are compared with a preset threshold. If the shortest distance is within the threshold range, the line segment can be considered to be on the legend, otherwise it is marked as an error.

[0077] S304: Error correction suggestions

[0078] After an error is found, corresponding correction suggestions are provided. These suggestions may include adding unrecognized blocks to the component library or adjusting the position of line segments. Such correction measures help ensure the accuracy and consistency of graphics and improve the quality and efficiency of system processing.

[0079] S4: Establishing and preserving connection relationships

[0080] The system will identify and establish the connection relationships between the components in the SAMA diagram. This process involves identifying the components in the diagram and determining the logical or data flow connections between them. The system saves the identified connection relationships in the form of a graph structure, which includes nodes and connecting lines. The nodes represent the functional blocks in the diagram, and the connecting lines represent the connection relationships between the functional blocks. By saving the graph structure of these connection relationships, the system can better understand and describe the control logic of the SAMA diagram and provide the necessary data foundation for subsequent conversion and processing.

[0081] Further, such as Figure 4 As shown, step S4 includes the following sub-steps:

[0082] S401: Input and output identification

[0083] Process the identified connection relationships and clearly identify the input and output of each component. By identifying each connection, the system can more clearly understand the data flow between components and provide necessary information for subsequent logic processing and program generation;

[0084] S402: Connection attribute record

[0085] The attribute information of each connection will be saved. This attribute information includes the type of connection (such as logical connection, data flow connection), the mode of connection (serial, parallel), the channel of connection, etc. By recording this attribute information, the system can perform more detailed analysis and optimization, and provide more reference basis in the subsequent processing process;

[0086] S403: Visualization of connection relationships

[0087] Visualize the connection relationship. In addition to displaying the connection relationship between function blocks, the system also displays the input and output ports of each connection. Such a visual display can directly present the data flow and logical relationship of the system, helping users better understand the structure and operation of the entire control system;

[0088] S404: Input and output matching check

[0089] The input and output of each component will be checked for matching. By checking the data type and format of the input port and output port, the system can ensure that they match and avoid incompatible or incorrect connections. Such matching checks can improve the stability and reliability of the system.

[0090] S5: Convert to XML for storage

[0091] The system will convert the identified SAMA diagram and the established connection relationship into XML format according to the pre-defined conversion rules and store them. This process involves converting the various functional blocks of the SAMA diagram and the connection relationship between them into the structured form of an XML document. By storing in XML format, the system can more conveniently perform subsequent processing, analysis and sharing. The XML document contains all the key information of the SAMA diagram, including functional block attributes, connection relationships, layout, etc., which provides an important data basis for the generation and debugging of configuration programs.

[0092] like Figure 5 Shown is the SAMA diagram legend file, which contains all the legends used in the project file.

[0093] like Figure 6 The figure shows a simple typical case in the SAMA diagram engineering file. The specific content is that two numbers are input and the product is obtained through the multiplier. The output result passes through the high-value signal monitor. If it exceeds the predefined threshold, an alarm is issued and a 5s pulse is output.

[0094] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments including components are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.

Claims

1. A method for automatically generating a configuration program based on a SAMA diagram, characterized in that: The steps include: Step 1, preprocessing process: identify and parse SAMA diagram legend files and predefined legend code segment files from different sources, match the legends and code segments, and save them as components; Step 2: Engineering file analysis and information extraction: read the real SAMA diagram, analyze the engineering file of the SAMA diagram, and obtain the legend and line segment information; Step 3, Error checking and correction: Analyze the layout and structure in the SAMA diagram and provide correction hints to correct the errors; Step 4: Establish and save connection relationships: Identify the connection relationships between the various legends in the SAMA diagram and save them as a graph structure, including nodes and connection lines; Step 5: Convert to XML for storage: traverse the graph structure, convert the data of the graph structure into XML format, and store it.

2. A method for automatically generating a configuration program based on a SAMA diagram according to claim 1, characterized in that: When matching the legend with the code segment in step 1, the legend is identified by the target detection model to obtain different types of legends, and the legends and the corresponding code segments are stored in the component library according to the type classification.

3. A method for automatically generating a configuration program based on a SAMA diagram according to claim 2, characterized in that: The target detection model adopts the DT-DETR model as the backbone network, and uses the RepGhostELAN module to replace the basicblock module in the DT-DETR model, reducing the network parameters and calculation amount through the lightweight network; the BiForme attention mechanism is introduced after the RepGhostELAN module to capture the key features related to the SAMA graph legend at different scales; MPDIou is used to replace GIoU in the DT-DETR model.

4. The method for automatically generating a configuration program based on a SAMA diagram according to claim 2, characterized in that: In step 2, the method for parsing the engineering file of the SAMA diagram is: First, all entity information in the SAMA graph is traversed, including legends, line segments, graphic elements, text descriptions, and block types; Then, the legend is identified based on the specific identification or attribute of the entity information; Secondly, extract the relevant attributes and functional descriptions of the identified legends, including name, type, and connection relationship; Finally, based on the identified legends, the legend and line segment information are generated: the corresponding legends are drawn according to the position and connection relationship of the legends; the connecting line segments between the legends are extracted and drawn to complete the parsing of the entire SAMA diagram.

5. A method for automatically generating a configuration program based on a SAMA diagram according to claim 4, characterized in that: In step 2, the method for identifying the legend is: Analyze each entity information and extract its type, identifier and other relevant attributes; The extracted information is matched with a predefined component library to determine whether the entity information belongs to a specific component.

6. The method for automatically generating a configuration program based on a SAMA diagram according to claim 4, characterized in that: In step 2, in the process of parsing the engineering file of the SAMA diagram, the basic graphics that are not legends are combined according to the graphics combination algorithm, and the legend obtained after the combination is compared with the component library. If they match, the combination is saved.

7. The method for automatically generating a configuration program based on a SAMA diagram according to claim 4, characterized in that: In step 3, the analysis method of the layout and structure in the SAMA diagram is: Using data structures and algorithms in any programming language to check whether each recognized legend already exists in the component library to determine the recognition status of the legend in the system; Use graph theory algorithms to check if there are multiple line segments between two legends to ensure that the connection relationship is clear and accurate; Use the distance formula from a point to a line segment in geometric calculations to analyze the position of the line segment and determine whether the line segment is on the corresponding legend.

8. The method for automatically generating a configuration program based on a SAMA diagram according to claim 7, characterized in that: The specific method of step 4 is as follows: Step 4.1: For the identified connection relationships, clearly mark the input and output of each legend to facilitate subsequent logic processing and program generation; Step 4.2: Save the attribute information of each connection for more detailed analysis and optimization in subsequent processing; Step 4.3: Visualize the connection relationship; Step 4.4: For each legend input and output, perform a matching check to ensure that the data types and formats of the input ports and output ports match to avoid incompatible or incorrect connections.

9. The method for automatically generating a configuration program based on a SAMA diagram according to claim 8, characterized in that: The attribute information includes connection type, connection mode and connection channel.

Citation Information

Patent Citations

  • Soft PLC configuration software generation system based on FPGA platform

    CN110376959A

  • Graphical logic control system, method and device and readable storage medium

    CN112462713A

  • Nuclear power DCS algorithm configuration logic diagram drawing system

    CN113703405A

Cited By

  • Intelligent picking robot and monitoring system

    CN119949151A

  • Automatic analysis and labeling method for KiCad EDA engineering data

    CN121413549A