Documentation

Diagnostics Pane: Sample Time

Sample Time Diagnostics Overview

Specify what diagnostic actions Simulink® software should take, if any, when it detects a compilation error related to model sample times.

Configuration

Set the parameters displayed.

Tips

  • To open the Sample Time pane, in the Simulink Editor, select Simulation > Model Configuration Parameters > Diagnostics > Sample Time.

  • The options are typically to do nothing or to display a warning or an error message.

  • A warning does not terminate a simulation, but an error does.

See Also

Source block specifies -1 sample time

Select the diagnostic action to take if a source block (such as a Sine Wave block) specifies a sample time of -1.

Settings

Default: none

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • The Random Source block does not obey this parameter. If its Sample time parameter is set to -1, the Random Source block inherits its sample time from its output port and never produces warnings or errors.

  • Some Communications System Toolbox™ blocks internally inherit sample times, which can be a useful and valid modeling technique. Set this parameter to none for these types of models.

Command-Line Information

Parameter: InheritedTsInSrcMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

See Also

Multitask rate transition

Select the diagnostic action to take if an invalid rate transition occurred between two blocks operating in multitasking mode.

Settings

Default: error

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • This parameter allows you to adjust error checking for sample rate transitions between blocks that operate at different sample rates.

  • Use this option for models of real-time multitasking systems to ensure detection of illegal rate transitions between tasks that can result in a task's output being unavailable when needed by another task. You can then use Rate Transition blocks to eliminate such illegal rate transitions from the model.

Command-Line Information

Parameter: MultiTaskRateTransMsg
Type: string
Value: 'warning' | 'error'
Default: 'error'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

See Also

Single task rate transition

Select the diagnostic action to take if a rate transition occurred between two blocks operating in single-tasking mode.

Settings

Default: none

none

Simulink takes no action.

warning

Simulink displays a warning.

error

Simulink terminates the simulation and displays an error message.

Tips

  • This parameter allows you to adjust error checking for sample rate transitions between blocks that operate at different sample rates.

  • Use this parameter when you are modeling a single-tasking system. In such systems, task synchronization is not an issue.

  • Since variable step solvers are always single tasking, this parameter applies to them.

Command-Line Information

Parameter: SingleTaskRateTransMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionnone or error

See Also

Multitask conditionally executed subsystem

Select the diagnostic action to take if Simulink software detects a subsystem that may cause data corruption or non-deterministic behavior.

Settings

Default: error

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • These types of subsystems can be caused by either of the following conditions:

    • Your model uses multitasking solver mode and it contains an enabled subsystem that operates at multiple rates.

    • Your model contains a conditionally executed subsystem that can reset its states and that contains an asynchronous subsystem.

    These types of subsystems can cause corrupted data or nondeterministic behavior in a real-time system that uses code generated from the model.

  • For models that use multitasking solver mode and contain an enabled subsystem that operates at multiple rates, consider using single-tasking solver mode or using a single-rate enabled subsystem instead.

  • For models that contain a conditionally executed subsystem that can reset its states and that contains an asynchronous subsystem, consider moving the asynchronous subsystem outside the conditionally executed subsystem.

Command-Line Information

Parameter: MultiTaskCondExecSysMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

See Also

Tasks with equal priority

Select the diagnostic action to take if Simulink software detects two tasks with equal priority that can preempt each other in the target system.

Settings

Default: warning

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • This condition can occur when one asynchronous task of the target represented by this model has the same priority as one of the target's asynchronous tasks.

  • This option must be set to Error if the target allows tasks having the same priority to preempt each other.

Command-Line Information

Parameter: TasksWithSamePriorityMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionnone or error

See Also

Enforce sample times specified by Signal Specification blocks

Select the diagnostic action to take if the sample time of the source port of a signal specified by a Signal Specification block differs from the signal's destination port.

Settings

Default: warning

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • The Signal Specification block allows you to specify the attributes of the signal connected to its input and output ports. If the specified attributes conflict with the attributes specified by the blocks connected to its ports, Simulink software displays an error when it compiles the model, for example, at the beginning of a simulation. If no conflict exists, Simulink software eliminates the Signal Specification block from the compiled model.

  • You can use the Signal Specification block to ensure that the actual attributes of a signal meet desired attributes, or to ensure correct propagation of signal attributes throughout a model.

Command-Line Information

Parameter: SigSpecEnsureSampleTimeMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

See Also

Sample hit time adjusting

Select the diagnostic action to take if Simulink software makes a minor adjustment to a sample hit time while running the model.

Settings

Default: none

none

Simulink software takes no action.

warning

Simulink software displays a warning.

Tips

  • Simulink software might change a sample hit time if that hit time is close to the hit time for another task. If Simulink software considers the difference to be due only to numerical errors (for example, precision issues or roundoff errors), it changes the sample hits of the faster task or tasks to exactly match the time of the slowest task that has that hit.

  • Over time, these sample hit changes might cause a discrepancy between the numerical simulation results and the actual theoretical results.

  • When this option is set to warning, the MATLAB® Command Window displays a warning like the following when Simulink software detects a change in the sample hit time:

    Warning: Timing engine warning: Changing the hit time for ...

Command-Line Information

Parameter: TimeAdjustmentMsg
Type: string
Value: 'none' | 'warning'
Default: 'none'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

See Also

Unspecified inheritability of sample time

Select the diagnostic action to take if this model contains S-functions that do not specify whether they preclude this model from inheriting their sample times from a parent model.

Settings

Default: warning

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • Not specifying an inheritance rule may lead to incorrect simulation results.

  • Simulink software checks for this condition only if the solver used to simulate this model is a fixed-step discrete solver and the periodic sample time constraint for the solver is set to ensure sample time independence

  • For more information, see Periodic sample time constraint.

Command-Line Information

Parameter: UnknownTsInhSupMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

See Also

Was this topic helpful?