Simulation processing method and device, equipment and medium
By using browser front-end multi-threading isolation technology, simulation models are built and executed on the browser side, solving the problem of balancing convenience, real-time interactivity and data security in industrial simulation, and realizing an efficient and secure simulation system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- RUANTONG TIANSHU INTELLIGENT (NANJING) TECHNOLOGY CO LTD
- Filing Date
- 2026-04-20
- Publication Date
- 2026-07-21
AI Technical Summary
Existing industrial system simulation technologies struggle to balance ease of use, real-time interactivity, and data security. Desktop simulation software suffers from platform dependency and high deployment and maintenance costs, while browser-based cloud simulations are plagued by high latency and data security risks.
Employing browser front-end multi-threading isolation technology, the simulation scene data is acquired in the first thread and the simulation model is built in the second thread. The simulation calculation is executed in the browser background using the first simulation processing container, independent of the visualization interface, to achieve efficient simulation modeling and real-time result display.
It achieves lightweight, high real-time, and low-latency industrial system simulation, improves the versatility, real-time performance, and data security of the simulation system, reduces system deployment and maintenance costs, and reduces network transmission latency and data leakage risks.
Smart Images

Figure CN122431912A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer simulation technology, and in particular to a simulation processing method, apparatus, device, and medium. Background Technology
[0002] Industrial system simulation has been widely used in scenarios such as factory production line planning and logistics scheduling, and plays an important role in improving the efficiency of industrial system design and verification.
[0003] Currently, mainstream industrial system simulations are mainly divided into two categories: desktop simulation software and browser-based cloud simulation. Desktop simulation software requires the deployment of a local client on a high-performance workstation, relying on local hardware to complete modeling and simulation calculations. Although it has strong computing power, it suffers from platform dependency, high deployment and maintenance costs, and difficulty in cross-terminal use and collaborative operation. Browser-based cloud simulations mostly adopt an architecture of backend cloud computing and frontend browser display. The simulation engine runs on a remote server, and the browser is only responsible for interface display and command issuance. Because simulation calculations and frontend interaction are separated, parameter adjustments require round-trip transmission over the network, resulting in high interaction latency and difficulty in achieving real-time feedback. In addition, the simulation process is concentrated in remote execution, making it impossible to efficiently execute high-frequency discrete event scheduling in a browser environment. Furthermore, cloud computing poses data security risks due to the uploading of core data, making it difficult to achieve efficient and stable execution of simulation calculations. Summary of the Invention
[0004] This invention provides a simulation processing method, apparatus, equipment, and medium to solve the problem of balancing ease of use, real-time interactivity, and data security in industrial simulation.
[0005] According to one aspect of the present invention, a simulation processing method is provided, comprising:
[0006] Acquire the first data, which is the data sent by the first thread. The first data is used to indicate the topology of the scene to be simulated, as well as the parameter information associated with each node in the topology. The first thread is the thread used to run the browser visualization interface.
[0007] Based on the first data, a first model is constructed through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for constructing the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a background execution thread of the browser;
[0008] In response to the first instruction, the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction used to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps.
[0009] The first thread acquires simulation event information and renders and displays it in the browser's visualization interface based on that information.
[0010] According to another aspect of the present invention, a simulation processing apparatus is provided, comprising:
[0011] The data acquisition module is used to acquire first data, which is data sent by the first thread. The first data is used to indicate the topology of the simulation scene and the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface.
[0012] The model building module is used to build a first model based on the first data through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for building the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a browser background execution thread;
[0013] The simulation calculation module is used to respond to a first instruction, wherein the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps.
[0014] The rendering and display module is used by the first thread to obtain the simulation event information and render and display it in the browser visualization interface based on the simulation event information.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] At least one processor; and
[0017] A memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the simulation processing method described in any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the simulation processing method described in any embodiment of the present invention.
[0020] According to another aspect of this application, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the simulation processing method described in any embodiment of this application.
[0021] The technical solution of this invention, by acquiring the first data sent by the first thread, can accurately and timely obtain the topology and node parameter information of the scene to be simulated; by constructing the simulation model using the first simulation processing container in a second thread isolated from the first thread, the simulation model construction process can be completed on the browser side and run independently of the browser's visual interface, avoiding the simulation modeling operation from occupying interface rendering resources and preventing interface lag; at the same time, simulation modeling by running the first simulation processing container in the second thread can get rid of the dependence on dedicated workstations and local clients, reducing system deployment and maintenance costs, thereby supporting cross-terminal use; by executing simulation calculations directly in the browser's background thread through the first simulation processing container, without relying on remote cloud servers, the network transmission latency of instructions and data can be reduced, thereby achieving high-frequency and efficient event scheduling; in addition, core simulation data does not need to be uploaded to the external network, which can reduce the risk of data leakage and improve the security and stability of the simulation system; the first thread acquires simulation event information and renders it in real time on the browser's visual interface, enabling interaction between simulation calculation results and front-end display, improving the real-time performance and intuitiveness of the simulation process. Based on the above technical solution, by leveraging the multi-threaded isolation feature of the browser front-end, the simulation model is constructed and executed using a simulation processing container on the browser side, and the simulation results are displayed in real time. This solves the problem of balancing ease of use, real-time interactivity, and data security in industrial simulation, achieving lightweight, high real-time performance, and low latency industrial system simulation. It improves the versatility, real-time performance, and data security of the simulation system, and enhances the overall execution efficiency and engineering application capabilities of industrial system simulation.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of a simulation processing method provided according to an embodiment of the present invention;
[0025] Figure 2 This is a timing diagram of simulation algorithm package mounting and simulation kernel assembly provided according to an embodiment of the present invention;
[0026] Figure 3 This is a flowchart of another simulation processing method provided according to an embodiment of the present invention;
[0027] Figure 4 This is a logical schematic diagram of the simulation model construction process provided in the embodiments of the present invention;
[0028] Figure 5 This is a flowchart of another simulation processing method provided according to an embodiment of the present invention;
[0029] Figure 6 This is a simulation processing container dynamic loading and runtime sequence diagram provided according to an embodiment of the present invention;
[0030] Figure 7 This is a flowchart of another simulation processing method provided according to an embodiment of the present invention;
[0031] Figure 8 This is a timing diagram of the asynchronous collaborative rendering of simulation events by the simulation kernel and the front-end rendering thread according to an embodiment of the present invention.
[0032] Figure 9 This is a logical schematic diagram of the simulation processing method provided according to an embodiment of the present invention;
[0033] Figure 10 This is a schematic diagram of the structure of a simulation processing device according to an embodiment of the present invention;
[0034] Figure 11 This is a schematic diagram of the structure of an electronic device that implements the simulation processing method of the present invention. Detailed Implementation
[0035] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0036] It should be noted that the terms "candidate," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0037] Figure 1 This is a flowchart illustrating a simulation processing method provided in an embodiment of the present invention. This embodiment is applicable to situations where various industrial system simulations are implemented on a browser-based platform. The method can be executed by a simulation processing device, which can be implemented in hardware and / or software and can be configured in any electronic device with network communication capabilities. Figure 1 As shown, an embodiment of the present invention provides a simulation processing method that may include:
[0038] S110. Obtain first data. The first data is data sent by the first thread. The first data is used to indicate the topology of the simulation scene and the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface.
[0039] The first data is data sent by the first thread that supports cross-thread transmission. This first data indicates the topology of the scenario to be simulated, as well as the parameter information associated with each node in the topology. The topology of the scenario to be simulated refers to the set of nodes in the topology of the scenario to be simulated, and the set of edges used to represent the connection relationships between the nodes. The first data contains record information for all nodes in the scenario to be simulated. The record information for each node may include node identifier, node type, successor node relationship, and the parameter information associated with that node. The parameter information associated with the node may include node attribute parameters, process time parameters, fault parameters, output strategy parameters, etc.
[0040] Optionally, the first thread acquires third data; wherein the third data is the topology map of the simulation scene displayed in the browser's visual interface, and the parameter information configured for each node in the topology map; the first thread encapsulates the third data into first data to achieve cross-thread transmission of the simulation scene information. In this embodiment, the browser's visual interface is an interactive interface, and the topology map of the simulation scene can be constructed through interactive operations such as clicking and dragging components, and the parameter information configured for each node in the topology map can also be configured through interactive operations such as input and clicking.
[0041] The system acquires the first data sent by the first thread to complete the collection of scene information required for simulation modeling, ensuring the consistency between simulation input information and visualized scene information. Transmitting the scene information to be simulated only through cross-thread transmission can reduce data transmission latency and avoid the risk of leakage of sensitive scene information due to network transmission, thereby improving data security.
[0042] S120. Based on the first data, a first model is constructed through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for constructing the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a background execution thread of the browser.
[0043] The first simulation processing container runs on the second thread, providing an independent runtime environment for simulation model construction and execution. Since the second thread is isolated from the first thread, running the first simulation processing container within the second thread, and performing simulation model construction and execution within it, will not block the first thread. Furthermore, the first simulation processing container running on the second thread can be a heterogeneous computing container, forming a heterogeneous architecture with the browser visualization interface in the first thread. A more efficient programming language can be used within the first simulation processing container to meet the demands of high-efficiency simulation processing. Therefore, by using the first simulation processing container running on the second thread, simulation processing can be implemented on the browser side while avoiding lag in the browser visualization interface of the first thread. For example, JavaScript is used to implement the visualization interface rendering and interaction logic in the first thread; Python is used to implement the simulation processing logic within the first simulation processing container running on the second thread.
[0044] A simulation kernel can refer to the execution entity that performs simulation calculations on a simulation model. In this embodiment, the simulation kernel can be deployed in a first simulation processing container to enable the first simulation processing container to perform simulation calculations on the simulation model. Simulation calculation can refer to the process by which the simulation kernel performs calculations on the simulation model to obtain simulation results.
[0045] The first simulation processing container parses the first data. Based on the topology of the scene to be simulated and the parameter information associated with each node in the topology indicated in the first data, it instantiates each node in the scene to be simulated into an object executable by the simulation kernel, and clarifies the connection relationships between the objects, thereby constructing a first model that can be executed by the simulation kernel and can describe the scene to be simulated. Using the first simulation processing container to construct the simulation model can ensure the independence and stability of the simulation model construction process. By decoupling the browser visualization interface from the simulation model construction through thread isolation, it can avoid mutual interference between the interface thread and the background construction thread, thereby improving the reliability of system operation.
[0046] As an optional but not limited implementation, the first simulation processing container can be constructed in the following way:
[0047] Create a second thread, which will be used to run the first simulation processing container;
[0048] Start the second thread, initialize the second simulation processing container to obtain the first simulation processing container. The first simulation processing container has a runtime environment that supports the assembly and operation of the simulation kernel, and the first simulation processing container has the ability to interact with the first thread across threads.
[0049] A virtual file system is built in the runtime memory of the second thread. This virtual file system is used to cache and manage algorithm package files.
[0050] In response to the second instruction, at least one simulation algorithm package is obtained from the server or other content distribution node, the obtained simulation algorithm package is cached and mounted to the virtual file system, and the second instruction is an instruction initiated by the first thread to indicate the initialization of the simulation environment;
[0051] Based on the simulation algorithm package mounted in the virtual file system, the corresponding simulation kernel is assembled in the first simulation processing container;
[0052] Configure multiple first interfaces of the first simulation processing container, the first interface being used to receive instructions from the first thread.
[0053] The second thread can refer to a browser background execution thread used to host the execution of the first simulation processing container. The second thread is isolated from and runs in parallel with the first thread, using asynchronous message communication to ensure that the rendering and interaction of the browser's visual interface in the first thread are not blocked while simulation processing is being performed in the second thread. For example, this embodiment uses Web Worker to implement the creation and execution of the second thread.
[0054] The second simulation processing container can refer to the initial simulation processing container that has not yet completed its initialization configuration. It is a container object created in the second thread, providing an independent runtime environment only within the second thread, and its independent runtime environment initialization configuration has not yet been completed. After the second thread starts, the second simulation processing container is initialized to obtain the first simulation processing container. This gives the first simulation processing container the runtime environment to support the assembly and operation of the simulation kernel, and it also enables the first simulation processing container to interact with the first thread across threads.
[0055] Optionally, a second thread is started, and a second simulation processing container is initialized to obtain a first simulation processing container. This includes: configuring script interpretation runtime parameters for the second simulation processing container, and initializing the script runtime environment according to the configured script interpretation runtime parameters; initializing the virtual machine execution engine; and creating a message channel for receiving data and instructions from the first thread. The virtual machine execution engine is the underlying execution carrier used to load and execute bytecode or binary instructions. Initializing the virtual machine execution engine can refer to loading the virtual machine execution engine and completing the construction of its internal runtime environment, enabling the engine to perform low-level simulation calculations. For example, the virtual machine execution engine can refer to a WebAssembly engine or a bytecode execution engine. In this embodiment, the WebAssembly engine is used as the underlying execution carrier of the simulation kernel to provide efficient low-level execution capabilities, improve the processing speed and running efficiency of simulation calculations, and enable this solution to adapt to the execution requirements of complex simulation logic.
[0056] Due to the isolation characteristics of browser background threads, the second thread cannot directly access the Document Object Model and browser interface rendering resources, nor can it directly read or modify resources from other threads. Therefore, a virtual file system is constructed in the runtime memory of the second thread to cache and manage algorithm package files. This virtual file system is an in-memory data storage resource independently managed by the second thread, providing data read / write and virtual file support for script execution and the virtual machine execution engine within the second thread. Objects within the second thread can directly access this virtual file system.
[0057] Optionally, constructing a virtual file system in the runtime memory of the second thread may include: allocating runtime memory for the first simulation processing container in the runtime memory of the second thread; creating a root directory and related system directories in the runtime memory of the first simulation processing container; and establishing a mount association between the first simulation processing container and the virtual file system, so that the first simulation processing container can access virtual file resources normally. By adopting a memory-level virtual file system to manage algorithm package files, file read / write efficiency and access speed can be improved, and the independence and security of the simulation environment can be enhanced.
[0058] After receiving the second instruction from the first thread, the first simulation processing container retrieves at least one simulation algorithm package from a static resource server or other content distribution node via a network interface. The retrieved simulation algorithm package is then cached and mounted to the virtual file system. This simulation algorithm package can be a compressed code library file. Dynamically retrieving simulation algorithm packages based on initialization instructions allows for flexible adaptation to different simulation scenario requirements. Cacheing and mounting these packages to the virtual file system enables standardized and unified management of the algorithm packages, facilitating rapid assembly and invocation of the subsequent simulation kernel.
[0059] Optionally, obtaining at least one simulation algorithm package from a server or other content distribution node, caching the obtained simulation algorithm package, and mounting it to a virtual file system may include: initiating a request to the server or other content distribution node based on a preset simulation algorithm package path or identifier; receiving the binary data stream of at least one simulation algorithm package sent by the server or other content distribution node; allocating a corresponding storage location for each simulation algorithm package in the virtual file system and creating a corresponding target directory for the algorithm package; writing the decompressed metadata, module files, and resource files of each simulation algorithm package to the corresponding target directory location in the virtual file system to complete the mounting of each simulation algorithm package in the virtual file system; and updating the write path information of each simulation algorithm package to the module search path in the script runtime environment. By caching and mounting the obtained simulation algorithm packages to the virtual file system and synchronously updating the module search path in the script runtime environment, the simulation algorithm packages can be dynamically loaded as runtime plugins by the first simulation processing container, thereby realizing the pluggable extension and flexible upgrade of the simulation kernel.
[0060] See Figure 2This is a timing diagram for mounting the simulation algorithm package and assembling the simulation kernel, provided in this embodiment of the invention. After the simulation processing container starts, it is initialized to provide a runtime environment that supports the assembly and operation of the simulation kernel, and to enable cross-thread interaction with the first thread. The simulation algorithm package is obtained through the network layer, cached, and mounted to the virtual file system. Based on the simulation algorithm package mounted in the virtual file system, the corresponding simulation kernel is assembled within the simulation processing container. The simulation kernel assembly path is updated in the module search path of the script runtime environment. After successfully mounting the simulation algorithm package in the virtual file system and updating the module search path in the script runtime environment, the simulation processing container imports the simulation kernel-related classes from the simulation algorithm package and creates simulation instances and runtime control objects, completing the instantiation and assembly of the simulation kernel. The simulation kernel-related classes may include simulation context classes, simulation engine classes, or runtime control classes. Pre-set event callback functions from the browser side are registered to the simulation kernel, enabling the simulation kernel to actively send simulation events and calculation results back to the first thread during operation through a callback mechanism, supporting real-time interaction between the simulation process and the interface display.
[0061] Since the first thread and the second thread are isolated from each other, the first thread sends instructions to the first simulation processing container through a unified encapsulated function. The first simulation processing container needs to receive the instructions and call the corresponding method of the simulation kernel according to the received instructions, thereby realizing the remote control of the simulation instance by the first thread. Specifically, the first simulation processing container exposes multiple first interfaces to the first thread through a message channel. Each first interface is used to receive specific instructions from the first thread. Configuring the multiple first interfaces of the first simulation processing container enables each first interface to receive different instructions, standardizes the interaction between the first simulation processing container and the first thread, and improves the stability and reliability of instruction transmission. Optionally, the instructions that the multiple first interfaces of the first simulation processing container can receive include, but are not limited to: initialization and reset instructions, model compilation and loading instructions, simulation start and pause instructions, and simulation speed adjustment instructions.
[0062] S130. In response to the first instruction, the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction used to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps.
[0063] The first simulation processing container provides an independent operating environment for building simulation models and executing simulation calculations. Upon receiving a first instruction to control the simulation calculations, the first simulation processing container performs simulation calculations on the built first model, generating simulation event information containing simulation calculation results and timestamps. Executing simulation calculations via instruction triggering enables precise control and orderly execution of the simulation process. Simultaneously, generating timestamped simulation event information ensures the timeliness and traceability of simulation event information, improving the standardization and reliability of simulation calculations.
[0064] S140. The first thread acquires simulation event information and renders and displays it in the browser visualization interface based on the simulation event information.
[0065] The first thread acquires simulation event information generated by the first simulation processing container. Based on the simulation calculation results and timestamps contained in the simulation event information, the first thread renders and displays the simulation calculation results on the browser visualization interface in chronological order indicated by the timestamps. For example, the browser visualization interface presents a simulation scene, and each object in the simulation scene is displayed through its corresponding visualization object. After acquiring the simulation event information, the first thread renders and displays the simulation calculation results on each visualization object in chronological order.
[0066] The technical solution of this invention, by acquiring the first data sent by the first thread, can accurately and timely obtain the topology and node parameter information of the scene to be simulated; by constructing the simulation model using the first simulation processing container in a second thread isolated from the first thread, the simulation model construction process can be completed on the browser side and run independently of the browser's visual interface, avoiding the simulation modeling operation from occupying interface rendering resources and preventing interface lag; at the same time, simulation modeling by running the first simulation processing container in the second thread can get rid of the dependence on dedicated workstations and local clients, reducing system deployment and maintenance costs, thereby supporting cross-terminal use; by executing simulation calculations directly in the browser's background thread through the first simulation processing container, without relying on remote cloud servers, the network transmission latency of instructions and data can be reduced, thereby achieving high-frequency and efficient event scheduling; in addition, core simulation data does not need to be uploaded to the external network, which can reduce the risk of data leakage and improve the security and stability of the simulation system; the first thread acquires simulation event information and renders it in real time on the browser's visual interface, enabling interaction between simulation calculation results and front-end display, improving the real-time performance and intuitiveness of the simulation process. Based on the above technical solution, by leveraging the multi-threaded isolation feature of the browser front-end, the simulation model is constructed and executed using a simulation processing container on the browser side, and the simulation results are displayed in real time. This solves the problem of balancing ease of use, real-time interactivity, and data security in industrial simulation, achieving lightweight, high real-time performance, and low latency industrial system simulation. It improves the versatility, real-time performance, and data security of the simulation system, and enhances the overall execution efficiency and engineering application capabilities of industrial system simulation.
[0067] Figure 3 This is a flowchart of another simulation processing method provided by an embodiment of the present invention. This embodiment further refines the process of constructing a first model based on first data through a first simulation processing container as described in the above embodiment. Figure 3 As shown, another simulation processing method provided in this embodiment of the invention may include:
[0068] S210. Obtain first data. The first data is data sent by the first thread. The first data is used to indicate the topology of the scene to be simulated, as well as the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface.
[0069] S220. The first data is parsed and instantiated using the compilation engine configured in the first simulation processing container to obtain a set of simulation objects and a first connection table. The first model is constructed based on the set of simulation objects and the first connection table. The compilation engine is used to compile the data displayed in the browser visualization interface into data that can be executed by the simulation kernel. The set of simulation objects includes all simulation objects in the scene to be simulated. The first connection table is used to indicate the connection relationship between each simulation object.
[0070] The first data, displayed in the browser's visual interface, is sent to the first simulation processing container by the first thread. It indicates the topology of the scene to be simulated and the associated parameters of each node. The first simulation processing container is equipped with a compilation engine that compiles the data displayed in the browser's visual interface into executable simulation kernel data. After acquiring the first data, the first simulation processing container parses and processes the information contained within it, generating a corresponding set of simulation objects and a first connection table based on the parsed data. The set of simulation objects includes all simulation objects in the scene to be simulated, and the first connection table indicates the connections between these simulation objects. The set of simulation objects and the first connection table describe the complete scene to be simulated; therefore, the first model is constructed based on the set of simulation objects and the first connection table.
[0071] The compilation engine configured in the first simulation processing container can convert browser visualization interface data into executable simulation kernel data, ensuring data format adaptability and compatibility during simulation execution. Based on the simulation object set and connection relationship table, the model can accurately reproduce the simulation scene, ensuring the integrity and accuracy of the first model and providing a reliable model foundation for simulation calculation.
[0072] As an optional but not limited implementation, the first data is parsed and instantiated using the compilation engine configured in the first simulation processing container to obtain a set of simulation objects and a first connection relationship table. Based on the set of simulation objects and the first connection relationship table, the first model is constructed, which may include steps 1-6:
[0073] Step 1: Obtain the first mapping result based on the preset semantic mapping table and the first data. The first mapping result is used to indicate the simulation entity corresponding to each node indicated in the first data.
[0074] A preset semantic mapping table can refer to a pre-defined set of mapping rules used to establish the correspondence between node types and simulation entity categories. Optionally, node type can refer to the visual component type corresponding to each node in the browser's visualization interface. Based on the preset semantic mapping table, the conversion from visual component type to simulation entity category can be realized, thereby enabling components from different domains to be described under a unified abstract semantic framework. For example, components from different domains can refer to sources, processing devices, delivery units, sinks, etc.
[0075] The first data is the data displayed in the browser's visual interface. It contains record information for all nodes in the scenario to be simulated. By traversing the record information of all nodes in the first data, the node type corresponding to each node can be determined. Based on the node type and a preset semantic mapping table, the simulation entity corresponding to each node, i.e., the first mapping result, can be determined. This enables precise matching between nodes and simulation entities, ensuring the accuracy and reliability of the correspondence between the visual interface data and the simulation execution entity, and providing a correct object foundation for the construction of the simulation model.
[0076] Step 2: Based on the first mapping result and the first data, construct the first information. The first information is a structured data model that is independent of the front-end visualization format and the simulation kernel execution format. It is used to provide a structured description of each simulation entity and its corresponding associated parameter information.
[0077] Based on the first mapping result and the first data, first information is constructed. This first information provides a structured description of each simulation entity and its corresponding parameter information in a manner independent of the front-end visualization format and the simulation kernel execution format. The first information is an intermediate-layer structured data model oriented towards the simulation kernel, used to decouple browser-visualized data from simulation object data, eliminating the impact of differences between the visualization format and the simulation execution format. This improves data universality and portability, facilitating adaptation to different simulation kernels and visualization interfaces. For example, the first information may include entity representations, entity categories, entity parameter sets, time parameter sets, fault parameter sets, output strategy parameter sets, as well as connection relationships and routing rules.
[0078] Step 3: Generate third information based on the second information. The second information is the parameter information associated with each node in the topology indicated by the first data, and the third information is the parameter information that the simulation kernel can execute.
[0079] The third information, adapted to the simulation kernel execution requirements, is generated based on the second information. This enables the conversion of the parameter information of each node from the visual interface description format to the simulation kernel execution format, thereby ensuring the format compatibility and execution effectiveness of the parameter information and avoiding simulation calculation abnormalities caused by parameter format mismatch.
[0080] For example, the second information is normalized to generate the third information, wherein the normalization process includes at least one of the following: the first process, the second process, the third process, and the fourth process. Specifically, the first process may refer to converting process time parameters into a time distribution description structure that can be called by the kernel, and the time distribution description structure that can be called by the kernel may contain a distribution type identifier and a distribution parameter array; the second process may refer to converting fault parameters into a kernel-executable interrupt trigger description structure, and the kernel-executable interrupt trigger description structure may contain an enable identifier, trigger condition, duration, etc.; the third process may refer to converting equipment attributes such as conveying and processing into numerical parameters required by the kernel object, for example, the numerical parameters required by the kernel object may refer to length, speed, capacity, cycle time, etc.; the fourth process may refer to converting output strategy parameters into kernel-executable action rules, for example, converting output strategy parameters into discharge / diversion rules.
[0081] Step 4: Based on the first and third information, generate a set of simulation objects. Each simulation object in the set represents the simulation entity after configuring the corresponding associated parameter information.
[0082] The first piece of information is a structured data model in the middle layer for the simulation kernel, used to provide a structured description of each simulation entity and its corresponding parameter information. There is a one-to-one correspondence between simulation entities and nodes. The third piece of information is the parameter information associated with each node in an executable format for the simulation kernel. Based on the first and third pieces of information corresponding to the same node, the simulation object corresponding to that node can be instantiated, thereby completing the instantiation of all simulation objects in the simulation scenario and generating a set of simulation objects. By binding and integrating simulation entities with their corresponding parameter information to form complete and executable simulation objects, the integrity and independence of simulation objects can be improved, facilitating unified calling and management by the simulation kernel.
[0083] Step 5: Generate a first connection relationship table based on the first mapping result and the fourth information. The fourth information is the topology of the simulation scene indicated by the first data. The first connection relationship table is used to indicate the connection relationship between each simulation entity.
[0084] The fourth information can refer to the topology of the simulation scenario indicated by the first data, used to indicate the connection relationships or composition of each node in the simulation scenario. Optionally, the fourth information can at least indicate the successor nodes of each node in the simulation scenario. The first mapping result can indicate the simulation entity corresponding to each node indicated in the first data. Based on the first mapping result and the fourth information, the connection relationship of each node corresponding to the simulation entity can be determined, i.e., a first connection relationship table is generated. By uniformly recording and maintaining the connection relationships between simulation entities through a dedicated connection relationship table, the accurate restoration of the topology in the simulation model can be ensured, improving the standardization and readability of the simulation model structure.
[0085] Step 6: Construct the first model based on the set of simulation objects and the first connection relationship table.
[0086] Based on the first connection table, reference relationships or routing index structures are established between simulation objects in the simulation object set, thereby completing the construction of the first model. Integrating the simulation objects and their connection relationships forms a complete simulation model, ensuring that the model accurately reflects the structure and operational logic of the simulation scenario. This provides a stable, reliable, and directly executable model foundation for subsequent simulation calculations, enabling the visualization of the topology to generate an executable simulation model without the need for manual simulation code writing.
[0087] Optionally, generating a first connection table based on the first mapping result and the fourth information may include:
[0088] Based on the first mapping result, the entity category to which each simulation object belongs is determined. The entity category includes a first category and a second category. The first category is the entity category that does not have the function of conveying or connecting, and the second category is the entity category that has the function of conveying or connecting.
[0089] Based on the entity category to which each simulation object belongs, a second connection table and a third connection table are generated according to the fourth information. The second connection table is used to indicate the connection relationship between simulation objects belonging to the first category, and the third connection table is used to indicate the connection relationship between simulation objects belonging to the second category.
[0090] Entity categories can refer to classifications of simulation objects based on their functional characteristics. The first category can refer to the entity category to which simulation objects without transport or connection functions belong. The second category can refer to the entity category to which simulation objects with transport or connection functions belong. Based on the first mapping result, each simulation object is classified according to its functional characteristics to determine whether each simulation object belongs to the first category (lacking transport or connection functions) or the second category (possessing transport or connection functions). Based on the determined entity categories of each simulation object, and combined with the topology of the simulation scene indicated by the fourth information, a second connection relationship table is generated to record the connection relationships between simulation objects of the first category, and a third connection relationship table is generated to record the connection relationships between simulation objects of the second category.
[0091] By categorizing simulation objects according to their functional characteristics, a classified management system is achieved, providing a basis for subsequent construction of connection relationship tables and improving the relevance and standardization of connection relationship analysis. Recording connection relationships in separate tables by entity category enables separate management of connection relationships for simulation objects of different functional categories, clearly distinguishing the association logic of various simulation objects, avoiding confusion of connection relationships between different functional types, and improving the readability and maintainability of the connection relationship tables. Furthermore, different simulation kernels and flow strategies can be adopted for different functional categories, improving the accuracy of simulation results in complex production line topology scenarios and the overall scalability of the simulation system.
[0092] Optionally, the simulation processing method provided in this embodiment of the invention may further include:
[0093] In response to the first operation, second data is obtained. The first operation is a modification operation on the first data, and the second data is used to indicate the first data after the first operation.
[0094] Based on at least one of the first information, the first connection relationship table, and the preset semantic mapping table, as well as the second data, the first model is reconstructed to obtain the second model.
[0095] After the first operation modifies the first data, the second data is obtained. Then, based on at least one item from the first information, the first connection table, and the preset semantic mapping table, as well as the second data obtained after the first operation, the constructed first model is reconstructed, ultimately yielding the reconstructed second model. By obtaining the modified second data in response to data modification operations and combining it with relevant existing data to reconstruct the original simulation model to obtain a new model, dynamic updates and adjustments to the simulation model can be achieved. By reconstructing the model based on partially existing information, it is possible to ensure that the model remains consistent with the modified simulation scenario data, while maintaining the original model's reasonable structure and configuration. This avoids the need to rebuild the entire model due to data modifications, saving model construction time and resource consumption, improving the efficiency and accuracy of model construction, enabling dynamic adjustment and adaptation of the simulation scenario, and enhancing the flexibility and adaptability of the simulation model.
[0096] For example, if the first operation only modifies the parameter information associated with nodes, the first model can be reconstructed based on the first information, the first connection relationship table, the preset semantic mapping table, and the second information to obtain the second model, where the second information is the parameter information associated with each node after the first operation. Specifically, a set of simulation objects is generated based on the first information, the preset semantic mapping table, and the second information; the second model is constructed based on the set of simulation objects and the first connection relationship table. If the first operation only modifies the topology of the scene to be simulated, i.e., modifies nodes and / or modifies node connection relationships, the first model can be reconstructed based on the first information, the first connection relationship table, the preset semantic mapping table, and the third information to obtain the second model, where the third information is the topology of the scene to be simulated after the first operation. Specifically, a set of simulation objects is generated based on the first information, the preset semantic mapping table, and the third information; a fourth connection relationship table is generated based on the preset semantic mapping table and the third information, the fourth connection relationship table indicating the connection relationships of each node after the first operation; the second model is constructed based on the set of simulation objects and the first connection relationship table. If the first operation modifies both the parameter information associated with the nodes and the topology of the scene to be simulated, the first model can be reconstructed based on the preset semantic mapping table and the fourth information to obtain the second model.
[0097] See Figure 4 This is a logical diagram illustrating the simulation model construction process provided in this embodiment of the invention. The compilation engine in the simulation processing container, by traversing the information of each node and using preset mapping rules, classifies and maps nodes into different simulation entities according to their types; it normalizes the parameter information associated with each node; and based on the simulation entity corresponding to each node and the processed associated parameter information, it instantiates the simulation object corresponding to the simulation kernel. Figure 4 In the example, the heterogeneous simulation container is implemented using Python; the compilation engine in the simulation processing container generates a routing table by parsing the next node field in the node information to limit the reference connection relationship between objects; based on the instantiated simulation objects and the routing table, a simulation model is constructed, which is a set of simulation environment objects that the simulation kernel can execute, used to describe the simulation scenario displayed on the front end.
[0098] S230. In response to the first instruction, the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction used to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps.
[0099] S240. The first thread acquires simulation event information and renders and displays it in the browser visualization interface based on the simulation event information.
[0100] The technical solution of this invention uses a compilation engine in a simulation processing container to parse and instantiate the first data, generate a set of simulation objects and a connection table, and construct a first model. This enables browser visualization interface data to be efficiently converted into data executable by the simulation kernel, thereby improving the automation level and execution efficiency of model construction. The compilation engine configured in the first simulation processing container independently completes data compilation and model construction, avoiding parsing errors or poor compatibility issues that can easily result from directly mixing browser visualization interface data and simulation calculation data, thus improving the reliability and execution stability of the simulation model.
[0101] Figure 5 This is a flowchart illustrating another simulation processing method provided by an embodiment of the present invention. This embodiment further refines the process described in the above embodiment where the first simulation processing container performs simulation calculations on the first model and generates simulation event information. For example... Figure 5 As shown, another simulation processing method provided by an embodiment of the present invention may include:
[0102] S310. Obtain first data. The first data is data sent by the first thread. The first data is used to indicate the topology of the simulation scene and the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface.
[0103] S320. Based on the first data, a first model is constructed through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for constructing the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a background execution thread of the browser.
[0104] S330. Based on the discrete event mechanism, the first simulation processing container gradually advances the simulation calculation of the first model and generates corresponding simulation event information until it responds to the third instruction; wherein, the discrete event mechanism refers to a simulation control method that is driven by discrete events and advances the simulation calculation sequentially according to the occurrence sequence of discrete events, and the third instruction is an instruction used to control the first simulation processing container to stop performing simulation calculation on the first model.
[0105] Discrete event mechanisms refer to simulation control methods that are driven by discrete events and proceed with simulation calculations sequentially according to the occurrence time of these discrete events. Discrete events refer to events that occur during the simulation process, have a definite occurrence time, and exist discretely. For example, equipment startup, equipment shutdown, material leaving the equipment, and the start of product painting are all discrete events. For continuous simulation scenarios where it is difficult to divide discrete events, simulation calculations can be performed by dividing the simulation into time slices according to preset rules. Each time slice can represent a discrete event. Continuous simulation scenarios refer to simulation scenarios where the state continuously changes over time and cannot be naturally separated into independent events with definite trigger times, such as continuous temperature changes, continuous pressure rises and falls, continuous liquid flow, and continuous current and voltage fluctuations. Preset rules refer to the pre-defined criteria and strategies for dividing the continuous simulation process into time slices; for example, preset rules can refer to preset fixed time intervals.
[0106] The first simulation processing container employs a discrete event mechanism, performing simulation calculations on the first model sequentially according to the occurrence order of discrete events, and synchronously generating corresponding simulation event information. This information records the simulation calculation result for each discrete event, as well as the timestamp of that event. The simulation calculation process continues until a third instruction is received to stop the simulation calculation, at which point the simulation calculation terminates.
[0107] Employing a discrete event mechanism to advance simulation calculations enables precise control over the temporal logic of the simulation process, improving the rationality and accuracy of the simulation calculations. By progressively advancing the simulation and simultaneously generating event information, dynamic tracking and data recording of the simulation process can be achieved, ensuring the temporal order of simulation event information and facilitating the traceability and analysis of subsequent simulation results. Supporting the control of simulation calculations to stop via third-party instructions allows for controllable scheduling of the simulation process, avoiding unnecessary resource consumption, while enhancing the flexibility and practicality of the simulation method and ensuring the efficient and orderly execution of the simulation calculation process.
[0108] As an optional but not limited implementation, based on a discrete event mechanism, the first simulation processing container progressively advances the simulation calculation of the first model and generates corresponding simulation event information, including:
[0109] The first event is determined from the event set, and the first clock is advanced to the timestamp corresponding to the first event. The event set is used to store discrete events to be executed during the simulation process. The first event is the discrete event with the smallest timestamp in the event set, and the first clock is a virtual clock used to identify the timing of the simulation calculation.
[0110] The first simulation processing container executes the first event, updating the running status of each simulation object in the first model;
[0111] Based on the first event, the current time indicated by the first clock, and the running status of each simulation object in the updated first model, corresponding simulation event information is generated, and the second event is determined from the event set to continue the simulation calculation of the first model. The simulation calculation timestamp included in the simulation event information is the current time indicated by the first clock, and the second event is the discrete event with the smallest timestamp in the event set after removing the first event.
[0112] A virtual clock can refer to a virtual time stamping tool used to simulate the progression of time in simulation calculations and to identify the simulation sequence. It selects the first event with the smallest timestamp from the event set and advances the first clock to the timestamp corresponding to that first event, thus synchronizing the simulation sequence with the events to be executed. By prioritizing the execution of the first event with the smallest timestamp and strictly following the occurrence sequence of discrete events, the timing accuracy of the simulation calculations can be guaranteed. Furthermore, by synchronously advancing the first clock to the timestamp corresponding to the event, precise identification and tracking of the simulation sequence can be achieved, providing an accurate time reference for the generation of subsequent simulation event information and improving the standardization and traceability of the simulation process.
[0113] The operational status refers to the operating parameters or working state of the simulated object during the simulation process, such as working, blocked, faulty, recovering, speed value, etc. The first simulation processing container executes the first event and updates the operational status of each simulated object in the first model to prepare for the next stage of simulation calculation. By executing the first event and synchronously updating the operational status of the simulated objects, the impact of events occurring in the simulation scenario on each simulated object can be promptly restored, ensuring the dynamic adaptability and realism of the simulation model. The real-time updated operational status provides an accurate state basis for the next stage of simulation calculation.
[0114] Based on the first event, the current time of the first clock, and the updated running status of the simulation object, simulation event information is generated. Since the event set stores discrete events to be executed during the simulation, the first event is removed from the event set as it is executed. Then, the discrete event with the smallest timestamp is reselected from the event set, and the simulation calculations for the first clock and the first model continue to advance. Optionally, the simulation event information includes at least the target entity identifier, event type, event timestamp, and optional load information. The event type describes the content of the discrete event, and the event timestamp can refer to the current time of the first clock, i.e., the execution time of the discrete event.
[0115] The generated simulation event information integrates key information such as event execution, timing, and object status, providing complete data support for subsequent visualization and result traceability. By iteratively eliminating executed events and determining the next event to be executed, the simulation calculation is automated and orderly, improving the efficiency of the simulation calculation. Events with the smallest timestamps are always prioritized for execution, strictly ensuring the accuracy of the simulation timing and further enhancing the rationality and realism of the simulation calculation.
[0116] Employing a discrete event mechanism to drive simulation calculations ensures that simulation events are executed in strict chronological order, guaranteeing the accuracy of timing and the logical consistency of execution during the simulation process. By uniformly managing the simulation timing through a virtual clock, precise control and state tracking of the simulation process can be achieved. By iteratively selecting and executing the event with the smallest timestamp in the event set, the stable and continuous progress of the simulation process can be ensured. Simultaneously, simulation event information containing corresponding time information is generated, providing a reliable basis for subsequent simulation result display and data traceability, thereby improving the standardization, controllability, and reliability of the overall simulation process.
[0117] S340: The first thread acquires simulation event information and renders and displays it in the browser visualization interface based on the simulation event information.
[0118] See Figure 6 This is a sequence diagram of dynamic loading and runtime of the simulation processing container provided in this embodiment of the invention. The simulation processing container is dynamically loaded in the background execution thread of the browser. In response to the execution of the main thread, the simulation processing container calls the corresponding kernel method to perform simulation calculations and generates a simulation event information stream, which is then sent back to the main thread to render and display the simulation results.
[0119] The technical solution of this invention, by adopting a discrete event mechanism to progressively advance simulation calculations, enables the simulation process to be executed in an orderly manner strictly according to the timing of event occurrences. The simulation logic is more in line with the actual operating rules of industrial scenarios, thereby improving the realism and reliability of the simulation results. Based on the discrete event-driven approach, the resource waste caused by continuous calculations can be avoided, improving the execution efficiency and resource utilization of simulation calculations. At the same time, it is easier to accurately respond to stop commands, thereby improving the controllability and stability of the simulation process.
[0120] Figure 7 This is a flowchart illustrating another simulation processing method provided by an embodiment of the present invention. This embodiment further refines the process described above where the first thread acquires simulation event information and renders and displays it in a browser visualization interface based on the simulation event information. For example... Figure 7 As shown, another simulation processing method provided in this embodiment of the invention may include:
[0121] S410. Obtain first data. The first data is data sent by the first thread. The first data is used to indicate the topology of the scene to be simulated, as well as the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface.
[0122] S420. Based on the first data, a first model is constructed through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for constructing the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a background execution thread of the browser.
[0123] S430. In response to the first instruction, the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction used to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps.
[0124] S440. The second thread stores the simulation event information into the simulation event channel. The simulation event channel is used to realize the one-way transmission of simulation event information from the second thread to the first thread.
[0125] The second thread, which carries the first simulation processing container, stores the simulation event information generated by the simulation calculation into the simulation event channel, thus preparing for the transmission of simulation event information from the second thread to the first thread. Optionally, if the first simulation processing container is a heterogeneous computing container, the second thread encapsulates the simulation event information generated by the simulation calculation before storing it into the simulation event channel, enabling the simulation event information to be transmitted across languages. In this embodiment, the simulation event channel can refer to a message queue or a shared buffer structure, used to isolate the execution sequence of simulation calculation and browser visualization rendering, allowing the first simulation processing container to output the simulation event information stream without blocking the browser visualization rendering thread.
[0126] By using a dedicated simulation event channel to achieve one-way transmission of simulation event information, it is possible to prevent browser visualization interface data from interfering with the simulation processing in the second thread, ensuring the stability of the simulation calculation process, and at the same time ensuring that simulation event information can be accurately and securely transmitted to the first thread.
[0127] Optionally, the simulation event channel employs an event slicing and backpressure control strategy. The first simulation processing container outputs simulation event information in batches according to a preset time window. When the simulation event channel reaches a preset high-water mark threshold, the first simulation processing container reduces the output frequency of simulation event information or pauses output. When the simulation event channel falls below a preset low-water mark threshold, the first simulation processing container resumes output of simulation event information. By adopting the event slicing and backpressure control strategy, the frequency of cross-thread communication can be reduced, and information congestion in the simulation event channel can be prevented, thus avoiding uncontrolled memory usage or stuttering in the browser's visual interface rendering.
[0128] S450, the first thread extracts simulation event information from the simulation event channel at a fixed frame rate, and renders and displays the extracted simulation event information in the browser visualization interface.
[0129] A fixed frame rate refers to the fixed time frequency used by the first thread to extract simulation event information and perform rendering operations. The first thread extracts stored simulation event information from the simulation event channel at a fixed time frequency, and based on the extracted simulation event information, converts the simulation calculation results and related timing information into a visual format for display in the browser's visualization interface. When displaying in the browser's visualization interface, the target simulation object and its state information can be determined based on the event type corresponding to the simulation event information and the simulation object to which the event targets. Based on the target simulation object and its state information, state switching and rendering are performed on the corresponding visual object in the browser's visualization interface.
[0130] The first thread extracts simulation processing information and completes rendering at a fixed frame rate, which can ensure the smoothness and consistency of the simulation results display, avoid display stuttering or screen distortion, improve the real-time performance of the simulation results display, and enhance the intuitive perception and interactive experience of the simulation process.
[0131] As an optional but not limited implementation, the first thread extracts simulation event information from the simulation event channel at a fixed frame rate, and renders and displays the extracted simulation event information in the browser's visualization interface, which may include:
[0132] The first thread extracts target simulation event information from the simulation event channel; wherein the simulation calculation timestamp included in the target simulation event information is no later than the current time indicated by the second clock, which is a virtual clock used to identify the browser's visual rendering progression sequence;
[0133] The first thread renders and displays the target simulation event information in the browser's visualization interface, and then advances the second clock at a fixed frame rate to extract new target simulation event information from the simulation event channel.
[0134] The first thread extracts target simulation event information that meets certain criteria from the simulation event channel. The filtering criterion is that the simulation calculation timestamp included in the target simulation event information is no later than the current time indicated by the second clock used to identify the browser's visualization rendering progress sequence. This completes the accurate filtering and extraction of event information required for visualization rendering. By comparing the simulation calculation timestamp included in the target simulation event information with the second clock, the target simulation event information is filtered out. This ensures that the extracted target simulation event information accurately matches the visualization rendering sequence, and only renders the execution results of simulation events that have already been completed. This avoids situations where rendering information and rendering sequence are out of sync, ensuring the consistency and repeatability of the visualization display sequence. At the same time, it avoids the extraction of invalid information, improving the efficiency and relevance of information extraction.
[0135] The first thread, based on the extracted target simulation event information, transforms the simulation calculation results into a visual format and renders them in a browser visualization interface. After rendering, the first thread continues to advance the second clock at a fixed frame rate, then extracts new target simulation event information that meets the timestamp filtering criteria from the simulation event channel, thus continuously advancing the visualization rendering process. Rendering based on target simulation event information ensures a precise correspondence between the visualized content and the simulation calculation results, improving the accuracy of the display. Advancing the second clock at a fixed frame rate and continuously extracting new target information ensures a stable update rhythm for the visualization interface, achieving synchronous linkage between the simulation process and the visualization display, avoiding rendering stutters or timing errors, improving the user's intuitive perception and interactive experience, and simultaneously enabling automated, cyclical advancement of visualization rendering, thus improving rendering efficiency.
[0136] Optionally, the playback progress of the first thread's rendering and display can be adjusted by setting a playback speed coefficient. This coefficient maps a fixed frame rate to a corresponding playback progress, enabling adjustment, pausing, and resumption of the simulation result rendering and display speed. The playback speed coefficient can be set through the corresponding component in the browser's visual interface. Specifically, for the first playback progress, setting the playback speed coefficient advances it to a second playback progress. The second playback progress is the playback progress obtained by advancing the first playback progress by a fixed frame rate that is a multiple of the playback speed coefficient. Adjusting the playback speed coefficient does not change the logical order of events, i.e., it does not change the generation order and speed of simulation event information in the second thread; it only changes the playback progress of the first thread's rendering and display, ensuring consistency of simulation results under different playback speeds.
[0137] Optionally, the first thread renders and displays the target simulation event information in a browser visualization interface, which may include:
[0138] According to the timing of the target simulation event information, the first thread renders the first visualization object based on the simulation calculation results included in each target simulation event information; wherein, the first visualization object is the visualization object corresponding to the simulation object whose state is updated in the simulation calculation results.
[0139] The first thread extracts the simulation calculation results contained in each target simulation event information according to the chronological order of the target simulation event information. For simulation objects whose running state has been updated in the simulation calculation results, it finds the corresponding first visualization object and renders the first visualization object according to the simulation calculation results, realizing the synchronous update of the visualization object and the state of the simulation object. For discrete state switching events, such as device start-up / stop or abnormal state changes, rendering is performed according to the chronological order of the target simulation event information to ensure that the visualization display is consistent with the chronological order of the simulation calculation, restore the real logic of the simulation process, and avoid the simulation result rendering relying on the simulation kernel's frame-by-frame result output. Instead, it uses the information of the executed discrete events for rendering and display, and only renders the first visualization object corresponding to the simulation object whose state has been updated. This avoids indiscriminate rendering of all visualization objects, reduces rendering resource consumption, and improves rendering efficiency. It achieves precise synchronization between the state of the simulation object and the display of the visualization object, ensuring the accuracy and real-time performance of the content displayed in the browser's visualization interface and improving the interactive experience.
[0140] Optionally, the first thread renders and displays the target simulation event information in a browser visualization interface, which may include:
[0141] The first thread performs interpolation rendering on the second visualization object based on the target simulation event information and the reference simulation event information. The reference simulation event information is the simulation event information that is sequentially adjacent to the target simulation event information. The second visualization object is the visualization object in the target simulation event information that has a state change compared to the simulation object in the reference simulation event information.
[0142] Reference simulation event information refers to simulation event information that is temporally adjacent to the target simulation event information. Temporally adjacent means that the simulation calculation timestamps of the two simulation event information are closely connected in time sequence, without any other simulation event information intervening. Interpolation rendering refers to a rendering method that supplements intermediate states based on the state changes of simulation objects in two adjacent simulation event information to achieve a smooth transition of the visualized object.
[0143] The first thread simultaneously acquires the target simulation event information and the reference simulation event information that is adjacent to the target simulation event information in terms of timing. By comparing the two, the simulation object with a state change is identified as the second visualization object. Then, based on the state data of the simulation object in the target simulation event information and the reference simulation event information, the second visualization object is rendered by interpolation rendering to achieve a smooth transition display of the visualization object's state.
[0144] For example, when the simulation object is a conveying unit object for conveying liquid, in the temporally adjacent reference simulation event information, the liquid conveying position corresponding to the conveying unit is at the starting conveying point, and in the target simulation event information, the liquid conveying position corresponding to the conveying unit reaches the target conveying point. The first thread obtains the two sets of temporally adjacent simulation event information, determines that the conveying unit is a simulation object whose state has changed, and corresponds it to the second visualization object. Based on the liquid position state data of the conveying unit in the two sets of simulation event information, interpolation is used to supplement the intermediate states of the continuous movement of the liquid from the starting conveying point to the target conveying point. Then, interpolation rendering is performed on the second visualization object so that the liquid conveying process corresponding to the conveying unit in the visualization interface presents a smooth and continuous flow display effect.
[0145] By employing interpolation rendering, intermediate states between adjacent simulation events can be supplemented, avoiding abrupt updates to the state of visualized objects. This improves the smoothness and coherence of the browser's visualization interface, enhancing the user's visual experience. It also avoids relying on frame-by-frame output from the simulation kernel for rendering simulation results, instead utilizing information from already executed discrete events. This ensures smooth visual presentation even under high computational loads. Interpolation rendering is performed only on the second visualized object corresponding to the simulation object with state changes, accurately locating the rendered object, reducing unnecessary rendering operations, lowering rendering resource consumption, and improving rendering efficiency. Combining simulation event information from adjacent time sequences for rendering ensures that the state changes of visualized objects are consistent with the temporal logic of the simulation calculation, guaranteeing the accuracy and realism of the visualization and further enhancing the overall effect of simulation visualization.
[0146] See Figure 8The simulation kernel and front-end rendering thread asynchronously collaborate to implement a timing diagram for simulation event rendering, as provided in this embodiment of the invention. The simulation kernel uses a logical clock as a reference, which is a virtual clock used to identify the timing of simulation event information generation by the simulation processing container. It advances non-uniformly according to the timestamps of discrete events, popping the event with the smallest timestamp from the event queue and performing a state transition. Events containing target identifiers, event types, logical timestamps, and payload data are written to the event channel. The rendering loop uses a physical clock as a reference, which is a virtual clock used to identify the timing of browser visualization rendering. It advances uniformly at a fixed frame rate, updating the physical clock each frame according to the playback speed coefficient, and reading consumable events from the event channel that satisfy a logical timestamp less than or equal to the current physical clock. When a consumable event exists, the event channel returns the event to the rendering loop, which triggers the view object / state machine to perform state machine switching and initiate or update interpolation calculations. When there are no consumable events, the view object / state machine continues rendering based on existing interpolation data, thereby achieving a smooth transition display of the simulation state. In addition, a high / low water level back pressure control mechanism can be set to prevent data backlog in the event channel, thereby ensuring the coordinated stability of simulation calculation and front-end rendering.
[0147] See Figure 9 This is a logical schematic diagram of the simulation processing method provided in this embodiment of the invention. Users can interactively construct a visual topology and configure relevant parameters. The main thread carrying the browser's visual interface encapsulates the visual topology and parameter information and sends it to the heterogeneous computing container in the browser's background processing thread. The heterogeneous computing container is configured with a dynamic topology compilation and runtime injection engine, possessing the ability to build simulation models. The heterogeneous computing container obtains algorithm packages through a network interface, mounts them to a virtual file system, compiles the mounted algorithm packages, assembles a simulation kernel, and possesses simulation computing capabilities. Based on the obtained visual topology and parameter information, the heterogeneous computing container constructs a simulation model through topology compilation and parameter injection. The heterogeneous computing container performs simulation calculations on the simulation model using the assembled simulation kernel, generates simulation event information, and stores it in the event channel. The main thread consumes simulation event information from the event channel according to the simulation event sequence; based on the consumed simulation event information, the main thread updates the state of the corresponding simulation objects in the visual interface and performs interpolation rendering on the simulation results.
[0148] The technical solution of this invention involves a second thread running a first simulation processing container storing simulation event information generated by the simulation calculation into a dedicated simulation event channel. This channel enables unidirectional secure transmission of simulation event information from the second thread to the first thread, isolating data interaction between the front-end and back-end threads and avoiding thread interference and data conflicts caused by bidirectional transmission. This ensures the stability of the simulation calculation process and the security of data transmission. Subsequently, the first thread extracts simulation event information from the simulation event channel at a preset fixed frame rate and promptly converts the simulation calculation results into a visual format based on the extracted information. This is then rendered and displayed in a browser visualization interface, ensuring a stable and controllable update rhythm for the visualization interface. This avoids interface lag or display errors caused by the randomness of simulation event triggering, improving the smoothness and intuitiveness of the simulation result display. Simultaneously, it achieves linkage between the simulation calculation process and the visualization display, enhancing the user's perception and interactive experience of the simulation process.
[0149] Figure 10 This is a schematic diagram of a simulation processing device provided in an embodiment of the present invention. This embodiment is applicable to situations where various industrial system simulations are implemented on a browser-based platform. The simulation processing device can be implemented in hardware and / or software, and can be configured in any electronic device with network communication capabilities. Figure 10 As shown, the simulation processing apparatus provided in this embodiment of the invention may include the following:
[0150] The data acquisition module 510 is used to acquire first data, which is data sent by the first thread. The first data is used to indicate the topology of the simulation scene and the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface.
[0151] The model building module 520 is used to build a first model based on the first data through a first simulation processing container; wherein, the first model is a simulation model used to describe the simulation scenario and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for building the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a browser background execution thread;
[0152] The simulation calculation module 530 is used to respond to a first instruction, wherein the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps.
[0153] The rendering and display module 540 is used for the first thread to obtain the simulation event information and to render and display it in the browser visualization interface based on the simulation event information.
[0154] Based on the above embodiments, the first simulation processing container may optionally be constructed in the following manner:
[0155] Create a second thread, which is used to run the first simulation processing container;
[0156] The second thread is started, and the second simulation processing container is initialized to obtain the first simulation processing container. The first simulation processing container has a runtime environment that supports the assembly and operation of the simulation kernel, and the first simulation processing container has the ability to interact with the first thread across threads.
[0157] A virtual file system is built in the runtime memory of the second thread, which is used to cache and manage algorithm package files;
[0158] In response to the second instruction, at least one simulation algorithm package is obtained from the server or other content distribution node, the obtained simulation algorithm package is cached and mounted to the virtual file system, and the second instruction is an instruction initiated by the first thread to indicate the initialization of the simulation environment;
[0159] Based on the simulation algorithm package mounted in the virtual file system, the corresponding simulation kernel is assembled in the first simulation processing container;
[0160] Configure multiple first interfaces of the first simulation processing container, wherein the first interface is used to receive instructions from the first thread.
[0161] Based on the above embodiments, optionally, a first model is constructed using a first simulation processing container based on the first data, including:
[0162] The first data is parsed and instantiated using the compilation engine configured in the first simulation processing container to obtain a set of simulation objects and a first connection table. A first model is then constructed based on the set of simulation objects and the first connection table. The compilation engine is used to compile the data displayed in the browser visualization interface into data executable by the simulation kernel. The set of simulation objects includes all simulation objects in the scene to be simulated, and the first connection table is used to indicate the connection relationships between each simulation object.
[0163] Based on the above embodiments, optionally, the first data is parsed and instantiated using a compilation engine configured in the first simulation processing container to obtain a set of simulation objects and a first connection relationship table, and a first model is constructed based on the set of simulation objects and the first connection relationship table, including:
[0164] Based on the preset semantic mapping table and the first data, a first mapping result is obtained. The first mapping result is used to indicate the simulation entity corresponding to each node indicated in the first data.
[0165] Based on the first mapping result and the first data, first information is constructed. The first information is a structured data model that is independent of the front-end visualization format and the simulation kernel execution format, and is used to provide a structured description of each simulation entity and its corresponding associated parameter information.
[0166] Based on the second information, third information is generated, wherein the second information is the parameter information associated with each node in the topology indicated by the first data, and the third information is the parameter information that the simulation kernel can execute.
[0167] Based on the first information and the third information, a set of simulation objects is generated, wherein each simulation object in the set of simulation objects is used to represent a simulation entity after configuring the corresponding associated parameter information;
[0168] Based on the first mapping result and the fourth information, a first connection relationship table is generated, wherein the fourth information is the topological structure of the simulation scene indicated by the first data, and the first connection relationship table is used to indicate the connection relationship between each simulation entity.
[0169] The first model is constructed based on the set of simulation objects and the first connection relationship table.
[0170] Based on the above embodiments, optionally, a first connection relationship table is generated according to the first mapping result and the fourth information, including:
[0171] Based on the first mapping result, the entity category to which each simulation object belongs is determined. The entity category includes a first category and a second category. The first category is an entity category that does not have a transport or connection function, and the second category is an entity category that has a transport or connection function.
[0172] Based on the entity category to which each simulation object belongs, a second connection table and a third connection table are generated according to the fourth information; the second connection table is used to indicate the connection relationship between simulation objects belonging to the first category, and the third connection table is used to indicate the connection relationship between simulation objects belonging to the second category.
[0173] Based on the above embodiments, optionally, the simulation processing apparatus provided in the embodiments of the present invention may further include:
[0174] The data acquisition module 510 can also be used to acquire second data in response to the first operation, wherein the first operation is a modification operation on the first data, and the second data is used to indicate the first data after being modified by the first operation;
[0175] The model building module 520 can also be used to reconstruct the first model based on at least one of the first information, the first connection relationship table, and the preset semantic mapping table, as well as the second data, to obtain a second model.
[0176] Based on the above embodiments, optionally, the first simulation processing container performs simulation calculations on the first model to generate simulation event information, including:
[0177] Based on the discrete event mechanism, the first simulation processing container progressively advances the simulation calculation of the first model and generates corresponding simulation event information until it responds to the third instruction; wherein, the discrete event mechanism refers to a simulation control method that is driven by discrete events and advances the simulation calculation sequentially according to the occurrence sequence of discrete events, and the third instruction is an instruction used to control the first simulation processing container to stop performing simulation calculation on the first model.
[0178] Based on the above embodiments, optionally, based on a discrete event mechanism, the first simulation processing container progressively advances the simulation calculation of the first model and generates corresponding simulation event information, including:
[0179] The first event is determined from the event set, and the first clock is advanced to the timestamp corresponding to the first event; the event set is used to store discrete events to be executed during the simulation process, the first event is the discrete event with the smallest timestamp in the event set, and the first clock is a virtual clock used to identify the timing of the simulation calculation.
[0180] The first simulation processing container executes the first event and updates the running status of each simulation object in the first model;
[0181] Based on the first event, the current time indicated by the first clock, and the updated running status of each simulation object in the first model, corresponding simulation event information is generated, and a second event is determined from the event set to continue the simulation calculation of the first model; wherein, the simulation calculation timestamp included in the simulation event information is the current time indicated by the first clock, and the second event is the discrete event with the smallest timestamp in the event set after removing the first event from the event set.
[0182] Based on the above embodiments, optionally, the first thread acquires the simulation event information and renders and displays it in a browser visualization interface according to the simulation event information, including:
[0183] The second thread stores the simulation event information into the simulation event channel, which is used to realize the one-way transmission of simulation event information from the second thread to the first thread;
[0184] The first thread extracts simulation event information from the simulation event channel at a fixed frame rate, and renders and displays the extracted simulation event information in the browser visualization interface.
[0185] Based on the above embodiments, optionally, the first thread extracts simulation event information from the simulation event channel at a fixed frame rate, and renders and displays the extracted simulation event information in a browser visualization interface, including:
[0186] The first thread extracts target simulation event information from the simulation event channel; wherein, the simulation calculation timestamp included in the target simulation event information is no later than the current time indicated by the second clock, and the second clock is a virtual clock used to identify the browser's visual rendering progression sequence;
[0187] The first thread renders and displays the target simulation event information in the browser visualization interface, and then returns to advance the second clock at a fixed frame rate to extract new target simulation event information from the simulation event channel.
[0188] Based on the above embodiments, optionally, the first thread renders and displays the target simulation event information in a browser visualization interface, including:
[0189] According to the timing of the target simulation event information, the first thread renders the first visualization object based on the simulation calculation results included in each target simulation event information; wherein, the first visualization object is the visualization object corresponding to the simulation object whose state is updated in the simulation calculation results.
[0190] Based on the above embodiments, optionally, the first thread renders and displays the target simulation event information in a browser visualization interface, including:
[0191] The first thread performs interpolation rendering on the second visualization object based on the target simulation event information and the reference simulation event information; the reference simulation event information is simulation event information that is temporally adjacent to the target simulation event information, and the second visualization object is the visualization object in the target simulation event information that corresponds to the simulation object in the reference simulation event information that has a state change.
[0192] The technical solution of this invention, by acquiring the first data sent by the first thread, can accurately and timely obtain the topology and node parameter information of the scene to be simulated; by constructing the simulation model using the first simulation processing container in a second thread isolated from the first thread, the simulation model construction process can be completed on the browser side and run independently of the browser's visual interface, avoiding the simulation modeling operation from occupying interface rendering resources and preventing interface lag; at the same time, simulation modeling by running the first simulation processing container in the second thread can get rid of the dependence on dedicated workstations and local clients, reducing system deployment and maintenance costs, thereby supporting cross-terminal use; by executing simulation calculations directly in the browser's background thread through the first simulation processing container, without relying on remote cloud servers, the network transmission latency of instructions and data can be reduced, thereby achieving high-frequency and efficient event scheduling; in addition, core simulation data does not need to be uploaded to the external network, which can reduce the risk of data leakage and improve the security and stability of the simulation system; the first thread acquires simulation event information and renders it in real time on the browser's visual interface, enabling interaction between simulation calculation results and front-end display, improving the real-time performance and intuitiveness of the simulation process. Based on the above technical solution, by leveraging the multi-threaded isolation feature of the browser front-end, the simulation model is constructed and executed using a simulation processing container on the browser side, and the simulation results are displayed in real time. This solves the problem of balancing ease of use, real-time interactivity, and data security in industrial simulation, achieving lightweight, high real-time performance, and low latency industrial system simulation. It improves the versatility, real-time performance, and data security of the simulation system, and enhances the overall execution efficiency and engineering application capabilities of industrial system simulation.
[0193] The simulation processing apparatus provided in the embodiments of the present invention can execute the simulation processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0194] The acquisition, storage, use, and processing of data in this application comply with relevant national laws and regulations and do not violate public order and good morals.
[0195] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0196] Figure 11A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0197] like Figure 11 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0198] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0199] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods described above, such as simulation processing methods.
[0200] In some embodiments, the simulation processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the simulation processing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the simulation processing method by any other suitable means (e.g., by means of firmware).
[0201] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific reference products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0202] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0203] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0204] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0205] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as data servers), or computing systems that include switching components (e.g., application servers), or computing systems that include front-end components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such back-end, switching, or front-end components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0206] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0207] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 19, or installed from storage unit 18, or installed from ROM 12. When the computer program is executed by processor 11, it performs the functions defined in the methods of the embodiments of the present invention.
[0208] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the simulation processing method provided in any embodiment of this application.
[0209] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0210] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0211] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A simulation processing method, characterized in that, The method includes: Acquire first data, which is data sent by the first thread. The first data is used to indicate the topology of the simulation scene and the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface. Based on the first data, a first model is constructed through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for constructing the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a browser background execution thread; In response to a first instruction, the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction used to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps. The first thread acquires the simulation event information and renders and displays it in the browser's visualization interface based on the simulation event information.
2. The method according to claim 1, characterized in that, The first simulation processing container is constructed in the following manner: Create a second thread, which is used to run the first simulation processing container; The second thread is started, and the second simulation processing container is initialized to obtain the first simulation processing container. The first simulation processing container has a runtime environment that supports the assembly and operation of the simulation kernel, and the first simulation processing container has the ability to interact with the first thread across threads. A virtual file system is built in the runtime memory of the second thread, which is used to cache and manage algorithm package files; In response to the second instruction, at least one simulation algorithm package is obtained from the server or other content distribution node, the obtained simulation algorithm package is cached and mounted to the virtual file system, and the second instruction is an instruction initiated by the first thread to indicate the initialization of the simulation environment; Based on the simulation algorithm package mounted in the virtual file system, the corresponding simulation kernel is assembled in the first simulation processing container; Configure multiple first interfaces of the first simulation processing container, wherein the first interface is used to receive instructions from the first thread.
3. The method according to claim 1, characterized in that, Based on the first data, a first model is constructed using a first simulation processing container, including: The first data is parsed and instantiated using the compilation engine configured in the first simulation processing container to obtain a set of simulation objects and a first connection table. A first model is then constructed based on the set of simulation objects and the first connection table. The compilation engine is used to compile the data displayed in the browser visualization interface into data executable by the simulation kernel. The set of simulation objects includes all simulation objects in the scene to be simulated, and the first connection table is used to indicate the connection relationships between each simulation object.
4. The method according to claim 3, characterized in that, The first data is parsed and instantiated using the compilation engine configured in the first simulation processing container to obtain a set of simulation objects and a first connection relationship table. Based on the set of simulation objects and the first connection relationship table, a first model is constructed, including: Based on the preset semantic mapping table and the first data, a first mapping result is obtained. The first mapping result is used to indicate the simulation entity corresponding to each node indicated in the first data. Based on the first mapping result and the first data, first information is constructed. The first information is a structured data model that is independent of the front-end visualization format and the simulation kernel execution format, and is used to provide a structured description of each simulation entity and its corresponding associated parameter information. Based on the second information, third information is generated, wherein the second information is the parameter information associated with each node in the topology indicated by the first data, and the third information is the parameter information that the simulation kernel can execute. Based on the first information and the third information, a set of simulation objects is generated, wherein each simulation object in the set of simulation objects is used to represent a simulation entity after configuring the corresponding associated parameter information; Based on the first mapping result and the fourth information, a first connection relationship table is generated, wherein the fourth information is the topological structure of the simulation scene indicated by the first data, and the first connection relationship table is used to indicate the connection relationship between each simulation entity. The first model is constructed based on the set of simulation objects and the first connection relationship table.
5. The method according to claim 4, characterized in that, Based on the first mapping result and the fourth information, a first connection relationship table is generated, including: Based on the first mapping result, the entity category to which each simulation object belongs is determined. The entity category includes a first category and a second category. The first category is an entity category that does not have a transport or connection function, and the second category is an entity category that has a transport or connection function. Based on the entity category to which each simulation object belongs, a second connection table and a third connection table are generated according to the fourth information; the second connection table is used to indicate the connection relationship between simulation objects belonging to the first category, and the third connection table is used to indicate the connection relationship between simulation objects belonging to the second category.
6. The method according to claim 4, characterized in that, The method further includes: In response to a first operation, second data is obtained, wherein the first operation is a modification operation on the first data, and the second data is used to indicate the first data after being modified by the first operation; Based on at least one of the first information, the first connection relationship table, and the preset semantic mapping table, as well as the second data, the first model is reconstructed to obtain the second model.
7. The method according to claim 1, characterized in that, The first simulation processing container performs simulation calculations on the first model and generates simulation event information, including: Based on the discrete event mechanism, the first simulation processing container progressively advances the simulation calculation of the first model and generates corresponding simulation event information until it responds to the third instruction; wherein, the discrete event mechanism refers to a simulation control method that is driven by discrete events and advances the simulation calculation sequentially according to the occurrence sequence of discrete events, and the third instruction is an instruction used to control the first simulation processing container to stop performing simulation calculation on the first model.
8. The method according to claim 7, characterized in that, Based on the discrete event mechanism, the first simulation processing container progressively advances the simulation calculation of the first model and generates corresponding simulation event information, including: The first event is determined from the event set, and the first clock is advanced to the timestamp corresponding to the first event; the event set is used to store discrete events to be executed during the simulation process, the first event is the discrete event with the smallest timestamp in the event set, and the first clock is a virtual clock used to identify the timing of the simulation calculation. The first simulation processing container executes the first event and updates the running status of each simulation object in the first model; Based on the first event, the current time indicated by the first clock, and the updated running status of each simulation object in the first model, corresponding simulation event information is generated, and a second event is determined from the event set to continue the simulation calculation of the first model; wherein, the simulation calculation timestamp included in the simulation event information is the current time indicated by the first clock, and the second event is the discrete event with the smallest timestamp in the event set after removing the first event from the event set.
9. The method according to claim 1, characterized in that, The first thread acquires the simulation event information and renders and displays it in the browser's visualization interface based on the simulation event information, including: The second thread stores the simulation event information into the simulation event channel, which is used to realize the one-way transmission of simulation event information from the second thread to the first thread; The first thread extracts simulation event information from the simulation event channel at a fixed frame rate, and renders and displays the extracted simulation event information in the browser visualization interface.
10. The method according to claim 9, characterized in that, The first thread extracts simulation event information from the simulation event channel at a fixed frame rate, and renders and displays the extracted simulation event information in the browser visualization interface, including: The first thread extracts target simulation event information from the simulation event channel; wherein, the simulation calculation timestamp included in the target simulation event information is no later than the current time indicated by the second clock, and the second clock is a virtual clock used to identify the browser's visual rendering progression sequence; The first thread renders and displays the target simulation event information in the browser visualization interface, and then returns to advance the second clock at a fixed frame rate to extract new target simulation event information from the simulation event channel.
11. The method according to claim 10, characterized in that, The first thread renders and displays the target simulation event information in a browser visualization interface, including: According to the timing of the target simulation event information, the first thread renders the first visualization object based on the simulation calculation results included in each target simulation event information; wherein, the first visualization object is the visualization object corresponding to the simulation object whose state is updated in the simulation calculation results.
12. The method according to claim 10, characterized in that, The first thread renders and displays the target simulation event information in a browser visualization interface, including: The first thread performs interpolation rendering on the second visualization object based on the target simulation event information and the reference simulation event information; the reference simulation event information is simulation event information that is temporally adjacent to the target simulation event information, and the second visualization object is the visualization object in the target simulation event information that corresponds to the simulation object in the reference simulation event information that has a state change.
13. A simulation processing device, characterized in that, The device includes: The data acquisition module is used to acquire first data, which is data sent by the first thread. The first data is used to indicate the topology of the simulation scene and the parameter information associated with each node in the topology. The first thread is a thread used to carry out the operation of the browser visualization interface. The model building module is used to build a first model based on the first data through a first simulation processing container; wherein, the first model is a simulation model used to describe the scenario to be simulated and is executable by the simulation kernel, the simulation kernel is the execution entity that performs simulation calculations on the simulation model, the first simulation processing container is used to provide an independent running environment for building the simulation model and performing simulation calculations, the first simulation processing container runs on a second thread, and the second thread is isolated from the first thread, the second thread is a browser background execution thread; The simulation calculation module is used to respond to a first instruction, wherein the first simulation processing container performs simulation calculations on the first model and generates simulation event information. The first instruction is an instruction to control the first simulation processing container to perform simulation calculations on the first model. The simulation event information includes simulation calculation results and simulation calculation timestamps. The rendering and display module is used by the first thread to obtain the simulation event information and render and display it in the browser visualization interface based on the simulation event information.
14. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the simulation processing method according to any one of claims 1-12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the simulation processing method according to any one of claims 1-12.