Main Content

Analyze Architecture

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 analyzes the structure of the system. 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:

  1. Define a profile containing a set of stereotypes that describe some analyzable properties (for example, cost and weight).

  2. Apply the profile to an architecture model and add stereotypes from that profile to elements of the model (components, ports, or connectors).

  3. Specify values for the properties on those elements.

  4. Write an analysis function to compute values necessary for the trade study. This is a static constraint solver for parametrics and values of related properties captured in the system model.

  5. 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. Use the Instantiate Architecture Model tool.

  6. Run the analysis function and then see analysis calculations and results in the Analysis Viewer tool.

Tip

To learn more about how System Composer concepts apply to systems engineering design, see System Composer Concepts.

Set Properties for Analysis

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. For more information, see Simple Roll-Up Analysis Using Robot System with Properties.

Open the Model

Open the RobotPhysicalArchitecture architecture model.

Import Profile

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 Model Elements

Apply stereotypes to all model elements that are part of the analysis. Use the Apply Stereotypes dialog to apply stereotypes to all elements of a certain type. Navigate to Modeling > Apply Stereotypes. In Apply Stereotypes, from Apply stereotype(s) to, select Components. From Scope, select This layer. For more information, see Use Apply Stereotypes Dialog to Batch Apply Stereotypes.

Tip

Make sure you apply the stereotype to the top-level component if a cumulative value is to be computed.

Set Property Values

Set property values for each model element in the Property Inspector. To open the Property Inspector, navigate to Modeling > Property Inspector.

  1. Select the model element.

  2. In the Property Inspector, expand the stereotype name and type values for properties.

Robot component stereotype displayed from the Property Inspector called Physical Component with properties named: unit cost 2000 dollars, and unit weight 5 kilograms.

Create a Model Instance for Analysis

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 a MAT file, of a System Composer architecture model for analysis.

Navigate to Modeling > Analysis Model to open the Instantiate Architecture Model tool. Specify all the parameters required to create and view an analysis model.

Instantiate Architecture Model window with stereotypes listed on the left and configure analysis on the right with analysis function, iteration order bottom-up, and instance model name system with props. Options are to cancel or instantiate.

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 analysis function, 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 elements in the instantiated model get properties only if the corresponding element in the composition model has the stereotype applied.

Click Instantiate to create the instantiated architecture model and launch the Analysis Viewer tool.

The Analysis Viewer shows all elements in the first column. The other columns show properties for all stereotypes chosen for the current 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 the stereotypes and property values of the element. 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 pulls changes to the instance from the model. Unsynchronized changes are shown in a different color. Selecting a single element enables the option to Update Element.

Note

When you save an instance of a subsystem reference, it propagates to all other instances and synchronizes. Model references continuously synchronize. In an analysis model, to ensure all unsaved subsystem references synchronize, save your changes, and then click Refresh or Update in the Analysis Viewer tool. For more information, see Edit and Save Referenced Subsystem.

Write Analysis Function

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 the properties of each element in the model instance.

Use an analysis function to calculate the result of an analysis.

For more information, see Analysis Function Constructs.

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 plus 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 using the Analysis Viewer tool.

function CostAndWeightRollupAnalysis(instance,varargin)
% Analysis function for the RobotPhysicalArchitecture.slx example

% Calculate total price
if instance.isComponent() && ~isempty(instance.Components)...
 && instance.hasValue('SystemProfile.PhysicalElement.UnitCost')
    sysComponent_unitPrice = 0;
    for child = instance.Components
        if child.hasValue('SystemProfile.PhysicalElement.UnitCost')
           comp_price = child.getValue('SystemProfile.PhysicalElement.UnitCost');
           sysComponent_unitPrice = sysComponent_unitPrice + comp_price;
        end
    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 analysis:

  • Access a property of the instance: instance.getValue("<profile>.<stereotype>.<property>")

  • Set a property of an instance: instance.setValue("<profile>.<stereotype>.<property>",value)

  • Access the subcomponents of a component: instance.Components

  • Access the connectors in component: instance.Connectors

The getValue function generates an error if the property does not exist. You can use hasValue to query whether elements in the model have the properties before getting the value.

As an example, this code computes the weight of a component as a sum of the weights of its subcomponents.

% Calculate total weight
if instance.isComponent() && ~isempty(instance.Components)...
 && instance.hasValue('SystemProfile.PhysicalElement.UnitWeight')
    weight = 0;
    for child = instance.Components
        if child.hasValue('SystemProfile.PhysicalElement.UnitWeight')
           subcomp_weight = child.getValue('SystemProfile.PhysicalElement.UnitWeight');
           weight = weight + subcomp_weight;
        end
    end
    instance.setValue('SystemProfile.PhysicalElement.UnitWeight',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 Analysis Function

Run an analysis function using the Analysis Viewer.

  1. Select or change the analysis function using the Analyze menu.

  2. Select the iteration method.

    • Pre-order — Start from the top level, move to a child component, and 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.

  3. 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.

The unit cost is computed and shown in yellow.

Here, the total cost of the system is 5100 dollars and the total weight is 55 kg.

See Also

Tools

Objects

Functions

Related Topics