Skip to Main Content Skip to Search
Product Documentation

Interpreting Simulation Results

Introduction

A model configured for concurrent execution is a model that is designed to execute concurrently on a real-time multicore target. Simulink enables you to simulate such models and observe the effects of task-to-task data transfer. You can also observe how this transfer can impact the numerical characteristics of the model.

Consider the model sldemo_concurrent_execution. To understand simulation results, compare the signal x in two scenarios:

Default Configuration

In the following example, the model is configured as described in Baseline Analysis Using Configuration Defaults. Because this model contains only one sample time (continuous sample time), the automatic analysis configures the target with one task and maps all blocks to run in that task. The period of the task is selected as 0.1, which agrees with the fixed-step size of the model. Because the design has only one task, no task-to-task data transfer is needed. Therefore, simulation of the model should produce the same numeric results as if the model is not configured for concurrent execution.

Configure the model to inspect data using the Simulation Data Inspector from the Data Input and Output pane of the Configuration Execution dialog box. After you enable the Simulation Data Inspector, click Simulate > Start> to simulate the model using the single task configuration. After simulation, the Simulation Data Inspector should automatically launch and record the simulation results for the signal labeled x.

Sample Configured Model with Multiple Target Tasks

In the Concurrent Execution dialog box, create two additional tasks and map the ControllerA block to the first additional task and the ControllerB block to the second additional task.

  1. Open the Concurrent Execution dialog box.

  2. Click the Add Task button twice.

  3. Select the first added task and label it ControllerA.

  4. Select the second added task and label it ControllerB.

  5. In the Map blocks to tasks pane, check that the ControllerA block is assigned to execute within the ControllerA task and the ControllerB block is assigned to execute within the ControllerB task.

  6. Simulate the model again.

  7. After simulation completes, compare the results for the default and custom configurations using the Simulation Data Inspector.

To understand the source of the phase margin, observe that:

Because the data transfer is deterministic, the simulated model takes into account a unit delay to capture the effects of data transfer. This delay causes a small phase margin in the mapped design. The delay agrees with the step size of the model, which is 0.1. This delay is the least possible delay that the software can impose on the signal.

How Simulink Determines Data Transfer Requirements

The software determines data transfer based on how the blocks are mapped to tasks. When a model is simulated, either from an update diagram or upon code generation, Simulink software examines the block-to-task mapping and determines which signals must be configured for task-to-task data transfer. The software considers only the signals where the source of the signal originates from one task and the destination of the signal resides in a different task. You can specify global options that control data transfer (see Data Transfer Options). You can also override these options for each signal from the Data Transfer pane of the Signal Properties dialog box.

Therefore, the block-to-task mapping dictates which blocks execute in which tasks. Consequently, this mapping also dictates which signals you configure for task-to-task data transfer.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS