systemcomposer.view.View
Description
A View
object is used to manage architecture views for a
System Composer™ model.
Properties
Name
— Name of view
string
Name of view, specified as a string.
Example: "NewView"
Data Types: string
Root
— Root element group
element group object
Root element group that defines view, specified as a systemcomposer.view.ElementGroup
object.
Model
— Architecture model
model object
Architecture model where view belongs, specified as a systemcomposer.arch.Model
object.
UUID
— Universal unique identifier
character vector
Universal unique identifier for view, specified as a character vector.
Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'
Data Types: char
Select
— Selection query
constraint object
Selection query associated with view, specified as a systemcomposer.query.Constraint
object.
GroupBy
— Grouping criteria
string array of properties
Grouping criteria, specified as a string array of properties in the form
"<profile>.<stereotype>.<property>"
.
Example: ["AutoProfile.MechanicalComponent.mass","AutoProfile.MechanicalComponent.cost"]
Color
— Color of view
string
Color of view, specified as a string. The color can be the name
"blue"
, "black"
, or
"green"
, or it can be an RGB value encoded in a hexadecimal string:
"#FF00FF"
or "#DDDDDD"
. An invalid color
results in an error.
Description
— Description of view
string
Description of view, specified as a string.
Data Types: string
IncludeReferenceModels
— Whether to include referenced models
true
or 1 | false
or 0
Whether to include referenced models, specified as a logical.
Example: included =
get(objView,'IncludeReferenceModels')
Data Types: logical
Object Functions
modifyQuery | Modify architecture view query and property groupings |
runQuery | Re-run architecture view query on model |
removeQuery | Remove architecture view query |
destroy | Remove model element |
Examples
Create Architecture Views in System Composer with Keyless Entry System
Use a keyless entry system to programmatically create architecture views.
1. Import the package with queries.
import systemcomposer.query.*
2. Open the Simulink® project file for the Keyless Entry System.
scKeylessEntrySystem
3. Load the example model into System Composer™.
model = systemcomposer.loadModel("KeylessEntryArchitecture");
Example 1: Hardware Component Review Status View
Create a filtered view that selects all hardware components in the architecture model and groups them using the ReviewStatus
property.
1. Construct a query to select all hardware components.
hwCompQuery = HasStereotype(IsStereotypeDerivedFrom("AutoProfile.HardwareComponent"));
2. Use the query to create a view.
model.createView("Hardware Component Review Status",... Select=hwCompQuery,... GroupBy={'AutoProfile.BaseComponent.ReviewStatus'},... IncludeReferenceModels=true,... Color="purple");
3. To open the Architecture Views Gallery the Views section, click Architecture Views.
model.openViews
Example 2: FOB Locator System Supplier View
Create a freeform view that manually pulls the components from the FOB Locator System and groups them using existing and new view components for the suppliers. In this example, you will use element groups, groupings of components in a view, to programmatically populate a view.
1. Create a view architecture.
fobSupplierView = model.createView("FOB Locator System Supplier Breakdown",... Color="lightblue");
2. Add a subgroup called Supplier D
. Add the FOB Locator Module
to the view element subgroup.
supplierD = fobSupplierView.Root.createSubGroup("Supplier D"); supplierD.addElement("KeylessEntryArchitecture/FOB Locator System/FOB Locator Module");
3. Create a new subgroup for Supplier A
.
supplierA = fobSupplierView.Root.createSubGroup("Supplier A");
4. Add each of the FOB Receivers to view element subgroup.
FOBLocatorSystem = model.lookup("Path","KeylessEntryArchitecture/FOB Locator System");
Find all the components which contain the name "Receiver"
.
receiverCompPaths = model.find(... contains(Property("Name"),"Receiver"),... FOBLocatorSystem.Architecture); supplierA.addElement(receiverCompPaths)
5. Save the model.
model.save
More About
Definitions
Term | Definition | Application | More Information |
---|---|---|---|
view | A view shows 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. Switch between a component diagram, component hierarchy, or architecture hierarchy. For software architectures, you can switch to a class diagram view. A viewpoint represents a stakeholder perspective that specifies the contents of the view. | Modeling System Architecture of Keyless Entry System |
element group | An element group is a grouping of components in a view. | Use element groups to programmatically populate a view. | |
query | A query is a specification that describes certain constraints or criteria to be satisfied by model elements. | Use queries to search elements with constraint criteria and to filter views. | Find Elements in Model Using Queries |
component diagram | A component diagram represents 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. | Inspect Components in Custom Architecture Views |
hierarchy diagram | You can visualize a hierarchy diagram as a view with components, ports, reference types, component stereotypes, and stereotype properties. |
There are two types of hierarchy diagrams:
| Display Component Hierarchy and Architecture Hierarchy Using Views |
Version History
Introduced in R2021a
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)