Symbol:
Function: The command starts the static analysis for the active application and displays the metrics for all POUs in a table.
Call: Menu bar: “Build View Standard Metrics”
The metrics (code numbers) to be displayed are activated in the project settings. You can access the configuration by clicking “Configure” in the context menu of the displayed table. If a value is outside of the configured upper and lower limits, then the field in the table is highlighted in red.
Standard Metrics
Metric |
Description |
---|---|
“Code size” |
Number of bytes |
“Variable size” |
Number of bytes |
“Stack size” |
Number of bytes |
“Calls” |
Number of calls |
“Tasks” |
Number of calls from tasks |
“Global” |
Number of different global variables |
“I/Os” |
Number of direct object accesses |
“Local” |
Number of local variables |
“Inputs” |
Number of input variables |
“Outputs” |
Number of output variables |
“NOS” |
Number of statements |
“Comments” |
Percentage of comments |
“McGabe” |
McGabe complexity |
“Prather” |
Prather complexity of nesting |
“DIT” |
Depth of inheritance tree |
“NOC” |
Number of children |
“RFC” |
Response for class |
“Elshof” |
Elshof complexity of reference |
“CBO” |
Coupling between objects |
“LCOM” |
Lack of cohesion in methods |
“n1 (Halstead)” |
Number of different used Halstead (n1) operators |
“N1 (Halstead)” |
Number of Halstead (N1) operators |
“n2 (Halstead)” |
Number of different used Halstead (n2) operands |
“N2 (Halstead)” |
Number of operands (N2) |
“HL (Halstead)” |
Halstead length (HL) |
“HV (Halstead)” |
Halstead volume (HV) |
“D (Halstead)” |
Halstead difficulty (D) |
“ SFC branches” |
Number of SFC branches |
“SFC steps” |
Number of SFC steps |
Commands in the context menu
The following commands are provided in the context menu of the table:
-
“Calculate”: The values are refreshed.
-
“Copy Table”: The table is copied to the clipboard. The separators are tabs.
-
“Print Table”: The default dialog for setting up a print job opens.
-
“Export Table”: The table is exported as a CSV file. The separators are semicolons.
-
“Kiviat Diagram”: Requirement: At least three metrics have defined upper and lower limits.
A radar chart is created for the selected POU. This visualizes the quality of POU code with respect to a given standard.
Each metric is depicted as an axis with its origin at the center (value 0) which radiates outward into three concentric ring zones. The inner ring zone represents the range of values below the lower limit defined for the metric. The outer ring represents the range of values above the upper limit. The axes of the metrics are distributed uniformly around the circle.
The current values of the individual metrics on the axes are connected by a line. In the ideal case, the complete line is located in the middle zone.
-
“Configure”: The table for selecting the desired metrics opens. This corresponds to the table in the project settings.
-
“Open POU”: The POU opens in the editor.
Example of a Kiviat diagram for five metrics
The name of the metric is displayed at the end of the respective axis and the name of the POU is displayed in the upper right corner of the diagram.
