Main Content

Variant Terminology

Simulink® variant terminology helps you to understand various parameters and terms.

Variant TerminologyDescription
Variant Subsystem, Variant ModelContains one or more choices where each choice is a Subsystem or Model block.
Variant SourceProvides variation on the source of a signal.
Variant SinkProvides variation on the sink (destination) of a signal.
Variant ModelVariant Subsystem block containing Model block as variant choices.
Active choiceVariant choice associated with a variant control that evaluates to true.
Variant control expressionBoolean expression or a Simulink.Variant object containing a boolean expression or (default). Used as Variant control mode.
Variant control labelString that is not evaluated and the choice used in simulation is determined by the Label mode active choice parameter. Used as Variant control mode.
Variant control variableMATLAB® variable, Simulink.Variant object, or a Simulink.Parameter object.
Variant objectContainer of variant control expression.
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.

Command Line Parameters

Variant Subsystem Parameters

Parameter nameDescription
Variant

Used to check if the subsystem is a Variant Subsystem block. Returns on if the subsystem is a Variant Subsystem block, else it returns off. Example: get_param(gcb, 'Variant')

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.

  • get_param behavior: Returns variant controls for choice block of a Variant Subsystem block. Example: get_param(gcb, 'VariantControl')

  • set_param behavior: Sets variant control for current block. Example: set_param(gcb, 'VariantControl', 'A==1')

VariantControlMode

Specifies the mode for modeling Variant blocks, which can be either Expression or Label.

  • get_param behavior:

    Returns the mode set for modeling Variant blocks. Example: get_param(gcb, 'VariantControlMode')

  • set_param behavior:

    Sets the mode for modeling Variant blocks. Example: set_param(gcb, 'VariantControlMode', 'Label')

LabelModeActiveChoice

Returns the variant control label of the selected choice for the Variant Subsystem block when VariantControlMode is specified as Label . If VariantControlMode is specified as Expression, this parameter returns empty ('').

  • get_param behavior:

    Returns the variant control label of the selected choice for the Variant Subsystem when VariantControlMode is set to Label. If VariantControlMode is set to Expression, this parameter returns empty ('').

  • set_param behavior:

    When VariantControlMode is specified as Expression, set_param makes the label selected as the active choice. When VariantControlMode is Label, set_param switches between specified labels.

TreatAsGroupedWhenPropagatingVariantConditions

Returns on if the Subsystem is treated as a group when propagating variant conditions else returns off.

  • get_param behavior:

    Indicates if the subsystem is treated as a group when propagating Variant conditions or not by returning on or off. Example: get_param(gcb, 'TreatAsGroupedWhenPropagatingVariantConditions')

  • set_param behavior:

    Enables or disables treating subsystem as a group when propagating variant conditions. Example: set_param(gcb, 'TreatAsGroupedWhenPropagatingVariantConditions', 'on')

GeneratePreprocessorConditionals

Indicates if all the choices are to be analyzed and preprocessor conditionals to be generated by returning on or off.

  • get_param behavior:

    Indicates if all the choices are to be analyzed and preprocessor conditionals be generated by returning on or off. Example: get_param(gcb, 'GeneratePreprocessorConditionals')

  • set_param behavior:

    Enables or disables analyzing all the choices and generating preprocessor conditionals. Example: set_param(gcb, 'GeneratePreprocessorConditionals', 'on')

CompiledActiveChoiceControl

Returns the variant control corresponding to the active choice of the Variant Subsystem block and returns empty (' ') when no choice is active. When the block is commented or is inside a commented subsystem, this parameter returns empty(' '). Example: get_param(gcb, 'CompiledActiveChoiceControl').

This is a read-only parameter.

CompiledActiveChoiceBlock

Returns the full block path name of the active Variant Subsystem block choice and returns empty (' ') when no choice is active. When the block is commented or is inside a commented Subsystem, the value is returned as empty(' '). Example: get_param(gcb, 'CompiledActiveChoiceBlock').

This is a read-only parameter.

CompiledVariantInfo

Indicates if a block is active during simulation and if it is part of generated code. Example: get_param(gcb, 'CompiledVariantInfo').

This is a read-only parameter.

PropagateVariantConditions

Indicates if conditions on ports inside the Variant Subsystem block are to be propagated outside the block.

  • get_param behavior:

    Indicates if conditions on ports inside the Variant Subsystem block are to be propagated outside the block.

  • set_param behavior:

    Enables or disables propagating conditions outside Variant Subsystem block. Example: set_param(gcb, 'PropagateVariantConditions','on')

AllowZeroVariantControls

Indicates if the Variant Subsystem block is allowed to have no active choices.

  • get_param behavior:

    Indicates if the Variant Subsystem block is allowed to have no active choices.

  • set_param behavior:

    Enables or disables having active choices in Variant Subsystem block. Example: set_param(gcb, 'AllowZeroVariantControls','on')

Variant Source and Variant Sink Parameters

Parameter nameDescription
VariantControls

Returns a 1-by-N cell array of variant control expressions corresponding to each of the N ports of the Variant Source or Variant Sink blocks.

  • get_param behavior:

    Returns a cell array of variant control expressions corresponding to each ports of the Variant Source or Variant Sink blocks. Example: get_param(gcb, 'VariantControls')

  • set_param behavior:

    Sets the cell array of Variant control expressions corresponding to each of ports of Variant Source or Variant Sink blocks. Example: set_param(gcb, 'VariantControls', ('{A==1}, '4'))

VariantControlMode

Specifies the mode for modeling variant blocks, which can be either Expression or Label.

  • get_param behavior:

    Returns the mode set for modeling Variant blocks. Example: get_param(gcb, 'VariantControlMode')

  • set_param behavior:

    Sets the mode for modeling Variant blocks. Example: set_param(gcb, 'VariantControlMode', 'Label')

LabelModeActiveChoice

Returns the variant control label of the selected choice for Variant Source or Variant Sink block when VariantControlMode is specified as Label. If VariantControlMode is specified as Expression, this parameter returns empty ('').

  • get_param behavior:

    Returns the variant control label of the selected choice for the Variant Subsystem when VariantControlMode is set to Label. If VariantControlMode is set to Expression, this parameter returns empty ('').

  • set_param behavior:

    When VariantControlMode is specified as Expression, set_param makes the label selected as the active choice. When VariantControlMode is Label, set_param switches between specified labels.

GeneratePreprocessorConditionals

Indicates if all the choices are to be analyzed and preprocessor conditionals to be generated by returning on or off.

  • get_param behavior:

    Indicates if all the choices are to be analyzed and preprocessor conditionals to be generated by returning on or off. Example: get_param(gcb, 'GeneratePreprocessorConditionals')

  • set_param behavior:

    Enables or disables analyzing all the choices and generating preprocessor conditionals. Example: set_param(gcb, 'GeneratePreprocessorConditionals', 'on')

ShowConditionOnBlock

Indicates if the VariantControlExpression is to be displayed on the block by returning on or off.

  • get_param behavior:

    Indicates if the VariantControlExpression is to be displayed on the block or not.

  • set_param behavior:

    Enables or disables the displaying of VariantControlExpression on the block. Example: set_param(gcb, 'ShowConditionOnBlock','on')

AllowZeroVariantControls

Indicates if the block is allowed to have no active ports by returning on or off.

  • get_param behavior:

    Indicates if the Variant Source or Variant Sink block is allowed to have no active choices.

  • set_param behavior:

    Enables or disables having active choices in Variant Source or Variant Sink block. Example: set_param(gcb, 'AllowZeroVariantControls','on')

CompiledActiveVariantControl

Returns the variant control corresponding to the active port from the last compilation instance. If no port is active, returns empty (' '). If the block is commented or inside a commented Subsystem or inside an inactive choice of a Variant Subsystem block, the value is not computed and returns empty (' '). Example: get_param(gcb, 'CompiledActiveVariantControl')

This is a read-only parameter.

CompiledActiveVariantPort

Returns the "index" of the active port from the last compilation instance or returns -1 when no port is active. If the block is commented or inside a commented Subsystem or inside an inactive choice of a Variant Subsystem block (with generate preprocessor conditionals Off), the value is not computed, and returns empty (' '). Example: get_param(gcb, 'CompiledActiveVariantPort')

This is a read-only parameter.

Related Examples

More About