The Number Of Instances metric is used to get information about how often a complex type (function block, enumeration, structure, and so on) is used as variable type on programming objects (programs, function blocks, and so on).
Inside the declaration part, you can define variables. Each variable has an associated data type (complex type or elementary type). When used, the instance count of this data type is increased by +1.
Example
Number Of Instances calculation example:
SR_Main
VAR
fbMyAlphaModule: FB_MyAlphaModule;
END_VAR
FB_MyAlphaModule
VAR
astAxisStructures: ARRAY [1..10] OF ST_MyAxisStructure;
fbSubModule: FB_MySubModule;
END_VAR
FB_MySubModule
VAR
fbAxis: FB_MyAxis;
END_VAR
ST_MyAxisStructure
VAR
iID: INT;
fbAxis: FB_MyAxis;
END_VAR
FB_MyAxis
VAR
END_VAR
Number Of Instances Results
Number Of Instances (FB_MyAlphaModule) = 1
Number Of Instances (FB_MySubModule) = 1
Number Of Instances (ST_MyAxisStructure) = 1
Number Of Instances (FB_MyAxis) = 2