An automationML-based industrial equipment motion control PLC code automatic generation method and device
By using AutomationML specifications and digital twin technology, lossless data exchange from industrial simulation platforms to PLC programming platforms was achieved, solving the problem of repetitive manual work in the PLC code generation process and improving development efficiency and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, the PLC code generation process for motion control of industrial equipment requires engineers to perform repetitive work between industrial simulation platforms and PLC programming platforms, which increases manpower costs and makes it difficult to conduct cross-platform data exchange without loss, affecting development efficiency and security.
By adopting the AutomationML format specification, digital twin simulation of equipment is performed through an industrial simulation platform to generate a behavior model of the equipment. Combined with the function block knowledge base of the PLC programming platform, code is automatically generated from the industrial simulation platform to the PLC programming platform, ensuring lossless data exchange and logical consistency.
It enables lossless data exchange from industrial simulation platforms to PLC programming platforms, improving the development efficiency of industrial automation engineering, reducing repetitive work, and ensuring the accuracy and security of code generation.
Smart Images

Figure CN116069317B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial control and relates to a method and apparatus for automatically generating motion control codes for industrial equipment based on AutomationML. Background Technology
[0002] The presence of numerous repetitive tasks in automated programming leads to low efficiency in industrial automation engineering development. While automatic code generation is considered an effective solution for reducing engineering costs, the motion control of industrial equipment is a precise and complex process requiring rigorous logic and accurate data; otherwise, it may cause equipment damage or even endanger the personal safety of on-site personnel.
[0003] Digital twin technology enables the establishment of a mapping relationship between virtual and real environments through digital means. Industrial simulation platforms support teaching and programming devices in the virtual environment using their built-in component libraries, including motion components. Industrial simulation platforms based on digital twin technology can simulate the motion processes of industrial equipment in the virtual environment in advance, largely avoiding on-site accidents and providing technical support for the automatic generation of code in automation engineering. However, due to inconsistencies between platform and device protocols, simulation platforms often cannot directly drive the operation of on-site equipment.
[0004] PLCs are commonly used devices in modern industrial control and support programming languages conforming to the IEC 61131-3 standard. Using PLCs and PLC programming development platforms compliant with the IEC 61131-3 standard, motion control of field industrial equipment can be achieved.
[0005] In the field of PLC industrial control, due to the unique nature of PLC code, the underlying implementation of the behavioral logic of industrial equipment and the PLC motion control logic are two different research areas. Therefore, currently, industrial sites require process engineers responsible for process control design to operate industrial simulation platforms, and software engineers responsible for logic implementation to operate PLC programming platforms in collaboration to complete equipment operation. Their work involves considerable overlap, which undoubtedly increases unnecessary manpower expenditure.
[0006] Therefore, in view of the technical deficiencies of existing technologies, this invention aims to find a solution to automatically generate PLC programming platform-executable code directly from an industrial simulation platform. However, accurately describing the motion logic between each module of the equipment, precisely replicating the virtual motion scene and extracting the necessary information from it, and effectively associating each discrete piece of information while achieving lossless data exchange are challenges. The AutomationML (AML) format specification provides a reference solution for lossless data exchange between different platforms. Summary of the Invention
[0007] To address the aforementioned issues, this invention proposes a method and apparatus for automatically generating motion control code for industrial equipment based on AutomationML. This method enables automatic code generation from an industrial simulation platform to a PLC programming platform, solves the problem of lossless data exchange across platforms, and improves the efficiency of industrial automation engineering development.
[0008] In order to solve the technical problems existing in the prior art, the technical solution of the present invention is as follows:
[0009] A method for automatically generating motion control code for industrial equipment based on AutomationML includes the following steps:
[0010] Step S1: The industrial simulation platform simulates the motion of the digital twin of the industrial equipment on site. After determining the equipment's motion behavior, the equipment's drive information, initial state information, target state information, and complete motion process information are modeled and represented to obtain the equipment behavior model.
[0011] Step S2: The PLC programming platform imports the device behavior model, performs ontology semantic description on the device behavior model, and performs knowledge fusion based on the constructed functional block knowledge base to obtain a knowledge graph.
[0012] Step S3: Perform reasoning and parsing on the knowledge graph according to specific rules and algorithms to generate FBD code based on the IEC 61131-3 standard that is consistent with the motion control logic described by the device behavior model.
[0013] As a further improvement, AutomationML, based on the IEC 62714-1 standard, is used as a model representation tool for device behavior to combine motion descriptions and simulation information, wherein the simulation motion data is integrated into the AutomationML model as a Collada file description.
[0014] As a further improvement, step S1 further includes:
[0015] Step S1-1: Construct the motion scene;
[0016] The basic motion of the equipment is described by a motion control model.
[0017] Definition 1: The motion control model is a 3-tuple MCM = (s, t, f), consisting of the following:
[0018] 1) An initial state s;
[0019] 2) A target state t;
[0020] 3) A transformation rule f represents the transformation logic from s to t;
[0021] A complete set of equipment motion behavior consists of a series of industrial devices involved in motion control, and motion control models between these devices combined according to certain logic. The equipment behavior model is described as follows:
[0022] Definition 2: The Device Behavior Model is a 4-tuple DBM = (d, M, S, λ), consisting of the following:
[0023] 1) A device that corresponds to a behavioral description;
[0024] 2) A set of motion control models described by Definition 1, M = (m0, m1, ..., m n );
[0025] 3) A set of lists of motion control execution sequences S = (s0, s1, ..., s2) n );
[0026] 4) A list of interlocking conditions λ = (λ0, λ1, ..., λ) n-1 Interlocking is described as a binary logic that locks the associated motion control to a specific state; each λ i Description of m i to m i+1 Additional interlocking restrictions that need to be met, namely
[0027] Step S1-2: Construct a digital twin model of the robotic arm; whereby,
[0028] Relying on digital twin technology, feature data is obtained from the sensor modules built into the robotic arm. Based on the geometric model library integrated into the platform and the data generated by transmission and analysis, a digital twin of the actual robotic arm is generated on the industrial simulation platform.
[0029] Steps S1-3: The simulation platform describes the motion scene; where,
[0030] A complete device behavior model can be described by combining the motion control model with the interlocking logic described by the execution sequence and logic component library.
[0031] Steps S1-4: Modeling representation; where,
[0032] The behavior of equipment described based on the industrial simulation platform is modeled and represented using AutomationML. The AML standard defines a basic role class library, a basic interface class library, and a basic attribute class library. The equipment behavior and simulation information are combined through the semantic connection relationships defined in the AML standard, and the simulation motion data is integrated into the AML model using Collada description.
[0033] As a further improvement, step S2 further includes:
[0034] Step S2-1: Construct a functional block knowledge base; whereby,
[0035] The existing function block control library of the PLC programming platform is subjected to ontology semantic conversion to generate a corresponding function block knowledge base based on ontology semantic description. This function block knowledge base includes basic interlocking logic function blocks including Equal, and function blocks based on the PLCOpen Motion Control standard. It also provides input and output attributes for each motion control to form a mapping relationship with the motion process in the AML model.
[0036] Step S2-2: Generate a knowledge graph: where,
[0037] The PLC programming platform imports AML model files and performs ontology semantic transformation on the relationships between modules expressed in the AML model. In particular, the description of motion processes is fused with the existing ontology-based functional block knowledge base according to a customized mapping relationship.
[0038] As a further improvement, step S3 further includes:
[0039] Step S3-1: Generate the project framework; where,
[0040] According to the DBM description, starting from the device node, the driver information corresponding to the device is first stored in the variable area of a separate POU, called a shared POU, for use by other POUs. POU pages are then created sequentially according to the execution order described in the Order class.
[0041] Step S3-2: Generate function blocks; where,
[0042] Starting from the motion process nodes, the functional block logic corresponding to each motion process node is identified and generated in the corresponding POU according to the execution order. The functional blocks pass information to each other through connections or variables. If two motion process nodes contain interlocking logic controls, the interlocking logic controls are generated additionally.
[0043] Step S3-3: Assign values to function blocks; where,
[0044] According to the MCM description, starting from the motion process node, the corresponding initial state and target state are searched sequentially. Based on the attributes described by the input Port node, data is obtained from the shared POU, the initial state point, and the target state point, respectively. If the Port node attributes cannot meet the input requirements of the function block, the corresponding Collada file is obtained from the motion process, the feature point recognition algorithm is called to identify the location of the feature points in each frame, and after converting them into actual spatial positions, the movement distance between points in each two frames is calculated. Then, the device's moving speed, acceleration, and other information are deduced and assigned to the function block pins.
[0045] As a further improvement, the function block knowledge base is constructed from the ontology descriptions corresponding to the function block control library based on the PLC programming platform, which includes basic interlocking logic function blocks and function blocks based on the PLCOpen Motion Control standard.
[0046] This invention also includes an automatic motion control code generation device for industrial equipment based on AutomationML, comprising at least an industrial simulation platform and a PLC programming platform, wherein...
[0047] The industrial simulation platform is used to simulate the motion of digital twins of industrial equipment in the field. After determining the motion behavior of the equipment, the equipment driving information, initial state information, target state information and complete motion process information are modeled and represented to obtain the equipment behavior model.
[0048] The PLC programming platform is used to import the equipment behavior model, perform ontology semantic description on the equipment behavior model, and perform knowledge fusion based on the constructed functional block knowledge base to obtain a knowledge graph. Then, it performs reasoning and parsing on the knowledge graph according to specific rules and algorithms to generate FBD code based on the IEC 61131-3 standard that is consistent with the motion control logic described by the equipment behavior model.
[0049] As a further improvement plan,
[0050] The industrial simulation platform integrates a geometric model library, a motion function library, and a logic component library. The geometric model library includes digital models of various industrial equipment. The motion function library includes basic motion components, each representing a basic motion process, with an underlying motion control logic based on ontology description. This underlying motion control logic is transparent to the simulation platform user. The logic component library includes basic logic components, including Equal logic, used to describe interlocking logic.
[0051] As a further improvement plan,
[0052] The basic motion of the equipment is described by a motion control model:
[0053] Definition 1: The motion control model is a 3-tuple MCM = (s, t, f), consisting of the following:
[0054] 1) An initial state s;
[0055] 2) A target state t;
[0056] 3) A transformation rule f represents the transformation logic from s to t;
[0057] A complete set of equipment motion behavior consists of a series of industrial devices involved in motion control, and motion control models between these devices combined according to certain logic. The equipment behavior model is described as follows:
[0058] Definition 2: The Device Behavior Model is a 4-tuple DBM = (d, M, s, λ), consisting of the following:
[0059] 1) A device that corresponds to a behavioral description;
[0060] 2) A set of motion control models described by Definition 1, M = (m0, m1, ..., m n );
[0061] 3) A set of lists of motion control execution sequences S = (s0, s1, ..., s2) n );
[0062] 4) A list of interlocking conditions λ = (λ0, λ1, ..., λ) n-1 Interlocking is described as a binary logic that locks the associated motion control to a specific state; each λ i Description of m i to m i+1 Additional interlocking restrictions that need to be met, namely
[0063] As a further improvement, the PLC programming platform is a programming platform based on the programming language of the IEC 61131-3 standard, which provides programming modes for the corresponding programming language and a library of function block controls with a variety of rich functions.
[0064] Compared with the prior art, the technical effects of the present invention are as follows:
[0065] 1. In the field of automatic PLC code generation, existing technologies mainly consider code generation methods in terms of logic control. This invention explores the field of motion control and provides a method for generating motion control code.
[0066] 2. In the field of automatic motion control code generation, existing technologies mainly target C / C++ and Python languages. They automatically generate code frameworks that conform to the requirements description through model-driven development technology, but the specific details of functional logic still require programmers to implement them themselves, which is a semi-automatic generation. This invention, based on the PLCOpen Motion Control standard, provides a fully automated solution for PLC code generation. Attached Figure Description
[0067] Figure 1 This is an implementation architecture diagram of an automatic generation method for motion control code of industrial equipment that supports lossless data exchange, according to one embodiment of the present invention.
[0068] Figure 2 This is a flowchart illustrating the implementation of an automatic generation method for motion control code of industrial equipment that supports lossless data exchange in one embodiment of the present invention.
[0069] Figure 3 This is a flowchart illustrating the implementation of device behavior modeling representation in one embodiment of the present invention;
[0070] Figure 4 This is a schematic diagram of the movement behavior of a robotic arm in one embodiment of the present invention;
[0071] Figure 5 This is a simplified schematic diagram of the operation interface of an industrial simulation platform in one embodiment of the present invention;
[0072] Figure 6 This is a schematic diagram of an AML model representing a robotic arm motion behavior scenario in one embodiment of the present invention;
[0073] Figure 7 This is a schematic diagram illustrating the knowledge graph description of an AML model in one embodiment of the present invention;
[0074] Figure 8 This is a flowchart illustrating the code implementation for knowledge graph reasoning and parsing generation in one embodiment of the present invention.
[0075] Figure 9 This is a schematic diagram illustrating the process of generating a program framework in one embodiment of the present invention;
[0076] Figure 10 This is a schematic diagram illustrating the process of generating an FBD functional block in one embodiment of the present invention;
[0077] Figure 11 This is a schematic diagram illustrating the process of assigning values to the FBD function block code in one embodiment of the present invention; Detailed Implementation
[0078] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0079] Conversely, this invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of the invention as defined in the claims. Furthermore, to provide a better understanding of the invention, certain specific details are described in detail below. However, those skilled in the art will fully understand the invention even without these detailed descriptions.
[0080] A specific embodiment of the present invention includes an implementation architecture for automatically generating motion control code for industrial equipment that supports lossless data exchange, such as... Figure 1 As shown, it includes an industrial simulation platform and a PLC programming platform, which together constitute a programmable configuration environment, as detailed below:
[0081] The industrial simulation platform integrates a geometric model library, a motion function library, and a logic component library. The geometric model library includes digital models of various industrial equipment, including robotic arms; the motion function library includes basic motion components, each representing a basic motion process, with an underlying motion control logic based on ontology description, which is transparent to the simulation platform user; the logic component library includes basic logic components, including Equal logic, used to describe interlocking logic.
[0082] The PLC programming platform is based on the IEC 61131-3 standard and supports five programming languages (FBD (Function Block Diagram), LD (Ladder Diagram), ST (Structured Text), SFC (Sequential Function Chart), and IL (Instruction List). It provides programming modes for each of the five languages and offers a rich library of function block controls.
[0083] A specific embodiment of the present invention includes an implementation flow of a method for automatically generating motion control code for industrial equipment based on AutomationML, such as... Figure 2 As shown, the specific steps are as follows:
[0084] Step S1: The industrial simulation platform simulates the motion of a digital twin of the industrial equipment on-site. After determining the equipment's motion behavior, the equipment's drive information, initial state information, target state information, and complete motion process information are modeled and represented to obtain the equipment behavior model. The industrial simulation platform is existing technology. This invention creatively proposes motion control and equipment behavior models. The intention of proposing these two models is to provide an abstract description of the motion of existing equipment, ensuring universality across platforms. However, the specific method used by each platform to represent the model cannot be precisely described; only an abstract description can be provided. The intention is that regardless of the method used, as long as the established model is similar to the model proposed in this invention within a certain spiritual scope, it falls within the scope of protection of this invention.
[0085] The implementation process is as follows Figure 3 As shown, the specific steps are as follows:
[0086] Step S1-1: Constructing the motion scene
[0087] First consideration Figure 4 The motion scenario depicts two industrial robot arms, Robot1 and Robot2, each with six degrees of freedom. Robot1 grasps an object at Position1, starts at Position1, moves through Position2, and reaches the target position, Position3. When Robot2 reaches Position4, which is the same as Position3, it takes the object from Robot1, starts at Position4, and moves to the target position, Position5.
[0088] The basic motion of the equipment can be described by a motion control model.
[0089] Definition 1: A motion control model is a 3-tuple MCM = (s, t, f), consisting of the following:
[0090] 1) An initial state s;
[0091] 2) A target state t;
[0092] 3) A transformation rule f represents the transformation logic from s to t.
[0093] Figure 4 The basic motions of the two devices shown can be described by the following three motion control models:
[0094] MCM1=(P1,P2,Move_PointToPoint) (1)
[0095] This indicates that the movement starts from the initial state Position1 and proceeds to the target state Position2 through point-to-point motion rules.
[0096] MCM2=(P2,P3,Move_PointToPoint) (2)
[0097] The meaning is indicated by MCM1.
[0098] MCM3=(P4,P5,Move_PointToPoint) (3)
[0099] The meaning is indicated by MCM1.
[0100] A complete set of equipment motion behavior consists of a series of industrial devices involved in motion control, and motion control models between these devices combined according to certain logic. It can be described by the following equipment behavior model.
[0101] Definition 2: The Device Behavior Model is a 4-tuple DBM = (d, M, S, λ), consisting of the following:
[0102] 1) A device that corresponds to a behavioral description
[0103] 2) A set of motion control models described by Definition 1, M = (m0, m1, ..., m n ).
[0104] 3) A set of lists of motion control execution sequences S = (s0, s1, ..., s2) n ).
[0105] 4) A list of interlocking conditions λ = (λ0, λ1, ..., λ) n-1 Interlocking can be described as a binary logic that locks the associated motion control to a specific state. Each λ i Description of m i to m i+1 Additional interlocking restrictions that need to be met, namely
[0106] By defining the model in 2, we can... Figure 5 The complete device behavior description is as follows:
[0107] DBM1=(d,(MCM1,MCM2),(1,2),(ε)) (4)
[0108] DBM2=(d,(MCM3),(1),(λ1=Equal(Position3,Position4)) (5)
[0109] Where ε represents the absence of interlocking restrictions, and λ1 in the above behavior model represents that Robot1 and Robot2 are in the same position. Under this premise, Robot2 is allowed to take the item from Robot1 and perform its own motion control.
[0110] Step S1-2: Construct a digital twin model of the robotic arm.
[0111] To describe the details of the above motion scenario, a programmable simulation platform was used to determine the starting and target position states of the robotic arm and the corresponding device behavior.
[0112] Relying on digital twin technology, feature data is obtained from the sensor modules built into the robotic arm. Based on the geometric model library integrated into the platform and the data generated by transmission and analysis, a digital twin of the actual robotic arm is generated on the industrial simulation platform.
[0113] Step S1-3: The simulation platform describes the motion scene.
[0114] in accordance with Figure 3 The described robotic arm motion scenario utilizes a platform-integrated motion function library to perform virtual simulation operations on a digital twin. To more accurately represent the motion details of each motion control model (MCM), simulation functions are used in conjunction with basic motion components to fully describe the initial state, target state, and transition rules within the MCM. A simplified diagram of the user interface is shown below. Figure 5 As shown, the MCM, combined with the execution order and the interlocking logic described by the logic component library, can completely describe a device behavior model (DBM).
[0115] Steps S1-4: Modeling and Representation
[0116] Equipment behavior described based on an industrial simulation platform is modeled and represented using AML (Automation ML). The AML standard defines a basic role class library, a basic interface class library, and a basic attribute class library. Equipment behavior and simulation information are combined through semantic connections defined in the AML standard. Simulation motion data is integrated into the AML model using Collada descriptions, such as... Figure 6 As shown, the simulation motion data is integrated into the AML model using Collada descriptions. The Collada file contains descriptions of the device's behavior and pose for each frame, as well as the time intervals between frames, from which information such as motion speed and acceleration can be identified.
[0117] In this embodiment, the AML modeling representation of device behavior is as follows: Figure 6 As shown.
[0118] Specifically, for Figure 6The AML model shown is described as follows:
[0119] The above equipment behavior model is described in AML using the factory structure concept of Resource-Process-Product, as detailed below:
[0120] 1) Use the Resource role class in the basic role class library to describe the device list, where device-related information such as device drivers is stored in the device's properties.
[0121] In this example, the characteristics of the robotic arm are described, including six steering axes and the corresponding drive information for each axis.
[0122] 2) Use the Process role class in the basic role class library to describe the motion process. The motion process corresponds one-to-one with the basic motion components in the industrial simulation platform.
[0123] In this example, only the motion process of the three instances move_PointToPoint1, move_PointToPoint2, and move_PointToPoint3 generated by the basic motion component Move_PointToPoint is involved.
[0124] 3) Use the Product role class from the basic role class library to describe the status information, and store the values contained in each status information in the status's attributes.
[0125] In this example, based on the defined Position spatial position state class, five state instances, Position1, Position2, ..., Position5, and their corresponding spatial position coordinate values are generated.
[0126] 4) Use the Port interface class in the basic interface class library to describe the information that the state can provide, as well as the input and output information required for the motion process.
[0127] 5) Use the Order interface class in the basic interface class library to describe the execution order information of a device's motion process.
[0128] 6) Use the Collada interface class in the basic interface class library to link and integrate the simulation motion data information described in the external Collada file.
[0129] In this example, each motion process instance corresponds to a Collada file, which describes the simulated kinematic information of the robotic arm during a single motion process.
[0130] 7) Define a custom class to describe the logic components, containing several fixed interlocking component instances.
[0131] 8) Use the InterlockLogic interface class in the basic interface class library to describe the interlocking logic information.
[0132] The InternalLink feature in the AML standard is used to describe the relationships between elements, as detailed below:
[0133] 1) Following the (s,t,f) principle in MCM, each motion process instance (i.e., transition rule) corresponds to the starting state, the target state, and the motion control device. In this example, it corresponds to equations (1), (2), and (3) described above. Taking equation (1) as an example, Position1 corresponds to the starting state, and Position2 corresponds to the target state, which are respectively connected to the Port interface class under move_PointToPoint1.
[0134] 2) Following the principle of (d, M, S, λ) in DBM, each industrial device connects its own motion control model in the execution order. If interlocking conditions exist, the InterlockLogic interface under the corresponding interlocking component instance is additionally connected. In this example, this corresponds to equations (4) and (5) described above. Taking equation (4) as an example, Robot1 executes MCM1 first, and then executes MCM2. Taking equation (5) as an example, Robot2 needs to satisfy the interlocking condition λ1 = Equal(Position3, Position4) first, that is, when the position of Robot1 (Position3) is equal to the position of Robot2 (Position4), then the motion control corresponding to MCM3 is executed.
[0135] Step S2: The PLC programming platform imports the device behavior model, performs ontology semantic description on the model, and integrates knowledge from the constructed function block knowledge base to obtain a knowledge graph. Since the PLC programming platform imports the device behavior model with an integrated motion control model, motion control code generation is achieved.
[0136] Step S2-1: Construct a functional block knowledge base
[0137] The existing function block control library of the PLC programming platform is subjected to ontology semantic transformation to generate a corresponding function block knowledge base based on ontology semantic description. This function block knowledge base includes basic interlocking logic function blocks such as Equal, and function blocks based on the PLCOpen Motion Control standard. It also provides input and output attributes for each motion control to form a mapping relationship with the motion process in the AML model.
[0138] Step S2-2: Generate a knowledge graph
[0139] The PLC programming platform imports AML model files and performs ontological semantic transformation on the relationships between modules expressed in the AML model.
[0140] This involves describing the motion process and integrating it with a pre-built ontology-based functional block knowledge base according to a customized mapping relationship.
[0141] It should be noted that the motion processes represented in the knowledge graph do not have a one-to-one correspondence with the motion control function blocks based on the PLCOpen Motion Control standard. The motion process is a description of the basic motion components on the industrial simulation platform. It is a complex motion behavior composed of one or more atomic motion behaviors arranged according to certain logic, with the motion control function blocks based on the PLCOpen Motion Control standard as the atomic motion behaviors. The mapping relationship is as follows:
[0142] A = τ(B = (b0, b1, ..., b) n (6)
[0143] Where A represents a motion process node, B represents a list of motion control function blocks b, and τ represents the transformation logic relationship.
[0144] In this embodiment, the Move_PointToPoint motion process in the AML model forms a direct mapping relationship with the MC_MoveDirectAbsolute description in the motion function block library, that is...
[0145]
[0146] in This represents a direct mapping relationship without any extra logic.
[0147] By incorporating MC_MoveDirectAbsolute as a child node of Move_PointToPoint into the ontology semantic description, a knowledge graph structure is ultimately generated, such as... Figure 7 As shown. This involves the association with the Port interface class, which additionally generates two nodes representing input and output. The output node represents the attributes and values that the motion or state can provide, while the input node represents the attributes required by the motion process.
[0148] Step S3: Perform reasoning and parsing on the knowledge graph according to specific rules and algorithms to generate FBD code based on the IEC 61131-3 standard that is consistent with the motion control logic described by the device behavior model.
[0149] The semantically replaced knowledge graph adds descriptions of motion control function blocks based on the PLCOpenMotion Control standard to the nodes representing motion processes, and also includes detailed descriptions of input / output port nodes. A specific parsing algorithm is used to reason through the knowledge graph, thereby generating FBD code. The implementation process is as follows: Figure 8 As shown, the specific steps are as follows:
[0150] Step S3-1: Generate project framework
[0151] According to the DBM description, starting from the device node, the driver information corresponding to the device is preferentially stored in the variable area of a separate POU (Program Organization Unit), called a shared POU, for use by other POUs. POU pages are then created sequentially according to the execution order described in the Order class.
[0152] In this example, such as Figure 9 As shown, according to the knowledge graph description, it involves two robotic arm devices and three motion processes. Accordingly, two device nodes are generated under the engineering framework. Each device node generates the POU corresponding to the motion process in the execution order.
[0153] Step S3-2: Generate function blocks
[0154] Starting from the motion process nodes, the functional block logic corresponding to each motion process node is identified and generated in the corresponding POU according to the execution order. The functional blocks pass information to each other through connections (only allowing two functional blocks to be in the same POU) or variables. If two motion process nodes contain interlocking logic controls, additional interlocking logic controls are generated.
[0155] In this example, such as Figure 10 As shown, this illustrates the relationship between the two movement process nodes, move_PointToPoint2 and move_PointToPoint3, in the knowledge graph, and the corresponding generated functional block logic description. It should be noted that the connections here only represent logical relationships and do not fully represent the functional block connections in the actual programming interface.
[0156] Step S3-3: Assigning values to function blocks
[0157] According to the MCM description, starting from the motion process node, the corresponding initial state and target state are searched sequentially. Based on the attributes described by the input Port node, data is obtained from the shared POU, the initial state point, and the target state point, respectively. If the Port node attributes cannot meet the input requirements of the function block, such as requiring information like speed or acceleration, the corresponding Collada file is obtained from the motion process. The feature point recognition algorithm is called to identify the location of feature points in each frame. After converting them into actual spatial positions, the distance the points move between each two frames is calculated, and then the device's moving speed, acceleration, and other information are deduced and assigned to the function block pins.
[0158] In this example, such as Figure 11 As shown, after step 2, the pins of the function block are successfully assigned values, and the function blocks of different POUs transfer data through variables.
[0159] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for automatically generating industrial equipment motion control code based on AutomationML, characterized by, The method comprises the following steps: Step S1, the industrial simulation platform simulates the motion simulation of the digital twin of the field industrial equipment; after determining the equipment motion behavior, the equipment driving information, the initial state information, the target state information and the complete motion process information are modeled and represented to obtain the equipment behavior model; Step S2, the PLC programming platform imports the equipment behavior model, performs ontology semantic description on the equipment behavior model, and performs knowledge fusion according to the constructed function block knowledge base to obtain a knowledge graph; Step S3, the knowledge graph is analyzed according to specific rules and algorithms, and FBD code based on the IEC 61131-3 standard consistent with the motion control logic described by the equipment behavior model is generated; AutomationML based on the IEC 62714-1 standard is used as a model representation tool for equipment behavior, which is used to combine motion description and simulation information, and simulation motion data is described in a Collada file and integrated into the AutomationML model; Step S1 comprises: Step S1-1: Construct a motion scene; The basic motion of the equipment is described by a motion control model; Definition 1: A motion control model is a 3-tuple comprising: 1) a starting state s; 2) a target state t; 3) a conversion rule f representing the transformation logic from s to t; The complete equipment motion behavior is described by a series of industrial equipment participating in motion control and the motion control model of the industrial equipment combined according to a certain logic, and the equipment behavior model is described as follows: Definition 2: A device behavior model is a 4-tuple , consisting of: 1) a device corresponding to the behavior description; 2) a list of sets of motion control models as described by definition 1 ; 3) a set list of motion control execution sequences ; 4) a list of interlock condition sets An interlock is described as a binary logic that locks the associated motion control in a specific state; each m i m i+1 Interlock restrictions that need to be additionally satisfied, i.e. ; Step S1-2: Construct a digital twin model of the robot arm; wherein, By means of digital twin technology, feature data is obtained from the self-carrying sensor module of the robot arm, and a digital twin of the actual robot arm is generated on the industrial simulation platform based on the integrated geometric model library and the generated data; Step S1-3: The simulation platform describes the motion scene; wherein, The interlocking logic described by the execution sequence and the logic component library in combination with the motion control model can completely describe a device behavior model; Step S1-4: Modeling representation; wherein, The device behavior described based on the industrial simulation platform is modeled and represented by AutomationML, which contains basic role libraries, basic interface libraries and basic attribute libraries defined in the AML standard; the device behavior and simulation information are combined by means of the semantic connection relationship defined in the AML standard, and simulation motion data is described in a Collada file and integrated into the AML model.
2. The AutomationML-based industrial device motion control code automatic generation method according to claim 1, characterized in that, Step S2 further comprises: Step S2-1: Construct a function block knowledge base; wherein, The existing function block control library of the PLC programming platform is subjected to ontology semantic conversion to generate a corresponding function block knowledge base based on ontology semantic description, which contains basic interlocking logic function blocks including Equal, and function blocks based on the PLCOpen Motion Control standard, and provides input and output attributes of each motion control to form a mapping relationship with the motion process in the AML model; Step S2-2: Generate a knowledge graph: wherein, The PLC programming platform imports the AML model file, and converts the connection between the modules expressed by the AML model in ontology semantics; wherein, the description of the motion process is fused with the function block knowledge base constructed based on the ontology description according to the customized mapping relationship.
3. The AutomationML-based industrial device motion control code automatic generation method according to claim 1, characterized in that, Step S3 further includes: Step S3-1: generating an engineering framework; wherein, According to the DBM description, starting from the device node, the driving information corresponding to the device is stored in the variable area of a separate POU, called a shared POU, for use by other POUs; and POU pages are established in sequence according to the execution order described by the Order class; Step S3-2: generating function blocks; wherein, Starting from the motion process node, the function block logic corresponding to each motion process node is identified, and is generated in the corresponding POU according to the execution order, and the function blocks rely on the connection or variable to transmit information; if the interlocking logic control is contained in two motion process nodes, an interlocking logic control is additionally generated; Step S3-3: function block assignment; wherein, According to the MCM description, starting from the motion process node, the corresponding start state and target state are sequentially found, and data is obtained from the shared POU, the start state point and the target state point according to the attributes of the input Port node description; if the Port node attributes cannot meet the input requirements of the function block, the corresponding Collada file is obtained from the motion process, a feature point recognition algorithm is called to identify the position of each frame feature point, the actual spatial position is converted, the moving distance of each two frames is calculated, and the moving speed and acceleration information of the device are calculated, and are assigned to the function block pin.
4. The AutomationML-based industrial device motion control code automatic generation method according to claim 1, characterized in that, The function block knowledge base is constructed by the ontology description corresponding to the function block control library based on the PLC programming platform, and contains basic interlocking logic function blocks and function blocks based on the PLCOpen Motion Control standard.
5. An apparatus for automatically generating industrial equipment motion control code based on AutomationML, characterized by, The automationML-based industrial equipment motion control code automatic generation method of any one of claims 1-4 comprises at least an industrial simulation platform and a PLC programming platform, wherein, The industrial simulation platform is used for simulating the motion of the digital twin of the field industrial equipment; after determining the device motion behavior, the device driving information, the start state information, the target state information and the complete motion process information are modeled and represented to obtain a device behavior model; The PLC programming platform is used for importing the device behavior model, performing ontology semantic description on the device behavior model, and performing knowledge fusion on the device behavior model according to the constructed function block knowledge base to obtain a knowledge graph; and the knowledge graph is analyzed by a specific rule and algorithm to generate FBD code based on the IEC 61131-3 standard consistent with the motion control logic described by the device behavior model.
6. The AutomationML-based industrial device motion control code automatic generation apparatus according to claim 5, characterized by, The PLC programming platform is a programming platform based on the IEC 61131-3 standard programming language, which provides programming modes of corresponding programming languages, and provides various function block control libraries with rich functions.
Citation Information
Patent Citations
Code abstract generation method based on code knowledge graph and knowledge migration
CN111797242A
Digital twin workshop multi-scale association method based on knowledge graph
CN115080797A