Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Setting Up Configuration Sets

About Configuration Sets

A configuration set is a named set of values for a model's parameters, such as solver type and simulation start or stop time. Every new model is created with a default configuration set, called Configuration, that initially specifies default values for the model's parameters. You can subsequently create and modify additional configuration sets and associate them with the model. The sets associated with a model can specify different values for any or all configuration parameters.

This section describes techniques for defining and using configuration sets that are stored in individual models. Such configuration sets are available only to the model that contains them. The next section, Referencing Configuration Sets, describes techniques for storing configuration sets in the base workspace, independently of any model. Such configuration sets can be shared by any number of models.

Configuration Set Components

A configuration set comprises groups of related parameters called components. Every configuration set includes the following components:

Some Simulink-based products, such as Real-Time Workshop, define additional components. If such a product is installed on your system, the configuration set also contains the components that it defines.

The Active Set

Only one of the configuration sets associated with a model is active at any given time. The active set determines the current values of the model's parameters. Changing the value of a parameter in the Model Explorer changes its value in the associated configuration set. You can change the active or inactive set at any time (except when executing the model). In this way, you can quickly reconfigure a model for different purposes, e.g., testing and production, or apply standard configuration settings to new models.

Displaying Configuration Sets

To display the configuration sets associated with a model, open the Model Explorer (see The Model Explorer: Overview). The configuration sets associated with the model appear as gear-shaped nodes in the Model Explorer's Model Hierarchy pane.

The Model Explorer's Contents pane displays the components of the selected configuration set. The Model Explorer's Dialog pane displays a dialog box for setting the parameters of the selected group (see Configuration Parameters Dialog Box).

Activating a Configuration Set

To activate a configuration set, right-click the configuration set's node to display the node's context menu, then select Activate from the context menu.

Opening Configuration Sets

In the Model Explorer, to open the Configuration Parameters dialog box for a configuration set, right-click the configuration set's node to display the node's context menu, then select Open from the context menu. You can open the Configuration Parameters dialog box for any configuration set, whether or not it is active. You might want to open a configuration set to inspect or edit the parameter settings.

The title bar of the dialog box indicates if the configuration set is active or inactive.

Copying, Deleting, and Moving Configuration Sets

You can use edit commands on the Model Explorer's Edit or context menus or object drag-and-drop operations to delete, copy, and move configuration sets among models displayed in the Model Explorer's Model Hierarchy pane.

For example, to copy a configuration set, using edit commands:

  1. Select the model with a configuration set that you want to copy in the Model Hierarchy pane.

  2. Select the configuration set that you want to copy in the Contents pane.

  3. Select Copy from the Model Explorer's Edit menu or the configuration set's context menu.

  4. Select the model in which you want to create the copy.

      Note   You can create a copy in the same model as the original.

  5. Select Paste from the Model Explorer's Edit menu or from the model's context menu.

To copy the configuration set, using object drag-and-drop, hold the right mouse button down and drag the configuration set's node to the node of the model in which you want to create the copy. To move a configuration set from one model to another, using drag-and-drop, hold the left mouse button down and drag the configuration set's node to the node of the destination model.

Copying Configuration Set Components

To copy a configuration set component from one configuration set to another:

  1. Select the component in the Model Explorer's Contents pane.

  2. Select Copy from the Model Explorer's Edit menu or the component's context menu.

  3. Select the configuration set into which you want to copy the component.

  4. Select Paste from the Model Explorer's Edit menu or the component's context menu.

      Note   The copy replaces the component of the same name in the destination configuration set. For example, if you copy the Solver component of configuration set A and paste it into configuration set B, the copy replaces B's existing Solver component.

Creating Configuration Sets

To create a new configuration set, select Configuration Set from the Model Explorer's Add menu or press the Add Configuration button in the Model Explorer's toolbar. You can also create a new configuration set by copying an existing configuration set.

Saving Configuration Sets

You can save the settings of configuration sets as MATLAB functions or scripts. Using the MATLAB function or script, you can share and archive model configuration sets. You can also compare the settings in different configuration sets by comparing the MATLAB functions or scripts of the configuration sets.

To save a configuration set as a MATLAB function or script:

  1. Use getActiveConfigSet or getConfigSet to get a handle to the configuration set.

  2. Use the saveAs method of the Simulink.Configset class to save the configuration set as a function or script.

Loading Saved Configuration Sets

You can load configuration sets that you previously saved as MATLAB functions or scripts.

To load a configuration set from a MATLAB function or script:

  1. Use getActiveConfigSet or getConfigSet to get a handle to the configuration set that you want to update.

  2. Call the MATLAB function or execute the MATLAB script to load the saved configuration set.

  3. Use attachConfigSet to attach the configuration set to the model. To avoid configuration set naming conflicts, set allowRename to true.

  4. Activate the configuration set. For more information, see Activating a Configuration Set.

Setting Values in Configuration Sets

To set the value of a parameter in a configuration set, select the configuration set in the Model Explorer and then edit the value of the parameter on the corresponding dialog box in the Model Explorer's dialog view.

Configuration Set API

An application program interface (API) lets you create and manipulate configuration sets from the command line or in a MAT-file or MATLAB-file. The API includes the Simulink.ConfigSet data object class and the following functions:

These functions, along with the methods and properties of Simulink.ConfigSet class, allow you to create a MATLAB-file program to:

For examples using the above functions and the Simulink.ConfigSet class, see the function and class reference pages.

Model Configuration Dialog Box

The Model Configuration dialog box appears in the Model Explorer dialog pane when you select any model configuration.

You can edit the name and description of your configuration. See Model Configuration Pane.

Model Configuration Preferences Dialog Box

The Model Configuration Preferences dialog box appears in the Model Explorer dialog pane when you view the default model configuration.

  1. Enable View > Show Configuration Preferences in the Model Explorer menu.

  2. Select Configuration Preferences under the Simulink Root node in the Model Explorer Model Hierarchy pane.

You can also edit the configuration defaults in the Simulink Preferences window. See Model Configuration Pane.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS