Documentation

Share a Configuration Across Referenced Models

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_configurationpoints to the freestanding configuration set,配置。Therefore, the parameter values in配置apply to all four models. Any parameter change in配置applies to all four models.

Convert Configuration Set to Configuration Reference

In the top model, you must convert the active configuration set to a configuration reference:

  1. Open thesldemo_mdlref_depgraphmodel and the Model Explorer.

  2. In the Model Hierarchy pane, expand the top model,sldemo_mdlref_depgraph。In the list, right-click配置(Active)。In the context menu, selectConvert to Configuration Reference

  3. In the配置set namefield, specify a name for the configuration set object, or use the default name,配置。This configuration set object is stored in the base workspace.

  4. Optionally, you can save the configuration set to a MAT-file. SelectSave configuration set to file。This enables theFile nameparameter.

  5. In theFile namefield, specify a name for the MAT-file.

  6. ClickOK

The original configuration set is now stored as a configuration set object,配置, 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,配置, in the base workspace.

  1. In the Model Explorer, in the Model Hierarchy pane, expand thesldemo_mdlref_depgraphnode.

  2. Right-click the active configuration reference,Reference (Active)。In the context menu, selectPropagate to Referenced Models

  3. In the Configuration Reference Propagation dialog box, select the check box for each referenced model. In this example, they are already selected.

  4. 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. ClickPropagate

  5. In the Propagation Confirmation dialog box, clickOK

  6. In the Configuration Reference Propagation dialog box, the Propagation Report is updated and theStatusfor each referenced model is marked asConverted

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 clickingRestore All。如果你想撤销propagation for individual referenced models, in theUndo/Redocolumn, click theUndobutton. The Propagation Report is updated and theStatusfor the referenced model is set toRestored

Related Examples

More About

Was this topic helpful?