Prepare for Real-Time Execution
To observe how Simulink® models respond to real-world behavior, connect the real-time application to physical I/O devices. You have access to a library of I/O driver blocks that provide connections between devices and applications. To prepare for real-time execution, install I/O devices in your computer and select the corresponding Simulink Desktop Real-Time™ library blocks.
Actions to consider when preparing for real-time execution include:
Prepare I/O Devices
Choose I/O plugin modules from
Acquire the modules and install them in your computer.
Refer to the vendor documentation for vendor-specific requirements.
If the hardware requires the installation of vendor software, install the vendor software on your computer.
Restart your computer and, from the MATLAB® Command Window, start the Simulink Desktop Real-Time kernel.
Prepare Real-Time Application
Replace Simulink I/O blocks with Simulink Desktop Real-Time blocks that represent the functionality of your I/O modules.
Open the dialog box for each block and associate the block with the driver for the corresponding I/O module.
Set the other block parameters as required by your model.
To configure the model for Simulink Desktop Real-Time code generation, in the Simulink Editor, from the Apps tab, select Desktop Real-Time.
This operation selects the
sldrt.tlccode generation target and sets other configuration parameters for compatibility with Simulink Desktop Real-Time.
Set the Simulink Desktop Real-Time configuration parameters as required by your model.
If the performance of your model in Run in Kernel mode does not meet your system requirements, add Execution Time and Timestamp blocks for analysis. See Execution Time Measurement and Block Profiling.
The next step is to set the simulation mode to Connected IO mode or Run in Kernel mode to attain the required sample rate, and then run the simulation.