L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 84

Advertising
background image

L-force | PLC Designer

Concepts and Base Components

82

DMS 4.1 EN 03/2011 TD29

Method call:
Method calls are also named "virtual function calls". Please see: Method invocation.

Note:

All data of a method is temporary and only valid during the execution of the method
(stack variables).

In the body of a method access to the function block instance variables is allowed.

THIS Pointer: You can use identifier "THIS" to point directly to the implicit function
block instance, which is available automatically. Notice that a locally declared
variable might hide a function block variable. So in case of the example shown
above in the syntax description "THIS^.x" would not refer to the methods input x,
but to the function block variable x.

VAR_IN_OUT or VAR_TEMP-variables of the function block can not be accessed in a
method!

Methods defined in an Interface are only allowed to have input-, output and inout-
variables, but no body (implementation part).

Methods, like functions, can have additional outputs. Those must be assigned
during method invocation


Special methods for a function block:
Init method
: A method named "FB_init" always is declared implicitly, but also can be
declared explicitly. It contains initialization code for the function block as declared in
the declaration part of the function block. See: FB_Init method.
Reinit method: If a method named "FB_reinit" is declared for a function block instance,
it will be called after the instance has been copied and will reinitialize the new
instance module. See: FB_reinit method.
Exit method: If an exit method named "FB_exit" is desired (for example for
deallocating any , it must be declared explicitly. There is no implicit declaration. The
exit method will be called for each instance of the function block before a new
download, a reset or during online change for all moved or deleted instances. See:
FB_exit method.
Properties: Set and Get methods; see: Property.

Advertising