Main Content

Implement Component Behavior in Simulink

System design and architecture definition can involve a behavior definition for some components, such as the algorithm for a data processing component. Components in System Composer™ architecture models can define behavior using Simulink® models by linking components to Simulink models.

Create a Simulink Behavior Model

When a component does not require further decomposition from an architecture standpoint, you can design and define its behavior in Simulink. When linked to a Simulink behavior, the component becomes a Reference Component. A reference component represents a logical hierarchy of other compositions. You can reuse compositions in the model using reference components.

  1. Right-click the component and select Create Simulink Behavior, or, on the toolstrip under Component, click Create Simulink Behavior.

    Right-click menu selection for the 'Data Processing' component selecting 'Create Simulink Behavior...'

  2. Provide a model name. The default name is the name of the component.

    Create Simulink Behavior dialog with new model name 'Data Processing' with options browse, from Simulink template, new data dictionary name, OK, cancel, and help.

  • A new Simulink model with the provided name is created. The root level ports of the Simulink model reflect the ports of the component.

  • The component in the architecture model is linked to the Simulink model. The Simulink icon on the component indicates this is a Simulink link.

The data processing component with referenced Simulink model between chevrons with arrow pointing to what is inside. There is a Simulink base model inside with in-ports and out-ports designated.

You can continue with providing specific dynamics and algorithms in the referenced Simulink model. Adding root-level ports in the Simulink model creates additional ports on the System Composer Reference Component block.

You can access and edit a referenced Simulink model by double-clicking the component in the architecture model. When you save the architecture model, all unsaved Simulink behavior models it references must also be saved, and all linked components updated.

Options to save reference models recursively with 'Save All', or to save the current model and refresh the parent model with 'Save'. There is also an option to 'Cancel' the save operation.

Link to an Existing Simulink Behavior Model

You can link to an existing Simulink behavior model from a System Composer component, provided that the component is not already linked to a reference architecture. Right-click the component and select Link to Model. Type in or browse for the name of a Simulink model.

Link to model dialog with existing model name 'Data Processing'. Press Enter for OK.

Any subcomponents and ports that are present in the components get deleted when the component links to a Simulink model, with a prompt to continue and lose subcomponents and ports when linking.

Note

The software does not support linking a System Composer component to a Simulink model with root-level enable or trigger ports.

You can link protected Simulink models (.slxp) to create component behaviors. You can also convert an already linked Simulink behavior model to a protected model, and the change is reflected after refreshing the model.

Create a Simulink Behavior from Template for a Component

To create user-defined templates for Simulink models, see Create Template from Model.

After creating and saving a user-defined template, you can link the template to a Simulink behavior. Right-click the component and select Create Simulink Behavior, or, on the toolstrip under Component, click Create Simulink Behavior.

Create Simulink Behavior for a component. Create the new model from a Simulink template and a new data dictionary.

On the Create Simulink behavior dialog, choose the template and enter a new data dictionary name if local interfaces are defined. Click OK. The component exhibits a Simulink behavior according to the template with shared interfaces, if present. Blocks and lines in the template are excluded, and only configuration settings are preserved. Configuration settings include annotations and styling.

Note

Architecture templates can be used with Save As Architecture Model.

Save component as an architecture model. Create the new model from a Simulink template and a new data dictionary.

See Also

Functions

Blocks

Related Topics