This example shows how to share the same configuration set for the top model and referenced models in a model reference hierarchy. You can use a configuration reference in each of the models to reference the same configuration set object in a Simulink® data dictionary that the models are linked to.
In the diagram, each model shown in the Dependency Analyzer specifies a
configuration reference as its active configuration set. Each reference points to the
freestanding configuration set,
my_configuration. Therefore, the
parameter values in
my_configuration apply to all four models. Any
parameter change in
my_configuration applies to all four models. For more
information about configuration references, see Share a Configuration with Multiple Models.
Create a Simulink data dictionary to store the configuration set. When you link the models in the hierarchy to the data dictionary, they can reference the configuration set.
sldemo_mdlref_depgraph model. At the command line,
sldemo_mdlref_depgraph. Verify that your current folder is a
On the Modeling tab, under Design, click Link to Data Dictionary.
In the Model Properties dialog box, click New. Name the
new Simulink data dictionary
SharedDataDictionary and click
Click OK. Because this model includes referenced models,
a pop-up window asks you if
SharedDataDictionary.sldd should be
used for all referenced models that do not already use a dictionary. Click
Change all models. The current model and all of its
referenced models are linked to the new data dictionary. When the data dictionary is
linked, click OK.
The models are now linked to the Simulink data dictionary,
SharedDataDictionary.sldd. When you
store a configuration set in this data dictionary, the models that are linked to it can
reference the configuration set.
In the top model, you must convert the active configuration set to a configuration reference:
Open the Model Explorer.
In the Model Hierarchy pane, expand the top model,
sldemo_mdlref_depgraph. In the list, select the
Configurations node, and right-click
Configuration (Active) in the
Contents pane. In the context menu, select Convert to Configuration Reference.
In the Name field, use the default name,
Configuration. This configuration set object is stored in the
The original configuration set is now stored as a configuration set object,
Configuration, in the Simulink data dictionary. The active configuration for the top model is now a
configuration reference that points to the configuration set object in the data
Now that the top model contains an active configuration reference, you can propagate this configuration reference to all of the child models. Propagation creates a copy of the top model configuration reference in each referenced model and makes it the active configuration. The configuration references point to the configuration set object in the data dictionary.
In the Model Explorer, in the Model Hierarchy pane, expand
sldemo_mdlref_depgraph node and select the
In the Contents pane, right-click the active configuration reference, Reference (Active). In the context menu, select Propagate to Referenced Models.
In the Configuration Reference Propagation dialog box, select the check box for each referenced model. In this example, they are already selected.
The propagation mechanism saves the original configuration parameters for each referenced model so that you can undo the propagation. Click Propagate.
In the Propagation Confirmation dialog box, click OK.
In the Configuration Reference Propagation dialog box, the Propagation Report is
updated and the Status for each referenced model is marked as
Now, each model in the hierarchy references the freestanding configuration
Configuration. If you want one model to use a different value for a
parameter, you can override individual parameters within the reference that the model
uses. For more information, see Change Parameter Value in a Configuration Reference.
After propagating a configuration reference from a top model to the referenced models,
you can undo the propagation for all referenced models by clicking Restore
All. If you want to undo the propagation for individual referenced models,
in the Undo/Redo column, click the Undo
button. The Propagation Report is updated and the Status for the
referenced model is set to