In recent years Hardware-In-The-Loop (HIL) testing has become a standard part of the embedded software development process. Two trends in the embedded software development world, reduced time to market and an increase in complexity has created the need for better, more dynamic test platforms. HIL platforms provide a way to test the embedded software of a microcontroller in a real time, accurate way prior to integration on the final system.
In general, HIL testing involves running the embedded software on the target, generally an embedded controller of some sort. The HIL system will then provide all of the required stimuli to that embedded controller, including but not limited to analog signals, digital signals and CAN messages. These stimuli are often generated through the use of a plant model; simply put a simulation of the physical system. This plant model will monitor controller outputs and adjust the values feeding back to the controller in a realistic manner. This creates an environment in which the developer is able to dynamically test the embedded code with signals very similar to those the controller and code would see on the final system.
Testing in a HIL environment has several advantages bridging the gap between static testing and testing on the final system. First, the embedded code is being tested while running real time. This can help to expose timing related issues which may be masked by running in a software only simulation. HIL testing also provides the ability to test extreme cases in a safe, controlled setting. Depending on the HIL implementation, test cases may be able to be automated creating truly repeatable tests. HIL systems also minimize the necessity of testing performed on a physical system. This is can lead to significant cost savings as prototype builds are generally much more expensive than the final product.
Traditionally, HILs have been used toward the end of the software development process as a last step before testing on the final system. Recently, there has been a push to bring HIL testing up in the development process. Many studies have indicated that the later a software bug is discovered the more expensive it is to fix. Bringing HIL testing up in the development process enables users to identify and fix bugs even sooner, leading to project cost savings and a higher quality end product.