Documentation

Model Metrics

Model Metrics

Model metrics analyze your model and help you assess your model with regard to size, architecture, readability, and compliance to standards. Simulink® Check™ provides the metrics for these metric types:

Using the Metrics Dashboard, you can collect and view model metrics to get an assessment of your project quality status. For more information, see Collect and Explore Metric Data by Using the Metrics Dashboard.

You can use the model metric API to run the model metrics programmatically and export the results to a file. For more information, see Collect Model Metrics Programmatically.

For your company guidelines and standards, you can also use the model metric API to create your own model metrics, compute those metrics, and export the metric data. For more information, see Create a Custom Model Metric.

Size Metrics

To collect metric data on a model or subsystem, run these metrics.

MetricDescription
Simulink block metric

Calculates the number of blocks in the model.

Subsystem metric

Calculates the number of subsystems in the model.

Library link metric

Calculates the number of library-linked blocks in the model.

Effective lines of MATLAB code metric

Calculates the number of effective lines of MATLAB® code.

Stateflow chart objects metric

Calculates the number of Stateflow® objects.

Lines of code for Stateflow blocks metric

Calculates the number of code lines for the following Stateflow blocks in the model:

  • States

  • Transitions

  • Truth tables

Subsystem depth metric

Calculates the subsystem depth of the model.

Input output metric

Calculates the number of inports and outports in your model.

Diagnostic warnings metricCalculates the number of diagnostic warnings reported.
Explicit input output metric

Calculates the number of inports and outports in your model.

File metricCalculates the number of model and library files.
Matlab Function metricCalculates the number of Matlab Function blocks in your model.
Model file countCalculates the number of model files.
Parameter metricCalculates the number of data objects that parameterize the behavior of a model.
Stateflow chart metricCalculates the number Stateflow charts in your model.

For more information on model metrics, see Collect Model Metrics.

Architecture Metrics

To learn more about the architecture for a model or subsystem, run these metrics.

MetricDescription
Cyclomatic complexity metric

Calculates the cyclomatic complexity of the model.

Clone content metricCalculates the number of components involved in a clone, excluding libraries.
Clone detection metricCalculates the number of clones in components across the model hierarchy.
Library content metricCalculates the number of components involved in a library, excluding clones.

For more information on model metrics, see Collect Model Metrics.

Compliance Metrics

To determine if your model or subsystem is compliant with standards and guidelines, run one or more of these metrics.

MetricDescription
MATLAB code analyzer warnings

Determines warnings for MATLAB code blocks in your model.

Model Advisor Check Compliance for High-Integrity Systems

Returns the fraction of checks the model passes from Model Advisor DO-178C/DO-331 Standards.

Model Advisor Check Compliance for Modeling Standards for MAAB

Returns the fraction of checks the model passes from Model Advisor MAAB Standard.

Model Advisor Check Issues for High-Integrity Systems

Reports the number of issues from Model Advisor DO-178C/DO-331 Standards.

Model Advisor check issues for MAAB Standards

Reports the number of issues from Model Advisor MAAB Standard.

For more information on model metrics, see Collect Model Metrics.

Readability Metrics

Run these metrics to determine readability for a model or subsystem.

MetricDescription
Nondescriptive block name metric

Determines nondescriptive Inport, Outport, and Subsystem block names.

Data and structure layer separation metric

Calculates the data and structure layer separation.

For more information on model metrics, see Collect Model Metrics.

Simulink block metric

Metric Type: Size

Metric ID: mathworks.metrics.SimulinkBlockCount

Model Advisor Check ID: mathworks.metricchecks.SimulinkBlockCount

Calculate the number of Simulink blocks in the model

Description

Use this metric to calculate the number of blocks in the model. The results provide the number of blocks at the model and subsystem level. This metric counts Simulink—based blocks, but does not include underlying blocks used to implement the block. This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Simulink block metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.SimulinkBlockCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of blocks.

  • AggregatedValue: Number of blocks for component and its subcomponents.

  • Measures: Not applicable.

Note

The results from metric analysis of Simulink block metric can differ from calling sldiagnostics. The result of the Simulink block metric:

  • Includes referenced models.

  • Does not include any underlying blocks used to implement a MathWorks block that you used from the Simulink Library Browser.

  • Does not include links into MathWorks libraries, which means that MathWorks library blocks that are masked subsystems are counted as one block. The inner content of those blocks is not counted.

  • Does not include hidden content under Stateflow Charts or MATLAB Function blocks.

  • Does not include requirements blocks.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Subsystem metric

Metric Type: Size

Metric ID: mathworks.metrics.SubSystemCount

Model Advisor Check ID: mathworks.metricchecks.SubSystemCount

Display number of subsystems in the model

Description

Use this metric to calculate the number of subsystems in the model. The results provide the number of subsystems at the model and subsystem level.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Subsystem metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.SubSystemCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of subsystems.

  • AggregatedValue: Number of subsystems for a component and its subcomponent.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • Does not count subsystems linked to MathWorks® libraries.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Library link metric

Metric Type: Size

Metric ID: mathworks.metrics.LibraryLinkCount

Model Advisor Check ID: mathworks.metricchecks.LibraryLinkCount

Display number of library links in the model

Description

Use this metric to calculate the number of library-linked blocks in the model. The results provide the number of library-linked blocks at the model and subsystem level.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Library link metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.LibraryLinkCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of library linked blocks.

  • AggregatedValue: Number of library linked blocks for a component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • Does not count subsystems linked to MathWorks libraries.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Effective lines of MATLAB code metric

Metric Type: Size

Metric ID: mathworks.metrics.MatlabLOCCount

Model Advisor Check ID: mathworks.metricchecks.MatlabLOCCount

Display number of effective lines of MATLAB code

Description

Run this metric to calculate the number of effective lines of MATLAB code. Effective lines of MATLAB code are lines of executable code. Empty lines, lines that contain only comments, and lines that contain only an end statement are not considered effective lines of code. The results provide the number of effective lines of MATLAB code for each MATLAB Function block and for MATLAB functions in Stateflow charts.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Effective lines of MATLAB code metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.MatlabLOCCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of effective lines of MATLAB code.

  • AggregatedValue: Number of effective lines of MATLAB code for a component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • Does not analyze the content of MATLAB code in external files.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Stateflow chart objects metric

Metric Type: Size

Metric ID: mathworks.metrics.StateflowChartObjectCount

Model Advisor Check ID: mathworks.metricchecks.StateflowChartObjectCount

Display the number of Stateflow objects in each chart

Description

Run this metric to calculate the number of Stateflow objects. For each chart in the model, the results provide the number of the following Stateflow objects:

  • Atomic subcharts

  • Boxes

  • Data objects

  • Events

  • Graphical functions

  • Junctions

  • Linked charts

  • MATLAB functions

  • Notes

  • Simulink functions

  • States

  • Transitions

  • Truth tables

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Stateflow chart objects metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.StateflowChartObjectCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of Stateflow objects.

  • AggregatedValue: Number of Stateflow objects for a component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Lines of code for Stateflow blocks metric

Metric Type: Size

Metric ID: mathworks.metrics.StateflowLOCCount

Model Advisor Check ID: mathworks.metricchecks.StateflowLOCCount

Display the number of effective lines of code for Stateflow blocks

Description

Use this metric to calculate the number of effective lines of code in Stateflow. Effective lines of MATLAB code are lines of executable code. Empty lines, lines that contain only comments, and lines that contain only an end statement are not considered effective lines of code. This metric calculates the lines of code for the following Stateflow blocks in the model:

  • Chart, counting the code on Transitions and inside States

  • State Transition Table block

  • Truth Table block

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Lines of code for Stateflow blocks metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.StateflowLOCCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of Stateflow block code lines.

  • AggregatedValue: Number of Stateflow block code lines for a component and its subcomponents.

  • Measures: Vector with two entries: number of effective lines of code in MATLAB action language and number of effective lines of code in C action language.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Subsystem depth metric

Metric Type: Size

Metric ID: mathworks.metrics.SubSystemDepth

Model Advisor Check ID: mathworks.metricchecks.SubSystemDepth

Calculates the maximum depth of all hierarchical children of a subsystem or model

Description

Use this metric to count the maximum depth of all hierarchical children for a given subsystem or model starting from the given component, or root of analysis. The depth is the relative depth of the deepest branch. Depth traversal analysis stops when it reaches a referenced model or a library. Depth and level are restarted with 0 for each of these components.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Subsystem depth metric in By Task > Model Metrics > Count Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.SubSystemDepth.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: None

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: subsystem depth for each component in the hierarchy.

  • AggregatedValue: Not applicable.

  • Measure: level of component in the hierarchy.

  • AggregatedMeasure: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Input output metric

Metric Type: Size

Metric ID: mathworks.metrics.IOCount

Display number of inputs and outputs in the model

Description

Use this metric to calculate the number of inputs and outputs in the model, which include:

  • Inputs: Inport blocks, Trigger ports, Enable ports, chart input data and events.

  • Outputs: Outport blocks, chart output data and events.

  • Implicit inputs: From block, where the matching Goto block is outside of the component.

  • Implicit outputs: Goto block, where the matching From block is outside of the component.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Max

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: total interface size or sum of the elements of Measures.

  • AggregatedValue: Number of inputs and outputs for a component and its subcomponents.

  • Measures: Array consisting of number of inputs, number of outputs, number of implicit inputs, and number of implicit outputs, which are local to the component.

  • AggregatedMeasures: Maximum number of inputs, outputs, implicit inputs, and implicit outputs for a component and subcomponents.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Diagnostic warnings metric

Metric Type: Size

Metric ID: mathworks.metrics.DiagnosticWarningsCount

Calculate the number of diagnostic warnings reported during a model update for simulation.

Description

Use this metric to calculate the number of Simulink diagnostic warnings reported during a model update for simulation. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.DiagnosticWarningsCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of diagnostic warnings reported.

  • AggregatedValue: Number of diagnostic warnings reported for component and its subcomponents.

  • Measure: Not applicable.

Capabilities and Limitations

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Explicit input output metric

Metric Type: Size

Metric ID: mathworks.metrics.ExplicitIOCount

Display number of inputs and outputs in the model, excluding From and Goto blocks.

Description

Use this metric to calculate the number of inputs and outputs in the model, which include:

  • Inputs: Inport blocks, Trigger ports, Enable ports, chart input data and events.

  • Outputs: Outport blocks, chart output data and events.

This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.ExplicitIOCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Max

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Total interface size or sum of the elements of Measures.

  • AggregatedValue: Number of inputs and outputs for a component and its subcomponents.

  • Measures: Array consisting of number of inputs and number of outputs which are local to the component.

  • AggregatedMeasures: Maximum number of inputs and outputs for a component and subcomponents.

Capabilities and Limitations

The metric:

  • Excludes From and Goto blocks.

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

File metric

Metric Type: Size

Metric ID: mathworks.metrics.FileCount

Calculates the number of model and library files used by a specific component and its subcomponents.

Description

Use this metric to count the number of model and library files used by a specific component and its subcomponents. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.FileCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: None

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of model and library files.

  • AggregatedValue: Not applicable.

  • Measures: Not applicable.

Capabilities and Limitations

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Matlab Function metric

Metric Type: Size

Metric ID: mathworks.metrics.MatlabFunctionCount

Calculates the number of Matlab Function blocks inside a component.

Description

Use this metric to count the number of Matlab Function blocks inside a component. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.MatlabFunctionCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of Matlab Function blocks.

  • AggregatedValue: Number of Matlab Function blocks for component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Model file count

Metric Type: Size

Metric ID: mathworks.metrics.ModelFileCount

Calculate the number of model files.

Description

Use this metric to count the number of model files. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.ModelFileCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: None

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of files reference by a component and its subcomponents.

  • AggregatedValue: Not applicable.

  • Measures: Not applicable.

Capabilities and Limitations

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Parameter metric

Metric Type: Size

Metric ID: mathworks.metrics.ParameterCount

Calculate the number of parameters.

Description

Use this metric to calculate the amount of user-managed parameterization data inside a Simulink system. A parameter is a variable used by a Simulink block or object of a basic type (single, double, uint8, uint16, uint32, int8, int16, int32, boolean, logical, struct, char, cell), Simulink.Parameter, Simulink.Variant, or enum value. The parameter can be stored in either the base workspace, the model workspace, or a data dictionary.

This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.ParameterCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of parameters used inside a component.

  • AggregatedValue: Number of parameters for a component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

This metric:

  • Uses the Simulink.findVars function and inherits the limitations of this function.

  • Counts the parameter instances in a component rather than unique parameters.

  • Does not include parameters in masked workspaces.

  • Does not include data type and signal objects.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Stateflow chart metric

Metric Type: Size

Metric ID: mathworks.metrics.StateflowChartCount

Calculate the number of Stateflow charts at any component level.

Description

Use this metric to count the number of Stateflow charts at any component level. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.StateflowChartCount.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of Stateflow charts at the model level.

  • AggregatedValue: Number of charts for component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Cyclomatic complexity metric

Metric Type: Architecture

Metric ID: mathworks.metrics.CyclomaticComplexity

Model Advisor Check ID: mathworks.metricchecks.CyclomaticComplexity

Display the local and aggregated cyclomatic complexity of the model

Description

Use this metric to calculate the cyclomatic complexity of the model. The results provide the local and aggregated cyclomatic complexity for the:

  • Model

  • Subsystems

  • Charts

  • States in charts

  • MATLAB functions

Local complexity is the cyclomatic complexity for objects at their hierarchical level. Aggregated cyclomatic complexity is the cyclomatic complexity of an object and its descendants.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Cyclomatic complexity metric in By Task > Model Metrics > Complexity Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.CyclomaticComplexity.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Local cyclomatic complexity.

  • AggregatedValue: Aggregated cyclomatic complexity.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Does not run on library models.

  • Analyzes content in masked subsystems.

  • Does not analyze inactive variants.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

Clone content metric

Metric Type: Architecture

Check ID: mathworks.metrics.CloneContent

Calculate the number of components involved in a clone.

Description

Use this metric to calculate the number of components involved in an exact graphical subsystem clone, excluding libraries. Exact graphical subsystem clones must have identical block types, connections, and parameter values. If the software identifies a subsystem as a clone, the subsystem itself and all subcomponents are considered as being involved in a clone. Subcomponents linked to a library and its subcomponents are not considered to be involved in a clone. For more information on clone detection, see Enable Component Reuse with Clone Detection.

This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.CloneContent.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: None

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of components involved in a clone.

  • AggregatedValue: Not applicable.

  • Measures: Not applicable.

Capabilities and Limitations

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Clone detection metric

Metric Type: Architecture

Check ID: mathworks.metrics.CloneDetection

Calculate the number of clones in a model.

Description

Use this metric to count the number of exact graphical subsystem clones in a model. Exact graphical subsystem clones must have identical block types, connections, and parameter values. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.CloneDetection.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of clones.

  • AggregatedValue: Number of clones for component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Library content metric

Metric Type: Architecture

Check ID: mathworks.metrics.LibraryContent

Calculate the number of components involved in a library, excluding clones.

Description

Use this metric to calculate the number of components involved in a library, excluding clones. This metric is available with Simulink Check. To collect data for this metric, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.LibraryContent.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: None

  • slmetric.metric.AggregateComponentDetails: false

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of components involved in a library, excluding clones.

  • AggregatedValue: Not applicable.

  • Measures: Not applicable.

Capabilities and Limitations

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics.

Nondescriptive block name metric

Metric Type: Readability

Check ID: mathworks.metrics.DescriptiveBlockNames

Model Advisor Check ID: mathworks.metricchecks.DescriptiveBlockNames

Display nondescriptive Inport, Outport, and Subsystem block names

Description

Run this metric to determine nondescriptive Inport, Outport, and Subsystem block names. Default names appended with an integer are nondescriptive block names. The results provide the nondescriptive block names at the model and subsystem levels.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Nondescriptive block name metric in By Task > Model Metrics > Readability Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.DescriptiveBlockNames.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of nondescriptive Inport, Outport, and Subsystem block names.

  • AggregatedValue: Number of nondescriptive Inport, Outport, and Subsystem block names for a component and its subcomponents.

  • Measures: 1-D vector containing:

    • Total number of Inport blocks

    • Number of Inport blocks with nondescriptive names

    • Total number of Outport blocks

    • Number of Outport blocks with nondescriptive names

    • Total number of Subsystem blocks

    • Number of Subsystem blocks with nondescriptive names

  • AggregatedMeasures: 1-D vector containing sum of:

    • Total number of Inport blocks

    • Number of Inport blocks with nondescriptive names

    • Total number of Outport blocks

    • Number of Outport blocks with nondescriptive names

    • Total number of Subsystem blocks

    • Number of Subsystem blocks with nondescriptive names

Capabilities and Limitations

The metric:

  • Does not run on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics

Data and structure layer separation metric

Metric Type: Readability

Metric ID: mathworks.metrics.LayerSeparation

Model Advisor Check ID: mathworks.metricchecks.LayerSeparation

Display data and structure layer separation

Description

Run this metric to calculate the data and structure layer separation. The results provide the separation at the model and subsystem level.

Run this metric to calculate the data and structure layer separation. The results provide the separation at the model and subsystem levels.

This metric is available with Simulink Check. To collect data for this metric:

  • Using the Model Advisor, run the check, Data and structure layer separation metric in By Task > Model Metrics > Readability Metrics.

  • Programmatically, use slmetric.Engine.getMetrics with the metric identifier, mathworks.metrics.LayerSeparation.

For guidelines about blocks on model levels, see the MAAB 3.0 guideline db_0143: Similar block types on the model levels.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of basic blocks on a structural level.

  • AggregatedValue: Number of basic blocks on a structural level for a component and its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Does not run on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

See Also

For more information on model metrics, see Collect Model Metrics

MATLAB code analyzer warnings

Metric Type: Compliance

Metric ID: mathworks.metrics.MatlabCodeAnalyzerWarnings

Use this metric to calculate the number of MATLAB code analyzer warnings from MATLAB code in the model

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of MATLAB code analyzer warnings

  • AggregatedValue: Number of MATLAB code analyzer warnings aggregated for a component and subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Analyzes MATLAB code in MATLAB Function blocks

  • Analyzes MATLAB functions in Stateflow charts

  • Runs on library models

  • Analyzes content in masked subsystems

  • If specified, analyzes content of library-linked blocks and referenced models

  • Does not analyze external MATLAB code files

See Also

Model Advisor Check Compliance for High-Integrity Systems

Metric Type: Compliance

Metric ID: mathworks.metrics.ModelAdvisorCheckCompliance.hisl_do178

Use this metric to calculate the fraction of Model Advisor checks that pass for the High-Integrity Systems subgroups.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Percentile

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Fraction of total number of checks passed in High-Integrity Systems subgroups.

  • AggregatedValue: Fraction of total number of checks passed in High-Integrity Systems subgroups aggregated for a component and all of its subcomponents.

  • Measures: Vector containing: number of checks passed in subgroups and number of checks in subgroups.

  • AggregatedMeasures: Vector containing: number of checks passed in subgroups and number of checks in subgroup, for a component and all its subcomponents.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

  • Analyzes content in Stateflow objects.

See Also

Model Advisor Check Compliance for Modeling Standards for MAAB

Metric Type: Compliance

Metric ID: mathworks.metrics.ModelAdvisorCheckCompliance.maab

Use this metric to calculate the fraction of Model Advisor checks that pass for the group Modeling Standards for MAAB

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Percentile

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Fraction of total number of checks passed in MAAB.

  • AggregatedValue: Fraction of total number of checks passed in MAAB aggregated for a component and all of its subcomponents.

  • Measures: Vector containing: number of checks passed in group and number of checks in group.

  • AggregatedMeasures: Vector containing: number of checks passed in group and number of checks in group, for a component and all its subcomponents.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

  • Analyzes content in Stateflow objects.

See Also

Model Advisor Check Issues for High-Integrity Systems

Metric Type: Compliance

Metric ID: mathworks.metrics.ModelAdvisorCheckIssues.hisl_do178

Use this metric to calculate number of issues reported by the subgroups of Model Advisor checks for High-Integrity Systems. An issue is a Simulink object that the Model Advisor check flags. You see an issue in the check output as a hyperlink and in the Simulink Editor with Model Advisor highlighting. For configuration parameter checks, we add one issue to each model component that fails the check.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of issues reported by the High-Integrity Systems checks

  • AggregatedValue: Number of issues reported by the High-Integrity Systems checks aggregated for a component and all of its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

  • Analyzes content in Stateflow objects.

See Also

Model Advisor check issues for MAAB Standards

Metric Type: Compliance

Metric ID: mathworks.metrics.ModelAdvisorCheckIssues.maab

Use this metric to calculate number of issues reported by the group of Model Advisor checks for Modeling Standards for MAAB. An issue is a Simulink object that is flagged by the Model Advisor check. You see an issue in the check output as a hyperlink and in the Simulink Editor with Model Advisor highlighting.

Aggregation properties for this metric are set to:

  • slmetric.metric.AggregationMode: Sum

  • slmetric.metric.AggregateComponentDetails: true

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of issues reported by the Model Advisor for MAAB checks.

  • AggregatedValue: Number of issues reported by the Model Advisor for MAAB checks aggregated for a component and all of its subcomponents.

  • Measures: Not applicable.

Capabilities and Limitations

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • If specified, analyzes the content of library-linked blocks or referenced models.

  • Analyzes content in Stateflow objects.

  • Adds check issues on the configuration set or issues with data objects to the issue count at the model root level.

See Also

Related Topics

Was this topic helpful?