System simulation debugging method and device and electronic equipment

By obtaining the module information of the dynamic system model and generating an execution script, flexible rollback and real-time parameter adjustment of the dynamic system model are achieved, which solves the problem of low debugging efficiency in the existing technology and improves the efficiency and flexibility of simulation debugging.

CN120687350APending Publication Date: 2025-09-23BEITAI ZHENHUAN (CHONGQING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510794389.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

In the prior art, dynamic system simulation debugging cannot be flexibly rolled back to any time point and it is difficult to adjust module parameters in real time, resulting in low debugging efficiency.

Method used

By obtaining the module information of the dynamic system model, generating an execution script and performing simulation, obtaining the target module information and the number of backoff steps, the debugging operation of the dynamic system model is realized, supporting real-time module parameter modification and backoff at any time point without adding additional memory burden.

Benefits of technology

It improves the efficiency and flexibility of dynamic system simulation debugging, allows rollback at any time point and real-time adjustment of module parameters, reduces memory usage, and improves debugging flexibility and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687350A_ABST
    Figure CN120687350A_ABST
Patent Text Reader

Abstract

The invention discloses a system simulation debugging method and device and electronic equipment. The method comprises the following steps: acquiring module information of a dynamic system model; an execution script is generated according to the module information, the dynamic system model is simulated according to the execution script, and the execution script comprises execution logic and a debugging function corresponding to the dynamic system model; target module information and a step-back step number when the dynamic system model performs simulation execution to a preset breakpoint are obtained, the target module information is module information adjusted according to an update demand of a target object, and the step-back step number is a time step number of the target object expecting to return in a simulation process; and debugging the dynamic system model according to the target module information and the step number. According to the method and the device, the technical problems that a dynamic system cannot flexibly return to any time point and module parameters are difficult to adjust in real time during simulation debugging in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of simulation technology, and in particular to a system simulation debugging method, device and electronic equipment. Background Art

[0002] Dynamic system simulation is typically based on ordinary differential equations or systems thereof, using scientific computing software and specialized dynamic system simulation software (such as Simulink, Open Modelica, and Maple). These software programs provide the ability to mathematically model and solve complex dynamic systems, but their debugging and visual monitoring capabilities have certain technical limitations.

[0003] For example, Simulink, as a leader in the field of dynamic system simulation, has evolved its debugging capabilities from supporting only basic breakpoints, to developing a stepping function, and then to currently supporting both stepping and stepping back. In Simulink, the implementation of the stepping back function is based on additional recording of the state of each step in the simulation process, which to a certain extent solves the need for backtracking during debugging, but at the same time brings negative impacts on memory usage and running speed. In addition, the current stepping back function requires the number of stepping back steps to be preset before the simulation starts, which limits debugging flexibility, especially for scenarios where it is difficult to predict the debugging location in advance. In addition, related technologies usually use a unified sampling setting to determine the sampling time of each module in the dynamic system model during dynamic system debugging or simulation. Once the simulation is started, it cannot be dynamically adjusted, which is not convenient when encountering debugging scenarios that require parameter adjustment.

[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0005] The embodiments of the present application provide a system simulation debugging method, device and electronic device to at least solve the technical problems in the related art that dynamic systems cannot flexibly roll back to any time point during simulation debugging and it is difficult to adjust module parameters in real time.

[0006] According to one aspect of an embodiment of the present application, a system simulation and debugging method is provided, comprising: obtaining module information of a dynamic system model, wherein the module information includes at least parameter information, sampling time, and execution order of each module in the dynamic system model; generating an execution script based on the module information, and simulating the dynamic system model based on the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model; obtaining target module information and a number of back-steps when the simulation of the dynamic system model reaches a preset breakpoint, wherein the target module information is module information adjusted according to the update requirements of the target object, and the number of back-steps is the number of time steps that the target object expects to backtrack during the simulation process; and performing debugging operations on the dynamic system model based on the target module information and the number of back-steps.

[0007] Optionally, before generating an execution script based on the module information, the method further includes: obtaining a first-level node corresponding to an array consisting of all modules in the dynamic system model; obtaining a second-level node corresponding to the module information; and converting the module information into tree structure data based on the first-level node and the second-level node.

[0008] Optionally, before obtaining the target module information and the number of back steps when the dynamic system model simulation is executed to a preset breakpoint, the method also includes: determining the target position of the preset breakpoint in the debugger, wherein the preset breakpoint is in a to-be-activated state and the target position is any position after the debugger completes all data operations; receiving an activation instruction of the target object, and activating the preset breakpoint according to the activation instruction.

[0009] Optionally, obtaining the target module information and the number of back-steps when the dynamic system model simulation is executed to a preset breakpoint includes: receiving an update instruction and a back-step instruction of the target object, wherein the update instruction is used to guide the update operation of the module information, and the back-step instruction is used to guide the back-step operation of the dynamic system model; determining the target module information based on the update instruction, and determining the number of back-steps based on the back-step instruction.

[0010] Optionally, the method also includes: obtaining a first output variable of the dynamic system model at a preset breakpoint; determining a data length corresponding to the number of backoff steps; deleting a data variable corresponding to the data length at the end of the first output variable to obtain a second output variable, and storing the second output variable in a solver, wherein the second output variable is used to represent the output variable of the dynamic system model after performing a backoff operation.

[0011] Optionally, the method also includes: when the solver is a variable-step solver, determining a time series corresponding to the first output variable, wherein the time series is used to identify the time point of each data variable in the first output variable; subtracting the number of back-off steps from the tail of the time series to obtain a first time point, and subtracting the number of back-off steps from the tail of the time series and adding one to obtain a second time point; performing a differential calculation on the first time point and the second time point to obtain a differential result, and determining the differential result as a trial time interval for the next moment, wherein the trial time interval is used to represent a preliminary time span estimate for the variable-step solver to restart the calculation after performing a back-off operation.

[0012] Optionally, the method also includes: obtaining module data at a preset breakpoint through a monitor and displaying it on a user interface, wherein, when an oscilloscope module exists in the monitor, a signal change curve corresponding to the dynamic system model is generated, and the signal change curve is used to represent the signal change trend of the dynamic system model from the start of simulation to the preset breakpoint.

[0013] Optionally, the method further includes: receiving a display instruction of the target object, wherein the display instruction includes a data display format expected by the target object, and the data display format includes at least one of the following: scalar format, array format and string format; and displaying the module data according to the display instruction.

[0014] According to another aspect of an embodiment of the present application, a system simulation and debugging device is also provided, including: a first acquisition module, used to obtain module information of a dynamic system model, wherein the module information includes at least parameter information, sampling time and execution order of each module in the dynamic system model; a simulation module, used to generate an execution script based on the module information, and simulate the dynamic system model based on the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model; a second acquisition module, used to obtain target module information and the number of back-steps when the simulation of the dynamic system model reaches a preset breakpoint, wherein the target module information is module information adjusted according to the update requirements of the target object, and the number of back-steps is the number of time steps that the target object expects to back off during the simulation process; and a debugging module, used to perform debugging operations on the dynamic system model based on the target module information and the number of back-steps.

[0015] According to another aspect of the embodiments of the present application, an electronic device is provided, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned system simulation debugging method.

[0016] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned system simulation debugging method by running the computer program.

[0017] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned system simulation debugging method when executed by a processor.

[0018] In an embodiment of the present application, by obtaining module information of a dynamic system model, wherein the module information includes at least parameter information, sampling time and execution order of each module in the dynamic system model; generating an execution script based on the module information, and simulating the dynamic system model based on the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model; obtaining target module information and the number of backoff steps when the dynamic system model simulation is executed to a preset breakpoint, wherein the target module information is module information adjusted according to the update requirements of the target object, and the number of backoff steps is the number of time steps that the target object expects to backoff during the simulation process; debugging the dynamic system model based on the target module information and the number of backoff steps, thereby achieving the purpose of improving the simulation debugging efficiency and flexibility of the dynamic system, thereby achieving the technical effect of real-time module parameter modification and backoff debugging at any time point without increasing the additional memory burden, thereby solving the technical problems in the related art that the dynamic system cannot flexibly backoff to any time point and is difficult to adjust module parameters in real time during simulation debugging. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0020] Figure 1 is a hardware structure diagram of a computer terminal for implementing a system simulation debugging method according to an embodiment of the present application;

[0021] Figure 2 is a flow chart of a system simulation debugging method according to an embodiment of the present application;

[0022] Figure 3 is a structural diagram of a dynamic system model according to an embodiment of the present application;

[0023] Figure 4 This is a label display diagram of a dynamic system model according to an embodiment of the present application when it is stepped to 0.4 simulation time;

[0024] Figure 5 is an oscilloscope display diagram of a dynamic system model during a 0-0.4 simulation period according to an embodiment of the present application;

[0025] Figure 6This is a label display diagram of a dynamic system model according to an embodiment of the present application when it is stepped back to the 0.2 simulation time;

[0026] Figure 7 is an oscilloscope display diagram of a dynamic system model during a 0-0.2 simulation according to an embodiment of the present application;

[0027] Figure 8 It is a structural diagram of a system simulation debugging device according to an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] First, some nouns or terms that appear in the process of explaining the embodiments of this application are subject to the following explanations:

[0031] Ordinary Differential Equation (ODE): A relationship between a function and its derivatives of several orders, with only one independent variable. It is widely used in the construction of mathematical models in many fields such as physics, engineering, and biology.

[0032] Dynamic system: refers to a system that changes over time and whose state evolves over time and can be described by ordinary differential equations or difference equations.

[0033] Stepping: A fundamental operation in debugging that allows a program or simulation to progress step by step so that the state at each time step can be examined in detail.

[0034] Step Back: The opposite of Step Forward, Step Back allows simulation or program execution to rewind to a previous step, which helps developers understand what caused a specific state change.

[0035] Breakpoints: Markers set during debugging that automatically pause program execution, allowing the developer to examine the current state. Breakpoints can be enabled or disabled to control the pause point in the debugging process.

[0036] In order to solve the problem of poor system simulation debugging effect in the related art, the embodiment of the present application provides a system simulation debugging method, which can be run on Figure 1 Among the computer terminals shown, the computer terminal will be described below.

[0037] The system simulation debugging method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG1 shows a hardware structure block diagram of a computer terminal for implementing a system simulation debugging method. Figure 1 As shown, the computer terminal 10 may include one or more (illustrated by 102a, 102b, ..., 102n in the figure) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0038] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10. As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0039] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the system simulation debugging method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above-mentioned system simulation debugging method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0040] The transmission module 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission module 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission module 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0041] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0042] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0043] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a system simulation debugging method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0044] Figure 2 is a flow chart of a system simulation debugging method according to an embodiment of the present application, such as Figure 2As shown, the method includes the following steps:

[0045] Step S202 : Acquire module information of the dynamic system model, wherein the module information at least includes parameter information, sampling time, and execution sequence of each module in the dynamic system model.

[0046] Step S204 : generating an execution script according to the module information, and simulating the dynamic system model according to the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model.

[0047] Step S206, obtaining the target module information and the number of back-steps when the dynamic system model simulation reaches a preset breakpoint, wherein the target module information is the module information adjusted according to the update requirements of the target object, and the number of back-steps is the number of time steps that the target object expects to back-step during the simulation process.

[0048] Step S208 : Debugging the dynamic system model according to the target module information and the number of backoff steps.

[0049] Through steps S202 to S208 described above, the goal of improving the simulation debugging efficiency and flexibility of the dynamic system is achieved, thereby achieving the technical effect of performing real-time module parameter modification and rollback debugging at any time point without adding additional memory load. This further solves the technical problems in the related art of dynamic systems that cannot flexibly roll back to any time point during simulation debugging and that make it difficult to adjust module parameters in real time. Detailed descriptions are given below.

[0050] In the above step S202, first, it is necessary to collect relevant information of all modules that make up the dynamic system model. The module is the smallest indivisible unit that makes up the dynamic system model. The module information includes but is not limited to the essential parameters, sampling time and execution order of each module in the model simulation solution process. Among them, the essential parameters reflect the intrinsic functions and behavior settings of the module, and the sampling time defines the time resolution of the module response. Both are determined by the specific simulation scenario and are usually user input. The execution order is determined based on the topological structure and internal signal flow of the model. For example, the module that generates the output signal first is always ranked in a more forward position to ensure the correctness of signal transmission and the consistency of the simulation calculation. It should be noted that the execution order of the module is also the identification code of the module in the model. Subsequent operations such as changing parameter values ​​and obtaining port values ​​require the use of this identification code.

[0051] In step S204, a set of scientific computing scripts, or M scripts, can be generated based on the collected module information. These scripts can be recognized and executed by scientific computing software (such as MATLAB). After the simulation begins, the solver will follow the instructions in the execution script and advance the dynamic simulation process of the model according to the predetermined logic. Among them, the M script not only contains the execution logic of the model, that is, how to solve the ordinary differential equations in the model according to the correct order and parameter settings, but also integrates debugging functions, which enables the script to have debugging and monitoring capabilities when executing the simulation task.

[0052] Optionally, before generating an execution script based on the module information, the method further includes: obtaining a first-level node corresponding to an array consisting of all modules in the dynamic system model; obtaining a second-level node corresponding to the module information in the dynamic system model; and converting the module information into tree structure data based on the first-level node and the second-level node.

[0053] In the embodiment of the present application, in order to achieve efficient debugging, a special data organization method is adopted, that is, module information is converted into independent variables in a tree structure and passed into the solver. Among them, the tree structure data organization, the first-level node represents the array composed of all modules, ensures that each module is processed as an independent entity, and also maintains the relevance and execution order between them. The second-level node contains the essential parameters, sampling time and execution order of the module. This information is crucial in the debugging process because it directly determines the module's behavior, status update frequency and identity in the simulation process.

[0054] Optionally, the above method also includes: determining the target position of the preset breakpoint in the debugger, wherein the preset breakpoint is in a to-be-activated state and the target position is any position after the debugger completes all data operations; receiving an activation instruction of the target object, and activating the preset breakpoint according to the activation instruction.

[0055] In the embodiment of the present application, by pre-setting breakpoints in the debugger to be activated and flexibly activating them according to user instructions, it is ensured that the dynamic system model can maintain smooth simulation operation during the simulation process and enter the debugging state in a timely manner, thereby achieving fine control of the dynamic system model and accurate positioning of problems, thereby providing a more efficient and practical debugging method for dynamic system simulation.

[0056] Specifically, the debugger, as a subroutine called by the solver, plays a core role in communicating simulation process data. Among them, the preset breakpoint is set at a fixed position in the debugger and is in a "sleep" state until it receives the user's activation instruction. This mechanism ensures that the debugger can intervene in the simulation process at any time without affecting the normal simulation. It is worth noting that the preset breakpoint is set at the position after the debugger has executed all operations. It ensures that when the breakpoint is triggered, the model status and output data are the latest, thereby providing accurate debugging information, which makes it easier for the debugger to update the module status according to the timing and finely control the simulation process.

[0057] Activating the debug state is triggered by the user through an interactive button on the interface. Specifically, after the user issues the activation command, the system transmits a signal to the scientific computing software, activating the breakpoints previously set in the debugger that are in the "sleep" state. Execution of this command pauses the simulation and enters debug mode. In debug mode, the user can conduct in-depth inspection of the model, including viewing status, outputting data, and even modifying model parameters, and then continue the simulation or return to an earlier point in time using the step-back function. This real-time activation and control of the debug state greatly enhances the user's operational freedom and debugging efficiency during the simulation process.

[0058] In the above step S206, when the simulation reaches the above-mentioned activated preset breakpoint, the debugger will capture the current target module information and the number of backsteps, and pass them to the solver for further debugging operations. Among them, the target module information is obtained after the user changes the update requirements of the original module information, and the number of backsteps is the number of simulation state backstep time steps specified by the user. For example, the user may decide to adjust the parameters of a certain module during the debugging process, or choose to roll back the simulation to a previous time point. These operations require the debugger to update or process the incoming information accordingly. This step ensures that the debugger can accurately locate the point where the problem occurs and make parameter adjustments and state backtracking when necessary.

[0059] Optionally, obtaining the target module information and the number of back-steps when the dynamic system model simulation is executed to a preset breakpoint includes: receiving an update instruction and a back-step instruction of the target object, wherein the update instruction is used to guide the update operation of the module information, and the back-step instruction is used to guide the back-step operation of the dynamic system model; determining the target module information based on the update instruction, and determining the number of back-steps based on the back-step instruction.

[0060] In an embodiment of the present application, the acquisition of target module information and the number of backtracking steps is achieved by receiving two key commands from the user interface: an update command, which is used to guide the real-time update of module information, and a rollback command, which is used to guide the backtracking operation of the simulation state. Receiving the update command allows the user to adjust the parameters of a specific module when the simulation is paused. This immediate parameter modification provides great flexibility for debugging. In particular, when the user finds that the performance of certain modules does not meet expectations, they can react quickly, adjust the parameters, and then continue the simulation, avoiding the complicated process of restarting the simulation in traditional debugging. Receiving the rollback command is the basis for implementing the rollback operation of the dynamic system model. It gives the user the ability to roll back to the previous state at any stage of the simulation, and the number of backtracking steps is determined entirely based on the user's needs. This rollback mechanism overcomes the limitations of the backtracking function in the prior art. That is, there is no need to preset the number of backtracking steps before the simulation begins. The user can dynamically determine the precise time point to roll back based on the actual problems encountered during the debugging process, greatly enhancing the ability to analyze problems and locate faults.

[0061] It should be noted that in this step, the debugger will save all module port data of the current time step into a local data domain before transmitting information. This operation ensures that even after the simulation rolls back, the complete state at the breakpoint can be restored.

[0062] In the above step S208, based on the obtained target module information and the number of backsteps, the system enters the debugging mode and performs targeted debugging operations, including but not limited to: modifying the parameters of the selected module, rolling back the simulation state to any previous time point, recalculating the system state from the modification point to the current point, and updating the signal flow and output results on the monitor in real time.

[0063] It is worth noting that the step-back operation in this application does not require additional recording of the status of each step, which reduces memory consumption and enhances debugging flexibility. At the same time, the dynamic adjustment of the sampling time during debugging also facilitates model optimization.

[0064] Optionally, the above method also includes: obtaining the first output variable of the dynamic system model at a preset breakpoint; determining the data length corresponding to the number of backoff steps; deleting the data variable corresponding to the data length at the end of the first output variable to obtain a second output variable, and storing the second output variable in the solver, wherein the second output variable is used to represent the output variable of the dynamic system model after performing the backoff operation.

[0065] In the embodiment of the present application, the solver in the debugging state switches to the debugging branch (a code path specifically used to handle debugging requests) to adapt to the special needs of the debugging environment. For example, it obtains the first output variable of the dynamic system model when a preset breakpoint is reached, and then performs data processing for the step-back operation.

[0066] Specifically, when a simulation reaches a breakpoint, the solver saves all current output variables, the first output variable mentioned above. Subsequently, based on the number of backsteps obtained from the debugger, the solver determines the length of data to be deleted to enable backtracking of the simulation timeline. Next, the solver deletes the most recent data at the end of the first output variable, matching the number of backsteps. This creates a new output variable, the second output variable mentioned above, reflecting the simulation state of the dynamic system model after backtracking to the specified time point.

[0067] Furthermore, the second output variable is stored in memory to ensure that the simulation can accurately resume from a user-specified past point in time. This strategy cleverly avoids the existing problem of frequent rollbacks resulting in large amounts of additional memory usage. It also eliminates pre-set limits on the number of rollback steps, giving users greater freedom and finer control over the simulation process during debugging. By directly manipulating the output variable, this method simplifies rollback operations, improves system response speed and debugging efficiency, and significantly enhances the flexibility and practicality of dynamic system simulation debugging.

[0068] Optionally, the above method also includes: when the solver is a variable step-size solver, determining a time series corresponding to the first output variable, wherein the time series is used to identify the time point of each data variable in the first output variable; subtracting the number of back-off steps from the tail of the time series to obtain a first time point, and subtracting the number of back-off steps from the tail of the time series and adding one to obtain a second time point; performing a differential calculation on the first time point and the second time point to obtain a differential result, and determining the differential result as a trial time interval for the next moment, wherein the trial time interval is used to represent a preliminary time span estimate for the variable step-size solver to restart the calculation after performing a back-off operation.

[0069] In the embodiment of the present application, additional steps are designed specifically for the variable step solver to optimize the fallback operation. The specific process can be as follows:

[0070] First, obtain the time series corresponding to the first output variable, which records the exact time point when each data variable is generated.

[0071] Secondly, based on the number of back steps received from the debugger, the first time point is obtained by subtracting the number of back steps from the tail of the time series (i.e., the latest time point), and the second time point is obtained by subtracting the number of back steps from the tail of the time series and adding one. This operation essentially locates the start and end time after the back step in the time series.

[0072] Next, by performing a differential calculation between the first and second time points, the solver can obtain a differential result, which is then set as the solver's trial interval at the next moment. The trial interval is used to represent the variable-step solver's initial estimate of the step size to be selected in each iteration.

[0073] Through the above process, the solver can intelligently adjust its calculation step size after executing the backoff operation, which not only ensures the calculation accuracy but also improves the calculation efficiency. It not only avoids the time synchronization problems that may occur in the traditional fixed-step backoff, but also provides adaptive time step management for the variable-step solver in debugging mode, significantly enhancing the flexibility and accuracy of simulation debugging.

[0074] It's important to note that after the rollback operation, the solver also reinitializes the execution of each module using the updated target module information obtained from the debugger. This means that the solver reevaluates the behavior of each module based on the latest parameter settings and calls their executions in the order of causal relationships between modules to resume and continue the simulation. This series of operations not only supports flexible model debugging but also ensures simulation continuity and accuracy during debugging, providing users with powerful tools for precisely controlling and analyzing the behavior of dynamic systems.

[0075] Optionally, the above method also includes: obtaining module data at a preset breakpoint through a monitor and displaying it on a user interface, wherein, when an oscilloscope module exists in the monitor, generating a signal change curve corresponding to the dynamic system model, and the signal change curve is used to represent the signal change trend of the dynamic system model from the start of simulation to the preset breakpoint; and receiving a display instruction of the target object, wherein the display instruction includes the data display format expected by the target object, and the data display format includes at least one of the following: scalar format, array format and string format; displaying the module data according to the display instruction.

[0076] In the embodiments of the present application, the monitor plays a key role in information display and data analysis. When the simulation is paused at the preset breakpoint, the monitor can accurately extract the data of interest to the user from the debugger's internal data area based on the identification code of each module. The flexibility of this step is reflected in the monitor's processing and display of data. It can provide customized information display based on the data type (scalar value, array of values, string) and user needs.

[0077] In particular, when an oscilloscope module is integrated into the monitor, it can generate a curve depicting signal changes. This curve clearly shows the signal evolution process of the dynamic system model from the beginning of simulation to the breakpoint, providing users with intuitive visual assistance, making it easier to quickly understand system behavior and identify abnormal trends.

[0078] In addition, the monitor also introduces a response mechanism for display instructions, allowing users to customize the form of data display, including but not limited to scalar form, array form or string form. When receiving a specific display instruction, the monitor will format the module data accordingly to meet the user's different data analysis needs. For example, for complex array data, the monitor can display it in an orderly manner according to the row and column structure of the array, and automatically omit unnecessary parts when the array size is too large to reduce visual clutter; for string data, the monitor will convert ASCII code into easy-to-understand text. If the string length is too long, only the first nine characters will be displayed, and the rest will be omitted to ensure the conciseness and readability of the information.

[0079] This series of mechanisms ensures that the monitor presents key data from complex dynamic system models in an intuitive and user-friendly manner, enhancing data visibility while providing users with tools for in-depth analysis of system behavior and debugging issues. The efficient data exchange mechanism between the monitor and debugger, as well as the intelligent processing of different data types, significantly improves the accuracy and convenience of dynamic system simulation and debugging, representing a significant advancement in dynamic system simulation and debugging technology.

[0080] In the embodiments of this application, Figure 3 As shown in the figure, using the integration of a sinusoidal signal module as an example, a dynamic system model is created that connects a sinusoidal signal, an integrator, and an oscilloscope. The monitoring tags for the sinusoidal signal and the integrator output ports are enabled. A first-order Runge-Kutta solver is selected for this dynamic system model, with a simulation duration of 10, a solver step size of 0.2, and an initial integrator value of 0.

[0081] Next, step to the 0.4 simulation time and check the monitoring tag at this time, such as Figure 4 As shown, the monitoring label correctly displays the values ​​of each port at the 0.4 simulation time.

[0082] At the same time, check the curve recorded by the oscilloscope, such as Figure 5 As shown in FIG. 1 , the oscilloscope can correctly display the curve during the 0-0.4 simulation.

[0083] Then, step back to the simulation time 0.2 and check the monitoring label at this time, as shown in the following figure: Figure 6 As shown, the monitor label is still displayed correctly.

[0084] At the same time, check the curve recorded by the oscilloscope, such as Figure 7 As shown, the oscilloscope can still correctly display the curve during the 0-0.2 simulation.

[0085] In the embodiments of the present application, a new dynamic system simulation and debugging method is proposed, which achieves significant improvements and beneficial effects compared to the simulation and debugging methods in the related art. Specifically, first, the present application supports the step-back function without the need for additional records and memory usage, which not only reduces resource consumption but also improves the overall performance of the system. Especially in a memory-constrained environment, its advantages are particularly obvious. Secondly, the present application allows the user to go back to any time point during a single debugging process, getting rid of the preset restrictions on the number of step-backs in traditional technology, greatly improving the flexibility and efficiency of debugging, and enabling users to locate and analyze problems more accurately. Finally, the present application supports real-time modification of the sampling time of the model during the debugging process, which provides convenience for comparing system behaviors under different sampling rates and helps to deepen the understanding of the dynamic characteristics of the system. In addition, the enhanced functions of the monitor, such as intelligent display management and oscilloscope curve generation, further optimize the user interface experience and improve the intuitiveness and accuracy of data analysis.

[0086] According to an embodiment of the present application, a system simulation debugging device is provided. It should be noted that the system simulation debugging device of the embodiment of the present application can be used to execute the system simulation debugging method provided in the embodiment of the present application. The system simulation debugging device provided in the embodiment of the present application is introduced below.

[0087] Figure 8 This is a structural diagram of a system simulation debugging device provided according to an embodiment of the present application. Figure 8 As shown, the device includes:

[0088] A first acquisition module 80 is configured to acquire module information of the dynamic system model, wherein the module information includes at least parameter information, sampling time, and execution order of each module in the dynamic system model;

[0089] A simulation module 82 is configured to generate an execution script based on the module information and simulate the dynamic system model based on the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model;

[0090] A second acquisition module 84 is configured to acquire target module information and a back-step number when the dynamic system model simulation reaches a preset breakpoint, wherein the target module information is module information adjusted according to the update requirements of the target object, and the back-step number is the number of time steps that the target object expects to back-step during the simulation process;

[0091] The debugging module 86 is used to perform debugging operations on the dynamic system model according to the target module information and the number of back-steps.

[0092] Through the first acquisition module, simulation module, second acquisition module and debugging module in the above-mentioned system simulation and debugging device, the purpose of improving the simulation and debugging efficiency and flexibility of the dynamic system is achieved, thereby realizing the technical effect of real-time module parameter modification and rollback debugging at any time point without increasing the additional memory burden, thereby solving the technical problems in related technologies that the dynamic system cannot flexibly roll back to any time point during simulation debugging and it is difficult to adjust module parameters in real time.

[0093] In the system simulation and debugging device provided in the embodiment of the present application, the first acquisition is also used to obtain the first-level node corresponding to the array composed of all modules in the dynamic system model; obtain the second-level node corresponding to the module information; and convert the module information into tree structure data based on the first-level node and the second-level node.

[0094] In the system simulation debugging device provided in an embodiment of the present application, the second acquisition is also used to determine the target position of the preset breakpoint in the debugger, wherein the preset breakpoint is in a to-be-activated state and the target position is any position after the debugger completes all data operations; receiving the activation instruction of the target object, and activating the preset breakpoint according to the activation instruction.

[0095] In the system simulation and debugging device provided in an embodiment of the present application, the second acquisition is also used to receive update instructions and rollback instructions of the target object, wherein the update instruction is used to guide the update operation of the module information, and the rollback instruction is used to guide the rollback operation of the dynamic system model; the target module information is determined based on the update instruction, and the number of rollback steps is determined based on the rollback instruction.

[0096] In the system simulation debugging device provided in an embodiment of the present application, the debugging module is also used to obtain the first output variable of the dynamic system model at a preset breakpoint; determine the data length corresponding to the number of backoff steps; delete the data variable corresponding to the data length at the end of the first output variable to obtain a second output variable, and store the second output variable in the solver, wherein the second output variable is used to represent the output variable of the dynamic system model after performing a backoff operation.

[0097] In the system simulation debugging device provided in an embodiment of the present application, the debugging module is also used to determine a time series corresponding to a first output variable when the solver is a variable step-size solver, wherein the time series is used to identify the time point of each data variable in the first output variable; subtracting the number of back-off steps from the tail of the time series to obtain a first time point, and subtracting the number of back-off steps from the tail of the time series and adding one to obtain a second time point; performing a differential calculation on the first time point and the second time point to obtain a differential result, and determining the differential result as a trial time interval for the next moment, wherein the trial time interval is used to represent a preliminary time span estimate for the variable step-size solver to restart the calculation after performing a back-off operation.

[0098] The system simulation and debugging device provided in the embodiment of the present application also includes a display module 88, which is used to obtain module data at a preset breakpoint through a monitor and display it on a user interface. When an oscilloscope module is present in the monitor, a signal change curve corresponding to the dynamic system model is generated. The signal change curve is used to represent the signal change trend of the dynamic system model from the start of simulation to the preset breakpoint.

[0099] In the system simulation and debugging device provided in an embodiment of the present application, the display module is also used to receive display instructions of the target object, wherein the display instructions include the data display format expected by the target object, and the data display format includes at least one of the following: scalar format, array format and string format; the module data is displayed according to the display instructions.

[0100] An embodiment of the present application also provides an electronic device, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned system simulation debugging method.

[0101] It should be noted that the above electronic equipment is used to perform Figure 2 The system simulation debugging method shown in the figure, therefore the relevant explanations in the above system simulation debugging method are also applicable to the electronic device and will not be repeated here.

[0102] An embodiment of the present application further provides a non-volatile storage medium, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned system simulation debugging method by running the computer program.

[0103] It should be noted that the above non-volatile storage medium is used to execute Figure 2 The system simulation debugging method shown in the figure, therefore the relevant explanations in the above system simulation debugging method are also applicable to the non-volatile storage medium, and will not be repeated here.

[0104] An embodiment of the present application also provides a computer program product, including computer instructions, which implement the above-mentioned system simulation debugging method when executed by a processor.

[0105] It should be noted that the above-mentioned computer program product is used to execute Figure 2 The system simulation debugging method shown in the figure, therefore the relevant explanations in the above system simulation debugging method are also applicable to the computer program product and will not be repeated here.

[0106] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0107] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0108] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0109] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0110] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0111] 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 application 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, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0112] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A system simulation debugging method, characterized in that: include: Acquire module information of a dynamic system model, wherein the module information includes at least parameter information, sampling time, and execution order of each module in the dynamic system model; generating an execution script according to the module information, and simulating the dynamic system model according to the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model; Obtaining target module information and a number of backoff steps when the dynamic system model simulation reaches a preset breakpoint, wherein the target module information is module information adjusted according to the update requirements of the target object, and the number of backoff steps is the number of time steps that the target object expects to backoff during the simulation process; The dynamic system model is debugged according to the target module information and the number of backoff steps.

2. The method according to claim 1, characterized in that Before generating an execution script according to the module information, the method further includes: Obtaining the first-level node corresponding to the array composed of all modules in the dynamic system model; Obtain the secondary node corresponding to the module information; The module information is converted into tree structure data according to the first-level nodes and the second-level nodes.

3. The method according to claim 1, characterized in that Before obtaining the target module information and the number of back-steps when the dynamic system model simulation reaches a preset breakpoint, the method further includes: Determining a target position of the preset breakpoint in the debugger, wherein the preset breakpoint is in a to-be-activated state and the target position is any position after the debugger completes all data operations; An activation instruction of a target object is received, and the preset breakpoint is activated according to the activation instruction.

4. The method according to claim 1, wherein Obtaining target module information and the number of backward steps when the dynamic system model simulation reaches a preset breakpoint, including: receiving an update instruction and a rollback instruction of the target object, wherein the update instruction is used to guide the update operation of the module information, and the rollback instruction is used to guide the rollback operation of the dynamic system model; The target module information is determined according to the update instruction, and the backoff number is determined according to the backoff instruction.

5. The method according to claim 1, wherein The method further comprises: Obtaining a first output variable of the dynamic system model at the preset breakpoint; Determining a data length corresponding to the number of back-steps; A data variable corresponding to the data length is deleted at the end of the first output variable to obtain a second output variable, and the second output variable is stored in the solver, wherein the second output variable is used to represent the output variable of the dynamic system model after performing a fallback operation.

6. The method according to claim 5, characterized in that The method further comprises: When the solver is a variable-step solver, determining a time series corresponding to the first output variable, wherein the time series is used to identify a time point of each data variable in the first output variable; Subtracting the number of backward steps from the tail of the time series to obtain a first time point, and subtracting the number of backward steps from the tail of the time series and adding one to obtain a second time point; A differential calculation is performed on the first time point and the second time point to obtain a differential result, and the differential result is determined as a trial time interval for the next moment, wherein the trial time interval is used to represent a preliminary time span estimate for the variable step solver to restart calculation after performing a fallback operation.

7. The method according to claim 1, characterized in that The method further comprises: Module data at the preset breakpoint is acquired through a monitor and displayed on a user interface, wherein, when an oscilloscope module is present in the monitor, a signal change curve corresponding to the dynamic system model is generated, and the signal change curve is used to represent the signal change trend of the dynamic system model from the start of simulation to the preset breakpoint.

8. The method according to claim 7, characterized in that The method further comprises: receiving a display instruction of a target object, wherein the display instruction includes a data display format desired by the target object, and the data display format includes at least one of the following: a scalar format, an array format, and a character string format; The module data is displayed according to the display instruction.

9. A system simulation debugging device, characterized in that: include: A first acquisition module is configured to acquire module information of a dynamic system model, wherein the module information includes at least parameter information, sampling time, and execution order of each module in the dynamic system model; a simulation module, configured to generate an execution script according to the module information, and simulate the dynamic system model according to the execution script, wherein the execution script includes execution logic and debugging functions corresponding to the dynamic system model; a second acquisition module, configured to acquire target module information and a number of backoff steps when the dynamic system model simulation reaches a preset breakpoint, wherein the target module information is module information adjusted according to an update requirement of the target object, and the number of backoff steps is the number of time steps that the target object is expected to backoff during the simulation process; A debugging module is used to perform debugging operations on the dynamic system model according to the target module information and the number of back-steps.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory and is used to execute the system simulation debugging method according to any one of claims 1 to 8.

11. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the system simulation debugging method according to any one of claims 1 to 8 by running the computer program.

12. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the system simulation debugging method according to any one of claims 1 to 8 is implemented.