In the automotive electronics development industry, the software development V-model derived from ISO26262 is increasingly accepted by developers. A crucial part of the V-model is HIL (Hardware-in-the-Loop) testing. Depending on the specific product form, the specifics of the V-model may vary, but it generally follows the overall process of requirements, design, and verification. For the battery management system (hereinafter referred to as BMS) in electric vehicles, there are characteristics specific to its field, including battery characteristics and high-voltage characteristics, which pose challenges for BMS development verification. The BMS HIL testing platform provides convenience for development verification.
The BMS HIL testing equipment can support the verification of BMS algorithms, fault handling strategy verification, and preliminary calibration parameter matching, ensuring the software quality and functionality of the BMS. HIL operates by using a real-time processor to run simulation models that simulate the operating state of the controlled object, connecting various boards to the object under test. As a BMS HIL, specific hardware resources are also needed, including real high-voltage sources, current sources, and battery cell voltage simulation boards. These will provide the necessary support for building a complete closed-loop system. The complete composition of the BMS HIL testing environment includes: hardware platform, real-time software, test management software, and the object under test (BMS). The composition diagram is as follows:
The HIL testing implementation process mainly includes: hardware platform construction, real-time software development, test management software development, testing verification, and automated testing implementation.
1. Hardware Platform Construction
The hardware platform of BMS HIL is the foundation of the entire system, including real-time processors, IO interface boards, fault injection modules, communication modules, signal conditioning modules, programmable power supplies, cabinets, distribution boxes, and other general modules, as well as BMS-related high-voltage sources, current sources, battery cell voltage simulation sources, and insulation resistance simulation boards.
The design of the high-voltage source must match the insulation circuit to ensure the implementation of insulation resistance simulation. Meanwhile, it is recommended to use devices that can operate bidirectionally for the current source, meeting the system’s current range requirements. In high-voltage circuit design, it should be isolated from the low-voltage part, and the device itself should have insulation monitoring capabilities to prevent high-voltage short circuits.
Ultimately, the hardware platform integrates the above modules into a complete cabinet, forming the testing equipment, ensuring that the connections between various modules meet design requirements and that each interface meets the functional requirements of the object under test (BMS).
2. Real-Time Software Development
The real-time software development for BMS HIL refers to the development of software running on the real-time processor to match the functional requirements of the object under test. The real-time software model includes the following two aspects:
-
Industry general models: including motor models, battery models, engine models, transmission system models, driver models, etc., which can be purchased commercially or developed in-house;
Among them, the model parts related to battery characteristics are set based on actual battery parameters, maximizing the restoration of battery characteristics, providing a better external simulation environment for the BMS.
-
Functional modules related to specific vehicle functions: such as vehicle charging and discharging processes, fault settings, and data acquisition accuracy. Software development and design need to be carried out based on specific project requirements.
Currently, the mainstream implementation method for HIL real-time software is Simulink model development, with testing software supporting executable files generated by Simulink. This allows for model-based development, avoiding issues related to manual C coding cycles and code quality.
3. Test Management Software Development
The test management software in HIL is the upper-level control interface for the entire equipment, serving as the specific tool for human-computer interaction with the testers.
The test management software has the following functions: hardware configuration management, real-time software Simulink model interface, creating a visual user interface, controlling HIL devices to perform actions, recording data, analyzing data, and generating reports. Most of these functions are inherent to the testing software itself, while some aspects require analysis based on actual projects and specific development matching.
The development of test management software mainly involves matching the project and implementing application functions. The test management software needs to customize the operation interface based on usage habits and functional characteristics.
4. Testing Verification
Once the hardware platform construction, real-time software development, and test management software development are completed, the HIL device needs to be verified. This includes open-loop verification and closed-loop verification.
Open-loop verification mainly refers to using the test management software to adjust the interface definitions of the real-time software, verifying the channel status of the HIL hardware, with the aim of verifying the controllability of the entire system hardware and the matching effect of the hardware-software interface.
Closed-loop verification mainly forms a closed loop between the HIL device and the object under test, verifying the functional items of the object under test to prove the integrity and correctness of the HIL testing environment. The aim is to verify the functional control effect of the entire system.
5. Automated Testing Implementation
After completing the hardware platform construction, real-time software development, test management software development, and testing verification, the HIL testing environment can match all functions of the object under test. The next step is to build an automated testing sequence to implement HIL automated testing.
The implementation of automated testing is achieved by designing manual testing steps into a predetermined sequence for automatic execution, using professional automated testing software to execute each operation step in order. Additionally, after execution, the expected results can be checked. Different automated testing software interfaces may vary, but the core working method is consistent, requiring the automation of manual testing while matching actual project engineering.
Automated testing mainly aims to save time, avoid irregular manual operations, and automatically determine results through the automation of the testing process. Building an automated sequence can be quite challenging in terms of resource investment and development cycles. However, the benefits are evident; once an automated testing platform is established, it can lead to rapid iterations and optimizations, significantly accelerating product development. The automation of HIL testing also reduces the potential for errors introduced by human factors during testing.
In the overall development process of the BMS controller, HIL testing is an important verification step. Its significance lies in providing a more realistic and comprehensive testing environment for the object under test. The more complete the HIL environment is and the higher the testing coverage, the better the product quality. However, it is important to note that the essence of HIL testing is still to serve the object under test; constructing a testing environment that exceeds the product range or performance is unnecessary and should start from the product definition, rather than being overly complex.
HIL testing balances system integrity, authenticity, and operational feasibility, allowing potential functional logic issues of the controller in vehicles to be tested in advance, greatly improving the efficiency of software development and testing.