Configuration | Rules Function block FB_Test1 without attribute: FUNCTION_BLOCK FB_Test1 Function block FB_Test2 with attribute: {attribute 'analysis:report-multiple-instance-calls'} FUNCTION_BLOCK FB_Test2 MAIN program: PROGRAM MAIN VAR fb1 : FB_Test1; fb2 : FB_Test2; END_VAR fb1(); fb1(); fb2(); // => SA0105 fb2(); // => SA0105 4.2.1.5.9 SA0106: Virtual method calls in FB_init | SA0106: Virtual method calls in FB_init Sample: Function block FB_Base has the methods FB_init and MyInit. FB_init calls MyInit for initialization. Function block FB_Sub is derived from FB_Base. FB_Sub.MyInit overwrites or extends FB_Base.MyInit. MAIN instantiates FB_Sub.
During this process it uses the instance variable nSub before it was initialized, due to the call sequence during the initialization. Function block FB_Base: FUNCTION_BLOCK FB_Base VAR nBase : DINT; END_VAR Method FB_Base.FB_init: METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; bInCopyCode : BOOL; END_VAR VAR nLocal : DINT; END_VAR nLocal := MyInit(); // => SA0106 Method FB_Base.MyInit: METHOD MyInit : DINT nBase := 123; // access to member of FB_Base MyInit := nBase; Function block FB_Sub: FUNCTION_BLOCK FB_Sub EXTENDS FB_Base VAR nSub : DINT; END_VAR Method FB_Sub.MyInit: METHOD MyInit : DINT TE1200 60 Version:
2.11.1 Function Determines method calls in the method FB init of a basic function block, which are _ overwritten by a function block derived from the basic FB. Reason In such cases it may happen that the variables in overwritten methods are not initialized in the base FB. Importance High