Metrics
In the Metrics tab you can select and configure the metrics to be displayed for each function block in the Standard Metrics view when the command 'View Standard Metrics' is executed.
Analysis of libraries The following metrics are also output for the libraries integrated in the project: code size, variable size, stack size and number of calls. |
Compilation errors for violations of upper/lower limits You can use rule SA0150 of the static code analysis to output violations of the upper and lower limits of the activated metrics as compilation errors. |
Configuration of the metrics
Active | You can enable or disable the individual metrics using the checkbox for the respective row. When command 'View Standard Metrics' is executed, the metrics that are enabled in the respective configuration are shown for each programming block in the Standard Metrics view.
|
Lower limit | For each metric you can define an individual upper and lower limit by entering the required number in the respective metric row. If a metric is only limited in one direction, you can leave the configuration for the other direction blank. In other words, you may specify either only the lower limit or only the upper limit. |
Upper limit |
Evaluation of the upper and lower limits
The set upper and lower limits you can be evaluated in two ways.
- Standard Metrics view:
- Enable the metric whose configured upper and lower limits you want to evaluate.
- Execute the Command 'View Standard Metrics'.
- TwinCAT shows the enabled metrics for each programming block in the tabular Standard Metrics view.
- If a value is outside the range defined by an upper and/or lower limit in the configuration, the table cell is shown in red.
- Static Analysis:
- Enable rule 150 as error or warning in the Rules tab.
- Run the Static Analysis (see: Command 'Run static analysis').
- Violations of the upper and/or lower limits are issued as error or warning in the message window.
Overview and description of the metrics
An overview of the metrics and a detailed description of the rules can be found in the next chapter.