Skip to main content

SA0105: Multiple instance calls

Detects the instances of function blocks which are called multiple times. For this purpose, the function blocks have to be marked with the following pragma:

{attribute 'analysis:report-multiple-instance-calls'}

Justification: Some function blocks are designed in such as way that they can be called only one time in the cycle. This test checks whether or not a call is made in multiple locations.

Importance: Low

PLCopen rule: CP16 / CP20

Example 93. Example
// {attribute 'analysis:report-multiple-instance-calls'} Deactivated
FUNCTION_BLOCK FB_DoA
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
    iA : INT;
END_VAR
iA := iA + 1;
{attribute 'analysis:report-multiple-instance-calls'}
FUNCTION_BLOCK FB_DoB
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
    iB : INT;
END_VAR
iB := iB + 1;
PROGRAM PLC_PRG
VAR
    fbA : FB_DoA;
    fbB : FB_DoB;
END_VAR
fbA();
fbB();    // SA0105
fbA();
fbB();    // SA0105

Output in the Messages view:

  • sa_icon_message.png SA0105: Instance 'fbB' called more than once