Main Content

Sample time properties

Discrete sample time periods, offsets, and priorities

Model Configuration Pane: Solver

Description

Specify priority for each sample time in the model.

Dependencies

To enable this parameter, set the Periodic sample time constraint parameter to Specified.

Settings

n-by-3 matrix

Specify the sample time properties as an n-by-3 matrix where n is equal to the number of discrete sample times in the model. Each row of the matrix has this form:

[period, offset, priority]

  • period — Sample time period

  • offset — Sample time offset relative to other blocks with the same period

  • priority — Execution priority of the real-time task associated with the sample time

Specify the sample time properties in order from highest priority to lowest priority. During simulation, higher priority tasks run first and can interrupt lower priority tasks as needed. Faster rates must have higher priorities. Continuous sample time always has the highest priority.

For example, specifying the value as [[0.1, 0, 10]; [0.2, 0, 11]; [0.3, 0, 12]]:

  • Declares that the model should specify three sample times

  • Sets the fundamental sample time period to 0.1 second

  • Assigns priorities of 10, 11, and 12 to the sample times

  • Assumes that higher priority values indicate lower priorities

Recommended Settings

The table summarizes recommended values for this parameter based on considerations related to code generation.

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionPeriod, offset, and priority of each sample time in the model

Programmatic Use

Parameter: SampleTimeProperty
Type: structure
Value: n-by-3 matrix
Default: []

Version History

Introduced in R2007a