MATLAB Examples

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 Real-Time template for a new Simulink model that is configured for Normal or External mode.

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

Contents

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 Normal Mode, select the Simulink Desktop Real-Time normal mode template from the start page, and create the exampleSldrtAppNormal model. Or, in the Command Window, use the Simulink.createFromTemplate command.

To create a model that is configured for External Mode, select the Simulink Desktop Real-Time external mode template from the start page, and create the exampleSldrtAppExternal 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 Normal Mode:

  • Both fixed-step and variable-step solvers can be used in Normal 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 External Mode:

  • It is not necessary to use the Real-Time Synchronization block in External mode. The block performs no operation.
  • It is not useful to use the Missed Ticks port in External 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