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

Page 73

Advertising
background image

L-force | PLC Designer

Concepts and Base Components

DMS 4.1 EN 03/2011 TD29

71

According to the IEC 61131-3 standard, functions can have additional outputs. Those
must be assigned in the call of the function, for example in ST according to syntax
out1 => <output variable 1> | out2 => <output variable 2> | ...further output variables
Example: Function fun is defined with two input variables in1 and in2. The return value
of fun will be written to the locally declared output variables (VAR_OUTPUT) loc1 and
loc2.

fun(in1 := 1, in2 := 2, out1 => loc1, out2 => loc2);

Extensible functions (not yet implemented)
As extension to the IEC 61131-3 standard it is possible to declare functions or methods
with a variable number of input parameters of the same type.

3.7.3

Function Block
A function block is a POU which provides one or more values during the processing of a
PLC program. As opposed to a function, the values of the output variables and the
necessary internal variables shall persist from one execution of the function block to
the next. So invocation of a function block with the same arguments (input
parameters) need not always yield the same output values.
In addition to the functionality described by standard IEC11631-3 object oriented
programming
will be supported and function blocks can be defined as extensions of
other functions blocks and they can include interface definitions concerning method
invocation. This means that "inheritance" can be used when programming with
function blocks.
A function block always is called via an instance, which is a reproduction (copy) of the
function block.

A function block can be added to the project via command "Add Object / POU". To
assign the function block to an existing application, select the application entry in the
Devices view and use the command from the context menu. Otherwise it will be added
to the POUs view. In the Add POU dialog choose type 'Function',
In the 'Add object' dialog choose type 'Function Block', enter a function block name
(<identifier>) and choose the desired implementation language. Additionally the
following options may be set:
Extends: Enter here the name of another function block available in the project, which
should be the base for the current one.
Implements: Enter here the name(s) of interfaces available in the project, which should
be implemented in the current function block. Several interfaces can be entered
separated by commas. In the field Method implementation language for all method
objects created via the interface implementation you can choose the desired
programming language, independently from that set for the function block itself.
After having confirmed the settings with button Open the editor window for the new
function block will open and you can start editing:

Advertising