Simulation, Testing and Validation · X-in-the-loop testing
Hardware-in-the-LoopHIL
Also known as HIL testing, HIL simulation
A test method in which a real embedded controller is connected through its actual electrical and network interfaces to a real-time simulator that emulates the plant, sensors and rest of the vehicle, so the hardware can be tested in closed loop.
Explanation
MathWorks describes HIL simulation as a technique for developing and testing embedded systems in which the real controller is wired, through real analog and digital I/O, to a plant model executing on a real-time test system; the controller acts on the simulated plant's responses as if they came from the physical system.
HIL is a late stage in the X-in-the-loop sequence: model-in-the-loop, software-in-the-loop and processor-in-the-loop come first, and testing with actual hardware follows. Compared with the earlier stages it adds the real electronic control unit (ECU), its I/O electronics, timing and communication, typically with a residual bus simulation standing in for the other ECUs on CAN or Ethernet. For ADAS controllers, sensor inputs may be fed as object lists, raw sensor data or physically stimulated signals.
HIL lets teams test before all physical components exist and run hazardous or fault scenarios repeatably without risking equipment. Its conclusions are only as valid as the plant and sensor models; the plant model must complete every simulation step within its real-time deadline; and high-fidelity sensor stimulation and rig maintenance are costly.
How it works
A real-time computer runs vehicle, plant and environment models at a fixed time step. I/O boards generate the electrical signals the ECU expects, such as sensor voltages and wheel-speed pulses, and read its actuator outputs. Bus interfaces simulate the messages of other ECUs. Automated test scripts run scenarios, inject faults and log signals, and results are compared against expected behaviour and requirements.
Automotive applications
- ECU functional and regression testing
- Diagnostic and fault-reaction testing
- ADAS ECU testing with simulated sensor data
- Network and gateway integration testing
Example
A brake ECU sits on a HIL rig while the real-time computer simulates vehicle dynamics and wheel-speed signals. A scripted test opens the circuit of one wheel-speed sensor and checks that the ECU stores the correct diagnostic trouble code and degrades ABS operation safely.
An illustrative example: any figures in it are worked numbers, not measurements.
References
- What Is Hardware-in-the-Loop (HIL)? (opens in a new tab)
“Hardware-in-the-loop (HIL) simulation is a technique for developing and testing embedded systems.”
- What are MIL, SIL, PIL, and HIL, and how do they integrate with the Model-Based Design approach? (opens in a new tab)
Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.