What Is Hardware-in-the-Loop?


This white paper explains the difficulties of testing complex systems and how hardware-in-the-loop (HIL) testing is the solution for creating a test system that is scalable and ensures comprehensive test coverage.


The Challenge Of Testing Complex Systems

Thorough and reliable tests are necessary to verify and validate design. But, as modern systems grow in complexity, particularly in software, this critical step is more easily said than done.

Consider testing the electronic components of a new car. To remain relevant in today’s market, modern vehicles need to include advanced driver-assistance systems (ADAS), cameras, radar, and more. Testing these subsystems on the assembled product in desired use cases ensures that testing is performed in the ideal context, but it also incurs significant test overhead and the challenge of testing every scenario. Additionally, delaying tests until final assembly carries significant risk, and test-driven changes can lead to catastrophic schedule impacts. Unthinkable test cost and an unpredictable time to market are sure to follow. The complexity of this problem is further heightened when you consider that just one of many electronic control units (ECUs) in a car equates to an enormous number of signals representing various functions and I/O types, making comprehensive test coverage a challenge. These factors sound like the makings of an impossible problem calling into question the plausibility of thorough testing that is both cost and time effective.

The solution must provide comprehensive testing without the burden of using an assembled final product in the field. By allowing ECUs under test to interact with a simulated use case, you are free to test early and often to uncover as many software defects as possible. This is the basis of a hardware-in-the-loop (HIL) test.

What Is HIL?

HIL testing is a technique where real signals from a controller are connected to a test system that simulates reality, tricking the controller into thinking it is in the assembled product. Test and design iteration take place as though the real-world system is being used. You can easily run through thousands of possible scenarios to properly exercise your controller without the cost and time associated with actual physical tests.

Again, consider a car. The engine ECU is responsible for converting sensor measurements into action such as adjusting air intake when the accelerator is depressed.

Figure 1. Test System

An HIL test replaces the engine with a simulation comprising hardware and software that interacts with real I/O as though the physical engine were present. Because updates can be made in software, you can quickly incorporate ECU or engine software changes, test a wide breadth of relevant scenarios, and expand test coverage as needed to fearlessly and comprehensively test without risk to a physical, costly system.  

 Figure 2.  Engine Replaced With HIL Simulation

For HIL testing to be of value, the quality of the simulation software is of utmost importance. Simulation software must be paired with hardware that not only accounts for system specifications such as connector type and I/O but also allows for fault insertion and the ability to test real-world scenarios.

Figure 3.  Simulation Requirements

This is where you feel the burden of choice as to what hardware and software you will use to ensure maximum test coverage while minimizing time spent on system setup and usability. Additionally, to keep pace with rapidly changing market requirements, you are tasked with finding a solution that addresses not only this test but also the next, necessitating testers that are customizable and future-proof.  

A Platform-Based Approach Conquers Test Challenges

National Instruments offers a comprehensive hardware and software solution that helps you get started quickly with configuration-based software and modular I/O. Rather than use a generic solution with costly features and I/O that are irrelevant to your test, NI solutions are tailored to your specific application. You have the freedom to customize hardware and software to account for nonstandard signals and to expand I/O count as needed. 

Design for This System and the Next

Integrating changing safety requirements and government regulations, incorporating new sensors, and responding to market-demanded technologies are just a few examples illustrating that a tester is most usable and cost-effective if it can respond to these changing requirements. NI HIL Simulators are built on an open architecture based on commercial off-the-shelf (COTS) hardware like PXI and switch load signal conditioning (SLSC) to ensure that you can customize systems to meet your test needs and keep pace with evolving industry trends. As new ideas enter your design and as technology evolves, you can reduce your risk of falling behind by future-proofing your test system using hardware and software that adapts as you do. 

Tackle Increasing Complexity

The goal of testing is to produce informed software changes leading to the desired final product. As software errors are uncovered and changes are made, test systems must adapt. Fixed, black box systems make it challenging if not impossible to account for increased channel count and changing I/O types. NI’s modular hardware such as PXI and reconfigurable I/O (RIO) draw on an industry standard, allowing you to add I/O and change I/O type without rebuilding the test system. Configuration-based test software such as VeriStand integrates seamlessly with modular hardware, ensuring that software and hardware stay in sync as test system changes are made. For models used in applications such as power electronics where model fidelity and hardware reliable timing are key, VeriStand can incorporate your own FPGA code, allowing you to choose the level of customization needed for your application.

Keep Pace With Changing Design Requirements

With NI’s open platform, you can take advantage of interoperable hardware and software and choose the approach you deem best such as using specialized partner hardware, choosing Python for automation, and importing models from multiple environments including Simulink®. NI products are ASAM XIL–compatible, meaning that you are investing in a trusted, adaptable industry standard rather than a one-time solution.

NI’s configuration-based test software, VeriStand, runs on a deterministic, real-time OS where you can test right away without the need to program. However, when special cases arise, this same software is customizable with your own LabVIEW code. Reconfigurable FPGAs offer to-the-pin control of your I/O and allow you to implement in-line processing in hardware that can be changed at the speed of your next idea.

You Are the Expert

No one knows your design like you do. HIL tests ensure that your final product is exactly what you intended while minimizing cost and time to market. NI hardware and software for HIL testing give you the power to design the test system you need to reliably produce the product you imagine.