Main Content

Model Preparation for Real-Time Simulation

Predefined and custom I/O driver blocks, code generation parameters, real-time kernel

A library of I/O driver blocks provides connections between physical I/O devices and real-time models. To observe how Simulink® models respond to real-world behavior, use the Simulink Desktop Real-Time™ block library to create a real-time application from a Simulink model. Set the model configuration parameters to values consistent with real-time execution. The real-time application runs on your computer with the Simulink Desktop Real-Time kernel. See Prepare for Real-Time Execution.

Functions

sldrtkernelInstall and remove Simulink Desktop Real-Time kernel
rtwhoDisplay information about development computer status
sldrtconfigsetAttach and activate default Simulink Desktop Real-Time configuration set
SLDRT.runRun model in real time by using Simulink Desktop Real-Time kernel (Since R2023b)
createTimerCreate timer in real-time kernel (Since R2023b)
loadExecutableLoad executable into real-time kernel (Since R2023b)
loadDriverLoad driver instance into real-time kernel (Since R2023b)
stopStops execution of current model simulation run and causes MATLAB to wait until execution stops (Since R2023b)
waitWait for model execution to complete (Since R2023b)

Objects

SLDRT.RunStatusGet simulation run status and get data from scopes and logged signals (Since R2023b)
RT.KernelGet real-time kernel property information and access child object for timers, executables, and drivers (Since R2023b)
RT.TimerRepresent timer in real-time kernel (Since R2023b)
RT.ExecutableRepresent executable in real-time kernel (Since R2023b)
RT.DriverRepresent device driver in real-time kernel (Since R2023b)
RT.DriverImageRepresent a binary image of device driver for real-time kernel (Since R2023b)

Tools

Board setupOpen a board-specific dialog box to set up the data acquisition board for Simulink Desktop Real-Time

Blocks

expand all

Analog InputRead from one or multiple analog input channels
Analog OutputWrite to one or multiple analog output channels
Counter InputRead from one or multiple counter-input channels
Encoder InputRead from one or multiple incremental encoder input channels
Frequency OutputWrite to one or multiple frequency or PWM output channels
Digital InputRead from one or multiple digital input channels
Digital OutputWrite to one or multiple digital output channels
ThingSpeak InputRead input fields from ThingSpeak channel
ThingSpeak OutputWrite output fields to ThingSpeak channel
Packet InputRead binary data or a CAN message from a communication channel
Packet OutputWrite binary data or a CAN message to a communication channel
Servo OutputWrite to standard servo output channels
Stream InputRead formatted ASCII data from communication channel
Stream OutputWrite formatted ASCII data to communication channel
Other InputRead from one or more input channels not handled by specific blocks
Other OutputWrite to one or more output channels not handled by specific blocks
Real-Time SyncSynchronize model execution to real time in Connected IO mode
Execution TimeOutput total execution time in Run in Kernel mode
TimestampOutput signal timestamp in Run in Kernel mode
Video InputGet video data from system video devices (Since R2022a)

Topics

Prerequisites

Configuration

Related Information

Featured Examples