Variant Terminology
Simulink® variant terminology helps you to understand various parameters and terms.
Variant Terminology | Description |
---|---|
Variant Subsystem | Contains one or more choices where each choice is a Subsystem or Model block. |
Variant Source | Provides variation on the source of a signal. |
Variant Sink | Provides variation on the sink (destination) of a signal. |
Variant Model | Variant Subsystem block containing Model block as variant choices. See Variant Subsystem. |
Active choice | Variant choice associated with a variant control that evaluates to
true . |
Variant control mode |
|
Variant control variable | MATLAB® variable, Simulink.VariantExpression object, or a
Simulink.Parameter object. See Types of Variant Control Variables (Operands) in Variant Blocks. |
Variant object | Container of variant control expression. See Simulink.VariantExpression . |
Variant Manager | Central tool that allows you to manage various variation points that are modeled using variant blocks in a system model. |
Variant Reducer | Reduces variant models to simplified, standalone model depending on the selected variant configurations. |
Variant Configuration, Variant Configuration data object | A variant configuration consists of a named set of variant control variables, their values, and configurations to be used by referenced models. It can be used to activate a variation of a Simulink model. A variant configuration data object (instance of
the
You can create new variant configurations and group them into a variant
configuration data object from Variant Manager or programmatically using the To associate the
variant configuration data object to a model, use the Export variant configuration
data object functionality in Variant Manager, or use the
variantConfig = Simulink.VariantConfigurationData; set_param(model, 'VariantConfigurationObject',... 'variantConfig'); |
Command Line Parameters
Variant Subsystem Parameters
This section lists the command line parameters you can use to control a Variant Subsystem block during simulation or code generation.
You can add variant choices to the Variant Subsystem block using the
add_block
command:
add_block('simulink/Ports & Subsystems/', ... [ModelName '/
BlockName
'], ... VariantControl='
VariantSubsystemChoicePath
');
VariantControlName
BlockName
is the block to add as a
variant choice to the Variant Subsystem block at path
VariantSubsystemChoicePath
in the model
ModelName
.
VariantControlName
is the name of the
variant control for the newly added variant choice.For example, to add the Subsystem block named
Discrete
as a variant choice to the Controller
subsystem in the slexVariantSubsystemsAdaptiveInterface
model, use this
command. Specify the variant control as V ==
3
.
add_block('simulink/Ports & Subsystems/Subsystem', ... 'slexVariantSubsystemsAdaptiveInterface/Controller/Discrete', ... VariantControl='V == 3');
Note
If you do not specify a variant control, a variant block with an empty variant control is created. You are then required to specify the variant control parameter in the subsequent line of code.
Parameter name | Description |
---|---|
Variant | Used to check if the subsystem is a Variant Subsystem
block. Returns This is a read-only parameter. |
VariantChoices | Gets the list of variant choices in a Variant Subsystem
block. Example: Returns a 1-by-N struct array with fields:
This is a read-only parameter. |
VariantControl | Subsystem block and Model block parameter, which applies to a choice block of a Variant Subsystem block and returns the variant control for the choice block.
|
VariantControlMode | Specifies the mode for modeling Variant blocks, which can be either
See Variant control mode. |
LabelModeActiveChoice | Returns the variant control label of the selected choice for the
Variant Subsystem block when
|
TreatAsGroupedWhenPropagatingVariantConditions | Returns
See Propagate Variant Conditions to Define Variant Regions in Virtual and Nonvirtual Subsystems. |
GeneratePreprocessorConditionals
| Indicates if all the choices are to be analyzed and preprocessor
conditionals to be generated by returning
Note Use the Variant activation time parameter instead.
|
CompiledActiveChoiceControl | Returns the variant control corresponding to the active choice of the
Variant Subsystem block and returns empty This is a read-only parameter. |
CompiledActiveChoiceBlock | Returns the full block path name of the active Variant
Subsystem block choice. If Allow zero active variant
controls is This is a read-only parameter. |
CompiledVariantInfo | Block parameter that indicates the variant activeness of a block
after model compilation. Returns a structure with three
fields, with values set to
For an example, see Identify Variant Activeness of a Block After Model Compilation. This is a read-only parameter. |
CompiledVariantActivationTime | Returns the variant activation time of the block after model
compilation. Before the model is compiled, this parameter returns update diagram
activation time. Example:
This is a read-only parameter. |
PropagateVariantConditions | Indicates if conditions on ports inside the Variant Subsystem block are to be propagated outside the block.
|
AllowZeroVariantControls
| Indicates if the Variant Subsystem block is allowed to have no active choices.
|
VariantActivationTime | Determines if Simulink sets the active choice of a Variant Subsystem block during update diagram or code compile.
Note The
|
VariantControlVariable | Specifies the variant control variable of a Variant Assembly
Subsystem block that is in
|
VariantChoicesEnumeration | Specifies the variant choices of a Variant Assembly
Subsystem block that is in
|
VariantChoicesSpecifier | Specifies the variant choices of a Variant Assembly
Subsystem block that is in
|
AllowFlexibleInterface | Indicates if the Variant Subsystem block has a flexible interface.
|
Variant Source and Variant Sink Parameters
This section lists the command line parameters you can use to control Variant Source and Variant Sink blocks during simulation or code generation.
You can add these blocks using the add_block
command:
add_block('simulink/Signal Routing/', ... [ModelName '/
BlockName
']
VariantBlockPath
BlockName
is the variant block to be
added to VariantBlockPath
in model
ModelName
.For example, to add the Variant Source block named
Discrete
in the slexVariantSourceAndSink
model,
use this command. Specify the variant control as V ==
3
.
add_block('simulink/Signal Routing/Subsystem', ... 'slexVariantSourceAndSink/Discrete', ... VariantControl='V == 3');
Parameter name | Description |
---|---|
VariantControls | Returns a
|
VariantControlMode | Specifies the mode for modeling variant blocks, which can be either
See Variant control mode. |
LabelModeActiveChoice | Returns the variant control label of the selected choice for
Variant Source or Variant Sink block when
|
GeneratePreprocessorConditionals
| Indicates if all the choices are to be analyzed and preprocessor
conditionals to be generated by returning
Note Use the Variant activation time parameter instead.
|
ShowConditionOnBlock | Indicates if the
|
AllowZeroVariantControls
| Indicates if the block is allowed to have no active ports by returning
|
CompiledActiveVariantControl
| Returns the variant control corresponding to the active port from the
last compilation instance. If no port is active, returns empty This is a read-only parameter. |
CompiledActiveVariantPort | Returns the "index" of the active port from the last compilation
instance or returns This is a read-only parameter. |
CompiledVariantActivationTime | Returns the variant activation time of the block after model
compilation. Before the model is compiled, this parameter returns update diagram
activation time. Example:
This is a read-only parameter. |
OutputFunctionCall | Indicates if the Variant Source or Variant Sink blocks are allowed to output function-call signals.
See Output function call. |
Examples
Identify Variant Activeness of a Block After Model Compilation
This example shows the behavior of the CompiledVariantInfo
command line parameter. Consider a model with two Variant Subsystem blocks,
StartupVSS
and UDVSS
, with the Variant activation time parameter set to
startup
and update diagram
, respectively. The
result of CompiledVariantInfo parameter after model compilation is
shown for each variant choice.
The active choice in both
StartupVSS
andUDVSS
hasIsInStartup
set toon
because the blocks are active in simulation.The inactive choice in
StartupVSS
gets the propagatedstartup
variant activation time from its parent, soIsInStartup
ison
.The inactive choice in
UDVSS
has theupdate diagram
variant activation time, soIsInStartup
isoff
.