Main Content

Attach Data Dictionary to Subsystem Reference

You can attach a data dictionary to a subsystem reference to store variables, objects, and interfaces. The scope of data you define in an attached data dictionary is the subsystem reference boundary. Using a data dictionary allows you to define all types of data and interfaces and reuse them in child blocks and instances of your subsystem reference.

Attach Data Dictionary to a Subsystem File

Attaching a data dictionary to a subsystem reference provides you with multiple capabilities, such as data storage, data-model linkage, and version handling. For more information, see What Is a Data Dictionary?

Create a new data dictionary or open an existing data dictionary.

  1. To create a new data dictionary, in the Model Explorer, select File > New > Data Dictionary.

  2. Click Add to add objects from the drop down list to the data dictionary.

    View of Model Explorer. On the left, a data dictionary node is expanded in the Model Hierarchy pane. On the right, the Contents pane displays the two objects contained in the Design Data section of the dictionary. More objects can be added from the Add tab.

  3. Save the data dictionary.

  4. To attach the data dictionary:

    • Open your subsystem file. In the Simulink® Editor, on the Modeling tab, click Subsystem Properties.

    • In the Subsystem Properties dialog box, on the External Data tab, click Browse to locate and open your data dictionary.

    • Click OK to attach the data dictionary.

    View of Subsystem Properties of ssref1. Data dictionary ssref1dd.sldd is added using the External Data tab.

    Alternatively, you can attach the data dictionary by using the set_param function.

    set_param('ssref1','DataDictionary','ssref1dd.sldd')

After you have attached the data dictionary and saved your subsystem file, the data dictionary and its contents appear in the Model Explorer as an external data source for the subsystem file.

You can use variables and data types defined in the data dictionary within the subsystem reference boundary.

For example, select data types defined in the attached data dictionary from the Data type list in the child blocks and instances of your Subsystem Reference block.

On the left, the model hierarchy is shown. On the right, the model canvas displays the contents of the child blocks of a subsystem file. The Outport block is selected. The block parameters dialog box displays the dictionary data types in the drop-down menu for Data type.

Symbol Resolution Process

To determine model behavior, Simulink tries to find the values of symbols used to define model entities. See Symbol Resolution for more information. To resolve a symbol, Simulink searches through the accessible workspaces in hierarchical order for a variable or object whose name is same as the symbol's name.

When you attach a data dictionary with your subsystem file, the symbol resolution for any child block of a subsystem reference is restricted within the subsystem reference boundary. The dialog box displays the behavior change in symbol resolution when you attach a data dictionary.

View of Subsystem Properties. When a data dictionary is added using the External Data tab, a warning to restrict hierarchical resolution is given.

Symbol resolution for any child block of a subsystem reference is:

  1. Mask workspaces of all blocks starting upward from the child block till the mask workspace of Subsystem Reference block (see Masking Fundamentals).

  2. The data dictionary attached with the Subsystem Reference block.

  3. MATLAB® base workspace, only if the attached data dictionary has access to the base workspace.

To allow access to the MATLAB base workspace, in the Model Explorer, select your data dictionary and select Enable dictionary access to base workspace.

View of Model Explorer. On the right, information for data dictionary is displayed. User can select 'Enable dictionary access to base workspace'.

Considerations and Limitations

There are some considerations when you attach a data dictionary with a subsystem reference.

  • As the hierarchical symbol resolution is restricted, the Permit Hierarchical Resolution option on the Subsystem Reference block parameter dialog box is disabled and set to None.

    View of model canvas and block parameters of Subsystem Reference block. The 'Permit Hierarchical Resolution' option is disabled and set to 'None'.

  • The enumerated data types defined in the data dictionary of a subsystem reference are available outside the subsystem reference boundary.

See Also

Blocks

Functions

Related Topics