Compose Variant Configurations for Top Model Using Referenced Model Configurations
A variant configuration represents a combination of variant choices across a Simulink® model hierarchy. It contains a set of variant control variables and their values, which can be used to activate a specific variation in the model hierarchy. Variant Manager allows you to create and manage the variant configurations for a model.
In Variant Manager, a variant configuration for a top-level model must also define the variant control variables used by any referenced components in the model hierarchy, such as referenced models. This approach helps to maintain a single consistent definition for a variant control across the hierarchy.
You can either directly add the variant control variables used by a referenced component to the top-level model configuration or if the referenced component has named variant configurations of its own, you can use them to set up the control variables in the top-level configuration. This topic explains how to use the Component Configurations view in Variant Manager to select the referenced component configurations to be used for the initialization.
Open Component Configurations View
To open the Component Configurations view for a top-level model configuration:
Open Variant Manager for the top-level model. On the Modeling tab, open the Design section and click Variant Manager.
Click the required configuration in the Configurations tab.
In the Control Variables section for the selected variant configuration, click Show Component Configurations. This action opens the Component Configurations view as a tab in the model hierarchy pane.
This image shows the Component Configurations tab for the
Select Variant Configuration for Referenced Component
Expand the model hierarchy in the Component Configurations tab.
Locate the required referenced component in the Component column of the hierarchy.
The Selected Configuration field for the component is set to
unsetby default. With this setting, you can directly add the control variables required by the component in the Control Variables table of the top-level configuration and update them with any valid custom value.
To use an existing named configuration, select it from the list in the Selected Configuration column. This action adds the control variables present in that configuration to the top-level model configuration.
In the Control Variables table of a top-level variant configuration, the control variables that are populated using a referenced component configuration are read-only and appear with a grey background color.
To close the tab, click Hide Component Configurations in the Control Variables section.
After selecting component configurations, you can use any of these options in the Manage tab to save or revert your changes:
To apply the changes to the global workspace (base workspace or data dictionary) of the model, click Apply changes.
To reload the variant configuration object from the global workspace used by the model, click Reload object. This allows you to revert the changes that are not yet exported to the global workspace.
To permanently save the changes in the variant configuration data object to a file, click Export to file.
A icon next to a component in the Component column indicates that it has predefined variant configurations.
Clear Selected Variant Configuration
You can unset the variant configuration that you specified for a referenced component from the Component Configurations tab. This action does not remove the control variables added to the top-level configuration previously.
To unset the variant configuration for a referenced component, in the
Component Configurations tab, in the Selected
Configuration column, select
unset. In the
Control Variables table, the control variables populated from this
configuration become editable.
Component Configurations View Example
In this example, the
External Plant component has two predefined
LowFid. Selecting one of
them adds or updates the corresponding control variable,
FidType, in the
top-level model configuration,
unset allows you to provide custom values.
Validate That Top-Level Model Uses Referenced Component Configuration
For a referenced model that has predefined variant configurations of its own, you can detect when a top-level model does not use one of these configurations to set up its own variant configurations. You can use the model configuration parameter Variant configuration not used by top model for a referenced model to specify the diagnostic action to take for such a scenario. This setting helps you to verify that the referenced model is used only for its tested variant configurations.
To open the Configuration Parameters dialog box, in the Simulink Editor, on the Modeling tab, click Model Settings.
Click the Diagnostics pane in the tree on the left side of the dialog box.
Point to the ellipsis toward the bottom of the dialog box and click Advanced parameters.
In the Modeling issues related to variants section, select the required option for the Variant configuration not used by top model parameter.