Twin entity behavior control method and device based on building block script

By introducing Blockly graphical programming interface and building block script technology into the twin entity control system, the problem of complex programming skills in the existing technology is solved, and the simplicity, efficient control and rapid development capabilities of twin entities are achieved.

CN119376718BActive Publication Date: 2025-03-28BEIJING TUXIAODOU ONLINE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411975467.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-03-28
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

The existing twin entity control methods require complex programming skills, high threshold, are not suitable for users with weak programming foundations, and are difficult to achieve rapid development and real-time interaction.

Method used

Using a block script-based method, by integrating the Blockly graphical programming interface on the Web-side scene editing interface, users can drag the block components to build the behavior logic of the twin entity, generate Blockly block scripts, and implement behavior control of the twin entity through the server-side execution of script code.

Benefits of technology

Reduces the requirements for programming capabilities, allowing users to quickly define the behavioral process of twin entities through simple clicks and drag operations, achieving simple and efficient control of twin entities, and supporting rapid development and real-time interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376718B_ABST
    Figure CN119376718B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for controlling the behavior of twin entities based on building block scripts, and relates to the field of computing software and system technology. The method includes: creating a digital twin scene based on the front end, and selecting a twin entity; dragging building block components to construct the behavior logic of the twin entity, and generating a building block script; mapping the building block script to a script code; executing the script code on the back end, obtaining an instruction data set, and sending the instruction to the corresponding twin entity to control the behavior of the twin entity, and rendering the behavior process of the twin entity in real time. The present application allows users to quickly define the behavior of twin entities by simply clicking and dragging operations, which effectively solves the technical problems that the behavior control process of traditional twin entities requires strong programming capabilities, a slow development process, and cannot achieve real-time interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computing software and system technology, and in particular to a twin entity behavior control method and device based on building block scripts. Background Art

[0002] Digital twins, also known as digital twins, are virtual models of physical objects. They are the comprehensive use of information technologies such as perception, computing, and modeling, and are defined by software to describe, diagnose, predict, and make decisions on physical space, thereby achieving interactive mapping between physical space and virtual space.

[0003] Digital twin technology collects real-time data of physical objects through sensors and maps it into its digital model, thus providing data support for product development, production and maintenance. Script data-driven twin entity behavior technology is a technology that uses scripting language and data-driven models to imitate the behavior of real-world physical entities, and is a specific application of digital twin technology.

[0004] With the development of digital twin technology, higher requirements are placed on the behavior control of twin entities. Existing twin entity control methods usually require complex programming skills. Currently, the market mostly uses Python, JavaScript, C++ and third-party libraries to complete script programming, and uses visualization tools such as Unity3D, Web3D, Tableau, etc. to present the results. However, this process has a high threshold and is not suitable for users with weak programming foundation. The traditional behavior control method of twin entities is not conducive to rapid development and real-time interaction. Therefore, a simple and efficient twin entity behavior control method and system is needed. Summary of the invention

[0005] The embodiments of the present application provide a twin entity behavior control method and device based on building block scripts, which solves the technical problem that the twin entity control method in the prior art usually requires strong programming capabilities and is difficult to quickly develop and interact in real time. It realizes the construction of twin entity behavior in the form of dragging building blocks, making the control method of twin entities simpler and more efficient.

[0006] In the first aspect, an embodiment of the present application provides a twin entity behavior control method based on building block scripts, including: integrating the Blockly graphical programming interface in the Web-side scene editing interface, creating a digital twin scene, and selecting a twin entity therein; generating a Blockly building block script in response to the behavior logic of the twin entity constructed by the user dragging the building block components in the Blockly graphical programming interface; mapping the Blockly building block script to script code through the Blockly graphical programming interface; obtaining an instruction data set by executing the script code on the server side; distributing the instructions in the instruction data set to the corresponding twin entity for execution, and performing real-time rendering to achieve behavior control of the twin entity.

[0007] In combination with the first aspect, in a possible implementation method, before the Blockly graphical programming interface is integrated into the Web-side scene editing interface, it also includes: starting the pixel stream signaling server and starting the instruction information server to build a Web-side scene editing interface; deploying and configuring the pixel stream signaling server and the executable program, and deploying the instruction information server between the rendering end and the executable program; starting the pixel stream signaling server and the instruction information server, and creating a visual editing scene in the Web-side scene editing interface; creating a visual editing scene in the Web-side scene editing interface includes: the instruction information server starts instance batch processing in response to the request of the Web-side scene editing interface to start the pixel instance, obtains the instance port number, and returns the instance port number to the Web-side scene editing interface; the Web-side scene editing interface requests the pixel stream signaling server to display the pixel instance on the rendering end based on the instance port number.

[0008] In combination with the first aspect, in a second possible implementation method, the creation of a digital twin scene includes: obtaining the spatial attributes and basic environmental attributes of the twin entity; constructing multiple initial digital twin scenes based on the spatial attributes and basic environmental attributes, and publishing them; in response to a user's selection operation, determining and loading the digital twin scene in the multiple initial digital twin scenes.

[0009] In combination with the first aspect, in a third possible implementation method, before generating the Blockly building block script, it also includes: defining the visual appearance, functional behavior and execution logic between the functional behaviors of the Blockly building block script in the Blockly graphical programming interface; registering the visual appearance, functional behavior and execution logic in the building block component of the Blockly graphical programming interface.

[0010] In combination with the first aspect, in a fourth possible implementation method, the obtaining of an instruction data set by executing the script code on the server side includes: embedding a function library and global variables in the script code to obtain a complete script code; obtaining script instruction data by executing the complete script code on the server side; converting the script instruction data into instructions in Json format to form an instruction data set, and sending the instruction data set to the rendering side.

[0011] In combination with the fourth possible implementation method of the first aspect, in a fifth possible implementation method, after obtaining the instruction data set by executing the script code on the server side, it also includes: storing the complete script code in a database and assigning a scene identification ID to it; in response to the request of the rendering side, when the server side completes the scene rendering, the server side executes the stored scene identification ID to trigger interaction and / or dynamic presentation within the scene.

[0012] In combination with the fifth possible implementation method of the first aspect, in a sixth possible implementation method, the method of obtaining an instruction data set by executing the script code on the server side also includes: when the server side receives the script code, retrieving the corresponding complete script code in the database using the scene identification ID; obtaining script instruction data by executing the complete script code on the server side; converting the script instruction data into instructions in Json format to form an instruction data set, and sending the instruction data set to the rendering side.

[0013] In combination with the first aspect, in the seventh possible implementation method, the instructions in the instruction data set are distributed to the corresponding twin entities for execution and real-time rendering, including: the rendering end parses the received instruction data set and distributes the parsed instructions to the corresponding twin entities; the twin entity determines the behavior to be executed through the header information of the distributed instructions, quantifies the behavior to be executed through the numerical information of the instructions, and renders it in real time in the window of the rendering end.

[0014] In combination with the seventh possible implementation method of the first aspect, in an eighth possible implementation method, the instructions in the instruction data set are distributed to the corresponding twin entities for execution and real-time rendering, and also include: if the instructions received by the twin entity include a sub-script event, the sub-script event is stored; when the sub-script event is triggered, the sub-script event is executed by the server to obtain a sub-script instruction data set; the sub-script instructions in the sub-script instruction data set are distributed to the corresponding twin entities for execution, and real-time rendering is performed.

[0015] On the second aspect, an embodiment of the present application provides a twin entity behavior control device based on building block scripts, including: a Web-side scene editing interface, used to integrate the Blockly graphical programming interface, create a digital twin scene, and select a twin entity in the digital twin scene; a Blockly graphical programming interface, used to respond to user instructions to drag the behavior logic of the twin entity constructed by building block components, and generate a Blockly building block script; a back-end execution module, used to map the Blockly building block script into a script code and build an execution environment; a server side, used to execute the script code to obtain an instruction data set; an executable program, used to execute the corresponding twin entity behavior control based on the instructions in the instruction data set, and perform real-time rendering.

[0016] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:

[0017] The embodiment of the present application adopts Blockly graphical programming, which allows users to quickly define the behavior process of twin entities by simply clicking and dragging, which is more friendly to people with weak programming skills. By utilizing the Unreal Engine with powerful rendering technology and support for diverse GIS data, the technical effect of highly realistic scene simulation can be achieved. Through the pixel stream service, the rendered images are efficiently displayed on the Web, thereby further optimizing the user experience. It effectively solves the technical problems that the behavior control process of traditional twin entities requires strong programming skills, the development process is slow, and real-time interaction cannot be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 A flowchart of a twin entity behavior control method based on a building block script provided in an embodiment of the present application;

[0020] Figure 2 A detailed flow chart of twin entity behavior control based on building block scripts provided in an embodiment of the present application;

[0021] Figure 3 A flowchart of script execution and processing of a twin entity behavior control system based on a building block script provided in an embodiment of the present application;

[0022] Figure 4It is a Blockly building block script optimization twin entity behavior control composition diagram provided in an embodiment of the present application;

[0023] Figure 5 A structural diagram of a twin entity behavior control device based on building block scripts provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] Figure 1 A flowchart of a twin entity behavior control method based on a building block script provided in an embodiment of the present application, such as Figure 1 As shown, the method includes steps 101 to 105.

[0026] Figure 2 A detailed flowchart of the twin entity behavior control based on the building block script provided in the embodiment of the present application. The embodiment of the present application can be based on Figure 2 right Figure 1 A more detailed explanation of the process is provided.

[0027] Before implementing the twin entity behavior control method, it is necessary to deploy and configure a pixel stream signaling server and an executable program. For example, in the embodiment of the present application, a UE (Unreal Engine, a real-time 3D creation tool) executable program is selected as an executable program for executing the behavior control of the corresponding twin entity based on the instructions in the instruction data set.

[0028] After deploying and configuring the pixel stream signaling server and executable program, you also need to deploy the command information server between the rendering end and the executable program. The command information server has a similar function to that of a relay, mainly to establish special data exchange between the rendering end and the executable program through monitoring and request.

[0029] When all servers are deployed, start the pixel stream signaling server and command information server, and create a visual editing scene in the Web scene editing interface.

[0030] Exemplarily, creating a visual editing scene includes:

[0031] After entering the scene creation interface, create a visual editing scene. When the scene editing is opened, the rendering end will send a request to start the pixel stream instance to the command information server. The command information server responds to the request to start the pixel instance, calls the server-side to start the instance batch, obtains the instance port number, and returns the instance port number to the Web-side scene editing interface.

[0032] The Web-side scene editing interface requests the pixel stream signaling server to display the pixel instance on the rendering end based on the instance port number.

[0033] Step 101: Integrate the Blockly graphical programming interface into the Web-based scene editing interface, create a digital twin scene, and select the twin entity in it.

[0034] It should be noted that Blockly is a graphical programming language. Through the construction of fully visual code blocks, a full-featured code editor can be built. The editor focuses on the core concepts in programming, such as variable definition, logical operations, and loop control. Users can build programs by dragging these graphic blocks without writing code, which greatly reduces the user's attention to syntax details when programming and lowers the programming threshold.

[0035] In the embodiment of the present application, the Web-side scene editing interface is based on the Vue framework and integrates Blockly (version 10.3.0) to customize and develop an efficient Blockly graphical programming interface. The Blockly graphical programming interface has a series of commonly used functional building blocks built in, and they are finely classified so that users can quickly locate and select them. Users can simply drag the required building blocks to the visual editing area to complete the script editing.

[0036] Specifically, the creation of digital twin scenarios includes:

[0037] Based on the twin entity model data, digital earth data, script data and object storage data in the database, the spatial attributes such as type, position, rotation and scale of the twin entity and the basic environmental attributes such as scene time and weather are obtained.

[0038] Multiple initial digital twin scenes are constructed based on spatial attributes and basic environmental attributes, and are published to generate element information of the initial digital twin scenes. It should be noted that these element information also need to be stored in Json format.

[0039] In response to a selection operation by the user, a digital twin scene is determined and loaded from a plurality of initial digital twin scenes.

[0040] In an embodiment of the present application, the data structure of the element information of the initial digital twin scene is shown in Table 1.

[0041] Table 1

[0042]

[0043] Among them, Int represents a signed type, that is, the value of the Int type must be an integer; the String type is a template class, and its instantiation is an object, which can also be understood as an operable string class.

[0044] After publishing the initial digital twin scene, enter the Web-side scene editing interface again. After obtaining the pixel stream port number, the Web-side scene editing interface requests the pixel stream signaling server to send the specified instance video stream to the rendering end for display.

[0045] In the initialization of the digital twin scene, the spatial properties and basic environmental properties of the twin entity generated by the initial digital twin scene are read to complete the construction of the digital twin scene. When the digital twin scene generation is initialized, the created twin entity object is stored in the mapping container to facilitate the management and calling of the twin entity in the digital twin scene.

[0046] Step 102: In response to the behavior logic of the twin entity constructed by the user dragging the building block components in the Blockly graphical programming interface, a Blockly building block script is generated.

[0047] It should be noted that if Figure 4 As shown, before generating the Blockly building block script, it also includes:

[0048] Define the blocks of the Blockly script: define the block properties such as the visual appearance of the Blockly script, the block behaviors such as the functional behaviors, and the execution logic between the functional behaviors in the Blockly graphical programming interface.

[0049] The visual appearance and functional behavior include label text, color scheme, input fields and connection points. In the embodiment of the present application, Json objects are selected for block definition in order to simplify the localization work in the process of multilingual application development.

[0050] Register visual appearance, functional behavior, and execution logic to building blocks in the Blockly graphical programming interface.

[0051] Step 103: Map the Blockly block script to script code through the Blockly graphical programming interface.

[0052] For example, in the Blockly graphical programming interface, after obtaining the Blockly block script obtained by the block building operation, it is also necessary to convert the Blockly block script obtained on the rendering end into executable script code through Blockly's API (Application Programming Interface) at the underlying logic. It should be noted that the script code is in the form of JavaScript.

[0053] When the user completes editing the block script, the Blockly graphical programming interface will automatically generate the corresponding behavior function body that can be used to control the behavior of the specified object according to the combination rules of the Blockly block script, and generate script code in JavaScript form by connecting the behavior logic of the Blockly block script.

[0054] When the script code is obtained, the script code and the Blockly script need to be stored at the same time. Specifically, the Blockly script needs to be converted into XML format and stored, so that it is convenient for users to edit and use it repeatedly. It should be noted that the process of converting to XML format can be directly implemented by using the workspaceToDom function and domToText function provided by the internal API of the Blockly graphical programming interface.

[0055] Step 104: Execute the script code on the server side to obtain the instruction data set.

[0056] Exemplarily, it includes:

[0057] Through the workspaceToCode function provided by the Blockly graphical programming interface, the behavior logic built by the user by dragging the building blocks is converted into a script code snippet, and the function library and global variables are embedded in the script code snippet to obtain the complete script code. The complete script code is submitted to the Java backend system via the HTTP protocol, which in turn stores the complete script code in the database and assigns it a scene identification ID.

[0058] When the server receives the script code, it uses the scene identification ID to retrieve the corresponding complete script code in the database.

[0059] The script instruction data is obtained by executing the complete script code on the server side.

[0060] Convert script instruction data into instructions in Json format to form an instruction data set, and send the instruction data set to the rendering end.

[0061] In response to the request of the rendering end, when the server end completes the scene rendering, the server end executes the stored scene identification ID to trigger the interaction and / or dynamic presentation within the scene.

[0062] Step 105: Distribute the instructions in the instruction data set to the corresponding twin entity for execution, and perform real-time rendering to achieve behavior control of the twin entity.

[0063] Specifically, step 105 includes:

[0064] The rendering end parses the received instruction data set and distributes the parsed instructions to the corresponding twin entities.

[0065] During the rendering phase of the digital twin scene, the rendering application will periodically send requests to the server to monitor the rendering status of the twin. Once the server notifies that the digital twin scene has been rendered, the rendering end immediately requests the server to execute the complete script code marked by the corresponding scene identification ID previously stored through the HTTP protocol, thereby triggering the interaction and / or dynamic display within the digital twin scene. The automation and precision of this process provides an efficient and coherent user experience for software operations, and promotes the functionality and operability of twin projects in practical applications.

[0066] It should be noted that in step 105, the built-in Nashorn script engine is selected as the virtual processing engine. The Nashorn script engine is a tool for efficiently executing script codes, which can achieve seamless integration of JavaScript script codes and Java codes and interactive operations between the two. This technology allows JavaScript functions to be called directly in the Java environment, and enables JavaScript functions to access Java class libraries and objects, building a bridge connecting modern Web technologies and Java applications.

[0067] Based on the high performance and flexibility of the Nashorn script engine, this embodiment of the application selects it as the script execution engine. Once the Java backend receives the execution script code instruction from the rendering end, it uses the scene identification ID to retrieve the JavaScript script code pre-stored in the database. Then, the Nashorn script engine is used to execute these script codes, and the generated twin operation commands are sent to the server through the HTTP protocol. The server distributes these instructions to the corresponding digital twin scenes to achieve precise scene interaction and control.

[0068] The twin entity determines the behavior to be executed through the header information of the distributed instructions, quantifies the behavior to be executed through the numerical information of the instructions, and renders it in real time in the window of the rendering end.

[0069] Exemplarily, the behavior of the twin entity is a pre-packaged behavior function, which has spatial attribute modification and physical attribute modification. When the twin entity in the digital twin scene receives the corresponding instruction, the corresponding instruction is parsed by Json. The behavior to be performed by the twin entity is judged by the header information of the corresponding instruction, and the specific degree of the behavior is quantified by the numerical information value of the corresponding instruction. Finally, the behavior of the twin entity is driven by the script code data and rendered on the rendering end through the pixel flow technology of the Nashorn script engine.

[0070] If the instruction received by the twin entity contains a sub-script event, the sub-script event data is stored in the database.

[0071] When the sub-script event is triggered, the sub-script event is executed on the server side to obtain the sub-script instruction data set.

[0072] The sub-script instructions in the sub-script instruction dataset are distributed to the corresponding twin entities for execution and real-time rendering.

[0073] Specifically, sub-script events include trigger-type scripts, such as key trigger, twin entity click trigger, etc. For such trigger-type sub-script events, there will be a collection container in the twin entity class, which is specifically used to store the content of such sub-script instructions. When the user triggers the condition, the content of the sub-script instruction will be executed.

[0074] Figure 3 The flowchart of script execution and processing of the twin entity behavior control system based on the building block script provided in the embodiment of the present application, the script processing process on the server side is as follows Figure 3 shown.

[0075] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in this embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in sequence or in parallel according to the method shown in this embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment).

[0076] Figure 5 A structural diagram of a twin entity behavior control device 500 based on a building block script provided in an embodiment of the present application, such as Figure 5 As shown, the device specifically includes:

[0077] The web-side scene editing interface 501 is used to integrate the Blockly graphical programming interface 502, create a digital twin scene, and select a twin entity in the digital twin scene.

[0078] The Blockly graphical programming interface 502 is used to generate a Blockly block script by responding to user instructions to drag the behavior logic of the twin entity constructed by the building block components.

[0079] The backend execution module 503 is used to map the Blockly building block script into script code and build an execution environment.

[0080] The server side 504 is used to execute the script code and obtain the instruction data set.

[0081] The executable program 505 is used to execute the behavior control of the corresponding twin entity based on the instructions in the instruction data set and perform real-time rendering.

[0082] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0083] Exemplarily, the rendering end and the executable program are communicated with each other via the instruction information server.

[0084] The executable program accesses the instruction information server through the POST protocol request in HTTP, which is used to push instructions and obtain the results of instruction operations. The instruction information server establishes a stable Socket interface (Socket is the middleware abstraction layer for communication between the application layer and the TCP / IP protocol family) to communicate with the executable program in real time, which is convenient for handling operations such as reconnection and disconnection, releasing the pixel stream port, and closing the program. At the same time, the Socket interface can also handle the script data transmission of multiple rendering end instances well, making the communication faster. The format of the transmitted data content is Json format.

[0085] Figure 4 : is a composition diagram of the Blockly building block script optimized twin entity behavior control provided in the embodiment of the present application. Figure 4 As shown, a twin entity behavior control system based on building block scripts provided in an embodiment of the present application mainly includes two aspects: Blockly graphical script editing and Blockly graphical script data processing and digital drive.

[0086] Specifically, Blockly graphical script editing includes the creation of visual editing scenes and graphical programming of Blockly building block scripts.

[0087] Blockly graphical script data processing and digital drive include script data processing, instruction information distribution, script code execution and twin entity behavior rendering based on scripts of graphical programming results.

[0088] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.

[0089] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist independently, or two or more modules may be integrated into one module.

[0090] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of the present application can be essentially or partly reflected in the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0091] The above storage media include but are not limited to random access memory (RAM), read-only memory (ROM), cache, hard disk drive (HDD) or memory card. The memory can be used to store computer program instructions.

[0092] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0093] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.

Claims

1. A twin entity behavior control method based on building block scripts, characterized in that: include: Integrate the Blockly graphical programming interface into the Web-based scene editing interface to create a digital twin scene and select the twin entity in it; In response to the behavior logic of the twin entity constructed by the user dragging the building block components in the Blockly graphical programming interface, generating a Blockly building block script; Mapping the Blockly building block script into script code through the Blockly graphical programming interface; Executing the script code on the server side to obtain an instruction data set; The rendering end parses the received instruction data set and distributes the parsed instruction data to the corresponding twin entity; The twin entity determines the behavior to be executed through the header information of the distributed instruction data, quantifies the behavior to be executed through the numerical information of the instruction data, and renders it in real time in the window of the rendering end to realize the behavior control of the twin entity.

2. The method according to claim 1, characterized in that: Before integrating the Blockly graphical programming interface into the Web-side scene editing interface, the method further includes: Start the pixel stream signaling server and the command information server, and build the Web-side scene editing interface; Deploy and configure the pixel stream signaling server and the executable program, and deploy the instruction information server between the rendering end and the executable program; Starting the pixel stream signaling server and the instruction information server, and creating a visual editing scene in the Web-side scene editing interface; The creating of a visual editing scene in the Web-side scene editing interface includes: The instruction information server starts instance batch processing in response to the request of starting pixel instance in the Web-side scene editing interface, obtains the instance port number, and returns the instance port number to the Web-side scene editing interface; The Web-side scene editing interface requests the pixel stream signaling server to display the pixel instance on the rendering end based on the instance port number.

3. The method according to claim 1, characterized in that The creation of the digital twin scenario includes: Obtaining the spatial attributes and basic environmental attributes of the twin entity; Constructing a plurality of initial digital twin scenes according to the spatial attributes and the basic environment attributes, and publishing them; In response to a selection operation by the user, the digital twin scene is determined and loaded from a plurality of initial digital twin scenes.

4. The method according to claim 1, characterized in that: Before generating the Blockly building block script, the following steps are also included: Defining the visual appearance, functional behaviors, and execution logic between the Blockly building block script in the Blockly graphical programming interface; The visual appearance, the functional behavior and the execution logic are registered into a building block component of the Blockly graphical programming interface.

5. The method according to claim 1, characterized in that: The step of executing the script code on the server side to obtain the instruction data set includes: Embedding function libraries and global variables in the script code to obtain a complete script code; Executing the complete script code on the server side to obtain script instruction data; The script instruction data is converted into instructions in Json format to form an instruction data set, and the instruction data set is sent to the rendering end.

6. The method according to claim 5, characterized in that After the script code is executed on the server side to obtain the instruction data set, the method further includes: The complete script code is stored in a database and a scene identification ID is assigned to it; In response to the request of the rendering end, when the server end completes the scene rendering, the server end executes the stored scene identification ID to trigger the interaction and / or dynamic presentation within the scene.

7. The method according to claim 6, characterized in that The step of obtaining the instruction data set by executing the script code on the server side also includes: When the server receives the script code, it uses the scene identification ID to retrieve the corresponding complete script code in the database; Executing the complete script code on the server side to obtain script instruction data; The script instruction data is converted into instructions in Json format to form an instruction data set, and the instruction data set is sent to the rendering end.

8. The method according to claim 1, characterized in that The real-time rendering in the window of the rendering end also includes: If the instruction received by the twin entity includes a sub-script event, storing the sub-script event; When the sub-script event is triggered, the sub-script event is executed by the server to obtain a sub-script instruction data set; The sub-script instructions in the sub-script instruction data set are distributed to the corresponding twin entities for execution and real-time rendering is performed.

9. A twin entity behavior control device based on building block script, characterized in that: include: A web-based scene editing interface, which is used to integrate the Blockly graphical programming interface, create a digital twin scene, and select a twin entity in the digital twin scene; The Blockly graphical programming interface is used to generate Blockly block scripts in response to user instructions to drag the behavior logic of the twin entity constructed by the block components; A backend execution module, used to map the Blockly script into script code and build an execution environment; The server side is used to execute the script code to obtain the instruction data set; The rendering end is used to perform data parsing based on the instructions in the instruction data set, and distribute the parsed instruction data to the corresponding twin entity, so that the twin entity determines the behavior to be executed according to the header information of the distributed instruction data, and quantifies the behavior to be executed based on the numerical information of the instruction data, and executes the corresponding behavior control of the twin entity for real-time rendering.

Citation Information

Patent Citations

  • Blockly and Raspberry Pi-based online graphical programming system and usage method thereof

    CN110362299A

  • Multi-concurrent execution method for digital twin industry cloud rendering service

    CN115914338A

  • Low-code digital twinning scene interactive configuration method and system

    CN117667055A