Backtracking type multi-branch parallel simulation system, method, equipment and medium
By introducing the result data recording module, the result data playback module, the process data recording module and the snapshot restoration module in the simulation system, the function of creating a new branch during the playback process is realized, solving the problem that traditional simulation record playback cannot create a new branch, and meeting the simulation application needs in complex scenarios.
Patent Information
- Application Number
- CN202510370725.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-03-27
AI Technical Summary
The traditional recording and playback function cannot create new branches during the playback process, resulting in the inability to derive a new simulation process and cannot meet the simulation application needs in complex scenarios.
By introducing the result data recording module, the result data playback module, the process data recording module and the snapshot restoration module in the simulation system, the function of creating a new branch during the playback process is realized, and multi-branch parallel simulation is supported.
It solves the problem that traditional simulation record playback cannot create new branches, realizes the combination of playback and continuation of parallel simulation, meets the simulation application needs in complex scenarios, and improves the flexibility of simulation recording and playback.
Smart Images

Figure CN119903676A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of simulation technology, and in particular 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 is of key value in many fields. In the development of new drones, a prototype simulation system is built according to the design plan, experiments are designed according to technical indicators, simulated test flights are carried out and data is recorded. By replaying and analyzing the design effect, 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 driving training, trainees operate on flight simulators, 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 control levels.
[0003] Although the above traditional recording and playback can meet the basic playback needs, it has major defects. The playback process and details are exactly the same each time, and it does not support branching functions and cannot derive new simulation processes. This is because the traditional recording and playback stores the output results of each frame, lacks the intermediate process data to restore the scene, cannot reproduce the simulation "scene" state, and does not meet the data continuity of the mathematical simulation model deduction.
[0004] In actual use, traditional recording and playback functions often fail to meet the needs. For example, when flight schools use flight simulators for teaching, students need to control multiple flight states at the same time, which is complicated to operate. Instructors use traditional playback to analyze students' technical movements. If they find improper operations, students are required to fly again to verify the correction effect. However, traditional playback cannot create new branches during the playback process. When students "fly again", it is difficult to accurately restore the erroneous flight state because the two operations cannot be completely consistent. As a result, the instructor's correction method may not be applicable and it is difficult to verify the correction effect.
[0005] In addition, the traditional recording and playback function will encounter some other situations that cannot meet the needs when used. For example, when simulating driving an aircraft, flight trainees need to control multiple states such as speed, altitude, heading, landing gear, flaps, etc. at the same time, which requires high energy allocation and has strong operational complexity. The instructor usually uses the traditional recording and playback function of the flight simulator to analyze and correct the trainees' technical movements. The following teaching scenario often occurs: the instructor finds that the trainee's operation is improper, and first explains through playback, pointing out which action is wrong and what to do. As mentioned earlier, traditional simulation recording and playback can only be reproduced, and does not support new branches during playback. Therefore, trainees need to fly again to verify whether the wrong action has been truly corrected, and develop correct operating habits through repeated training. The previous simulators were not perfect in supporting this function, which is reflected in the process of trainees "flying again". The take-off and landing operations of the aircraft are complicated, and the two manual operations cannot be completely consistent, so it is difficult to accurately restore the flight state where the first error occurred the second time. Then the instructor's correction method for the first operation is likely to be inapplicable in the second flight, making it difficult to verify the effect of the correction. Such problems are caused by the defects of traditional simulation recording and playback. In view of the above problems, the existing technology needs to be improved urgently. Summary of the invention
[0006] Traditional recording and playback only has one trunk, does not support creating new branches and continuing the simulation state, and cannot meet the use needs of the above-mentioned situation. The purpose of the present invention is to provide a retrospective 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 new simulation processes in parallel. The present invention can realize multi-branch parallel simulation backtracking, solve the problem that the traditional recording and playback method cannot continue the simulation, expand the original function, and 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, including a result data recording module, a result data playback module, a process data recording module and a snapshot restoration module, realizes 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, and reserves data for snapshot restoration during playback in order to open parallel simulation branches. 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, and it is read out in the order when the variables are written, and assigned to the corresponding intermediate variables in the simulation software at one time to realize snapshot restoration.
[0008] 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 results.
[0009] The recording process in the result data recording module is performed frame by frame, and each time the recording is performed, each state data of the current frame is added to the end of the result recording file A.
[0010] 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.
[0011] A method for performing backtracking multi-branch parallel simulation using the system comprises the following steps: 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 result 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 restore the instant snapshot 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 can be performed again, and the cycle is iterated.
[0012] A device comprising: one or more processors; one or more memories; display screen; the one or more memories store one or more programs, the one or more programs include instructions, when the instructions are executed by the one or more processors, the device performs the method described.
[0013] A readable storage medium stores a program thereon, and when the program is executed by a device, the computer implements the method described.
[0014] Beneficial effects of the present invention: The present invention can organically combine the traditional recording and playback with the multi-branch parallel simulation function, which not only retains the original functions but also expands new functions. Recording and playing back the simulation process is the original function; generating new branches during the playback process and continuing the state to carry out a new simulation process is a new function. 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 can be combined with the newly created simulation process to meet more simulation application needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 The workflow of the conventional method during the recording phase; Figure 2 The workflow of the conventional method in the playback phase; Figure 3 The main structural logic of a backtracking multi-branch parallel simulation method provided by the present invention; Figure 4 The workflow of the present invention in the recording stage; Figure 5 The present invention shows the workflow in the playback and multi-branch parallel simulation stages. DETAILED DESCRIPTION
[0016] The technical solutions in the present application will be clearly and completely described below in conjunction with the drawings in the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the present application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0017] This application aims to solve the problem that in the traditional simulation recording and playback process, new branches cannot be created during the playback process, resulting in the inability to derive new simulation processes. Through the 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 the playback process is realized.
[0018] Although traditional simulation recording and playback can meet basic playback needs, it has significant limitations, namely, the playback process and details are exactly the same each time, it does not support branching functions, and it is impossible to derive new simulation processes. This is because traditional simulation recording and playback only stores the output results of each frame, lacks intermediate process data to restore the scene, cannot reproduce the simulation "scene" state, and does not meet the data continuity of mathematical simulation model deduction. For example, in the teaching process of a flight school, students need to perform complex flight operations repeatedly. The instructor analyzes the students' technical movements through traditional playback. After discovering improper operations, the students need to fly again to verify the correction effect. However, since the two operations cannot be completely consistent, it is difficult to accurately restore the erroneous flight state, resulting in the instructor's correction method may not be applicable and it is difficult to verify the correction effect.
[0019] The present application discloses a retrospective multi-branch parallel simulation system, including 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 playback and continuous parallel simulation. The result data recording module records the simulation output result of each frame, and writes it into the result recording file A in chronological order to ensure that there is sufficient data reserve during playback. The result data playback module reads data frame by frame from the result recording file A to realize playback of the simulation results. The process data recording module records the intermediate data of each frame of the simulation process, and writes it into the process recording file B in chronological order to reserve data for the snapshot restoration module. The snapshot restoration module realizes instantaneous recovery of the simulation state by reading the data in the process recording file B, so that the simulation state can be switched to the historical state at the moment of creating the branch point.
[0020] In the specific implementation, the result data recording module is responsible for recording the simulation output results to ensure that there is sufficient data reserve during playback. The result data playback module is responsible for reading data from the result recording file A, assigning it to the corresponding result variable in the simulation software, and realizing 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 recording file B. The snapshot restoration module realizes the instantaneous recovery of the simulation state by reading the data in the process recording file B, so that the simulation state can be switched to the historical state at the time of creating the branch point.
[0021] Through the coordination of these technical features, this application solves the problem that new branches cannot be created during the traditional simulation recording and playback process, and realizes the combination of playback and continuous parallel simulation. For example, in the teaching process of a flight school, the instructor can directly create a new branch during the playback process, and the students can perform corrective operations under the same error state, ensuring that the instructor's correction method is applicable and the correction effect can be verified.
[0022] The retrospective multi-branch parallel simulation system proposed in this application realizes the function of creating new branches during the playback process 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.
[0023] Furthermore, the present application also proposes that the result data recording module records the simulation results frame by frame in chronological order into the result recording file A, and the content recorded in the result recording file A is the data sequence outputted by each frame of the simulation results.
[0024] The technical features include a result data recording module and a result recording file A. The result data recording module records the simulation results frame by frame in chronological order to ensure data sequence consistency. The result recording file A saves the data sequence of each frame of simulation results. By recording the simulation results frame by frame in chronological order, the problem of inconsistent data sequence is solved.
[0025] The result data recording module can be implemented in many ways. For example, the result data recording module can adopt a method based on a memory buffer, first temporarily storing the simulation results in the memory, and then writing them to the result recording file A frame by frame in chronological order. This can improve the efficiency of data writing and reduce frequent operations on the disk. Another implementation method is to directly write the simulation results of each frame into the result recording file A in real time, which can ensure the real-time nature of the data, but may increase the I / O burden of the disk. In addition, the result recording file A can adopt text format, binary format or other suitable data storage format to facilitate subsequent data reading and processing.
[0026] The present application records the simulation results frame by frame in chronological order through the result data recording module, ensuring the consistency of the data sequence and solving the problem of inconsistent data sequence in the traditional method. Compared with the prior art, the present application provides a more reliable and efficient data recording method, improving the accuracy and availability of the simulation results.
[0027] Furthermore, the present application also proposes that the recording process in the result data recording module is performed frame by frame, and each time the recording adds the RemStruct data of the current frame to the end of the result recording file A. Among them, RemStructs is a data structure composed of all intermediate variables arranged in a fixed order.
[0028] The result data recording module records the simulation process data frame by frame, and each time the record is recorded, 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 simulation data, avoid data loss or dislocation, and provide accurate and complete data support when playback or analysis is required. This application solves the problem of how to efficiently record simulation process data and ensure data integrity in a retrospective multi-branch parallel simulation system by recording 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, so that the simulation data can be accurately reproduced during playback and analysis, improving the reliability and practicality of the system.
[0029] Further, the RemStruct data may include various state information and result data generated during the simulation process, such as parameters such as position, velocity, acceleration, etc. Each time the data is recorded, the RemStruct data of the current frame will be serialized and appended to the end of the result record file A. As a preferred embodiment, the result record file A can be stored in binary format to improve the efficiency of data storage and reading. During the recording process, a file lock mechanism can be used to ensure the atomicity of data writing to avoid data competition problems in a multi-threaded environment.
[0030] Therefore, 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 dislocation problems, enables the simulation data to be accurately reproduced during playback and analysis, and improves the reliability and practicality of the system.
[0031] Furthermore, the present application also proposes that the result data recording module and the result data playback module read the recorded data from the file A of the result data recording module and playback the simulation results frame by frame.
[0032] 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 simulation results more accurate and controllable, and better meeting the needs of simulation result analysis and optimization in different fields.
[0033] The implementation 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 pass the data to the simulation software frame by frame in chronological order by reading the data in file A, thereby realizing the frame-by-frame playback of the simulation results. As a preferred embodiment, the result data playback module can set a buffer zone to avoid the jamming phenomenon caused by inconsistent data reading speed during the playback process. Further, the result data playback module can also provide functions such as fast forward and fast rewind, so that the user can more flexibly control the playback process of the simulation results.
[0034] By choosing to turn on the branch parallel simulation function during the playback process, the problem that traditional simulation recording and playback cannot create new branches is solved. This method uses snapshot restoration technology to switch the simulation state to the historical state of the newly created branch point, thereby achieving instant restoration of the simulation state. By selecting 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 performed based on this. This technical solution supports multi-branch parallel simulation through a loop iteration method, overcoming the defect that traditional technology cannot perform branch simulation due to the inability to restore the internal state of the simulation system.
[0035] Specifically, the method of the present application includes the following steps: in the middle process of replaying the result record file A, the branch parallel simulation function is enabled according to the use needs, and the corresponding playback time point when this function is enabled 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 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. 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 can be performed, and the cycle is iterated.
[0036] During the implementation process, the opening of the branch parallel simulation function can be triggered by a selection operation in the user interface, or it can be automatically triggered by a pre-set condition. The implementation of the snapshot restore function depends on the full recording of the intermediate data in the simulation process. These data are stored in the process record file B and organized in chronological order. During snapshot restoration, the corresponding RemStruct record data can be quickly retrieved through the positioning of the time point P 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, taking the state of snapshot restoration as the starting point, generating new simulation branches and recording them. As a preferred implementation method, when performing real-time simulation, multi-threading technology can be used to achieve parallel operation of the main branch and the new branch, thereby improving the efficiency and flexibility of the simulation.
[0037] The present invention solves the problems mentioned in the background technology from the root, where "backtracking" means that the previous flight process records can be traced back, "multiple branches" means that multiple different simulation processes can be supported, and "parallel simulation" means that a new branch simulation process can be created from any point in the playback process as needed. Compared with the original recording process, this newly created simulation process has the same initial state, but can have a completely different development and evolution process, and the results are also different, just like time flows back to historical time, allowing users to make choices and operations again, so that they can "know mistakes and correct them." The basic principle of the present invention is that by recording the various intermediate state data of the simulation process, the historical state of the internal data of the simulation system can be completely restored during the playback process, so that it can not only seamlessly connect and transition, but also evolve different simulation processes and results according to new input drives, thereby overcoming the defects of traditional recording and playback methods.
[0038] 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 add the recording of intermediate state data. Specifically, if the value of a variable is affected by the previous simulation result, then this 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 aircraft position of the previous frame, V is the aircraft speed, and dt is the simulation step length, where P is a process variable, and its value is affected by the aircraft position P0 of the previous frame; similarly, V is also a process variable, V=V0+a×dt, where V0 is the aircraft speed of the previous frame, a is the aircraft acceleration, and dt is the simulation step length.
[0039] The present invention arranges all intermediate variables in a fixed order to form a data structure, recorded as RemStruct, and records the content of the RemStruct structure in each frame, that is, records process data. The playback process design of the present invention is also different from the traditional one: 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 a "snapshot restoration" effect, after which the playback is stopped and the normal simulation process is switched, thus creating a new parallel simulation branch. The new parallel simulation branch can also be recorded and played back, and branches can be created on the branches, thereby forming a layer-by-layer progressive, backtracking, multi-branch parallel simulation.
[0040] After adopting the method of the present invention, the above example will be better solved in the following way: Record the process of the first simulated flight, including process data and result data. During the playback process, select a time point before the operation error occurs as the branch point, load the previously recorded process data of this point and hand over the control to the flight trainee, 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 trainee takes over the simulator control, and verifies the effect of the corrective action on the parallel simulation branch, which can be repeated many times. This method overcomes the defects of traditional methods and brings two benefits: one is that it can accurately restore to the previous simulation state, and the other is that it saves the long process of repeating the flight before reaching the branch point, saving time.
[0041] The main structural logic of the method used in the present invention is as follows Figure 3 As shown in the figure, AO is the original playback process. A is the first branch point, which is in the traditional playback process. Point A generates AC parallel simulation branch, AF parallel simulation branch, and AH parallel simulation branch respectively, which means: starting from the same state point A, three different simulation operation processes are attempted and different results are obtained. On the AC branch, ABE parallel simulation branch is created; progressively, on the ABE parallel simulation branch, ABDK parallel simulation branch is generated. Similarly, on the AH parallel simulation branch, AGJ parallel simulation branch is generated. Each of the above branches represents a new evolutionary process that is differentiated from the trunk. Each evolutionary process corresponds to a new attempt that can be traced back to the past. For example, in the simulated flight landing training mentioned above, it represents multiple simulated landing trainings. The so-called "multiple branches" means that on a newly opened parallel simulation branch, new parallel simulation branches can be opened, layer by layer. This method of building branches on branches is called "multiple branches", which is similar to the branch structure style of a tree from the root to each treetop. Therefore, the inventor named this simulation method "backtracking multi-branch parallel simulation".
[0042] The present invention is mainly applied to the simulation of the motion process of objects, such as airplanes, drones, ships, etc., and can additionally provide a retrospective multi-branch parallel simulation recording and playback function. The following takes the typical application of the present invention on a flight simulator as an example, and combines the accompanying drawings to describe the specific implementation method in detail as follows.
[0043] A flight simulator is a ground-mounted flight training device that can provide a simulated aircraft cockpit hardware operating environment, use software to virtually generate visual effects of extravehicular flight, use computer software to solve the aircraft's mathematical simulation model, and can output flight status information in real time to simulate the flight process. It has the advantages of being economical, efficient, and safe, and is widely used in pilot driving skills training.
[0044] The flight simulator has a traditional recording and playback function, which is mainly used for reviewing the flight afterward. When the trainee is found to have improper operation, it is usually corrected by flying again. This method has the following disadvantages: Wrong flight operations are caused by specific flight conditions and environmental conditions. It is difficult to completely reproduce the last state and environment by manually flying again. It is very likely that the conditions and factors that caused the wrong operation will not exist, resulting in the last wrong operation not happening again, and there is no way to conduct corrective training; The flight may have been going on for a long time before the wrong operation occurred, and it would take a long time to re-fly, which would affect efficiency. If there are multiple operational errors that need to be corrected on a timeline, each re-flight can only correct one error at most, which is inefficient. This is because the corrected action will affect the subsequent flight, breaking the precondition for the next erroneous action to occur, and the next erroneous operation cannot be reproduced.
[0045] The traditional recording and playback method described above is also a conventional method, which is divided into two stages: recording and playback. The workflow of the recording stage is as follows: Figure 1 As shown in the figure, the workflow of the playback phase is as follows Figure 2 shown.
[0046] The present invention provides a backtracking multi-branch parallel simulation method, which is divided into two stages: recording and playback. However, it is significantly different from the conventional method. The workflow of the present invention in the recording stage is as follows: Figure 4 As shown in the figure, the workflow in the playback and multi-branch parallel simulation phase is as follows Figure 5As shown. Compared with the conventional method, the recording process of the present invention adds a "process data recording module", which is used to save the intermediate variables of the simulation process, that is, the "memory snapshot", and retain data for the "snapshot restoration" of the playback process. In the playback stage, the method described in the present invention retains the "result data playback module" of the conventional playback process and adds a "snapshot restoration module", which is used to completely restore the internal data state of the simulation program, thereby realizing state-continuation simulation.
[0047] The present invention provides a retrospective multi-branch parallel simulation system, which includes four modules: a result data recording module, a result data playback module, a process data recording module, and a snapshot restoration module, and realizes a unique function of combining playback with continuous parallel simulation.
[0048] The function of the result data recording module is to record the simulation output results of each frame and reserve data for playback. The data of each simulation output result is read from the memory variable for each frame, written into the result recording file A in sequence, and saved to the disk.
[0049] 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 needed, read the content from the file frame by frame according to the storage order of the variables, and assign the values to the corresponding result variables in the simulation software, thereby realizing the result playback function.
[0050] 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 opening parallel simulation branches during playback, that is, to reserve data for the snapshot restoration module. By reading the intermediate data of each simulation process from the memory variable for each frame, they are written to the process recording file B in sequence and saved to the disk.
[0051] The function of the snapshot restore module is to restore the memory data of the simulation software so that the simulation state can be immediately switched to the historical state at the time of creating the branch point, that is, to achieve "on-site restoration". After completing this step, the internal state of the simulation system is restored to its previous state, and the initial conditions are prepared for the next new simulation branch. The implementation method is to compile a software program. When a new simulation branch is needed, open the previously saved process record file B, retrieve and locate the frame of data that needs to be read according to the time correspondence, read it out in the order when the variable is written, and assign it to the corresponding intermediate variable in the simulation software at one time, thereby realizing the "snapshot restore" function.
[0052] The 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 each frame simulation result output. For example, in the application of flight simulation, the intermediate data that needs to be recorded include longitude, latitude, altitude, pitch angle, roll angle, heading angle, velocity vector, and angular velocity of each axis. These data are compiled into a data structure, that is, the RemStruct data structure mentioned above. The recording process is carried out frame by frame, and each recording adds the RemStructt data of the current frame to the end of the result recording file A.
[0053] 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. In the application of flight simulation, the data that need to be played back mainly include longitude, latitude, altitude, pitch angle, roll angle, heading angle, velocity vector, and angular velocity of each axis.
[0054] The process data recording module records the simulation process data frame by frame into file B. In flight simulation applications, the data that need to be recorded mainly include integral data, state flags, position, speed, angle, angular velocity, and temperature.
[0055] During regular playback, when the user encounters a desired scenario and decides to take over the simulation manually immediately, a state switch is required. State switching means stopping playback first, and then starting the parallel simulation process with the last frame of playback as the initial state of parallel simulation. For example, if you want to do "five-side" landing training, create a new "parallel simulation branch" when replaying the "five-side" position. When creating a new "parallel simulation branch", select the same time point in file B at which file A is replayed, read the RemStruct data recorded in that frame at one time, and then assign it to the corresponding variable in the simulation software, so as to achieve the "snapshot restoration" of the simulation state, so that the internal process data of the simulation program is completely restored to the state at that time. The variables that need to be "snapshot restored" in flight simulation mainly include integral data, state flags, position, speed, angle, angular velocity, temperature, and engine speed.
[0056] A backtracking multi-branch parallel simulation method comprises the following steps: Step 1: In the middle of the regular playback of the recorded file A, choose to turn on the branch parallel simulation function according to the needs of use. When this function is turned on, the corresponding playback time point is the time point P of the new "branch parallel simulation". For example, during the regular playback process, the aircraft is flying to the "five-side" glide path, and the user decides to manually take over the control of the aircraft for the next landing training. At this time, 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 of the new "branch parallel simulation", and N can be any time point in the playback process, which can be selected by the user according to needs.
[0057] Step 2: Select the time point P at the Nth second in 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 an instant "snapshot restoration" of the simulation state.
[0058] For example, at time P, the flight simulator is at a glide path for a "five-side" landing. After the "snapshot restore" operation is completed, the internal process data of the simulation program is restored to the state at time P. The effect is that the simulated aircraft is completely restored to the glide path for a "five-side" landing, thereby giving the simulator the conditions to continue manual landing training from this state.
[0059] Step 3: From the moment of "snapshot restoration", the simulation playback state is switched to the manual operation state, and the real-time simulation process is performed on the new simulation branch starting from the state at the moment of "snapshot restoration". At this time, the newly created simulation branch becomes the main branch, and simulation recording and playback can also be performed, and the cycle is repeated. For example, if the last "five-side" landing flight driving operation is unqualified, the "snapshot restoration" method can be used to pull the simulated aircraft back to the "five-side" descent state that was previously flown, and a new parallel simulation branch can be created to conduct manual landing control training again. If it is still unqualified, repeat the above operation until it is qualified and satisfactory.
[0060] The embodiment of the present application provides a program product, when the program product is run on a device, the device executes the method in the above embodiment. Its implementation principle and technical effect are similar to those of the embodiment related to the above method, and will not be repeated here.
[0061] The embodiment of the present application provides a readable storage medium, which contains instructions. When the instructions are executed on a device, the device executes the method of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.
[0062] It can be seen that this application significantly improves the flexibility of simulation recording and playback and adds new functions through the newly added branch parallel simulation function and snapshot restoration technology. Compared with the existing technology, this application can create new branches during the playback process, solving the technical problem of affecting the verification effect due to the inability to restore the simulation state in traditional technology. By supporting multi-branch parallel simulation, this 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 can be 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 that needs to be read is retrieved and located according to the time correspondence. 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 to realize snapshot restoration.
2. A backtracking multi-branch parallel simulation system as claimed in claim 1, characterized in that: 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 results.
3. A backtracking multi-branch parallel simulation system as claimed in claim 2, characterized in that: 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.
4. A backtracking multi-branch parallel simulation system as claimed in claim 1, characterized in that: 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.
5. A method for performing backtracking multi-branch parallel simulation using the system described in any one of claims 1 to 4, 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 result 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 restore the instant snapshot 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.
6. 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 5.
7. 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 5.
Citation Information
Patent Citations
Power grid anti-accident maneuver process graphic presentation method
CN104900109A
Local shared memory operation method and system based on universal blackboard
CN113419881A
Snapshot and playback method and system for network topology
CN113794586A
Automatic driving simulation data recording and playback method and device, storage medium and vehicle
CN117785384A
Cited By
Online agile simulation model parameter adjustment method
CN121118469A