Create Architecture Views Interactively
The structural hierarchy of a system typically differs from the hierarchy of the functional requirements of a system. With architecture views in System Composer™, you can view a system based on different hierarchies.
Aviewshows a customizable subset of elements in a model. Views can be filtered based on stereotypes or names of components, ports, and interfaces, along with the name, type, or units of an interface element. Create views by adding elements manually. Views create a simplified way to work with complex architectures by focusing on certain parts of the architectural design.
You can use different types of views to represent the system:
操作视图demonstrate how a system will be used and should be integrated with requirements analysis.
Functional viewsfocus on what the system must do to operate.
Physical viewsshow how the system is constructed and configured.
A viewpoint represents a stakeholder perspective that specifies the contents of the view.
For example, you can author a system using requirements. A view allows you to better understand what components you need to satisfy your requirements while not necessarily focusing on the structure.
This example uses the architecture model for a keyless entry system to create component diagram views.
Acomponent diagramrepresents a view with components, ports, and connectors based on how the model is structured.
Component diagrams allow you to programmatically or manually add and remove components from the view.
For more information on the keyless entry system architecture, seeModeling System Architecture of Keyless Entry System.
Create Filtered Views with Component Filters and Port Filters
In the MATLAB®Command Window, enter this command.
scKeylessEntrySystem
Navigate toModeling>Architecture Viewsto open theArchitecture Views Gallery.
SelectNew>Viewto create a new view.
InView Propertieson the right pane, in theNamebox, enter a name for this view, for example,
Software Component Review
. Choose aColorand enter aDescription, if necessary.In the bottom pane, selectView Configurations>Filter>Add Component Filterto add a form-based criterion to a component filter.
From theSelectlist, select
Components
. From theWherelist, selectStereotype
. Selectisa. In the text box, from the list selectAutoProfile.SoftwareComponent
.SelectApply.
An architecture view is created using the query in theComponent Filterbox. The view is filtered to select all components with the
AutoProfile.SoftwareComponent
stereotype applied to them.SelectAdd Component Filter. From theSelectlist, select
Components
. From theWherelist, selectName
. Select~contains. In the text box, enter"Door Lock"
. Select theAuto Applycheck box so that future changes are applied without selectingApply.An architecture view is created using the additional query in theComponent Filterbox. The view is filtered to select all components not named
"Door Lock"
.From theAdd Port Filterlist, select the option
Hide Unconnected Ports
.An architecture view is created using the additional query in thePort Filterbox. The view is filtered to hide unconnected ports.
删除the port filter. Pause on the constraint and select thebutton.
Add Group By Criteria to Filtered Views
In the View Configurations pane, selectGrouping.
To choose a property enumeration for grouping, clickAdd Group By.
From the list, select
AutoProfile.BaseComponent.ReviewStatus
.ClickAdd Group Byagain.
From the list, select
AutoProfile.SoftwareComponent.ImplementationLanguage
.ClickApply.
Interactively Add and Remove Elements from Views
To add more components to the view, drag and drop components fromModel Components. Drag and drop the
Lighting System
component to theSoftware Component Review
view. Alternatively, clickAddon the toolstrip. You can also pressCtrl+Ito add component instantiations to your view when they are selected.Note
Interactively adding and removing elements from your view with an associated query is not supported. You will receive a warning message: Remove associated query? PressOKto proceed.
You can press删除to delete components from the view.
Observe that the
Lighting System
component has been added to the view.This view is now considered a freeform view.
Add or Remove Requirements Links from Views
Navigate toRequirement>Requirements Manager. A Requirements Toolbox™ license is required. TheRequirement Linkstab appears at the bottom of the
Software Component Review
view.Select the
Lighting Controller
component and observe the linked requirementAutomatically turn off headlights
.Select the requirement
Automatically turn off headlights
to open the Requirements Editor to view or modify requirement links.In theArchitecture Views Gallery, navigate toRequirement>Open Requirements Editorif the Requirements Editor is not open already.
Select the
Should unlock door
requirement.Return to theArchitecture Views Gallery. In the
Software Component Review
view, select theLighting Controller
component.Navigate toRequirement>Link to selected requirement. The new requirement
Should unlock door
is added.To remove a requirement link, selectand confirm deletion.
Add Custom Clauses to Component Filters and Port Filters
SelectNew>Viewto create a new view.
InView Propertieson the right pane, in theNamebox, enter a name for this view, for example,
Hardware Component View
. Choose aColorand enter aDescription, if necessary.In the bottom pane, underView Configurations>Filter, select from the listAdd Component Filter>Add Custom Component Filterto enter a constraint by which to filter. In the box, enter
contains(Property('Name'),'Dashboard')
.In the bottom pane, underView Configurations>Filter, select from the listAdd Port Filter>Add Custom Port Filterto enter a constraint by which to filter. In the box, enter
contains(Property('Name'),'sound')
.SelectApply.
The view is filtered using the constraints in the custom filters. For more information on structuring constraints, see
systemcomposer.query.Constraint
.