Simulation test method and device, electronic equipment and storage medium
By using a visual interface to import data and process scripts in the Simulink model, the problem of manually changing input data is solved, and simplified operation and intuitive verification of simulation test results are achieved.
Patent Information
- Application Number
- CN202310559800.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-17
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-05-17
AI Technical Summary
In existing technologies, manually changing input data in a Simulink model requires code-based operations, which are complex and unsuitable for users with low coding proficiency, resulting in a large workload.
The test data and simulation parameters are imported using a visual interface. The first and second processing scripts are used for data processing and visualization to generate simulation test results.
It enables simulation testing through a visual interface, reducing programming complexity, making it suitable for users with low coding proficiency, improving the convenience and intuitiveness of testing, and meeting the needs of different working conditions.
Smart Images

Figure CN116540562B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of simulation testing, in particular to a simulation testing method and device, electronic equipment and storage medium. BACKGROUND
[0002] Simulink is an extension of Matlab, which provides a software package with functions of dynamic system modeling, setting different simulation data, etc. Simulink provides a large number of module libraries, and users can use these provided module libraries to conveniently complete the establishment of simulation models, and do not need to understand the internal structure of these modules.
[0003] In the related art, an EPB (Electrical Park Brake) function model is built through Simulink, and the function mode is tested through the model to verify the effectiveness of the function, but visual development is not performed, and in the case of manually changing input data in the model, all input data need to be changed through the code end, which is not friendly to operators with low code mastery. SUMMARY
[0004] One of the purposes of the present application is to provide a simulation testing method to solve the problem that in the prior art, in the case of manually changing input data in the model, all input data need to be changed through the code end, which is not suitable for users with low code mastery, and has the problems of large workload and complex operation. The second purpose is to provide a simulation testing device. The third purpose is to provide electronic equipment. The fourth purpose is to provide a computer readable storage medium.
[0005] In order to achieve the above purposes, the technical solutions adopted by the present application are as follows:
[0006] A simulation testing method comprises the following steps: importing test data of a target function and setting simulation parameters in a visual interface; entering a simulation testing process by using a virtual button of the visual interface, wherein a first processing script and a second processing script are called in the simulation testing process in sequence; combining and processing the simulation parameters and the test data by using the first processing script to obtain input data, inputting the input data into a simulation model to output a simulation testing result, processing the simulation testing result by using the second processing script to obtain a visual simulation testing result of the target function, and ending the simulation testing process.
[0007] According to the technical means, the embodiment of the application can import the test data and the simulation parameters of the target function in the visual interface, process the test data and the simulation parameters to obtain input data when performing simulation testing, input the input data into the simulation model to output simulation test results, and visualize the output results to verify whether the logic of the target function meets the requirements under different working conditions, thereby avoiding excessive programming and enabling users with low code mastery to operate intuitively.
[0008] Further, the importing of the test data of the target function in the visual interface includes designing the test data of the target function in the visual interface, and importing the test data into a class file of the visual interface.
[0009] According to the technical means, the embodiment of the application can design and write the test data of the target function in the visual interface, and import the test data into a class file of the visual interface, so that the test data can be directly called in the subsequent execution process.
[0010] Further, the importing of the test data of the target function in the visual interface includes extracting the file name and the file address of an external file of the test data in the visual interface, and importing the file name and the file address of the external file into a class file of the visual interface.
[0011] According to the technical means, the embodiment of the application can directly read the test data required by the target function from an external file, and import the test data into a class file of the visual interface, so that the test data can be directly called in the subsequent execution process.
[0012] Further, the simulation parameters include one or more of a simulation start time, a simulation end time, a simulation step, a start time of signal change, and an end time of signal change.
[0013] Further, the first processing script is defined with the length of the data dimension and the position of each data in the data dimension at the beginning, and the combination processing of the simulation parameters and the test data by using the first processing script to obtain input data includes: generating a time dimension according to the simulation start time, the simulation end time, and the simulation step; defining an empty data array according to the data dimension and the time dimension, wherein the time dimension defines the number of rows of the data array, and the data dimension defines the number of columns of the data array; traversing the start time of signal change and the end time of signal change in the time dimension; assigning the test data to the corresponding position of the data array according to the start time of signal change, the end time of signal change, and the position of each data in the data dimension; and combining the data array and the time dimension to obtain input data.
[0014] According to the technical means, the simulation parameter and the test data are processed by using the first processing script, the test data is assigned to the corresponding position of the data array according to the start time of signal change, the end time of signal change and the position of each data in the data dimension, and the continuous input data in time is generated in combination with the time dimension, so as to facilitate subsequent simulation.
[0015] Further, the test data is assigned to the corresponding position of the data array, including: assigning the test data of the visual interface design to the corresponding position of the data array; or, storing the test data and the data protocol in the form of a cell array in a target workspace through the file name and file address of the external file of the test data, and assigning the test data of the cell array to the corresponding position of the data array from the target workspace.
[0016] According to the technical means, different ways are used to assign the test data to the corresponding position of the data array according to different test data modes of the imported target function, so as to meet the test requirements of different users and further improve the convenience of the test.
[0017] Further, after the visual simulation test result of the target function is obtained by using the second processing script to visually process the simulation test result, the visual simulation test result of the target function is displayed on the visual interface.
[0018] According to the technical means, the visual simulation test result of the target function is displayed on the visual interface, so that whether the logic of the target function meets the requirements under different working conditions can be intuitively verified, and a foundation is laid for the next embedded development in hardware.
[0019] An simulation test device, comprising: an import module, configured to import test data of a target function and set simulation parameters in a visual interface; a control module, configured to enter a simulation test process by using a virtual button of the visual interface, wherein the first processing script and the second processing script are called in the simulation test process; a test module, configured to combine and process the simulation parameters and the test data by using the first processing script to obtain input data, input the input data into a simulation model to output a simulation test result, visually process the simulation test result by using the second processing script to obtain a visual simulation test result of the target function, and end the simulation test process.
[0020] Further, the import module is further configured to design the test data of the target function in the visual interface.
[0021] The test data is imported into a class file of the visualization interface.
[0022] Further, the import module is further used for extracting a file name and a file address of an external file of the test data on the visualization interface, and importing the file name and the file address of the external file into a class file of the visualization interface.
[0023] Further, the simulation parameters include one or more of a simulation start time, a simulation end time, a simulation step, a start time of signal change and an end time of signal change.
[0024] Further, the first processing script is defined with a length of a data dimension and a position of each data in the data dimension at the beginning, and the test module is further used for generating a time dimension according to the simulation start time, the simulation end time and the simulation step, defining an empty data array according to the data dimension and the time dimension, wherein the time dimension defines a row number of the data array and the data dimension defines a column number of the data array, traversing the start time of signal change and the end time of signal change in the time dimension, assigning the test data to a corresponding position of the data array according to the start time of signal change, the end time of signal change and the position of each data in the data dimension, and combining the data array and the time dimension to obtain input data.
[0025] Further, the test module is further used for assigning the test data designed by the visualization interface to the corresponding position of the data array, or storing the test data and data protocols in a form of a cell array in a target workspace through the file name and the file address of the external file of the test data, and assigning the test data of the cell array to the corresponding position of the data array from the target workspace.
[0026] Further, the simulation test device further comprises a display module, which is used for displaying the visual simulation test result of the target function on the visualization interface after the visual simulation test result of the target function is obtained by visualizing the simulation test result by using the second processing script.
[0027] An electronic device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and the processor executes the program to implement the simulation test method as described in the above embodiments.
[0028] A computer readable storage medium, which stores a computer program executable by a processor to implement the simulation test method as described in the above embodiments.
[0029] The present application has the following advantages:
[0030] (1) The embodiment of the present application can import test data and set simulation parameters of the target function in the visual interface, process the test data and the simulation parameters to obtain input data when performing simulation testing, input the input data into the simulation model to output simulation test results, and visualize the output results to verify whether the logic of the target function meets the requirements under different working conditions, thereby avoiding excessive programming, and users with low code mastery can also operate, while the simulation process can be intuitively reflected.
[0031] (2) The embodiment of the present application can design and write test data of the target function in the visual interface, and import the test data into a class file of the visual interface, so as to directly call the test data in the subsequent execution process.
[0032] (3) The embodiment of the present application can directly read test data required by the target function from an external file, and import the test data into a class file of the visual interface, so as to directly call the data in the subsequent execution process.
[0033] (4) The embodiment of the present application can process the simulation parameters and the test data by using a first processing script, assign the test data to the corresponding position of the data array according to the start time of signal change, the end time of signal change and the position of each data in the data dimension, and generate continuous input data on time in combination with the time dimension, so as to perform simulation subsequently.
[0034] (5) The embodiment of the present application can assign the test data to the corresponding position of the data array in different ways according to different test data import modes of the target function, so as to meet the test requirements of different users and further improve the convenience of testing.
[0035] (6) The embodiment of the present application can display the visual simulation test results of the target function in the visual interface, and intuitively verify whether the logic of the target function meets the requirements under different working conditions, while laying a foundation for the next embedded development in hardware.
[0036] Additional aspects and advantages of the present application will be in part apparent and in part pointed out hereinafter. BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 A flowchart of a simulation test method provided by the embodiment of the present application;
[0038] Figure 2 A visual interface provided by the embodiment of the present application;
[0039] Figure 3A brief schematic diagram of a simulation test method is provided for an embodiment of the present application.
[0040] Figure 4 A simulation schematic diagram of testing data of a design target function in a visual interface is provided for an embodiment of the present application.
[0041] Figure 5 A simulation schematic diagram of reading external file testing data is provided for an embodiment of the present application.
[0042] Figure 6 A brief schematic diagram of a simulation test method is provided for an embodiment of the present application.
[0043] Figure 7 A block schematic diagram of a simulation test device is provided for an embodiment of the present application.
[0044] Figure 8 A structural schematic diagram of an electronic device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0045] Other advantages and effects of the present application can be easily understood by those skilled in the art from the above description of the embodiments of the present application. The present application can also be implemented or applied in other different specific embodiments, and the details in the present description can be modified or changed based on different views and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, but not for limiting the protection scope of the present application.
[0046] It should be noted that the diagrams provided in the following embodiments only schematically illustrate the basic concept of the present application, and only the components related to the present application are shown in the diagrams, but not the number, shape and size of the components in actual implementation. The type, number and proportion of the components in actual implementation can be arbitrarily changed, and the layout type of the components can be more complex.
[0047] Specifically, Figure 1 A flow schematic diagram of a simulation test method is provided for an embodiment of the present application.
[0048] As Figure 1 shown, the simulation test method includes the following steps:
[0049] In step S101, the testing data of the target function and the simulation parameters are imported in the visual interface.
[0050] As Figure 2The simulation parameters in the embodiment of the application can include a simulation start time, a simulation end time, a simulation step, a start time of signal change, and an end time of signal change.
[0051] In the embodiment of the application, the test data of the target function is imported into the visualization interface, including: designing the test data of the target function in the visualization interface; and importing the test data into a class file of the visualization interface. The file name and file address of the external file of the test data are extracted on the visualization interface; and the file name and file address of the external file are imported into the class file of the visualization interface.
[0052] It can be understood that the embodiment of the application can write the required input data in the visualization interface or directly read the test data required by the target function from the external file, and import the test data into a class file of the visualization interface, so that the data can be directly called in the subsequent execution process, without the need to write additional calling interfaces in the header file, greatly improving the speed of reading the external file and reducing the complexity of the simulation test.
[0053] It should be noted that the visualization interface is derived from the APP Designer module provided by Matlab, and the module has integrated a large number of components, which can be used by being dragged into the visualization interface. The visualization interface is a processing script of a huge class (app class), most of which is automatically generated and cannot be changed. In the changeable part, a part of the values in the visualization interface are stored in the properties of the class or external files, and the file address and file name are stored in the properties of the class.
[0054] In step S102, the virtual button of the visualization interface is used to enter the simulation test process, in which the first processing script and the second processing script are called in sequence.
[0055] The embodiment of the application can test the target function through the start simulation button on the visualization interface, and sequentially call the first processing script and the second processing script in the simulation test process, so as to generate the input required by the model in the workspace of Matlab, and process the result of inputting the model into the workspace to output visualization.
[0056] In step S103, the first processing script is used to combine and process the simulation parameters and the test data to obtain input data, the input data is input into the simulation model to output simulation test results, the second processing script is used to visually process the simulation test results to obtain the visualization simulation test results of the target function, and the simulation test process is ended.
[0057] Specifically, as shown in FIG. 6, the simulation test process includes the following steps. Figure 3As shown, the embodiment of the present application can design test data in a visual interface, and import the data into a class file. Next, a first processing script is called through a button of the visual interface to process the test data, generate input data required by a model in Workspace, and then the model uses the input data to perform simulation, and export the simulation result to Workspace. The second processing script calls the output to generate visual simulation results or reports.
[0058] In the embodiment of the present application, the first processing script is used to combine and process the simulation parameters and the test data to obtain the input data, including: generating a time dimension according to a simulation start time, a simulation end time and a simulation step; defining an empty data array according to the data dimension and the time dimension, wherein the time dimension defines the number of rows of the data array, and the data dimension defines the number of columns of the data array; traversing the start time of signal change and the end time of signal change in the time dimension; assigning the test data to the corresponding position of the data array according to the start time of signal change, the end time of signal change and the position of each data in the data dimension; and combining the data array and the time dimension to obtain the input data.
[0059] The embodiment of the present application can use the first processing script to process the simulation parameters and the test data, assign the test data to the corresponding position of the data array according to the start time of signal change, the end time of signal change and the position of each data in the data dimension, and generate continuous input data in time in combination with the time dimension, so as to perform simulation subsequently.
[0060] Specifically, as shown in the following table, the embodiment of the present application uses the first processing script to combine and process the simulation parameters and the test data to obtain the input data, specifically including the following steps: Figure 4
[0061] 1. Design data in a visual interface, and store the data in a class script to which the visual interface belongs.
[0062] 2. In the beginning of the first processing script, define the length of the data dimension and the specific position of each data in the data dimension.
[0063] 3. Generate a time dimension according to a simulation start time, a simulation end time and a simulation step.
[0064] 4. Define an empty data array according to the time dimension and the data dimension, wherein the time dimension defines the number of rows of the data array, and the data dimension defines the number of columns of the data array.
[0065] 5. Traverse the time dimension, find the scale of the start and end of signal change in the time dimension through the start time and the end time of signal change designed in the visual interface.
[0066] 6、According to the time scale of the change start and end and the specific location of each data in the data dimension, the data designed in the visualization interface is assigned to the corresponding position in the data array.
[0067] 7、The time dimension and the data array are combined together, and the input data that can be continuous in time is generated in the Matlab workspace.
[0068] Further, the embodiment of the application can automatically call the input data in the workspace for simulation through the From Workspace module, and import the simulation results into the workspace again through the To Workspace, and visualize the data in the workspace through the second processing script by using the functions provided by Matlab, and generate a model simulation result report relying on the visualization results to determine the visual simulation test result of the target function.
[0069] In the embodiment of the application, the assignment of the test data to the corresponding position of the data array includes: assigning the test data designed in the visualization interface to the corresponding position of the data array; or storing the test data and the data protocol in the form of a cell array in the target workspace through the file name and file address of the external file of the test data, and assigning the test data of the cell array from the target workspace to the corresponding position of the data array.
[0070] It can be understood that if the test data of the target function is directly imported from the visualization interface, the embodiment of the application can assign the test data to the corresponding position of the data array; if the input is from an external file, the specific steps are similar to directly importing the test data of the target function, and the only difference is that the data imported from the visualization interface only has the file name and file address. Most of the external files should be.asw or.blf files recorded by CANoe / alyzer. As shown in the following table, the specific steps for reading the test data in the file are as follows: Figure 5
[0071] 1、The address and file name of the test data file and the data protocol file in the visualization interface are also stored in the class script to which the visualization interface belongs.
[0072] 2、Using the interface provided by Matlab, the external data and the data protocol are stored in the workspace of Matlab in the form of a cell array through the address and file name of the file.
[0073] 3、Using the functions provided by Matlab, the data required by the target function is selected from the external data according to the data protocol.
[0074] 4. Also according to the time dimension and the data dimension, an empty data array is generated, and data in the cell array is recorded into the empty data array through traversal.
[0075] In the embodiment of the present application, after the simulation test result is visualized by using the second processing script to obtain the visualized simulation test result of the target function, the visualized simulation test result of the target function is displayed on the visualization interface.
[0076] The embodiment of the present application can display the visualized simulation test result of the target function on the visualization interface, intuitively verify whether the logic of the target function meets the requirements under different working conditions, and lay a foundation for the next embedded development in hardware.
[0077] In summary, as shown in Figure 6 The embodiment of the present application can generate the input data required by the simulation model on the visualization interface, analyze and compare the output generated by the input data, ensure the accuracy and effectiveness of the simulation test result, visualize the simulation test process, and enable users with low code mastery to operate.
[0078] According to the simulation test method provided in the embodiment of the present application, the test data of the target function and the simulation parameters are imported on the visualization interface, the input data is obtained by processing the test data and the simulation parameters during the simulation test, the input data is input into the simulation model to output the simulation test result, the output result is visualized to verify whether the logic of the target function meets the requirements under different working conditions, excessive programming is avoided, and the process of simulation can be intuitively reflected. Therefore, the problem that all input data needs to be changed through the code end when the input data is manually changed in the model in the related art is solved, the user with low code mastery is not suitable for operation, and the problems of large workload and complex operation are solved.
[0079] Secondly, the simulation test device provided in the embodiment of the present application is described with reference to the accompanying drawings.
[0080] Figure 7 is a block schematic diagram of the simulation test device in the embodiment of the present application.
[0081] As shown in Figure 7 The simulation test device 10 includes an import module 100, a control module 200 and a test module 300.
[0082] The import module 100 is configured to import test data of a target function and set simulation parameters on a visual interface; the control module 200 is configured to enter a simulation test process by using a virtual button on the visual interface, wherein the first processing script and the second processing script are called in sequence in the simulation test process; and the test module 300 is configured to combine and process the simulation parameters and the test data by using the first processing script to obtain input data, input the input data into a simulation model to output simulation test results, process the simulation test results by using the second processing script to obtain visual simulation test results of the target function, and end the simulation test process.
[0083] In the embodiment of the application, the import module 100 is further configured to design test data of the target function on the visual interface, and import the test data into a class file of the visual interface.
[0084] In the embodiment of the application, the import module 100 is further configured to extract a file name and a file address of an external file of the test data on the visual interface, and import the file name and the file address of the external file into the class file of the visual interface.
[0085] In the embodiment of the application, the simulation parameters include one or more of a simulation start time, a simulation end time, a simulation step, a start time of signal change, and an end time of signal change.
[0086] In the embodiment of the application, the first processing script is defined with a length of a data dimension and a position of each data in the data dimension at the beginning, and the test module 300 is further configured to generate a time dimension according to the simulation start time, the simulation end time, and the simulation step, define an empty data array according to the data dimension and the time dimension, traverse the start time of signal change and the end time of signal change in the time dimension, assign the test data to a corresponding position of the data array according to the start time of signal change, the end time of signal change, and the position of each data in the data dimension, and combine the data array and the time dimension to obtain the input data.
[0087] In the embodiment of the application, the test module 300 is further configured to assign the test data designed on the visual interface to the corresponding position of the data array, or store the test data and a data protocol in a target workspace in the form of a cell array by using the file name and the file address of the external file of the test data, and assign the test data of the cell array to the corresponding position of the data array from the target workspace.
[0088] In the embodiment of the application, the simulation test device 10 further includes a display module.
[0089] The display module is configured to display the visual simulation test result of the target function on the visual interface after visualizing the simulation test result by using the second processing script.
[0090] It should be noted that the above description of the simulation test method is also applicable to the simulation test device of the embodiment, and will not be described here.
[0091] According to the simulation test device provided in the embodiment of the present application, the test data of the target function and the simulation parameters are imported on the visual interface, the test data and the simulation parameters are processed to obtain input data during the simulation test, the input data is input into the simulation model to output the simulation test result, and the output result is visualized to verify whether the logic of the target function meets the requirements under different working conditions, thereby avoiding excessive programming and intuitively reflecting the simulation process. Therefore, the problem that all input data need to be changed through the code end when the input data is manually changed in the model in the related art is solved, and the problem that the operation is not suitable for users with low code mastery and is complicated and has a large workload is solved.
[0092] Figure 8 The structure of the electronic device provided in the embodiment of the present application is shown in the figure. The electronic device can include:
[0093] The memory 801, the processor 802, and the computer program stored in the memory 801 and executable on the processor 802.
[0094] The processor 802 executes the program to implement the simulation test method provided in the above embodiment.
[0095] Further, the electronic device further includes:
[0096] The communication interface 803 is configured to communicate between the memory 801 and the processor 802.
[0097] The memory 801 is configured to store the computer program executable on the processor 802.
[0098] The memory 801 can include a high-speed RAM (Random Access Memory, Random Access Memory) memory, and can also include a non-volatile memory, for example, at least one disk memory.
[0099] If the memory 801, the processor 802 and the communication interface 803 are implemented independently, the communication interface 803, the memory 801 and the processor 802 can be connected with each other through a bus and complete communication between each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 8 Only one thick line is used in the figure to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0100] Optionally, in a specific implementation, if the memory 801, the processor 802 and the communication interface 803 are integrated on a chip, the memory 801, the processor 802 and the communication interface 803 can complete communication between each other through an internal interface.
[0101] The processor 802 can be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0102] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the simulation test method.
[0103] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example" or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms is not necessarily for the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present specification and the features of the different embodiments or examples without contradiction.
[0104] In addition, the terms "first", "second", etc. are used only for descriptive purposes and do not connote or imply relative importance or a quantity of the indicated technical features. Thus, a feature defined with "first", "second", etc. can include at least one of the feature, explicitly or implicitly. In the description of the present application, the meaning of "N" is at least two, such as two, three, etc., unless otherwise explicitly and specifically limited.
[0105] Any process or method descriptions or descriptions of the flow diagrams described herein can be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logic functions (or steps) described by that module, segment, or portion of code. The various embodiments of the application can include additional or fewer steps or methods as described in the examples provided herein, and the order of the steps or methods can be changed, including the use of concurrent steps or methods, unless otherwise specifically limited.
[0106] It should be understood that portions of the present application can be realized with hardware, software, firmware or a combination thereof. In the above embodiments, the N steps or methods can be realized with software or firmware stored in a memory and executed by a suitable instruction execution system. As in another embodiment, if realized with hardware, any one or a combination of the following technologies known in the art can be used: discrete logic circuit with logic gates for implementing logic functions on data signals, application specific integrated circuit with suitable combination logic gates, programmable gate array, field programmable gate array, etc.
[0107] Those skilled in the art of the present technology can understand that all or part of the steps carried out by the above-mentioned embodiment method can be completed by a program instructing the relevant hardware, and the program can be stored in a computer readable storage medium, and the program includes one or a combination of the steps of the method embodiment when executed.
[0108] Although the embodiments of the present application have been shown and described above, it should be understood that the above-mentioned embodiments are exemplary and cannot be understood as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above-mentioned embodiments within the scope of the present application.
Claims
1. A simulation testing method, characterized in that, Includes the following steps: Import test data for the target function and set simulation parameters in the visual interface; The simulation test process is entered using the virtual buttons on the visual interface, wherein the first processing script and the second processing script are called sequentially in the simulation test process. The simulation parameters and test data are combined and processed using the first processing script to obtain input data. The input data is then input into the simulation model to output simulation test results. The simulation test results are then visualized using the second processing script to obtain the visualized simulation test results of the target function, and the simulation test process ends. The simulation parameters include simulation start time, simulation end time, simulation step size, start time of signal change, and end time of signal change. The first processing script begins by defining the length of the data dimension and the position of each data point within that dimension. The process of combining the simulation parameters and test data using the first processing script to obtain input data includes: Based on the simulation start time, the simulation end time, and the simulation step size, the time dimension is generated. An empty data array is defined based on the data dimension and the time dimension, wherein the time dimension defines the number of rows in the data array and the data dimension defines the number of columns in the data array; Iterate through the start time and end time of the signal change in the time dimension; Based on the start time of the signal change, the end time of the signal change, and the position of each data point in the data dimension, the test data is assigned to the corresponding position in the data array. The input data is obtained by combining the data array and the time dimension.
2. The simulation testing method according to claim 1, characterized in that, The process of importing test data for the target function into the visual interface includes: Test data for the target function are designed using a visual interface; Import the test data into the class file of the visualization interface.
3. The simulation testing method according to claim 1, characterized in that, The process of importing test data for the target function into the visual interface includes: Extract the filename and file address of the external file containing the test data from the visualization interface; Import the filename and file path of the external file into the class file of the visualization interface.
4. The simulation testing method according to claim 1, characterized in that, Assigning the test data to the corresponding position in the data array includes: Assign the test data of the visualization interface design to the corresponding positions in the data array; Alternatively, the test data and data protocol can be stored in the target workspace as a cell array using the filename and file address of the external file containing the test data, and the test data of the cell array can be assigned to the corresponding position in the data array from the target workspace.
5. The simulation testing method according to claim 1, characterized in that, After using the second processing script to visualize the simulation test results to obtain the visualized simulation test results of the target function, the process further includes: The visualization interface displays the results of the simulation test of the target function.
6. A simulation testing device, characterized in that, The simulation testing device is used to execute the simulation testing method as described in any one of claims 1-5, including: The import module is used to import test data for the target function and set simulation parameters in the visual interface; The control module is used to enter the simulation test process using the virtual buttons of the visualization interface, wherein the first processing script and the second processing script are called sequentially in the simulation test process. The testing module is used to combine and process the simulation parameters and test data using the first processing script to obtain input data, input the input data into the simulation model to output simulation test results, use the second processing script to perform visualization processing on the simulation test results to obtain the visualized simulation test results of the target function, and end the simulation test process.
7. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the simulation test method as described in any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the simulation test method as described in any one of claims 1-5.
Citation Information
Patent Citations
Automatic test method and system for vehicle control unit
CN111258290A
Automatic test tool and automatic test method for Simulink model
CN114817001A