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

Page 1016

Advertising
background image

L-force | PLC Designer

Programming Reference

1014

DMS 4.1 EN 03/2011 TD29

not yet implemented: defined
(resource:identifier)

When applied to a resource identifier, its value is TRUE if a
resource with that particular name is defined; otherwise
FALSE.
Example:

P

recondition: There are two applications App1 and App2. A

resource object "glob_var1" (global variable list) is available
in App1, but not in App2.

{IF defined (resource:glob_var1)}
(*the following code line only will be processed in application
"App1"*)
gvar_x := gvar_x + ivar;
{ELSE}
(*the following code line is only processed in application
"App2"*)
x := x + ivar;
{END_IF}

hasattribute (pou: pou-name, 'attribute') When applied to a POU, its value is TRUE if this particular

attribute is specified in the first line of the POUs declaration
part.
Example:
Precondition: There are two applications App1 and App2.
Function "fun1" is defined in App1 and App2, but in App1
additionally has got an attribute 'vision':
Definition of fun1 in App1:

{attribute 'vision'}

FUNCTION fun1 : INT
VAR_INPUT
i : INT;
END_VAR
VAR
END_VAR
Definition of fun1 in App2:
FUNCTION fun1 : INT
VAR_INPUT
i : INT;
END_VAR
VAR
END_VAR

{IF hasattribute (pou: fun1, 'vision')}
(*the following code line will only be processed in App1*)
ergvar := fun1(ivar);
{END_IF}

Advertising