Hardware-in-the-loop (HIL) is a technique that allows testing embedded controllers without the physical plant. In the case of a Battery Management System (BMS), the real-time system emulates the behavior of the battery cells. By being connected to a real-time system, the BMS "thinks" that it has been connected to real battery cells. This allows testing the BMS controls in a safe environment, and in various scenarios, without the risk of damaging the battery cells.
There are several real world behaviors that cannot be easily simulated without having the hardware connected, e.g.: electric noise, short-circuits, wiring and connections, wrong/mismatching bitrates and timing for communication interfaces.
There are two types of hardware-in-the-loop testing:
- Controller HIL: the BMS and real-time systems are connected using low-voltage signals and communication networks. E.g., the real-time system runs a model of the battery cells, but there aren't high voltage connections. The battery cell voltage values are exchanged between BMS and real-time system via communication interfaces such as Ethernet or CAN, or low voltages (typically +/- 10V).
- Power HIL: the real-time system includes a battery cell emulator. The BMS includes the power converters, whcih are wired to the battery cell emulator.
For best integration with MATLAB and Simulink, the recommended product for HIL testing is Simulink Real-Time which is designed to work with Speedgoat real-time test systems.