A backtracking multi-branch parallel simulation system, method, device and medium
By creating new simulation branches and continuation states during simulation playback, the problem that traditional recording playback cannot derive new simulation processes is solved, and the combination of multi-branch parallel simulation is realized, meeting the simulation needs in complex scenarios.
Patent Information
- Application Number
- CN202510370725.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-03-27
AI Technical Summary
Traditional recording playback cannot create new branches during playback, resulting in the inability to derive new simulation processes and cannot meet the simulation needs in complex scenarios.
A backtracking multi-branch parallel simulation system is designed, including a result data recording module, a result data playback module, a process data recording module and a snapshot restoration module, to create a new simulation branch during the playback process, continue the state and carry out a new simulation process in parallel.
It solves the problem that traditional recording and playback methods can only playback as it is and cannot continue to create a new process of simulation, and realizes the combination of historical playback and new simulation process, meeting more simulation application needs.
Smart Images

Figure CN119903676B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of simulation, and particularly relates to a backtracking multi-branch parallel simulation system, method, device and medium. Background Art
[0002] The function of recording the simulation process and replaying it has key value in many fields. In the research and development of new unmanned aerial vehicles, a prototype simulation system is constructed according to the design scheme, tests are designed according to technical indicators, simulation flight tests are carried out and data are recorded. By replaying and analyzing the design effect and improving parameters, and iterating repeatedly, design problems can be discovered and solved before trial production, saving time and economic costs. In the field of aircraft pilot training, trainees operate on a flight simulator, record the flight process, replay and analyze the accuracy of control actions and the rationality of flight data, and compare with standard data to correct errors and improve the control level.
[0003] Although the above traditional recording and replaying can meet the basic replaying requirements, there are significant defects. Each replaying process and details are exactly the same, it does not support the branching function and cannot derive new simulation processes. This is because the traditional recording and replaying stores the output results of each frame, lacks the intermediate process data for restoring the scene, and cannot reproduce the "scene" state of the simulation, not meeting the data continuity required for the deduction of mathematical simulation models.
[0004] In actual use, the traditional recording and replaying function often fails to meet the needs. For example, when a flight school uses a flight simulator for teaching, trainees need to control multiple flight states simultaneously, and the operation is complex. The instructor analyzes the trainees' technical actions through traditional replaying. After finding improper operations, the trainees need to fly again to test the correction effect. However, the traditional replaying cannot create new branches during the replaying process. When the trainees "fly again", since the two operations cannot be exactly the same, it is difficult to accurately restore the wrong flight state, resulting in the instructor's correction method may not be applicable and it is difficult to verify the correction effect.
[0005] In addition, when using the traditional recording and playback function, there will be some other situations that cannot meet the needs. For example, when flight cadets simulate flying an aircraft, they need to control multiple states such as speed, altitude, heading, landing gear, and flaps simultaneously. This requires a high level of energy allocation and strong operation complexity. The flight instructor usually relies on the traditional recording and playback function of the flight simulator to analyze and correct the cadets' technical movements. There are often such teaching scenarios: the instructor finds that the cadet's operation is incorrect, first explains through playback, points out which action is incorrect and how it should be done. As mentioned before, the traditional simulation recording and playback can only reproduce and does not support creating new branches during playback. Therefore, the cadet needs to fly again to check whether the incorrect actions have been truly corrected and develop correct operating habits through repeated training. The previous simulators were not perfect enough in terms of function support in this regard, which was manifested in the process of the cadet "flying again". The flight operations of taking off and landing are complex, and it is impossible for two manual operations to be exactly the same. Therefore, it is very difficult to accurately restore the flight state where the first error occurred during the second flight. Then, the correction method for the first operation by the instructor is likely to be inapplicable during the second flight, resulting in the difficulty of verifying the correction effect. All such problems are ultimately caused by the defects of the traditional simulation recording and playback. In view of the above problems, the existing technology urgently needs to be improved. Summary of the Invention
[0006] The traditional recording and playback has only one main branch and does not support creating new branches and continuing the simulation state, which cannot meet the usage needs of the situations described above. The purpose of the present invention is to provide a backtracking multi-branch parallel simulation system, method, device and medium, which can create new simulation branches during the simulation playback process, continue the state and carry out a new simulation process in parallel. Through the present invention, multi-branch parallel simulation backtracking can be realized, the problem that the traditional recording and playback method cannot continue the simulation is solved, the original function is extended, and it is a new simulation playback method that combines parallel simulation and historical playback.
[0007] The present invention is implemented as follows: A backtracking multi-branch parallel simulation system includes a result data recording module, a result data playback module, a process data recording module and a snapshot restoration module, which realizes the combination of simulation playback and continued parallel simulation;
[0008] The result data recording module records the simulation output results of each frame, reserves data for playback, reads the data of each simulation output result from the memory variables for each frame, writes them into the result record file A in sequence, and saves them to the disk;
[0009] The result data playback module realizes the playback of simulation results. When playback is required, it opens the result record file A, reads the content frame by frame from the file according to the storage order of the variables, and assigns values to the corresponding result variables in the simulation software to realize the result playback function;
[0010] The process data recording module records the intermediate data of each frame in the simulation process, reserves data for snapshot restoration during playback to enable the opening of parallel simulation branches, reads the intermediate data of each simulation process from memory variables for each frame, writes them into the process record file B in sequence, and saves it to the disk;
[0011] The snapshot restoration module realizes the restoration of the memory data of the simulation software, and immediately switches the simulation state to the historical state at the moment when the branch point is created. When a new simulation branch needs to be created, the previously saved process record file B is opened, the data of the frame to be read is retrieved and located according to the time correspondence relationship, and it is read out in the order when the variables are written, and then assigned to the corresponding intermediate variables in the simulation software at one time to achieve snapshot restoration.
[0012] The result data recording module records the simulation results frame by frame in chronological order into the result record file A, and the content recorded in the result record file A is the data sequence of the simulation results output for each frame.
[0013] The recording process in the result data recording module is carried out frame by frame, and each time a record is made, the state data of the current frame is added to the end of the result record file A.
[0014] The result data playback module reads the recorded data from the file A of the result data recording module and replays the simulation results frame by frame.
[0015] A method for retrospective multi-branch parallel simulation using the described system includes the following steps:
[0016] Step 1: During the intermediate process of playing back the result record file A, select to enable the branch parallel simulation function according to the usage needs. The playback time point corresponding to enabling this function is the time point P for creating a new branch parallel simulation;
[0017] Step 2: Select the time point P at the Nth second in the result record file B, read all the recorded data of that frame at one time, and then assign it to the corresponding variables in the simulation software to achieve instant snapshot restoration of the simulation state;
[0018] Step 3: Starting from the snapshot restoration moment, with the state at the snapshot restoration moment as the starting point, execute the real-time simulation process on the new simulation branch. At this time, the newly created simulation branch becomes the main branch and can be used for simulation recording and playback again, and so on in a loop.
[0019] A device includes:
[0020] One or more processors;
[0021] One or more memories;
[0022] A display screen; the one or more memories store one or more programs, and the one or more programs include instructions which, when executed by the one or more processors, cause the device to execute the described method.
[0023] A readable storage medium, on which a program is stored, and when the program is executed by a device, the computer is enabled to implement the described method.
[0024] Advantages of the present invention: The present invention can organically combine the traditional recording and playback with the multi-branch parallel simulation function, not only retaining the original function but also expanding new functions. Recording and playback of the simulation process are the original functions; generating new branches during the playback process and continuing the state for a new simulation process are the newly added functions. The present invention solves the problem that the traditional recording and playback method can only play back as it is and cannot continue the simulation to create a new process, so that the historical playback and the creation of a new simulation process can be combined to meet more simulation application requirements. Description of the Drawings
[0025] Figure 1 is the workflow of the conventional method in the recording stage;
[0026] Figure 2 is the workflow of the conventional method in the playback stage;
[0027] Figure 3 is the main structural logic of a backtracking multi-branch parallel simulation method provided by the present invention;
[0028] Figure 4 is the workflow of the present invention in the recording stage;
[0029] Figure 5 is the workflow of the present invention in the playback and multi-branch parallel simulation stage. Detailed Description of the Invention
[0030] The following will clearly and completely describe the technical solutions in the present application with reference to the drawings in the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the present application to be protected, but only represents the selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.
[0031] This application aims to solve the problem that in the traditional simulation recording and playback process, new branches cannot be created during playback, resulting in the inability to derive new simulation processes. Through the mutual cooperation of the result data recording module, the result data playback module, the process data recording module, and the snapshot restoration module, the function of creating new branches during playback is realized.
[0032] Although traditional simulation recording and playback can meet basic playback requirements, it has significant limitations. That is, each playback process and details are exactly the same, it does not support the branch function, and new simulation processes cannot be derived. This is because traditional simulation recording and playback only stores the output results of each frame, lacking the intermediate process data for restoring the scene, unable to reproduce the "scene" state of the simulation, and not meeting the data continuity requirements for the deduction of mathematical simulation models. For example, during the teaching process in a flight school, students need to repeatedly perform complex flight operations. The instructor analyzes the students' technical movements through traditional playback. After finding improper operations, the students need to fly again to test the correction effect. However, since the two operations cannot be exactly the same, it is difficult to accurately restore the error flight state, resulting in the instructor's correction method may not be applicable and it is difficult to verify the correction effect.
[0033] A retrospective multi-branch parallel simulation system of this application includes a result data recording module, a result data playback module, a process data recording module, and a snapshot restoration module, realizing the combination of playback and continuous parallel simulation. The result data recording module records the simulation output results of each frame and writes them into the result record file A in sequence, ensuring sufficient data reserves for playback. The result data playback module reads the data from the result record file A frame by frame to realize the playback of the simulation results. The process data recording module records the intermediate data of each frame of the simulation process and writes them into the process record file B in sequence to reserve data for the snapshot restoration module. The snapshot restoration module realizes the instantaneous restoration of the simulation state by reading the data in the process record file B, enabling the simulation state to switch to the historical state at the branch creation point.
[0034] In the specific implementation, the result data recording module is responsible for recording the simulation output results to ensure sufficient data reserves for playback. The result data playback module is responsible for reading the data from the result record file A and assigning it to the corresponding result variables in the simulation software to realize the playback of the simulation results. The process data recording module records the intermediate data of the simulation process, reserves data for opening parallel simulation branches during playback, and saves it to the process record file B. The snapshot restoration module realizes the instantaneous restoration of the simulation state by reading the data in the process record file B, enabling the simulation state to switch to the historical state at the branch creation point.
[0035] Through the cooperation of these technical features, this application solves the problem that new branches cannot be created during the traditional simulation record playback process, and realizes the combination of playback and continuous parallel simulation. For example, during the teaching process in a flight training school, the instructor can directly create a new branch during the playback process, and the trainee can perform corrective operations in the same error state to ensure that the instructor's corrective method is applicable and the corrective effect can be verified.
[0036] The backtracking multi-branch parallel simulation system proposed in this application realizes the function of creating new branches during playback through the coordinated work of the result data recording module, the result data playback module, the process data recording module, and the snapshot restoration module, breaking through the limitations of traditional simulation record playback, and providing a more flexible and efficient simulation record playback method.
[0037] Furthermore, this application also proposes that the result data recording module records the results of the simulation frame by frame in chronological order into the result record file A, and the content recorded in the result record file A is the data sequence of the simulation results output for each frame.
[0038] The technical features include the result data recording module and the result record file A. The result data recording module records the simulation results frame by frame in chronological order to ensure the consistency of data order. The result record file A stores the data sequence of the simulation results for each frame. By recording the simulation results frame by frame in chronological order, the problem of inconsistent data order is solved.
[0039] The result data recording module can be implemented in various ways. For example, the result data recording module can adopt a memory buffer-based method, first temporarily store the simulation results in memory, and then write them into the result record file A frame by frame in chronological order. This can improve the efficiency of data writing and reduce frequent disk operations. Another implementation method is to directly write the simulation results of each frame into the result record file A in real time, which can ensure the real-time nature of the data, but may increase the disk I / O burden. In addition, the result record file A can adopt a text format, a binary format, or other suitable data storage formats for subsequent data reading and processing.
[0040] This application records the simulation results frame by frame in chronological order through the result data recording module, ensuring the consistency of data order and solving the problem of inconsistent data order in traditional methods. Compared with the prior art, this application provides a more reliable and efficient data recording method, improving the accuracy and usability of the simulation results.
[0041] Furthermore, the present application also proposes that the recording process in the result data recording module is carried out frame by frame, and each time a record is made, the RemStruct data of the current frame is added to the end of the result record file A. Among them, RemStructs is a data structure composed of all intermediate variables arranged in a fixed order.
[0042] The result data recording module records the simulation process data frame by frame, and each time a record is made, the RemStruct data of the current frame is added to the end of the result record file A, which ensures the integrity and continuity of the simulation process data. By recording frame by frame, the system can effectively manage and store the simulation data, avoid data loss or misalignment, and thus provide accurate and complete data support when playback or analysis is required. The present application solves the problem of how to efficiently record the simulation process data and ensure data integrity in a backtracking multi-branch parallel simulation system by recording the RemStruct data frame by frame and adding it to the end of the result record file A. This technical means ensures the orderly storage of each frame of data, enables the accurate reproduction of the simulation data during playback and analysis, and improves the reliability and practicality of the system.
[0043] Furthermore, the RemStruct data can include various state information and result data generated during the simulation process, such as parameters like position, speed, and acceleration. Each time a record is made, the RemStruct data of the current frame is serialized and appended to the end of the result record file A. As a preferred implementation manner, the result record file A can be stored in a binary format to improve the efficiency of data storage and reading. During the recording process, a file lock mechanism can be adopted to ensure the atomicity of data writing and avoid data competition problems in a multi-threaded environment.
[0044] Thus, by recording the RemStruct data of the current frame frame by frame and adding it to the end of the result record file A, the present application not only ensures the integrity and continuity of the simulation data, but also improves the efficiency of data storage and management. Compared with the traditional recording method, this technical solution avoids data loss and misalignment problems, enables the accurate reproduction of the simulation data during playback and analysis, and improves the reliability and practicality of the system.
[0045] Furthermore, the present application also proposes that the result data playback module reads the recorded data from file A of the result data recording module and replays the simulation results frame by frame.
[0046] The result data recording module records the simulation output results and stores them in File A. The result data playback module reads the recorded data from File A and plays back the simulation results frame by frame. In this way, the problem that the simulation results cannot be played back frame by frame in the traditional recording and playback process is solved, making the playback of the simulation results more accurate and controllable, and better meeting the needs of different fields for the analysis and optimization of simulation results.
[0047] The implementation methods of the result data recording module and the result data playback module can be various. Specifically, the result data recording module can obtain the simulation output results of each frame in real time by calling the API interface of the simulation software, and write these results into File A in chronological order. The result data playback module can read the data in File A and transfer the data to the simulation software frame by frame in chronological order, so as to realize the frame-by-frame playback of the simulation results. As a preferred implementation manner, the result data playback module can set a buffer to avoid jamming caused by inconsistent data reading speeds during playback. Further, the result data playback module can also provide functions such as fast forward and fast rewind, so that users can more flexibly control the playback process of the simulation results.
[0048] By selecting to enable the branch parallel simulation function during playback, the problem that traditional simulation recording and playback cannot create new branches is solved. This method uses the snapshot restoration technology to switch the simulation state to the historical state of the newly created branch point, realizing the instant restoration of the simulation state. By selecting the time point P in the playback result record file A and combining the snapshot restoration function of the result record file B, the internal state of the simulation system can be accurately restored, a new simulation branch can be generated, and real-time simulation recording and playback can be carried out starting from this point. This technical solution supports multi-branch parallel simulation through iterative loops, overcoming the defect that traditional technologies cannot perform branch simulation because they cannot restore the internal state of the simulation system.
[0049] Specifically, the method of this application includes the following steps: During the intermediate process of the playback result record file A, select to enable the branch parallel simulation function according to the usage needs. The playback time point corresponding to enabling this function is the time point P of the newly created branch parallel simulation. Select the time point P of the Nth second in the result record file B, read all kinds of recorded data of that frame at one time, and then assign them to the corresponding variables in the simulation software to realize the instant snapshot restoration of the simulation state. Starting from the snapshot restoration moment, with the state at the snapshot restoration moment as the starting point, execute the real-time simulation process on the new simulation branch. At this time, the newly created simulation branch becomes the main branch, and simulation recording and playback can be carried out, and so on in a loop.
[0050] In the implementation process, the enabling of the branch parallel simulation function can be triggered by a selection operation in the user interface or automatically triggered by preset conditions. The realization of the snapshot restoration function depends on the full recording of the intermediate data during the simulation process. These data are stored in the process record file B and organized in chronological order. During snapshot restoration, by locating the time point P, the corresponding RemStruct record data can be quickly retrieved and loaded into the simulation software at one time. The execution of the real-time simulation process is based on the calculation logic of the simulation model, starting from the state of snapshot restoration, generating new simulation branches and recording them. As a preferred implementation method, during the execution of real-time simulation, multi-threading technology can be used to achieve the parallel operation of the main branch and the new branch, improving the efficiency and flexibility of the simulation.
[0051] The present invention fundamentally solves the problems mentioned in the background art. Here, "backtracking" means that the flight process records can be traced back. "Multi-branch" means that multiple different simulation processes can be supported. "Parallel simulation" means that new branch simulation processes can be created at any point during the playback process as needed. Compared with the original recording process, although the new simulation process has the same initial state, it can have a completely different development and evolution process and different results, just like time going back to historical time, allowing users to make new choices and operations again, so that they can "correct mistakes". The basic principle of the present invention is to record the intermediate state data of the simulation process, so that the historical state of the internal data of the simulation system can be fully restored during the playback process, enabling seamless connection and transition, and evolving different simulation processes and results according to new inputs, thus overcoming the defects of traditional recording and playback methods.
[0052] Traditional simulation records only record the result data of each frame output, while the backtracking multi-branch parallel simulation method described in the present invention needs to additionally record the intermediate state data. Specifically, if the value of a variable is affected by the previous simulation result, then such a variable is called a process variable. For example, the current position of the aircraft is represented by P, and the mathematical model is P = P0 + V × dt, where P0 is the position of the aircraft in the previous frame, V is the aircraft speed, and dt is the simulation step size. Here, P is a process variable, and its value is affected by the position P0 of the aircraft in the previous frame; similarly, V is also a process variable, V = V0 + a × dt, where V0 is the aircraft speed in the previous frame, a is the aircraft acceleration, and dt is the simulation step size.
[0053] The present invention arranges all intermediate variables in a fixed order to form a data structure, denoted as RemStruct, and records the content of this RemStruct structure for each frame, that is, records the process data. The replay process design of the present invention is also different from the traditional one: before a new branch is created, the traditional replay method is executed, that is, the result data of each frame is replayed; when a new branch is created, the recorded intermediate variables are used to overwrite the corresponding current variables to achieve the "snapshot restoration" effect, and then the replay is stopped and the normal simulation process is resumed, thus creating a new parallel simulation branch. The new parallel simulation branch can also be recorded and replayed, and branches can be created on the branch, thus forming a progressive backtracking multi-branch parallel simulation.
[0054] After adopting the method of the present invention, the above example will be better solved in the following way:
[0055] Record the process of the first simulated flight, including process data and result data. During the replay process, select a time point before the operation error occurs as the branch point, load the process data of this point recorded previously and hand over the control right to the flight cadet, that is, create a new parallel simulation branch. At the branch point, the flight scene is completely restored, the internal state of the simulator is continuous, the flight cadet takes over the control of the simulator, and the effect of the corrective action can be verified on the parallel simulation branch, and this can be repeated many times. This method overcomes the defects of the traditional method and brings two benefits at the same time: one is that it can accurately restore to the previous simulation state, and the other is that it saves the long process of repeated flight before reaching the branch point and saves time.
[0056] The main structural logic of the method used in the present invention is as Figure 3 shown. AO is the original replay process. A is the first branch point, which is in the traditional replay process. At point A, parallel simulation branches AC, AF, and AH are generated respectively. Its meaning is: starting from the same state point A, three different simulation operation processes are attempted and different results are obtained. On the AC branch, a parallel simulation branch ABE is created; progressively, on the ABE parallel simulation branch, a parallel simulation branch ABDK is further differentiated. Similarly, on the AH parallel simulation branch, a parallel simulation branch AGJ is generated. Each of the above branches represents a new evolution process generated by its divergence from the main trunk. Each evolution process corresponds to a new attempt that can trace back to the past. For example, in the simulated flight landing training described above, it represents multiple simulated landing trainings. The so-called "multi-branch" means that on a newly opened parallel simulation branch, new parallel simulation branches can be opened again, layer by layer. This method of creating branches on branches is called "multi-branch", which is similar to the branch structure style of a tree from the root to each treetop. Therefore, the inventor names this simulation method "backtracking multi-branch parallel simulation".
[0057] The present invention is mainly applied to the simulation of the movement process of objects, such as airplanes, drones, ships, etc., and can additionally provide a retrospective multi-branch parallel simulation recording and playback function. Taking the typical application of the present invention on a flight simulator as an example, combined with the accompanying drawings, the specific implementation method will be described in detail as follows.
[0058] A flight simulator is a flight training device fixedly installed on the ground, which can provide a simulated aircraft cockpit hardware operation environment, virtually generate the out-of-cockpit flight visual effects with software, solve the aircraft mathematical simulation model with computer software, and can output flight state information in real time to simulate the flight process. It has the advantages of economy, high efficiency, and safety, and is widely used in pilot flight skill training.
[0059] The flight simulator has a traditional recording and playback function, and its main purpose is to conduct flight reviews by looking back afterwards. When it is found that the trainee has improper operation behaviors, it is usually corrected by flying again. This method has the following disadvantages:
[0060] The incorrect flight operations are generated under specific flight state conditions and environmental conditions. It is very difficult to completely reproduce the previous state and environment by manually flying again. It is very likely that the conditional factors that caused the incorrect operation are not available, resulting in the non-occurrence of the previous incorrect operation, and thus there is no way to conduct corrective training;
[0061] Before the incorrect operation occurs, the flight may have lasted for a long time. Flying again takes a long time and affects the efficiency;
[0062] If there are multiple operation errors on a time line that need to be corrected, at most one error can be corrected each time when flying again, and the efficiency is low. This is because the corrected actions will affect the subsequent flight, breaking the preconditions for the occurrence of the next incorrect action, and the next incorrect operation cannot be reproduced.
[0063] The traditional recording and playback method described above is also a conventional method, which is divided into two stages: recording and playback. Among them, the work flow of the recording stage is as Figure 1 shown, and the work flow of the playback stage is as Figure 2 shown.
[0064] A retrospective multi-branch parallel simulation method of the present invention is divided into two stages: recording and playback, but it is significantly different from the conventional method. The work flow of the present invention in the recording stage is as Figure 4 shown, and the work flow in the playback and multi-branch parallel simulation stage is as Figure 5As shown in the figure. Compared with the conventional method, the recording process of the present invention adds a "process data recording module", whose function is to save the intermediate variables of the simulation process, that is, the "memory snapshot", to retain data for the "snapshot restoration" during the playback process. During the playback stage, the method of the present invention retains the "result data playback module" of the conventional playback process and adds a "snapshot restoration module", whose function is to fully restore the internal data state of the simulation program, so as to realize the state-continued simulation.
[0065] A retrospective multi-branch parallel simulation system provided by the present invention includes four modules: a result data recording module, a result data playback module, a process data recording module, and a snapshot restoration module, realizing a unique function of combining playback and continued parallel simulation.
[0066] Among them, the function of the result data recording module is to record the simulation output results of each frame and reserve data for playback. By reading the data of each simulation output result from the memory variables for each frame and writing them into the result record file A in sequence and saving them to the disk.
[0067] The function of the result data playback module is to playback the simulation results. The implementation method is to open the previous result record file A when playback is required, read the content frame by frame from the file in the storage order of the variables, and assign them to the corresponding result variables in the simulation software, so as to realize the result playback function.
[0068] The function of the process data recording module is to record the intermediate data of each frame of the simulation process and reserve data for starting a parallel simulation branch during the playback process, that is, reserve data for the snapshot restoration module. By reading the intermediate data of each simulation process from the memory variables for each frame and writing them into the process record file B in sequence and saving them to the disk.
[0069] The function of the snapshot restoration module is to restore the memory data of the simulation software, so that the simulation state immediately switches to the historical state at the moment when the branch point is created, that is, to realize "on-site restoration". After this step is completed, the internal of the simulation system is restored to the previous state, preparing the initial conditions for the newly created simulation branch. The implementation method is to, by programming the software program, open the previously saved process record file B when a new simulation branch needs to be created, retrieve and locate the data of the frame to be read according to the time correspondence relationship, read it out in the order when the variables are written, and assign it to the corresponding intermediate variables in the simulation software at one time, so as to realize the "snapshot restoration" function.
[0070] The described result data recording module records the simulation results frame by frame in chronological order into File A. The content recorded in File A is the data sequence of the simulation results output for each frame. For example, in flight simulation applications, the intermediate data that needs to be recorded includes longitude, latitude, altitude, pitch angle, roll angle, heading angle, velocity vector, and angular velocity of each axis. These data are incorporated into a data structure, namely the RemStruct data structure described above. The recording process is carried out frame by frame, and each time the RemStruct data of the current frame is added to the end of the result recording File A.
[0071] The result data playback module reads the recorded data from File A of the result data recording module and replays the simulation results frame by frame. In flight simulation applications, the data that needs to be replayed mainly includes longitude, latitude, altitude, pitch angle, roll angle, heading angle, velocity vector, and angular velocity of each axis.
[0072] The process data recording module records the simulation process data frame by frame into File B. In flight simulation applications, the data that needs to be recorded mainly includes integral data, status flags, position, velocity, angle, angular velocity, and temperature.
[0073] During the regular playback process, when the user encounters a desired scenario and decides to immediately take over the simulation manually, a state switch is required. The state switch is to first stop the playback, and then use the state of the last frame of the playback as the initial state of the parallel simulation to start the parallel simulation process. For example, to perform a "five-sided" landing training, a "parallel simulation branch" is created when the playback reaches the "five-sided" position. When creating the "parallel simulation branch", at the time point to which File A is replayed, the same time point is selected in File B, and the RemStruct data recorded in that frame is read at once and then assigned to the corresponding variables in the simulation software, thus achieving the "snapshot restoration" of the simulation state and completely restoring the internal process data of the simulation program to the state at that time. In flight simulation, the variables that need to perform "snapshot restoration" mainly include integral data, status flags, position, velocity, angle, angular velocity, temperature, and engine speed.
[0074] A retrospective multi-branch parallel simulation method includes the following steps:
[0075] Step 1: During the intermediate process of the regular playback record file A, select to enable the branch parallel simulation function as needed. The playback time point corresponding to enabling this function is the time point P for creating the "branch parallel simulation". For example, during the regular playback process, when the aircraft is flying on the "five - side" glide path and the user decides to manually take over the control of the aircraft for the subsequent landing training. At this time, the file A is being played back to the Nth second, that is, the time point P is the Nth second. Here, the Nth second is the time point for creating the "branch parallel simulation", and N can be any time point during the playback process, which is selected by the user according to needs.
[0076] Step 2: Select the time point P (the Nth second) in file B, read all kinds of recorded data of that frame at one time, and then assign them to the corresponding variables in the simulation software to achieve an instant "snapshot restoration" of the simulation state.
[0077] For example, at time point P, the flight simulator is at a glide point during the "five - side" landing. After the "snapshot restoration" operation, the internal process data of the simulation program is restored to the state at time point P. The effect is that the simulated aircraft is completely restored to the glide point during the "five - side" landing, thus providing the condition for the simulator to continue the manual landing training from this state.
[0078] Step 3: Starting from the "snapshot restoration" moment, the simulation playback state is switched to the manual operation state. Starting from the state at the "snapshot restoration" moment, the real - time simulation process is executed on the new simulation branch. At this time, the newly created simulation branch becomes the main branch and can also perform simulation recording and playback, and so on in a loop. For example, if the previous "five - side" landing flight operation was unqualified, the simulated aircraft can be pulled back to the previous "five - side" glide state through the "snapshot restoration" method, a new parallel simulation branch is created, and the manual landing operation training is carried out again. If it is still unqualified, the above operations are repeated until it is qualified and satisfactory.
[0079] The embodiment of the present application provides a program product. When the program product runs on a device, it enables the device to execute the method in the above - mentioned embodiment. Its implementation principle and technical effect are similar to those of the related embodiment of the above - mentioned method, and will not be elaborated here.
[0080] The embodiment of the present application provides a readable storage medium. The readable storage medium contains instructions. When the instructions run on a device, it enables the device to execute the method in the above - mentioned embodiment. Its implementation principle and technical effect are similar, and will not be elaborated here.
[0081] It can be seen that through the newly added branch parallel simulation function and snapshot restoration technology, the present application significantly improves the flexibility of simulation recording and playback and adds new functions. Compared with the prior art, the present application can create new branches during playback, solving the technical problem in the traditional technology that the verification effect is affected due to the inability to restore the simulation state. By supporting multi-branch parallel simulation, the present application provides more functions and more efficient technical means for simulation applications in complex scenarios.
Claims
1. A backtracking multi-branch parallel simulation system, characterized in that: It includes result data recording module, result data playback module, process data recording module and snapshot restoration module, realizing the combination of simulation playback and continuous parallel simulation; The result data recording module records the simulation output results of each frame, reserves data for playback, reads the data of each simulation output result from the memory variable through each frame, writes them into the result recording file A in sequence, and saves them to the disk; The result data playback module plays back the simulation results. When playback is required, the result record file A is opened, and the content is read frame by frame from the file according to the storage order of the variables, and the values are assigned to the corresponding result variables in the simulation software to realize the result playback function; The process data recording module records the intermediate data of each frame of the simulation process, reserves data for opening parallel simulation branches during playback, and reserves data for the snapshot restoration module. It reads the intermediate data of each simulation process from the memory variable through each frame, writes them to the process recording file B in sequence, and saves them to the disk; The snapshot restoration module restores the memory data of the simulation software, so that the simulation state is immediately switched to the historical state at the time of creating the branch point. When a new simulation branch is needed, the previously saved process record file B is opened, and the frame data to be read is retrieved according to the time correspondence relationship, and the data is read out in the order when the variables are written, and the values are assigned to the corresponding intermediate variables in the simulation software at one time, so as to realize snapshot restoration; In the middle of replaying the result recording file A, the branch parallel simulation function is enabled according to the usage needs. When this function is enabled, the corresponding playback time point is the time point P of the newly created branch parallel simulation. Select the time point P at the Nth second in the process record file B, read all the recorded data of that frame at one time, and then assign the values to the corresponding variables in the simulation software to achieve instant snapshot restoration of the simulation state; From the moment of snapshot restoration, the real-time simulation process is executed on the new simulation branch, taking the state at the moment of snapshot restoration as the starting point. At this time, the newly created simulation branch becomes the trunk branch, and simulation recording and playback are performed, and this cycle is repeated; The result data recording module records the simulation results frame by frame in chronological order into the result recording file A. The content recorded in the result recording file A is the data sequence outputted by each frame of the simulation result; The recording process in the result data recording module is performed frame by frame, and each time the RemStructs data of the current frame is added to the end of the result recording file A, wherein RemStructs is a data structure composed of all intermediate variables arranged in a fixed order; The result data playback module reads the recorded data from the file A of the result data recording module and plays back the simulation results frame by frame; It is divided into two stages: recording and playback. In the recording process, a "process data recording module" is added, which is used to save the intermediate variables of the simulation process, namely "memory snapshots", to retain data for the "snapshot restoration" of the playback process. In the playback stage, the "result data playback module" of the conventional playback process is retained, and a "snapshot restoration module" is added, which is used to completely restore the internal data state of the simulation program, thereby realizing state-continuation simulation. Before a new branch is created, the traditional playback method is executed, that is, the result data is played back for each frame. When a new branch is created, the corresponding current variable is overwritten with the recorded intermediate variable to achieve the "snapshot restoration" effect. After that, the playback is stopped and the normal simulation process is switched to a new parallel simulation branch, which can also be recorded and played back. Branches can be created on branches, thus forming a layer-by-layer progressive, backtracking, multi-branch parallel simulation.
2. A method for performing backtracking multi-branch parallel simulation using the system of claim 1, characterized in that: The steps include: Step 1: In the middle of replaying the result record file A, choose to enable the branch parallel simulation function according to the usage needs. When this function is enabled, the corresponding playback time point is the time point P of the newly created branch parallel simulation; Step 2: Select the time point P at the Nth second in the process record file B, read all the recorded data of that frame at one time, and then assign them to the corresponding variables in the simulation software to achieve instant snapshot restoration of the simulation state; Step 3: From the moment of snapshot restoration, the real-time simulation process is executed on the new simulation branch with the state at the moment of snapshot restoration as the starting point. At this time, the newly created simulation branch becomes the main branch, and simulation recording and playback are performed, and this cycle is iterated.
3. A device, characterized in that: include: one or more processors; one or more memories; Display screen; The one or more memories store one or more programs, and the one or more programs include instructions, which, when executed by the one or more processors, cause the device to perform the method described in claim 2.
4. A readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by the device, the computer implements the method as claimed in claim 2.
Citation Information
Patent Citations
Automatic driving simulation data recording and playback method and device, storage medium and vehicle
CN117785384A