Main Content

Periodic sample time constraint

Option to specify constraints on model sample times

Model Configuration Pane: Solver

Description

You can specify constraints on sample times for simulations that use a fixed-step solver. When the model does not satisfy the specified constraint, the software issues a diagnostic.

Dependencies

To enable this parameter, set the solver Type to Fixed-step.

Settings

Unconstrained (default) | Ensure sample time independent | Specified
Unconstrained

The software imposes no constraints on sample times in the model.

When you select this option, the software assigns priority 40 to the sample time that corresponds to the fixed step size for the simulation. The software increments or decrements from 40 to assign priorities to other rates in the model according to the value of the Higher priority value indicates higher task priority parameter. Continuous sample times always have the highest priority.

When you select Unconstrained, you can configure these parameters:

  • Fixed-step size (fundamental sample time)

  • Treat each discrete rate as a separate task

  • Higher priority value indicates higher task priority

  • Automatically handle rate transitions for data transfers

Ensure sample time independent

When you select this option, referenced models inherit sample time from the context in which they are used. Select this option to detect sample time problems related to referencing models with intrinsic sample time inside triggered or iterator subsystems.

The software checks to ensure that this model can inherit its sample times from a model that references it without altering its behavior. Models that specify a fixed step size cannot satisfy this constraint.

Specified

The software checks to ensure that the model operates at a specified set of prioritized periodic sample times. When you select this option, you must specify properties for each sample time you use in the model. The software issues a diagnostic when the model uses a sample time that is not specified. During simulation, higher priority tasks run first and can interrupt lower priority tasks as needed. Use the Sample time properties parameter to specify the rates and priorities for sample times in the model.

For information about how to use this option for multitasking models, see Execute Multitasking Models (Simulink Coder).

When you select Specified, you can configure these parameters:

  • Sample time properties

  • Treat each discrete rate as a separate task

  • Higher priority value indicates higher task priority

  • Automatically handle rate transitions for data transfers

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 precaution

Specified or Ensure sample time independent

Programmatic Use

Parameter: SampleTimeConstraint
Value: 'unconstrained' | 'STIndependent' | 'Specified'
Default: 'unconstrained'

Version History

Introduced before R2006a