Hardware-in-the-Loop (HIL)

What Is Hardware-in-the-Loop (HIL)?

Hardware-in-the-loop (HIL) simulation is a technique for validating your control algorithm, running on an intended target controller, by creating a virtual real-time environment that represents your physical system to control. HIL helps to test the behavior of your control algorithms without physical prototypes.

How does HIL simulation work?

  1. You create and simulate a virtual real-time implementation of physical components such as a plant, sensors, and actuators on a real-time target computer.  
  2. You run the control algorithm on an embedded controller and run the plant or environment model in real time on a target computer connected to the controller. The embedded controller interacts with the plant model simulation through various I/O channels.
  3. You refine software representations of your components and gradually replace parts of the system environment with the actual hardware components.

With this approach, HIL simulation can eliminate costly iterations in hardware fabrication.

Hardware-in-the-loop (HIL) simulation setup.

Hardware-in-the-loop (HIL) simulation setup. The block diagram shows a HIL simulation in which the hardware under test is an embedded controller and the plant model is a representation of a physical system.

Where is HIL simulation used?

HIL simulation is especially useful when testing your control algorithm on the real physical system is costly or dangerous. HIL simulation is widely used in the automotive, aerospace and defense, and industrial automation and machinery industries to test embedded designs. HIL is also being adopted in medical devices, communications, semiconductors, and other industries.

Common HIL simulation examples include:

  • Aerospace and defense: Flight simulators and flight dynamic control, where it is too complex to test the control algorithm on the actual aircraft
  • Automotive: Vehicle dynamics and controls, where it is impractical to test the functionality on the road in the initial phases
  • Industrial automation: Controller-plant testing, when stopping the production or assembly line to test control algorithms involves a huge amount of resources and business loss

HIL Simulation with MATLAB and Simulink

You can use Simulink Real-Time™ and Speedgoat target hardware to perform real-time simulation and testing. Engineers can start with desktop simulation using MATLAB® and Simulink® and then design, build, and test the real-time application. Using Simscape™, you can build physical models of your plant and then perform HIL simulation using Simulink Real-Time and Speedgoat target hardware.

 

Complete Speedgoat rack setup.

Complete Speedgoat rack setup. This setup was used to automate the testing of tractor controllers with hardware-in-the-loop test benches.

See also: real-time simulation, physical modeling, rapid prototyping, embedded code generation, Simulink Real-Time, Power Electronics Hardware-in-the-Loop (HIL) testing