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.
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.
Right-click the component and select Create Simulink
Behavior
, or, on the toolstrip under
Component, click Create Simulink
Behavior.
Provide a model name. The default name is the name of the component.
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.
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.
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.
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.
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.
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.