Variant Management

Variant Manager

Using the Variant Manager, you can define and manage variant configurations in the following ways.

  • Explore, visualize, and manipulate variant hierarchy.

  • Define, validate, and visualize variant configurations.

  • Define constraints models must satisfy.

  • Specify the default variant.

  • Associate variant configuration data object of type Simulink.VariantConfigurationData with models.

  • Define variant configurations, constraints, and export them as a variant configuration data objects.

  • Validate variant configurations without updating the model.

The Variant Manager enables you to specify the following information.

  • Variant configuration data: The variant configuration object stores a collection of variant configurations, constraints, and the default configuration.

  • Configuration: The configuration defines a set of variant control variables and values, referenced model configurations, and constraints that must be satisfied. Constraints are expressions that evaluate to a Boolean value.

  • Control Variables: Specify name-value pairs defined as structures having fields Name and Value. Simulink® verifies the values of the control variables when validating the configuration. Variant control variables determine the active variant.

  • Submodel Configurations: Specify variant configurations for models referenced by model reference blocks.

Considerations in Model Hierarchy Validation

  • For a model or referenced model that has a variant configuration data object with a default configuration defined, the control variables from the default configuration are loaded to the base workspace and are used for validation.

  • When you define a configuration as the default one, any configurations you define later are superseded by the default configuration during model compilation.

    For example, consider two configurations: config1 (V==1 && W==2) and config2 (V==1 && W==2). Here, config2 is the default configuration. If you validate your model using config1, Simulink populates the base workspace or data dictionary with V = 1 and W = 1. However, when you compile your model, config2 supersedes config1. Simulink pushes V = 1 and W = 2 to the base workspace or data dictionary, overwriting the previous values of the variables and using config2 for validation.

  • For referenced models, if the top model specifies the variant configuration, that specific variant configuration is used to validate the referenced models.

  • For a model containing referenced models, you can have multiple variant configurations that use common set of control variables and referenced model configurations. In such cases, all the variant configurations must have the same values for control variables and referenced model configurations.

See Also

Related Examples

Was this topic helpful?