Main Content

Real-Time Simulation

Real-time target; Connected IO mode, accelerator mode, and Run in Kernel mode; sample rate; real-time scope parameters

To evaluate the real-time behavior of your model, run the model, log data, tune parameters, and view signals from the Simulink® toolbar. Capture signals from the model and display them with standard Simulink Scope blocks. Run your model in Connected IO mode, accelerator mode, or Run in Kernel mode, depending upon the sample rate that you require.

If you require a moderate sample rate, up to 1 kHz, use Connected IO mode or accelerator mode. In these modes, you run the Simulink model within MATLAB®. Only the I/O module drivers run in the Simulink Desktop Real-Time™ kernel.

If you require a higher sample rate, up to 20 kHz, use Run in Kernel mode. In Run in Kernel mode, you use Simulink Coder™ to generate a real-time application from the model. The real-time application and the I/O module drivers run in the Simulink Desktop Real-Time kernel.

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)

Topics

Prerequisites

Connected IO Mode (Normal Mode)

Display

Featured Examples