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

Page 83

Advertising
background image

L-force | PLC Designer

Concepts and Base Components

DMS 4.1 EN 03/2011 TD29

81

3.7.5

Method

Note: This functionality is only available if supported by the currently used feature
set.

Supporting object oriented programming, methods can be used to describe a
sequence of instructions. Like a function a method is not an independent POU, but
must be assigned to a function block. It can be regarded as a function which contains
an instance of the respective function block.
Also as a means of object oriented programming Interfaces can be used to organize
the methods available in a project. An Interface is a collection of method-"prototypes",
that means a method assigned to an interface just contains a declaration part, but no
implementation. The implementation of the method is done in the function block
which implements the interface and uses the method.
The advantage: You can use one and the same method call in all function blocks which
are implementing the same interface, that means the call can be used for different
purposes. Calling a method is like telling roughly what purpose should be served and it
depends on the currently concerned function block which instructions
(implementation) will be carried out in detail to serve this purpose.

Note: When copying or moving a method from a POU to an Interface the contained
implementations will be deleted automatically. When copying or moving from an
Interface to a POU the user will be asked to specify the desired implementation
language.


Inserting:
To assign a method to a function block or interface select the appropriate function
block or interface entry in the POUs or Device tree and in the context menu use Add
Object / Method. In the Add Method dialog enter a Name, the desired Return type. and
Implementation language. For choosing the return data type you can use the

button to get the Input Assistant dialog. After having confirmed the settings via

Open the method editor view will be opened:

Declaration:
Syntax:
METHOD <method name> : <data type>
VAR_INPUT
x: INT;
END_VAR

For a description on how to define interfaces handling methods, see: Interface.

Advertising