Method and apparatus for using graphical industrial program structure with language model
By converting the graphic program into text format and using text-based language model processing, the problem that the language model cannot directly handle the graphic programming language is solved, and the interoperability of the graphic language model and the field of industrial automation is realized, and the flexibility and efficiency of the automation system are improved.
Patent Information
- Application Number
- CN202411362029.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-09-28
- Filing Date
- 2024-09-27
- Publication Date
- 2025-03-28
AI Technical Summary
Existing language models cannot directly deal with graphical programming languages, especially in the field of industrial automation, lack solutions that can interoperate with graphical language models.
By converting the graphics program to a compact, easy-to-read text format and processing it using a text-based language model on this basis, the results are finally converted back to the graphical form to achieve interoperability of the graphical language model.
The interoperability between the graphical language model and the graphical programming language in the field of industrial automation is realized, allowing the use of language models to analyze and improve the construction of automation programs, and improving the flexibility and efficiency of the automation system.
Smart Images

Figure CN119718289A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method according to the present invention for using a system having an artificial intelligence with a text-based language model for processing at least one graphical program structure, and a programming device according to the present invention for using a system having an artificial intelligence with a text-based language model for processing at least one graphical program structure. Background Art
[0002] Language models, such as those used, for example, in chatbots with the artificial intelligence ChatGPT from the manufacturer OpenAI, require textual languages for operation in communication between humans and machines. Graphical languages are not directly accessible to them. Most automation technicians prefer graphical languages, mostly according to EN 611131 / IEC 61131, in particular ladder diagrams (abbreviation: LD, ladder diagram). Therefore, ladder diagrams, sequential function flow charts (abbreviation: SFC, squential function charts) and other graphical languages (such as sequential control diagrams) or others supported by language models are not generated.
[0003] In the field of graphical languages, in particular industrial automation components (e.g. programmable logic controllers, abbreviation: PLC), there are no solutions using language models. However, such a solution is desirable, since it would thus be possible to use language models based on artificial intelligence, for example, for developing existing automation programs and thus to create or improve industrial control systems for automation of manufacturing plants or in the process industry, wherein software developers can also continue to work with their trusted languages and development tools. Summary of the invention
[0004] It is therefore an object of the present invention to provide a device for interacting with an artificial intelligence-based language model using constructs of a graphics-based programming language, in particular from industrial automation technology.
[0005] One solution to this problem requires that the graphical language must be converted to a text format. The text format must have several characteristics in order to be interpretable:
[0006] As compact and readable as possible.
[0007] There are no semantically unnecessary language components that are not necessarily domain-dependent (e.g., XML representation of LD in engineering systems).
[0008] Be understandable to humans so that they can check the results.
[0009] There are no difficult-to-interpret symbols.
[0010] The generated textual representation must be convertible back into the original graphical form.
[0011] This object is achieved by the method according to the invention and the programming device according to the invention.
[0012] A method is proposed for using a system with artificial intelligence having a text-based language model, in particular a generated pre-trained chatbot, for processing at least one program representation in a graphical industrial programming language, in particular a coupling diagram. During the input of a graphical program structure into the system, the graphical program representation is converted into a sequence of Boolean program representations in textual form, wherein non-Boolean (e.g. text-based) program representations of the graphical program structure are in each case integrated between adjacent Boolean program representations. The language model can thus be used to learn and use the structure of ladder diagram programming, in particular as an aid for analyzing program structures and for artificial intelligence-based assistance in the creation and development of industrial software in automation technology.
[0013] The object is also achieved by a system for using an artificial intelligence with a text-based language model with a pre-trained chatbot, in particular generated, to process at least one programming device with a plurality of program expressions, in particular coupling diagrams, in a graphical industrial programming language. In this case, the programming device is configured with the aid of conversion software that implements the above-described method. As a result, the advantages already discussed with respect to the method can be achieved.
[0014] Advantageous embodiments of the method according to the invention are provided in the invention. Here, the described features and their advantages also apply similarly to the programming device according to the invention. Advantageous variants can be implemented individually and in meaningful combinations with each other.
[0015] Particularly advantageously, the method can be used if a graphical program structure is transmitted to a system with artificial intelligence for training and generating reply messages, wherein the reply messages are then transmitted back to a text-based program structure, which is then used for programming the industrial automation arrangement and thus controlling the industrial automation or industrial process. For this purpose, advantageously, the reply program structure of the system consisting of text-based program expressions is converted into a graphical reply program structure ("return conversion") and is used to program the industrial automation arrangement and control the industrial process or industrial production.
[0016] In a plurality of actual application situations, the non-Boolean text-based program expression of the graphical program structure is a function block with a plurality of input variables and / or a plurality of output variables. Advantageously, in the case of a plurality of non-Boolean input variables of the non-Boolean text-based program expression, it is defined as a parameter in the generated text-based program expression, and is implemented as a link, preferably as a merger. In the case of a plurality of non-Boolean output variables of the non-Boolean text-based program expression, it can be defined as an output value in the generated text-based program structure, and converted as a branch, preferably as a derivation or as a logical or ("or").
[0017] In an advantageous embodiment, the language model is pre-trained with a data set having non-standardized function blocks, preferably non-Boolean text-based program expressions. Thus, the language model can be trained to handle non-standardized syntax in order to extract it appropriately from the graphical program structure. Furthermore, for the training, non-Boolean input variables and / or non-Boolean output variables are advantageously marked with standardized names in each case in order to improve the extraction of the program expressions or program elements.
[0018] In order to convert the text-based reverter structure back to the graphical reverter structure, the infix expression is advantageously converted to a postfix expression, wherein a stack-based conversion algorithm is used. Parentheses and non-operational tokens before parentheses are also advantageously removed during the conversion back, which cannot be represented in the graphical industrial programming language. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] An exemplary embodiment of the method according to the invention is explained below with reference to the drawings. At the same time, it serves to explain the device according to the invention, namely the programming device according to the invention.
[0020] The accompanying drawings show:
[0021] Figure 1 shows the conversion of a graphical program structure into a Boolean expression (in text form),
[0022] Figure 2 shows the conversion of another program structure with embedded function blocks into a compressed text form and then into an expanded text form, and
[0023] Figure 3 The conversion of infix expressions to suffix expressions and then to graphs and LD annotations is shown. DETAILED DESCRIPTION
[0024] Mathematically, ladder diagrams and other graphical program constructs of standard IEC 61131-3 are Boolean formulas which are represented as diagrams, see for example Figure 1The graphical program construction GP1 in the upper part. The order of objects connected by lines is the order of logical AND expression. Branches are the exclusive OR of their branches, starting with AND and an open square bracket. Links generate closed brackets. Non exists only for individual connections, not for complete subgraphs. Virtual nodes are generated before all starting lines (edges), which branch off from the starting line.
[0025] For one formula or the same formula (e.g. a Boolean expression), there are several different graphical constructions ("LD"; LD elements), and conversely there are several formulas showing the same Boolean function. Therefore, the formula should be reduced to a canonical form, for example, by expanding it in and thereby removing brackets.
[0026] The nodes in the graph are either standard LD elements (e.g. flip-flop, NOT), which can be directly converted to Boolean expressions and added to the formula, or function blocks with some Boolean inputs and outputs and other inputs and outputs, which are typically connected to data points (e.g. registers or variables). Such function blocks (abbreviation: FB) are identified by special tags, e.g. ["TYPE_DATAPLACE_FB"] for FBs with the name "TYPE_DATAPLACE_FB".
[0027] The internals of such FBs are unknown ("Blackbox"), so two rules apply: if multiple Boolean inputs are present, it behaves like a "merge" (generates a closed bracket); if multiple outputs are available, it behaves like a "derivation" (generates an OR). Non-Boolean inputs are written as parameters of the function block (FB), non-Boolean outputs with output identifiers, for example:
[0028] ["TYPE_DATAPLACE_FB"(x1,x2)(y1,y2)].
[0029] If the language model is trained "against" automation standards, where standard function blocks ("standard FB") are used, the names of the FB used above should be used. If the language model is trained on a different data set with non-standardized function blocks, the names of the function blocks are reduced to common names, such as "FB". The language model is thereby reduced to learning only structures. If the (non-Boolean) input and output variables have standard names, this again limits the language model to learning structures instead of specific scenarios.
[0030] Figure 1 A first example is shown, in which a graphical program structure GP1 (upper part) is converted into a text-based program structure TP1 (in the lower part).
[0031] When using function blocks (FB), program elements can be transferred into the text-based program structure TP2A, TP2B in the sense of a “black box” and processed by the artificial intelligence as blocks with defined inputs and outputs. Figure 2 A second example of a transformation with a comparison operation (“CMP”) and a transformation (“MOVE”) is shown, wherein in a second transformation step the connected variables IN1 , IN2 are resolved (expanded) (actual value, maximum Sp).
[0032] Note that the second case is less common and less useful for training language models unless variable names should be standardized.
[0033] In order to convert the formula generated by the language engine back into a graphical expression or graphical program structure (such as LD), the infix expression ( Figure 3 The top part) is converted to a suffix expression, wherein a known stack-based conversion algorithm is applied. This removes brackets and non-operation symbols before brackets, which cannot be represented in LD (“Ladder Diagram”; coupling diagram). Finally, the suffix is converted to an LD diagram. This situation is Figure 3 Shown in.
[0034] Given is the suffix expression ( Figure 3 , line 2), where the input or
[0035] An operand that represents an input variable / output variable or a function block with associated Boolean input / output points, or
[0036] Operators (logical AND, XOR, and NOT as single operators).
[0037] The aim is to generate directed graphs which represent LD ("coupling graphs") (LD is an aperiodic directed graph). The expression X->Y marks a direct connection from X to Y in each case.
[0038] Defines a stack (stacked storage structure) for storing subgraphs. In the usual way, extract the operand from the left side of the suffix expression. If the expression is an operand, it is placed on the stack, where it is illustrated as a subgraph with only one node. If it is an operator, it is applied to the topmost element of the stack (the subgraph) and the result is stored on the stack, which is the new subgraph. The subgraph is generated as follows:
[0039] 1. For the “and” operator, the penultimate and last subgraph of the stack are connected with a directed edge (line), wherein the penultimate subgraph provides the output node and the last subgraph provides the input node, which is clear due to the construction:
[0040] A
[0041] B
[0042] "and"
[0043] Become "b-->a", b = the end node of graph B and a = the start node of graph A.
[0044] 2. For the operator "or", a false node is generated, which connects the two top graphs A and B on the stack; the resulting graph is stored on the stack:
[0045] A
[0046] B
[0047] "or"
[0048] become
[0049]
[0050] 3. For the operation flag "not", mark the topmost stack element as negated. This element is always a single node due to its construction.
[0051] Generating LD from a directed graph is not difficult. The original node is connected on the left with a vertical start line of LD. Then, the graph is constructed to the right or downward in the direction of the edges. Note that the edge direction describes the order in which LD is evaluated. This is the case in Figure 3 The lower part is shown.
[0052] Thus, a language model can be used in order to learn the structure of a ladder program. The vocabulary is minimized and the details of the learned program can be controlled by integrating or omitting function names and variable names. In principle, the method can be extended to signal flow-based programs, where any variables can be logically connected instead of Boolean expressions. In particular, the language model can be used to learn and use the structure of a ladder program in a program device for industrial automation components, in particular as a tool for analyzing program structure and for artificial intelligence-based assistance in the creation and development of industrial software in automation technology.
Claims
1. A method for using a system with artificial intelligence, the artificial intelligence having a text-based language model, the system being in particular a generated pre-trained chatbot, the method being for processing at least one graphical program structure (GP1, GP2), the graphical program structure having a plurality of program expressions in a graphical industrial programming language, the graphical industrial programming language being in particular a coupling diagram, characterized in that In order to input the graphical program structure (GP1, GP2) into the system, the graphical program expression is converted into a sequence of Boolean program expressions in textual form (TP1), wherein non-Boolean, in particular text-based program expressions (MOVE; CMP) of the graphical program structure (GP1, GP2) are each integrated between adjacent Boolean program expressions.
2. The method according to claim 1, characterized in that A response program structure of the system consisting of a text-based program expression is converted into a graphical response program structure, and the graphical response program structure is used for programming an industrial automation arrangement and for controlling an industrial process or industrial production.
3. The method according to claim 1 or 2, characterized in that: The non-Boolean text-based program representation (MOVE; CMP) of the graphical program structure (GP1, GP2) is a function block having a plurality of input variables and / or a plurality of output variables.
4. The method according to claim 3, characterized in that In the case of a plurality of non-Boolean input variables of the non-Boolean text-based program representation (GP2), the non-Boolean input variables are defined as parameters in the generated text-based program structure (TP2A, TP2B) and implemented as links, preferably as combinations.
5. The method according to claim 3 or 4, characterized in that: In the case of a plurality of non-Boolean output variables of the non-Boolean text-based program representation, the non-Boolean output variables are defined as output values in the generated text-based program structure and implemented as branches, preferably as forks or as logical ORs.
6. The method according to any one of the preceding claims, characterized in that The language model is pre-trained using a data set with non-standardized function blocks, preferably using non-Boolean text-based program expressions.
7. The method according to any one of claims 3 to 6, characterized in that For training purposes, non-boolean input variables and / or non-boolean output variables are labeled with standard names.
8. The method according to any one of claims 2 to 7, characterized in that To convert the text-based restorer construction back to the graphical restorer construction, the infix expression is converted to a postfix expression, wherein a stacking-based conversion algorithm is used.
9. The method according to claim 8, characterized in that During the conversion back, brackets and non-operation symbols before brackets that cannot be expressed in the graphic industry programming language are removed.
10. A programming device using a system with artificial intelligence, the artificial intelligence having a text-based natural language model, the system being in particular a generated pre-trained chatbot, the programming device being for processing at least one graphical program structure (GP1, GP2), the graphical program structure having a plurality of program expressions in a graphical industrial programming language, the graphical industrial programming language being in particular a coupling diagram, characterized in that The programming device is configured to carry out the method according to claim 1 by means of implementation software.