Contenuto principale

Visualize and Interpret Variant Elements in Simulink Models

R2026b

You can use graphical interfaces to monitor which parts of a model are active to trace data flow and logic specific to each design alternative in large and complex models. However, for a comprehensive visualization of the model hierarchy and to centrally manage the use of variant elements such as variant blocks, variant parameters, and variant transitions across the hierarchy, use Simulink® Variant Manager™. For more information, see Simulink Variant Manager (Simulink Variant Manager).

Variant Legend

The Variant Legend dialog box helps you visualize the variant control expressions applied to the model. Simulink annotates model elements that have variant control expressions and the variant legend displays the control expressions for each annotation. See Visualize Propagated Variant Conditions and Bounded Regions in Variant Legend.

Variant legend dialog box showing propagated variant conditions that activate each variant choice

Variant Badges

Each variant block displays a badge. Right-clicking the badge provides quick access to common variant commands, such as opening the Block Parameters dialog box to edit variant choices and control expressions, and opening Simulink Variant Manager to configure and manage variant configurations. The color and icon of the badge change based on the values of Variant activation time, Variant control mode, Allow zero active variant controls (for Variant Source and Variant Sink blocks), and Propagate conditions outside of variant subsystem parameters set on the block (for Variant Subsystem block).

Variant badge on variant block

Note

The Refresh Blocks option on the variant badge does not re-evaluate the variables that are defined in the mask workspace of the variant blocks. For example, consider a masked Variant Subsystem block with the variant control variable defined in the mask workspace of the block. To change the active choice of the block, you change the value of the variant control variable. When you then click the Refresh Blocks option, the variant control variable is not re-evaluated and so the active choice of the block is not updated. You must click Apply on the mask dialog box or update the diagram for the latest active choice to reflect.

Variant Settings

Variant Source

Variant Sink

Variant Subsystem

Variant blocks with default Variant badge.

The Variant Source block showing two overlapping white squares at the bottom-left corner

The Variant Sink block showing two overlapping white squares at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner

Variant blocks with Variant control mode set to Label and an active variant choice is selected for the Label mode active choice option

The Variant Source block showing a grey square overlapping a white square at the bottom-left corner

The Variant Sink block showing a grey square overlapping a white square at the bottom-right corner

The Variant Subsystem block showing a grey square overlapping a white square at the bottom-left corner

  • Variant Source and Variant Sink blocks with Allow zero active variant controls option selected.

  • Variant Subsystem block with Built-in empty choice or Built-in passthrough choice option selected.

The Variant Source block showing a ground icon with two overlapping white squares at the bottom-left corner

The Variant Sink block showing a signal resolution icon with two overlapping white squares at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner

Variant blocks with Variant control mode set to expression and Variant activation time set to update diagram.

The Variant Source block showing two overlapping white squares at the bottom-left corner

The Variant Sink block showing two overlapping white squares at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner

Variant blocks with Variant control mode set to expression and Variant activation time set to update diagram analyze all choices.

The Variant Source block showing two overlapping white squares with two horizontal lines in the front square at the bottom-left corner

The Variant Sink block showing two overlapping white squares with two horizontal lines in the front square at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares with two horizontal lines in the front square at the bottom-left corner

Variant blocks with Variant control mode set to expression and Variant activation time set to code compile.

The Variant Source block showing two overlapping white squares at the bottom-left corner. The front square has a grid of two horizontal and two vertical black lines.

The Variant Sink block showing two overlapping white squares at the bottom-right corner. The front square has a grid of two horizontal and two vertical black lines.

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner. The front square has a grid of two horizontal and two vertical black lines.

Variant blocks with Variant control mode set to expression and Variant activation time set to startup.

The Variant Source block showing two overlapping white squares with an S icon in the front square at the bottom-left corner

The Variant Sink block showing two overlapping white squares with an S icon in the front square at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares with an S icon in the front square at the bottom-left corner

Variant blocks with Variant control mode set to sim codegen switching and Variant activation time set to update diagram.

The Variant Source block showing two overlapping white squares with a forward slash in the front square at the bottom-left corner

The Variant Sink block showing two overlapping white squares with a forward slash in the front square at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares with a forward slash in the front square at the bottom-left corner

Variant Subsystem block with Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left

  • Variant Source and Variant Sink blocks with Variant activation time set to update diagram and Allow zero active variant controls option selected.

  • Variant Subsystem block with Variant activation time set to update diagram, and Built-in empty choice or Built-in passthrough choice option selected.

The Variant Source block showing a ground icon with two overlapping white squares at the bottom-left corner

The Variant Sink block showing a signal resolution icon with two overlapping white squares at the bottom-right corner

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner

  • Variant Source and Variant Sink blocks with Variant activation time set to update diagram analyze all choices and Allow zero active variant controls option selected.

  • Variant Subsystem block with Variant activation time set to update diagram analyze all choices, and Built-in empty choice or Built-in passthrough choice option selected.

The Variant Source block showing a ground icon with two overlapping white squares at the bottom-left corner. The front square has two horizontal black lines.

The Variant Sink block showing a signal resolution icon with two overlapping white squares at the bottom-right corner. The front square has two horizontal black lines.

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner

  • Variant Source and Variant Sink blocks with Variant activation time set to code compile and Allow zero active variant controls option selected.

  • Variant Subsystem block with Variant activation time set to code compile, and Built-in empty choice or Built-in passthrough choice option selected.

The Variant Source block showing a ground icon with two overlapping white squares at the bottom-left corner. The front square has a grid of two horizontal and two vertical black lines.

The Variant Sink block showing a signal resolution icon with two overlapping white squares at the bottom-right corner. The front square has a grid of two horizontal and two vertical black lines.

The Variant Subsystem block showing two overlapping white squares at the bottom-left corner. The front square has a grid of two horizontal and two vertical black lines.

  • Variant Source and Variant Sink blocks with Variant activation time set to startup and Allow zero active variant controls option selected.

  • Variant Subsystem block with Variant activation time set to startup, and Built-in empty choice or Built-in passthrough choice option selected.

The Variant Source block showing a ground icon with two overlapping white squares at the bottom-left corner. The front square has a black S icon.

The Variant Sink block showing a signal resolution icon with two overlapping white squares at the bottom-left corner. The front square has a black S icon.

The Variant Subsystem block showing two overlapping white squares with an S icon in the front square at the bottom-left corner.

Variant blocks with Variant activation time set to inherit from Simulink.VariantControl.

The Variant Source block showing a ground icon with two overlapping white squares at the bottom-left corner

The Variant Sink block showing a ground icon with two overlapping white squares at the bottom-right corner

The Variant Subsystem block showing a ground icon with two overlapping white squares at the bottom-left corner

Variant Subsystem block with Variant activation time set to update diagram and Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left

Variant Subsystem block with Variant activation time set to update diagram analyze all choices and Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left. The front square has two horizontal black lines.

Variant Subsystem block with Variant activation time set to code compile and Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left. The front square has a grid of two horizontal and two vertical black lines.

Variant Subsystem block with Variant activation time set to startup and Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left. The front square has a black S icon.

Variant Subsystem block with Built-in empty choice option selected, and Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left

Variant Subsystem block with Built-in pass through choice and Propagate conditions outside of variant subsystem options selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left

Variant Subsystem block with Variant control mode set to sim codegen switching and Propagate conditions outside of variant subsystem option selected.

Not applicable

Not applicable

The Variant Subsystem block showing two overlapping squares with arrows extending diagonally up-right and down-left. The front square has a black forward slash.

Variant Fading

The inactive variant choices are dimmed in the block diagram by default. You can disable the fading effect by using Variant Fading in the Information Overlays menu on the Debug tab of the Simulink Editor. For more information, see Inactive Variant Choice.

Faded inactive variant choice of Variant Sink block

Signal Highlighting

Signal highlighting visually distinguishes active and inactive variant choices to identify which parts of the model are active for a given variant configuration. This feature enables you to trace data flow and logic specific to each variant implementation in large and complex models. For more information, see Signal Highlighting in Variant Systems.

Highlighted Variant Sink block and the connected elements

Start and End Bounded Regions

Highlighting the blocks within a bounded region created by the Variant Start and Variant End blocks enables you to visually distinguish them from other components. This feature allows you to trace data flow and logic specific to each variant implementation in large and complex models. For more information, see Limit Variant Condition Propagation Within Bounded Regions Using Variant Start and Variant End Blocks.

First-order and second-order systems within a bounded region formed by Variant Start and Variant End blocks, with the second-order system active.