Analyze Variant Configurations in Models Containing Variant Blocks
Overview of Variant Configurations
A model hierarchy may contain several variant blocks, each with many variant choices. You must associate each variant choice in a model with a variant control that is used to determine if the choice is active or inactive. A combination of these variant choices represents a specific implementation of the system being modeled. It also corresponds to a specific variant path in the model.
A variant configuration is used to represent such a combination of variant choices. It contains a set of variant control variables and their values, using which you can activate a specific variant path in the model. The number of variant configurations for a model can be high depending on the number of variant control variables used in the model. You can use Variant Manager to create and manage such variant configurations. You can use the Variant Configuration Analysis tool to compare and analyze these configurations.
Analyze Variant Configurations Using the Variant Configuration Analysis Tool
You require a Simulink® Design Verifier™ license to use the Variant Configuration Analysis Tool.
The Variant Configuration Analysis tool allows you to :
Compare different variant configurations for a model.
Check if all variant choices have been activated at least once, and that the model is covered completely for simulation and code generation.
Verify if the active, implemented model is different between different variant configurations.
Get information on the dependent models and libraries used for a particular variant configuration.
You can analyze the named variant configurations created for the model, or perform an analysis after setting values for the variant control variables. The report generated by the tool displays:
The variant configurations analyzed.
The model hierarchy with all the blocks.
The variant activeness of each block in each variant configuration.
The propagated variant condition on a block for each variant configuration.
The analysis results helps you to determine which blocks are used in different variant configurations. The unused blocks are highlighted in red, which represents untested and uncovered parts of the model. The heatmap view helps you determine the similarities and differences in the active, implemented model between different variant configurations. This information can be used to refine the variant configurations and to update the model to provide full simulation coverage across all variant configurations.
How to Run the Variant Configuration Analysis Tool for a Model
Open a model containing variant blocks. For example, Variant Configuration Analysis.
This model contains multiple vendor choices for the sensors and different controller implementations based on the sensor input. The choice of vendor sensors is modeled with Variant Source and Variant Sink blocks. The different controller choices is modeled using Variant Subsystem block.
Open Variant Manager. On the Modeling tab, open the Design section and click Variant Manager. Alternatively, right-click the variant badge on any variant block and select Open in Variant Manager.
The Variant Manager opens and displays the predefined configurations.
Click Analyze. The Variant Configuration Analysis dialog box opens.
In the Analysis mode, choose whether to analyze the predefined named configurations for the model or if you need to specify values for the variant control variables.
Specify variant configurations: Select from the list of named variant configurations under Named configurations or select Named configurations to select all of them.
Specify variant control values: If you select this option, you can create multiple variable groups that correspond to different configurations. To create a new variable group, click New variable group and set the values for variant control variables. You can either specify a variant control value or select
Ignoredfrom the drop-down list. If you select
Ignored, then that variant control variable is not considered while analyzing the model.
Click Analyze. The report for analyzed variant configurations opens.
In this example, Specify variant configurations is selected in Analysis mode.
Explore the Variant Configuration Analysis Report
The variant configuration analysis report displays a tree-table view of the model hierarchy and all of the analyzed variant configurations. This table explains the icons and formatting used in the report.
Rows and Columns
Each row in the table corresponds to a block in the model and each column represents a variant configuration.
The symbol is for visual aid and indicates that the block is active in the corresponding variant configuration.
An entire row including the block name appears with red background color if it is not active in any of the variant configurations. Such a block indicates an untested path in the model. A table field with red background color indicates that a particular block is not active in a specific configuration.
For example, in this model, the Vendor A block is active in the variant configurations VendorACtrlLinear, VendorACtrlFuzzy, VendorACtrlNonLinear and is inactive in the variant configurations VendorBCtrlFuzzy, VendorBCtrlLinear, VendorBCtrlSecondOrder, and VendorBCtrlNonLinear.
Block activeness icons
The | | icons in the Activeness column indicates if a block is active in all the configurations, active in some configurations, or inactive in all configurations, respectively.
Variant condition annotations (c:#)
The annotations in the table fields represent a variant condition that the block receives for a particular configuration. The propagated variant condition on a block changes according to the active variant configuration.
You can refer the table in the Annotation pane for the mapping between the annotations (c:#) and the propagated variant conditions that each of them represent. The propagated variant conditions help you understand why a block is active for a given variant configuration (the variant condition is evaluated based on the values of the control variables defined in the configuration). Click on an annotation in the table. All the blocks that have that annotation appear highlighted in the configurations table.
The controls on the Variant Configuration Analysis window allow you to perform the following actions:
Search for blocks.
Filter the results based on the type of block.
Select an option from the View Blocks list:
Variant to display only variant blocks in the model.
Hierarchical to display all hierarchical blocks (for example, Subsystem or Model blocks) in the model. This view allows you to explore subsystems or model references one-by-one instead of looking through the complete model.
All blocks to display all blocks in the model.
Filter the results based on block activeness.
Always Active displays blocks that are always active in the model.
Partially Active displays blocks that are active in some configurations and inactive in others among the selected configurations.
Never Active displays blocks that are never active in the model. These blocks appear highlighted in red which indicates they are untested and uncovered parts of the model and require some updates to provide full simulation coverage.
For example, this image shows a model with several unused blocks. Never Active option is selected to view the unused blocks.
The blocks in the Second order controller inside the Linear_Control and F1_Unsat filter are unused. To make these unused blocks part of the active model in at least one of the variant configurations, modify the model or update the variant configurations.
This image shows a model with two identical variant configurations. Partially Active option is selected to get this result.
The variant configurations VendorBCtrlLinear and VendorBCtrlSecondOrder have no differences between them. This indicates that the resulting active model for both these configurations will be same. To resolve this, update the variant configurations or update the model appropriately.
Variant Configuration Analysis tool does not support variant blocks with the
Variant activation time parameter set to