Simulation process scheduling method and device and computer equipment
By using snapshot technology to save and restore the initial model state in the simulation model, the problem of slow and inefficient simulation model operation is solved, and the effect of accelerating simulation operation and efficient acquisition of results is achieved.
Patent Information
- Application Number
- CN202411538660.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-14
AI Technical Summary
In the field of real-time simulation modeling technology, the simulation model is huge in scale, the equipment initialization takes a long time, and the model runs slowly, which makes it take a long time to run to the expected state, and the efficiency of repeatedly simulation is inefficient in obtaining parameter values.
Through snapshot technology, the initial model state of the simulation model is determined when it is run, and snapshots are saved and restored according to the corresponding saving method of this state, and the simulation is directly started from a specific state to avoid time-consuming operations.
It achieves accelerated simulation operation speed, efficiently obtains correct simulation expected results, and improves the dynamic scheduling efficiency of the simulation process.
Smart Images

Figure CN119442664A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of simulation modeling, and in particular to a simulation process scheduling method, device and computer equipment. Background Art
[0002] In the field of real-time simulation modeling technology, simulation models in practical applications are often large in scale, and semi-physical simulation models involve multiple hardware devices. This will bring some problems, such as long device initialization time, slow model operation resulting in a long time to run to the expected state, the need for repeated simulations to obtain parameter values, which makes efficiency low, etc., and there is also the phenomenon that only a few simulations with different condition configurations can be run in a short period of time, which greatly consumes manpower and material resources. Therefore, how to efficiently and dynamically schedule the simulation process is a problem to be solved at this stage. Summary of the invention
[0003] Based on this, the purpose of this application is to use snapshot technology to enable the simulation model to quickly restore to a specific simulation state and start the simulation directly from a certain state. This can avoid a series of time-consuming operations, achieve the effect of "accelerating" the simulation running speed, and efficiently obtain the correct expected simulation results.
[0004] In a first aspect, the present application provides a simulation process scheduling method, including:
[0005] Determine the initial model state when the simulation model is running;
[0006] Performing a snapshot of the simulation model according to a saving method corresponding to the initial model state;
[0007] Determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run;
[0008] The simulation model is snapshot restored according to the target snapshot file so that the restored simulation model continues to run.
[0009] In one embodiment, a snapshot of the simulation model is saved in accordance with a saving method corresponding to the initial model state, including: when the initial model state is a running state, determining a current signal value of the simulation model in a current running step and a previous signal value of a previous running step; judging whether a preset trigger condition is met based on the current signal value and the previous signal value; if met, saving a snapshot of target data associated with the simulation model when it is running.
[0010] In one embodiment, a snapshot of the simulation model is saved according to a saving method corresponding to the initial model state, including: when the initial model state is a paused state, periodically determining whether there is a user-triggered instruction; if so, a snapshot of the target data associated with the simulation model when it is running is saved.
[0011] In one embodiment, the simulation model performs snapshot thread initialization before running; the target data includes state information and model data; a snapshot is saved for the target data associated with the simulation model when it is running, including: calling a snapshot save function, and storing the state information and model data of the simulation model when it is running in a linked list memory according to a preset target format; periodically polling the linked list through a child thread, and when the linked list is not empty, saving the data in the linked list to a snapshot file library.
[0012] In one embodiment, determining the candidate model state and the corresponding target snapshot file when the simulation model continues to run includes: when the candidate model state when the simulation model continues to run is a loading state, periodically judging through the main thread whether there is a snapshot recovery instruction; if so, obtaining the target snapshot file associated with the snapshot recovery instruction from the snapshot file library.
[0013] In one embodiment, snapshot recovery of the simulation model is performed according to the target snapshot file, including: determining a memory area in a linked list associated with the target snapshot file; parsing and splitting the target snapshot file according to a preset target format to obtain target state information and target model data; the target model data includes signal data and parameter data in the model; calling a snapshot recovery function, and overwriting the data in the memory area with the target model data to obtain a restored simulation model.
[0014] In one embodiment, after obtaining the restored simulation model, it also includes: responding to a trigger operation of the execution state, continuing to simulate the restored simulation model according to the target state information; the target state information includes simulation steps and time data.
[0015] In a second aspect, the present application also provides a simulation process scheduling device, including:
[0016] A snapshot saving module, used to determine the initial model state when the simulation model is running; and to save the simulation model in a snapshot according to the saving method corresponding to the initial model state;
[0017] The snapshot recovery module is used to determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run; and perform snapshot recovery on the simulation model according to the target snapshot file so that the restored simulation model continues to run.
[0018] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above simulation process scheduling method when executing the computer program.
[0019] In a fourth aspect, the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above simulation process scheduling method are implemented.
[0020] The above-mentioned simulation process scheduling method, device, computer equipment and readable storage medium can save a snapshot of the simulation model according to the saving method corresponding to the initial model state by determining the initial model state when the simulation model is running, and then determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run, and then perform snapshot recovery of the simulation model according to the target snapshot file, so that the restored simulation model continues to run. The present application makes the state management of the simulation model clearer by clearly saving or restoring snapshots of different model states, facilitates the effective tracking and management of different stages during the operation process, and can quickly perform snapshot recovery directly according to the target snapshot file, thereby achieving the effect of "accelerating" the simulation operation speed and efficiently obtaining the correct expected simulation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 An application environment diagram of a simulation process scheduling method in an embodiment;
[0022] Figure 2 A schematic diagram of a flow chart of a simulation process scheduling method in one embodiment;
[0023] Figure 3 A schematic diagram of the principle of a simulation process scheduling method in one embodiment;
[0024] Figure 4 A schematic diagram of a flow chart of a simulation process scheduling method in another embodiment;
[0025] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0027] The simulation process scheduling method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown, and through the interaction between the terminal 102 and the server 104. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 is used to determine the initial model state when the simulation model is running, and save the simulation model in a snapshot according to the saving method corresponding to the initial model state. The server 104 is also used to determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run, and snapshot restore the simulation model according to the target snapshot file, so that the restored simulation model continues to run and the running status is displayed on the terminal 102. Among them, the terminal 102 can be, but is not limited to, various personal computers, smart phones, tablet computers, drone equipment, smart vehicle-mounted equipment, portable wearable devices, etc. Server 104 is implemented by an independent server or a server cluster composed of multiple servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0028] Among them, snapshot represents a backup method, such as the state of a real-time simulation model at a specific point in time; saving a snapshot represents saving the state of the simulation model at a certain moment in some way, and can be restored to the state at this moment later; snapshot recovery represents the process of restoring the current simulation state to the state in the previously saved snapshot.
[0029] In one embodiment, Figure 2 As shown, a simulation process scheduling method is provided, which is applied to Figure 1 The computer equipment including the terminal and the server is used as an example to illustrate, including the following steps:
[0030] Step 202, determining the initial model state when the simulation model is running.
[0031] Among them, the terminal integrates simulation software running on the Windows desktop system, forming a simulation software system. Simulation software refers to software that provides functions such as simulation model development, model monitoring, and model operation management, such as simulink software. The lower computer corresponding to the server generally refers to a real-time operating system based on Linux, and the real-time simulation program associated with the simulation model runs on the lower computer.
[0032] Specifically, Figure 3 As shown, Figure 3The schematic diagram of the principle of a simulation process scheduling method. When the user issues snapshot-related instructions in the terminal operation simulation software, such as save snapshot instructions and restore snapshot instructions, the real-time simulation program running on the lower computer will respond to the relevant instructions to process the simulation model accordingly. Usually, the simulation model will have several states, such as unloaded, loaded, running, paused, etc. The switching of different model states can be controlled by the user trigger. After the simulation model is initially run, the computer device can determine the initial model state of the simulation model at any running time in real time. It is easy to understand that the initial model state at this time is usually a running state or a paused state.
[0033] Step 204 , saving a snapshot of the simulation model according to the saving method corresponding to the initial model state.
[0034] Specifically, the computer device is pre-configured with multiple snapshot saving methods in the simulation software. Figure 3 As shown, when the computer device determines that the initial model state is the running state, it determines that the corresponding saving method is associated with the preset trigger condition, that is, it is necessary to judge whether the signal value when the simulation model is running meets the trigger condition. Only when the trigger condition is met can the simulation model be snapshot saved. When the computer device determines that the initial model state is the paused state, it determines that the corresponding saving method is associated with the user trigger instruction. Only when there is a user trigger instruction can the simulation model be snapshot saved.
[0035] It is easy to understand that users can set operations according to preset trigger conditions. This flexibility and configurability enables computer equipment to adapt to different application scenarios and needs.
[0036] In one embodiment, the user uses the snapshot simulink module in advance when modeling in the simulation software, configures the trigger signal and trigger threshold included in the trigger condition, and specifies the way to trigger and save the snapshot, so that the model will automatically record the snapshot file if the trigger condition is met during the simulation operation. Among them, the triggering method of the trigger condition includes at least rising edge triggering, falling edge triggering, and edge triggering.
[0037] In one embodiment, reference Figure 3 As shown in the figure, after the simulation software is initialized, the computer device will automatically save a default initial state snapshot file for quickly restoring the initial state information or model state of the simulation model. Therefore, through the initial saved snapshot file, the simulation process can be quickly restored to the initial model state and restarted, avoiding a series of tedious and time-consuming initialization operations.
[0038] Step 206 , determining the candidate model states and corresponding target snapshot files when the simulation model continues to run.
[0039] Specifically, after the user operates the simulation software on the terminal of the computer device to save the snapshot of the simulation model, the simulation model needs to continue to run. When it is determined that the candidate model state when the simulation model continues to run is a loading state or a paused state, the simulation software can present an interface selection box, so that the user can directly select the target snapshot file to be restored in the interface selection box.
[0040] Step 208 , performing snapshot recovery on the simulation model according to the target snapshot file, so that the restored simulation model continues to run.
[0041] Specifically, the computer device parses and splits the target snapshot file according to a preset target format, and then overwrites the split values into the memory corresponding to the simulation model, so that the relevant target model data in the simulation model is replaced by the data in the target snapshot file, and the restored simulation model is obtained.
[0042] In the above simulation process scheduling method, by determining the initial model state when the simulation model is running, the simulation model can be snapshot saved according to the saving method corresponding to the initial model state, and then the candidate model state and the corresponding target snapshot file when the simulation model continues to run are determined, and the simulation model can be snapshot restored according to the target snapshot file, so that the restored simulation model continues to run. The present application makes the state management of the simulation model clearer based on clear snapshot saving or snapshot restoration of different model states, facilitates effective tracking and management of different stages during operation, and snapshot restoration can be quickly performed directly according to the target snapshot file, achieving the effect of "accelerating" the simulation running speed and efficiently obtaining the correct expected simulation results.
[0043] In one embodiment, a snapshot of the simulation model is saved in accordance with a saving method corresponding to the initial model state, including: when the initial model state is a running state, determining a current signal value of the simulation model in a current running step and a previous signal value of a previous running step; judging whether a preset trigger condition is met based on the current signal value and the previous signal value; if so, saving a snapshot of target data associated with the simulation model when it is running.
[0044] Specifically, when users use snapshot simulink modules in simulation software, they need to select the trigger mode and configure the trigger signal and trigger value. Figure 3As shown, when the computer device determines that the initial model state is the running state, it is necessary to determine whether to save the snapshot after each running step, so it is necessary to determine the current signal value of the simulation model in the current running step and the previous signal value of the previous running step. For example, when the trigger mode is rising edge trigger and the trigger value is A, if the current signal value is greater than the trigger value A and the previous signal value is less than the trigger value A, it is considered that the preset trigger condition is met, and the flag will be set to notify and trigger the snapshot save.
[0045] In this embodiment, it supports customizing the timing of saving snapshots during modeling. Through precise signal threshold triggering, data can be saved efficiently when the trigger conditions are met, and simulation can be started directly from this state later, which can save a lot of time when the model is large. This real-time monitoring and response mechanism can ensure that actions are taken immediately when the conditions are met, thereby improving response speed and timeliness of processing.
[0046] In one embodiment, a simulation model is snapshot saved according to a saving method corresponding to the initial model state, including: when the initial model state is a paused state, periodically determining whether there is a user-triggered instruction; if so, a snapshot is saved of target data associated with the simulation model when it is running.
[0047] Specifically, refer to Figure 3 As shown, when the computer device determines that the initial model state is a paused state, it periodically determines whether the user has issued a user trigger instruction to save a snapshot from the simulation software of the terminal, that is, when the user clicks Save Snapshot in the simulation software in the simulation paused state, the computer device saves a snapshot of the target data associated with the simulation model when it is running.
[0048] In this embodiment, user-triggered instructions can flexibly ensure that data is saved at key time points, thereby improving user experience, and when the initial model is in a paused state, the model can respond quickly and perform related operations without actively consuming computing resources, which helps save system resources.
[0049] In one embodiment, a target template (such as a TLC template) is used in a computer device to implement snapshot-related functions. During code generation, the simulation software will call the TLC template to generate corresponding snapshot codes. The snapshot codes, for example, provide snapshot initialization functions, snapshot custom data registration functions, snapshot save functions, snapshot restore functions, and deinitialization functions. Therefore, in order to facilitate the acquisition of simulation model-related data, the computer device calls different functions to decouple the snapshot code from the simulation model code as much as possible.
[0050] The snapshot initialization function is used to initialize the linked list, calculate the data size, and create a thread to handle the task of writing the snapshot file. The snapshot custom data registration function is used to save the S-Funcion data of the simulink custom module and other user-defined data. The function will add the incoming parameter address to the global linked list.
[0051] In one embodiment, a snapshot is saved for target data associated with the simulation model during runtime, including: calling a snapshot save function, and storing the runtime status information and model data of the simulation model in a linked list memory in accordance with a preset target format; periodically polling the linked list through a child thread, and when the linked list is not empty, saving the data in the linked list to a snapshot file library.
[0052] The simulation model is initialized with a snapshot thread before running; the target data includes state information and model data. The state information includes simulation steps, time data TimingData, DWork data and ModelData data; the model data includes signal data rtB, parameter data rtP, state data rtX of continuous modules, S-Funcion data, and other custom data in the model.
[0053] Specifically, if a snapshot needs to be saved, the snapshot saving function is called to save the state information and model data of the simulation model during runtime to the specified memory in the agreed format, and then the block of memory is added to the linked list. Since the snapshot saving function is the core of the tlc template file, the computer device clears the memory allocated for copying data during initialization, and copies the signal data rtB, parameter data rtP, and state data rtX of the continuous module in the model to the memory. Then the function in the tlc template is called to filter out the time data and copy it to the specified memory, filter out the ModelData data and copy it to the specified memory, and filter out the DWork data and copy it to the specified memory. The computer device traverses the custom data linked list, copies the S-Funcion data and other custom data to the specified memory in turn, and saves the simulation steps and the state of the time point in the data recording; creates a new linked list node, and copies the data in the above memory to the global linked list through the node. The child thread created when the snapshot is initialized polls the linked list at a certain time interval. If the linked list is not empty, the data in the linked list is taken out and written to the specified snapshot file library.
[0054] In this embodiment, by using a child thread to perform periodic polling of the linked list, it is ensured that the snapshot saving operation does not block the operation of the main thread. This asynchronous processing method can significantly improve the response speed and overall performance of the system. Storing the state information and model data of the simulation model during runtime in the memory of the linked list instead of directly writing to the file can reduce frequent disk I / O operations, thereby optimizing memory usage and reducing system load. The flexibility of the linked list also makes the dynamic adjustment and processing of data more efficient.
[0055] In one embodiment, after the simulation model receives the reset instruction, the simulation software will download all snapshot files in the lower computer to the local computer.
[0056] In one embodiment, a user can customize the name of a snapshot file in the snapshot file library.
[0057] In one embodiment, Figure 4 As shown, Figure 4 The flowchart of the simulation process scheduling method in another embodiment is shown. The simulation model is started to run through the simulation program; the snapshot initialization function is called to initialize the snapshot thread, and the default initial state snapshot file is saved; the initial model state of the simulation model when running is determined; when the initial model state is a paused state, it is periodically determined whether there is a user trigger instruction, if so, the snapshot save function is called, and the target data of the simulation model is stored in the memory and added to the linked list. When the initial model state is a running state, it is determined whether the snapshot needs to be saved after each step of running, and if so, the snapshot save function is called, and the target data of the simulation model is stored in the memory and added to the linked list. The linked list is periodically polled by the child thread initialized by the snapshot thread, and when the linked list is not empty, the data in the linked list is saved to the snapshot file library.
[0058] In one embodiment, determining the candidate model state and the corresponding target snapshot file when the simulation model continues to run includes: when the candidate model state when the simulation model continues to run is a loading state, periodically judging whether there is a snapshot recovery instruction through the main thread; if so, obtaining the target snapshot file associated with the snapshot recovery instruction from the snapshot file library.
[0059] The main thread represents a thread that executes the snapshot recovery and snapshot saving processes; the aforementioned sub-thread represents a thread that stores the data in the linked list after the thread is initialized.
[0060] Specifically, when the state of the candidate model is in a loading state or a paused state while the simulation model continues to run, the main real-time thread polls at a certain time interval to determine whether there is a task to restore the snapshot, that is, the user selects the generated snapshot restoration instruction through the interface selection box. If there is a task to restore the snapshot, the computer device obtains the target snapshot file associated with the snapshot restoration instruction from the snapshot file library.
[0061] In this embodiment, the system can be restored to the previous accurate state through snapshot file recovery, avoiding re-running the simulation from the beginning, saving time and computing resources. In addition, periodic inspection and automatic acquisition of target snapshot files from the snapshot file library and recovery reduce the need for manual intervention and improve the automation and operation efficiency of the system.
[0062] In one embodiment, a simulation model is snapshot restored according to a target snapshot file, including: determining a memory area in a linked list associated with the target snapshot file; parsing and splitting the target snapshot file according to a preset target format to obtain target state information and target model data; calling a snapshot recovery function, and overwriting the data in the memory area with the target model data to obtain a restored simulation model.
[0063] The target model data includes signal data rtB, parameter data rtP, state data rtX of continuous modules, S-Funcion data, other custom data, etc. The snapshot recovery function is similar to the reverse process of the snapshot save function.
[0064] Specifically, the computer device reads the content in the target snapshot file, copies the target state information and the target model number to the address of the memory area corresponding to the simulation model data, and restores the state of the time point in the data recording. The computer device calls the snapshot recovery function, overwrites the data in the memory area with the target model data, and obtains the restored simulation model. Therefore, by determining the memory area associated with the target snapshot file in the linked list, it can ensure that the snapshot information is accurately mapped to the corresponding memory location, thereby achieving accurate state recovery and avoiding erroneous overwriting or data loss. Processing the target state information and the target model data separately can more flexibly respond to different types of snapshot files and recovery requirements, and facilitate future expansion and modification.
[0065] In one embodiment, after obtaining the restored simulation model, the method further includes: responding to a trigger operation of the execution state, continuing to simulate the restored simulation model according to the target state information.
[0066] The target state information includes simulation steps and time data. When the user triggers the model state to change the simulation model to the execution state, the restored simulation model will continue the new simulation process in combination with the target state information.
[0067] In one embodiment, the computer device can save the target state information of the model under different parameter configuration conditions, compare the differences in simulation results under different parameter configurations, and quickly obtain the expected results of the simulation.
[0068] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0069] Based on the same inventive concept, the embodiment of the present application also provides a simulation process scheduling device for implementing the simulation process scheduling method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more simulation process scheduling device embodiments provided below can refer to the limitations of the simulation process scheduling method above, and will not be repeated here.
[0070] In one embodiment, a simulation process scheduling device is provided, including: a snapshot saving module and a snapshot restoring module, wherein:
[0071] The snapshot saving module is used to determine the initial model state when the simulation model is running; and to save the simulation model in a snapshot according to the saving method corresponding to the initial model state.
[0072] The snapshot recovery module is used to determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run; the simulation model is snapshot restored according to the target snapshot file so that the restored simulation model continues to run.
[0073] Each module in the above simulation process scheduling can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0074] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store snapshot files. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a simulation process scheduling method is implemented.
[0075] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0076] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0077] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0078] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0079] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0080] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0081] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A simulation process scheduling method, characterized in that: The method comprises: Determine the initial model state when the simulation model is running; Performing a snapshot of the simulation model according to a saving method corresponding to the initial model state; Determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run; The simulation model is snapshot restored according to the target snapshot file so that the restored simulation model continues to run.
2. The method according to claim 1, characterized in that The step of performing a snapshot of the simulation model according to the storage method corresponding to the initial model state includes: When the initial model state is the running state, determining the current signal value of the simulation model in the current running step and the previous signal value of the previous running step; Determining whether a preset trigger condition is met according to the current signal value and the previous signal value; If the conditions are met, a snapshot of the target data associated with the simulation model when it is running is saved.
3. The method according to claim 1, characterized in that The step of performing a snapshot of the simulation model according to the storage method corresponding to the initial model state includes: When the initial model state is a pause state, periodically determining whether there is a user trigger instruction; If so, a snapshot of the target data associated with the simulation model when it is running is saved.
4. The method according to claim 2 or 3, characterized in that: The simulation model performs snapshot thread initialization before running; the target data includes state information and model data; The step of saving a snapshot of target data associated with the simulation model during runtime includes: Calling a snapshot saving function, and storing the state information and model data of the simulation model during runtime in the memory of the linked list respectively according to a preset target format; The linked list is periodically polled through a child thread, and when the linked list is not empty, the data in the linked list is saved to a snapshot file library.
5. The method according to claim 1, characterized in that The determining of the candidate model states and the corresponding target snapshot files when the simulation model continues to run includes: When the candidate model state is in the loading state while the simulation model continues to run, the main thread periodically determines whether there is a snapshot recovery instruction; If it exists, the target snapshot file associated with the snapshot recovery instruction is obtained from the snapshot file library.
6. The method according to claim 1, characterized in that The performing snapshot recovery on the simulation model according to the target snapshot file comprises: Determine a memory area in a linked list that is associated with the target snapshot file; Parsing and splitting the target snapshot file according to a preset target grid to obtain target state information and target model data; the target model data includes signal data and parameter data in the model; A snapshot recovery function call is performed, and the target model data overwrites the data in the memory area to obtain a restored simulation model.
7. The method according to claim 6, characterized in that After obtaining the restored simulation model, the method further includes: In response to the triggering operation of the execution state, the simulation model after the restoration is continued to be simulated according to the target state information; the target state information includes the number of simulation steps and time data.
8. A simulation process scheduling device, characterized in that: The device comprises: A snapshot saving module, used to determine the initial model state when the simulation model is running; and to save the simulation model in a snapshot according to the saving method corresponding to the initial model state; The snapshot recovery module is used to determine the candidate model state and the corresponding target snapshot file when the simulation model continues to run; and perform snapshot recovery on the simulation model according to the target snapshot file so that the restored simulation model continues to run.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.