Test method, apparatus, device, and storage medium
By acquiring a traceability matrix and developing a MATLAB model, combined with Simulink and HIL testing, the testing method for the body controller was optimized, solving the problem of insufficient robustness in body controller testing and achieving more efficient functional testing and design defect discovery.
Patent Information
- Application Number
- CN202411066234.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2044-08-05
AI Technical Summary
The body controller has low robustness in testing, making it difficult to fully test its performance during the development phase.
By obtaining the traceability matrix, a control strategy model is established based on MATLAB, and C code is automatically generated using Simulink development algorithms. SIL and HIL script tests are then performed to optimize the control strategy model and improve test robustness.
It improves the test robustness of the body controller, enhances the coverage and efficiency of functional testing, and enables timely detection of design defects and verification of functional requirements.
Smart Images

Figure CN119045450B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of vehicle testing, and in particular, to a testing method, device, equipment and storage medium. BACKGROUND
[0002] With the development of automotive electronics technology, the body controller has become a standard component of automobiles.
[0003] In the related art, a virtual vehicle environment is established to simulate various driving conditions of the vehicle, which enables automobile manufacturers to comprehensively detect various performances of the automobile in the development stage. However, in the above related art, the test robustness of the body controller is low. SUMMARY
[0004] Embodiments of the present application provide a testing method, device, equipment and storage medium, which can improve the test robustness of the body controller. The technical solutions provided by embodiments of the present application are as follows:
[0005] According to an aspect of an embodiment of the present application, a testing method is provided, and the method comprises:
[0006] obtaining a traceability matrix, the traceability matrix being used for developing an application program, the application program being used for tracking functional test requirements of the body controller;
[0007] establishing a control strategy model based on MATLAB;
[0008] performing functional test on the body controller based on the traceability matrix and the control strategy model.
[0009] In some embodiments, the traceability matrix belongs to a phenotype document, and the phenotype document stores a corresponding relationship between at least one group of requirements and test cases.
[0010] In some embodiments, the traceability matrix includes a forward traceability matrix, a backward traceability matrix and a bidirectional traceability matrix; wherein,
[0011] the forward traceability matrix is used for correct execution of requirements of each enterprise in the application program;
[0012] the backward traceability matrix is used for checking whether to increase product space;
[0013] the bidirectional traceability matrix is used for executing all requirements in test cases, and for evaluating modification of requirements caused by errors in the application program.
[0014] In some embodiments, the method further comprises:
[0015] The algorithm developed by Simulink generates corresponding C code automatically;
[0016] The SIL (Software In The Loop) test is used to test the consistency between the C code and the algorithm, and a test result is obtained;
[0017] Based on the test result, the control strategy model is optimized to obtain an optimized control strategy model.
[0018] In some embodiments, the function test of the body controller based on the traceability matrix and the control strategy model comprises:
[0019] The optimized control strategy model is written to the HIL (Hardware In The Loop) bench of the body controller to perform HIL script testing.
[0020] According to an aspect of an embodiment of the present application, a testing device is provided, which comprises:
[0021] A matrix acquisition module is configured to acquire a traceability matrix, which is used to develop an application program for tracking the function test requirements of a body controller;
[0022] A model establishment module is configured to establish a control strategy model based on MATLAB;
[0023] A function test module is configured to perform a function test of the body controller based on the traceability matrix and the control strategy model.
[0024] In some embodiments, the traceability matrix belongs to a phenotype document, which stores a corresponding relationship between at least one group of requirements and test cases.
[0025] In some embodiments, the traceability matrix comprises a forward traceability matrix, a backward traceability matrix, and a bidirectional traceability matrix; wherein,
[0026] The forward traceability matrix is used to ensure that the requirements of each enterprise are correctly executed in the application program;
[0027] The backward traceability matrix is used to check whether the product space is increased;
[0028] The bidirectional traceability matrix is used to execute all requirements in the test cases, and to evaluate the modification of requirements caused by errors in the application program.
[0029] In some embodiments, the device further comprises:
[0030] a code generation module configured to automatically generate corresponding C code from the algorithm developed by Simulink;
[0031] a test module configured to perform consistency test on the C code and the algorithm by SIL test, and obtain a test result;
[0032] a model optimization module configured to optimize the control strategy model based on the test result, and obtain an optimized control strategy model.
[0033] In some embodiments, the function test module is configured to write the optimized control strategy model to a HIL bench of the body controller, and perform HIL script test.
[0034] According to an aspect of the embodiments of the present application, a computer device is provided, which comprises a processor and a memory, and the memory stores a computer program, which is loaded and executed by the processor to implement the above test method.
[0035] According to an aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program is loaded and executed by a processor to implement the above test method.
[0036] According to an aspect of the embodiments of the present application, a computer program product is provided, which is loaded and executed by a processor to implement the above test method.
[0037] The technical solutions provided by the embodiments of the present application can have the following beneficial effects:
[0038] The function test on the body controller based on the traceability matrix improves the robustness of the test on the body controller.
[0039] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0041] Figure 1 is a flowchart of the test method provided by an embodiment of the present application;
[0042] Figure 2 is a schematic diagram of a traceability matrix provided by an embodiment of the present application;
[0043] Figure 3 is a schematic diagram of a bidirectional traceability matrix provided by an embodiment of the present application;
[0044] Figure 4 is a schematic diagram of consistency verification provided by an embodiment of the present application;
[0045] Figure 5 is a block diagram of a test device provided by an embodiment of the present application;
[0046] Figure 6 is a block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0047] The exemplary embodiments will be described in detail herein with reference to the attached drawings. When the description below refers to accompanying drawings, unless otherwise stated, the same numbers in different drawings refer to the same or similar elements. The implementations described in the following exemplary embodiments are not meant to represent all implementations consistent with the present application. Rather, they are merely examples that can be consistent with some aspects of the present application as detailed in the appended claims.
[0048] The execution subject of each step of the method provided by the embodiments of the present application can be a computer device, which refers to an electronic device with data calculation, processing and storage capabilities. The computer device can be a terminal such as a PC (Personal Computer), a tablet computer, a smart phone, a wearable device, a smart robot, etc.; or a server. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0049] The technical solutions of the present application will be described below through several embodiments.
[0050] Reference is made to Figure 1 , which shows a flowchart of a test method provided by an embodiment of the present application. In this embodiment, the method is mainly exemplified by being applied to the computer device introduced above. The method can include at least one of the following steps (110-130).
[0051] In step 110, a traceability matrix is acquired. The traceability matrix is used for developing an application program, and the application program is used for tracking the functional test requirements of the body controller.
[0052] In some embodiments, the function test of the body controller can be a HIL test. The HIL test is a test method centered on real-time simulation. By establishing a virtual vehicle environment around the controller, various working conditions of vehicle driving are simulated. This enables automobile manufacturers to comprehensively detect various performances of automobiles (such as new energy vehicles) in the development stage, and provide a reference for subsequent product optimization. The HIL test scheme usually includes the construction of hardware platform and software platform. The hardware platform is mainly used to build a complete and reliable electrical system architecture, and the constituent elements mainly include a cabinet, a camera test dark box, a high-performance workstation, a real-time system, a communication board, a driving simulator, a router and a display, etc. The software platform is mainly responsible for model construction and simulation, as well as data collection and analysis.
[0053] To improve the convenience and safety of the use of automobiles, more and more automobiles nowadays are equipped with a central control door lock system, referred to as a central control door lock system. The central control door lock system includes a door lock mechanism, a control switch, a remote controller, a receiver antenna, a control unit and the like, and the organic combination of these components forms a complete central control door lock system, thereby realizing the functions of the vehicle central control lock system. The functions of the vehicle central control lock system can be realized by a body controller. The body controller mainly controls the modules of vehicle lights, wiper washing, vehicle windows, central control lock and anti-theft alarm, and the reliability of the functions and performance of the body controller has a significant impact on the safety, comfort, drivability and steering of the automobile. The present application takes the body controller as an example to design and optimize the model building and function test of the body controller.
[0054] In some embodiments, a traceability matrix belongs to a phenotypic document that stores a correspondence between at least one set of requirements and test cases. In some embodiments, the traceability matrix is a phenotypic document that can be referred to as an RTM (Release To Manufacturing) document used to develop a software application to track requirements. As shown in Figure 2 the traceability matrix can be used to track forward (from requirements to design or coding) and backward (from coding to requirements). The traceability matrix is also referred to as a requirement traceability matrix or a cross-reference matrix (CRM (Customer Relationship Management)). The traceability matrix is prepared before the test execution process to ensure that each requirement is covered in the form of a test case, thereby ensuring that no test is missed. In the RTM document, we map all requirements and corresponding test cases to ensure that we have written all test cases for each condition.
[0055] In some embodiments, Table 1 below shows a traceability matrix. In Table 1 below, requirement numbers 2 and 4 test case names are not mentioned in order to write test cases.
[0056] Table 1
[0057] Requirement Number Test Case Name 1 xxx 2 xxx 3 xxx 4 xxx 5 xxx 6 xxx 7 xxx 8 xxx
[0058] In some embodiments, the traceability matrix includes a forward traceability matrix, a backward traceability matrix, and a bidirectional traceability matrix; wherein the forward traceability matrix is used to check whether the requirements of each enterprise are correctly implemented in the application; the backward traceability matrix is used to check whether the product space is increased; and the bidirectional traceability matrix is used to implement all requirements in the test cases, and to evaluate the modification of the requirements due to errors in the application.
[0059] In some embodiments, the traceability matrix can be divided into three different types, namely forward traceability, backward traceability matrix (also referred to as reverse traceability matrix), and bidirectional traceability matrix. The forward traceability matrix is used to ensure that the requirements or requirements of each enterprise are correctly implemented in the application and are strictly tested. The main purpose of this is to verify whether the product development is moving in the right direction. In this case, the requirements are mapped to the forward direction of the test cases. The reverse traceability matrix or backward traceability matrix is used to check whether the product space is increased by enhancing design elements, code, test business requirements, and other things not mentioned. Its main goal is to keep the existing project on the right track. In this case, the requirements are mapped to the backward direction of the test cases. The bidirectional traceability matrix is a combination of forward and backward traceability matrices, and is used to ensure that all business requirements are implemented in the test cases. As shown in Figure 3 the bidirectional traceability matrix is also used to evaluate the modification of the requirements due to errors in the application.
[0060] Step 120, a control strategy model is established based on MATLAB.
[0061] In some embodiments, the control strategy model is the focus of the development work of the body controller. In some embodiments, based on MATLAB modeling development, the Stateflow graphical model is used to express complex control logic, Simulink is used to simulate and test the control strategy model, the correctness of the control logic is verified, SIL test verifies the reliability of the automatically generated code, and the development cycle is shortened.
[0062] Step 130, based on the traceability matrix and the control strategy model, a function test is performed on the body controller.
[0063] In some embodiments, the function test is an indispensable part of the development process of the body controller, and a HIL function test platform is built based on the VTSystem simulation system. The body controller is functionally tested through manual testing by the host computer software CANoe and automatic testing by TTAF, to ensure that the body controller functions normally.
[0064] To sum up, in the technical scheme provided by the embodiments of the present application, the function test of the body controller based on the traceability matrix improves the robustness of the test of the body controller.
[0065] In the embodiments of the present application, in order to improve the efficiency and coverage rate of the function test of the body controller, according to the hardware-in-the-loop test requirements, a reasonable test method is used to write the body central locking function test case. The test case provides a basis for the body central locking function test, can timely find design defects, and effectively verify the function requirements of the body controller.
[0066] In some possible implementation manners, the test method can further include the following steps:
[0067] 1. Automatically generating corresponding C code from the algorithm developed in Simulink;
[0068] 2. Using SIL testing to test the consistency of the C code and the algorithm, to obtain a test result;
[0069] 3. Optimizing the control strategy model based on the test result, to obtain an optimized control strategy model.
[0070] In some embodiments, the algorithm developed in Simulink is automatically generated as C code (i.e., code represented by C language). However, due to the reasons of the code automatic generation tool itself or incorrect setting of the code generation tool or other unknown reasons, the automatic generation of code may introduce some errors. Therefore, it is necessary to verify the consistency of the automatically generated code and the algorithm model, which is the SIL testing. The SIL testing simulates various sensor signals required by the controller by running the model in the system environment and the I / O (Input / Output) model in the virtual ECU (Electronic Control Unit), and can receive the signals of the bench sensor and the control signals sent by the virtual ECU, so as to be connected with the code information (including basic software and hardware parameters, etc.) of the virtual ECU to be tested and the system environment model, and finally realize closed-loop simulation for testing and verifying the control system. The SIL testing uses the same test cases as the MIL (Model In The Loop), and checks whether the output is consistent with that in the MIL stage for the same test cases. In some embodiments, for example,Figure 4 As shown, for the efficiency of the test, the controlled object model is not connected, but the same input is applied to the algorithm model and the generated code to see if the output is consistent.
[0071] In some embodiments, in the SIL test, the model in the MIL test is replaced by the executable object code of the corresponding automatically generated software. The automatic code generator, usually based on standardized modeling guidelines, and can help system engineers use the functions of the modeling language. The modeling and simulation tool environment provides a pre-test step to implement the generation of source code from the model, and the software architecture of the model will determine the modularization, data structure and the size of the generated source code. Then, the system compiles the source code of the simulation environment of the underlying host PC and automatically generates the code required for SIL testing, uses the same test case input as the MIL test, and records the value of the test output, and finally compares whether the output is consistent with the MIL test output. The MIL performs these basic calculations using floating-point arithmetic, using tool-specific libraries that provide the necessary functions and calculations for the basic model blocks. However, the SIL test uses actual code to perform calculations in fixed-point, which reflects the actual calculations that will be performed in the final target system. Not all tools provide fixed-point execution in SIL. This approach can detect the occurrence of any possible overflow and division by zero faults due to inappropriate design choices for variable data sizes. Through SIL testing, the error caused by code compilation can be greatly reduced, and the error probability of the model can also be reduced, and a series of pre-checks are made for the subsequent HIL test.
[0072] In some embodiments, based on the traceability matrix and the control strategy model, a function test is performed on the body controller, including: writing the optimized control strategy model to the HIL bench of the body controller to perform HIL script testing.
[0073] In some embodiments, after obtaining the bidirectional traceability matrix, the optimized control strategy model in the above is written to the HIL bench to perform HIL script testing. First, manual simulation is realized through CAN (Controller Area Network bus) in CANoe (CAN open environment, a bus development environment) and Ethernet to observe the output voltage, duty cycle and various related output signals, and to write HIL test cases according to the specific situation. In some embodiments, through CAN channel simulation, the brake signal output is controlled through the VT (Virtualization Technology) board card, the operation of loosening the brake is simulated, then through ETH simulation, the power supply is set to OFF (off) gear, at this time, through the VT board card, the lock state is set to the unlocked state, and after all the preconditions are executed, the NFC (Near Field Communication) card is simulated. CAN signal, four doors on the bench are locked. Similarly, when the NFC is unlocked, all the preconditions remain unchanged, the lock state is changed to locked, and the same NFC signal is sent to realize the unlocking of the four doors of the whole vehicle. The precondition for unlocking the large screen is non-protected, and the four doors are closed. Therefore, the four door board card signals on the board card are set to closed, and the bench is set to the un-protected state.
[0074] In the above implementation mode, by combining the traceability matrix and applying the traceability matrix to the test process of the HIL, the coverage rate of the overall model test is improved, the recognition degree of the product to the model is met, and it is a feasible scheme which is relatively easy to implement and high in efficiency.
[0075] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, please refer to the method embodiments of the present application.
[0076] Please refer to Figure 5 which shows a block diagram of a test device provided by an embodiment of the present application. The device has the functions of implementing the above test method examples, which can be implemented by hardware or corresponding software executed by hardware. The device can be the computer device introduced above or can be arranged on the computer device. The device 500 can include a matrix acquisition module 510, a model establishment module 520 and a function test module 530.
[0077] The matrix acquisition module 510 is configured to acquire a traceability matrix, and the traceability matrix is used to develop an application program, and the application program is used to track the function test requirements of a body controller.
[0078] The model establishing module 520 is configured to establish a control strategy model based on MATLAB.
[0079] The function test module 530 is configured to perform function test on the body controller based on the traceability matrix and the control strategy model.
[0080] In some embodiments, the traceability matrix belongs to a phenotype document, and the phenotype document stores a correspondence between at least one group of requirements and test cases.
[0081] In some embodiments, the traceability matrix includes a forward traceability matrix, a backward traceability matrix, and a bidirectional traceability matrix.
[0082] The forward traceability matrix is configured to check whether requirements of each enterprise are correctly implemented in the application.
[0083] The backward traceability matrix is configured to check whether product space is increased.
[0084] The bidirectional traceability matrix is configured to implement all requirements in test cases and to evaluate modification of requirements caused by errors in the application.
[0085] In some embodiments, the device 500 further includes a code generation module, a test module, and a model optimization module.
[0086] The code generation module is configured to automatically generate corresponding C code from an algorithm developed by Simulink.
[0087] The test module is configured to perform consistency test on the C code and the algorithm by SIL test to obtain a test result.
[0088] The model optimization module is configured to optimize the control strategy model based on the test result to obtain an optimized control strategy model.
[0089] In some embodiments, the function test module 530 is configured to write the optimized control strategy model to a HIL bench of the body controller to perform HIL script test.
[0090] In summary, the technical scheme provided by the embodiments of the present application improves the robustness of the test on the body controller by performing function test on the body controller based on the traceability matrix.
[0091] In the embodiments of the present application, in order to improve the efficiency and coverage of the body controller function test, according to the requirements of hardware-in-the-loop test, a reasonable test method is used to write a body central locking function test case. The test case provides a basis for the body central locking function test, can discover design defects in time, and effectively verifies the function requirements of the body controller.
[0092] It should be noted that the device provided in the above embodiments is only exemplified by the division of the above functional modules when implementing its functions. In actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be described here.
[0093] Please refer to Figure 6 which shows a structural block diagram of a computer device provided in an embodiment of the present application. The computer device is used to implement the test method provided in the above embodiments. Specifically:
[0094] The computer device 600 includes a CPU (Central Processing Unit) 601, a system memory 604 including a RAM (Random Access Memory) 602 and a ROM (Read-Only Memory) 603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The computer device 600 also includes a basic I / O system 606 to help transfer information between various devices in the computer, and a mass storage device 607 for storing an operating system 613, application programs 614 and other program modules 615.
[0095] The basic input / output system 606 includes a display 608 for displaying information and an input device 609 such as a mouse, keyboard, etc. for user input. The display 608 and the input device 609 are both connected to the central processing unit 601 through the input / output controller 610 connected to the system bus 605. The basic input / output system 606 can also include an input / output controller 610 for receiving and processing input from a keyboard, mouse, or electronic stylus, and other devices. Similarly, the input / output controller 610 also provides output to the display screen, printer, or other types of output devices.
[0096] The mass storage device 607 is connected to the central processing unit 601 through a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer readable medium provide nonvolatile storage for the computer device 600. That is, the mass storage device 607 can include a computer readable medium (not shown) such as a hard drive or a CD-ROM drive, among others.
[0097] In the interest of not unduly delaying this written description, no attempt is made to describe more than the most basic and elementary computer circuits and systems that can be employed to carry out the testing method. One of ordinary skill in the art will readily recognize a wide variety of ways that the described testing method can be implemented, and therefore the testing method is not limited to the embodiments described.
[0098] According to various embodiments of the present application, the computer device 600 can also operate in a networking environment via the network 612 and via the network interface 611 that connects to the system bus 605. By way of example, the computer device 600 can be connected to the network 612 through the network interface 611, or can be connected to another type of network or remote computer system (not shown) via the network interface 611.
[0099] In an exemplary embodiment, there is also provided a computer readable storage medium having stored therein a computer program, which, when executed by a processor, implements the testing method.
[0100] In an exemplary embodiment, there is also provided a computer program product, which is loaded and executed by a processor to implement the testing method.
[0101] It should be understood that the "multiple" mentioned herein refers to two or more than two. The "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents that the associated objects before and after it are in an "or" relationship.
[0102] The above only describes exemplary embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A test method characterized by, The method comprises: obtaining a traceability matrix, the traceability matrix being used for developing an application program for tracking functional test requirements of a body controller; the traceability matrix belongs to a phenotype document, the phenotype document storing a correspondence between at least one group of requirements and test cases, the traceability matrix including a forward traceability matrix, a backward traceability matrix, and a bidirectional traceability matrix; wherein the forward traceability matrix is used for correct execution of requirements of each enterprise in the application program; the backward traceability matrix is used for checking whether product space is increased; and the bidirectional traceability matrix is used for executing all requirements in test cases and for evaluating modification of requirements caused by errors in the application program; establishing a control strategy model based on MATLAB; performing functional test on the body controller based on the traceability matrix and the control strategy model.
2. The method of claim 1, wherein, The method further comprises: generating corresponding C code automatically by using an algorithm developed by Simulink; performing consistency test on the C code and the algorithm by using SIL test to obtain a test result; optimizing the control strategy model based on the test result to obtain an optimized control strategy model.
3. The method of claim 2, wherein, The functional test on the body controller based on the traceability matrix and the control strategy model comprises: writing the optimized control strategy model to an HIL bench of the body controller to perform HIL script test.
4. A test device characterized by, The device comprises: a matrix obtaining module configured to obtain a traceability matrix, the traceability matrix being used for developing an application program for tracking functional test requirements of a body controller; the traceability matrix belongs to a phenotype document, the phenotype document storing a correspondence between at least one group of requirements and test cases, the traceability matrix including a forward traceability matrix, a backward traceability matrix, and a bidirectional traceability matrix; wherein the forward traceability matrix is used for correct execution of requirements of each enterprise in the application program; the backward traceability matrix is used for checking whether product space is increased; and the bidirectional traceability matrix is used for executing all requirements in test cases and for evaluating modification of requirements caused by errors in the application program; a model establishing module configured to establish a control strategy model based on MATLAB; a functional test module configured to perform functional test on the body controller based on the traceability matrix and the control strategy model.
5. The apparatus of claim 4, wherein, The device further comprises: a code generating module configured to generate corresponding C code automatically by using an algorithm developed by Simulink; a test module configured to perform consistency test on the C code and the algorithm by using SIL test to obtain a test result; a model optimizing module configured to optimize the control strategy model based on the test result to obtain an optimized control strategy model.
6. A computer device, comprising: The computer device comprises a processor and a memory, and the memory stores a computer program, which is loaded and executed by the processor to realize the test method of any one of claims 1 to 3.
7. A computer readable storage medium characterized in that, The computer readable storage medium stores a computer program, which is loaded and executed by the processor to realize the test method of any one of claims 1 to 3.
8. A computer program product, characterised in that, The computer program product is loaded and executed by the processor to realize the test method of any one of claims 1 to 3.
Citation Information
Patent Citations
Traceable link recovery model training data enhancement method based on unmarked data
CN115408041A
Automatic testing method, device and equipment based on vehicle body controller and medium
CN116383086A