Vehicle control unit model in-loop test system and method
By designing the vehicle controller model in-ring testing system, the problems of singularity and inefficiency of the existing test system are solved, and comprehensive, effective and automatic model in-ring testing are achieved for different projects and products, improving the testing efficiency and safety of the vehicle controller software model.
Patent Information
- Application Number
- CN202510069342.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-01-16
AI Technical Summary
The existing vehicle controller model has problems of singularity and inefficiency in ring testing, which is difficult to meet the needs of complex logic processing and real data use, affecting the safe operation of the vehicle.
A vehicle controller model in-ring testing system was designed, including architecture modules, calibration modules, script modules and interface modules. The physical model is built through a preset platform-based model architecture, and the interface model is generated by combining data calibration and script programs to achieve comprehensive, effective and automatic model in-ring testing suitable for different projects and products.
The efficiency of the vehicle controller software model in-ring test is improved, making the test results closer to the hardware in-ring test and actual vehicle test results, exposing the test problems in advance, and ensuring the safe operation of the vehicle.
Smart Images

Figure CN119882696A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automobile testing, and in particular to a whole vehicle controller model-in-the-loop testing system and method. Background Art
[0002] As the core component of the car, the vehicle controller collects vehicle signal data, such as the accelerator pedal, gear position, brake pedal and other signals to determine the driver's driving intention, monitor the vehicle status, such as speed, temperature and other information to generate corresponding operation control instructions to control the safe, stable and reliable operation of the vehicle. Therefore, the quality of the vehicle controller directly determines the stability and safety of the vehicle.
[0003] At present, with the trend of diversified and rapid update of vehicle controllers, the corresponding software development cycle of each controller function has become shorter, which has accelerated the software changes and led to heavy testing tasks for vehicle controllers. Model In Loop (MIL) testing is a commonly used testing method. After the initial development of the model, it verifies whether the control model meets the functional requirements in the form of pure software simulation. That is, MIL testing integrates the vehicle controller software model and the vehicle model to form a closed-loop control, and uses Simulink to perform model simulation testing; it is used to verify the system function logic in the early stage of software development, can quickly locate test problems, and can effectively improve software development efficiency and reduce testing costs.
[0004] However, due to the wide variety of vehicle drive types and functional requirements, the existing MIL test of the vehicle controller is only for specific models, such as electric vehicles, which will lead to the singleness of the projects and products corresponding to the vehicle controller model; even worse, only simulating and reading a single signal is difficult to meet the testing requirements of the vehicle controller software functions involving complex logic processing. In addition, the implementation of the existing vehicle controller software functions is strongly related to the calibration data, but the existing MIL test lacks the use of real data; and the test cases are relatively simple, and the case library is not shared with the hardware-in-the-loop test, which makes the MIL test less efficient, thus affecting the safe operation of the vehicle. Summary of the invention
[0005] In view of this, the present invention provides a vehicle controller model-in-the-loop testing system and method to solve the problem raised in the above technical background that there is a lack of comprehensive, effective and automatic model-in-the-loop testing of vehicle controllers for different projects and products, resulting in many defects, which in turn seriously affects the safe operation of the vehicle.
[0006] In a first aspect, the present invention provides a vehicle controller model-in-the-loop test system, the system comprising:
[0007] Architecture module, calibration module, script module and interface module;
[0008] Among them, the architecture module is used to build the physical model required for the model-in-the-loop test environment. The physical model is built according to the preset platform model architecture of the vehicle controller software test in response to the preset test requirements;
[0009] The calibration module is used to provide a vehicle controller software model to be tested after data calibration;
[0010] The script module includes a script program that connects the physical model and the software model of the vehicle controller to be tested, and generates a corresponding interface model in the interface module by running the script program, wherein the interface model is used for communication between the architecture module and the calibration module.
[0011] The vehicle controller model-in-the-loop testing system of the present invention can build a physical model that meets the needs of different test environments through a preset platform model architecture for vehicle controller software testing, and can facilitate comprehensive, effective and automatic model-in-the-loop testing of vehicle controllers suitable for different projects and products in combination with the vehicle controller software model to be tested after data calibration, script program and interface model, which helps to greatly improve the efficiency of vehicle controller software model-in-the-loop testing, thereby ensuring the safe operation of the vehicle.
[0012] In an optional implementation, the architecture module includes: a first architecture unit, a second architecture unit, and a third architecture unit;
[0013] Among them, the first architecture unit is a data layer, including a parameter file and a configuration file. The parameter file includes a first parameter file and a second parameter file. The first parameter file is composed of control parameters and physical calculation parameters that are not related to the vehicle model. The second parameter file is a model initialization parameter related to the vehicle model adapted to the preset test requirements. The model initialization parameter includes at least engine parameters, battery parameters, motor parameters and vehicle parameters.
[0014] The second architecture unit is a software layer containing at least one preset function module, wherein the model parameters and model functions of each preset function module are determined by the corresponding parameter files and configuration files in the first architecture unit;
[0015] The third architecture unit is an interface layer, which is used for communication among various preset functional modules in the second architecture unit.
[0016] The architecture module of the present invention designs a preset platform model architecture for the whole vehicle controller software test, which includes a first architecture unit of the data layer, a second architecture unit of the software layer, and a third architecture unit of the interface layer; through the preset platform model architecture, a physical model that meets the needs of different test environments can be built, wherein the physical model can cover different projects and products, thereby realizing the signal transmission between the physical models of the whole vehicle controller software model in the loop test and the state changes of each controller, and can simulate the signal source and flow direction of each subsystem of a real vehicle, making it possible to test the state flow of other controllers and the impact of the whole vehicle controller software on the whole vehicle system.
[0017] In an optional implementation, the calibration module includes: a first calibration unit, a second calibration unit, and a third calibration unit;
[0018] Wherein, the first calibration unit is used to identify a preset calibration data file, and the preset calibration data file includes a calibration name, a calibration value and a calibration type;
[0019] The second calibration unit is used to identify a data object file to be calibrated of a preset vehicle controller software model, where the data object file to be calibrated includes a data object name, a data object value and a data object type;
[0020] The third calibration unit is used to perform data calibration on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain the vehicle controller software model to be tested.
[0021] The calibration module of the present invention is designed to include a first calibration unit for identifying a preset calibration data file, a second calibration unit for identifying a data object file to be calibrated of a preset whole vehicle controller software model, and a third calibration unit for calibrating the preset whole vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain the whole vehicle controller software model to be tested. The calibration module can import the calibration data of the whole vehicle controller software model, so that the model-in-the-loop test results are closer to the hardware-in-the-loop test and the actual vehicle test results, and can advance the time when the test problems are exposed, further improving the efficiency of the in-the-loop test of the whole vehicle controller software model and ensuring the safe operation of the whole vehicle.
[0022] In an optional implementation, the interface module includes: a first interface unit and a second interface unit;
[0023] Wherein, the first interface unit is used to provide a first interface model supporting CAN communication;
[0024] The second interface unit is used for providing a second interface model supporting hard-wire communication.
[0025] The interface module of the present invention is designed to include a first interface unit providing a first interface model supporting CAN communication and a second interface model supporting hard-wired communication, which can take into account the different communication modes of various components in the vehicle and provide corresponding interfaces for the communication of various modules.
[0026] In an optional implementation, the script module includes: a first script unit and a second script unit;
[0027] The first script unit is used to provide a first script program for generating a first interface model, the first script program is composed of operations of reading a first preset table, performing data conversion on the first preset table, and then performing model connection according to the software internal signal name, the first preset table contains mapping relationships between different CAN signals, software internal signals and model default values;
[0028] The second script unit is used to provide a second script program for generating a second interface model. The second script program is composed of operations of traversing the hard-wired signal names inside the software and performing model connections on them.
[0029] The script module of the present invention is designed to include a first script unit that provides a first script program for generating a first interface model and a second script unit that provides a second script program for generating a second interface model. The corresponding interface models can be generated simply by running different script programs to ensure communication between different modules.
[0030] In a second aspect, the present invention provides a vehicle controller model-in-the-loop testing method, which is applied to the vehicle controller model-in-the-loop testing system in the first aspect or any corresponding embodiment thereof, and the method includes:
[0031] In response to preset test requirements, a physical model is built according to a preset platform model architecture for vehicle controller software testing, and the physical model is used to configure the environment required for model-in-the-loop testing;
[0032] Obtaining a preset calibration data file and a data object file to be calibrated of a preset vehicle controller software model, and performing data calibration on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain a vehicle controller software model to be tested;
[0033] Determine a script program for model connection based on the physical model and the vehicle controller software model to be tested, and run the script program to obtain a corresponding interface model, wherein the interface model is used for communication between the physical model and the vehicle controller software model to be tested;
[0034] Based on the preset test requirements, test cases are screened from the preset test case library, and the test cases are converted to obtain a test script program;
[0035] Run the test script program and output a test report based on the running results.
[0036] The present invention builds a physical model according to a preset platform model architecture for whole vehicle controller software testing, and the physical model provides a model-in-the-loop test environment that meets preset test requirements; data calibration is performed according to a preset calibration data file and a data object file to be calibrated of a preset whole vehicle controller software model, and a whole vehicle controller software model to be tested is obtained, so as to provide a model-in-the-loop test object that meets the preset test requirements; and after a model-in-the-loop test system is constructed through a script program and an interface model, a test is performed in combination with test cases that meet the preset test requirements screened from a preset test case library, and a corresponding test report is obtained, which can provide a comprehensive, effective and automatic model-in-the-loop test method for whole vehicle controllers suitable for different projects and products, and is helpful to greatly improve the efficiency of the whole vehicle controller software model-in-the-loop test, and further ensure the safe operation of the whole vehicle.
[0037] In an optional implementation, data calibration is performed on a preset vehicle controller software model according to a preset calibration data file and a data object file to be calibrated, including:
[0038] Reading and formatting a preset calibration data file and a data object file to be calibrated, wherein the preset calibration data file includes a calibration name, a calibration value, and a calibration type, and the data object file to be calibrated includes a data object name, a data object value, and a data object type;
[0039] Filter the data object names that match the calibration name, and determine the data object to be calibrated and its current value and current type according to the data object name;
[0040] The calibration value is processed based on the calibration value, the calibration type, the current value and the current type, and the calibration value after the data processing is assigned to the current value.
[0041] The present invention performs file reading and format conversion operations on preset calibration data files and data object files to be calibrated, screens data object names that match calibration names, and determines the data objects to be calibrated and their current values and current types according to the data object names; performs data processing on the calibration values based on the calibration values, calibration types, current values and current types, and assigns the calibration values after data processing to the current values to realize data calibration of the preset whole vehicle controller software model, so that the model-in-the-loop test results are closer to the hardware-in-the-loop test results and the actual vehicle test results, and the time when the test problems are exposed can be advanced, thereby further improving the efficiency of the whole vehicle controller software model in-the-loop test and ensuring the safe operation of the whole vehicle.
[0042] In an optional implementation, data processing is performed on the calibration value based on the calibration value, the calibration type, the current value and the current type, including:
[0043] If the calibration type is different from the current type, the calibration value is converted to the value corresponding to the current type;
[0044] If the dimensions of the calibrated value are different from those of the current value, the calibrated value is interpolated based on the dimension of the current value.
[0045] The present invention takes into account the difference between the calibration type and the current type and the difference between the calibration value and the current value dimension, and accordingly designs a corresponding data processing method to ensure the accuracy of data calibration.
[0046] In an optional implementation, the preset test case library contains at least test cases for hardware-in-the-loop testing, software-in-the-loop testing, and model-in-the-loop testing, wherein the test case is in the form of an XML file, and the test case is converted to obtain a test script program, including:
[0047] Read the xml file;
[0048] Identify test cases in xml files;
[0049] The use case is converted based on a preset writing method to obtain a corresponding test script program, wherein the preset writing method is a statement or function written according to different scripting languages.
[0050] The present invention can realize automated testing of the software model-in-the-loop testing of the whole vehicle controller by designing a preset test case library including test cases for hardware-in-the-loop testing, software-in-the-loop testing and model-in-the-loop testing, and converting the format of the test cases, thereby ensuring that the model-in-the-loop testing and the hardware-in-the-loop testing share a common test case library, and can automatically control the operation and data interaction of the model-in-the-loop testing system, thereby completing the execution of complex logical steps and the processing and judgment of signal data.
[0051] In an optional implementation, a test report is output according to the operation result, including:
[0052] Identify comments and attribute information in test script programs;
[0053] Detect whether there are any operating failures during the running of the test script program;
[0054] When there is a running fault, record the statement location, occurrence time and program error information of the fault, where the program error information includes the error identifier, error stack and error cause;
[0055] Count the statement failures in the test script program, and generate an in-the-loop test case report for the vehicle controller software model to be tested based on comments, attribute information, and statement failures;
[0056] Detect whether there are any modifications to the test cases during the running of the test script program;
[0057] When there is a modification of the test case, the corresponding modification information is stored to obtain a temporary file;
[0058] The test report consists of in-loop test case reports and / or program error information and / or temporary files.
[0059] The present invention obtains in-loop test case reports, program error information or temporary files according to the running results of the test script program during the running process to obtain and output the test report, and can provide comprehensive test results.
[0060] The vehicle controller model-in-the-loop testing system and method of the present invention build a physical model that meets the needs of different test environments through a preset platform model architecture for vehicle controller software testing; perform data calibration according to a preset calibration data file and a data object file to be calibrated of a preset vehicle controller software model to obtain a model-in-the-loop test object, that is, a vehicle controller software model to be tested; and after the model-in-the-loop testing system is constructed through a script program and an interface model, the test is performed in combination with test cases that meet the preset test requirements screened from a preset test case library, and a corresponding test report is obtained; the above-mentioned system and method provide a comprehensive, effective, and automatic model-in-the-loop testing method for vehicle controllers that can be applied to different projects and products, which helps to greatly improve the efficiency of the vehicle controller software model-in-the-loop testing and greatly ensures the safe operation of the vehicle. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 is a schematic diagram of the structure of a vehicle controller model-in-the-loop test system according to an embodiment of the present invention;
[0063] Figure 2 is a schematic structural diagram of another vehicle controller model-in-the-loop test system according to an embodiment of the present invention;
[0064] Figure 3 It is a schematic diagram of the platform model architecture for vehicle controller software testing;
[0065] Figure 4 It is a flow chart of the calibration data integration method of the vehicle controller software model;
[0066] Figure 5 It is a connection diagram of the vehicle controller software model in-loop test system;
[0067] Figure 6 is a flow chart of a vehicle controller model-in-the-loop testing method according to an embodiment of the present invention;
[0068] Figure 7 4 is a flow chart of another vehicle controller model-in-the-loop testing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0070] In this embodiment, a vehicle controller model in-loop test system is provided. Figure 1 Schematic diagram of the structure of the vehicle controller model in the loop test system according to an embodiment of the present invention. Figure 1 As shown, the system includes: an architecture module 1, a calibration module 2, a script module 3 and an interface module 4; wherein the architecture module 1 is used to build the physical model required for the model-in-the-loop test environment, and the physical model is built according to the preset platform model architecture of the vehicle controller software test in response to the preset test requirements; the calibration module 2 is used to provide the vehicle controller software model to be tested after data calibrated; the script module 3 includes a script program connecting the physical model and the vehicle controller software model to be tested, and generates the corresponding interface model in the interface module 4 by running the script program, wherein the interface model is used for communication between the architecture module and the calibration module.
[0071] It should be noted that the specific content of the preset test requirements in this embodiment is not limited here, and is determined based on the adaptability of actual needs; the preset platform model architecture of the vehicle controller software test in this embodiment is applicable to different projects and products, and is used to build the platform model architecture corresponding to the physical model required for the vehicle controller software model in-loop test environment. Specifically, the platform model architecture can be used to easily switch between projects and products.
[0072] The vehicle controller model-in-the-loop test system in the embodiment of the present invention can build a physical model that meets the needs of different test environments through the preset platform model architecture of the vehicle controller software test, and combine the vehicle controller software model to be tested after data calibration, script program and interface model to facilitate comprehensive, effective and automatic model-in-the-loop testing of the vehicle controller suitable for different projects and products, which helps to greatly improve the efficiency of the vehicle controller software model-in-the-loop testing, thereby ensuring the safe operation of the whole vehicle.
[0073] In a specific embodiment, Figure 2 FIG. 1 is a schematic diagram of the structure of another vehicle controller model-in-the-loop test system according to an embodiment of the present invention. Figure 2 It can be seen that the architecture module 1 includes: a first architecture unit 11, a second architecture unit 12 and a third architecture unit 13; wherein the first architecture unit 11 is a data layer, including a parameter file and a configuration file, the parameter file includes a first parameter file and a second parameter file, the first parameter file is composed of control parameters and physical calculation parameters that are independent of the vehicle model, the second parameter file is a model initialization parameter related to the vehicle model adapted to the preset test requirements, and the model initialization parameter includes at least engine parameters, battery parameters, motor parameters and vehicle parameters; the second architecture unit 12 is a software layer containing at least one preset function module, wherein the model parameters and model functions of each preset function module are determined by the corresponding parameter file and configuration file in the first architecture unit; the third architecture unit 13 is an interface layer, which is used for communication between each preset function module in the second architecture unit.
[0074] It should be noted that the platform model architecture of the vehicle controller software test in this embodiment is intended to improve development efficiency, reduce costs, enhance flexibility and promote standardization. Specifically, by sharing infrastructure and components, the development process is made more efficient, while reducing development and maintenance costs. In addition, platformization can also enhance the flexibility and scalability of the system, making it easy to quickly adapt to changes in market demand. The architecture of this embodiment includes: parameters and configuration files for adapting projects and products; wherein the parameter file is a model initialization parameter file related to the vehicle model and distinguished by the vehicle model name; the configuration file includes power type, drive mode, hardware configuration and vehicle communication mode. Contains software layers with different functional modules, wherein the software layer includes a driver module, an environment module, an actuator module, a sensor module, a controller module and a vehicle module. It should be noted that the model parameters of different projects and products are determined by the working variables loaded into the workspace by the parameter file; the module functions of different projects and products are switched by the configuration file. Finally, an IO interface layer for data interaction in the software layer is also included.
[0075] In a specific embodiment, a platform model architecture for vehicle controller software testing is provided. Figure 3This is a schematic diagram of the platform model architecture for vehicle controller software testing. Figure 3 It can be seen that the architecture consists of three parts, including:
[0076] The first part is the configuration file and parameter file. Among them, the configuration file includes parameters of power type, drive mode, hardware configuration and vehicle communication mode. Specifically, the power type includes hybrid power, plug-in hybrid power, extended-range power and pure electric power; the drive mode includes two-wheel drive front drive, two-wheel drive rear drive, four-wheel drive front drive, and four-wheel drive rear drive. The hardware configuration includes a P gear mechanism, an electronic handbrake hard switch, and a gear shifting method. The vehicle communication mode includes different CAN communication protocols. There are two types of parameter files. The first parameter file contains control parameters and physical calculation parameters that are not related to the vehicle model. The second parameter file contains vehicle model-related model initialization parameters for different projects and products, including engine parameters, battery parameters, motor parameters and vehicle parameters. In this embodiment, if you need to switch between different projects and products, you only need to switch the configuration file and the second parameter file, and load the configuration file and parameter file into the workspace.
[0077] The second part is the software layer containing different functional modules. The software layer includes driver module, environment module, actuator module, sensor module, controller module and vehicle module. Specifically, the actuator module, sensor module, controller module and vehicle module read parameters from the workspace in the form of configuration variables and parameter variables; each module selects the corresponding function to be implemented according to the configuration variables without modifying the model, and loads the parameter variables into the model, thereby realizing the switching of different projects and products.
[0078] The third part is the IO interface layer. In this embodiment, the interface layer is used for data exchange between different modules in the software layer. Each module sends data to the IO interface layer and obtains data sent by other modules from the IO interface layer, realizing the simulation of signal sources and flows between various vehicle systems.
[0079] In a specific embodiment, an example of data flow is provided, including: a driver module outputs a driver operation signal to an IO interface layer; a vehicle module obtains a driver operation signal, environmental parameters, and actuator data from the IO interface layer, and outputs vehicle status data to the IO interface layer; a controller module obtains a driver operation signal and sensor data from the IO interface layer, and at the same time, each controller of the controller module obtains other controller output signals from the IO interface layer, and outputs controller signals to the IO interface layer; an actuator module obtains controller output signals from the IO interface layer, and outputs actuator data to the IO interface layer; a sensor module obtains vehicle status data from the IO interface layer, and outputs sensor data to the IO interface layer; and an environmental module outputs environmental parameters to the IO interface layer.
[0080] In the embodiment of the present invention, the physical model is obtained through the architecture module, and the switching of projects and products can be easily performed without modifying the model, and the simulation of the signal flow at the system level can be realized. Specifically, the signal transmission between the physical model and the state change of each controller of the vehicle controller software model in the loop test is realized, and the signal source and flow direction of each subsystem of the real vehicle can be simulated, making it possible to test the state flow of other controllers and the influence of the vehicle controller software on the vehicle system.
[0081] In a specific embodiment, Figure 2 FIG. 1 is a schematic diagram of the structure of another vehicle controller model-in-the-loop test system according to an embodiment of the present invention. Figure 2 It can be seen that the calibration module 2 includes: a first calibration unit 21, a second calibration unit 22 and a third calibration unit 23; wherein the first calibration unit 21 is used to identify a preset calibration data file, the preset calibration data file includes a calibration name, a calibration value and a calibration type; the second calibration unit 22 is used to identify a data object file to be calibrated of a preset vehicle controller software model, the data object file to be calibrated includes a data object name, a data object value and a data object type; the third calibration unit 23 is used to perform data calibration on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain the vehicle controller software model to be tested.
[0082] It should be noted that in this embodiment, a calibration data integration method for a vehicle controller software model is provided, which is used to integrate the vehicle calibration data into the vehicle controller software model. Specifically, the above data calibration process includes: identifying the vehicle calibration data file (i.e., the actual performance data of the software in the vehicle), specifically reading the calibration in the file, including the calibration name, calibration value and calibration type; identifying the data object management file of the vehicle controller software model (i.e., the theoretical value preset by the software), specifically reading the data object in the file, including the data object name, data object value and data object type; matching the data object and calibration according to the data object name and calibration name, assigning the calibration value to the corresponding data object value after data processing, and saving the data object to the data object management file.
[0083] In a specific embodiment, Figure 4 This is a flow chart of the calibration data integration method of the vehicle controller software model. Figure 4 It can be seen that the process of calibration data integration includes the following four steps:
[0084] Step 1: Read the calibration in the vehicle calibration data file.
[0085] In this embodiment, the vehicle calibration data file is a vehicle controller software calibration file obtained after actual vehicle calibration. Specifically, the calibration in the file is read and converted into variables recognizable by the computer program, including calibration name, calibration value and calibration type.
[0086] Step 2: Read the data object in the vehicle controller software model data object management file.
[0087] In this embodiment, the data object is an adjustable calibration parameter of the vehicle controller software model. Specifically, the data object in the file is read and converted into a variable identifiable by the computer program, including the data object name, data object value and data object type.
[0088] Step three, match the data object with the calibration and perform data processing on the calibration.
[0089] In this embodiment, the calibration and data objects are traversed to find the calibration and data objects whose calibration names are the same as the data object names. Specifically, if the calibration type of the calibration and the data object type of the data object are inconsistent, the calibration value is converted into a value of the data object type; if the dimension of the calibration value of the calibration and the dimension of the data object value of the data object are inconsistent, the calibration value is interpolated according to the dimension of the data object value to obtain the calibration value after data processing.
[0090] It should be noted that interpolation processing of data with different dimensions can unify the data dimensions and facilitate subsequent data analysis and processing. In this embodiment, the specific method of interpolation can be determined according to the characteristics of the data and the analysis requirements. Common interpolation methods include linear interpolation, polynomial interpolation, spline interpolation, etc.
[0091] Step 4: Assign values to corresponding data objects and save them to the data object management file.
[0092] In this embodiment, the calibrated value after data processing is assigned to the matching data object value, and the data object corresponding to the data object value is saved in the data object management file.
[0093] In the embodiment of the present invention, the calibration module is used to import the whole vehicle calibration data of the vehicle controller software model, so that the model-in-the-loop test results are closer to the hardware-in-the-loop test and the actual vehicle test results, which can advance the time when the test problems are exposed, further improve the efficiency of the vehicle controller software model in-the-loop test, and ensure the safe operation of the whole vehicle.
[0094] It should be noted that the number of script programs in the script module of this embodiment is adaptively adjusted according to the number of interface units in the interface module, and the number of interface units is adaptively adjusted according to the communication methods supported by each component in the actual vehicle, such as supporting bus communication methods and supporting hard-line communication methods, which is only for exemplary purposes.
[0095] In a specific embodiment, Figure 2 FIG. 1 is a schematic diagram of the structure of another vehicle controller model-in-the-loop test system according to an embodiment of the present invention. Figure 2 It can be seen that the interface module 4 includes: a first interface unit 41 and a second interface unit 42; wherein the first interface unit 41 is used to provide a first interface model supporting CAN communication; and the second interface unit 42 is used to provide a second interface model supporting hard-wired communication. Specifically, the interface module takes into account different communication modes of various components in the vehicle, and provides corresponding interfaces for the communication of each module.
[0096] It should be noted that CAN (Controller Area Network) is an internationally standardized serial communication protocol, mainly used for real-time applications. It has now become the standard bus protocol in the automotive industry. The signals involved in the communication process are CAN signals; hard wiring mainly refers to the physical connection method used in traditional automotive electrical systems, including wires, connectors and wiring harnesses, etc., which are responsible for transmitting power and signals and connecting various components and sensors. The signals involved in the communication process are hard-wired signals.
[0097] In a specific embodiment, Figure 2 FIG. 1 is a schematic diagram of the structure of another vehicle controller model-in-the-loop test system according to an embodiment of the present invention. Figure 2 It can be seen that the script module 3 includes: a first script unit 31 and a second script unit 32; wherein the first script unit 31 is used to provide a first script program for generating a first interface model, the first script program consists of reading a first preset table, performing data conversion on the first preset table, and then connecting the model according to the software internal signal name, the first preset table contains a mapping relationship between different CAN signals, software internal signals and model default values; the second script unit 32 is used to provide a second script program for generating a second interface model, the second script program consists of traversing the software internal hard-wired signal names and connecting them to models.
[0098] It should be noted that the script module 3 in this embodiment is used to integrate the script program of the physical model and the vehicle controller software model to construct an interface model; the interface module 4 is used to implement the script program to obtain the corresponding interface model to establish a communication bridge between different models; the specific contents of the first preset table and the second preset table are not limited here, and are adaptively adjusted based on actual product or project requirements.
[0099] In this embodiment, generating a script program supporting different communication modes specifically includes the following three steps:
[0100] Step 1: read the correspondence table between input and output CAN signals and internal software signals. The correspondence table has built-in predetermined rules, that is, after the software design is completed, the controller obtains data (including specific values and types) from the CAN bus and converts the above data into variables recognizable by the computer program, including CAN signal name, software internal signal name and default value (i.e. model default value).
[0101] Step 2: Add the CAN signal interface model. Specifically, traverse the internal signal names of the software. If the corresponding CAN signal name is empty, add a model with a constant of zero and connect it to the vehicle controller software model; if the corresponding CAN signal name exists, add a model that connects the corresponding CAN signal in the physical model IO interface layer; if the corresponding CAN signal in the physical model IO interface layer does not exist, add a model with a constant of the default value and connect it to the vehicle controller software model.
[0102] Step 3: Add a virtual hard-wire signal interface model. Specifically, traverse the names of hard-wire signals in the software and add a model that connects to the corresponding hard-wire signal in the IO interface layer of the physical model.
[0103] The script module in the embodiment of the present invention is designed to include a first script unit that provides a first script program for generating a first interface model and a second script unit that provides a second script program for generating a second interface model. The corresponding interface models can be generated simply by running different script programs to ensure communication between different modules.
[0104] In a specific embodiment, a vehicle controller software model in-loop test system is provided, the system comprising: a physical model constructed by a preset platform model architecture, a vehicle controller software model obtained by calibration data integration, a script program integrating the physical model and the vehicle controller software model, and an interface model including CAN signals and virtual hard-wire signals obtained by implementing different script programs. Figure 5 It is a connection diagram of the vehicle controller software model in-loop test system.
[0105] An embodiment of the present invention also provides an embodiment of a vehicle controller model in-the-loop testing method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0106] In this embodiment, a vehicle controller model in-the-loop testing method is provided, which is applied to a vehicle controller model in-the-loop testing system. Figure 6 is a flow chart of a vehicle controller model-in-the-loop testing method according to an embodiment of the present invention. Figure 6 As shown, the process includes the following steps:
[0107] Step S601, in response to preset test requirements, a physical model is built according to a preset platform model architecture for vehicle controller software testing, and the physical model is used to configure the environment required for model-in-the-loop testing.
[0108] It should be noted that, in this embodiment, the relevant contents of the preset test requirements, preset platform model and physical model are referred to in the previous text and will not be repeated here.
[0109] Step S602, obtaining a preset calibration data file and a data object file to be calibrated of a preset vehicle controller software model, and calibrating the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain a vehicle controller software model to be tested.
[0110] In this embodiment, the specific content of data calibration is as mentioned above and will not be repeated here.
[0111] Step S603, determining a script program for model connection based on the physical model and the vehicle controller software model to be tested, and running the script program to obtain a corresponding interface model, wherein the interface model is used for communication between the physical model and the vehicle controller software model to be tested.
[0112] In this embodiment, the relevant contents of the script program and the interface model are as mentioned above and will not be repeated here.
[0113] Step S604, based on the preset test requirements, test cases are screened from the preset test case library, and the test cases are converted to obtain a test script program.
[0114] It should be noted that the preset test case library in this embodiment is intended to meet different software function test requirements, and it integrates case libraries constructed by different test methods, such as test methods including hardware-in-the-loop test, software-in-the-loop test, and model-in-the-loop test. In practical applications, since the file formats of the test cases provided by different test methods are different, they need to be converted to generate standardized script programs that can be used to directly run the test.
[0115] Step S605, running the test script program and outputting a test report according to the running result.
[0116] It should be noted that the specific content of the test report in this embodiment is not limited here, and can be adaptively adjusted according to actual needs. For example, the test results, the type and cause of the program running failure are only for exemplary description.
[0117] The vehicle controller model-in-the-loop testing method of the embodiment of the present invention builds a physical model according to a preset platform model architecture for vehicle controller software testing, and the physical model provides a model-in-the-loop testing environment that meets preset testing requirements; performs data calibration according to a preset calibration data file and a data object file to be calibrated of a preset vehicle controller software model, and obtains a vehicle controller software model to be tested, so as to provide a model-in-the-loop testing object that meets preset testing requirements; and after building a model-in-the-loop testing system through a script program and an interface model, performs testing in combination with test cases that meet preset testing requirements screened from a preset test case library, and obtains a corresponding test report, which can provide a comprehensive, effective, and automatic model-in-the-loop testing method for vehicle controllers suitable for different projects and products, and helps to greatly improve the efficiency of vehicle controller software model-in-the-loop testing, and further ensure the safe operation of the vehicle.
[0118] In this embodiment, a vehicle controller model in-loop testing method is provided. Figure 7 FIG. 1 is a flow chart of another vehicle controller model-in-the-loop testing method according to an embodiment of the present invention. Figure 7 As shown, the process includes the following steps:
[0119] Step S701: In response to the preset test requirements, a physical model is built according to the preset platform model architecture of the vehicle controller software test. The physical model is used to configure the environment required for the model-in-the-loop test. For details, please refer to Figure 6 Step S601 of the illustrated embodiment will not be described in detail here.
[0120] Step S702, obtaining a preset calibration data file and a data object file to be calibrated of a preset vehicle controller software model, and calibrating the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain a vehicle controller software model to be tested.
[0121] Specifically, in the above step S702, data calibration is performed on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated, including:
[0122] Step S7021, reading and format conversion of a preset calibration data file and a data object file to be calibrated, wherein the preset calibration data file includes a calibration name, a calibration value and a calibration type, and the data object file to be calibrated includes a data object name, a data object value and a data object type.
[0123] It should be noted that the specific method of reading the file in this embodiment can be determined according to the conventional reading method in this field; the format conversion in this embodiment is to convert the read file into a variable recognizable by a computer. The specific conversion method is not limited here and can also be implemented by referring to the conventional conversion method in this field.
[0124] Step S7022, filter the data object names that match the calibration name, and determine the data object to be calibrated and its current value and current type according to the data object name.
[0125] In this embodiment, the data object names matching the marked names are screened according to conventional screening methods in the art, which are not limited here.
[0126] Step S7023, performing data processing on the calibration value based on the calibration value, the calibration type, the current value and the current type, and assigning the calibration value after the data processing to the current value.
[0127] In this embodiment, the vehicle calibration is imported into the vehicle controller software model, that is, the calibration value after data processing is assigned to the current value of the object to be calibrated in the to-be-calibrated data object file of the preset vehicle controller software model.
[0128] Specifically, in the above step S7023, data processing is performed on the calibration value based on the calibration value, the calibration type, the current value and the current type, including:
[0129] Step A1: If the calibration type is different from the current type, the calibration value is converted into a value corresponding to the current type.
[0130] Step A2: if the dimensions of the calibration value and the current value are different, interpolation processing is performed on the calibration value based on the dimension of the current value.
[0131] In this embodiment, the relevant contents of the interpolation processing are referred to above and will not be repeated here.
[0132] In the embodiment of the present invention, taking into account the difference between the calibration type and the current type and the difference between the calibration value and the current value dimension, corresponding data processing methods are designed to ensure the accuracy of data calibration; in addition, by performing file reading and format conversion operations on the preset calibration data file and the data object file to be calibrated, the data object name matching the calibration name is screened, and the data object to be calibrated and its current value and current type are determined according to the data object name; the calibration value is data processed based on the calibration value, calibration type, current value and current type, and the calibration value after data processing is assigned to the current value to realize data calibration of the preset vehicle controller software model, so that the model-in-the-loop test results are closer to the hardware-in-the-loop test and the actual vehicle test results, and the time when the test problem is exposed can be advanced, further improving the efficiency of the vehicle controller software model in-the-loop test and ensuring the safe operation of the vehicle.
[0133] Step S703, determine the script program for model connection based on the physical model and the vehicle controller software model to be tested, and run the script program to obtain the corresponding interface model, wherein the interface model is used for communication between the physical model and the vehicle controller software model to be tested. Figure 6 Step S603 of the illustrated embodiment will not be described in detail here.
[0134] Step S704, based on the preset test requirements, test cases are screened from the preset test case library, and the test cases are converted to obtain a test script program.
[0135] In this embodiment, the preset test case library contains at least test cases for hardware-in-the-loop testing, software-in-the-loop testing and model-in-the-loop testing, wherein the format of the test cases is an XML file.
[0136] Specifically, in the above step S704, the test case is converted to obtain a test script program, including:
[0137] Step S7041, read the xml file.
[0138] It should be noted that an xml file is a file with a file extension of ".xml". This file format is often used for data storage and transmission and is a very popular text format in current applications. In this embodiment, the specific reading method of the xml file is not limited here and can be adaptively adjusted based on the actual development platform or programming language. For example, for an xml file written in the Python programming language, the ElementTree module in the Python standard library can be used to read it, which is only an exemplary description.
[0139] Step S7042, identifying the test cases in the xml file.
[0140] Step S7043, converting the use case based on a preset writing method to obtain a corresponding test script program, wherein the preset writing method is a statement or function written according to different scripting languages.
[0141] In this embodiment, the specific type of the scripting language and the specific content of the preset writing method are not limited here, and can be adaptively adjusted according to actual needs.
[0142] In a specific embodiment, the use cases in the use case library are XML files applicable to hardware-in-the-loop testing, software-in-the-loop testing, and model-in-the-loop testing, and the test case scripts are M scripts running in Matlab (i.e., a development platform that integrates functions such as numerical analysis, matrix operations, data visualization, and interactive programming); an automated program for converting XML files into test case scripts (i.e., M scripts) includes:
[0143] (1) Read the XML file and identify the use case.
[0144] In this embodiment, the use case writing method includes Block, Loop, IfThenElse, Read, Write, Restore, Package, Wait, Calculation and Comment.
[0145] (2) Convert the use case into m scripting language.
[0146] In this embodiment, the step is essentially to convert the use case writing method into the m script language. Specifically, the Block method is converted into a loop statement with a loop count of 1; the Loop method is converted into a loop statement with a loop variable, a loop count and an exit condition; the IfThenElse method is converted into a conditional statement that retains the judgment condition; the Read method is converted into a TestRead function; the Write method is converted into a TestWrite function; the Restore method is converted into a TestRestore function; the Package method is converted into a run function that looks up the corresponding table and calls the written use case package script; the Wait method is converted into a TestWait function; the Calculation method is converted into a TestCal function; and the Comment method is converted into a comment statement.
[0147] In the embodiment of the present invention, by designing a preset test case library including test cases for hardware-in-the-loop testing, software-in-the-loop testing and model-in-the-loop testing and converting the format of the test cases, it is possible to realize automated testing of the software model-in-the-loop testing of the vehicle controller, ensure that the model-in-the-loop testing and the hardware-in-the-loop testing share a test case library, and automatically control the operation and data interaction of the model-in-the-loop testing system, thereby completing the execution of complex logical steps and the processing and judgment of signal data.
[0148] Step S705, run the test script program, and output a test report according to the running result.
[0149] In this embodiment, running the test script program is to automatically run the m script obtained in the above steps. Specifically, the script running includes two parts, the first part is the mapping file of the signal name and the model path, and the second part is the customized TestRead function, TestWrite function, TestRestore function, TestWait function and TestCal function; among them, the TestRead function reads the signal value from the model and determines whether the read signal value matches the expected value, the TestWrite function writes the parameter value to the model, the TestRestore function reads the initial value of the parameter and writes it to the model, the TestWait function waits for the real time, and the TestCal function performs numerical calculations.
[0150] In this embodiment, the outputting of the test report according to the operation result in the above step S705 includes:
[0151] Step B1, identifying comments and attribute information in the test script program.
[0152] In this embodiment, comments and attribute information can be obtained according to the corresponding identification method of the script type. For example, the m script can obtain all comment lines in the file through the comment function and obtain attribute information through the meta.classInfo function. This is only an exemplary description.
[0153] Step B2, detecting whether there is any operation failure during the running of the test script program.
[0154] In this embodiment, the specific detection method of the program running fault is not limited here, and is adaptively adjusted based on the actual program running environment.
[0155] Step B3, when there is a running fault, record the statement location where the fault occurs, the time of occurrence, and program error information, wherein the program error information includes an error identifier, an error occurrence stack, and an error cause.
[0156] It should be explained that the error stack refers to the sequence of function calls when an error occurs during program execution. Specifically, when an error or exception occurs during program execution, the call stack information when the error occurs will be automatically recorded, including the type of error, the location of the error, and the sequence of function calls when the error occurs.
[0157] Step B4, counting the statement failure conditions in the test script program, and generating an in-the-loop test case report of the vehicle controller software model to be tested based on the comments, attribute information and statement failure conditions.
[0158] Step B5, detecting whether there is any modification of the test case during the running of the test script program.
[0159] Step B6: When there is a modification of the test case, the corresponding modification information is stored to obtain a temporary file.
[0160] Step B7, forming a test report from in-loop test case reports and / or program error information and / or temporary files.
[0161] In a specific embodiment, the test report includes a test case report, program error information and a temporary file; wherein the test case report is a vehicle controller software model in-loop test case report, including comments and attribute information, the pass and fail of each step, the model time and fail information of the failed statement; the program error information includes the error identifier of the error occurring when the program is running, the error stack and the cause of the error; the temporary file includes the storage variable modification information of the test case.
[0162] In the embodiment of the present invention, an in-loop test case report, program error information or temporary file is obtained according to the running result of the test script program during the running process to obtain and output the test report, which can provide comprehensive test results.
[0163] In summary, the vehicle controller model-in-the-loop testing system and method of the embodiments of the present invention construct a platform model architecture for vehicle controller software testing, realize the calibration data integration of the vehicle controller software model, and simultaneously realize the construction and automated testing of the vehicle controller software model-in-the-loop testing system, which can conveniently switch between different projects and products for automated testing, and the test results are closer to hardware-in-the-loop and real vehicle testing; and the automatic test and hardware-in-the-loop test share a test case library, which can complete the execution of complex logic steps as well as signal data processing and judgment, greatly improving the efficiency of the vehicle controller software model-in-the-loop testing.
[0164] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A vehicle controller model-in-the-loop test system, characterized in that: The system comprises: Architecture module, calibration module, script module and interface module; The architecture module is used to build a physical model required for a model-in-the-loop test environment, and the physical model is built according to a preset platform model architecture for vehicle controller software testing in response to preset test requirements; The calibration module is used to provide a vehicle controller software model to be tested after data calibration; The script module includes a script program that connects the physical model and the software model of the vehicle controller to be tested, and generates a corresponding interface model in the interface module by running the script program, wherein the interface model is used for communication between the architecture module and the calibration module.
2. The vehicle controller model-in-the-loop test system according to claim 1, characterized in that: The architecture module includes: a first architecture unit, a second architecture unit and a third architecture unit; The first architecture unit is a data layer, including a parameter file and a configuration file, wherein the parameter file includes a first parameter file and a second parameter file, wherein the first parameter file is composed of control parameters and physical calculation parameters that are independent of the vehicle model, and the second parameter file is a model initialization parameter related to the vehicle model adapted to the preset test requirements, and the model initialization parameter includes at least engine parameters, battery parameters, motor parameters, and vehicle parameters; The second architecture unit is a software layer containing at least one preset function module, wherein the model parameters and model functions of each of the preset function modules are determined by the corresponding parameter files and configuration files in the first architecture unit; The third architecture unit is an interface layer, which is used for communication among the preset functional modules in the second architecture unit.
3. The vehicle controller model-in-the-loop test system according to claim 1, characterized in that: The calibration module includes: a first calibration unit, a second calibration unit and a third calibration unit; Wherein, the first calibration unit is used to identify a preset calibration data file, and the preset calibration data file includes a calibration name, a calibration value and a calibration type; The second calibration unit is used to identify a data object file to be calibrated of a preset vehicle controller software model, wherein the data object file to be calibrated includes a data object name, a data object value and a data object type; The third calibration unit is used to perform data calibration on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain the vehicle controller software model to be tested.
4. The vehicle controller model-in-the-loop test system according to claim 1, characterized in that: The interface module comprises: a first interface unit and a second interface unit; Wherein, the first interface unit is used to support a first interface model for CAN communication; The second interface unit is used for providing a second interface model supporting hard-wire communication.
5. The vehicle controller model-in-the-loop test system according to claim 4, characterized in that: The script module includes: a first script unit and a second script unit; The first script unit is used to provide a first script program for generating the first interface model, the first script program is composed of operations of reading a first preset table, performing data conversion on the first preset table, and then performing model connection according to the software internal signal name, the first preset table containing mapping relationships between different CAN signals, software internal signals and model default values; The second script unit is used to provide a second script program for generating the second interface model. The second script program is composed of operations of traversing the hard-wired signal names inside the software and performing model connections on them.
6. A vehicle controller model-in-the-loop testing method, applied to the vehicle controller model-in-the-loop testing system according to any one of claims 1 to 5, characterized in that: The method comprises: In response to preset test requirements, a physical model is built according to a preset platform model architecture for vehicle controller software testing, wherein the physical model is used to configure an environment required for model-in-the-loop testing; Acquire a preset calibration data file and a data object file to be calibrated of a preset vehicle controller software model, and perform data calibration on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated to obtain a vehicle controller software model to be tested; Determine a script program for model connection based on the physical model and the vehicle controller software model to be tested, and run the script program to obtain a corresponding interface model, wherein the interface model is used for communication between the physical model and the vehicle controller software model to be tested; Based on the preset test requirements, test cases are screened from a preset test case library, and the test cases are converted to obtain a test script program; Run the test script program and output a test report based on the running results.
7. The vehicle controller model-in-the-loop testing method according to claim 6, characterized in that: The step of performing data calibration on the preset vehicle controller software model according to the preset calibration data file and the data object file to be calibrated includes: Reading and formatting the preset calibration data file and the data object file to be calibrated, wherein the preset calibration data file includes a calibration name, a calibration value, and a calibration type, and the data object file to be calibrated includes a data object name, a data object value, and a data object type; Screening the data object names that match the calibration name, and determining the data object to be calibrated and its current value and current type according to the data object name; The calibration value is subjected to data processing based on the calibration value, the calibration type, the current value and the current type, and the calibration value after the data processing is assigned to the current value.
8. The vehicle controller model-in-the-loop testing method according to claim 7, characterized in that: The performing data processing on the calibration value based on the calibration value, the calibration type, the current value and the current type includes: If the calibration type is different from the current type, converting the calibration value into a value corresponding to the current type; If the dimensions of the calibrated value and the current value are different, an interpolation process is performed on the calibrated value based on the dimension of the current value.
9. The vehicle controller model-in-the-loop testing method according to claim 6, characterized in that: The preset test case library at least includes test cases for hardware-in-the-loop testing, software-in-the-loop testing, and model-in-the-loop testing, wherein the format of the test case is an XML file, and the test case is converted to obtain a test script program, including: Read the xml file; Identify the test cases in the xml file; The use case is converted based on a preset writing method to obtain a corresponding test script program, wherein the preset writing method is a statement or function written according to different scripting languages.
10. The vehicle controller model-in-the-loop testing method according to claim 6, characterized in that: The outputting of the test report according to the operation result includes: Identifying comments and attribute information in the test script program; Detecting whether there is an operation failure during the operation of the test script program; When there is a running fault, record the statement location, occurrence time and program error information where the fault occurs, wherein the program error information includes the error identifier, the stack where the error occurs and the cause of the error; Counting the statement failure conditions in the test script program, and generating an in-the-loop test case report of the vehicle controller software model to be tested based on the annotations, the attribute information and the statement failure conditions; Detecting whether there is any modification of the test case during the running of the test script program; When there is a modification of the test case, the corresponding modification information is stored to obtain a temporary file; The test report is composed of the in-the-loop test case report and / or the program error information and / or the temporary file.
Citation Information
Patent Citations
Method and device for generating environment model of automobile controller test
CN104536856A
Pure electric vehicle control unit model in-loop test device and test method thereof
CN105446316A
Electric vehicle controller model in-the-loop test system and method
CN105629960A
Building method and device for controlled object model
CN106444714A
Hardware-in-the-loop test platform for vehicle control unit and method thereof
CN111007840A