Main Content

Variant Terminology

金宝app®variant terminology helps you to understand various parameters and terms.

Variant Terminology Description
Variant Subsystem, Variant Model Contains one or more choices where each choice is aSubsystemorModelblock.
Variant Source Provides variation on the source of a signal.
Variant Sink Provides variation on the sink (destination) of a signal.
Variant Model Variant Subsystemblock containingModelblock as variant choices. SeeVariant Subsystem, Variant Model.
Active choice Variant choice associated with a variant control that evaluates totrue.
Variant control mode

expression,labelorsim codegen switchingfor modeling variant blocks and variant parameters.

Variant control variable MATLAB®variable,Simulink.Variantobject, or aSimulink.Parameterobject. SeeTypes of Variant Control Variables (Operands) in Variant Blocks.
Variant object Container of variant control expression. SeeSimulink.Variant.
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 theSimulink.VariantConfigurationDataclass) associated with a model stores:

  • Collection of all variant configurations for the model.

  • 的反对straints that must be satisfied by the model for all variant configurations.

  • Default configuration for the model.

You can create new variant configurations and group them into a variant configuration data object from Variant Manager or programmatically using theSimulink.VariantConfigurationDataclass.

To associate the variant configuration data object to a model, use the Export variant configuration data object functionality in Variant Manager, or use theVariantConfigurationObjectparameter. Example:

variantConfig = Simulink.VariantConfigurationData; set_param(model,'VariantConfigurationObject',...'variantConfig');

Command Line Parameters

Variant Subsystem Parameters

Parameter name Description
Variant

Used to check if the subsystem is aVariant Subsystemblock. Returnsonif the subsystem is aVariant Subsystemblock, else it returnsoff. Example:get_param(gcb, 'Variant')

This is a read-only parameter.

VariantChoices

Gets the list of variant choices in aVariant Subsystemblock. Example:get_param(gcb, 'VariantChoices');

Returns a 1-by-Nstruct array with fields:

Name:Name of the variant control

BlockName:Block path name

This is a read-only parameter.

VariantControl

Subsystemblock andModelblock parameter, which applies to a choice block of aVariant Subsystemblock and returns the variant control for the choice block.

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

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

VariantControlMode

Specifies the mode for modeling Variant blocks, which can be eitherexpressionorlabelorsim codegen switching.

  • get_parambehavior:

    块返回模式集建模变体。Example:get_param(gcb, 'VariantControlMode')

  • set_parambehavior:

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

SeeVariant control mode.

LabelModeActiveChoice

Returns the variant control label of the selected choice for theVariant Subsystemblock whenVariantControlModeis specified aslabel. IfVariantControlModeis specified asexpression, this parameter returns empty('').

  • get_parambehavior:

    Returns the variant control label of the selected choice for the Variant Subsystem whenVariantControlModeis set tolabel. IfVariantControlModeis set toexpression, this parameter returns empty('').

  • set_parambehavior:

    WhenVariantControlModeis specified asexpression,set_parammakes the label selected as the active choice. WhenVariantControlModeislabel,set_paramswitches between specified labels.

SeeLabel mode active choice.

TreatAsGroupedWhenPropagatingVariantConditions

Returnsonif theSubsystemis treated as a group when propagating variant conditions else returnsoff.

  • get_parambehavior:

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

  • set_parambehavior:

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

SeePropagate Variant Conditions from Variant Source Blocks to Subsystem Blocks.

GeneratePreprocessorConditionals

Indicates if all the choices are to be analyzed and preprocessor conditionals to be generated by returningonoroff.

  • get_parambehavior:

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

  • set_parambehavior:

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

Note

Use theVariant activation timeparameter instead.

CompiledActiveChoiceControl

Returns the variant control corresponding to the active choice of theVariant Subsystemblock 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 activeVariant Subsystemblock 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

Block parameter that indicates the variant activeness of a block模型编译后. Returns a structure with three fields, with values set toonoroff:

  • IsActive: Value isonif the block is active in simulation.

  • IsInCodegen: Value isonif the block is part of generated code.

  • IsInStartup: Value isonif the block is active or can become active in simulation (the propagated value ofVariant activation timeon the block isstartup) after model compilation.

For an example, seeIdentify Variant Activeness of a Block After Model Compilation.

This is a read-only parameter.

PropagateVariantConditions

Indicates if conditions on ports inside theVariant Subsystemblock are to be propagated outside the block.

  • get_parambehavior:

    Indicates if conditions on ports inside theVariant Subsystemblock are to be propagated outside the block.

  • set_parambehavior:

    Enables or disables propagating conditions outsideVariant Subsystemblock. Example:set_param(gcb, 'PropagateVariantConditions','on')

SeePropagate conditions outside of variant subsystem.

AllowZeroVariantControls

Indicates if theVariant Subsystemblock is allowed to have no active choices.

  • get_parambehavior:

    Indicates if theVariant Subsystemblock is allowed to have no active choices.

  • set_parambehavior:

    Enables or disables having active choices inVariant Subsystemblock. Example:set_param(gcb, 'AllowZeroVariantControls','on')

SeeAllow zero active variant controls.

VariantActivationTime

Determines if Simulink sets the active choice of aVariant Subsystemblock during update diagram or code compile.

  • get_parambehavior:

    Returns theVariant Activation Timeof aVariant Subsystemblock. This parameter can be set toupdate diagram,update diagram analyze all choices, orcode compile.

    Example:get_param(gcb, 'VariantActivationTime')

  • set_parambehavior:

    • When you set theVariant control modetoexpression, this parameter can be set toupdate diagram,update diagram analyze all choices, orcode compile.

    • When you set theVariant control modetosim codegen switching, this parameter can be set to eitherupdate diagramorupdate diagram analyze all choices. Thecode compileoption becomes unavailable.

    Example:set_param(gcb,'VariantActivationTime', 'update diagram')

Note

Theget_paramandset_parambehavior ofVariantActivationTimeparameter with thecode compileoption is equivalent to that of the parameterGeneratePreprocessorConditionals.

SeeVariant activation time.

Variant Source and Variant Sink Parameters

Parameter name Description
VariantControls

Returns a1-by-Ncell array of variant control expressions corresponding to each of theNports of theVariant SourceorVariant Sinkblocks.

  • get_parambehavior:

    Returns a cell array of variant control expressions corresponding to each ports of theVariant SourceorVariant Sinkblocks. Example:get_param(gcb, 'VariantControls')

  • set_parambehavior:

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

VariantControlMode

Specifies the mode for modeling variant blocks, which can be eitherExpressionorLabel.

  • get_parambehavior:

    块返回模式集建模变体。Example:get_param(gcb, 'VariantControlMode')

  • set_parambehavior:

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

SeeVariant control mode.

LabelModeActiveChoice

Returns the variant control label of the selected choice forVariant SourceorVariant Sinkblock whenVariantControlModeis specified asLabel. IfVariantControlModeis specified asExpression, this parameter returns empty('').

  • get_parambehavior:

    Returns the variant control label of the selected choice for the Variant Subsystem whenVariantControlModeis set toLabel. IfVariantControlModeis set toExpression, this parameter returns empty('').

  • set_parambehavior:

    WhenVariantControlModeis specified asExpression,set_parammakes the label selected as the active choice. WhenVariantControlModeisLabel,set_paramswitches between specified labels.

SeeLabel mode active choice.

GeneratePreprocessorConditionals

Indicates if all the choices are to be analyzed and preprocessor conditionals to be generated by returningonoroff.

  • get_parambehavior:

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

  • set_parambehavior:

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

Note

Use theVariant activation timeparameter instead.

ShowConditionOnBlock

Indicates if theVariantControlExpressionis to be displayed on the block by returningonoroff.

  • get_parambehavior:

    Indicates if theVariantControlExpressionis to be displayed on the block or not.

  • set_parambehavior:

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

SeeShow variant condition on block.

AllowZeroVariantControls

Indicates if the block is allowed to have no active ports by returningonoroff.

  • get_parambehavior:

    Indicates if theVariant SourceorVariant Sinkblock is allowed to have no active choices.

  • set_parambehavior:

    Enables or disables having active choices inVariant SourceorVariant Sinkblock. Example:set_param(gcb, 'AllowZeroVariantControls','on')

SeeAllow zero active variant controls.

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 commentedSubsystemor inside an inactive choice of aVariant Subsystemblock, 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-1when no port is active. If the block is commented or inside a commentedSubsystemor inside an inactive choice of aVariant Subsystemblock (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