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

Page 1018

Advertising
background image

L-force | PLC Designer

Programming Reference

1016

DMS 4.1 EN 03/2011 TD29

hastype (variable:variable, type-spec)

When applied to a variable, its value is TRUE if this particular
variable has the specified type-spec; otherwise FALSE.
ANY
ANY_DERIVED
ANY_ELEMENTARY
ANY_MAGNITUDE
ANY_BIT
ANY_STRING
ANY_DATE
ANY_NUM
ANY_REAL
ANY_INT
LREAL
REAL
LINT
DINT
INT
SINT
ULINT
UDINT
UINT
USINT
TIME
LWORD
DWORD
WORD
BYTE
BOOL
STRING
WSTRING
DATE_AND_TIME
DATE
TIME_OF_DAY
Example:
Precondition: There are two applications App1 and App2.
Variable "g_multitype" is declared in App1 with type LREAL
and in application App2 with type STRING:
{IF (hastype (variable: g_multitype, LREAL))}
(*the following code line will be processed only in App1*)
g_multitype := (0.9 + g_multitype) * 1.1;
{ELSIF (hastype (variable: g_multitype, STRING))}
(*the following code line will be processed only in App2*)
g_multitype := 'dies ist ein multitalent';
{END_IF}

Advertising