Simulink.VariantConfigurationAnalysis - Analyze variant configurations programmatically - MATLAB (original) (raw)

Namespace: Simulink

Analyze variant configurations programmatically

Description

Note

This class requires Variant Manager for Simulink®.

Use the Simulink.VariantConfigurationAnalysis class to analyze variant configurations for a model by specifying either named variant configurations or variable groups. The class returns a variant configuration analysis object and has methods that can be used to:

Creation

`varConfigObj` = Simulink.VariantConfigurationAnalysis(`mdl`,[Name,Value](#namevaluepairarguments)) returns a variant configuration analysis object for the model specified bymodel and sets the ModelName andConfigurations properties.

Name-Value Arguments

expand all

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'NamedConfigurations', {'config1', 'config2'}

Names of variant configurations, specified as a string or a cell array of strings. Use this argument to perform the analysis by specifying named variant configurations defined for the model.

You can use Variant Manager to create named variant configurations for a model, save them in a variant configuration object of type Simulink.VariantConfigurationData, and associate this object with the model. You can specify one or more configuration names defined in this variant configuration object for the analysis.

Note

If the model is associated with a variant configuration object, then theVariantConfigurationObject model parameter contains the name of the corresponding variant configuration object.

Example: NamedConfigurations={'config1', 'config2'}

Variant control variable names and values, specified as an array of structures. Use this argument to perform the analysis by specifying values for the variant control variables used by the model.

You can specify multiple variable groups that represent the different variant configurations to be analyzed. In each variable group, you must specify the variant control variables and their values that must be used for the analysis.

To define the variable groups, provide an array of structures with these fields:

Example: 'VariableGroups',[struct('Name', 'V1W1',... 'VariantControls', {{'V',1,'W',1}}),struct('Name', 'V1W2',... 'VariantControls', {{'V',1,'W',2}})]

Note

Specifying both NamedConfigurations andVariableGroups is not supported.

Properties

expand all

Name of model to be analyzed, specified as a character vector.

Example: 'slexVariantReducer'

Attributes:

GetAccess public
SetAccess private

Data Types: character vector

Names of variant configurations or variable groups to be analyzed, specified as a cell array of strings.

Example: {'config1', 'config2'}

Attributes:

GetAccess public
SetAccess private

Data Types: character vector

Examples

collapse all

Create a variant configuration analysis object by specifying either named variant configurations or variable groups.

Open the model slexVariantReducer.

open_system('slexVariantReducer');

The model has two named variant configurations, config1 and config2. The named configurations are saved in a variant configuration object, slexVariantReducer_config, associated with the model.

Analyze the model using the named configurations.

VarConfigObjnc = Simulink.VariantConfigurationAnalysis('slexVariantReducer', ... 'NamedConfigurations',{'config1', 'config2'})

VarConfigObjnc = VariantConfigurationAnalysis with properties:

     ModelName: 'slexVariantReducer'
Configurations: {'config1'  'config2'}

Next, specify variable groups for analysis.

The slexVariantReducer model contains two variant control variables V and W.

Analyze the model using two variable groups, V1W1 and V2W2:

VarConfigObjvg = Simulink.VariantConfigurationAnalysis(... 'slexVariantReducer',... 'VariableGroups',[struct('Name','V1W1','VariantControls', {{'V',1,'W',1}}),... struct('Name', 'V1W2','VariantControls',{{'V',1,'W',2}})])

VarConfigObjvg = VariantConfigurationAnalysis with properties:

     ModelName: 'slexVariantReducer'
Configurations: {'V1W1'  'V1W2'}

Limitations

Variant Analyzer does not support models that contain variant blocks that use variant control variables defined in the mask or model workspace.

Version History

Introduced in R2019a