This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Concurrent Execution on Simulink® Real-Time™

This example shows how to perform concurrent execution of a model on Simulink Real-Time. It displays the execution of each model thread using the Simulink Real-Time profiling tool.

dxpcmdsdemo runs the model with the default sample time 0.001 second.

To run the model with adjusted sample time nnn second, please type Ts = nnn before dxpcmdsdemo. For example:

Ts = 0.01;



  1. Boot the target computer with the Simulink Real-Time real-time kernel.

  2. At the MATLAB® command prompt, type dxpcmdsdemo to download and run the model on the target computer.

Select and Open the Model

Open the model dxpcmds6t (see Figure 1). The model is mapped to 7 threads (Model1_R1, Model1_R2, Model1_R3, Model1_R4, Model2_R1, Model2_R3, and Model2_R4) running at sample times of Ts, 2*Ts, 3*Ts, 4*Ts, Ts, 3*Ts and 4*Ts respectively.


Figure 1: A Model Comprised of Seven Tasks

Details in Model1

open_system([mdl, '/Model1']);

Figure 2: Four Tasks in Model1

Details in Model2

open_system([mdl, '/Model2']);

Figure 3: Three Tasks in Model2

Build, Download, and Run the Model

tg = slrt;
### Starting Simulink Real-Time build procedure for model: dxpcmds_ref1

### Starting Simulink Real-Time build procedure for model: dxpcmds_ref2

### Starting Simulink Real-Time build procedure for model: dxpcmds6t
### Generated code for 'dxpcmds6t' is up to date because no structural, parameter or code replacement library changes were found.
### Successful completion of build procedure for model: dxpcmds6t
### Looking for target: TargetPC1
### Download model onto target: TargetPC1

Display Profiling Data

The profiling data shows the execution time of each thread on a multi-core target computer

profileInfo.modelname = 'dxpcmds6t';
profileInfo.noreport = 0;
Copying data from target machine, please wait ...
Processing data, please wait ...

Figure 5: Plot of Recorded Profiling Data

Close the Model

Was this topic helpful?