A model-in-loop simulation test method, device, equipment and medium

By automating the processing of model files and configuration files to generate test project files, the problem of low efficiency in model-in-the-loop testing in existing technologies is solved, thus achieving automated testing and improving development efficiency.

CN115729830BActive Publication Date: 2025-12-23CHONGQING CHANGAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211504371.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2025-12-23
Estimated Expiration
2042-11-28

AI Technical Summary

Technical Problem

Existing model-in-the-loop testing methods are inefficient, manual integration cannot guarantee quality, and automated testing is limited, failing to automate the execution of test cases, resulting in low development efficiency.

Method used

By acquiring the functional model file, building the integration file, loading the configuration file data into the global variable space, processing the model reference, generating the test project file, and configuring the timing management, input refactoring, function call and output refactoring modules, automated testing is achieved.

Benefits of technology

It enables automatic integration of model files and automatic creation of test projects, improving software development efficiency and saving development time and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115729830B_ABST
    Figure CN115729830B_ABST
Patent Text Reader

Abstract

The application provides a model-in-loop simulation test method, device, equipment and medium. The model-in-loop simulation test method comprises the following steps: obtaining a plurality of function model files used for simulation test, wherein the data of the function model files comprises model file data and configuration file data; constructing an integrated file according to the model file data; loading the configuration file data into a global variable space associated with the integrated file to generate an integrated model file; performing model reference processing on the integrated model file to generate a test engineering file; and performing simulation test on an input test case according to the test engineering file to generate test result data. The application can improve the simulation test efficiency of software model-in-loop and save the software development time cost.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software development, and in particular to a model-in-the-loop simulation test method, device, equipment and medium. BACKGROUND

[0002] Model-in-the-loop (MIL) testing is a software testing and verification method in the model-based software development process. MIL testing does not require hardware-in-the-loop and can verify requirements in the early stages of software development, avoiding software problems in advance, ensuring software quality, and thus reducing the incidence of problems and the workload of problem rectification and verification in the later testing stage, which can effectively improve the overall development efficiency.

[0003] MIL testing generally includes four steps: control model integration, MIL test project creation, test case writing and test execution. The way to create a MIL test project is usually manual creation and automatic creation using the functions provided by Matlab software. Among them, the manual creation method integrates the control model manually and creates a test project that can realize automatic testing. This method takes a long time and has low work efficiency, and the integration quality cannot be guaranteed. The automatic creation method using the functions provided by Matlab software has limitations in input and output processing, is not convenient for automatic test execution, cannot independently control the application layer function call, cannot observe the input parameters when the application layer calls the bottom layer function, and cannot customize the return value, etc. Therefore, it is difficult to realize the automatic execution of test cases, which greatly reduces the test efficiency. Moreover, if manual modification is made on the basis of the above test project, it will also take a lot of time and reduce the test efficiency. SUMMARY

[0004] In view of the above-mentioned shortcomings of the prior art, the present application provides a model-in-the-loop simulation test method, device, equipment and medium to solve the above technical problems.

[0005] The model-in-the-loop simulation test method provided by the present application comprises

[0006] Obtaining a plurality of functional model files for simulation testing, the data of the functional model files comprising model file data and configuration file data;

[0007] According to the model file data, an integrated file is constructed;

[0008] The configuration file data is loaded into the global variable space associated with the integrated file to generate an integrated model file;

[0009] The integrated model file is subjected to model reference processing to generate a test project file; and

[0010] According to the test engineering file, simulation test is performed on the input test case to generate test result data.

[0011] In an embodiment of the present application, the step of constructing the integration file according to the model file data comprises:

[0012] Obtaining path information of the model file data to create a plurality of hierarchical subsystem modules;

[0013] Adding the model file data into the corresponding subsystem modules, and

[0014] Configuring input interface information, output interface information and transfer information of the plurality of hierarchical subsystem modules to construct the integration file.

[0015] In an embodiment of the present application, the step of loading the configuration file data into the global variable space associated with the integration file to generate an integration model file comprises:

[0016] Obtaining data storage file data, data definition file data and data dictionary file data in the configuration file data; and

[0017] Loading the data storage file data, the data definition file data and the data dictionary file data into the global variable space associated with the integration file in sequence to generate an integration model file.

[0018] In an embodiment of the present application, the step of performing model reference processing on the integration model file to generate a test engineering file comprises:

[0019] Performing model reference processing on the integration model file to generate a test file; and

[0020] Performing function module configuration processing on the test file to generate the test engineering file.

[0021] In an embodiment of the present application, the step of performing function module configuration processing on the test file to generate the test engineering file comprises:

[0022] Configuring a timing management module of the test file based on running order information of each hierarchical model of the integration model file, the timing management module managing running timing of a plurality of hierarchical service models; and

[0023] Configuring an input reconstruction module of the test file based on input interface information of the integration model file, the input reconstruction module importing input signals of the integration model file.

[0024] In an embodiment of the present application, the step of performing function module configuration processing on the test file to generate the test engineering file further comprises:

[0025] obtaining function call information and function definition information of the integrated model file;

[0026] configuring a function call module of the test file according to the function call information; and

[0027] configuring a function definition module of the test file according to the function call information and the function definition information.

[0028] In an embodiment of the present application, the step of performing function module configuration processing on the test file to generate the test engineering file further comprises:

[0029] configuring an output reconstruction module of the test file based on transfer information of the test file, transfer information of the function call module and transfer information of the function definition module; and

[0030] saving the configured test file to generate the test engineering file.

[0031] The present application also provides a model-in-loop simulation test device, comprising:

[0032] a model data obtaining unit, configured to obtain a plurality of function model files for simulation test, data of the function model files comprising model file data and configuration file data;

[0033] an integrated file constructing unit, configured to construct an integrated file according to the model file data;

[0034] an integrated model generating unit, configured to load the configuration file data into a global variable space associated with the integrated file to generate an integrated model file;

[0035] a test engineering generating unit, configured to perform model reference processing on the integrated model file to generate a test engineering file; and

[0036] a test engineering executing unit, configured to perform simulation test on an input test case according to the test engineering file to generate test result data.

[0037] The present application also provides an electronic device, comprising:

[0038] one or more processors; and

[0039] A storage device is configured to store one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the model-in-loop simulation test method according to any one of the preceding embodiments.

[0040] The application further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor of a computer, the computer is caused to execute the model-in-loop simulation test method according to any one of the preceding embodiments.

[0041] The application provides a model-in-loop simulation test method, device, equipment and medium, which can realize automatic integration of model files and automatic creation of test engineering. The application can improve the software model-in-loop test efficiency and save development time cost.

[0042] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and are not limiting to the application. BRIEF DESCRIPTION OF DRAWINGS

[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application. It is clear that the drawings in the following description are only some embodiments of the application, and other drawings can be obtained from these drawings without creative labor for those skilled in the art. In the drawings:

[0044] Figure 1 is an application environment of the model-in-loop simulation test method provided by the application;

[0045] Figure 2 is a flowchart of the model-in-loop simulation test method according to an exemplary embodiment of the application;

[0046] Figure 3 is a specific implementation flowchart of step S202 in Figure 2

[0047] Figure 4 is a specific implementation flowchart of step S203 in Figure 2

[0048] Figure 5 is a specific implementation flowchart of step S204 in Figure 2

[0049] Figure 6 is a specific implementation flowchart of step S502 in Figure 5

[0050] Figure 7 ​​​​is a block diagram of a model-in-loop simulation test device according to an exemplary embodiment of the present application;

[0051] Figure 8 A structural diagram of a computer system of an electronic device suitable for implementing embodiments of the present application is shown. DETAILED DESCRIPTION

[0052] Other advantages and novel features of the present application will be readily appreciated as the same becomes better understood by reference to the following detailed description when considered in connection with the accompanying drawings wherein:

[0053] It should be noted that the drawings included herewith are included merely for illustrative purposes and therefore should not be construed as being limiting in any way. In particular, the drawings provided herein are not drawn to scale and are only meant to be a simplified representation of the various embodiments of the present application.

[0054] In the following description, numerous specific details are discussed in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to one of ordinary skill in the art that embodiments of the present application can be practiced without these specific details. In other instances, well-known structures and devices are not described in exhaustive detail in order to avoid obscuring the embodiments of the present application.

[0055] First of all, it should be noted that the current vehicle controller software development process is usually implemented using MATLAB simulation software. The model is built using the visual simulation tool Simulink in MATLAB, the code is automatically generated, the code is integrated to generate a runnable file, and finally the runnable file is burned to a single-chip microcomputer, which can complete the controller software development process. When developing software, developers usually divide the functions of the software into multiple functional modules, and each functional module corresponds to a Simulink functional module model.

[0056] The present application provides a model-in-loop simulation test method, which is a method of developing and running a simulation model in a simulation environment (such as Simulink). The present application can be applied to, for example, the development of vehicle controller software. Figure 1The application environment is shown in FIG. 1, in which the client 101 can communicate with the server 102 through a network. The server 102 stores the automation script. The client 101 can complete the automatic integration of the control model and the automatic creation of the test project through the automation script provided by the server 102.

[0057] It should be noted that before applying the method provided by the present application, the model file needs to be preprocessed. Specifically, first, all the models are placed in different folders according to the function modules; then the model files are placed in the folders corresponding to each layer in the function module folder according to the service layering; finally, in each layer service folder, each model is placed in a folder. After the above model file preprocessing, the integrated model file structure is consistent with the function module folder structure during the model integration, which facilitates the developers to read the model information. The present application uses the m language script to realize the automatic integration of the control model and the automatic creation of the test project, so as to realize the automation of the test and improve the overall test efficiency. The present application will be described in detail through specific embodiments.

[0058] Please refer to Figure 2 , Figure 2 is an exemplary embodiment of the present application, which shows a flowchart of a model-in-loop simulation test method, which can include the following steps:

[0059] Step S201, obtaining a plurality of function model files for simulation test, the data of the function model files including model file data and configuration file data.

[0060] In some embodiments, the model integration step for simulation test is first performed. In this embodiment, the integrated model file is automatically generated through the model integration script. In order to keep the structure of the integrated model file consistent with the structure of the function model file, the plurality of function model files for simulation test can be first obtained, and the data of the function model files including the model file data and the configuration file data.

[0061] Step S202, constructing an integrated file according to the model file data.

[0062] In some embodiments, the integrated file can be constructed according to the model file data obtained in step S201. Specifically, the path information of the model file data is first obtained, and then the multi-level subsystem module (Subsystem) consistent with the structure of the function model file is created based on the path information. The subsystem module needs to be named with the name of the folder corresponding to the function model file. Then the model file data is added to the corresponding subsystem module. Finally, the interface of each level of the subsystem module is set, and the automatic construction of the integrated file is completed.

[0063] Step S203, loading the configuration file data into the global variable space associated with the integrated file to generate an integrated model file.

[0064] In some embodiments, after the integrated file is built, the configuration file data in the functional model file needs to be added to the global variable space associated with the integrated file. This step can be implemented by a data loading script. The specific adding method is to first obtain the data storage file data (.mat file), data definition file data (.m file) and data dictionary file data (.sldd file) in the configuration file data. Then load the data storage file data, data definition file data and data dictionary file data into the global variable space associated with the integrated file in sequence to generate an integrated model file.

[0065] Step S204, performing model reference processing on the integrated model file to generate a test engineering file.

[0066] In some embodiments, a test file is first generated according to the generated integrated model file by means of model reference. Model reference (Model Reference) is a special subsystem of Simulink, which can realize reference encapsulation model and thus complete technical secrecy. Then the input interface information and the output interface information of the test file are configured.

[0067] In some embodiments, the functional modules of the test file need to be configured to generate a test engineering file. In this embodiment, the functional modules of the test engineering file can include a timing management module, an input reconstruction module, a function call module, a function definition module and an output reconstruction module. Among them, the timing management module manages the running timing of multiple levels of service models; the input reconstruction module imports the input signals of the integrated model file; the function call module realizes the call of each Simulink Function; the function definition module realizes the executable of the test engineering, and the observable input parameters and the customizable return values when the application layer calls the bottom layer Function; the output reconstruction module outputs all the signals that need to be observed to the global variable space.

[0068] Step S205, according to the test engineering file, simulating and testing the input test case to generate test result data.

[0069] In some embodiments, according to the test engineering file generated in step S205, the test case input by the R&D personnel is simulated and tested, and the test result data is generated, and the entire model-in-the-loop simulation test is completed.

[0070] Please refer to Figure 3 as shown in Figure 3 is Figure 2 a specific implementation process diagram of step S202 in the foregoing embodiment, which can include the following steps:

[0071] Step S301, path information of model file data is acquired to create multiple hierarchical subsystem modules.

[0072] In some embodiments, the path information of model file data is acquired first, and multiple hierarchical subsystem modules consistent with the functional model file structure are created based on the path information. In this embodiment, one hierarchical subsystem module corresponds to one functional model file. Specifically, the model integration script can be used to achieve this. First, the path information of model file data is acquired, and multiple hierarchical subsystem modules consistent with the functional model file structure are created. The subsystem module needs to be named after the name of the folder corresponding to the functional model file.

[0073] Step S302, model file data is added to the corresponding subsystem module.

[0074] In some embodiments, the modules in the subsystem module are deleted first. Then, when the folder corresponding to the added subsystem module is the folder where the single model is located, the single model file is copied into the subsystem module.

[0075] Step S303, the input interface information, output interface information and transfer information of the multiple hierarchical subsystem modules are configured to build the integrated file.

[0076] In some embodiments, the created multiple hierarchical subsystem modules are input interface information, output interface information and transfer information to build an integrated file. The following is described by taking MATLAB software as an example. According to the folder structure, the horizontal position of each hierarchical subsystem module is adjusted to leave space to add input and output interfaces; then from the innermost layer of the integrated model file outward, the larger value is taken according to the number of input interfaces (Input) and output interfaces (Output) inside the subsystem module to adjust the vertical height of the subsystem module, and then the output interface information, the output interface information and the transfer information (Goto) of all subsystem modules in the layer are added. The specific configuration method is to first obtain the output interface information inside the subsystem module, then add the same output interface and transfer information to the subsystem module, and the transfer information is to realize the signal interaction inside the layer. Finally, the input interface information and the transfer information of all subsystem modules in the layer are added, and the transfer information is to meet the case that one input information can be used by multiple subsystem modules. In this embodiment, the try-catch (exception handling mechanism, error handling) command is used when adding the input interface information. If the input interface information fails to be added, it means that there is already an input interface or output interface with the same name, which can be changed to add (From). The form can connect the interface of the module with other modules, that is, send the signal of the module to the interface of other modules. After the above steps of integrated file creation, subsystem module creation and input interface information, output interface information and transfer information of the subsystem module, the integrated file can be built. In this embodiment, the above steps are realized by using a script to automatically generate an integrated file, which can greatly improve the model integration efficiency.

[0077] Please refer to Figure 4 , Figure 4 is Figure 2 A specific implementation flowchart of step S203 in the embodiment can include the following steps:

[0078] Step S401, obtain data storage file data, data definition file data and data dictionary file data in the configuration file data.

[0079] In some embodiments, after the integrated file is built, the configuration file data in the functional model file needs to be loaded into the global variable space associated with the integrated file. First, the data storage file data (.mat file), the data definition file data (.m file) and the data dictionary file data (.sldd file) in the configuration file data need to be obtained. This step obtains the data storage file data, the data definition file data and the data dictionary file data in the configuration file data through a data loading script.

[0080] Step S402, sequentially load the data storage file data, data definition file data and data dictionary file data into the global variable space of the integrated file association to generate an integrated model file.

[0081] In some embodiments, the acquired data storage file data, data definition file data and data dictionary file data need to be sequentially added to the global variable space of the integrated file association to generate an integrated model file. This step can be implemented by a data loading script. Specifically, taking the data storage file data as an example, first acquire the paths of all data storage file data under the folder, since the data loading script is a Function function, the data storage file data can be loaded into the global variable space using the evalin command. Since the data dictionary file data cannot be directly loaded into the global variable space, the data in the data dictionary file data needs to be exported to a temporary data storage file first, then loaded into the global variable space, and then the temporary data storage file is deleted. Finally, the data in the global variable space can be saved to a data storage file for subsequent use, which can save loading time.

[0082] Please refer to Figure 5 , Figure 5 is Figure 2 a specific embodiment flowchart of step S204 in the method, which can include the following steps:

[0083] In some embodiments, first, according to the generated integrated model file, a test file is generated by means of model reference. Model reference (Model Reference) is a special subsystem of Simulink, which can realize reference encapsulation model and thus complete technical secrecy. Then, the input interface information and the output interface information of the test file are configured.

[0084] Step S501, model reference processing is performed on the integrated model file to generate a test file.

[0085] In some embodiments, first, according to the generated integrated model file, a test file is generated by means of model reference. Then, the input interface information and the output interface information of the test file are configured. Specifically, according to the input interface information and the output interface information of the outermost layer of the integrated model, form information is added to the input interface information of the test engineering file, and global transfer information is added to the output interface information.

[0086] Step S502, functional module configuration processing is performed on the test file to generate a test engineering file.

[0087] In some embodiments, the test file is configured with functional modules to generate a test engineering file. In this embodiment, the functional modules of the test engineering file can include a timing management module, an input reconstruction module, a function call module, a function definition module, and an output reconstruction module.

[0088] Referring to Figure 6 as shown in Figure 6 is Figure 5 A specific implementation process diagram of step S502 can include the following steps:

[0089] Step S601, based on the running order information of each hierarchical model of the integrated model file, configure the timing management module of the test file, and the timing management module manages the running timing of the service models of multiple levels.

[0090] In some embodiments, the timing management module of the test file can be configured based on the running order information of each hierarchical model of the integrated model file. The timing management module is used to manage the running timing of the service models of multiple levels. Specifically, the timing of the running of each layer service model is managed in the form of Matlab Function. First, according to the naming difference, find out the input interface name that controls the running of each hierarchical service from the input interface information of the integrated model, and save the name to different arrays according to the level; then, according to the actual running order required by each hierarchical service, use the previously saved name to add the calling command of each hierarchical service model in the Matlab Function in turn, and add the corresponding FunctionCall Output; finally, adjust the position of the Matlab Function module and add the transfer information to the output interface of the Matlab Function, which corresponds to the input From of the test file.

[0091] Further, if there is a running order requirement for the service models of the same level, the calling interface names of all service models can be arranged in order in Excel, and the Excel is read through the script to fill in the calling command in the Matlab Function according to the order in the Excel table. The above-mentioned manner makes the running timing of each service freely controllable.

[0092] Step S602, based on the input interface information of the integrated model file, configure the input reconstruction module of the test file, and the input reconstruction module imports the input signal of the integrated model file.

[0093] In some embodiments, the input reconstruction module of the test file can be configured based on the input interface information of the integrated model file. The input reconstruction module is used to import the input signal of the integrated model file. Specifically, the input signal of the integrated model is realized in the form of From Workspace through the input reconstruction script, which facilitates the execution of automatic testing. First, the input interface information of the integrated model is read, and according to the input interface information of the integrated model, the corresponding output interface information is added in the input reconstruction module. Add From Workspace module and data type conversion module, connect the two, and then connect with the output interface. This process needs to filter out the input interface that controls the running of each level of service. The data naming in From Workspace is consistent with the output interface, and the data type conversion module can be selected to inherit backward. Then create a definition for the data in From Workspace in the global variable space and assign an initial value of

[00] , in the format of matrix, the first column represents time, and the second column represents data value. If the signal is a 1xN array, N columns can be added after the time column. Finally, add transition information to the output interface of the input reconstruction module, and it needs to correspond to the input form of the engineering test file. Before testing, new rows can be added to the FromWorkspace data to realize the change of the input signal.

[0094] Further, for the Bus (microcomputer bus) type output interface, according to the data type of the Port, the same named Bus type definition is read in the global variable space, according to the member name and data type in the Bus, From Workspace is created for each member, and the Bus is connected with the output interface. The data naming of From Workspace adopts the form of connecting the Port name and the member name with the symbol “.”, that is, input in the form of structure body. It should be noted that “IN.” can be added in front of all FromWorkspace data names, so that all input signals are saved in the IN structure body, which is convenient for management and saving.

[0095] Step S603, acquiring function call information and function definition information of the integrated model file.

[0096] In some embodiments, the function call module and the function definition module need to acquire the function call information and the function definition information of the integrated model file. By acquiring all Simulink Function information in the integrated model, that is, the function call information and the function definition information, the calls to each Simulink Function are sequentially added in the Function call module.

[0097] Step S604, configuring the function call module of the test file according to the function call information.

[0098] In some embodiments, the function call module of the test file can be configured according to the function call information. Specifically, for each Simulink Function, a function (Function Caller) module that returns the specified function is added in an enabled subsystem (Enabled Subsystem), the output interface of the Function Caller module constitutes a Bus connected to the output interface. The input of the Function Caller module is input in the manner of From Workspace described above. The output interface of the Enabled Subsystem is connected to the global transition information, facilitating the subsequent use of the output reconstruction module to perform signal observation. The Enabled input interface of the Enabled Subsystem is also input in the manner of From Workspace, and the data naming uses the Function name connected with En by a period.

[0099] Step S605, configuring the function definition module of the test file according to the function call information and the function definition information.

[0100] In some embodiments, the function definition module of the test file can be configured according to the function call information and the function definition information. Specifically, in order to ensure that the test project can be run, and the input parameters of the application layer when calling the bottom layer function can be observed, and the return value can be customized, it is necessary to add a function definition module to the test project. First, all SimulinkFunction and Function Caller modules in the integrated model are obtained. Then, by comparison, Simulink Functions are added to Function Caller modules that do not have Simulink Functions with the same name. The function prototype can be obtained through the Function Caller, and then a Simulink Function with the same prototype is added. Through the input and output parameter instances in the Function Caller, the data types can be obtained, which are used to set the input and output parameter data types of the Simulink Function. The input parameters constitute a Bus connected to the output interface. Finally, the output interface of the Simulink Function is connected to the global transition information, and the output parameter is realized by the above-mentioned From Workspace to realize the customized value.

[0101] Step S606, configuring the output reconstruction module of the test file based on the transition information of the test file, the transition information of the function call module and the transition information of the function definition module.

[0102] In some embodiments, the configuration of the output reconstruction module of the test file can be performed based on the transfer information of the test file, the transfer information of the function call module and the transfer information of the function definition module. The output reconstruction module can output all signals that need to be observed to the global variable space. Specifically, first, the global transfer information of the first layer of the test project, the global transfer information in the function call module and the global transfer information in the function definition module are acquired in sequence, and then corresponding forms are added in the output reconstruction module. Finally, all forms are connected to the workspace through Bus, and signal names are added on the connection lines of the forms.

[0103] In step S607, the test file with the completed configuration is saved to generate a test project file.

[0104] In some embodiments, the test file with the completed configuration is saved to generate a test project file. Specifically, the IN structure generated in the above steps can be saved as a mat file, i.e., a data storage file. The file can be used as the initial value of the input signal and loaded before each test case is executed.

[0105] Referring to Figure 7 , Figure 7 The block diagram of the simulation test device of the model in the example embodiment of the present application can include a model data acquisition unit 701, an integrated file construction unit 702, an integrated model generation unit 703, a test project generation unit 704, a test project execution unit 705, and the functions of each module are described in detail as follows.

[0106] The model data acquisition unit 701 is configured to acquire a plurality of functional model files for simulation testing, and the data of the functional model files includes model file data and configuration file data.

[0107] In some embodiments, the model integration step of the simulation test is performed first. In this embodiment, the integrated model file is automatically generated through the model integration script. To make the structure of the integrated model file consistent with the structure of the functional model file, the model data acquisition unit 701 can first acquire a plurality of functional model files for simulation testing, and the data of the functional model file includes model file data and configuration file data.

[0108] The integrated file construction unit 702 is configured to construct an integrated file according to the model file data.

[0109] In some embodiments, the integrated file construction unit 702 can construct the integrated file according to the obtained model file data. Specifically, the integrated file construction unit 702 first obtains path information of the model file data, and then creates a multi-level subsystem module (Subsystem) consistent with the structure of the functional model file based on the path information. The subsystem module needs to be named after the name of the folder corresponding to the functional model file. Then the model file data is added to the corresponding subsystem module. Finally, the integrated file construction unit 702 sets the interface of the subsystem module at each level, thereby completing the automatic construction of the integrated file.

[0110] In a specific embodiment, the integrated file construction unit 702 can be specifically used for:

[0111] obtaining path information of the model file data to create a multi-level subsystem module;

[0112] adding the model file data to the corresponding subsystem module, and

[0113] configuring input interface information, output interface information and transfer information of the multi-level subsystem module to construct the integrated file.

[0114] The integrated model generation unit 703 is configured to load the configuration file data into the global variable space associated with the integrated file to generate an integrated model file.

[0115] In some embodiments, after the integrated file is constructed, the integrated model generation unit 703 can add the configuration file data in the functional model file to the global variable space associated with the integrated file. The specific adding method is to first obtain data storage file data (.mat file), data definition file data (.m file) and data dictionary file data (.sldd file) in the configuration file data. Then the data storage file data, the data definition file data and the data dictionary file data are loaded into the global variable space associated with the integrated file in sequence to generate the integrated model file.

[0116] In a specific embodiment, the integrated model generation unit 703 can be specifically used for:

[0117] obtaining data storage file data, data definition file data and data dictionary file data in the configuration file data; and

[0118] loading the data storage file data, the data definition file data and the data dictionary file data into the global variable space associated with the integrated file in sequence to generate the integrated model file.

[0119] The test engineering generation unit 704 is configured to perform model reference processing on the integrated model file to generate a test engineering file.

[0120] In some embodiments, the test engineering generation unit 704 generates a test file according to the generated integrated model file by model referencing. Then, the test engineering generation unit 704 configures the input interface information and the output interface information of the test file.

[0121] In some embodiments, the test engineering generation unit 704 needs to configure the functional modules of the test file to generate a test engineering file. In this embodiment, the functional modules of the test engineering file can include a timing management module, an input reconstruction module, a function call module, a function definition module, and an output reconstruction module. Among them, the timing management module manages the running timing of multiple levels of service models; the input reconstruction module imports the input signals of the integrated model file; the function call module realizes the calling of each Simulink Function; the function definition module realizes the executable of the test engineering, and the observable input parameters and the customizable return values when the application layer calls the underlying Function; the output reconstruction module outputs all the signals that need to be observed to the global variable space.

[0122] In a specific embodiment, the test engineering generation unit 704 can be specifically used for:

[0123] performing model referencing processing on the integrated model file to generate a test file; and

[0124] performing functional module configuration processing on the test file to generate a test engineering file.

[0125] The test engineering execution unit 705 is configured to perform simulation testing on the input test case according to the test engineering file to generate test result data.

[0126] In some embodiments, according to the generated test engineering file, the test engineering execution unit 705 performs simulation testing on the test case input by the R&D personnel, so as to generate the test result data and complete the entire model-in-loop simulation testing.

[0127] It should be noted that the model-in-loop simulation testing device provided in the above embodiments and the model-in-loop simulation testing method provided in the above embodiments belong to the same concept, wherein the specific operation execution manner of each module and unit has been described in detail in the method embodiments, which will not be repeated here. The model-in-loop simulation testing device provided in the above embodiments can be divided into different functional modules according to the needs in the actual application, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above, and this is not limited herein.

[0128] Embodiments of the present application also provide an electronic device, comprising: one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the model-in-loop simulation test method provided in each of the above embodiments.

[0129] Figure 8 A structural diagram of a computer system of an electronic device suitable for implementing embodiments of the present application is shown. It should be noted that, Figure 8 The computer system 800 of the electronic device shown is only an example and should not impose any limitation on the functions and use range of embodiments of the present application.

[0130] As Figure 8 shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 802 or programs loaded from a storage portion 808 into a random access memory (RAM) 803, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in the RAM 803. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0131] The following components are connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output portion 807 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a speaker, and the like; a storage portion 808 including a hard disk, and the like; and a communication portion 809 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as necessary. A removable recording medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 810 as necessary, so that a computer program read therefrom is installed into the storage portion 808 as necessary.

[0132] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program in accordance with embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising computer programs for performing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 809, and / or installed from the removable media 811. When the computer program is executed by the central processing unit (CPU) 801, various functions defined in the system of the present application are performed.

[0133] It should be noted that the computer readable medium shown in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable signal medium can include a data signal propagated in a baseband or as a carrier wave in a propagated data signal, in which the computer readable computer program is carried. Such a propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium other than the computer readable storage medium that can send, propagate or transfer the program for use by or in connection with the instruction execution system, apparatus or device. The computer program contained in the computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, or the like, or any suitable combination of the above.

[0134] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowcharts, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.

[0135] The units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The names of the units described in the embodiments of the present application do not constitute a limitation on the units themselves in some cases.

[0136] Another aspect of the present application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor of a computer, so that the computer performs the model-in-loop simulation test method as described above. The computer readable storage medium can be included in the electronic device described in the above embodiments, or can exist separately and not be assembled into the electronic device.

[0137] Another aspect of the present application further provides a computer program product or a computer program, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device performs the model-in-loop simulation test method provided in the above embodiments.

[0138] To sum up, the present application provides a model-in-loop simulation test method, device, equipment and medium. The present application faces a service-oriented model, realizes automatic integration of the service-oriented model and automatic creation of test engineering. Meanwhile, the present application has the advantages of definable timing sequence of the service-oriented model, definable application layer function call, observable application layer function return value, automatically generated underlying function, observable underlying function input parameter, definable underlying function return value and the like, meets the automatic execution requirement of test cases, greatly improves the model-in-loop test efficiency and saves the development time cost.

[0139] The above embodiments merely illustrate the principles of the present application and its effects, and are not intended to limit the present application. Any modification or change made by any person skilled in the art without departing from the spirit and scope of the present application shall be covered by the claims of the present application.

Claims

1. A model-in-the-loop simulation test method, characterized by, The method comprises the following steps: acquiring a plurality of functional model files for simulation testing, data of the functional model files including model file data and configuration file data; acquiring path information of the model file data to create a plurality of hierarchical subsystem modules; adding the model file data to the corresponding subsystem modules, configuring input interface information, output interface information and transfer information of the plurality of hierarchical subsystem modules to build an integration file; loading the configuration file data into a global variable space associated with the integration file to generate an integration model file; performing model reference processing on the integration model file to generate a test engineering file; and performing simulation testing on an input test case according to the test engineering file to generate test result data.

2. The model-in-the-loop simulation test method according to claim 1, wherein, The step of loading the configuration file data into the global variable space associated with the integration file to generate an integration model file comprises: acquiring data storage file data, data definition file data and data dictionary file data in the configuration file data; and loading the data storage file data, the data definition file data and the data dictionary file data into the global variable space associated with the integration file in sequence to generate an integration model file.

3. The model-in-the-loop simulation test method according to claim 1, wherein The step of performing model reference processing on the integration model file to generate a test engineering file comprises: performing model reference processing on the integration model file to generate a test file; and performing functional module configuration processing on the test file to generate the test engineering file.

4. The model-in-the-loop simulation test method according to claim 3, wherein The step of performing functional module configuration processing on the test file to generate the test engineering file comprises: configuring a timing management module of the test file based on running order information of each hierarchical model of the integration model file, the timing management module managing running timing of a plurality of hierarchical service models; and configuring an input reconstruction module of the test file based on input interface information of the integration model file, the input reconstruction module importing input signals of the integration model file.

5. The model-in-the-loop simulation test method according to claim 4, wherein, The step of performing functional module configuration processing on the test file to generate the test engineering file further comprises: acquiring function call information and function definition information of the integration model file; configuring a function call module of the test file according to the function call information; and configuring a function definition module of the test file according to the function call information and the function definition information.

6. The model-in-the-loop simulation test method according to claim 5, wherein, The step of performing functional module configuration processing on the test file to generate the test engineering file further comprises: configuring an output reconstruction module of the test file based on transfer information of the test file, transfer information of the function call module and transfer information of the function definition module; and saving the configured test file to generate the test engineering file.

7. A model-in-the-loop simulation test apparatus, characterized by, The simulation testing device comprises: A model data acquisition unit is configured to acquire a plurality of function model files for simulation testing, data of the function model files including model file data and configuration file data; An integrated file construction unit is configured to construct an integrated file according to the model file data; An integrated model generation unit is configured to load the configuration file data into a global variable space associated with the integrated file to generate an integrated model file; A test engineering generation unit is configured to perform model reference processing on the integrated model file to generate a test engineering file; and A test engineering execution unit is configured to perform simulation testing on an input test case according to the test engineering file to generate test result data.

8. An electronic device, comprising: The electronic device includes: one or more processors; and a storage device for storing one or more programs that, when executed by the one or more processors, cause the electronic device to implement the model-in-loop simulation testing method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, A computer program is stored thereon, when the computer program is executed by a processor of a computer, the computer executes the model-in-loop simulation testing method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Sub-model test apparatus and method for dynamic system simulation

    CN106528936A

  • Test environment model generation method and device, computer device and storage medium

    CN108241357A