Workshop production line plc virtual debugging and visual verification method and system based on digital twinning

By establishing a bidirectional mapping relationship in the digital twin scenario, PLC virtual debugging and visual verification are realized, which solves the problem that PLC program debugging depends on real equipment and improves debugging efficiency and equipment status consistency.

CN123029787APending Publication Date: 2026-11-03BEIHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611117759.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing PLC program debugging relies on real PLCs and physical devices, resulting in long debugging cycles and difficulties in problem localization. Furthermore, existing digital twin virtual debugging methods lack a closed-loop mapping mechanism between virtual sensors, PLC input/output addresses, and the controlled devices.

Method used

By constructing a digital twin debugging scenario and a PLC simulation data interaction space, a two-way mapping relationship is established to realize data interaction between the digital twin debugging scenario and the virtual PLC instance, and to perform rendering updates, forming a closed-loop virtual debugging process.

Benefits of technology

Reduce reliance on actual PLCs and physical equipment, improve the efficiency of problem localization and debugging verification, maintain equipment pose consistency, and achieve collaborative visualization of PLC control logic and equipment operation mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123029787A_ABST
    Figure CN123029787A_ABST
Patent Text Reader

Abstract

The application discloses a workshop production line PLC virtual debugging and visual verification method and system based on digital twinning, and belongs to the technical field of digital twinning. The method comprises the following steps: a digital twinning debugging scene and a PLC simulation data interaction space are respectively constructed; a bidirectional mapping relationship of the digital twinning debugging scene and the PLC simulation data interaction space is established; based on the latest node data of the digital twinning debugging scene, data interaction between the digital twinning debugging scene and a virtual PLC instance is realized through the bidirectional mapping relationship; based on the data interaction, node data of the digital twinning debugging scene is updated; and a closed loop of the data interaction between the updated node data of the digital twinning debugging scene and the virtual PLC instance is realized. The application realizes a closed loop virtual debugging process, and reduces the dependence on a real PLC, entity equipment and a field joint debugging environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of digital twin technology, specifically relating to a method and system for virtual debugging and visual verification of PLC in a workshop production line based on digital twins. Background Technology

[0002] In smart manufacturing workshops, PLCs undertake tasks such as equipment control, logic interlocking, and operational coordination. The correctness of their program logic directly affects production line efficiency, equipment safety, and system stability. Traditional PLC program debugging usually relies on actual PLCs, physical equipment, and on-site debugging environments. When equipment is not fully installed or on-site conditions are not met, it is difficult to verify the control logic in advance, resulting in problems such as strong hardware dependence, long debugging cycles, difficulty in problem localization, and high risk of equipment malfunction.

[0003] With the development of PLC simulation, digital twin, and virtual debugging technologies, virtual PLC instances can be created using PLC simulation software, and the PLC program to be debugged can be run. Simultaneously, a digital twin scenario can be constructed to provide a 3D visualization of the program's execution results. Existing technologies, such as Chinese patent CN108919765B which discloses a method for virtual debugging and virtual monitoring of an intelligent manufacturing plant based on digital twins, and Chinese patent CN112684717A which discloses a method for constructing a virtual-real combined digital twin simulation experimental platform, can reduce the cost of physical debugging to a certain extent.

[0004] However, existing PLC virtual debugging methods mostly focus on 3D scene display, process simulation, or equipment movement driven by control signals, lacking a structured parsing mechanism for the PLC data block address space, as well as a configurable bidirectional mapping mechanism between virtual sensors, PLC input / output addresses, and controlled equipment. Summary of the Invention

[0005] To address the problems of existing PLC program debugging relying on real PLCs and physical equipment, long debugging cycles, and difficulties in problem localization, as well as the lack of a closed-loop mapping mechanism between virtual sensors, PLC input / output addresses, and controlled equipment in existing digital twin virtual debugging methods, this invention provides a workshop production line PLC virtual debugging and visualization verification method and system based on digital twins.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] In a first aspect, this invention proposes a method for virtual debugging and visual verification of a workshop production line PLC based on digital twins, the method comprising the following steps:

[0008] S1: Construct a digital twin debugging scenario and a PLC simulation data interaction space respectively; the digital twin debugging scenario includes scenario structure nodes, virtual sensor nodes, and controlled execution nodes; the PLC simulation data interaction space connects to and runs a virtual PLC instance, and includes the address information of the virtual PLC instance.

[0009] S2: Establish a two-way mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space;

[0010] S3: Based on the latest node data of the digital twin debugging scenario, data interaction between the digital twin debugging scenario and the virtual PLC instance is realized through the bidirectional mapping relationship.

[0011] S4: Based on the data interaction, update the node data of the digital twin debugging scene, and update the rendering of the digital twin debugging scene based on the updated node data.

[0012] S5: Repeat steps S3 to S4.

[0013] Secondly, this invention proposes a workshop production line PLC virtual debugging and visualization verification system based on digital twins, the system comprising:

[0014] The data construction module is used to construct a digital twin debugging scenario and a PLC simulation data interaction space, respectively. The digital twin debugging scenario includes scenario structure nodes, virtual sensor nodes, and controlled execution nodes. The PLC simulation data interaction space connects to and runs a virtual PLC instance and includes the address information of the virtual PLC instance.

[0015] The relationship establishment module is used to establish a bidirectional mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space.

[0016] The data interaction module is used to realize data interaction between the digital twin debugging scenario and the virtual PLC instance through the bidirectional mapping relationship, based on the latest node data of the digital twin debugging scenario.

[0017] The data update module is used to update the node data of the digital twin debugging scenario based on the data interaction, and to perform rendering updates of the digital twin debugging scenario based on the updated node data.

[0018] The present invention has the following beneficial effects:

[0019] (1) By establishing a bidirectional mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space, the present invention forms a closed-loop virtual debugging process of “scenario state calculation - input of virtual PLC instance - PLC program operation - output of virtual PLC instance - device drive - node data update”, thereby reducing the dependence on real PLC, physical equipment and on-site debugging environment.

[0020] (2) The present invention uses a directed acyclic graph structure to describe the parent-child hierarchical relationship between workshop production line equipment, and updates the spatial state according to the order of parent node before child node, which is beneficial to maintaining the pose consistency of complex equipment and its auxiliary mechanisms.

[0021] (3) This invention converts PLC output data into equipment operating status and target pose through hierarchical driving of controller objects and equipment mechanism components, thereby realizing the coordination between PLC control logic, equipment operating mechanism and three-dimensional visualization status, and improving the efficiency of problem location and debugging verification. Attached Figure Description

[0022] Figure 1 This is a flowchart of a digital twin-based workshop production line PLC virtual debugging and visualization verification method according to the present invention;

[0023] Figure 2 This is a closed-loop interaction architecture diagram of the digital twin debugging scenario and the PLC simulation data interaction space in an embodiment of the present invention;

[0024] Figure 3 This is a schematic diagram of the hierarchical structure of a digital twin debugging scenario based on a directed acyclic graph according to an embodiment of the present invention;

[0025] Figure 4 This is a schematic diagram of the controller-device mechanism component driving and virtual debugging cycle data flow according to an embodiment of the present invention. Detailed Implementation

[0026] 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. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0027] like Figure 1 As shown, this invention proposes a method for virtual debugging and visual verification of PLCs in a workshop production line based on digital twins. This method includes the following steps:

[0028] S1: Construct a digital twin debugging scenario and a PLC simulation data interaction space respectively; the digital twin debugging scenario includes scenario structure nodes, virtual sensor nodes, and controlled execution nodes; the PLC simulation data interaction space is connected to and runs a virtual PLC instance, and includes the address information of the virtual PLC instance;

[0029] S2: Establish a two-way mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space;

[0030] S3: Obtain the latest node data of the digital twin debugging scenario; realize data interaction between the digital twin debugging scenario and the virtual PLC instance through the bidirectional mapping relationship;

[0031] S4: Based on the data interaction, update the node data of the digital twin debugging scene, and update the rendering of the digital twin debugging scene based on the updated node data;

[0032] S5: Repeat steps S3 to S4.

[0033] In some embodiments, the PLC simulation data interaction space includes a set of PLC-accessible data addresses:

[0034] ;

[0035] in, This represents an accessible data address within a data block of the PLC program executed by the virtual PLC instance, where k ∈ [1, m], and m is the number of accessible data addresses. It should include at least the virtual PLC instance identifier, data block identifier, variable name, byte offset, bit offset, and variable data type;

[0036] ;

[0037] in, Indicates the virtual PLC instance identifier. Indicates the data block identifier. Indicates the variable name. Indicates byte offset. Indicates the bit offset. Indicates the data type of the variable.

[0038] In practice, a virtual PLC instance can be created using PLC simulation software and the PLC program to be debugged can be run. The PLC simulation data interaction space establishes a communication connection with the virtual PLC instance, obtains the data block structure file exported from the PLC project, parses the variable names, data types, byte offsets and bit offsets, and generates a PLC address space for mapping configuration.

[0039] Furthermore, a local data block mirror is established based on the set of data addresses accessible by the PLC, A. The local data block mirror is used to cache the data written by the virtual sensor to the PLC input address, as well as the PLC control field data values ​​associated with the reverse mapping relationship in the virtual PLC instance.

[0040] Establish a local data block mirror based on the set of PLC-accessible data addresses:

[0041] ;

[0042] in, Indicates the data address at time t The corresponding local image value.

[0043] During virtual debugging, the PLC simulation data interaction space actively reads the updated PLC control field data values ​​from the virtual PLC instance and synchronously updates the local data block image, so that the control input data of the controlled execution node can be extracted and organized according to the reverse mapping relationship later.

[0044] In some embodiments, the PLC simulation data interaction space includes a set of data addresses of the virtual PLC instance obtained by parsing the PLC data block corresponding to the virtual PLC instance; a local data block mirror is established based on the data address of the PLC instance, and the local data block mirror is used to cache the output data written by the virtual sensor node to the PLC input address, as well as the PLC control field data values ​​in the virtual PLC instance associated with the reverse mapping relationship.

[0045] like Figure 2 As shown, the PLC simulation data interaction space connects to the virtual PLC instance created by the PLC simulation software, parses the data block structure file exported from the PLC project, and generates an addressable PLC address space; it records the initial state of the local data block image and the PLC data block when the virtual debugging starts, and restores the corresponding data state when the virtual debugging stops or is reset.

[0046] like Figure 3The diagram shows the hierarchical structure of the digital twin debugging scenario based on a directed acyclic graph (DAG). Arrows represent the node update order from layer 0 to layer 4. Solid lines represent controlled execution nodes, and dashed lines of different shapes represent scene structure nodes and virtual sensor nodes. The overall structure is built hierarchically with parent-child nodes: the root node at layer 0 is the top-level parent node, and its child nodes are the layer 1 shelf nodes, ground rail nodes, and fixed support nodes; the layer 1 ground rail node is the parent node, and its child nodes are the layer 2 photoelectric sensor nodes, stacker crane body nodes, and limit sensor nodes; the layer 2 stacker crane body node is the parent node, and its child nodes are the layer 3 position sensor nodes and lifting sub-mechanism nodes; the layer 3 lifting sub-mechanism node is the parent node, and its child nodes are the layer 4 fork sub-mechanism nodes and position sensor nodes. The nodes in the digital twin debugging scenario are represented by the following formula based on the DAG structure:

[0047] ;

[0048] in, This represents the set of nodes in a digital twin debugging scenario. This represents the set of parent-child hierarchical constraints between nodes in a digital twin debugging scenario;

[0049] ;

[0050] in, As the root node, As the first node, For the second node, The n-1th node is the first node, the second node and the n-1th node are the remaining nodes other than the root node;

[0051] For any node The state attribute set is represented as:

[0052] ;

[0053] in, Represents a node The global transformation matrix, Represents a node Relative to the local transformation matrix of its parent node, Represents a position vector. Represents the scaling parameter matrix. This represents a rotation quaternion.

[0054] For any directed edge , ;

[0055] Then node For nodes The parent node, the node Local space with nodes The global space is used as a reference.

[0056] Understandably, digital twin debugging scenarios are constructed by importing geometric models of workshop production line equipment, and configuring node types, parent-child hierarchical relationships, initial local transformation parameters, and corresponding equipment mechanism parameters for each geometric model. During virtual debugging, the corresponding geometric model is rendered based on the updated global transformation matrix of each node, thereby achieving a three-dimensional visualization of the PLC program's execution results.

[0057] In some embodiments, such as Figure 2 As shown, the bidirectional mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space includes: the forward mapping relationship between the input addresses of the virtual sensor nodes and the virtual PLC instance, and the reverse mapping relationship between the PLC control field address used to output device control information in the virtual PLC instance and the controlled execution node.

[0058] In some embodiments, the forward mapping is used to represent the mapping between virtual sensor nodes and the input addresses of virtual PLC instances in the PLC accessible data addresses:

[0059] ;

[0060] Where S represents the set of virtual sensors, Let Z represent the i-th virtual sensor, and Z represent the set of input addresses of the virtual PLC instance. This represents the input address of the k-th virtual PLC instance.

[0061] In some embodiments, the reverse mapping relationship represents the mapping relationship between the PLC control field address used to output device control information in a virtual PLC instance and the controlled execution node, expressed as:

[0062] ;

[0063] in, C represents the controlled execution node, B represents the set of controlled execution nodes, and C represents the set of PLC control field addresses used to output device control information in the virtual PLC instance. This represents the output address of the k-th virtual PLC instance.

[0064] Forward mapping and inverse mapping relationship Composition of mapping configuration set:

[0065] ;

[0066] Mapping configuration set It is used to store the correspondence between virtual sensor nodes, PLC addresses and controlled execution nodes, and to restore them when the digital twin debugging scenario is loaded.

[0067] In some embodiments, the data interaction between the digital twin debugging scenario and the virtual PLC instance includes: calculating the output data of the virtual sensor node based on the state of the digital twin debugging scenario; writing the output data of the virtual sensor node to the input address of the virtual PLC instance based on the forward mapping relationship; the virtual PLC instance executing a PLC program based on the written input data, updating the PLC control field data values ​​associated with the reverse mapping relationship; the PLC simulation data interaction space actively reading the updated PLC control field data values ​​according to the address information, and synchronously updating the local data block mirror; the local data block mirror is used to store the PLC control field data values ​​associated with the reverse mapping relationship. Based on the reverse mapping relationship, the PLC control field data values ​​corresponding to the controlled execution node are extracted from the local data block mirror and organized into a control input vector.

[0068] The control input vector is input to the controller object corresponding to the controlled execution node, and a device operation command is generated through control semantic parsing and control quantity conversion. The device operation command drives the device mechanism component to update the running state of the controlled execution node, and calculates the target local pose parameters of the controlled execution node relative to the parent node based on the updated running state, constructs the target local transformation matrix, and calculates the target global transformation matrix according to the parent-child hierarchical relationship. The digital twin debugging scenario updates the spatial state and rendering state of the corresponding node according to the target global transformation matrix.

[0069] In some embodiments, the virtual sensing output set is constituted by the output data of all virtual sensor nodes at time t:

[0070] ;

[0071] in, This represents the output data of the first virtual sensor node at time t. This represents the output data of the second virtual sensor node at time t. Indicates the time t at the th Output data of each virtual sensor node.

[0072] Based on the forward mapping relationship, the virtual perception output set Converted to PLC input data, it is represented as:

[0073] ;

[0074] in, This represents the set of data written to the corresponding input address of the virtual PLC instance. This represents the forward mapping transformation function. Based on the forward mapping relationship, virtual sensor nodes can be transformed... Output data Write PLC input address The corresponding data location is updated, and the local data block mirror is updated synchronously. The corresponding mirror value.

[0075] For any controlled execution node Determine the relationship with the controlled execution node based on the reverse mapping. The corresponding set of PLC control fields is represented as follows:

[0076] ;

[0077] in, Indicates the relationship with the controlled execution node The corresponding set of PLC control fields, Indicates the relationship with the controlled execution node The corresponding first PLC control field, Indicates the relationship with the controlled execution node The corresponding second PLC control field, Indicates the relationship with the controlled execution node The corresponding number Each PLC control field.

[0078] The PLC simulation data interaction space actively reads the PLC control field data values ​​based on the address information, synchronously updates the local data block image, and organizes the data values ​​of the PLC control field set in the local data block image at time t into a control input vector:

[0079] ;

[0080] in, Indicates the controlled execution node The control input vector at time t, They are respectively , , The data value at time t corresponds to the data value in the local data block mirror.

[0081] Control input vector Used as a unified control semantic input for the controller object associated with the controlled execution node, the controller object generates a device operation instruction through control semantic parsing and control quantity conversion. The device operation instruction drives the corresponding device mechanism component to update the operation state of the controlled execution node, and calculates the target local pose parameters based on the updated operation state to construct the target local transformation matrix and the target global transformation matrix.

[0082] In some embodiments, virtual sensor nodes include physical simulation sensors that generate trigger states based on geometric collision relationships, and logical calculation sensors that generate detection results based on changes in device state.

[0083] For any virtual sensor node Its output data Represented as:

[0084] ;

[0085] in, Represents sensor nodes The set of parameters, This is the state calculation function for the corresponding sensor node. This represents the current state of the digital twin debugging scenario at time t. This indicates the state of the digital twin debugging scenario in the previous sampling period. This indicates the time interval between adjacent sampling periods.

[0086] In some embodiments, for any controlled execution node The set of PLC control fields corresponding to the controlled execution node is determined according to the reverse mapping relationship, and the data values ​​of the set of PLC control fields at time t are read from the local data block mirror. The data values ​​are then organized into a control input vector in a preset order.

[0087] It is understandable that the control input vector drives the controller object and device mechanism components, updates the running state of the controlled execution node, further updates the target local pose parameters, and constructs the target local transformation matrix and the target global transformation matrix. The updates of each node in the digital twin debugging scenario based on the target local transformation matrix and the target global transformation matrix of the controlled execution node, as well as the parent-child hierarchical relationship, include:

[0088] For any controlled execution node, the set of PLC control fields corresponding to that node is determined according to the reverse mapping relationship. The data values ​​of the PLC control field set at time t are read from the local data block mirror, and these data values ​​are organized into a control input vector according to a preset order. The control input vector is first input to the controlled execution node. The associated controller object generates device operation instructions through control semantic parsing and control quantity conversion; the device operation instructions drive the corresponding device mechanism components to update the operating state of the controlled execution node, generate target pose parameters based on the operating state, and further construct target local transformation matrix and target global transformation matrix. The spatial state of the controlled execution node and its subordinate nodes is updated according to the target local transformation matrix, target global transformation matrix and parent-child hierarchical relationship.

[0089] like Figure 3 As shown, each controlled execution node is associated with at least one controller object and at least one device mechanism component; the controller object is used to convert control input vectors into device operation instructions, and the device mechanism component is used to calculate the device operation state, target pose parameters, and target global transformation matrix.

[0090] In some embodiments, the nodes in a digital twin debugging scenario include non-root nodes and root nodes:

[0091] For a non-root node, it has a unique parent node;

[0092] For any non-root node Its parent node is Then the non-root node The global transformation matrix satisfies:

[0093] ;

[0094] in, Represents a non-root node The global transformation matrix of the parent node; Non-root node The global transformation matrix, Non-root node The local transformation matrix.

[0095] In some embodiments, controlling the input vector to drive the controller object and device mechanism components, and generating the global transformation matrix of the controlled execution node target includes:

[0096] For any controlled execution node The control input vector in its control input vector Input is sent to the associated controller object, and control semantics parsing and control quantity conversion are used to generate device operation instructions:

[0097] ;

[0098] in, Indicates the device operation command. Indicates the controlled execution node The corresponding controller's control semantics parsing and control quantity conversion functions, Indicates the controlled execution node The operating state at time t includes the device's action state and corresponding motion parameters.

[0099] The device operation command serves as the driving input for the device mechanism components, used to update the operating state of the controlled execution node, and is represented as follows:

[0100] ;

[0101] in, This represents the state update function. Indicates the controlled execution node The operating status in the next sampling period;

[0102] Based on the updated running status, calculate the target position vector and target rotation quaternion of the controlled execution node relative to its parent node:

[0103]

[0104]

[0105] in, and These represent the controlled execution nodes respectively. The target position vector and the target rotation quaternion, and These represent the position calculation function and the rotation calculation function, respectively. Indicates the device's mechanistic parameters.

[0106] Construct the target local transformation matrix based on the target position vector, the target rotation quaternion, and the scaling parameter matrix:

[0107]

[0108] in, Indicates the controlled execution node The target local transformation matrix in the next sampling period This represents a function that constructs a local transformation matrix based on the position vector, rotation quaternion, and scaling parameter matrix. Controlled execution node The scaling parameter matrix; the scaling parameter matrix remains unchanged by default.

[0109] Calculate the target global transformation matrix of the controlled execution node based on the parent-child hierarchical relationship:

[0110] ;

[0111] in, Indicates the controlled execution node The target global transformation matrix in the next sampling period This represents the global transformation matrix of the parent node in the next sampling period.

[0112] After obtaining the target local transformation matrix and the target global transformation matrix, the spatial state of the controlled execution node and its subordinate scene structure nodes and virtual sensor nodes is updated according to the parent-child hierarchy, with the parent node preceding the child node, in order to maintain the consistency of the hierarchical relationship and visualization state of the digital twin debugging scene.

[0113] Repeat steps S3 to S4 to create a closed-loop update of the output data of the virtual sensor node, the running data of the PLC program in the virtual PLC instance, the spatial state of the controlled execution node, and the visualization state of the digital twin debugging scenario, thereby realizing the virtual debugging of the PLC program and the visualization verification of the digital twin.

[0114] Specifically, such as Figure 4 As shown, in each virtual debugging cycle, virtual sensor output data is generated based on the state of the digital twin debugging scenario, and written to the corresponding PLC input address according to the forward mapping relationship; the virtual PLC instance executes the PLC program based on the written input data, and updates the PLC control field data values ​​associated with the reverse mapping relationship; the PLC simulation data interaction space actively reads the updated PLC control field data values ​​according to the address information, and synchronously updates the local data block image.

[0115] Subsequently, based on the reverse mapping relationship, the PLC control field data values ​​corresponding to the controlled execution node are extracted from the local data block mirror and organized into a control input vector. The controller object generates equipment operation instructions based on the control input vector. The equipment mechanism component updates the operating state of the controlled execution node based on the equipment operation instructions, calculates the target local pose parameters and constructs the target local transformation matrix. Then, based on the parent-child hierarchy relationship, the target global transformation matrix is ​​calculated, and the spatial state of the controlled execution node and its subordinate nodes and the rendering state of the digital twin debugging scene are updated.

[0116] The above closed-loop process can be represented as:

[0117] ;

[0118] in, This indicates the state of the digital twin debugging scenario at time t; This represents the set of data output by the virtual sensor node; This indicates the data status in the local data block mirror at time t; u This represents the set of control input vectors extracted and organized from the local data block mirror according to the reverse mapping relationship at time t; This indicates the state of the digital twin debugging scenario in the next sampling period.

[0119] Through the above closed-loop process, the virtual sensor node continuously senses the state changes of the digital twin debugging scenario and writes the sensing results into the corresponding input address of the virtual PLC instance according to the forward mapping relationship; the virtual PLC instance executes the PLC program according to the input data and updates the PLC control field data value associated with the reverse mapping relationship; the PLC simulation data interaction space actively reads the updated PLC control field data value and synchronously updates the local data block image.

[0120] The PLC simulation data interaction space extracts the PLC control field data values ​​of the corresponding controlled execution node from the local data block mirror according to the reverse mapping relationship, and organizes them into control input vectors. The controller object generates equipment operation instructions according to the control input vectors, and the equipment mechanism components update the operating state of the controlled execution node accordingly, calculate the target local pose parameters, construct the target local transformation matrix and the target global transformation matrix, and update the spatial state and rendering state of the controlled execution node and its subordinate nodes according to the parent-child hierarchy.

[0121] In some embodiments, the PLC simulation data interaction space includes a set of data addresses of the virtual PLC instance obtained by parsing the PLC data block corresponding to the virtual PLC instance.

[0122] A local data block mirror is established based on the data address set of the PLC instance. The local data block mirror is used to cache the output data written by the virtual sensor to the PLC input address, as well as the PLC control field data values ​​in the virtual PLC instance that are associated with the reverse mapping relationship.

[0123] In other embodiments, the present invention also provides a workshop production line PLC virtual debugging and visualization verification system based on digital twins. This system includes: a data construction module for constructing a digital twin debugging scenario and a PLC simulation data interaction space; the digital twin debugging scenario includes scenario structure nodes, virtual sensor nodes, and controlled execution nodes; the PLC simulation data interaction space connects to and runs a virtual PLC instance and includes the address information of the virtual PLC instance; a relationship establishment module for establishing a bidirectional mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space; a data interaction module for realizing data interaction between the digital twin debugging scenario and the virtual PLC instance based on the latest node data of the digital twin debugging scenario through the bidirectional mapping relationship; and a data update module for updating the node data of the digital twin debugging scenario based on the data interaction, and performing rendering updates of the digital twin debugging scenario based on the updated node data.

[0124] This invention is not limited to the embodiments described above. Any equivalent substitutions or modifications made based on the technical solutions of this invention should fall within the protection scope of this invention. The above descriptions are merely specific embodiments of this invention, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, this invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for virtual debugging and visual verification of PLC in a workshop production line based on digital twins, characterized in that, Includes the following steps: S1: Construct a digital twin debugging scenario and a PLC simulation data interaction space respectively; the digital twin debugging scenario includes scenario structure nodes, virtual sensor nodes, and controlled execution nodes; The PLC simulation data interaction space connects to and runs a virtual PLC instance, and includes the address information of the virtual PLC instance; S2: Establish a two-way mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space; S3: Based on the latest node data of the digital twin debugging scenario, data interaction between the digital twin debugging scenario and the virtual PLC instance is realized through the bidirectional mapping relationship; S4: Based on the data interaction, update the node data of the digital twin debugging scene, and update the rendering of the digital twin debugging scene based on the updated node data; S5: Repeat steps S3 to S4.

2. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 1, characterized in that, Each node in the digital twin debugging scenario is represented based on a directed acyclic graph structure: ; in, This represents the set of nodes in a digital twin debugging scenario. This represents the set of parent-child hierarchical constraints between nodes in a digital twin debugging scenario; ; in, As the root node, As the first node, For the second node, The n-1th node is the first node, the second node and the n-1th node are the remaining nodes other than the root node; any directed edge , ; Then node For nodes The parent node, the node Local space with nodes The global space is used as a reference.

3. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 2, characterized in that, The bidirectional mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space includes: The forward mapping relationship between the virtual sensor node and the input address of the virtual PLC instance, and the reverse mapping relationship between the PLC control field address used to output device control information in the virtual PLC instance and the controlled execution node.

4. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 3, characterized in that, The data interaction between the digital twin debugging scenario and the virtual PLC instance includes: The output data of the virtual sensor node is calculated based on the state of the digital twin debugging scenario, and the output data of the virtual sensor node is written to the input address of the virtual PLC instance based on the forward mapping relationship. The virtual PLC instance executes the PLC program based on the written input data and updates the PLC control field data values ​​associated with the reverse mapping relationship; The PLC simulation data interaction space synchronously reads the updated data values ​​from the virtual PLC instance and updates the local data block image; the local data block image is used to store the PLC control field data values ​​associated with the reverse mapping relationship.

5. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 4, characterized in that, The virtual sensor nodes include physical simulation sensors that generate trigger states based on geometric collision relationships, and logic calculation sensors that generate detection results based on changes in device state. For any virtual sensor node Its output data Represented as: ; in, Represents sensor nodes The set of parameters, This refers to the state calculation function for the corresponding sensor node. This represents the current state of the digital twin debugging scenario at time t. This indicates the state of the digital twin debugging scenario in the previous sampling period. This indicates the time interval between adjacent sampling periods.

6. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 4, characterized in that, For any controlled execution node The set of PLC control fields corresponding to the controlled execution node is determined according to the reverse mapping relationship, and the data values ​​of the set of PLC control fields at time t are read from the local data block mirror. The data values ​​are then organized into a control input vector in a preset order.

7. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 6, characterized in that, The nodes in the digital twin debugging scenario include non-root nodes and root nodes: For non-root nodes, there is a unique parent node; For any non-root node Its parent node is Then the non-root node The global transformation matrix satisfies: ; in, Represents a non-root node The global transformation matrix of the parent node; Non-root node The global transformation matrix, Non-root node The local transformation matrix; Any node The state attribute set is represented as: ; in, Represents a node The global transformation matrix, Represents a node Relative to the local transformation matrix of its parent node, Representing nodes respectively The position vector, scaling parameter matrix, and rotation quaternion relative to its parent node.

8. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 7, characterized in that, The control input vector drives the controller object and device mechanism components, and generates the global transformation matrix of the controlled execution node target, including: For any controlled execution node Control the input vector Input is sent to the associated controller object, and control semantics parsing and control quantity conversion are used to generate device operation instructions: ; in, Indicates the device operation command. Indicates the controlled execution node The corresponding controller's control semantics parsing and control quantity conversion functions, Indicates the controlled execution node At time t, the operating state includes the device's action state and corresponding motion parameters; the device operating command, as the driving input of the device's mechanism components, is used to update the operating state of the controlled execution node, and is expressed as: ; in, This represents the function for updating the running status. Indicates the controlled execution node The operating status in the next sampling period; Based on the updated running status, calculate the target position vector and target rotation quaternion of the controlled execution node relative to its parent node: in, and These represent the controlled execution nodes respectively. In the next sampling period, the target position vector and the target rotation quaternion and These represent the position calculation function and the rotation calculation function, respectively. Indicates the device's mechanism parameters; This represents the position vector at the current moment. Represents the rotation quaternion at the current moment; Construct the target local transformation matrix based on the target position vector, the target rotation quaternion, and the scaling parameter matrix: in, Indicates the controlled execution node The target local transformation matrix in the next sampling period This represents a function that constructs a local transformation matrix based on a position vector, a rotation quaternion, and a scaling parameter matrix, which remains unchanged by default. Controlled execution node The scaling parameter matrix; Calculate the target global transformation matrix of the controlled execution node based on the parent-child hierarchical relationship: ; in, Indicates the controlled execution node The target global transformation matrix in the next sampling period This represents the global transformation matrix of the parent node in the next sampling period.

9. The method for virtual debugging and visual verification of workshop production line PLC based on digital twin as described in claim 8, characterized in that, The PLC simulation data interaction space includes the set of data addresses of the virtual PLC instance obtained by parsing the PLC data block corresponding to the virtual PLC instance. A local data block mirror is established based on the data address of the PLC instance. The local data block mirror is used to cache the output data written by the virtual sensor node to the PLC input address, as well as the PLC control field data values ​​in the virtual PLC instance that are associated with the reverse mapping relationship.

10. A workshop production line PLC virtual debugging and visualization verification system based on digital twins, characterized in that, The system includes: The data construction module is used to construct a digital twin debugging scenario and a PLC simulation data interaction space, respectively. The digital twin debugging scenario includes scenario structure nodes, virtual sensor nodes, and controlled execution nodes. The PLC simulation data interaction space is connected to and runs a virtual PLC instance and includes the address information of the virtual PLC instance. The relationship establishment module is used to establish a bidirectional mapping relationship between the digital twin debugging scenario and the PLC simulation data interaction space; The data interaction module is used to realize data interaction between the digital twin debugging scenario and the virtual PLC instance through the bidirectional mapping relationship based on the latest node data of the digital twin debugging scenario. The data update module is used to update the node data of the digital twin debugging scenario based on the data interaction, and to perform rendering updates of the digital twin debugging scenario based on the updated node data.

Citation Information

Patent Citations

  • A method and system for virtual commissioning and virtual monitoring of a smart manufacturing plant based on digital twins.

    CN108919765B

  • Method for constructing virtual-real combined digital twin simulation experiment platform

    CN112684717A