Method, system and device for converting ladder language to st language

By parsing the ladder diagram language into a multi-way tree, removing irrelevant nodes, and calculating ST language expressions, the problem of ladder diagram language conversion not conforming to the IEC61131-3 standard was solved, and efficient portability and static checking of ladder diagram code under different programming controller platforms were achieved.

CN116661806BActive Publication Date: 2026-06-23JISHAN ZHIGONG (SUZHOU) TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JISHAN ZHIGONG (SUZHOU) TECH CO LTD
Filing Date
2023-05-29
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In the existing technology, the conversion software from ladder diagram language to ST language does not comply with the IEC61131-3 standard, resulting in poor code portability after changing the programming controller platform, and inconsistent support for ladder diagrams among different PLC manufacturers.

Method used

A method and system are provided to obtain the XML text of the ladder diagram language, parse it into a multi-way tree, remove irrelevant nodes, formulate sorting rules and calculate ST language expressions, establish the correspondence between ladder diagram elements and ST code, and realize static analysis and error checking.

Benefits of technology

It improves the portability of ladder diagram code across different programming controller platforms, simplifies the compilation process, and enhances the portability of the project and the logical checking capabilities of the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116661806B_ABST
    Figure CN116661806B_ABST
Patent Text Reader

Abstract

The application discloses a method, system and device for converting ladder diagram language into ST language, comprising the following steps: S1, obtaining XML text of the ladder diagram language; S2, parsing the text of the ladder diagram language to obtain a multi-way tree; S3, traversing all first-level nodes of the multi-way tree, and after eliminating nodes irrelevant to the generation of the ST language, composing an element tree list; S4, formulating a sorting rule, sorting the element tree list according to the sorting rule to obtain a new list; and S5, traversing the new list, and calculating an expression of the ST language according to the type of a current node and the connection condition of the current node. The application can realize one-to-one correspondence between the ladder diagram elements and the ST code lines, facilitate static analysis and error checking of the code, and increase the portability of the project.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of ladder diagram language conversion, and in particular to a method, system, and apparatus for converting ladder diagram language to ST language. Background Technology

[0002] The IEC 61131-3 standard and PLCopen TC6 XML have been accepted by most PLC manufacturers. However, due to practical reasons, current software for converting ladder diagrams to ST language does not conform to the IEC 61131-3 standard. Furthermore, while all PLC manufacturers offer largely similar support for the ST programming language, their support for ladder diagram functions, topologies, and connection methods varies. This results in poor portability of code written in ladder diagram language when switching programming controller platforms. Summary of the Invention

[0003] The purpose of this invention is to provide a method for converting ladder diagram language to ST language, aiming to solve the problem of converting ladder diagram language to ST language.

[0004] This invention provides a method for converting ladder diagram language to ST language, comprising:

[0005] S1. Obtain the XML text in ladder diagram language;

[0006] S2. Parse the text of the ladder diagram language to obtain a multi-way tree;

[0007] S3. Traverse all first-level nodes of the multi-way tree, remove nodes that are irrelevant to generating the ST language, and then form a list of element trees.

[0008] S4. Define the sorting rules and sort the element tree list according to the sorting rules to obtain a new list;

[0009] S5. Traverse the new list and calculate the ST language expression based on the current node type and the connections between the current nodes.

[0010] This invention also provides a system for converting ladder diagram language to ST language, comprising:

[0011] The acquisition module is used to acquire XML text in the ladder diagram language.

[0012] Parsing module: Used to parse the text of the ladder diagram language to obtain a multi-way tree;

[0013] Traversal module: Used to traverse all first-level nodes of a multi-way tree, remove nodes that are irrelevant to generating the ST language, and then form a list of element trees;

[0014] Sorting module: Used to define sorting rules, sort the element tree list according to the sorting rules, and obtain a new list;

[0015] Calculation module: Used to traverse the new list and calculate ST language expressions based on the current node type and the connections between the current nodes.

[0016] This invention also provides an apparatus for converting ladder diagram language to ST language, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the above method.

[0017] This invention also provides a computer-readable storage medium storing an information transmission implementation program, which, when executed by a processor, implements the steps of the above-described method.

[0018] By employing the embodiments of the present invention, a one-to-one correspondence is established between ladder diagram elements and ST code lines, which facilitates static analysis and error checking of the code and increases the portability of the project.

[0019] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0020] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating a method for converting ladder diagram language to ST language according to an embodiment of the present invention.

[0022] Figure 2 This is a schematic diagram illustrating the ladder diagram calculation of the contact expression in the method for converting ladder diagram language to ST language according to an embodiment of the present invention;

[0023] Figure 3 This is a schematic diagram of the block type calculation expression of the method for converting ladder diagram language to ST language according to an embodiment of the present invention;

[0024] Figure 4 This is a schematic diagram of a system for converting ladder diagram language to ST language according to an embodiment of the present invention;

[0025] Figure 5This is a schematic diagram of a device for converting ladder diagram language to ST language according to an embodiment of the present invention. Detailed Implementation

[0026] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] Method Implementation Examples

[0028] According to an embodiment of the present invention, a method for converting ladder diagram language to ST language is provided. Figure 1 This is a flowchart of a method for converting ladder diagram language to ST language according to an embodiment of the present invention, such as... Figure 1 As shown, it specifically includes:

[0029] S1. Obtain the XML text in ladder diagram language;

[0030] S2. Parse the text of the ladder diagram language to obtain a multi-way tree;

[0031] S2 specifically includes: parsing text according to the PLCopen TC6 XML specification to obtain a multi-branch tree composed of XML node elements.

[0032] S3. Traverse all first-level nodes of the multi-way tree, remove nodes that are irrelevant to generating the ST language, and then form a list of element trees.

[0033] S3 specifically includes: traversing all first-level nodes of the multi-way tree, removing nodes that are irrelevant to generating the ST language, and forming an element tree list. The element tree list includes: connector, continuation, leftPowerRail, rightPowerRail, coil, contact, block, invariable, outVariable, inOutVariable, label, jump, and return.

[0034] S4. Define the sorting rules and sort the element tree list according to the sorting rules to obtain a new list;

[0035] S4 specifically includes: defining sorting rules, sorting the element tree list according to the sorting rules, and obtaining a new list. The sorting rules are as follows:

[0036] S41. Create an empty list SortList to store the sorted elements of the ladder diagram, and create temporary lists orderTmp, outVarTmp, blockTmp and conTmp;

[0037] S42, Traverse the element tree list;

[0038] S43. Determine if the current node has a specified execution order; if yes, add the node to orderTmp and then execute S42; otherwise, continue executing S431.

[0039] S431. Determine if the current node type is outVariable, inOutVariable, or coil; if yes, add the current node to outVarTmp and then execute S42; otherwise, continue executing S432.

[0040] S432. Determine if the current node type is block, return, or jump; if so, add the current node to blockTmp and then execute S42; otherwise, continue executing S433.

[0041] S433. Determine if the current node type is connector; if yes, add the current node to conTmp and then execute S42; otherwise, continue to execute S434.

[0042] S434. Determine if the current node type is a label node; if yes, start sorting: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList; then, append the current label node to SortList; finally, clear the contents of the orderTmp, outVarTmp, blockTmp, and conTmp lists and continue executing S42; if not, continue executing S435.

[0043] S435. Determine if the end of the list has been reached. If yes, start the sorting rules: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList in sequence; finally, end the process. If no, continue executing S42.

[0044] S5. Traverse the new list and calculate the ST language expression based on the current node type and the connections between the current nodes.

[0045] S5 specifically includes:

[0046] Create a map data structure labelMap. The key data type of labelMap is string, where the key represents the label node name; the value is integer data, where the value represents the label index, starting from 1 and incrementing.

[0047] Create an integer variable _LABEL_VALUE, initialize it to 1, and represent the index of the current label;

[0048] Create a map data structure connMap. The key of connMap is a string representing the name of the connector node, and the value is a string representing the expression that associates the node.

[0049] ST language code generation is all in the statements

[0050] WHILE_LABEL_VALUE<=N DO ...

[0052] END_WHILE

[0053] In the formula, N represents the number of label nodes.

[0054] If the current node is a label node, look up the corresponding value in the labelMap based on the current node name. If the value is greater than 1, increment _LABEL_VALUE by 1, and then generate an END_IF statement. Next, generate ST conditional statements in the form of IF_LABEL_VALUE = value THEN…. If the value is equal to 1, it means that it is the first grid. First, generate a conditional statement in the form of WHILE_LABEL_VALUE <= N DO…, and then generate a conditional statement in the form of IF_LABEL_VALUE = value THEN….

[0055] If the current node is a connector node, first look up the expression corresponding to the connector in connMap. If the expression exists, use it directly. If the expression does not exist, first find the continuation node connected to the connector node, calculate the ST language expression based on the connection status of the continuation node, and store the expression in connMap.

[0056] If the current node is coil, outVariable, or inOutVariable, calculate the ST language expression based on the connection information of the current node and generate the assignment statement;

[0057] If the current node is a block node, obtain the ST language expressions of all nodes that provide data to the block, assign the values ​​to the corresponding input variables of the block, and then generate the block call statement;

[0058] If the current node is a jump node, evaluate the Boolean expression connected to it to generate an IF conditional statement. If the expression is true, assign _LABEL_VALUE to the value corresponding to the label;

[0059] If the current node is a return node, evaluate the Boolean expression connected to it to generate an IF conditional statement; if the expression is true, generate a RETURN statement.

[0060] If the list reaches the end, first generate END_IF, then generate END_WHILE;

[0061] The specific implementation method is as follows:

[0062] Based on the node types in the PLCopen TC6 XML specification text, the specification XML text is parsed into a tree-like representation structure in the program;

[0063] Extract some child nodes of the ladder diagram related node ldObjects and store them in a list OriList. Some child nodes include: connector, continuation, leftPowerRail, rightPowerRail, coil, contact, block, inVariable, outVariable, inOutVariable, label, jump, and return nodes and their subtrees.

[0064] Based on the ladder diagram execution logic, the sorting rules are determined, and the above list OriList is traversed according to the sorting rules to obtain the sorted list SortList;

[0065] The above yields a sorted list, SortList. A map data structure, labelMap, is created, where the key is a string representing the label node name, and the value is an integer representing the label index, incrementing from 1. This associates each label node with a unique integer. The number of elements in labelMap is equal to the number of grid cells N in the ladder diagram. Therefore, the ST code corresponding to the ladder diagram is within the range WHILE_LABEL_VALUE <= N DO…END_WHILE.

[0066] Create a map data structure connMap<string,string> It is used to store expressions connected to the connector; it iterates through SortList and calculates the ST expression based on the current node type and the connections to the current node.

[0067] The above calculation of the ST expression based on node connections refers to adding all connections connected to connectionPointIn (i.e., the data source nodes provided by each node in the SortList) to the connections list and then participating in the calculation.

[0068] BOOL type data nodes support multiple connections, whose serial and parallel relationships represent logical 'AND' and logical 'OR'; other types of data nodes can only have one connection, because consumed data can only come from one provider, and multiple providers will lead to logical errors.

[0069] The nodes connected to the nodes in the SortList above can only be of one of the following types: continuation, leftPowerRail, contact, block, inVariable, and inOutVariable. This is because only these node types can produce data for the nodes in the SortList to use; other node types will cause logical errors.

[0070] Among the node types connected to nodes in SortList, if it is leftPowerRail, BOOL#TRUE is returned directly; if it is continuation, the corresponding expression is searched in connMap based on the node name. If not found, an error is reported, indicating that no connector with the same name is found; if it is an inVariable or inOutVariable node, it is the expression field corresponding to the node in XML.

[0071] Based on the above analysis, the most complicated part of calculating the ST expression for node connections is the contact node and the block node, because the contact node involves logical operations, and the block node involves functions or functional blocks.

[0072] Figure 2 This is a schematic diagram illustrating the ladder diagram calculation of the contact expression in the method for converting ladder diagram language to ST language according to an embodiment of the present invention;

[0073] The expression calculation for the above contact node, combined with the following... Figure 2The following explanations are provided: Contact is represented by A, B, C, D, E, and F, and the coil node is represented by O. Figure 2 In the expression, the logical operation value of ABCDEF should be assigned to O; the logical operation result should be O:=(A and B and C)or(D and E)or F; substituting this into the expression gives:

[0074] Figure 3 This is a schematic diagram of the block type calculation expression of the method for converting ladder diagram language to ST language according to an embodiment of the present invention;

[0075] bOutput := (bInput1 and bInput2 and NOT(bInput3))or(bInput4 and NOT(bEnable))or bWorking; The expression evaluation logic is as follows: Figure 3 As shown;

[0076] When calculating the expression for Coil(O), the calculation logic is as follows:

[0077] First, we find the input connected to O, and find that there are three C, E, and F. Then the expression can be expressed as O:=CalSeriesExp(C,1)or CalSeriesExp(E,1)or CalSeriesExp(F,1); where the CalSeriesExp function represents the expression for serial connection with nodes, and returns the expression string. The first parameter is the current expression string; the second parameter is the current number of nodes.

[0078] The expressions connected to C, E, and F are calculated sequentially. First, we find that only B is connected to C, so we continue with CalSeriesExp(C and B, 2) to calculate the expression connected to B. We find A, so we continue with CalSeriesExp(C and B and A, 3) to calculate the node connected to A, which is considered a power line. The left power line is TRUE by default. When the parameter expression is not empty, any expression with TRUE can be ignored. Therefore, CalSeriesExp(C, 1) calculates to C and Band A. When the number of nodes exceeds one, parentheses are added by default, and finally, CalSeriesExp(C, 1) returns (C and Band A).

[0079] Similarly, the expressions connected to E and F are CalSeriesExp(E,1):=(E and D); and CalSeriesExp(F,1):=F;

[0080] When evaluating the expression for a block node, the expression must be calculated based on the input and output nodes within the block, as well as the block type; the following... Figure 3 For example,

[0081] When evaluating a CTU expression, the expressions of all input connections to the CTU are first examined. Since the block type of the CTU is a function block and its instance name is CTU1, the calling form of the function block is as follows:

[0082] CTU1(EN:=exp1,CU:=exp2,R:=exp3,PV:=exp4); In fact, exp1, exp2, exp3, and exp4 represent the expressions connected to its inputs EN, CU, R, and PV, respectively. If a node is connected to the output of a function block, for example... Figure 3 If we consider bDone and nCurrentValue, then we need to determine whether an assignment is required based on the EN expression.

[0083] In the above list of node types, the nodes leftPowerRail, rightPowerRail, contact, invariable, and label do not consume power flow; the nodes connector and continuation correspond to each other, and connectors and continuations with the same node name can be connected together, which is the same as the actual connection power flow line.

[0084] This invention is universal and can convert ladder diagrams from any manufacturer based on the PLCopen TC6 XML specification into IEC61131-3 ST code;

[0085] This invention can provide ST code and trapezoidal Figure 1 The one-to-one correspondence allows users to quickly check the logical correctness of ladder diagrams and also enables static code checking of ladder diagrams;

[0086] This invention enables PLC projects to be easily ported and successfully compiled on different programming controller platforms; due to the conversion optimization, this invention also simplifies ladder diagram logic to a certain extent.

[0087] This invention can also simplify the compiler; PLC manufacturers only need to compile the ST text to successfully compile the ladder diagram program.

[0088] This invention can also be used in programs written in FBD to convert FBD programs into ST code.

[0089] System Implementation Example 1

[0090] According to embodiments of the present invention, a system for converting ladder diagram language to ST language is provided. Figure 3 This is a schematic diagram of a system for converting ladder diagram language to ST language according to an embodiment of the present invention, such as... Figure 3 As shown, it specifically includes:

[0091] The acquisition module is used to acquire XML text in the ladder diagram language.

[0092] Parsing module: Used to parse the text of the ladder diagram language to obtain a multi-way tree;

[0093] Traversal module: Used to traverse all first-level nodes of a multi-way tree, remove nodes that are irrelevant to generating the ST language, and then form a list of element trees;

[0094] Sorting module: Used to define sorting rules, sort the element tree list according to the sorting rules, and obtain a new list;

[0095] Calculation module: Used to traverse the new list and calculate ST language expressions based on the current node type and the connections between the current nodes.

[0096] The parsing module is specifically used to parse text according to the PLCopen TC6 XML specification to obtain a multi-way tree composed of XML node elements.

[0097] The traversal module is specifically used to: traverse all first-level nodes of the multi-way tree, remove nodes that are irrelevant to the generation of ST language, and form an element tree list. The element tree list includes: connector, continuation, leftPowerRail, rightPowerRail, coil, contact, block, invariable, outVariable, inOutVariable, label, jump, and return.

[0098] The sorting module is specifically used to: define sorting rules, sort the element tree list according to the sorting rules, and obtain a new list. The sorting rules are as follows:

[0099] S83. Determine if the current node has a specified execution order; if yes, add the node to orderTmp and then execute S82; otherwise, continue to execute S831.

[0100] S831. Determine if the current node type is outVariable, inOutVariable, or coil; if yes, add the current node to outVarTmp and then execute S42; otherwise, continue executing S432.

[0101] S832. Determine if the current node type is block, return, or jump; if so, add the current node to blockTmp and then execute S82; otherwise, continue to execute S433.

[0102] S833. Determine if the current node type is connector; if yes, add the current node to conTmp and then execute S82; otherwise, continue to execute S834.

[0103] S834. Determine if the current node type is a label node; if yes, start sorting: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList; then, append the current label node to SortList; finally, clear the contents of the orderTmp, outVarTmp, blockTmp, and conTmp lists and continue executing 82; if not, continue executing 835.

[0104] S835. Determine if the end of the list has been reached. If yes, start the sorting rules: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList in sequence; finally, end the process. If no, continue executing S82.

[0105] The embodiments of the present invention are system embodiments corresponding to the above method embodiments. The specific operation of each module can be understood by referring to the description of the method embodiments, and will not be repeated here.

[0106] Device Example 1

[0107] This invention provides an apparatus for converting ladder diagram language to ST language, such as... Figure 5 As shown, it includes: a memory 50, a processor 52, and a computer program stored on the memory 50 and executable on the processor 52. When the computer program is executed by the processor, it implements the steps in the above method embodiments.

[0108] Device Example 2

[0109] This invention provides a computer-readable storage medium storing an information transmission implementation program, which, when executed by a processor 52, implements the steps described in the above method embodiments.

[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions to the technical solutions of the embodiments of the present invention do not cause the essence of the corresponding technical solutions to deviate from the scope of the present solution.

Claims

1. A method for converting ladder diagram language to ST language, characterized in that, include: S1. Obtain the XML text in ladder diagram language; S2. Parse the text of the ladder diagram language to obtain a multi-way tree; S3. Traverse all first-level nodes of the multi-way tree, remove nodes that are irrelevant to generating the ST language, and then form a list of element trees. S4. Define the sorting rules and sort the element tree list according to the sorting rules to obtain a new list; The sorting rules are as follows: S41. Create an empty list SortList to store the sorted elements of the ladder diagram, and create temporary lists orderTmp, outVarTmp, blockTmp and conTmp; S42, Traverse the element tree list; S43. Determine if the current node has a specified execution order; if yes, add the node to orderTmp and then execute S42; otherwise, continue executing S431. S431. Determine if the current node type is outVariable, inOutVariable, or coil; if yes, add the current node to outVarTmp and then execute S42; otherwise, continue executing S432. S432. Determine if the current node type is block, return, or jump; if so, add the current node to blockTmp and then execute S42; otherwise, continue executing S433. S433. Determine if the current node type is connector; if yes, add the current node to conTmp and then execute S42; otherwise, continue to execute S434. S434. Determine if the current node type is a label node; if yes, start sorting: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList; then, append the current label node to SortList; finally, clear the contents of the orderTmp, outVarTmp, blockTmp, and conTmp lists and continue executing S42; if not, continue executing S435. S435. Determine if the end of the list has been reached. If yes, start the sorting rules: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList in sequence; finally, end the process. If no, continue executing S42. S5. Traverse the new list and calculate the ST language expression based on the current node type and the connections between the current nodes.

2. The method according to claim 1, characterized in that, S2 specifically includes: parsing the text according to the PLCopen TC6 XML specification to obtain a multi-branch tree composed of XML node elements.

3. The method according to claim 2, characterized in that, S3 specifically includes: traversing all first-level nodes of the multi-way tree, removing nodes that are irrelevant to generating the ST language, and forming an element tree list. The element tree list includes: connector, continuation, leftPowerRail, rightPowerRail, coil, contact, block, invariable, outVariable, inOutVariable, label, jump, and return.

4. A system for converting ladder diagram language to ST language, characterized in that, include: The acquisition module is used to acquire XML text in the ladder diagram language. Parsing module: Used to parse the text of the ladder diagram language to obtain a multi-way tree; Traversal module: Used to traverse all first-level nodes of a multi-way tree, remove nodes that are irrelevant to generating the ST language, and then form a list of element trees; Sorting module: Used to define sorting rules, sort the element tree list according to the sorting rules, and obtain a new list; The sorting rules are as follows: S81. Create an empty list SortList to store the sorted elements of the ladder diagram, and create temporary lists orderTmp, outVarTmp, blockTmp and conTmp; S82, Traverse the element tree list; S83. Determine if the current node has a specified execution order; if yes, add the node to orderTmp and then execute S82; otherwise, continue to execute S831. S831. Determine if the current node type is outVariable, inOutVariable, or coil; if yes, add the current node to outVarTmp and then execute S42; otherwise, continue executing S432. S832. Determine if the current node type is block, return, or jump; if so, add the current node to blockTmp and then execute S82; otherwise, continue to execute S433. S833. Determine if the current node type is connector; if yes, add the current node to conTmp and then execute S82; otherwise, continue to execute S834. S834. Determine if the current node type is a label node; if yes, start sorting: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList; then, append the current label node to SortList; finally, clear the contents of the orderTmp, outVarTmp, blockTmp, and conTmp lists and continue executing 82; if no, continue executing 835. S835. Determine if the end of the list has been reached. If yes, start the sorting rules: first, sort orderTmp in ascending order according to the specified execution order; second, sort outVarTmp, blockTmp, and conTmp in ascending order according to their node position coordinates; then, append all nodes in the sorted orderTmp, outVarTmp, blockTmp, and conTmp to SortList in sequence; finally, end the process. If no, continue executing S82. Calculation module: Used to traverse the new list and calculate ST language expressions based on the current node type and the connections between the current nodes.

5. The system according to claim 4, characterized in that, The parsing module is specifically used to: parse text according to the PLCopen TC6XML specification to obtain a multi-way tree composed of XML node elements.

6. The system according to claim 5, characterized in that, The traversal module is specifically used to: traverse all first-level nodes of the multi-way tree, remove nodes that are irrelevant to the generation of ST language, and form an element tree list. The element tree list includes: connector, continuation, leftPowerRail, rightPowerRail, coil, contact, block, invariable, outVariable, inOutVariable, label, jump, and return.

7. An apparatus for converting ladder diagram language to ST language, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for converting ladder diagram language to ST language as claimed in any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an implementation program for information transmission, which, when executed by a processor, implements the steps of the method for converting ladder diagram language to ST language as described in any one of claims 1 to 3.