Main Content

Deploy Environment Model for Real-Time Hardware-In-the-Loop (HIL) Simulation

About Hardware-In-the-Loop Simulation

Hardware-in-the-loop (HIL) simulation tests and verifies an embedded system or control unit in the context of a software test platform. Examples of test platforms include real-time target systems and instruction set simulators (IISs). You use Simulink® software to develop and verify a model that represents the test environment. Using the code generator, you produce, build, and download an executable program for the model to the HIL simulation platform. After you set up the environment, you can run the executable to validate the embedded system or control unit in real time.

During HIL simulation, you gradually replace parts of a system environment with hardware components as you refine and fabricate the components. HIL simulation offers an efficient design process that eliminates costly iterations of part fabrication.

The code that you build for the system simulator provides real-time system capabilities. For example, the code can include VxWorks® from Wind River® or another real-time operating system (RTOS).

The following figure shows a typical HIL setup.

Conceptual diagram of HIL simulation setup that includes an algorithm model deployed to an embedded system connected to an environment model deployed to a real-time simulator

The HIL platform available from MathWorks is the Simulink Real-Time product. Several third-party products are also available for use as HIL platforms. The Simulink Real-Time™ product offers hard real-time performance for PCs with Intel® or AMD® 32-bit processors functioning as your real-time target. The Simulink Real-Time product enables you to add I/O interface blocks to your models and automatically generate code with code generation technology. The Simulink Real-Time product can download the code to a second PC running the Simulink Real-Time real-time kernel. System integrator solutions that are based on Simulink Real-Time are also available.

Set Up and Run HIL Simulations

To set up and run HIL simulations iterate through the following steps:

  1. Develop a model that represents the environment or system under development.

    For more information, see Compare System Target File Support Across Products.

  2. Generate an executable for the environment model.

  3. Download the executable for the environment model to the HIL simulation platform.

  4. Replace software representing a system component with corresponding hardware.

  5. Test the hardware in the context of the HIL system.

  6. Repeat steps 4 and 5 until you can simulate the system after including components that require testing.

Related Topics