Simulink.VariantManager.generateConfigurations
Syntax
Description
[
generates variant configurations for the given model vcdo
,configsInfo
] = Simulink.VariantManager.generateConfigurations(modelName
,Name=Value
)modelName
as
specified by one or more optional name-value arguments.
If Precondition
argument is specified and the AddPreconditionAsConstraint
argument is set to true
, the
corresponding condition is defined as a global constraint in the output object
vcdo
. The optional configsInfo
output contains
information on the validity of the generated configurations.
Note
To use this function, you must install the Variant Manager for Simulink® support package.
Examples
Input Arguments
Output Arguments
Limitations
Automatic configuration generation supports only logical operators
==
,~=
,&&
,||
, and~
in the variant control expressions of variant blocks and in the preconditions. If the variant control expressions use other operators such as arithmetic or relational operators, the configurations that can activate those variant choices might not be generated.Automatic configuration generation does not support generating variant configurations for these modeling elements:
Models that contain variant blocks that use variant control variables defined in the mask or model workspace.
Variant blocks with a Variant control expression that contains noninteger double values, structure fields, or
Simulink.Parameter
objects with value set to an expression of typeslexpr
Variant parameter objects of type
Simulink.VariantVariable
Models that represent libraries or subsystems
For variant blocks with the Variant control mode parameter set to
label
, the variant control labels are strings, not variables. Hence they are not present in the generated configurations.For Variant Subsystem blocks, these conditions also apply:
If the Variant control mode parameter is set to
label
, only the variations present in the active label path are considered when you generate configurations.Consider this model hierarchy for a model with a Variant Subsystem block in
label
mode. The active choice for the variant subsystem is the Subsystem block, which has its variant control set to a label,SUB1
. The variant control variableA
is used by the active choice and is considered when you generate configurations. The process does not consider the control variableB
because it is in the inactive choice of the variant subsystem.Here is the list of all generated configurations.
If the Variant control mode parameter is set to
sim codegen switching
, only the variations present in thesim
choice are considered when you generate configurations. For the variant controls present in thecodegen
hierarchy, only the default values are included in the generated configurations.Consider this model hierarchy for a model with a Variant Subsystem block in
sim codegen switching
mode. Thesim
choice for the variant subsystem is the Subsystem block. The variant control variableB
present in this choice is considered when you generate configurations. The process only considers the default value for the control variableC
because it is in thecodegen
choice of the variant subsystem.Here is the list of all generated configurations.
If the Variant activation time is set to
update diagram
, only the variations in the active choice are considered for generating configurations.
Tips
You can use the intersect
, setdiff
,
union
, and unique
methods in the
Simulink.VariantConfigurationData
class to perform set operations on variant
configuration data objects. See Specialized Operators and Functions.
Version History
Introduced in R2022b