Complexity of reference (Elshof)
Title short form | Elshof |
Categories | Efficiency, maintainability, reusability |
Definition | Complexity of the data flow of a POU The complexity of reference is calculated using the following formula: <Number of variables used> / <Number of variable accesses> |
Further information | Only variable accesses in the implementation part of the POU are taken into account. |
Sample:
PROGRAM MAIN
VAR
i, j : INT;
k : INT := GVL.m;
b, c : BOOL;
fb : FB_Sample;
END_VARfb(paramA := b); // +3 accesses (fb, paramA and b)
i := j; // +2 accesses (i and j)
j := GVL.d; // +2 accesses (j and GVL.d)For the metric Complexity of reference (Elshof), MAIN:
- Number of variables used = 6
- Number of variable accesses = 7
- Complexity of reference (Elshof) = number of variables used/number of variable accesses = 6/7 = 0.85
Attention:
- c and k are not used and therefore do not count as "variables used".
- The assignment
k : INT := GVL.m;is not counted as it is part of the declaration of the program.