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 for Nonvirtual Block Count. You can also create custom metrics for Model Advisor checks. For more information, see Change Model Advisor Checks in Metrics Dashboard.
To obtain the metric IDs for the available metrics in your metric engine, use slmetric.metric.getAvailableMetrics
.
availableMetricIDs = slmetric.metric.getAvailableMetrics()
slmetric.metric.getAvailableMetrics()
returns the available metrics in
your metrics engine, including custom metrics. For information on how to configure and use
custom metrics to customize the dashboard, see Customize Metrics Dashboard Layout and Functionality.
Size Metrics
To collect metric data on a model or subsystem, run these metrics.
Metric | Description |
---|---|
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 lines of code for the following Stateflow blocks in the model:
|
Subsystem Depth Metric | Calculates the subsystem depth of the model. |
Input Output Metric | Calculates the number of inputs and outputs in your model. |
Explicit Input Output Metric | Calculates the number of inputs and outputs in your model. |
File Metric | Calculates the number of model and library files. |
MATLAB Function Metric | Calculates the number of MATLAB Function blocks in your model. |
Model File Count | Calculates the number of model files. |
Parameter Metric | Calculates the number of instances of data objects that parameterize the behavior of a model. |
Stateflow Chart Metric | Calculates the number of Stateflow charts in your model. |
For more information on model metrics, see Collect Model and Testing Metrics.
Architecture Metrics
To learn more about the architecture for a model or subsystem, run these metrics.
Metric | Description |
---|---|
Cyclomatic Complexity Metric | Calculates the cyclomatic complexity of the model. |
Clone Content Metric | Calculates the fraction of total number of subcomponents that are clones. |
Clone Detection Metric | Calculates the number of clones in components across the model hierarchy. |
Library Content Metric | Calculates the fraction of total number of components that are linked library blocks. |
For more information on model metrics, see Collect Model and Testing Metrics.
Compliance Metrics
To determine if your model or subsystem is compliant with standards and guidelines, run one or more of these metrics.
Metric | Description |
---|---|
MATLAB Code Analyzer Warnings | Determines warnings for MATLAB code blocks in your model. |
Diagnostic Warnings Metric | Calculates the number of diagnostic warnings reported. |
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 MAB | Returns the fraction of checks the model passes from Model Advisor MAB 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 MAB Standards | Reports the number of issues from Model Advisor MAAB Standard. |
For information on compliance metrics that obtain compliance and issues metric data on your Model Advisor configuration, see Compliance Metrics for Model Advisor Configurations.
For more information on model metrics, see Collect Model and Testing Metrics.
Readability Metrics
Run these metrics to determine readability for a model or subsystem.
Metric | Description |
---|---|
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 and Testing Metrics.
Compliance Metrics for Model Advisor Configurations
The Metrics Dashboard and metric APIs can obtain compliance and issues metric data for your Model Advisor configuration or for an existing check group, such as the MISRA checks. To set up your own Model Advisor configuration, see Use the Model Advisor Configuration Editor to Customize the Model Advisor.
You can configure Model Advisor compliance metrics and Model Advisor compliance issues metrics by creating metric IDs for custom Model Advisor metrics. For more information, see Change Model Advisor Checks in Metrics Dashboard.
Model Advisor Compliance Metrics
Metric Type: Compliance
Family ID:
mathworks.metrics.ModelAdvisorCheckCompliance
Metric ID: <Family ID>.<Model Advisor Check Group ID>
Use this metric to calculate the fraction of Model Advisor checks that pass for the selected group of checks.
For Model Advisor compliance metrics, the Family ID is
mathworks.metrics.ModelAdvisorCheckCompliance
.
To obtain the Model Advisor Check Group ID, open the Model Advisor Configuration Editor and select the folder that contains the desired group of checks. The Check Group ID is shown in the Information tab. For information on the Model Advisor Configuration Editor, see Use the Model Advisor Configuration Editor to Customize the Model Advisor.
For an example of how to use Model Advisor compliance metrics, see Change Model Advisor Checks in Metrics Dashboard.
Model Advisor Compliance Issues Metrics
Metric Type: Compliance
Family ID:
mathworks.metrics.ModelAdvisorCheckIssues
Metric ID: <Family ID>.<Model Advisor Check Group ID>
Use this metric to calculate the number of issues reported by the selected group of Model Advisor checks. This metric counts each Model Advisor check, in the selected group of Model Advisor checks, that produces a warning or failure.
For Model Advisor compliance issues metrics, the Family
ID is mathworks.metrics.ModelAdvisorCheckIssues
.
To obtain the Model Advisor Check Group ID, open the Model Advisor Configuration Editor and select the folder that contains the desired group of checks. The Check Group ID is shown in the Information tab. For information on the Model Advisor Configuration Editor, see Use the Model Advisor Configuration Editor to Customize the Model Advisor.
For an example of how to use Model Advisor compliance metrics, see Change Model Advisor Checks in Metrics Dashboard.
Simulink Block Metric
Metric Information
Metric ID:
mathworks.metrics.SimulinkBlockCount
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.SimulinkBlockCount
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, use getMetrics
with the metric identifier,
mathworks.metrics.SimulinkBlockCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
Collection
To collect data for this metric using the Model Advisor, run the check, Simulink block metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of blocks in the model or the subsystem. The check does not analyze referenced models or return aggregated results.
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.
Subsystem Metric
Metric Information
Metric ID:
mathworks.metrics.SubSystemCount
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.SubSystemCount
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, use getMetrics
with the metric identifier,
mathworks.metrics.SubSystemCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Collection
To collect data for this metric using the Model Advisor, run the check, Subsystem metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of subsystems in the model or the subsystem. The check does not analyze referenced models or return aggregated results.
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.
Library Link Metric
Metric Information
Metric ID:
mathworks.metrics.LibraryLinkCount
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.LibraryLinkCount
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, use getMetrics
with the metric identifier,
mathworks.metrics.LibraryLinkCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Collection
To collect results for this metric using the Model Advisor, run the check, Library link metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of library links in the model or the subsystem. The check does not analyze referenced models or return aggregated results.
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.
Effective Lines of MATLAB Code Metric
Metric Information
Metric ID:
mathworks.metrics.MatlabLOCCount
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.MatlabLOCCount
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, use getMetrics
with the metric identifier,
mathworks.metrics.MatlabLOCCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Collection
To collect results for this metric using the Model Advisor, run the check, Effective lines of MATLAB code metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of effective lines of MATLAB code for each MATLAB Function block and for MATLAB functions in Stateflow charts in the model. The check does not analyze referenced models or return aggregated results.
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.
Stateflow Chart Objects Metric
Metric Information
Metric ID:
mathworks.metrics.StateflowChartObjectCount
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.StateflowChartObjectCount
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, use getMetrics
with the metric identifier,
mathworks.metrics.StateflowChartObjectCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
Collection
To collect results for this metric using the Model Advisor, run the check, Stateflow chart objects metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of Stateflow objects in each chart in the model. The check does not analyze charts in referenced models or return aggregated results.
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.
Lines of Code for Stateflow Blocks Metric
Metric Information
Metric ID:
mathworks.metrics.StateflowLOCCount
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.StateflowLOCCount
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, use getMetrics
with the metric identifier,
mathworks.metrics.StateflowLOCCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
Collection
To collect results for this metric using the Model Advisor, run the check, Lines of code for Stateflow blocks metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of code lines for Stateflow blocks in the model. The check does not analyze referenced models or return aggregated results.
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.
Subsystem Depth Metric
Metric Information
Metric ID:
mathworks.metrics.SubSystemDepth
Description
Metric Type: Size
Model Advisor Check ID:
mathworks.metricchecks.SubSystemDepth
Use this metric to count the relative depth of all hierarchical children for a given subsystem or model starting from the given component, or root of analysis. Depth traversal analysis stops when it reaches a referenced model or a library. Depth is restarted with 0 for each of these components.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.SubSystemDepth
.
The slmetric.metric.AggregationMode
property setting is
None
.
Computation Details
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
Collection
To collect results for this metric using the Model Advisor, run the check, Subsystem depth metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the depth of the subsystems in the model. The check does not analyze referenced models or return aggregated results.
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.Measures
: Not applicable.
Input Output Metric
Metric Information
Metric ID:
mathworks.metrics.IOCount
Description
Metric Type: Size
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.
The slmetric.metric.AggregationMode
property setting is
Max
.
Computation Details
The metric:
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: total interface size or sum of the elements ofMeasures
.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.
Explicit Input Output Metric
Metric Information
Metric ID:
mathworks.metrics.ExplicitIOCount
Description
Metric Type: Size
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 getMetrics
with the metric identifier,
mathworks.metrics.ExplicitIOCount
.
The slmetric.metric.AggregationMode
property setting is
Max
.
Computation Details
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.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Total interface size or sum of the elements ofMeasures
.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.
File Metric
Metric Information
Metric ID:
mathworks.metrics.FileCount
Description
Metric Type: Size
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 getMetrics
with the metric identifier,
mathworks.metrics.FileCount
.
The slmetric.metric.AggregationMode
property setting is
None
.
Computation Details
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
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.
MATLAB Function Metric
Metric Information
Metric ID:
mathworks.metrics.MatlabFunctionCount
Description
Metric Type: Size
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 getMetrics
with the metric identifier,
mathworks.metrics.MatlabFunctionCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
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.
Model File Count
Metric Information
Metric ID:
mathworks.metrics.ModelFileCount
Description
Metric Type: Size
Use this metric to count the number of model files. This metric is available with
Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.ModelFileCount
.
The slmetric.metric.AggregationMode
property setting is
None
.
Computation Details
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
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.
Parameter Metric
Metric Information
Metric ID:
mathworks.metrics.ParameterCount
Description
Metric Type: Size
Use this metric to calculate the number of instances of parameter data inside a Simulink system.
A parameter is a variable used by a Simulink block or object of a basic type (which includes single
,
double
, uint8
, uint16
,
uint32
, int8
, int16
,
int32
, boolean
, logical
,
struct
, char
, cell
),
Simulink.Parameter
object, Simulink.Variant
object, or enum
value. This metric returns every instance of a
parameter in a model, which means that the metric counts each instance of a parameter
separately. The parameter data must be located in the base workspace, the model
workspace, or a data dictionary.
For example, the model f14
uses two instances of the parameter
Zw
. One instance is in block f14/Gain
at the
root level of the model. One instance is in block f14/Aircraft Dynamics
Model/Transfer Fcn.2
in the Aircraft Dynamics Model
subsystem. The metric mathworks.metrics.ParameterCount
includes both
of these instances of parameter Zw
when it calculates the number of
parameter instances in the f14
model and its subsystems.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.ParameterCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
This metric:
Filters results from 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.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Number of parameter instances used inside a component.AggregatedValue
: Number of parameter instances for a component and its subcomponents.Measures
: Not applicable.
Stateflow Chart Metric
Metric Information
Metric ID:
mathworks.metrics.StateflowChartCount
Description
Metric Type: Size
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 getMetrics
with the metric identifier,
mathworks.metrics.StateflowChartCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
Runs on library models.
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
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.
Cyclomatic Complexity Metric
Metric Information
Metric ID:
mathworks.metrics.CyclomaticComplexity
Description
Metric Type: Architecture
Model Advisor Check ID:
mathworks.metricchecks.CyclomaticComplexity
Use this metric to calculate the cyclomatic complexity of the model. Cyclomatic complexity is a measure of the structural complexity of a model. The complexity measure can be different for the generated code than for the model due to code features that this analysis does not consider, such as consolidated logic and error checks. To compute the cyclomatic complexity of an object (such as a block, chart, or state), Simulink Check uses this formula:
N is the number of decision points that the object represents and on is the number of outcomes for the nth decision point. The calculation considers a vectorized operation or a Multiport switch block as a single decision point. The tool adds 1 to the complexity number for models, atomic subsystems, and Stateflow charts.
The results provide the local and aggregated cyclomatic complexity for the:
Model
Subsystems
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, use getMetrics
with the metric identifier,
mathworks.metrics.CyclomaticComplexity
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Does not analyze referenced models in accelerated mode.
Collection
To collect data for this metric using the Model Advisor, run the check, Cyclomatic complexity metric in By Task > Model Metrics > Complexity Metrics. The Model Advisor check displays the local cyclomatic complexity for the root model and for Simulink and Stateflow objects in the system. The check does not analyze referenced models or return aggregated results.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Local cyclomatic complexity.AggregatedValue
: Aggregated cyclomatic complexity.Measures
: Not applicable.
For more information on complexity, see:
Cyclomatic Complexity for Stateflow Charts (Simulink Coverage)
Specify Coverage Options (Simulink Coverage)
Clone Content Metric
Metric Information
Metric ID:
mathworks.metrics.CloneContent
Description
Metric Type: Architecture
Use this metric to calculate the fraction of the total number of subcomponents that are clones. Clones must have identical block types and connections but they can have different parameter values. For more information on clone detection, see Enable Component Reuse by Using Clone Detection.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.CloneContent
.
The slmetric.metric.AggregationMode
property setting is
None
.
Computation Details
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Fraction of total number of subcomponents that are clonesAggregatedValue
: Not applicable.Measures
: Vector containing number of clones, total number of components, and clone group number.
Clone Detection Metric
Metric Information
Metric ID:
mathworks.metrics.CloneDetection
Description
Metric Type: Architecture
Use this metric to count the number of clones in a model. Clones must have identical
block types and connections but they can have different parameter values. This metric is
available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.CloneDetection
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
Analyzes content in masked subsystems.
If specified, analyzes the content of library-linked blocks or referenced models.
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.
Library Content Metric
Metric Information
Metric ID:
mathworks.metrics.LibraryContent
Description
Metric Type: Architecture
Use this metric to calculate the fraction of total number of components that are
linked library blocks. This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.LibraryContent
.
The slmetric.metric.AggregationMode
property setting is
None
.
Computation Details
If specified, analyzes the content of library-linked blocks or referenced models.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Fraction of the total number of subcomponents that are linked library blocks.AggregatedValue
: Not applicable.Measures
: Vector containing the number of linked library blocks and total number of components
MATLAB Code Analyzer Warnings
Metric Information
Metric ID:
mathworks.metrics.MatlabCodeAnalyzerWarnings
Description
Metric Type: Compliance
Use this metric to calculate the number of MATLAB code analyzer warnings from MATLAB code in the model. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Number of MATLAB code analyzer warningsAggregatedValue
: Number of MATLAB code analyzer warnings aggregated for a component and subcomponents.Measures
: Not applicable.
For more information on code analyzer warnings, see Check Code for Errors and Warnings Using the Code Analyzer.
Diagnostic Warnings Metric
Metric Information
Metric ID:
mathworks.metrics.DiagnosticWarningsCount
Description
Metric Type: Compliance
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 getMetrics
with the metric identifier,
mathworks.metrics.DiagnosticWarningsCount
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
If specified, analyzes the content of library-linked blocks or referenced models.
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.
Model Advisor Check Compliance for High-Integrity Systems
Metric Information
Metric ID:
mathworks.metrics.ModelAdvisorCheckCompliance.hisl_do178
Description
Metric Type: Compliance
Family ID:
mathworks.metrics.ModelAdvisorCheckCompliance
Use this metric to calculate the fraction of Model Advisor checks that pass for the High-Integrity Systems subgroups. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Percentile
.
Computation Details
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.
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.
Results Details
For this metric, instances of the slmetric.metric.ResultDetail
Value
property provides these results:
A value of 0 indicates that a check did not run.
A value of 1 indicates that a check passed.
A value of 2 indicates a check warning.
A value of 3 indicates a failure.
For more information on the checks, see Model Advisor Checks for DO-178C/DO-331 Standards Compliance.
Model Advisor Check Compliance for Modeling Standards for MAB
Metric Information
Metric ID:
mathworks.metrics.ModelAdvisorCheckCompliance.maab
Description
Metric Type: Compliance
Family ID:
mathworks.metrics.ModelAdvisorCheckCompliance
Use this metric to calculate the fraction of Model Advisor checks that pass for the group Modeling Standards for MAB. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Percentile
.
Computation Details
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.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Fraction of total number of checks passed in MAB.AggregatedValue
: Fraction of total number of checks passed in MAB 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.
Results Details
For this metric, instances of the slmetric.metric.ResultDetail
Value
property provides these results:
A value of 0 indicates that a check did not run.
A value of 1 indicates that a check passed.
A value of 2 indicates a check warning.
A value of 3 indicates a failure.
For more information on the checks, see Using Model Advisor Checks for JMAAB Modeling Guidelines.
Model Advisor Check Issues for High-Integrity Systems
Metric Information
Metric ID:
mathworks.metrics.ModelAdvisorCheckIssues.hisl_do178
Description
Metric Type: Compliance
Family ID:
mathworks.metrics.ModelAdvisorCheckIssues
Use this metric to calculate number of issues reported by the subgroups of Model Advisor checks for High-Integrity Systems. This metric counts each Model Advisor check that produces a warning or failure. If a check contains links to blocks, this metric counts one issue for each linked block. Checks with links to the model are highlighted in the Simulink Editor. If a check does not contain links to blocks, this metric counts one issue. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Number of issues reported by the High-Integrity Systems checksAggregatedValue
: Number of issues reported by the High-Integrity Systems checks aggregated for a component and all of its subcomponents.Measures
: Not applicable.
For more information on the checks, see Model Advisor Checks for DO-178C/DO-331 Standards Compliance.
Model Advisor Check Issues for MAB Standards
Metric Information
Metric ID:
mathworks.metrics.ModelAdvisorCheckIssues.maab
Description
Metric Type: Compliance
Family ID:
mathworks.metrics.ModelAdvisorCheckIssues
Use this metric to calculate number of issues reported by the group of Model Advisor checks for Modeling Standards for MAB. This metric counts each Model Advisor check that produces a warning or failure. If a check contains links to blocks, this metric counts one issue for each linked block. Checks with links to the model are highlighted in the Simulink Editor. If a check does not contain links to blocks, this metric counts one issue. This metric is available with Simulink Check.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Results
For this metric, instances of slmetric.metric.Result
provide the
following results:
Value
: Number of issues reported by the Model Advisor for MAB checks.AggregatedValue
: Number of issues reported by the Model Advisor for MAB checks aggregated for a component and its subcomponents.Measures
: Not applicable.
For more information on the checks, see Using Model Advisor Checks for JMAAB Modeling Guidelines.
Nondescriptive Block Name Metric
Metric Information
Metric ID:
mathworks.metrics.DescriptiveBlockNames
Description
Metric Type: Readability
Model Advisor Check ID:
mathworks.metricchecks.DescriptiveBlockNames
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, use getMetrics
with the metric identifier,
mathworks.metrics.DescriptiveBlockNames
.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Collection
To collect results for this metric using the Model Advisor, run the check, Nondescriptive block name metric in By Task > Model Metrics > Readability Metrics. The Model Advisor check displays the number of nondescriptive Inport, Outport, and Subsystem block names in the model or subsystem. The check does not display the result for each type of block separately. The check does not analyze referenced models or return aggregated results.
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
Data and Structure Layer Separation Metric
Metric Information
Metric ID:
mathworks.metrics.LayerSeparation
Description
Metric Type: Readability
Model Advisor Check ID:
mathworks.metricchecks.LayerSeparation
Run this metric to calculate the data and structure layer separation. The results provide the separation at the model and subsystem level.
This metric is available with Simulink
Check. To collect data for this metric, use getMetrics
with the metric identifier,
mathworks.metrics.LayerSeparation
.
For guidelines about blocks on model levels, see the MAB guideline db_0143: Usable block types in model hierarchy.
The slmetric.metric.AggregationMode
property setting is
Sum
.
Computation Details
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.
Collection
To collect results for this metric using the Model Advisor, run the check, Data and structure layer separation metric in By Task > Model Metrics > Readability Metrics. The Model Advisor check displays the separation for the model or subsystem. The check does not analyze referenced models or return aggregated results.
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.