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 the base workspace.
In the diagram, each model shown in the Model Dependency Viewer specifies the configuration reference, my_configuration, as its active configuration set. my_configuration points to the freestanding configuration set, Configuration. Therefore, the parameter values in Configuration apply to all four models. Any parameter change in Configuration applies to all four models.
|On this page…|
Convert Configuration Set to Configuration Reference
In the top model, you must convert the active configuration set to a configuration reference:
Open the sldemo_mdlref_depgraph model and the Model Explorer.
In the Model Hierarchy pane, expand the top model, sldemo_mdlref_depgraph. In the list, right-click Configuration (Active). In the context menu, select Convert to Configuration Reference.
In the Configuration set name field, specify a name for the configuration set object, or use the default name, configSetObj. This configuration set object is stored in the base workspace.
Optionally, you can save the configuration set to a MAT-file. Select Save configuration set to file. This enables the File name parameter.
In the File name field, specify a name for the MAT-file.
The original configuration set is now stored as a configuration set object, configSetObj, in the base workspace. The configuration set is also stored in a MAT-file, configuration_set.mat. The active configuration for the top model is now a configuration reference. This configuration reference points to the configuration set object in the base workspace.
Propagate a Configuration Reference
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. For each referenced model, the configuration reference is now the active configuration. The configuration references point to the configuration set object, configSetObj, in the base workspace.
In the Model Explorer, in the Model Hierarchy pane, expand the sldemo_mdlref_depgraph node.
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.
Verify that your current folder is a writable folder. 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 Converted.
Undo a Configuration Reference Propagation
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 Restored.