addComponentConfiguration - Associate top-model variant configuration with variant configuration of referenced
model - MATLAB ([original](https://in.mathworks.com/help/simulink/slref/simulink.variantconfigurationdata.addcomponentconfiguration.html)) ([raw](?raw))
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
function 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 function thus allows you to author a top-model configuration using referenced component configurations. For more information on this workflow, see Compose Variant Configurations and Constraints for Top Model Using Referenced Component Configurations.
Note
This function requires Variant Manager for Simulink®.
addComponentConfiguration([vcdtop](#mw%5F320fc4f9-d8dd-457e-a712-991ef147c2a7),ConfigurationName=[topconfig](#mw%5Fed6e462a-5347-4621-9052-197ffb52cc33),ComponentName=[refmdl](#mw%5F441e554a-8c84-4f27-a7ac-4b08abd88f66),ComponentConfigurationName=[refconfig](#mw%5Fef3b4cb7-066f-4106-a018-01d2ed1c151f))
associates the variant configuration refconfig
of the referenced modelrefmdl
with the top-level variant configurationtopconfig
that is present in the variant configuration data objectvcdtop
.
This operation populates topconfig
with variant control variables from refconfig
. 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 oftopconfig
if it is associated with other referenced model configurations.
addComponentConfiguration(___,[PopulateControlVariables](#mw%5F7a7fed9a-0eaa-42e8-b663-e540873f4372)=false)
associates refconfig
with topconfig
using input arguments in the previous syntax, but it does not populate topconfig
with variant control variables from refconfig
, 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 want to indicate that they come fromrefconfig
. By default, PopulateControlVariables
is set to true
.
Examples
Consider the slexVariantManagement
model, which is associated with the variant configuration object vcd
. The model has a referenced model named slexVariantManagementExternalPlantMdlRef
in its hierarchy that has a predefined variant configuration namedLowFid
.
This command associates LowFid
with the variant configuration namedNonLinExterLowFid
present in vcd
and populatesNonLinExterLowFid
with the variant control variables fromLowFid
.
addComponentConfiguration(vcd,ConfigurationName="NonLinExterLowFid",... ComponentName="slexVariantManagementExternalPlantMdlRef",ComponentConfigurationName="LowFid");
This command associates LowFid
withNonLinExterLowFid
but does not update existing control variable values in NonLinExterLowFid
.
addComponentConfiguration(vcd,ConfigurationName="NonLinExterLowFid",... ComponentName="slexVariantManagementExternalPlantMdlRef",... ComponentConfigurationName="LowFid",... PopulateControlVariables=false);
Input Arguments
Variant configuration data of the top-level model, specified as aSimulink.VariantConfigurationData
object.
Name of the top-level variant configuration present in vcdtop to which the referenced component configuration refconfig is associated, specified as a character vector or string scalar.
Example: "LinInterExpNoNoise"
Data Types: char
| string
Name of the referenced component, such as a referenced model, specified as a character vector or string scalar.
Example: "slexVariantManagementExternalPlantMdlRef"
Data Types: char
| string
Name of the referenced component configuration to associate with the top-level configuration topconfig, specified as a character vector or string.
Example: "HighFid"
Data Types: char
| string
Option to populate variant control variable values from referenced configuration to top-level configuration, specified as a numeric or logical 1
(true) or 0
(false).
Data Types: logical
Version History
Introduced in R2022b
The addSubModelConfigurations function will be removed in a future release. Use theSimulink.VariantConfigurationData.addComponentConfiguration
function instead.