SA0105: Multiple instance calls
Function | Determines and reports instances of function blocks that are called more than once. To ensure that an error message for a repeatedly called function block instance is generated, the attribute {attribute 'analysis:report-multiple-instance-call'} must be added in the declaration part of the function block. |
Reason | Some function blocks are designed such that they can only be called once in a cycle. This test checks whether a call is made at several points. |
Importance | Low |
PLCopen rule | CP16/CP20 |
Sample:
In the following sample the Static Analysis will issue an error for fb2, since the instance is called more than once, and the function block is declared with the required attribute.
Function block FB_Test1 without attribute:
FUNCTION_BLOCK FB_Test1Function block FB_Test2 with attribute:
{attribute 'analysis:report-multiple-instance-calls'}
FUNCTION_BLOCK FB_Test2MAIN program:
PROGRAM MAIN
VAR
fb1 : FB_Test1;
fb2 : FB_Test2;
END_VARfb1();
fb1();
fb2(); // => SA0105
fb2(); // => SA0105