beckhoff TE1200 — 4.2.1.5.8 SA0105: Multiple instance calls

Configuration | Rules FUNCTION_BLOCK FB_Sample VAR_INPUT fInput : LREAL; END_VAR GVL: {attribute 'qualified_only'} VAR_GLOBAL fTest : LREAL; // => no error SA0103: Since the target system has a FPU, SA0103 does not apply. nTest : LINT; // => error reporting depends on the solution platform: // - SA0103 error if solution platform is set to "TwinCAT RT(x86)" // - no error SA0103 if solution platform is set to "TwinCAT (x64)" sTest : STRING; // => SA0103 wsTest : WSTRING; // => SA0103 aTest : ARRAY[0..2] OF INT; // => SA0103 aTest2 : ARRAY[0..2] OF INT; // => SA0103 fbTest : FB_Sample; // => SA0103 stTest : ST_Sample; // => SA0103 END_VAR Program MAIN1, called by task PlcTask1:

PROGRAM MAIN1 VAR END_VAR GVL.fTest := 5.0; GVL.nTest := 123; GVL.sTest := 'sample text'; GVL.wsTest := "sample text"; GVL.aTest := GVL.aTest2; GVL.fbTest.fInput := 3; GVL.stTest.nTest := GVL.stTest.nTest + 1; Program MAIN2, called by task PlcTask2: PROGRAM MAIN2 VAR fLocal : LREAL; nLocal : LINT; sLocal : STRING; wsLocal : WSTRING; aLocal : ARRAY[0..2] OF INT; aLocal2 : ARRAY[0..2] OF INT; fLocal2 : LREAL; nLocal2 : INT; END_VAR fLocal := GVL.fTest + 1.5; nLocal := GVL.nTest + 10; sLocal := GVL.sTest; wsLocal := GVL.wsTest; aLocal := GVL.aTest; aLocal2 := GVL.aTest2; fLocal2 := GVL.fbTest.fInput; nLocal2 := GVL.stTest.nTest; 4.2.1.5.8 SA0105: Multiple instance calls | SA0105:

Multiple instance calls 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. TE1200 59 Version: 2.11.1 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'} [} 125] 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