Simulink Desktop Real-Time (SLDRT) provides a real-time kernel for executing Simulink models on a laptop or desktop running Windows or MacOS. It includes a library of I/O driver blocks that provide connections between physical I/O devices and your real-time model. You can run your model in Normal, Accelerator, or External Mode, depending on the sample rate that you require:
Normal Mode real-time simulation:
If you require a moderate sample rate up to 1 kHz, use Normal mode. In these modes, the model is run "normally" within Simulink. Only the I/O module drivers run in the real-time kernel.
This means that in Normal mode, SLDRT does not guarantee real-time performance. However, it is capable of reporting to the user when real-time performance cannot be achieved by using the Missed Ticks feature. On each sample hit, I/O is performed, while the rest of the algorithm runs in Simulink, and Simulink tries to synchronize to the real-time I/O. If Simulink makes it in time, there is no missed tick. If Simulink is late, it is indicated by the number of missed ticks Simulink lags behind. If your model contains no I/O blocks, you can add the Real-Time Sync block for the same purpose.
Setting "Maximum Missed Ticks" to some low number or even zero would error out when real-time cannot be met. Some higher number specifies how much tolerance you permit before erroring out, or you may use the missed ticks output port to do any custom action you want.
The advantages of SLDRT Normal Mode are:
- No additional toolboxes required.
- The possibility to use blocks that do not support code generation.
- The possibility to use any S-Function and call external binaries.
- The possibility to use variable-step solvers.
The limitations of SLDRT Normal Mode are:
- No guarantee of real-time (only a detection if real-time constraints are met or not)
- Limited performance of up to 1 kHz.
See this page for a detailed description of SLDRT Normal Mode:
Accelerator Mode real-time simulation:
If you see too many missed ticks while running your model in Normal Mode, this can mean that your model is too big or complex to run in the desired sample time. This is a situation where running in Accelerator mode may help, which is an extension to the Normal Mode and has the same advantages and limitations.
See this page for a detailed description of SLDRT Accelerator Mode:
External Mode real-time simulation:
f you require a higher sample rate, use External Mode. In External Mode, the model, solver and drivers are converted to C code, built into a real-time executable, and run in the real-time kernel. This means that the entire model is running in the real-time kernel and the executable is fully synchronized with the real-time clock. Depending on model complexity and number and type of I/O, it is usable to up to 20 kHz of sample rate.
The advantages of SLDRT External Mode are:
- Guarantee of real-time.
- Good performance of up to 20 kHz.
- Recommend for operation with external real-time I/O hardware.
The limitations of SLDRT External Mode are:
- Simulink Coder toolbox is required.
- Models must only use blocks that support code generation
- Limited support for S-Functions and no support for external binaries
- Fixed-step solver is required.
See this page for a detailed description of SLDRT External Mode: