systemcomposer.analysis.ArchitectureInstance
Architecture in analysis instance
Description
An ArchitectureInstance
object represents an instance of an
architecture.
Creation
Create an instance of an architecture using the instantiate
function.
instance = instantiate(model.Architecture,'LatencyProfile','NewInstance', ... 'Function',@calculateLatency,'Arguments','3','Strict',true, ... 'NormalizeUnits',false,'Direction','PreOrder')
Properties
Name
— Name of instance
character vector
Name of instance, specified as a character vector.
Example: 'NewInstance'
Data Types: char
Components
— Child components of instance
array of component instance objects
Child components of instance, specified as an array of systemcomposer.analysis.ComponentInstance
objects.
Ports
— Ports of instance
array of port instance objects
Ports of instance, specified as an array of systemcomposer.analysis.PortInstance
objects.
Connectors
— Connectors in instance
array of connector instance objects
Connectors in instance that connect child components, specified as an array of systemcomposer.analysis.ConnectorInstance
objects.
Parameters
— Parameters in instance
array of instance parameter objects
Parameters in instance, specified as an array of systemcomposer.analysis.InstanceParameter
objects.
Specification
— Reference to architecture in design model
architecture object
Reference to architecture in design model, specified as a systemcomposer.arch.Architecture
object.
NormalizeUnits
— Whether units normalize
1
(true
) | 0
(false
)
Whether units normalize the value of properties in the instantiation, specified as
1
(true
) or 0
(false
).
Data Types: logical
IsStrict
— Whether instances get properties
1
(true
) | 0
(false
)
Whether instances get properties if the specification of the instance has the
stereotype applied, specified as 1
(true
) or 0
(false
).
Data Types: logical
AnalysisFunction
— Analysis function
MATLAB® function handle
Analysis function, specified as the MATLAB function handle to be executed when analysis is run.
Example: @calculateLatency
AnalysisDirection
— Analysis direction
enumeration | character vector
Analysis direction, specified as one of the following enumerations:
systemcomposer.IteratorDirection.TopDown
systemcomposer.IteratorDirection.BottomUp
systemcomposer.IteratorDirection.PreOrder
systemcomposer.IteratorDirection.PostOrder
or a character vector of one of the following options:
'TopDown'
, 'PreOrder'
,
'PostOrder'
, or 'BottomUp'
Data Types: enum
| char
AnalysisArguments
— Analysis arguments
character vector
Analysis arguments, specified as a character vector of optional arguments to the analysis function.
Example: '3'
Data Types: char
ImmediateUpdate
— Whether analysis instance updates automatically
1
(true
) | 0
(false
)
Whether analysis viewer updates automatically when the design model changes,
specified as 1
(true
) or 0
(false
).
Data Types: logical
Object Functions
getValue | Get value of property from element instance |
setValue | Set value of property for element instance |
hasValue | Find if element instance has property value |
iterate | Iterate over model elements |
save | Save architecture instance |
update | Update architecture model |
refresh | Refresh architecture instance |
isArchitecture | Find if instance is architecture instance |
isComponent | Find if instance is component instance |
isConnector | Find if instance is connector instance |
isPort | Find if instance is port instance |
getParameter | Get parameter from architecture or component |
getEvaluatedParameterValue | Get evaluated value of parameter from element |
getParameterNames | Get parameter names on element |
getParameterValue | Get value of parameter |
setParameterValue | Set value of parameter |
Examples
Analyze Latency Characteristics
Create an instantiation for analysis for a system with latency in its wiring. The materials used are copper, fiber, and WiFi.
Create Latency Profile with Stereotypes and Properties
Create a System Composer profile with a base, connector, component, and port stereotype. Add properties with default values to each stereotype as needed for analysis.
profile = systemcomposer.profile.Profile.createProfile("LatencyProfileC");
Add a base stereotype with properties.
latencybase = profile.addStereotype("LatencyBase"); latencybase.addProperty("latency",Type="double"); latencybase.addProperty("dataRate",Type="double",DefaultValue="10");
Add a connector stereotype with properties.
connLatency = profile.addStereotype("ConnectorLatency",... Parent="LatencyProfileC.LatencyBase"); connLatency.addProperty("secure",Type="boolean",DefaultValue="true"); connLatency.addProperty("linkDistance",Type="double");
Add a component stereotype with properties.
nodeLatency = profile.addStereotype("NodeLatency",... Parent="LatencyProfileC.LatencyBase"); nodeLatency.addProperty("resources",Type="double",DefaultValue="1");
Add a port stereotype with properties.
portLatency = profile.addStereotype("PortLatency",... Parent="LatencyProfileC.LatencyBase"); portLatency.addProperty("queueDepth",Type="double",DefaultValue="4.29"); portLatency.addProperty("dummy",Type="int32");
Instantiate Using Analysis Function
Create a new model and apply the profile. Create components, ports, and connections in the model. Apply stereotypes to the model elements. Finally, instantiate using the analysis function.
model = systemcomposer.createModel("archModel"); systemcomposer.openModel("archModel")
ans = Model with properties: Name: 'archModel' SimulinkHandle: 152.0015 Architecture: [1x1 systemcomposer.arch.Architecture] Profiles: [0x0 systemcomposer.profile.Profile] InterfaceDictionary: [1x1 systemcomposer.interface.Dictionary] Views: [0x0 systemcomposer.view.View] Interactions: [0x0 systemcomposer.interaction.Interaction]
arch = model.Architecture;
Apply profile to model.
model.applyProfile("LatencyProfileC");
Create components, ports, and connections.
componentSensor = addComponent(arch,"Sensor"); sensorPorts = addPort(componentSensor.Architecture,{'MotionData','SensorPower'},{'in','out'}); componentPlanning = addComponent(arch,"Planning"); planningPorts = addPort(componentPlanning.Architecture,... {'Command','SensorPower','MotionCommand'},... {'in','in','out'}); componentMotion = addComponent(arch,"Motion"); motionPorts = addPort(componentMotion.Architecture,... {'MotionCommand','MotionData'},{'in','out'}); c_sensorData = connect(arch,componentSensor,componentPlanning); c_motionData = connect(arch,componentMotion,componentSensor); c_motionCommand = connect(arch,componentPlanning,componentMotion);
Clean up the canvas.
Simulink.BlockDiagram.arrangeSystem("archModel");
Batch apply stereotypes to model elements.
batchApplyStereotype(arch,"Component","LatencyProfileC.NodeLatency"); batchApplyStereotype(arch,"Port","LatencyProfileC.PortLatency"); batchApplyStereotype(arch,"Connector","LatencyProfileC.ConnectorLatency");
Instantiate using the analysis function.
instance = instantiate(model.Architecture,"LatencyProfileC","NewInstance",... Function=@calculateLatency,Arguments="3", ... Strict=true,NormalizeUnits=false,Direction="PreOrder")
instance = ArchitectureInstance with properties: Specification: [1x1 systemcomposer.arch.Architecture] IsStrict: 1 NormalizeUnits: 0 AnalysisFunction: @calculateLatency AnalysisDirection: PreOrder AnalysisArguments: '3' ImmediateUpdate: 0 listenerFnc: [] Components: [1x3 systemcomposer.analysis.ComponentInstance] Ports: [0x0 systemcomposer.analysis.PortInstance] Connectors: [1x3 systemcomposer.analysis.ConnectorInstance] Parameters: [0x0 systemcomposer.analysis.InstanceParameter] Name: 'NewInstance'
Inspect Component, Port, and Connector Instances
Get properties from component, port, and connector instances.
defaultResources = instance.Components(1).getValue("LatencyProfileC.NodeLatency.resources")
defaultResources = 1
defaultSecure = instance.Connectors(1).getValue("LatencyProfileC.ConnectorLatency.secure")
defaultSecure = logical
1
defaultQueueDepth = instance.Components(1).Ports(1).getValue("LatencyProfileC.PortLatency.queueDepth")
defaultQueueDepth = 4.2900
Battery Sizing and Automotive Electrical System Analysis
Overview
Model a typical automotive electrical system as an architectural model and run a primitive analysis. The elements in the model can be broadly grouped as either a source or a load. Various properties of the sources and loads are set as part of the stereotype. This example uses the iterate
method of the specification API to iterate through each element of the model and run analysis using the stereotype properties.
Structure of Model
The generator charges the battery while the engine is running. The battery and the generator support the electrical loads in the vehicle, like ECU, radio, and body control. The inductive loads like motors and other coils have the InRushCurrent
stereotype property defined. Based on the properties set on each component, the following analyses are performed:
Total
KeyOffLoad
.Number of days required for
KeyOffLoad
to discharge 30% of the battery.Total
CrankingInRush
current.Total
Cranking
current.Ability of the battery to start the vehicle at 0°F based on the battery cold cranking amps (CCA). The discharge time is computed based on Puekert coefficient (k), which describes the relationship between the rate of discharge and the available capacity of the battery.
Load Model and Run Analysis
archModel = systemcomposer.loadModel('scExampleAutomotiveElectricalSystemAnalysis');
Instantiate battery sizing class used by the analysis function to store analysis results.
objcomputeBatterySizing = computeBatterySizing;
Run the analysis using the iterator.
archModel.iterate('Topdown',@computeLoad,objcomputeBatterySizing)
Display analysis results.
objcomputeBatterySizing.displayResults
Total KeyOffLoad: 158.708 mA Number of days required for KeyOffLoad to discharge 30% of battery: 55.789. Total CrankingInRush current: 70 A Total Cranking current: 104 A CCA of the specified battery is sufficient to start the car at 0 F.
ans = computeBatterySizing with properties: totalCrankingInrushCurrent: 70 totalCrankingCurrent: 104 totalAccesoriesCurrent: 71.6667 totalKeyOffLoad: 158.7080 batteryCCA: 500 batteryCapacity: 850 puekertcoefficient: 1.2000
Close Model
bdclose('scExampleAutomotiveElectricalSystemAnalysis');
More About
Definitions
Term | Definition | Application | More Information |
---|---|---|---|
analysis | Analysis is a method for quantitatively evaluating an architecture for certain characteristics. Static analysis analyzes the structure of the system. Static analysis uses an analysis function and parametric values of properties and parameters captured in the system model. | Use analyses to calculate overall reliability, mass roll-up, performance, or thermal characteristics of a system, or to perform a size, weight, and power (SWaP) analysis to increase efficiency. | |
analysis function | An analysis function is a MATLAB function that computes values necessary to evaluate the architecture using the properties of each element in the model instance and instance-specific parameters on the component and architecture level. | Use an analysis function to calculate the result of an analysis. | |
instance model | An instance model is a collection of instances. | You can update an instance model with changes to a model, but
the instance model will not update with changes in active variants or model references. You can
use an instance model, saved in a | Run Analysis Function |
instance | An instance is an occurrence of an architecture model element at a given point in time. | An instance freezes the active variant or model reference of the component in the instance model. | Create a Model Instance for Analysis |
Term | Definition | Application | More Information |
---|---|---|---|
architecture | A System Composer architecture represents a system of components and how they interface with each other structurally and behaviorally. |
Different types of architectures describe different aspects of systems. You can use views to visualize a subset of components in an architecture. You can define parameters on the architecture level using the Parameter Editor. | |
root | A root is at the top of an architecture hierarchy. A root architecture has a boundary defined by its architecture ports that surround the system of interest. | The root architecture has a system boundary surrounding your architecture model. You can add architecture ports that define interfaces across the boundary. | |
model | A System Composer model is the file that contains architectural information, such as components, ports, connectors, interfaces, and behaviors. |
Perform operations on a model:
A System Composer model is stored as an SLX file. | Create Architecture Model with Interfaces and Requirement Links |
component | A component is a replaceable part of a system that fulfills a clear function in the context of an architecture. A component defines an architectural element, such as a function, another system, hardware, software, or other conceptual entity. A component can also be a subsystem or subfunction. | Represented as a block, a component is a part of an architecture model that can be separated into reusable artifacts. Transfer information between components with:
| |
port | A port is a node on a component or architecture that represents a point of interaction with its environment. A port permits the flow of information to and from other components or systems. |
| |
connector | Connectors are lines that provide connections between ports. Connectors describe how information flows between components or architectures. | A connector allows two components to interact without defining the nature of the interaction. Set an interface on a port to define how the components interact. |
Version History
Introduced in R2019a
See Also
Tools
Functions
instantiate
|iterate
|lookup
|save
|update
|refresh
|systemcomposer.analysis.loadInstance
|systemcomposer.analysis.deleteInstance
|getValue
|setValue
|hasValue
|getParameter
|getEvaluatedParameterValue
|getParameterNames
|getParameterValue
|setParameterValue
|isArchitecture
|isComponent
|isConnector
|isPort
|getQualifiedName
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)