Hardware-in-the-loop (HIL) simulation is a type of real-time simulation. You use HIL simulation to test your controller design. HIL simulation shows how your controller responds, in real time, to realistic virtual stimuli. You can also use HIL to determine if your physical system (plant) model is valid.
In HIL simulation, you use a real-time computer as a virtual representation of your plant model and a real version of your controller. The figure shows a typical HIL simulation setup. The desktop computer (development hardware) contains the real-time capable model of the controller and plant. The development hardware also contains an interface with which to control the virtual input to the plant. The controller hardware contains the controller software that is generated from the controller model. The real-time processor (target hardware) contains code for the physical system that is generated from the plant model.
Use HIL simulation to test the design of your controller when you are performing Model-Based Design (MBD). The figure shows where HIL simulation fits into the MBD design-to-realization workflow.
Validation involves using actual plant hardware to test your controller in real-life situations or in environmental proxies (for example, a pressure chamber). In HIL simulation, you do not have to use real hardware for your physical system (plant). You also do not have to rely on a naturalistic or environmental test setup. By allowing you to use your model to represent the plant, HIL simulation offers benefits in cost and practicality.
There are several areas in which HIL simulation offers cost savings over validation testing. HIL simulation tends to be less expensive for design changes. You can perform HIL simulation earlier than validation in the MBD workflow so you can identify and redesign for problems relatively early the project. Finding problems early includes these benefits:
Your team is more likely to approve changes.
Design changes are less costly to implement.
In terms of scheduling, HIL simulation is less expensive and more practical than validation because you can set it up to run on its own.
HIL simulation is more practical than validation for testing your controller’s response to unusual events. For example, you can model extreme weather conditions like earthquakes or blizzards. You can also test how your controller responds to stimuli that occur in inaccessible environments like deep sea or deep space.