The Variant Manager is a central tool that allows you to manage various variation points that are modeled using variant blocks in a system model.
A model hierarchy may contain several variant blocks, each with many variant choices, combinations of which correspond to particular configurations of the system. Switching between variant choices and validating them manually can be complicated and erroneous.
Use the Variant Manager to create predefined configurations for a model, and use the model under any of the configurations. You can create the configurations by combinations of different variant choices across the model hierarchy.
Using the Variant Manager, you can:
Define, validate, and visualize variant configurations.
Define and validate constraints for the model.
Specify the default active configuration.
Set control variables to either integer, enumeration
with the model.
Validate a variant configuration or model without updating the model.
Reduce a variant configuration to reduce the model.
To open the Variant Manager, you can:
Right-click the variant badge and select Open in Variant Manager.
Right-click the variant block, and in the context menu, click Variant > Open in Variant Manager.
Select the variant block, and click Diagram > Variant > Open in Variant Manager.
Click Open block in Variant Manager available on the variant block's Block Parameter dialog box.
The Variant Manager window is divided into three panes:
The Variant Configuration Data pane which enables you to define variant configurations and constraints, and export them as variant configuration data objects.
The Model Hierarchy pane which enables you to visualize the variant hierarchy.
The Log pane which displays information on the source of control variables and validation errors.
Use this pane to create configurations, define control variables, associate referenced model configurations, and define constraints. The configurations and associated data are stored in a variant configuration data object.
After you add a variant configuration, enter a name for this configuration in the Name box and click Export to store it in the base workspace.
The Configurations tab is divided into upper and the lower panes. You can use the upper pane to add, delete, or copy a variant configurations. You can also set a default configuration.
The upper pane has these buttons to manage a variant configuration.
|Add variant configuration|
|Delete variant configuration|
|Duplicate variant configuration|
|Set/Clear default active configuration|
After a variant configuration is added, you can use the lower pane on the Configurations tab to add a description, control variables, and the submodel configurations for it. The lower pane contains these tabs:
Description — Provide a description for the selected variant configuration.
Control Variables — Add, delete, copy or import control variables. Toggle data type and import control variables from the workspace.
Add control variable
Delete the selected control variable
Create a copy of the selected control variable
Toggle type of a control variable
variable can be either a character vector or a
Import control variables from base workspace
Submodel Configurations — Define variant configuration for a referenced model.
Add or delete a referenced model configuration.
Use the Constraints tab to add or delete the model-level constraints. Similar to the Configurations tab, the Constraints tab also contains upper and lower panes.
The upper pane displays the name and condition of the constraints while the lower pane displays the description. The condition expression of the constraint must be satisfied by all variant configurations in the model.
You can visualize and explore the variant hierarchy of a model and edit the properties of variant blocks, variant choices, and variant objects from the Model hierarchy pane. This pane displays the Name, Submodel Configuration, Variant Control, and associated Conditions of variant objects used as variant controls.
Browse the hierarchy using the navigation icons. The controls on the Model hierarchy pane allow you to perform the following actions:
Refresh and validate hierarchy.
Display only variant blocks.
Navigate among active, invalid, and overridden variant choices.
Select a configuration from the Validate dropdown to refresh and validate the variant model for the selected configuration.
To re-validate the configuration and refresh the hierarchy, click .
Selectively display blocks in the variant hierarchy:
Select Model and variant blocks to display only model reference and variant blocks.
Select All hierarchical blocks to display all hierarchical blocks in the model.
The model hierarchy is displayed in a tree, with each block representing a node in the hierarchy. The hierarchy displays active, inactive, overridden, and invalid variants. You can edit referenced model configurations, variant controls, and variant conditions. Expand nodes to view the underlying blocks.
Note: Protected reference models cannot be viewed in the hierarchy.
The hierarchy table consists of these columns:
Name — Name of the model or block.
Submodel Configuration — Configurations used by referenced models. You can only edit the Submodel Configuration for rows that display models referenced by the top model.
Variant Control — Variant control parameter of a variant choice. This column is identical to the Variant Control column of the parameter dialog box of variant blocks. You can edit this column for variant choices across the hierarchy.
Condition — Displays and
allows you to edit the condition for the
when it is used as variant control. You can edit this column for variant
choices across the variant hierarchy.
Tip Right-click the item on the hierarchy table and use the Override using this Choice or the Open Parent Block Parameters options on the context menu, as necessary.
In the model hierarchy section, each block is represented with an icon. The following table displays the icons and the corresponding block name.
Inline Variants Block (Variant Source and Variant Sink
Variant Subsystem Block
Model Variant Block
Simulink® Function Block
Function Caller Block
Variant Sink output port
Variant Source output port
The Log pane displays information and validation results of the source of control variables for the models in the hierarchy.
For example, if a variant configuration is used for a referenced model, the referenced model name is displayed in the row along with name of the variant configuration data object and variant configuration. The pane also displays errors encountered during validation of the variant configuration.