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.
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.
To set up and run HIL simulations iterate through the following steps:
Develop a model that represents the environment or system under development.
For more information, see Compare System Target File Support Across Products.
Generate an executable for the environment model.
Download the executable for the environment model to the HIL simulation platform.
Replace software representing a system component with corresponding hardware.
Test the hardware in the context of the HIL system.
Repeat steps 4 and 5 until you can simulate the system after including components that require testing.