Digital twin scene rapid construction system and method based on scene description file, and medium
By quickly building a digital twin scene based on scene description files, the existing system construction efficiency is solved, the existing system construction is low, insufficient standardization and poor flexibility is achieved, and efficient and flexible digital twin scene construction is achieved, supporting virtual debugging and virtual image formation, improving industrial design and verification efficiency.
Patent Information
- Application Number
- CN202510454655.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-08-12
AI Technical Summary
The existing digital twin systems have low construction efficiency, insufficient standardization and lack of flexibility, making it difficult to achieve dynamic adaptation of changes in equipment configuration and switching between virtual and real synchronous simulation modes.
A digital twin scenario rapid construction system is adopted based on scene description files. By parsing XML files to extract device information and assembly relationships, a device simulation model with unified attributes is built, and an OPC UA server is used to realize communication between the simulation engine and the actual controller or physical device, supporting two modes: virtual debugging and virtual reality.
It realizes efficient generation and flexible application of digital twin scenarios, accelerates industrial design and verification processes, and provides technical support for the new generation of flexible automation.
Smart Images

Figure CN120470747A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital twin technology, and in particular to a system, method and medium for rapidly constructing a digital twin scene based on a scene description file. Background Art
[0002] With the development of the Industrial Internet and intelligent manufacturing, digital twin technology has become a key tool for achieving full lifecycle management of industrial equipment. However, the construction of existing digital twin systems has the following problems:
[0003] ① Low development efficiency: Traditional methods require manual coding to implement device models, data communication, and scene assembly. The process is cumbersome and has poor reusability.
[0004] ② Insufficient standardization: The lack of unified specifications for device data models and communication protocols makes it difficult for heterogeneous systems to interconnect with each other.
[0005] ③ Lack of flexibility: The existing system is difficult to dynamically adapt to changes in equipment configuration, and the cost of switching between virtual and real synchronized simulation modes is high. Summary of the Invention
[0006] The purpose of the present invention is to provide a system, method and medium for quickly constructing digital twin scenes based on scene description files, and to achieve efficient generation and flexible application of digital twin scenes through structured text and standardized communication technology.
[0007] To achieve the above objectives,
[0008] In a first aspect, an embodiment of the present application provides a digital twin scene rapid construction system based on a scene description file, comprising:
[0009] Description file parsing module, used to parse the scene description XML file and extract data model information, equipment and joint information, spatial position and assembly relationship information;
[0010] The device simulation model construction module constructs a device simulation model with unified attributes and methods based on the parsed device and joint information. The attributes include the device name, OPC UA node, joint instructions and status data list. The methods include initializing the device pose, reading and writing OPC UA data, executing simulation actions, and resetting the status.
[0011] The scenario simulation code integration module generates integrated code that can be run in the simulation engine based on the equipment simulation model and assembly relationship information;
[0012] Simulation engine, which provides visualization and 3D simulation environment and executes integrated code to drive virtual devices;
[0013] The OPC UA server, as a data hub, stores device joint instructions and status data nodes, enables communication between the simulation engine and the actual controller or physical device, and supports both virtual debugging and virtual-to-real modes.
[0014] The device information includes the device type, unique name, 3D resource path, base coordinate system pose, and data model; the assembly relationship is used to define the parent-child assembly relationship and coordinate system offset between devices; the data model includes the variable name, type, OPC UA data type, and initial value of each joint.
[0015] The implementation process of the scenario simulation code integration module includes:
[0016] Initialize the environment and connect the simulation engine to the OPC UA server;
[0017] Initialize the device and call the init method of the device model to load the 3D resource to the specified location;
[0018] Assembly relationship processing, binding the coordinate systems of parent and child devices according to the assembly relationship in XML;
[0019] The simulation main loop reads OPC UA instructions, executes simulation actions, and updates joint status to the OPC UA server.
[0020] In a second aspect, an embodiment of the present application provides a method for quickly constructing a digital twin scene based on a scene description file, comprising the following steps:
[0021] Parse the scene description XML file to extract device information, data model and assembly relationship;
[0022] Build a device simulation model based on device information and create corresponding instruction and status data nodes in the OPC UA server;
[0023] Generate simulation code based on the device posture and assembly relationship and integrate it into the simulation engine;
[0024] Communicate with external systems through the OPC UA server, drive virtual devices to perform actions and feedback status.
[0025] The construction of the equipment simulation model is specifically as follows:
[0026] Define the control variable name, type and initial value for each joint and associate it with the OPC UA node;
[0027] Batch reading and writing of OPC UA data is achieved through the read_joint_instructions and write_joint_status methods.
[0028] Extracting assembly relationships involves establishing dynamic binding relationships in the simulation engine based on the assembly joints and coordinate system offsets of the parent device and the child device.
[0029] The steps of executing the action of the simulation engine include:
[0030] Call the read_joint_instructions() method of the device simulation model to read the device's joint instruction data from the data space of the OPCUA server to the joint_instructions attribute of the device simulation model; call the execute_action() method of the device simulation model to execute the joint action instructions in the simulation engine; call the get_joint_status() method, or the actual joint data in the device simulation environment is stored in the joint_status attribute; call the write_joint_status() method to write the actual joint data in the device simulation environment in joint_status to the corresponding data space of the OPCUA server.
[0031] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores program code. When the program code is executed by a processor, it implements the steps of the method for quickly constructing a digital twin scene based on a scene description file as described above.
[0032] The beneficial effects of adopting the above embodiment are: realizing the rapid construction of digital twin scenarios based on description files, accelerating the industrial design and verification process, and providing the necessary technical support for the new generation of flexible automation.
[0033] By using the OPC UA server as the data middle platform, unified data communication is achieved between the digital twin environment and the actual controller or device, enabling rapid virtual debugging in the early stages of design and accelerating the automation implementation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0035] Figure 1 Schematic diagram of the scenario description file designed for the present invention;
[0036] Figure 2 A schematic diagram of a system for quickly building a digital twin scenario designed for the present invention;
[0037] Figure 3 The OPC UA data space construction process for the digital twin scenario designed by the present invention;
[0038] Figure 4 This is the running process of the digital twin scenario designed for the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0040] It should be noted that the descriptions of "first", "second", etc. in the present invention are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0041] Digital twin systems are playing an increasingly important role in the architecture of the next-generation Industrial Internet and industrial automation. Digital twins digitize and inform various industrial processes, forming a crucial cornerstone for achieving industrial intelligence. Based on this, this paper designs a system and method for rapidly constructing digital twin scenarios based on scenario description files, drawing on common technologies such as XML structured text, OPC UA communication, and a digital twin simulation engine.
[0042] A digital twin scene rapid construction system based on scene description files, including:
[0043] Description file parsing module, used to parse the scene description XML file and extract data model information, equipment and joint information, spatial position and assembly relationship information;
[0044] The device simulation model construction module constructs a device simulation model with unified attributes and methods based on the parsed device and joint information. The attributes include the device name, OPC UA node, joint instructions and status data list. The methods include initializing the device pose, reading and writing OPC UA data, executing simulation actions, and resetting the status.
[0045] The scenario simulation code integration module generates integrated code that can be run in the simulation engine based on the equipment simulation model and assembly relationship information;
[0046] Simulation engine, which provides visualization and 3D simulation environment and executes integrated code to drive virtual devices;
[0047] The OPC UA server, as a data hub, stores device joint instructions and status data nodes, enables communication between the simulation engine and the actual controller or physical device, and supports both virtual debugging and virtual-to-real modes.
[0048] like Figure 1 As shown in the figure, it is a structural diagram of the scene description XML file designed by the present invention, which describes the device information (Device) in the digital twin scene (DigitalTwinScene) and the assembly relationship (AssemblyRealtion) between devices.
[0049] The device information (Device) includes:
[0050] Device Type: Used for classification to establish a device library. The devices in the established device library can simplify the process when generating digital twin scenarios.
[0051] Device Name: serves as a unique identifier for each device instance.
[0052] 3D resource path (Asset3dPath): The path of the 3D resource corresponding to the device, used when loading the device 3D resource into the simulation engine.
[0053] Device Pose: The pose of the device base coordinate system relative to the simulation coordinate system, expressed by spatial position coordinates and quaternions.
[0054] Data Model: describes the simulation variable information of the device.
[0055] The data model specifically describes each joint variable of the device, and its attributes include:
[0056] Joint Name: corresponds to the joint name in the device's 3D resource.
[0057] Control variable name: (controlVarName): The variable node name registered in the OPCUA data space.
[0058] Joint Type: Joint type, divided into mobile joints and rotational joints.
[0059] Control variable type (ControlVarType): OPCUA data type, used to specify the data type when creating an OPCUA data node.
[0060] For the assembly relationship (AssemblyRealtion) between the devices, for each set of assembly relationships, it includes:
[0061] Assembly parent node (Parent): describes the assembly reference device information, including the reference device name and its assembly joints.
[0062] Assembly child node (Child): describes the information of the assembled device, including the name of the assembled device and its assembly joints.
[0063] Assembly offset (Transform): describes the position and posture offset between the joint coordinate system of the assembly reference device and the joint coordinate system of the assembled device, identified by three-dimensional coordinates and quaternions respectively.
[0064] like Figure 2 The following is a schematic diagram of a system designed by the present invention for rapidly constructing digital twin scenarios based on scenario description files. The input is the scenario description file, which includes a data model description, device joint descriptions, and spatial position and assembly relationship descriptions. The system includes a description file parsing module, a device simulation model construction module, a scenario simulation code integration module, a simulation engine, and an OPC UA server. The functions of each component are as follows:
[0065] Description file parsing module: Based on the grammatical rules of XML files, it implements semantic parsing of XML files. Parsing the scene description XML file obtains data model information for constructing OPCUA data space, device data and joint information, spatial position and assembly relationship information.
[0066] Device simulation model building module: builds a simulation model of a specific device according to the designed device simulation model based on the device data and joint information output by the description file parsing module.
[0067] Scenario code integration module: Based on the simulation models of each device constructed by the device simulation model construction module and the spatial position and assembly relationship analyzed and output by the description file parsing module, the code is integrated according to the designed simulation operation process to obtain code that can be run on the simulation engine.
[0068] Simulation engine: provides basic visualization and 3D simulation functions.
[0069] OPCUA server: As the data hub, it enables communication between the simulation program running on the simulation engine and the actual controller / device. By configuring the direction of the data flow, two simulation modes, virtual debugging and virtual-to-real simulation, can be implemented.
[0070] The process diagram of constructing the OPCUA data space is as follows: Figure 3 As shown, including:
[0071] Traverse the Device element in the scenario description XML file; create an Object node named DeviceName in the OPCUA data space; create two child nodes, JointInstruction and JointStatus, under the above Object node; traverse the Joint attributes under the DataModel element in the Device element; create a variable node under the JointInstruction node in the OPCUA data space, with the node name being Jointjointname, the node type being Joint.controlValType, and the initial value of the variable node being Joint.controlValDefaultValue; similarly, create a variable node under the Jointstatus node in the OPCUA data space. Click to create a variable node with the node name Jointjointname, node type Joint.controlValType, and the initial value of the variable node Joint.controlValDefaultValue. Repeat this cycle until all Device elements in the scene description XML file and the Joint attribute under the DataModel element of each Device element are traversed, thus completing the creation of the OPCUA data space. That is, for each Device, an Object node named DeviceName is created, which contains two child Object nodes, JointInstruction and JointStatus, which serve as the joint instruction data space and joint status data space of the Device respectively.
[0072] The device simulation model designed by the present invention, the model properties and model methods are shown in Table 1 and Table 2:
[0073] Table 1 Equipment simulation model attributes and descriptions
[0074]
[0075] Table 2 Equipment simulation model method and description
[0076]
[0077] Based on the device simulation model, a unified property and method model is constructed for device simulation. According to the result of parsing the scene description xml file by the description file parsing module, a specific device name (device_name), joint instruction data list (joint_instructions), and joint real-time status list (joint_status) are initialized for each. The OPCUA NodeId list (status_nodeids) corresponding to the joint instruction data space and the OPCUA NodeId list (initial_status) corresponding to the joint status data space are constructed through its device_name; for the method of the device model, the simulation engine's loading interface is called in the init method according to the device 3D resource path under the Device element in the scene description file to load the device 3D resource into the specific location of the simulation scene.
[0078] Based on the device simulation construction module and the description file parsing module, a unified attribute and method model is constructed for each device. Combined with the spatial position information and assembly relationship output by the description file parsing module, the scene simulation code integration module calls the method of the device simulation model of each device, as shown below. Figure 4 The process shown in the figure is used to integrate the simulation code, including:
[0079] ①Environment initialization:
[0080] Initialize the simulation engine environment, establish the OPCUA client, and connect to the OPCUA server
[0081] ②Device initialization:
[0082] For each device, call the init method of the device simulation model, pass in the POS information of each device in the scene description XML file, load the device 3D resource to the specific position of the simulation scene and complete the initialization of the model.
[0083] ③ Assembly relationship processing:
[0084] For the assembly relationship (AssemRelation) recorded in the scene description xml file, the assembly base coordinate system and the coordinate system to be assembled are determined according to the parent and child attributes recorded therein, and the binding between the assembly base coordinate system and the coordinate system to be assembled is completed according to the coordinate system pose offset recorded in the Transform attribute.
[0085] ④Simulation main loop:
[0086] For each device, call the read_joint_instructions() method of the device simulation model to read the device's joint instruction data from the data space of the OPCUA server to the joint_instructions attribute of the device simulation model; call the execute_action() method of the device simulation model to execute the joint action instructions in the simulation engine; call the get_joint_status() method, or the actual joint data in the device simulation environment is stored in the joint_status attribute; call the write_joint_status() method to write the actual joint data in the device simulation environment in joint_status to the corresponding data space of the OPCUA server.
[0087] Finally, the complete simulation code is run on the simulation engine, and the control of the virtual device on the simulation engine can be achieved by reading and writing the device joint instructions or status data in the data space of the OPC UA server.
[0088] Regarding the two simulation modes of virtual debugging and virtual-to-real:
[0089] Virtual debugging mode: When the actual controller is configured to write the control instruction data into the corresponding joint instruction data space of the OPCUA server and read the joint status value in the data space as reference information for the controller algorithm, the actual controller can control the virtual device in the virtual simulation environment and perform virtual debugging to verify the controller logic and algorithm.
[0090] Virtual-to-real model: When the joint status data of the actual physical device is written into the joint instruction data space of the OPCUA server, the real-time display of the operating status of the actual device by the virtual device in the virtual simulation environment can be achieved.
[0091] An embodiment of the present application provides a computer-readable storage medium, which stores program code. When the program code is executed by a processor, it implements the steps of the method for quickly constructing a digital twin scene based on a scene description file as described above.
[0092] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0093] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0094] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0095] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0096] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0097] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0098] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0099] The above description is merely an example of the present application and is not intended to limit the scope of protection of this application. Those skilled in the art will readily appreciate that this application is susceptible to various modifications and variations. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.
Claims
1. A digital twin scene rapid construction system based on scene description files, characterized by: include, Description file parsing module, used to parse the scene description XML file and extract data model information, equipment and joint information, spatial position and assembly relationship information; The device simulation model construction module constructs a device simulation model with unified attributes and methods based on the parsed device and joint information. The attributes include the device name, OPC UA node, joint instructions and status data list. The methods include initializing the device pose, reading and writing OPC UA data, executing simulation actions, and resetting the status. The scenario simulation code integration module generates integrated code that can be run in the simulation engine based on the equipment simulation model and assembly relationship information; Simulation engine, which provides visualization and 3D simulation environment and executes integrated code to drive virtual devices; The OPC UA server, as a data hub, stores device joint instructions and status data nodes, enables communication between the simulation engine and the actual controller or physical device, and supports both virtual debugging and virtual-to-real modes.
2. A digital twin scene rapid construction system based on scene description files according to claim 1, characterized in that: The device information includes the device type, unique name, 3D resource path, base coordinate system pose, and data model; the assembly relationship is used to define the parent-child assembly relationship and coordinate system offset between devices; the data model includes the variable name, type, OPC UA data type, and initial value of each joint.
3. A digital twin scene rapid construction system based on scene description files according to claim 1, characterized in that: The implementation process of the scenario simulation code integration module includes: Initialize the environment and connect the simulation engine to the OPC UA server; Initialize the device and call the init method of the device model to load the 3D resource to the specified location; Assembly relationship processing, binding the coordinate systems of parent and child devices according to the assembly relationship in XML; The simulation main loop reads OPC UA instructions, executes simulation actions, and updates joint status to the OPC UA server.
4. A method for rapidly constructing a digital twin scene based on a scene description file, characterized in that: The following steps are involved: Parse the scene description XML file to extract device information, data model and assembly relationship; Build a device simulation model based on device information and create corresponding instruction and status data nodes in the OPC UA server; Generate simulation code based on the device posture and assembly relationship and integrate it into the simulation engine; Communicate with external systems through the OPC UA server, drive virtual devices to perform actions and feedback status.
5. A method for rapidly constructing a digital twin scene based on a scene description file according to claim 4, characterized in that: The construction of the equipment simulation model is specifically as follows: Define the control variable name, type and initial value for each joint and associate it with the OPC UA node; Batch reading and writing of OPC UA data is achieved through the read_joint_instructions and write_joint_status methods.
6. A method for rapidly constructing a digital twin scene based on a scene description file according to claim 4, characterized in that: Extracting assembly relationships involves establishing dynamic binding relationships in the simulation engine based on the assembly joints and coordinate system offsets of the parent device and the child device.
7. The method for rapidly constructing a digital twin scene based on a scene description file according to claim 4 is characterized in that: The steps of executing the action of the simulation engine include: Call the read_joint_instructions() method of the device simulation model to read the device's joint instruction data from the data space of the OPCUA server to the joint_instructions attribute of the device simulation model; call the execute_action() method of the device simulation model to execute the joint action instructions in the simulation engine; call the get_joint_status() method, or the actual joint data in the device simulation environment is stored in the joint_status attribute; call the write_joint_status() method to write the actual joint data in the device simulation environment in joint_status to the corresponding data space of the OPCUA server.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores program code, and when the program code is executed by the processor, the steps of the method for quickly constructing a digital twin scene based on a scene description file as described in any one of claims 4 to 7 are implemented.