Identifiers for POUs and DUTs
When naming POUs and user-defined data unit types (DUTs), you should consider the following points.
- Prefixes of objects are always capitalized.
- The underscore character '_' is used as separator between the prefix and the actual object name.
- The actual object name always starts with a capital letter.
- If interfaces of TcCOM objects are directly embedded, they only have the prefix 'I', e.g. ITcUnknown.
Static Analysis:
Also note the option to check programming conventions using TE1200 PLC Static Analysis.
Prefixes:
Object | Prefix | Description | Sample | Static Analysis |
---|---|---|---|---|
FUNCTION_BLOCK | FB_ | Function block | FB_WritePersistentData | NC0103 |
ACTION |
| Action (of a function block or a program) | MoveAbsolute | NC0106 |
METHOD |
| Method (of a function block or an interface) | Reset | NC0105 |
PROPERTY | according to the return type (see Identifiers for variables and instances) | Property (of a function block, a program or an interface) | nErrorID | NC0107
See also: Placeholder {datatype} |
PROGRAM |
| Program | ModuleControl | NC0102 |
FUNCTION | F_ | Function | F_MeterToInch | NC0104 |
STRUCT | ST_ | Structure | ST_BufferEntry | NC0151 |
ENUM | E_ | Enumeration type | E_MachineState | NC0152 |
Type | T_ | Alias type | T_Nibble | NC0154 |
UNION | U_ | Union | U_Control | NC0153 |
INTERFACE | I_ | Interface | I_Cylinder | NC0108 |
GVL | GVL as name or GVL_ as prefix | Global Variable List | GVL |
|
GCL | Global constant list | GCL |
| |
Param | Param as name or Param_ as prefix | Global parameter list | Param |
|
If a property <name> is directly represented by a variable of the function block, this variable is referred to as _<name>.
Enumeration:
When defining an enumeration, use the attribute {attribute 'qualified_only'}
, which simplifies the use of the enumeration and at the same time makes it unnecessary to abbreviate the enumeration type. See also the topics Use attributes 'qualified_only' and 'strict' for enumeration in section Programming.
{attribute 'qualified_only'}
{attribute 'strict'}
TYPE E_SignalStates :
(
Red := 0,
Yellow,
Green
);
END_TYPE