Main Content

Sample Times in Subsystems

Subsystems fall into two categories: triggered and non-triggered. For triggered subsystems, in general, the subsystem gets its sample time from the triggering signal. One exception occurs when you use aTriggerblock to create a triggered subsystem. If you set the blockTrigger typetofunction-calland theSample time typetoperiodic,SampleTimeparameter becomes active. In this case,youspecify the sample time of theTriggerblock, which in turn, establishes the sample time of the subsystem.

There are four non-triggered subsystems:

  • Virtual

  • Enabled

  • Atomic

  • Action

金宝app®calculates the sample times of virtual and enabled subsystems based on the respective sample times of their contents.

The atomic subsystem is a special case in that the subsystem block has aSystemSampleTimeparameter. Moreover, for a sample time other than the default value of –1, the blocks inside the atomic subsystem can have only a value ofInf, –1, or the identical (discrete) value of the subsystemSampleTimeparameter. If the atomic subsystem is left as inherited, Simulink calculates the block sample time in the same manner as the virtual and enabled subsystems. However, the main purpose of the subsystemSampleTimeparameter is to allow for the simultaneous specification of a large number of blocks, within an atomic subsystem, that are all set to inherited. To obtain the sample time set on an atomic subsystem, use this command at the command prompt:

get_param(AtomicSubsystemBlock,‘SystemSampleTime’);

Finally, the sample time of the action subsystem is set by theIfblock or theSwitch Caseblock.

For non-triggered subsystems where blocks have different sample rates, Simulink returns the Compiled Sample Time for the subsystem as a cell array of all the sample rates present in the subsystem. To see this, use theget_paramcommand at MATLAB prompt.

get_param(subsystemBlock,'CompiledSampleTime')

Related Topics