Hardware-in-the-loop automatic test system and method for ECU (Electronic Control Unit)
By designing a hardware-in-ring automation test system including computers, CAN communication hardware modules, control interface boxes and ECUs to be tested, the problem of expensive hardware-in-ring testing systems in the prior art is solved, and low-cost, easy to use and efficient automated testing is achieved.
Patent Information
- Application Number
- CN202411640123.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-11
AI Technical Summary
Existing hardware in-ring testing systems are expensive, difficult for beginners to get started, and lack the ways or methods for automated testing.
A hardware-in-loop automation testing system for ECU is designed, including a computer, CAN communication hardware module, control interface box and ECU to be tested. Automatic testing is realized by installing the ECU calibration software to be tested, upper computer observation software, MATLAB and EXCEL.
It realizes a hardware-in-loop testing system that is cheap, easy to get started with for beginners and can realize automated testing, improving testing efficiency and reproducibility.
Smart Images

Figure CN119597650A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of hardware-in-the-loop test systems, and in particular to a hardware-in-the-loop automatic test system and method for an ECU. Background Art
[0002] Hardware-in-the-loop testing is a testing method in which the controller ECU (Electronic Control Unit) under test is a real controller, and the operation means of the controller that interacts with the real controller ECU are all established through simulation. The above method is used to comprehensively test and verify the controller ECU under test. Hardware-in-the-loop testing is widely used in controller development and testing in the fields of automotive electronics, new energy, aerospace, etc.
[0003] The testing of hardware-in-the-loop systems often requires the use of hardware-in-the-loop test cabinets. Although hardware-in-the-loop test cabinets have built-in hardware board resources and test software sources, they are expensive and difficult for novices to use. In addition, some hardware-in-the-loop test systems or methods in the existing technology are low-priced but lack ways or methods for automated testing. Summary of the invention
[0004] In view of the deficiencies in the prior art, the purpose of the present invention is to provide an automotive ECU hardware-in-the-loop automated testing system and a system thereof which is low-cost, easy for novices to use and can realize automated testing.
[0005] The above object of the present invention is achieved through the following technical solutions:
[0006] A hardware-in-the-loop automated test system for an ECU, comprising a computer, a CAN communication hardware module, a control interface box, and an ECU to be tested, which are electrically connected to each other;
[0007] The computer needs to be installed with the ECU calibration software to be tested, host computer observation software, MATLAB and EXCEL;
[0008] ECU calibration software: used to calibrate the input and output signals of the ECU under test;
[0009] Upper computer observation software: used to observe the signals sent and received during the operation of the ECU under test in real time;
[0010] MATLAB: used to build the test environment for the ECU to be tested;
[0011] EXCEL: used to write test cases;
[0012] CAN communication hardware module: used for conversion and transmission and reception of ECU signals to be tested;
[0013] Control interface box: serves as the interface device between the ECU to be tested and the hardware environment.
[0014] In a preferred example, the present invention can be further configured as follows: the construction of the ECU test environment includes interacting with the ECU to be tested, the ECU to be tested directly controlling the model of the controlled object or the running state of the ECU to be tested, and is also used to read various test cases written in EXCEL.
[0015] In a preferred example, the present invention can be further configured as follows: the test case includes input conditions and pass criteria for the test items.
[0016] The invention discloses an ECU hardware-in-the-loop automated testing method, comprising: setting up a software operating environment for the ECU under test, constructing other ECU models that interact with the automobile ECU under test, then debugging the hardware operating environment of the ECU under test and designing test cases for the ECU under test, and finally running the test case of the ECU under test and analyzing the running results.
[0017] In a preferred example, the present invention can be further configured as follows: the main nodes that interact with the vehicle controller in the node simulation model of each ECU of the vehicle include the motor controller, transmission controller, battery management system, DC voltage converter, power steering motor controller, air pump motor controller, gear controller, vehicle instrument unit, and body control unit.
[0018] In a preferred example, the present invention can be further configured as follows: during the debugging process: the connectivity of the hardware input and output interfaces of the ECU under test, verification of the stable output of the power supply interface, the normal communication of the CAN communication interface, the normal operation of the digital input interface, the normal operation of the analog input interface, the matching of the analog output interface with the controller under test, and the matching of the digital output interface with the controller under test.
[0019] In a preferred example, the present invention can be further configured as follows: in the use case design: the written automated test case script is called and run in the operating environment of the programming language, and the test results are automatically filled in after the running is completed.
[0020] In a preferred example, the present invention can be further configured as follows: the operation result analysis: for the items that need to be retested, the signals during the software operation are observed in real time by means of the upper computer observation software built into the computer.
[0021] In summary, the present invention includes at least one of the following beneficial technical effects:
[0022] 1. Based on the hardware-in-the-loop test method, a simple hardware-in-the-loop test system with a price far lower than the market price was designed;
[0023] 2. This method is easy to use, has high testing efficiency, and the testing process is reproducible and recordable;
[0024] 3. The designed "software test environment architecture" is simple to implement, especially the "vehicle dynamics model" simulates the longitudinal model of the vehicle with the help of common dynamic equations in automobile theory, and the "node simulation model of each vehicle ECU" simulates the ECU nodes according to the characteristics of each vehicle component. It is simple to implement and the data is reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the automotive ECU hardware-in-the-loop automated testing system in this technical solution;
[0026] Figure 2 This is a schematic diagram of the automotive ECU hardware-in-the-loop automated testing process in this technical solution;
[0027] Figure 3 It is a schematic diagram of the software testing environment architecture in this technical solution;
[0028] Figure 4 This is a schematic diagram of the automated test case template table of this technical solution;
[0029] Figure 5 It is a tabular diagram of the test results after the technical solution is completed. DETAILED DESCRIPTION
[0030] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0031] like Figure 1 As shown, a hardware-in-the-loop automated testing system for an ECU disclosed in the present technical solution is composed of a computer, a CAN communication hardware module, a control interface box, and an ECU to be tested.
[0032] The computer needs to be installed with the ECU calibration software to be tested, host computer observation software, MATLAB and EXCEL.
[0033] The ECU calibration software is used to calibrate the input and output signals of the ECU under test.
[0034] The host computer observation software is used to observe the signals sent and received during the operation of the ECU under test in real time.
[0035] MATALB is used to build the test environment of the ECU under test, including interaction with the ECU under test, the model of the controlled object directly controlled by the ECU under test, or a certain working condition of the ECU under test. It is also used to read various test cases written in EXCEL.
[0036] EXCEL is used to write test cases, which mainly include input conditions and passing criteria for a test item.
[0037] The above software can be used for operation on a computer. Standard settings can be made through MATALB and EXCEL to adapt to different construction environments and improve the applicability of the device. At the same time, the results can be clearly displayed in EXCEL, including screening, and the data you want to see can be obtained.
[0038] The CAN communication hardware module is used to convert the CAN signals that the computer simulates and needs to receive from the ECU under test into real-time signals, and on the other hand, it is used to receive and forward the CAN signals sent by the ECU under test to the computer's built environment model and the test software for automated operation. Compared with other methods, the use of CAN communication hardware can achieve the goals of information sharing, reducing wiring, reducing costs, and improving overall reliability. For example, the CAN monitoring and calibration equipment available for the CAN communication hardware module include CANape, Kvaser, etc.
[0039] The control interface box serves as an interface device between the ECU to be tested and the hardware environment. The CAN communication interface of the control interface box is connected to the ECU to be tested and the CAN communication hardware module respectively to ensure the smooth operation of the CAN network; the analog input interface and digital input interface of the control interface box are hard-wired to the analog output interface and digital output interface of the ECU to be tested; the digital output interface and analog output interface of the control interface box are hard-wired to the analog input interface and digital input interface of the ECU to be tested; the power supply interface of the control interface box is connected to an external 220V power supply, and can output two types of DC power supplies, DC12V and DC24V, which can be used by ECUs to be tested with different power supply interfaces, thus improving the applicability of the device.
[0040] Based on the above device, a hardware-in-the-loop automated testing method for ECU is provided, and the process is as follows: Figure 2 As shown, the following steps are included:
[0041] The first step of the automotive ECU hardware-in-the-loop automated testing process is to build the software operating environment of the ECU under test. Usually, it is necessary to build models of other ECUs that interact with the automotive ECU under test. For example, in MATLAB, according to the following Figure 3 The architecture shown builds a software test environment for the vehicle controller of a commercial vehicle. In the "Vehicle Dynamics Model", the vehicle dynamics model is built according to the vehicle dynamics equation (the equation is shown below), where m is the total mass of the vehicle T mot is the output torque of the driving motor, i 0 is the main reduction ratio of the drive axle, i g is the gearbox ratio, η Tis the vehicle powertrain efficiency, R is the tire radius, m is the total mass of the vehicle, g is the acceleration of gravity, f is the rolling resistance coefficient, α is the slope angle of the road on which the vehicle is traveling, V is the speed of the vehicle, and C D is the air resistance coefficient, A is the frontal area of the vehicle, and δ is the vehicle rotation mass conversion coefficient.
[0042]
[0043] In the "node simulation model of each vehicle ECU", the main nodes that interact with the vehicle controller include the motor controller MCU, the transmission controller TCU, the battery management system BMS, the 24V DC voltage converter DCDC, the power steering motor controller DCACS, the air pump motor controller DCACB, the gear controller SLU, the vehicle instrument unit IC, the body control unit BCM, etc.
[0044] The "vehicle dynamics model" simulates the longitudinal model of the vehicle with the help of common dynamic equations in automobile theory, and the "node simulation model of each vehicle ECU" simulates the ECU nodes according to the characteristics of each vehicle component. This method is simple to implement and the data is reliable.
[0045] In the "CAN interface processing model", the signals of each ECU node are packaged according to the vehicle's network topology and the CAN bus DBC data file, and sent in the form of messages. The message signals received through the bus are unpacked according to the vehicle's network topology and the CAN bus DBC data file, and distributed to the "vehicle dynamics model" and "node simulation model of each vehicle ECU" in the form of signals.
[0046] The second step of the automotive ECU hardware-in-the-loop automated testing process is to debug the hardware operating environment of the ECU under test. The connectivity of the hardware input and output interfaces of the ECU under test is the key to ensuring the operation of the entire test system. At this stage, on the one hand, it is necessary to verify the stable output of the power supply interface, the normal communication of the CAN communication interface, the normal operation of the digital input interface, the normal operation of the analog input interface, the matching of the analog output interface with the controller under test, and the matching of the digital output interface with the controller under test; on the other hand, the test of the analog and digital input interfaces of the ECU under test can be carried out at this stage. Subsequent other functional tests involve the setting of analog and digital input signals, which are automatically given through the calibration signal of the ECU under test. For example, to test the motor drive torque calculation function of a commercial vehicle vehicle controller, the analog signal of the accelerator pedal sensor is required. At this stage, the interface between the accelerator pedal and the vehicle controller can be tested first. In subsequent tests, the accelerator pedal signal will bypass the external analog signal of the vehicle controller, and the signal will be directly given by the calibration signal of the automated control accelerator pedal.
[0047] The third step of the automotive ECU hardware-in-the-loop automated testing process is to design test cases for the ECU under test. Test case design for the ECU under test is an important part of the automotive ECU hardware-in-the-loop automated testing process. Figure 4 This is a sample template for a test case. Figure 4 The template shown uses programming languages (Python or MATLAB's M language, etc.) to write automated execution scripts for test cases. The serial number 0 indicates that the listed input conditions are common preconditions for testing; serial numbers 1-3 indicate different signal types, and different functions are called according to different signal types to set the signals in the input condition column according to the input values. The setting process sets the corresponding waiting time according to the actual state of the signal; 1 in the test phenomenon column indicates the expected test result predicted based on the input conditions; the output signal is the name of the output signal of the ECU to be tested after executing the test steps; and the test expected value is the expected test result value of the output signal.
[0048] The fourth step of the automotive ECU hardware-in-the-loop automated testing process is to run the test case of the ECU under test. In the operating environment of the programming language, call the written automated test case script and run it. After the running is completed, the test results are displayed in Figure 5 The result is automatically filled in. If the test result is consistent with the expected result, the script execution will fill in "Pass", otherwise it will fill in "NotPass".
[0049] The fifth step of the automotive ECU hardware-in-the-loop automated testing process is to analyze the test results of the ECU under test. After the test case is executed, the test results are analyzed. For items that need to be retested, the Figure 1 The built-in host observation software of the "Automotive ECU Hardware-in-the-Loop Automated Test System" computer observes the signals in real time during the software operation.
[0050] The above five steps provide an automated testing method that is easy to use, has high testing efficiency, and the testing process is reproducible and easy to record.
[0051] The embodiments of this specific implementation method are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, all equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A hardware-in-the-loop automated test system for an ECU, comprising a computer, characterized in that: It also includes a CAN communication hardware module, a control interface box, and an ECU to be tested, which are electrically connected to each other; The computer needs to be installed with the ECU calibration software to be tested, host computer observation software, MATLAB and EXCEL; ECU calibration software: used to calibrate the input and output signals of the ECU under test; Upper computer observation software: used to observe the signals sent and received during the operation of the ECU under test in real time; MATLAB: used to build the test environment for the ECU to be tested; EXCEL: used to write test cases; CAN communication hardware module: used for conversion and transmission and reception of ECU signals to be tested; Control interface box: serves as the interface device between the ECU to be tested and the hardware environment.
2. The hardware-in-the-loop automated testing system for an ECU according to claim 1, characterized in that: The construction of the ECU test environment includes interaction with the ECU to be tested, the model of the controlled object directly controlled by the ECU to be tested or the running status of the ECU to be tested, and is also used to read various test cases written in EXCEL.
3. The hardware-in-the-loop automated testing system for an ECU according to claim 1, characterized in that: The test case includes input conditions for the test item and a passing criterion.
4. A hardware-in-the-loop automated testing method for an ECU for the above test, characterized in that: include: Build the software operating environment of the ECU under test, construct other ECU models that interact with the automotive ECU under test, then debug the hardware operating environment of the ECU under test and design test cases for the ECU under test, and finally run the test of the ECU under test and analyze the running results.
5. The hardware-in-the-loop automated testing method for an ECU according to claim 4, characterized in that: In the node simulation model of each vehicle ECU, the main nodes that interact with the vehicle controller include the motor controller, transmission controller, battery management system, DC voltage converter, power steering motor controller, air pump motor controller, gear controller, vehicle instrument unit, and body control unit.
6. The hardware-in-the-loop automated testing method for an ECU according to claim 4, characterized in that: During the debugging process: the connectivity of the hardware input and output interfaces of the ECU under test, verification of the stable output of the power supply interface, the normal communication of the CAN communication interface, the normal operation of the digital input interface, the normal operation of the analog input interface, the matching of the analog output interface with the controller under test, and the matching of the digital output interface with the controller under test.
7. The hardware-in-the-loop automated testing method for an ECU according to claim 4, characterized in that: In the use case design: the written automated test case script is called and run in the operating environment of the programming language, and the test results are automatically filled in after the running is completed.
8. The hardware-in-the-loop automated testing method for an ECU according to claim 4, characterized in that: The analysis of the operation results: for the items that need to be retested, the built-in host observation software of the computer is used to perform real-time observation of the signals during the software operation.