SA0105: Multiple instance callsPermalink

Detects the instances of function blocks that are called multiple times. To do this, the function blocks haves to be marked with the 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

// {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;
ND_VAR

fbA();
fbB();	// SA0105
fbA();
fbB();	// SA0105

--> SA0105: Instance 'fbB' called more than once