Specify Bus Signal Sample Times

The technique that you use to combine signals that use different sample times depends on the virtuality of the bus.

  • Virtual buses can combine signals that have different sample times.

  • Nonvirtual buses require that every element signal has the same sample time.

Sample Times for Nonvirtual Buses

All signals in a nonvirtual bus must have the same sample time, even if the elements of the associated bus object specify inherited sample times. Any bus operation that results in a nonvirtual bus that violates this requirement generates an error. All buses and signals input to a Bus Creator block that outputs a nonvirtual bus must have the same sample time.

To include signals or a bus in a nonvirtual bus that has elements with different sample times, you can change the sample time of bus element signals by inserting Rate Transition blocks upstream of the Bus Creator block.

However, some blocks automatically convert virtual buses to nonvirtual buses. Examples of these kinds of blocks include as root-level Outport and Inport blocks, MATLAB Function, and S-Function blocks. You can use a single Rate Transition block after a Bus Creator block to transition all the signal elements to a single sample time.

For more information about automatic conversion of virtual buses to nonvirtual buses, see Bus Conversion.

Specify Sample Times for Signal Elements

To control the sample time of each signal element in a bus, specify the sample time in the Block Parameters dialog box of the block that generates the signal element.

To specify a sample time for a signal in a Simulink.Bus object, a best practice is to use the default SampleTime value of -1.

See Also



Related Topics