Simulink.VariantManager.generateConfigurations
Class: Simulink.VariantManager
Package: Simulink
Syntax
Description
[
generates variant configurations for the given model vcdataobj
,configsInfo
] = Simulink.VariantManager.generateConfigurations(modelName
,Name=Value
)modelName
as
specified by optional Name=Value
arguments.
If Precondition
is specified and the AddPreconditionAsConstraint
argument is set to true
, the
corresponding condition is defined as a global constraint in the output object
vcdataobj
. The optional configsInfo
output
contains information on the validity of the generated configurations.
Input Arguments
Output Arguments
Limitations
The auto-generation process supports only
==
,~=
,&&
,||
, and~
operators 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 get generated.The process does not support generating variant configurations for these modeling elements:
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
Model that represents a library or subsystem
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.
Examples
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