Main Content

Apply Simulink Desktop Real-Time Model Templates to Create Real-Time Models

Starting from the model template for Simulink Desktop Real-Time™ provides a new model that has configuration parameters set up for building a real-time application. This example shows how to use the Simulink Desktop Real-Time template for a new Simulink model that is configured for Connected IO mode or Run in Kernel mode.

To see the Simulink Desktop Real-Time commands for each operation in this example, view the example code.

Create a Simulink Desktop Real-Time Model from Template

To create this model from the Simulink start page, in the Command Window, type:

simulink

To create a model that is configured for Connected IO mode, select the Simulink Desktop Real-Time Connected IO mode template from the start page, and create the exampleSldrtAppConnectedIO model. Or, in the Command Window, use the Simulink.createFromTemplate command.

To create a model that is configured for Run in Kernel mode, select the Simulink Desktop Real-Time Run in Kernel mode template from the start page, and create the exampleSldrtAppRunInKernel model. Or, in the Command Window, use the Simulink.createFromTemplate command.

Tips for Maximum Performance

These are some tips to help you get the most performance from the models that you create from these model templates.

For model that is configured for Connected IO mode:

  • Both fixed-step and variable-step solvers can be used in Connected IO mode.

  • All I/O blocks perform real-time synchronization. Use the Real-Time Synchronization block only if no I/O block is used.

  • Use a single block that reads or writes all channels of given type, rather than multiple blocks for one channel each.

For model that is configured for Run in Kernel mode:

  • It is not necessary to use the Real-Time Synchronization block in Run in Kernel mode. The block performs no operation.

  • It is not useful to use the Missed Ticks port in Run in Kernel mode. The port always outputs zero.

  • Use a single block that reads or writes all channels of given type, rather than multiple blocks for one channel each.

More Information