Embedded and systems
Hardware-in-the-loop (HiL)
Hardware-in-the-loop is a test method in which a real control unit or embedded system is tested against a simulated environment that reacts to its outputs in real time.
Also known as: HIL testing, HiL simulation
How does a HiL test work?
The device under test, usually a control unit running its real firmware, is connected to a HiL test bench. The bench replaces everything that surrounds the device in the finished product: sensors, actuators, other control units and the physics of the environment. It stimulates the inputs, measures the outputs and uses them to calculate the simulated world’s next reaction in real time.
That closes the loop: the device behaves as if it were installed, even though it is sitting on a lab bench.
What is HiL used for?
- Early testing without the complete system: firmware can be tested before the vehicle, machine or plant exists.
- Dangerous or rare situations: short circuits, sensor failures or limit values can be produced safely and reproducibly.
- Automated regression testing: every new firmware version runs through the same scenarios, overnight and in the CI pipeline too.
HiL compared
HiL is the last stage of a chain made up of model-in-the-loop, software-in-the-loop and HiL. Each stage makes more of the setup real and less of it simulated. HiL tests are closer to the product, but also more effort than pure software tests. So it pays to test on the bench only what genuinely needs real hardware.
In practice
A HiL test bench does not have to be expensive or proprietary. With standard measurement equipment and Python-based test frameworks such as QABench, HiL tests can be set up leanly and integrated into existing CI workflows.