Main Content

Layer Breadth

Since R2022b

Metric ID

slcomp.LayerBreadth

Description

Use this metric to count the number of child model components that each artifact contains. A layer is a parent or child model component in the model hierarchy.

This metric counts the following model components:

  • Simulink® Subsystems

  • Stateflow® states

  • MATLAB Function blocks

  • External MATLAB® functions and classes

  • MATLAB methods

Supported Artifacts

You can collect this metric for:

To control what the dashboard classifies as a unit or component, see Categorize Models in Hierarchy as Components or Units.

Computation Details

The metric:

  • Includes model references as child model components.

  • Does not count relationships to data dictionaries. For example, suppose that you have a block diagram that contains a subsystem and requires a Simulink Data Dictionary (SLDD) file. The metric returns a layer breadth of one, not two.

  • Does not count relationships to other units. For example, if you have a component with a required relationship to another model that is a unit, that relationship is not included in the metric count. The metric only counts the relationship if the other model is not a unit.

Collection

To collect data for this metric:

  • In the Model Maintainability Dashboard, in the Component Structure section, point to the Breadth widget and click the Run metrics for widget icon. The Breadth widget shows the maximum breadth found in the current unit or component. If you click on the Breadth widget, you can view a table that shows the breadth for each artifact.

  • Use getMetrics with the metric identifier slcomp.LayerBreadth.

Results

For this metric, instances of metric.Result return Value as the number of child model components that each artifact contains.

Examples

Suppose you have a unit, u2, that contains two subsystems: c1 and c2. The layer breadth for the unit u2 is 2 because there are 2 child model components directly associated with the unit.

See Also

Related Topics