Model offline simulation evaluation method, device, equipment and storage medium
Under the offline simulation framework, the offline model simulation is promoted according to the synchronization cycle and data interaction is carried out in the specified synchronization cycle, which solves the problem of how to ensure the equivalence of offline simulation and real-time simulation in the existing technology, and effectively verify and optimize the real-time simulation of the model.
Patent Information
- Application Number
- CN202510125541.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-27
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-01-27
AI Technical Summary
When using offline simulation to verify the optimization effect of the model, how to ensure that offline simulation and real-time simulation have a certain degree of equivalentity and ensure the confidence of offline simulation data.
By introducing an offline simulation framework, the offline simulation of the model is promoted according to the synchronization cycle, the controlled object model runs independently and the control algorithm program, and data interaction is carried out in the specified synchronization cycle, simulating data communication during the real-time simulation of the model. During the periodic advancement process, real-time simulation calculation and real-time evaluation are performed on the controlled object model until the real-time evaluation data meets the expected conditions for real-time simulation of the model.
Indirect verification of the real-time simulation effect of the model through offline simulation, avoiding various problems caused by directly deploying the simulation model to the real-time simulation machine. At the same time, it also solves the timeout problems that may occur during the semi-physical simulation process, ensuring the equivalence of offline simulation and real-time simulation.
Smart Images

Figure CN119558106B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of model simulation technology, and in particular to a model offline simulation evaluation method, device, equipment and storage medium. Background Art
[0002] Model real-time simulation is specifically applied to semi-physical simulation, which means using an actual controller to control the controlled object model (also known as the simulation model) running in the real-time simulator. The real-time simulator synchronizes information with the controller through the IO channel, which requires the real-time simulator to complete all calculations of the controlled object model and the preparation of communication data within the synchronization period, otherwise a timeout problem will occur. There are generally two ways to solve the problem of model real-time simulation timeout: one is to set the synchronization period to be relatively large to leave enough margin, but this margin will have a certain impact on the control effect; the other is to use a more advanced real-time simulator with stronger computing power to ensure real-time performance, but this method will increase costs. In addition to the above two conventional methods, there is another way: to achieve synchronization by optimizing the calculation amount of the controlled object model, so as to solve the problem of model real-time simulation timeout.
[0003] There are many existing model optimization schemes. The simulation model needs to be deployed to the real-time simulation machine for testing to verify the effect. This process is repetitive and will bring huge workload. In addition, a lot of preparation work needs to be done to perform a real-time simulation, such as generating and deploying the simulation model, configuring the real-time simulation environment and machine. The whole process is very complicated. Therefore, when the simulation model has not been finalized in the early stage of design and is still being rapidly iterated and optimized, it is not economical to directly deploy the real-time simulation to determine the simulation effect. At the same time, due to the imperfection of the simulation model and other contents, direct deployment may cause equipment failure and other problems. Furthermore, the synchronization cycle of the real-time simulation needs to be determined in combination with the application scenario. It may take multiple attempts to find a suitable interval. It is difficult to determine the synchronization cycle directly through real-time simulation iteration. Although the offline simulation method can avoid these risks and troubles, it must be ensured that the offline simulation and the real-time simulation have a certain equivalence, so that the data obtained from the offline simulation has sufficient confidence. Summary of the invention
[0004] The main purpose of the present invention is to provide a model offline simulation evaluation method, device, equipment and storage medium, aiming to solve the technical problem of how to ensure that offline simulation and real-time simulation have a certain degree of equivalence when verifying the model optimization effect by offline simulation.
[0005] A first aspect of the present invention provides a model offline simulation evaluation method, the model offline simulation evaluation method comprising:
[0006] Acquire a simulation model of the controlled physical object;
[0007] Set the offline simulation configuration and the external control data input method of the offline simulation framework;
[0008] Starting the offline simulation, and during the offline simulation process, performing real-time simulation calculation on the simulation model based on the offline simulation framework and evaluating the real-time performance of the offline simulation of the model;
[0009] When the offline simulation is finished, the real-time evaluation data of the offline simulation of the model is output;
[0010] Determining whether the real-time evaluation data meets the expected conditions for real-time simulation of the model;
[0011] If the real-time evaluation data does not meet the expected conditions, the relevant configuration of the offline simulation is reset and / or the optimized simulation model is re-acquired, and the next round of offline simulation is performed on the simulation model.
[0012] Optionally, in a first implementation of the first aspect of the present invention, starting the offline simulation, and performing real-time simulation calculation on the simulation model based on the offline simulation framework during the offline simulation process, and evaluating the real-time performance of the offline simulation of the model include:
[0013] When the simulation start time is reached, the offline simulation is started and the following operations are performed based on the offline simulation framework during the offline simulation:
[0014] Performing a simulation instantiation operation on the simulation model to obtain a simulation instance;
[0015] Performing a simulation initialization operation on the simulation instance to obtain an initialized simulation instance;
[0016] Starting a real-time simulation single-step loop for the simulation instance, and executing the real-time simulation single-step advancement according to the synchronization cycle, counting the actual physical time consumption of the single-step simulation, and calculating the real-time evaluation data;
[0017] When the simulation end time is reached, exit the real-time simulation single-step loop;
[0018] End the offline simulation and destroy the simulation instance.
[0019] Optionally, in a second implementation of the first aspect of the present invention, starting a real-time simulation single-step loop for the simulation instance, and executing the real-time simulation single-step advancement according to the synchronization cycle, and counting the actual physical time consumption of the single-step simulation and calculating the real-time evaluation data include:
[0020] Performing data synchronization on the simulation instance to complete single-step simulation data interaction;
[0021] Mark the timing starting point of the current single-step simulation and obtain the current physical time;
[0022] Performing data synchronization update on the simulation instance to make the external control data effective;
[0023] Execute a simulation step on the simulation instance, wherein the step length of the simulation step is a synchronization cycle;
[0024] Mark the timing end point of the current single-step simulation and obtain the current physical time;
[0025] Based on the timing end point and timing start point corresponding to the current single-step simulation, the actual physical time consumption of the current single-step simulation is obtained;
[0026] Calculate and update the real-time evaluation data of the simulation model according to the actual physical time consumption of the current single-step simulation;
[0027] Determine whether the current simulation time reaches the simulation end time;
[0028] If the current simulation time has not reached the simulation end time, the current simulation time is increased by one synchronization cycle and the next real-time simulation single step is executed.
[0029] Optionally, in a third implementation of the first aspect of the present invention, the performing data synchronization on the simulation instance to complete single-step simulation data interaction includes:
[0030] Obtaining output variable values of the simulation model;
[0031] According to the external control data input mode of the offline simulation framework, the output variable value of the simulation model is passed to the control algorithm program for control input quantity conversion;
[0032] The control input quantity converted by the control algorithm program is set as the input variable of the simulation instance to execute the next simulation step.
[0033] Optionally, in a fourth implementation of the first aspect of the present invention, the relevant configuration of the offline simulation includes simulation start time and simulation end time, synchronization period, simulation algorithm, simulation calculation accuracy, and real-time rate warning threshold.
[0034] Optionally, in a fifth implementation of the first aspect of the present invention, the real-time evaluation data includes real-time rate statistical information, or the real-time evaluation data includes real-time rate statistical information and the real-time rate of each simulation step in the offline simulation process;
[0035] The real-time rate statistical information includes the number of simulation timeout steps, the number of warning steps, the average real-time rate, the maximum real-time rate and the time when the maximum real-time rate occurs; the real-time rate is the ratio of the actual physical time consumed to execute a single-step simulation within a synchronization cycle to the synchronization cycle.
[0036] Optionally, in a sixth implementation of the first aspect of the present invention, the external control data input method of the offline simulation framework includes: any one of a joint simulation method, a function call method and an interpolation table method.
[0037] A second aspect of the present invention provides a model offline simulation evaluation device, the model offline simulation evaluation device comprising:
[0038] An acquisition module, used for acquiring a simulation model of a controlled physical object;
[0039] The setting module is used to set the relevant configuration of offline simulation and the external control data input method of the offline simulation framework;
[0040] A simulation evaluation module, used to start offline simulation, and during the offline simulation process, perform real-time simulation calculations on the simulation model based on the offline simulation framework and evaluate the real-time performance of the offline simulation of the model;
[0041] An output module is used to output real-time evaluation data of the offline simulation of the model when the offline simulation ends;
[0042] A judgment module, used to judge whether the real-time evaluation data meets the expected conditions of the real-time simulation of the model;
[0043] The loop module is used to reset the relevant configuration of the offline simulation and / or re-acquire the optimized simulation model if the real-time evaluation data does not meet the expected conditions, and perform the next round of offline simulation on the simulation model.
[0044] Optionally, in a first implementation manner of the second aspect of the present invention, the simulation evaluation module is specifically used to:
[0045] When the simulation start time is reached, the offline simulation is started and the following operations are performed based on the offline simulation framework during the offline simulation:
[0046] Performing a simulation instantiation operation on the simulation model to obtain a simulation instance;
[0047] Performing a simulation initialization operation on the simulation instance to obtain an initialized simulation instance;
[0048] Starting a real-time simulation single-step loop for the simulation instance, and executing the real-time simulation single-step advancement according to the synchronization cycle, counting the actual physical time consumption of the single-step simulation, and calculating the real-time evaluation data;
[0049] When the simulation end time is reached, exit the real-time simulation single-step loop;
[0050] End the offline simulation and destroy the simulation instance.
[0051] Optionally, in a second implementation of the second aspect of the present invention, the simulation evaluation module is further configured to:
[0052] Performing data synchronization on the simulation instance to complete single-step simulation data interaction;
[0053] Mark the timing starting point of the current single-step simulation and obtain the current physical time;
[0054] Performing data synchronization update on the simulation instance to make the external control data effective;
[0055] Execute a simulation step on the simulation instance, wherein the step length of the simulation step is a synchronization cycle;
[0056] Mark the timing end point of the current single-step simulation and obtain the current physical time;
[0057] Based on the timing end point and timing start point corresponding to the current single-step simulation, the actual physical time consumption of the current single-step simulation is obtained;
[0058] Calculate and update the real-time evaluation data of the simulation model according to the actual physical time consumption of the current single-step simulation;
[0059] Determine whether the current simulation time reaches the simulation end time;
[0060] If the current simulation time has not reached the simulation end time, the current simulation time is increased by one synchronization cycle and the next real-time simulation single step is executed.
[0061] Optionally, in a third implementation of the second aspect of the present invention, the simulation evaluation module is further configured to:
[0062] Obtaining output variable values of the simulation model;
[0063] According to the external control data input mode of the offline simulation framework, the output variable value of the simulation model is passed to the control algorithm program for control input quantity conversion;
[0064] The control input quantity converted by the control algorithm program is set as the input variable of the simulation instance to execute the next simulation step.
[0065] Optionally, in a fourth implementation of the second aspect of the present invention, the relevant configuration of the offline simulation includes simulation start time and simulation end time, synchronization period, simulation algorithm, simulation calculation accuracy, and real-time rate warning threshold.
[0066] Optionally, in a fifth implementation of the second aspect of the present invention, the real-time evaluation data includes real-time rate statistical information, or the real-time evaluation data includes real-time rate statistical information and the real-time rate of each simulation step in the offline simulation process;
[0067] The real-time rate statistical information includes the number of simulation timeout steps, the number of warning steps, the average real-time rate, the maximum real-time rate and the time when the maximum real-time rate occurs; the real-time rate is the ratio of the actual physical time consumed to execute a single-step simulation within a synchronization cycle to the synchronization cycle.
[0068] Optionally, in a sixth implementation of the second aspect of the present invention, the external control data input method of the offline simulation framework includes: any one of a joint simulation method, a function call method and an interpolation table method.
[0069] The third aspect of the present invention provides a computer device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the computer device executes the above-mentioned model offline simulation evaluation method.
[0070] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned model offline simulation evaluation method.
[0071] The present invention provides a model offline simulation evaluation method, which is used to evaluate whether the model offline simulation meets the expectations of the model real-time simulation while verifying the model optimization effect by using the offline simulation method. Specifically, an offline simulation framework is introduced, under which the model offline simulation is advanced according to the synchronization cycle, the controlled object model (i.e., the simulation model) and the control algorithm program are independently operated, and data interaction is performed in the specified synchronization cycle, thereby simulating the data communication in the model real-time simulation process. In the periodic advancement process, the controlled object model is subjected to real-time simulation calculation and real-time evaluation, and the real-time evaluation of the model offline simulation is performed to ensure that the offline simulation and the real-time simulation have a certain equivalence. If the real-time evaluation data of the current round does not meet the expected conditions of the model real-time simulation, the relevant configuration of the offline simulation is reset and / or the optimized simulation model is re-acquired, and then the next round of offline simulation is performed on the simulation model until the real-time evaluation data meets the expected conditions of the model real-time simulation. The present invention indirectly verifies the effect of the model real-time simulation through offline simulation, avoids various problems caused by directly deploying the simulation model on the real-time simulation machine, and also solves the timeout problem that may occur in the semi-physical simulation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 A schematic diagram of an embodiment of a model offline simulation evaluation method in an embodiment of the present invention;
[0073] Figure 2 A schematic diagram of an embodiment of a model offline simulation evaluation device in an embodiment of the present invention;
[0074] Figure 3 FIG. 1 is a schematic diagram of an embodiment of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0076] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the model offline simulation evaluation method in the embodiment of the present invention includes:
[0077] 101. Obtain a simulation model of the controlled physical object;
[0078] In this embodiment, the controlled physical object refers to the process of modeling and simulating the actual physical object in a simulation environment. This process allows engineers to test and optimize the control strategy without the need for actual physical hardware. The simulation model specifically refers to the establishment of a mathematical model based on the physical characteristics and motion laws of the physical object, and then the mathematical model can be solved and simulated using computer simulation software (such as MATLAB / Simulink, Simscape, etc.).
[0079] Simulating controlled physical objects can be applied to many fields, such as: industrial automation: simulation and control optimization of robotic arms, conveyor belts and other equipment on the production line; aerospace: simulation and verification of aircraft attitude control and navigation systems; automotive engineering: simulation and optimization of automobile engine control, braking systems, etc.; energy system: simulation and analysis of the stability and economy of power systems. By simulating controlled physical objects, the product development cycle can be greatly shortened, costs can be reduced, and product quality can be improved.
[0080] In this embodiment, before performing offline simulation, it is necessary to first obtain a pre-built simulation model of the controlled physical object. The simulation model is a mathematical or physical representation that simulates the behavior and characteristics of the actual physical object under specific conditions. It is a model built based on physical principles, mathematical equations or computer programs. It is used to simulate the dynamic behavior and response of the actual physical object under specific conditions. Its main purpose is to evaluate and optimize the performance of the control system in the design phase and reduce the risks and costs in actual testing.
[0081] 102. Set the relevant configuration of offline simulation and the external control data input method of the offline simulation framework;
[0082] In this embodiment, in order to achieve the purpose of offline simulation evaluation of the model, it is necessary to set relevant configurations of the offline simulation before performing the offline simulation.
[0083] In an optional embodiment, the related configuration of the offline simulation includes:
[0084] (1) Simulation start time and simulation end time are used to determine the time interval for offline simulation.
[0085] (2) Synchronization cycle: used to drive the simulation loop and real-time evaluation. The synchronization cycle is smaller than the simulation time interval, which means that multiple synchronization cycles can be executed within the simulation time interval.
[0086] (3) Simulation algorithm and simulation calculation accuracy
[0087] This embodiment supports many simulation algorithms, including but not limited to Monte Carlo algorithm, discrete event simulation algorithm, continuous system simulation algorithm, etc. The selection of a suitable simulation algorithm needs to consider factors such as the complexity of the problem, computing resources, and accuracy requirements. For example, for simple problems, a simple simulation algorithm can be used; for complex problems, a more complex simulation algorithm may need to be used. At the same time, it is also necessary to consider the limitations of computing resources, such as computing time, storage space, etc. The simulation calculation accuracy is an important indicator to measure the accuracy of the simulation results. The simulation calculation accuracy can be set accordingly according to the selected simulation algorithm. This embodiment supports determining the optimal synchronization period and simulation algorithm combination by offline simulation.
[0088] (4) Real-time rate warning threshold
[0089] The real-time rate refers to the ratio of the actual physical time taken to execute a single-step simulation within a synchronization cycle to the synchronization cycle. The greater the actual physical time taken, the greater the real-time rate. If the real-time rate is greater than 1, it means that the simulation calculation has timed out.
[0090] This embodiment provides an option to enable the real-time rate monitoring function. If the monitoring function is enabled, the real-time rate warning threshold input box is further activated. Since the actual offline simulation tool and the real-time simulation machine have performance differences, the real-time rate calculated in the offline simulation tool needs to provide a discount rate based on the performance difference between the two, such as 90%. The user can provide a corresponding real-time rate warning threshold of 0.9 based on the discount rate. When the real-time rate calculated by the offline simulation is higher than the warning threshold, the offline simulation tool needs to output a warning message.
[0091] The offline simulation framework provided in this embodiment can be integrated into a specific offline simulation tool. The user provides a simulation model of the controlled physical object (hereinafter referred to as the controlled object model), which runs in the offline simulation tool. In order to correctly count the real-time rate of the controlled object model, the control algorithm program and the simulation model program need to run independently. The offline simulation framework of this embodiment supports multiple control data input methods. Among them, the control data is used to control the simulation model to perform simulation calculations.
[0092] In an optional embodiment, the external control data input method of the offline simulation framework includes: any one of a joint simulation method, a function call method and an interpolation table method.
[0093] (1) Joint simulation
[0094] The development process of the control algorithm program also goes through offline development to online verification. Therefore, in the semi-physical real-time simulation stage, the control algorithm program deployed in the controller already has a ready-made control algorithm model. The control algorithm model and the controlled object model can be integrated and simulated through joint simulation.
[0095] (2) By function call
[0096] The control algorithm program can be encapsulated into a specific function form and actively called by other programs, such as by an offline simulation framework.
[0097] (3) Using interpolation table
[0098] The control quantity used for simulation calculation of the control model can be stored in a file in the form of a data table (i.e., an interpolation table). The control quantity data is derived from actual measurements or historical statistical values, and the corresponding control quantity can be obtained by reading the interpolation table.
[0099] 103. Start offline simulation, and during the offline simulation process, perform real-time simulation calculation on the simulation model based on the offline simulation framework and evaluate the real-time performance of the offline simulation of the model;
[0100] This embodiment constructs an offline simulation framework whose operation process is similar to real-time simulation, so that the offline simulation framework can be used as an alternative to real-time simulation to verify offline whether the current synchronization cycle and model calculation can meet the real-time simulation requirements.
[0101] The offline simulation framework provided in this embodiment can be integrated into a specific offline simulation tool. The user provides a simulation model of the controlled physical object, and the model runs in the offline simulation tool. When the offline simulation is turned on, real-time simulation calculations can be performed on the simulation model based on the offline simulation framework during the offline simulation process. The offline simulation process is advanced according to the synchronization cycle. The controlled object model and the control algorithm program run independently and perform data interaction in the specified synchronization cycle to simulate data communication in the real-time simulation process. During the periodic advancement process, the actual physical time consumption of the controlled object model is recorded, and then the real-time evaluation data of the current step interval is calculated.
[0102] In an optional embodiment, the above step 103 further includes:
[0103] When the simulation start time is reached, the offline simulation is started and the following operations are performed based on the offline simulation framework during the offline simulation:
[0104] 1031. Perform a simulation instantiation operation on the simulation model to obtain a simulation instance;
[0105] Simulation instantiation refers to the process of converting a simulation model from an abstract definition into a specific executable instance. This step is the basis of the simulation process and ensures that the simulation model can be recognized and executed by the system.
[0106] 1032. Perform a simulation initialization operation on the simulation instance to obtain an initialized simulation instance;
[0107] Simulation initialization refers to the process of setting initial conditions and parameters for a simulation instance. These initial conditions and parameters may include environment settings, system status, input data, etc. The initialized simulation instance will be in a known state so that subsequent simulation steps can be performed accurately.
[0108] 1033. Start a real-time simulation single-step loop for the simulation instance, and execute the real-time simulation single-step advancement according to the synchronization cycle, count the actual physical time consumption of the single-step simulation, and calculate the real-time evaluation data;
[0109] This step is the real-time simulation execution process of the simulation instance. The real-time simulation single-step loop refers to the process of gradually advancing the simulation at fixed time intervals (synchronization cycles). In each time interval, the offline simulation tool performs a series of calculations and update operations based on the offline simulation framework to simulate the real-time behavior of the controlled physical object. At the same time, the offline simulation tool will also count the actual physical time consumption of each single-step simulation based on the offline simulation framework, and calculate the real-time evaluation data to evaluate the real-time performance of the offline simulation.
[0110] In an optional embodiment, the above step 1033 further includes:
[0111] 10331. Perform data synchronization on the simulation instance to complete single-step simulation data interaction;
[0112] In semi-physical real-time simulation applications, the simulation model of the controlled physical object runs in the real-time simulation machine, and the control algorithm program runs on the real controller. At the synchronization moment, the controller obtains the value of the monitoring quantity from the real-time simulation machine, which is converted into a control instruction after the control algorithm program is calculated and input into the real-time simulation machine, and the real-time simulation machine completes a synchronization cycle step calculation based on the current input quantity. Therefore, before performing each single-step simulation calculation, it is necessary to perform data synchronization on the simulation instance to complete the single-step simulation data interaction.
[0113] In an optional embodiment, during the data synchronization process of step 10331 above:
[0114] S1, obtaining the output variable value of the simulation model;
[0115] S2, according to the external control data input mode of the offline simulation framework, passing the output variable value of the simulation model to the control algorithm program for control input quantity conversion;
[0116] S3. Setting the control input quantity converted by the control algorithm program as the input variable of the simulation instance for executing the next simulation step.
[0117] In this embodiment, before executing each simulation step, it is necessary to obtain the output variable values of the simulation model. These output variables have been marked in the modeling stage. The obtained output variable values will be used as the input basis for the subsequent control algorithm program. Specifically, according to the external control data input method of the offline simulation framework pre-set before the offline simulation, the output variable values of the simulation model are passed to the control algorithm program for control input quantity conversion. Finally, the control input quantity converted by the control algorithm program is set as the input variable of the simulation instance to execute the next simulation step, thereby completing the simulation data interaction.
[0118] 10332. Mark the timing starting point of the current single-step simulation and obtain the current physical time;
[0119] In order to measure the actual physical time consumed by the current simulation step, it is necessary to record the physical time when the simulation step starts. For example, a high-precision timer can be used to record the current physical time as the timing starting point.
[0120] 10333. Perform data synchronization update on the simulation instance to make the external control data effective;
[0121] After completing the simulation data interaction, you need to perform data synchronization and update operations to make the external control data effective. Before the simulation step starts, ensure that all external control data (such as sensor input, user instructions, etc.) have been synchronized and updated to the simulation instance. Specifically, you can update the relevant data in the simulation instance based on the data synchronization mechanism (such as network communication, file reading, etc.).
[0122] 10334. Execute a simulation step for the simulation instance, wherein the step length of the simulation step is a synchronization cycle;
[0123] Execute a simulation step to simulate the behavior of the simulation model in a synchronization cycle, calculate and update the state variables of the simulation instance. The step length of the simulation step used by offline simulation is one synchronization cycle.
[0124] 10335. Mark the timing end point of the current single-step simulation and obtain the current physical time;
[0125] In this embodiment, in order to measure the actual physical time consumed by the current simulation step, it is also necessary to record the physical time when the simulation step ends, for example, using a high-precision timer to record the current physical time as the timing end point.
[0126] 10336. Based on the timing end point and the timing start point corresponding to the current single-step simulation, obtain the actual physical time consumption of the current single-step simulation;
[0127] After completing a single-step simulation, the actual physical time consumption of the current simulation step needs to be calculated to evaluate the real-time performance of the simulation. Specifically, the difference between the timing end point and the timing start point is calculated to obtain the actual physical time consumption.
[0128] 10337. Calculate and update the real-time evaluation data of the simulation model according to the actual physical time consumption of the current single-step simulation;
[0129] In this embodiment, after calculating the actual physical time consumption of the current single-step simulation each time, it is necessary to synchronously calculate and update the real-time evaluation data of the simulation model.
[0130] In an optional embodiment, the real-time evaluation data includes real-time rate statistical information;
[0131] In another optional embodiment, the real-time evaluation data includes real-time rate statistics information and the real-time rate of each simulation step in the offline simulation process.
[0132] Real-time rate statistics include:
[0133] (1) Simulation timeout steps refer to the number of timeout steps with a real-time rate greater than 1 during the simulation step cycle. If the simulation timeout step is not 0, it means that the current synchronization period does not meet the real-time simulation requirements. You can adjust the synchronization period value or switch the simulation algorithm to determine the approximate range of the synchronization period suitable for the current controlled object model.
[0134] (2) Warning steps: refers to the number of steps in the simulation step cycle where the real-time rate is greater than the warning threshold. For stability reasons, the number of warning steps should be kept at a relatively small level as much as possible. As mentioned above, the warning threshold is a discount value introduced to eliminate the performance difference between the real-time simulator and the offline simulation tool. By adjusting the warning threshold, the performance parameters of the real-time simulator required for the current real-time simulation scenario can be roughly evaluated, providing reliable data for subsequent procurement needs.
[0135] (3) Average real-time rate: It is used to measure the real-time rate within the simulation time interval and evaluate the real-time rate fluctuation. The calculation formula is average real-time rate = (total simulation physical time / total number of simulation steps) / synchronization period.
[0136] (4) Maximum real-time rate and the time when the maximum real-time rate occurs
[0137] The maximum real-time rate indicates the maximum real-time rate that occurs during the simulation step cycle. It is used to measure the situation with the highest computational cost. If the maximum real-time rate is still less than the warning threshold, you can consider further shortening the synchronization cycle to reduce the accuracy loss caused by the control cycle margin. At the same time, record the time when the maximum real-time rate occurs, and analyze the behavior of the model at that time to assist in optimizing the simulation model.
[0138] 10338. Determine whether the current simulation time reaches the simulation end time;
[0139] 10339. If the current simulation time has not reached the simulation end time, the current simulation time is increased by one synchronization cycle and the next real-time simulation single step is executed.
[0140] 1034. When the simulation end time is reached, exit the real-time simulation single-step loop;
[0141] 1035. End the offline simulation and destroy the simulation instance.
[0142] In this embodiment, since the simulation time interval (simulation start time and end time) is pre-set before the start of the offline simulation, when executing the simulation single-step loop, it is necessary to determine whether the current simulation time has reached the preset simulation end time at the end of each simulation step. If the simulation end time is reached, the simulation single-step loop is exited, the offline simulation is ended, and the simulation instance is destroyed. Otherwise, the current simulation time is increased by one synchronization cycle and the next real-time simulation single-step is executed.
[0143] 104. When the offline simulation is finished, the real-time evaluation data of the offline simulation of the model is output;
[0144] After the offline simulation is completed, the real-time evaluation data of the model offline simulation is output, such as the number of simulation timeout steps, the number of warning steps, the average real-time rate, the maximum real-time rate and the time of occurrence. In addition, the real-time rate of each simulation step can also be output as needed.
[0145] 105. Determine whether the real-time evaluation data meets the expected conditions for real-time simulation of the model;
[0146] 106. If the real-time evaluation data does not meet the expected conditions, reset the relevant configuration of the offline simulation and / or re-acquire the optimized simulation model, and perform the next round of offline simulation on the simulation model.
[0147] In this embodiment, the real-time evaluation data output by the model offline simulation is used to evaluate whether the model offline simulation meets the expected conditions of the model real-time simulation, and the expected conditions are used to ensure that the offline simulation and the real-time simulation have a certain equivalence. There is no limit to the setting of the expected conditions, and it can be set based on one or more data in the real-time evaluation data of the model offline simulation. For example, the number of simulation timeout steps is less than 3, the number of warning steps is less than 1, the average real-time rate is less than 1 and greater than 0.8, etc.
[0148] In this embodiment, if the real-time evaluation data output after the model offline simulation ends does not meet the expected conditions for the model real-time simulation, it is necessary to reset the relevant configurations of the offline simulation, such as resetting the simulation start time and the simulation end time, the synchronization period, the simulation algorithm, the simulation calculation accuracy, the real-time rate warning threshold, or re-optimize the simulation model to reduce the model simulation calculation amount, and then obtain the optimized simulation model, and perform the next round of offline simulation on the simulation model until the real-time evaluation data output after the model offline simulation ends meets the expected conditions for the model real-time simulation.
[0149] The present embodiment provides a model offline simulation evaluation method, which is used to evaluate whether the model offline simulation meets the expectations of the model real-time simulation while verifying the model optimization effect by offline simulation. Specifically, an offline simulation framework is introduced, under which the model offline simulation is advanced according to the synchronization cycle, and the controlled object model (i.e., the simulation model) and the control algorithm program are independently operated, and data interaction is performed in the specified synchronization cycle, thereby simulating the data communication in the model real-time simulation process. In the process of periodic advancement, the controlled object model is subjected to real-time simulation calculation and real-time evaluation, and the real-time evaluation of the model offline simulation is performed to ensure that the offline simulation and the real-time simulation have a certain equivalence. If the real-time evaluation data of the current round does not meet the expected conditions of the model real-time simulation, the relevant configuration of the offline simulation is reset and / or the optimized simulation model is re-acquired, and then the next round of offline simulation is performed on the simulation model until the real-time evaluation data meets the expected conditions of the model real-time simulation. The present embodiment indirectly verifies the effect of the model real-time simulation through offline simulation, avoids various problems caused by directly deploying the simulation model on the real-time simulation machine, and also solves the timeout problem that may occur in the semi-physical simulation process.
[0150] The above describes the model offline simulation evaluation method in the embodiment of the present invention. The following describes the model offline simulation evaluation device in the embodiment of the present invention. Figure 2 , an embodiment of the model offline simulation evaluation device in the embodiment of the present invention includes:
[0151] An acquisition module 201 is used to acquire a simulation model of a controlled physical object;
[0152] A setting module 202, used to set the relevant configuration of the offline simulation and the external control data input mode of the offline simulation framework;
[0153] The simulation evaluation module 203 is used to start the offline simulation, and during the offline simulation process, perform real-time simulation calculation on the simulation model based on the offline simulation framework and evaluate the real-time performance of the offline simulation of the model;
[0154] Output module 204, used for outputting real-time evaluation data of the offline simulation of the model when the offline simulation is finished;
[0155] A judgment module 205 is used to judge whether the real-time evaluation data meets the expected conditions of the real-time simulation of the model;
[0156] The loop module 206 is used to reset the relevant configuration of the offline simulation and / or re-acquire the optimized simulation model if the real-time evaluation data does not meet the expected conditions, and perform the next round of offline simulation on the simulation model.
[0157] Optionally, in one embodiment, the simulation evaluation module 203 is specifically used for:
[0158] When the simulation start time is reached, the offline simulation is started and the following operations are performed based on the offline simulation framework during the offline simulation:
[0159] Performing a simulation instantiation operation on the simulation model to obtain a simulation instance;
[0160] Performing a simulation initialization operation on the simulation instance to obtain an initialized simulation instance;
[0161] Starting a real-time simulation single-step loop for the simulation instance, and executing the real-time simulation single-step advancement according to the synchronization cycle, counting the actual physical time consumption of the single-step simulation, and calculating the real-time evaluation data;
[0162] When the simulation end time is reached, exit the real-time simulation single-step loop;
[0163] End the offline simulation and destroy the simulation instance.
[0164] Optionally, in one embodiment, the simulation evaluation module 203 is further configured to:
[0165] Performing data synchronization on the simulation instance to complete single-step simulation data interaction;
[0166] Mark the timing starting point of the current single-step simulation and obtain the current physical time;
[0167] Performing data synchronization update on the simulation instance to make the external control data effective;
[0168] Execute a simulation step on the simulation instance, wherein the step length of the simulation step is a synchronization cycle;
[0169] Mark the timing end point of the current single-step simulation and obtain the current physical time;
[0170] Based on the timing end point and timing start point corresponding to the current single-step simulation, the actual physical time consumption of the current single-step simulation is obtained;
[0171] Calculate and update the real-time evaluation data of the simulation model according to the actual physical time consumption of the current single-step simulation;
[0172] Determine whether the current simulation time reaches the simulation end time;
[0173] If the current simulation time has not reached the simulation end time, the current simulation time is increased by one synchronization cycle and the next real-time simulation single step is executed.
[0174] Optionally, in one embodiment, the simulation evaluation module 203 is further configured to:
[0175] Obtaining output variable values of the simulation model;
[0176] According to the external control data input mode of the offline simulation framework, the output variable value of the simulation model is passed to the control algorithm program for control input quantity conversion;
[0177] The control input quantity converted by the control algorithm program is set as the input variable of the simulation instance to execute the next simulation step.
[0178] Optionally, in one embodiment, the relevant configuration of the offline simulation includes simulation start time and simulation end time, synchronization cycle, simulation algorithm, simulation calculation accuracy, and real-time rate warning threshold.
[0179] Optionally, in one embodiment, the real-time evaluation data includes real-time rate statistics information, or the real-time evaluation data includes real-time rate statistics information and the real-time rate of each simulation step in the offline simulation process;
[0180] The real-time rate statistical information includes the number of simulation timeout steps, the number of warning steps, the average real-time rate, the maximum real-time rate and the time when the maximum real-time rate occurs; the real-time rate is the ratio of the actual physical time consumed to execute a single-step simulation within a synchronization cycle to the synchronization cycle.
[0181] Optionally, in one embodiment, the external control data input method of the offline simulation framework includes: any one of: a joint simulation method, a function call method and an interpolation table method.
[0182] Since the embodiments of the device part correspond to the embodiments of the above-mentioned method, please refer to the above-mentioned method embodiments for the introduction of the model offline simulation and evaluation device provided by the present invention. The present invention will not be repeated here, and it has the same beneficial effects as the above-mentioned model offline simulation and evaluation method.
[0183] above Figure 2 The model offline simulation evaluation device in the embodiment of the present invention is described in detail from the perspective of modular functional entities, and the computer device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0184] Figure 3: is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. The computer device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the computer device 500. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the computer device 500.
[0185] The computer device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 3 The illustrated computer device structure does not constitute a limitation on the computer device, and may include more or fewer components than illustrated, or combine certain components, or arrange the components differently.
[0186] The present invention also provides a computer device, the computer device includes a memory and a processor, the memory stores computer-readable instructions, when the computer-readable instructions are executed by the processor, the processor executes the steps of the model offline simulation evaluation method in the above embodiments. The present invention also provides a computer-readable storage medium, the computer-readable storage medium can be a non-volatile computer-readable storage medium, the computer-readable storage medium can also be a volatile computer-readable storage medium, the computer-readable storage medium stores instructions, when the instructions are executed on the computer, the computer executes the steps of the model offline simulation evaluation method.
[0187] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0188] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0189] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A model offline simulation evaluation method, characterized in that: The model offline simulation evaluation method comprises: Acquire a simulation model of the controlled physical object; Set the offline simulation configuration and the external control data input method of the offline simulation framework; When the simulation start time is reached, the offline simulation is started and the following operations are performed based on the offline simulation framework during the offline simulation: Performing a simulation instantiation operation on the simulation model to obtain a simulation instance; Performing a simulation initialization operation on the simulation instance to obtain an initialized simulation instance; Performing data synchronization on the simulation instance to complete single-step simulation data interaction; wherein, performing data synchronization on the simulation instance to complete single-step simulation data interaction includes: obtaining the output variable value of the simulation model; passing the output variable value of the simulation model to the control algorithm program for control input quantity conversion according to the external control data input mode of the offline simulation framework; setting the control input quantity converted by the control algorithm program as the input variable of the simulation instance to execute the next simulation step; Mark the timing starting point of the current single-step simulation and obtain the current physical time; Performing data synchronization update on the simulation instance to make the external control data effective; Execute a simulation step on the simulation instance, wherein the step length of the simulation step is a synchronization cycle; Mark the timing end point of the current single-step simulation and obtain the current physical time; Based on the timing end point and timing start point corresponding to the current single-step simulation, the actual physical time consumption of the current single-step simulation is obtained; According to the actual physical time consumption of the current single-step simulation, the real-time evaluation data of the simulation model is calculated and updated; wherein the real-time evaluation data includes real-time rate statistics information, or the real-time evaluation data includes real-time rate statistics information and the real-time rate of each simulation step in the offline simulation process; the real-time rate statistics information includes the number of simulation timeout steps, the number of warning steps, the average real-time rate, the maximum real-time rate and the time when the maximum real-time rate occurs; the real-time rate is the ratio of the actual physical time consumption of executing the single-step simulation within a synchronization cycle to the synchronization cycle; Determine whether the current simulation time reaches the simulation end time; If the current simulation time has not reached the simulation end time, the current simulation time is increased by one synchronization cycle and the next real-time simulation single step is executed; When the simulation end time is reached, exit the real-time simulation single-step loop; End the offline simulation and destroy the simulation instance; When the offline simulation is finished, the real-time evaluation data of the offline simulation of the model is output; Determining whether the real-time evaluation data meets the expected conditions for real-time simulation of the model; If the real-time evaluation data does not meet the expected conditions, the relevant configuration of the offline simulation is reset and / or the optimized simulation model is re-acquired, and the next round of offline simulation is performed on the simulation model.
2. The model offline simulation evaluation method according to claim 1, characterized in that: The relevant configuration of the offline simulation includes simulation start time and simulation end time, synchronization cycle, simulation algorithm, simulation calculation accuracy, and real-time rate warning threshold.
3. The model offline simulation evaluation method according to claim 1, characterized in that: The external control data input mode of the offline simulation framework includes: any one of a joint simulation mode, a function call mode and an interpolation table mode.
4. A model offline simulation evaluation device, characterized in that: The model offline simulation evaluation device comprises: An acquisition module, used for acquiring a simulation model of a controlled physical object; The setting module is used to set the relevant configuration of offline simulation and the external control data input method of the offline simulation framework; A simulation evaluation module is used to start the offline simulation when the simulation start time is reached and perform the following operations based on the offline simulation framework during the offline simulation process: perform a simulation instantiation operation on the simulation model to obtain a simulation instance; perform a simulation initialization operation on the simulation instance to obtain an initialized simulation instance; perform data synchronization on the simulation instance to complete single-step simulation data interaction; mark the timing start point of the current single-step simulation and obtain the current physical time; perform data synchronization update on the simulation instance to make external control data effective; perform a simulation step on the simulation instance, wherein the step length of the simulation step is a synchronization cycle; mark the timing end point of the current single-step simulation and obtain the current physical time; based on the timing end point and timing start point corresponding to the current single-step simulation, obtain the actual physical time consumption of the current single-step simulation; calculate and update the real-time evaluation data of the simulation model according to the actual physical time consumption of the current single-step simulation; determine whether the current simulation time reaches the simulation end time; if the current simulation time does not reach the simulation end time, increase the current simulation time by one synchronization cycle and perform the next real-time simulation single-step advancement; when the simulation end time is reached, exit the real-time simulation single-step loop; end the offline simulation and destroy the simulation instance; The simulation evaluation module is further used to: obtain the output variable value of the simulation model; transfer the output variable value of the simulation model to the control algorithm program for control input quantity conversion according to the external control data input mode of the offline simulation framework; set the control input quantity converted by the control algorithm program as the input variable of the simulation instance to execute the next simulation step; An output module is used to output the real-time evaluation data of the offline simulation of the model when the offline simulation ends; wherein the real-time evaluation data includes real-time rate statistics information, or the real-time evaluation data includes real-time rate statistics information and the real-time rate of each simulation step in the offline simulation process; the real-time rate statistics information includes the number of simulation timeout steps, the number of warning steps, the average real-time rate, the maximum real-time rate and the time of occurrence of the maximum real-time rate; the real-time rate is the ratio of the actual physical time consumed to execute a single-step simulation within a synchronization cycle to the synchronization cycle; A judgment module, used to judge whether the real-time evaluation data meets the expected conditions of the real-time simulation of the model; The loop module is used to reset the relevant configuration of the offline simulation and / or re-acquire the optimized simulation model if the real-time evaluation data does not meet the expected conditions, and perform the next round of offline simulation on the simulation model.
5. A computer device, characterized in that: The computer device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory to enable the computer device to execute the model offline simulation evaluation method according to any one of claims 1 to 3.
6. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the model offline simulation evaluation method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Spacecraft telemetry and control coverage analysis design platform
CN108460216A
Analysis of eye movements in 3D real space in direction and depth
US20230225611A1