addComponentConfiguration
Class: Simulink.VariantConfigurationData
Namespace: Simulink
Associate top-model variant configuration with variant configuration of referenced model
Since R2022b
Syntax
Description
Consider a variant model that has predefined variant configurations and also has a referenced model in its model hierarchy. In Variant Manager, a variant configuration for a top-level model must also define the variant control variables used by any referenced components in the model hierarchy, such as referenced models. If the referenced component defines its own variant configurations, you can use them to set up the control variables in the top-level configuration.
Use the addComponentConfiguration
method to associate a variant
configuration of the referenced model with a variant configuration of the top-level model.
This operation adds the control variables present in the specified component configuration to
the top-level model configuration. This method thus allows you to author a top-model
configuration using referenced component configurations. For more information on this
workflow, see Compose Variant Configurations for Top Model Using Referenced Model Configurations.
Note
This method requires Variant Manager for Simulink®.
addComponentConfiguration(
associates the variant configuration vcdTop
,ConfigurationName=topConfig
,ComponentName=refmdl
,ComponentConfigurationName=refConfig
)refConfig
of the referenced model
refmdl
with the top-level variant configuration
topConfig
that is present in the variant configuration data object
vcdTop
.
This operation populates variant control variables from refConfig
to topConfig
; that is topConfig
contains all
variant control variables that are in refConfig
, these variables are
set to the same values as in refConfig
, and they are also marked as
read-only in the top-level configuration. You cannot modify or remove the control variables
populated using a component configuration from the top-model configuration. To populate
variant control variables, refmdl
is loaded. The operation also checks
that there are no conflicts in existing variant control variable definitions of
topConfig
if it is associated with other referenced model
configurations.
addComponentConfiguration(
associates vcdTop
,ConfigurationName=topConfig
,ComponentName=refmdl
,ComponentConfigurationName=refConfig
,PopulateControlVariables=false
)refConfig
with topConfig
but does not
populate variant control variables from refConfig
to
topConfig
and the variables are not marked as read-only. Use this
syntax if you do not want to update existing control variable values in
topConfig
but only indicate that they come from
refConfig
. By default, PopulateControlVariables
is set to true
.