Main Content

Layer Depth

Metric ID

slcomp.LayerDepth

Description

Use this metric to count how many layers deep a model component is in the model hierarchy for a unit or component. A layer is a parent or child model component in the model hierarchy.

This metric analyzes these model components:

  • Simulink® Subsystems

  • Stateflow® states

  • MATLAB Function blocks

  • External MATLAB® functions and classes

  • MATLAB methods

Computation Details

The metric:

  • Does not count relationships to data dictionaries.

  • 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 Depth widget and click the Run metrics for widget icon. The Depth widget shows the maximum depth found in the current unit or component. If you click on the Depth widget, you can view a table that shows the depth for each model component.

  • Use getMetrics with the metric identifier slcomp.LayerDepth.

Results

For this metric, instances of metric.Result return Value as the depth of the model component in the model hierarchy of a unit or component.

Examples

Suppose you have a unit, u1, that contains a subsystem, s1, and subsystem s1 contains subsystem s2. u1 is at layer depth 1, s1 is at layer depth 2, and s2 is at layer depth 3.

See Also

Related Topics