Main Content

Union Rate

The union sample time of a system is one sample time that unites two or more event sample times.

In the figure, E1 and E2 are independent events that do not preempt each other. The sample time of C is E3 which is computed using E3 = union(E1,E2). . For example, if an Outport block receives a union sample time of 2 and 3, then the block runs twice at 0 sample time, once for sample time 2, once for sample time 3, then at 2, 3, 4, twice again at 6, and so on. For more details on sample time, see What Is Sample Time?.

You can expect union sample time in these scenarios:

  • Root-level Inport block – When Allow multiple tasks to access inputs and outputs is enabled for non-export function models, or when a root-level Inport block has multiple destinations in at least two different tasks. Union sample time may occur these situations.

    • Two destinations have different discrete rates and the model setting Treat each discrete rate as a separate task is enabled.

    • Two destinations have different explicit partitions.

    • Two destinations have exported function-call subsystems in an export-function model.

  • Root-level Outport block and Merge block – When a Merge block receives input from sources in at least two different tasks and is connected to the root Outport block. Union sample times may occur in these situations:

    • Two blocks with discrete rates have the model setting Treat each discrete rate as a separate task enabled, such that the blocks in different tasks, and write to a Merge block connected to a root Outport block.

    • Two explicit partitions write to a Merge block that is connected to the root output.

    • Two exported function-call systems write to the root output via a Merge block.

  • Model block – When Allow multiple tasks to access inputs and outputs is enabled for non-export function models, or when ports of the Model block are accessed in multiple tasks inside the referenced model. Union sample time may occur in these situations:

    • Two discrete rates read or write from the root input or output ports of the referenced model, and Allow multiple tasks to access inputs and outputs is enabled in the referenced model. In this case, the Model block will get a union rate on its ports if Treat each discrete rate as a separate task is enabled in both the referenced and the top models.

    • Two explicit partitions access the input or output ports in a referenced model. In this case, the Model block inputs or outputs will get a union rate.

    • Two exported functions access the input or output ports in a referenced export-function model. In this case, the Model block will have a union rate if Allow multiple tasks to access inputs and outputs is enabled in the top model.

  • Function-call subsystem and Model block with function-call ports – When the function-call ports are fed by a muxed signal containing functions calls with different sample times. Union sample time may occur in these situations:

    • A function-call subsystem is called by two callers.

    • A function-call port on a Model block is called by two callers.

    • A Simulink® function has two callers that have different rates in different tasks.

Related Topics