Communication – Ethernet/IP and working with structures
In today's blog, we will look at the Ethernet/IP communication protocol, or rather its proprietary services implemented by Rockwell for operating PLCs of the ControlLogix and CompactLogix classes, and how they can work with structures. And, of course, what the implementation in Ipesoft D2000 can do.
The Template or UDT (User-Defined Type) in the ControlLogix/CompactLogix PLC family is a key mechanism for structuring data — very similar to struct in C/C++ languages. It allows you to define a structured data type in the Studio 5000 tool, which consists of simple types (e.g. BOOL, SINT, DINT), arrays (e.g. BOOL ARRAY, INT ARRAY) and other structured types.
Subsequently, the programmer creates a transformation (often several variables) of such a type and uses it.
Example of a UDT definition:
TYPE MOTOR :
STRUCT
Speed : REAL;
Current : REAL;
Running : BOOL;
FaultCode : DINT;
END_STRUCT;
END_TYPE
We are naturally interested in working with UDTs and their members from a communication perspective. The good news is that each item of the structure can be addressed separately, creating an I/O tag that directly accesses a simple type or array:
In the screenshot, you can notice, in addition to the address (symbolic name FIRQ101.OutOfRange), that the value of the Attribute type parameter is set to NONE/AUTO. This means that the value type is not explicitly specified, but is determined when reading the OutOfRange member of the FIRQ101 structure.
What is the disadvantage of reading individual members? It may be the speed of communication. If we need to read several UDT members, reading the entire structure may be faster than reading individual members. Of course, it depends on many circumstances (performance and load of the PLC and communication computer, network speed, UDT size and number of members being read), when it is optimal to read the entire UDT and when it is better to access individual items. D2000 does not (yet) try to use heuristics, but leaves the configuration to the user.
If active reading is configured in the I/O tag (the Reading mode parameter has the value Active read), the value of the I/O tag is read directly (a member of the structure). If passive reading is configured, when the value of the entire structure arrives, the corresponding member is parsed and the value of the I/O tag is set. In order to read the entire structure, it is necessary to create a separate I/O tag for the structure, which will have active reading configured:
Such an I/O tag does not acquire a value, but serves only to trigger reading.
Incidentally, it must be said that not every structure can be read directly. If the structure contains internal data structures (e.g., it has members of the TIMER, COUNTER, CONTROL, MESSAGE, MOTION type) to which symbolic access is not allowed, reading the entire structure will fail.
The reader will probably immediately have a question: how are the individual members and their types determined when reading a structure - and how are they organized in the message?
Rockwell offers the answer in the document Logix 5000 Controllers Data Access. It recommends the following procedure:
1. Determining the list of tags (objects). This is done by the Get_Instance_Attribute_List service and the result is a list of objects and their types (simple type, array or template). If the type is structured (template), the response also contains the 12-bit TemplateID (identifier of the corresponding UDT).
2. Determining the UDT attributes. The Get_Attribute_List service is intended for this, which for the specified TemplateID returns:
• Structure Handle (something like CRC, which changes with the change of the UDT structure)
• Number of structure members
• Size of the UDT definition
• Size of the structure data (when reading)
3. Finding the UDT structure using the ReadTagservice. The list of UDT members is read (depending on the size of the UDT definition, even using multiple requests) - their names, types, sizes and offsets within the structure. If the member is of the structure type (i.e. it is a UDT nested in another UDT), it is necessary to repeat points 2 and 3 for this nested structure
This procedure is quite complicated and demanding. The result is a list of as many as tens of thousands of structures and their items, which can take tens of seconds to obtain. For this reason, we have introduced caching of this information in D2000. If the Optimize Structure Read station parameter is set and details of structures and UDTs are being determined, information about templates, their members, structures and all symbols is saved in a text file in the Cache subdirectory of the application directory. If a cache file is found when the communication process starts (or when the communication station is saved), the information is read from it. If not, the information is read from the PLC.
Support for working with UDTs has also been added to the browser dialog in D2000 Cnf. When configuring the address of an I/O tag, it is possible to search for a structure or structure member in the list. This list has been expanded with the Comment column, which contains information about the template (name, TemplateID), the offset of the member within the structure and, if applicable, the bit offset of the BOOL variable.
The following screenshot shows a list of I/O tags with symbolic addresses that specify members of the structure named HSAOC109, with all but the structure itself in the first line being read passively (R=1). On the right is a browsing dialog in which the items of the HSAOC109 structure are filtered.
What is the experience from practice? Working with reading the entire structure has accelerated the reading cycle of the old CompactLogix (firmware from 2005) several times – this PLC did not support any other optimizations supported in D2000 (Multiple Service Packet Service, Symbol Instance ID, Connected Messages).
Conclusion
Support for working with templates and UDTs is another improvement in the D2000 KOM process, which will be welcomed by people using PLCs of the CompactLogix and ControlLogix classes. In addition to speeding up communication, it facilitates configuration by allowing you to display structure members in the D2000 Cnf browser dialog and insert them into the addresses of the I/O tags.
March 27, 2026, Ing. Peter Humaj, www.ipesoft.com