Nick KeelEvery year consumers demand more from the products they use and the services provided to them. For the auto industry this means smarter, more fuel efficient cars to compensate for rising fuel costs. Pushed by these challenges, cars have evolved into intelligent platforms that include complex electronics and software algorithms implemented on embedded control devices called electronic control units (ECUs).

The techniques and tools that engineers use to develop automobiles have evolved as well. A result of this evolution, Hardware-in-the-Loop (HIL) simulation is a test technique that helps reduce development cost, reduce time to market, and increase the quality of automobiles. This article describes HIL simulation and explains how it is being used to build better cars, and it provides guidance on considerations that should be made when selecting a HIL system. 

Figure 1: An automobile can have hundreds of ECUs, and HIL simulation can be used to test the proper operation of all of them.What is HIL Simulation?
HIL simulation is a real-time testing technique used to test embedded control devices more efficiently. When testing embedded control devices, safety, availability, or cost considerations can make it impractical to perform all of the necessary testing using the complete system. During HIL testing, the physical system that interfaces to an embedded control device is simulated on real-time hardware, and the outputs of the simulator mimic the actual output of the physical system. The embedded controller “thinks” it is in a real system. HIL simulation allows for thorough testing of the embedded control device in a virtual environment before proceeding to real-world tests of the complete system.

How Does HIL Simulation Work?
In a closed-loop control system, the current state of the system being controlled is fed back to the controller through sensor measurements. In the case of an automobile, an ECU uses these measurements to determine the appropriate actuator values to attain a desired operating condition. For example, the engine control ECU receives information regarding throttle position, engine speed, and exhaust oxygen levels to determine the appropriate actuator commands for fuel injector position, spark plug timing, and air intake to maintain maximum engine performance and minimize harmful emissions. Physical testing of the complete system is ultimately required; however, engineers can thoroughly test the ECU without a vehicle or even an engine using HIL simulation.

A HIL test system performs two main functions: it simulates the physical system with which the ECU will interact, and it performs test executive functions such as stimulus generation and test result data logging. Stimulus generation of an engine ECU might entail creating a series of desired engine speeds (to simulate pushing the gas pedal) and a series of vehicle loads (which may represent a variety of different road conditions). The entire system would be observed to ensure that all components operate correctly and the test results would be logged for comparison to ideal system response. 

Figure 2: An example diagram of a common HIL test system.

The other primary function of an HIL test system is to simulate the components that interact with the ECU. To understand how this is accomplished, let’s first consider what an ECU “knows” about the world around it. A typical ECU consists of an embedded controller with integrated electronics for sensor signal conditioning and digital communications. From the ECU’s perspective, an accurate simulation of the characteristics of the physical system being controlled is indistinguishable from the actual system. Simulation models are commonly used to represent the behavior of this physical system.

It is critical that an HIL simulator be able to generate and acquire signals at the same amplitude and rate that a physical system would produce to accurately test the ECU’s response to real-world conditions. A real-time operating system is commonly used to ensure that these timing requirements are met. Depending on the complexity of a system being simulated, parallel processing techniques such as FPGAs and multi-core processors may be necessary to complete output response calculations while maintaining timing accuracy. 

Figure 3: An HIL user interface that includes commands to send to the ECU as well data received from the simulated system.

Increasing Efficiency with HIL Simulation
HIL simulation is a way to efficiently test embedded control devices such as ECUs. While HIL simulation does not replace the need for physical testing, it does help engineers accomplish the following by enabling tests earlier in the development cycle and eliminating the need for a physical system during test:

• Test earlier in the development process – identify design errors earlier when they are less expensive to correct and have a smaller impact on time to market

• Reduce testing cost – reduce capital, repair, and maintenance expenses for test fixtures without the need for a physical system

• Increase test coverage – test ECUs under extreme conditions that might not be practical for physical testing due to safety or equipment damage concerns

• Increase test flexibility – simulate winter road conditions for a vehicle under test even in the heat of summer

• Increase test repeatability – isolate deficiencies in an ECU even if they occur only under certain circumstances

The Importance of HIL Test System Flexibility
There are many options for implementing HIL simulation as part of your test system. To ensure the short- and long-term success of your investment, it must be both flexible and open. With the drive to continually reduce the cost of test, a flexible solution is essential to making HIL simulation practical in your development process. An effective HIL simulation solution should be able to rapidly adapt to changes encountered during and between development cycles. A small change in the test process or configuration should not require a major renovation of your HIL simulator. At the current rate of innovation, it is not practical to expect a single vendor to simultaneously meet the time-to-market, quality, and cost expectations for all the latest technologies. An open HIL simulation solution ensures that you will always be able to integrate the technologies required to test your ECU.

Building Better Cars by Performing HIL Testing
Business and technical challenges will continue to grow in the automotive industry. By enabling tests earlier in the development cycle and removing the limitations of physical test, HIL simulation is helping to reduce development cost and increase the quality of vehicles in the face of these challenges. To learn more about HIL, visit