To perform hardware-in-the-loop simulation on target hardware, use Simulink® Real-Time™ to:
Generate and compile code on the development computer.
Download the real-time application to the target computer.
Execute the real-time application remotely from the development computer.
Before building and executing your real-time application:
Set up and configure the software, I/O interfaces, and connectivity for your development computer, target computer, and I/O board. For information, see Simulink Real-Time Setup and Configuration (Simulink Real-Time) and MATLAB Command-Line Interface (Simulink Real-Time).
To generate code for the model on your development computer, and then to transfer the code to your real-time computer:
Start the target computer. For information, see Start Target Computer (Simulink Real-Time).
To compile your code, link your hardware, and download the real-time application to your target machine in one step, in the Simulink editor, click the Build Model button . For information, see Build and Download Real-Time Application (Simulink Real-Time).
After you build and download a real-time application to the target computer, you can run the real-time application.
In the Simulink window, on the toolbar, set the
simulation mode to
Selecting external mode allows you to connect your development computer to your real-time target machine.
To connect your development computer and target machine and to transfer your model parameters to the target machine, click the Connect to Target button .
To execute your real-time application on the target machine, click the Run button .