Perform static analysis on a System Composer™ architecture to evaluate characteristics of the system. Analysis is a method for quantitatively evaluating an architecture for certain characteristics. Static analysis uses an analysis function and parametric values of properties 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 SWaP analysis.
Write static analyses based on element properties to perform data-driven trade studies and verify system requirements. Consider an electromechanical system where there is a trade-off between cost and weight, and lighter components tend to cost more. The decision process involves analyzing the overall cost and weight of the system based on the properties of its elements, and iterating on the properties to arrive at a solution that is acceptable both from the cost and weight perspective.
The analysis workflow consists of these steps:
Define a profile containing a set of stereotypes that describe some analyzable properties (for example, cost and weight).
Apply the profile to an architecture model and add stereotypes from that profile to elements of the model (components, ports, or connectors).
Specify values for the properties on those elements.
Create an instance of the architecture model, which is a tree of elements, corresponding to the model hierarchy with all shared architectures expanded and a variant configuration applied.
Write an analysis function to compute values necessary for the study. This is a static constraint solver for parametrics and values of related properties captured in the system model.
Run the analysis function and then see analysis calculations and results in the Analysis Viewer.
This example shows how to enable analysis by adding stereotypes to model elements and setting property values. The model provides the basis to analyze the trade-off between total cost and weight of the components in a simple architecture model of a robot system.
systemWithProps architecture model.
Enable analysis of properties by first importing a profile. In the toolstrip, navigate to Modeling > Profiles > Import and browse to the profile to import it.
Apply stereotypes to all model elements that are part of the analysis. Use the menu items that apply stereotypes to all elements of a certain type. Select Apply Stereotypes > Apply to and then Components > This layer. Make sure you apply the stereotype to the top-level component, if a cumulative value is to be computed.
Set property values for each model element in the Property Inspector. To open the Property Inspector, navigate to Modeling > Design > Property Inspector.
Select the model element.
In the Property Inspector, expand the stereotype name and type values for properties.
Create an instance of the architecture model that you can use for analysis. 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.
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 an
.MAT file, of a System Composer architecture model for analysis.
Navigate to Modeling > Views > Analysis Model to open the Instantiate Architecture Model dialog. Specify all the parameters required to create and view an analysis model.
The Select Stereotypes tree lists the stereotypes of all profiles
that have been loaded in the current session and allows you to select those whose properties
should be available in the instance model. You can browse for an analysis function, create a
new one, or skip analysis at this point. If the analysis function requires inputs other than
elements in the model (such as an exchange rate to compute cost) enter it in
Function arguments. Select a mode for iterating through model
elements, for example,
Bottom-up to move from the leaves of the
tree to the root.
Strict Mode ensures instances only get properties if the instance's specification has the stereotype applied.
To view the instance, click Instantiate and launch the Analysis Viewer. The Analysis Viewer shows all components in the first column. The other columns are properties for all stereotypes chosen for this instance. If a property is not part of a stereotype applied to an element, that field is greyed out. You can use the Filter button to hide properties for certain stereotypes. When you select an element, Instance Properties shows its stereotypes and property values. You can save an instance in a MAT-file, and open it again in the Analysis Viewer.
If you make changes in the model while an instance is open, you can synchronize the instance with the model. Update pushes the changes from the instance to the model. Refresh updates the instance from the model. Unsynchronized changes are shown in a different color. Selecting a single element enables the option to Update Element.
Write a function to analyze the architecture model using instances. An analysis function quantitatively evaluates an architecture for certain characteristics. An analysis function is a MATLAB® function that computes values necessary to evaluate the architecture using properties of each element in the model instance. Use an analysis function to calculate the result of an analysis.
You can add an analysis function as you set up the analysis instance model. After you select the stereotypes of interest, create a template function by clicking next to the Analysis function field. The generated M-file includes the code to obtain all property values from all stereotypes that are subject to analysis. The analysis function operates on a single element — aggregate values are generated by iterating this function over all elements in the model when you run the analysis from Analysis Viewer.
function systemWithProps_1(instance,varargin) if instance.isComponent() if instance.hasValue('SystemProfile.PhysicalElement.unitCost') sysComponent_unitPrice = instance.getValue('SystemProfile.PhysicalElement.unitCost'); end for child = instance.Components comp_price = child.getValue('SystemProfile.PhysicalElement.unitCost'); sysComponent_unitPrice = sysComponent_unitPrice + comp_price; end instance.setValue('SystemProfile.PhysicalElement.unitCost',sysComponent_unitPrice); end
In the generated file,
instance is the instance of the element on
which the analysis function runs currently. You can perform these operations for
Access a property of the instance:
Set a property of an instance:
Access the subcomponents of a component:
Access the connectors in component:
As an example, this code computes the weight of a component as a sum of the weights of its subcomponents.
if instance.isComponent() if instance.hasValue('SystemProfile.PhysicalElement.weight') weight = instance.getValue('SystemProfile.PhysicalElement.weight'); end for child = instance.Components subcomp_weight = child.getValue('SystemProfile.PhysicalElement.weight'); weight = weight + subcomp_weight; end instance.setValue('SystemProfile.PhysicalElement.weight',weight) end
Once the analysis function is complete, add it to the analysis under the
Analysis function box. An analysis function can take additional input
arguments, for example, a conversion constant if the weights are in different units in
different stereotypes. When this code runs for all components recursively, starting from the
deepest components in the hierarchy to the top level, the overall weight of the system is
assigned to the
weight property of the top-level component.
Run an analysis function using the Analysis Viewer.
Select or change the analysis function using the Analyze menu.
Select the iteration method.
Pre-order — Start from the top level, move to a child
component, process the subcomponents of that component recursively before moving to
a sibling component.
Top-Down — Like pre-order, but process all sibling components
before moving to their subcomponents.
Post-order — Start from components with no subcomponents,
process each sibling and then move to parent.
Bottom-up — Like post-order, but process all subcomponents at
the same depth before moving to their parents.
The iteration method depends on what kind of analysis is to be run. For example, for an analysis where the component weight is the sum of the weights of its components, you must make sure the subcomponent weights are computed first, so the iteration method must be bottom-up.
Click the Analyze button.
System Composer runs the analysis function over each model element and computes results. The computed properties are highlighted yellow in the Analysis Viewer.
Here, the total cost of the system is
25500 dollars and the total