Every component in an architecture model can have its own design, or even several design alternatives. These designs can be architectures modeled in System Composer™ or behaviors modeled in Simulink®. Engineering systems often use the same component design in multiple places. A common component, such as power switch, can be part of all electrical components. You can reuse a component in System Composer within the same model as well as across architecture models.
A component can have its own architecture. Double-click a component to view or edit its architecture. When you view the component at this level, its ports appear as architecture ports. You can use the navigation arrows on the toolbar to move through the hierarchy. Use the Model Browser to view component hierarchy.
You can add components, ports, and connections at this level to define the architecture.
You can also make a new component from a group of components.
Select the components. Either click and drag a rectangle, or select multiple components by holding the Shift button down.
Create a component from the selected elements using Architecture > Create Component
As a result, the new component has the selected components, their ports, and connections as part of its architecture. Any unconnected ports and connections to components outside of the selection become ports on the new component.
Any component that has its own architecture displays a preview of its contents.
Some projects use the same, detailed component in multiple places, and require the design of such a component to be tightly managed. You can create a reference architecture to reuse the architectural definition of a component in the same architecture model or across several architecture models. Create such a reference architecture using this procedure:
Right-click the component and select Save as Architecture Model.
Provide a name for the model. By default, the reference architecture is saved in the same folder as the architecture model. Browse for or type the full path if you want to save it in a different folder.
System Composer creates an architecture model with the provided name, and links the component
to the new model. The linked model is indicated in the name of the component between the
All architecture models can reference this new architecture model through linked components.
You can use a reference architecture, saved in a separate file, by linking to it from a component. Right-click the component and select Link to Model. You can also use the Create Reference option in the element palette directly to create a component that uses a reference architecture.
To link a selected component to an existing architecture model, right-click the component and select Link to Model.
Provide the full path to the reference architecture. If the linked component has its own ports and components, this content is deleted during linking and replaced by that of the reference architecture. The ports of the linked component become the architecture ports in the reference architecture.
Any change made in a reference architecture is immediately reflected in the models that link to it. If you move or rename the reference architecture, the link becomes invalid and the linked component displays an error. Link the component to a valid reference architecture.
In some cases, you have to deviate from the reference architecture for a single component. For example, a comprehensive sensor model, referenced from a local component, may include too many features for the motion control architecture at hand and require simplification for that architecture only. In this case, you can inline the reference architecture to make local changes possible. Right-click a linked component and select Inline Model.
This operation provides two options:
Interface and subcomponents — Ports, interfaces, and subcomponents of the reference architecture are copied to the component.
Interface only — The ports and designated interfaces of the reference architecture are reflected on the component, but the composition is blank.
Once the reference architecture is inlined, you can start making changes without affecting other architectures. However, you cannot propagate local changes to the reference architecture. If you link to the reference architecture again, local changes are lost.
To inline a Stateflow® Chart behavior, see Inline Stateflow Chart Behavior.
A component can have multiple design alternatives, or variants. A variant is one of many structural or behavioral choices in a variant component. Use variants to quickly swap different architectural designs for a component while performing analysis. A variant control is a string that controls the active variant choice. Set the variant control to programmatically control which variant is active.
You can model variations for any component in a single architecture model. You can define a mix of behaviors (defined in a Simulink model) and architectures (defined in a System Composer architecture model) as variant choices. For example, a component may have two variant options that represent two alternate structural decompositions.
Add variants to a component. Right-click the component and select Add Variant Choice.
The badge on the component indicates that it is a variant, and a variant choice is added to the existing composition. Double-click the component to see variant choices.
You can add more variant choices to a variant component using the Add Variant Choice option.
Open and edit the variant by right-clicking and selecting Variant > Open > <variant_name> from the component context menu.
You can also designate a component as a variant upon creation using the object in the toolstrip. This creates two variant choices by default.
Activate a specific variant choice using the context menu of the block. Right-click and select Variant > Label Mode Active Choice > <variant_name>. The active choice is displayed in the header of the block.