beautypg.com

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

Page 1034

background image

L-force | PLC Designer

Programming Reference

1032

DMS 4.1 EN 03/2011 TD29

Example for a structure definition named Polygonline:

TYPE Polygonline:
STRUCT
Start:ARRAY [1..2] OF INT;
Point1:ARRAY [1..2] OF INT;
Point2:ARRAY [1..2] OF INT;
Point3:ARRAY [1..2] OF INT;
Point4:ARRAY [1..2] OF INT;
End:ARRAY [1..2] OF INT;
END_STRUCT
END_TYPE

Initialization of structures:
Example for the initialization of a structure:

Poly_1:polygonline := ( Start:=[3,3], Point1 =[5,2], Point2:=[7,3], Point3:=[8,5],
Point4:=[5,7], End := [3,5]);

Initializations with variables are not possible. See an example of the initialization of an
array of a structure under 'Arrays'.

Access on structure components:
You can gain access to structure components using the following syntax:
.
So for the above mentioned example of the structure 'polygonline' you can access the
component 'start' by

Poly_1.Start

.

Enumerations
An enumeration is an user-defined data type that is made up of a number of string
constants. These constants are referred to as enumeration values.
Enumeration values are recognized globally in all areas of the project even if they were
declared within a POU.
An enumeration is created as a "DUT" object via the Add Object dialog.

Attention: In contrast to »PLC Designer« V2.3 a local enumeration declaration is no
longer possible except within TYPE.