Main Content

getAlwaysActiveBlocks

Class: Simulink.VariantConfigurationAnalysis
Namespace: Simulink

List of blocks that are always active across named variant configurations

Description

Use this method to find the blocks that are always active across all named variant configurations after analyzing them using the Simulink.VariantConfigurationAnalysis class. You must create a variant configuration analysis object of type Simulink.VariantConfigurationAnalysis for a model and use it to analyze the required named variant configurations for that model before calling the getAlwaysActiveBlocks method.

Note

This method requires Variant Manager for Simulink®.

example

alwaysActiveBlocks = varConfigObj.getAlwaysActiveBlocks() returns the list of blocks that are always active across all the named variant configurations that have been analyzed using a VariantConfigurationAnalysis object. varConfigObj is the VariantConfigurationAnalysis object for a model.

Output Arguments

expand all

List of blocks that are active across all the named variant configurations that are analyzed, returned as a cell array.

Examples

expand all

This example shows how to use the Simulink.VariantConfigurationAnalysis class to analyze variant configurations programmatically.

To analyze variant configurations using Variant Manager, see Analyze Variant Configurations in Models Containing Variant Blocks.

Open the model slexVariantConfigurationAnalysis.

open_system('slexVariantConfigurationAnalysis'); 

You can provide either a list of named variant configurations or the variable groups to analyze to the Simulink.VariantConfigurationAnalysis class. The operation returns a variant configuration analysis object for the model.

varConfigObjNamedConfig = Simulink.VariantConfigurationAnalysis('slexVariantConfigurationAnalysis', ...
                           'NamedConfigurations', {'VendorACtrlLinear', ...
                           'VendorACtrlNonLinear', 'VendorACtrlFuzzy'})
varConfigObjNamedConfig = 
  VariantConfigurationAnalysis with properties:

         ModelName: 'slexVariantConfigurationAnalysis'
    Configurations: {'VendorACtrlFuzzy'  'VendorACtrlLinear'  'VendorACtrlNonLinear'}

varConfigObjVarGroup = Simulink.VariantConfigurationAnalysis('slexVariantConfigurationAnalysis',...
                          'VariableGroups', [struct('Name', 'VendorANonLinear',...
                          'VariantControls', {{'CONTROLLER', 1, 'EXTERNAL_SENSOR', 1, 'ORDER', 1, 'SATURATE', 1, 'VENDOR', 1}}),...
                           struct('Name', 'VendorALinear',...
                          'VariantControls', {{'CONTROLLER', 0, 'EXTERNAL_SENSOR', 1, 'ORDER', 1, 'SATURATE', 1, 'VENDOR', 1}})]);

You can use the variant configuration analysis object to analyze the variant configurations using different methods specified in the following steps.

Get the list of active blocks in the variant configuration VendorACtrlLinear.

activeblocks = varConfigObjNamedConfig.getActiveBlocks('VendorACtrlLinear');

Get the list of blocks that are always active across all the named variant configurations that have been analyzed.

alwaysActiveBlocks = varConfigObjNamedConfig.getAlwaysActiveBlocks();

Get the list of blocks that are active in some of the analyzed variant configurations and inactive in other configurations.

getBlockDifferences = varConfigObjNamedConfig.getBlockDifferences();

Get the list of dependent libraries for a variant configuration.

dependentLibraries = varConfigObjNamedConfig.getDependentLibraries('VendorACtrlNonLinear');

Get the list of dependent models for a variant configuration.

dependentModels = varConfigObjNamedConfig.getDependentModels('VendorACtrlFuzzy');

Get the list of blocks that are inactive in all the named variant configurations that have been analyzed.

neverActiveBlocks = varConfigObjNamedConfig.getNeverActiveBlocks();

Get the variant condition on a block in a named variant configuration.

variantCondition = varConfigObjNamedConfig.getVariantCondition('VendorACtrlNonLinear',...
'slexVariantConfigurationAnalysis/Controller/NonLinear');

Show the variant configuration analysis report for a model after analyzing it.

varConfigObjNamedConfig.showUI();

Hide the variant configuration analysis report for a model after analyzing it.

varConfigObjNamedConfig.hideUI();

Version History

Introduced in R2019a