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

Page 1015

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

1013

defined (type:identifier)

When applied to a type identifier, its value is TRUE if a type
with that particular name is declared; otherwise FALSE.
Example:
Precondition: There are two applications App1 and App2.
Data type "DUT" is defined in App1, but not in App2.

{IF defined (type:DUT)}
(*the following code line only will be processed in App1*)
bDutDefined := TRUE;
{END_IF}

defined (pou:pou-name)

When applied to a pou-name, its value is TRUE if a POU or an
action with that particular name is defined; otherwise FALSE.
Example:
Precondition: There are two applications App1 and App2.
POU "CheckBounds" is available in App1, but not in App2.

{IF defined (pou:CheckBounds)}
(*the following code line is only processed in application
"App1"*)
arrTest[CheckBounds(0,i,10)] := arrTest[CheckBounds(0,i,10)]
+ 1;
{ELSE}
(*the following code line is only processed in application
"App2"*)
arrTest[i] := arrTest[i]+1;
{END_IF}

not yet implemented: defined
(task:identifier)

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

P

recondition: There are two applications App1 and App2.

Task "PLC_PRG_Task" is available in App1, but not in App2.

{IF defined (task:PLC_PRG_Task)}
(*the following code line is only processed in application
"App1"*)
erg := plc_prg.x;
{ELSE}
(*the following code line is only processed in application
"App2"*)
erg := prog.x;
{END_IF}

Advertising