What are structs and UDTs?
Essentially, structs and UDTs can be described as performing the same function: to hold data that has different types under a parent variable. While they perform the same fundamental function, a UDT is much more powerful than a struct. This is because a struct is a singular instance of a group of variables and a UDT is an actual data type.
Both of these datatypes can be described as a structure.
Structs
Structs are groups of variables defined under a parent variable with the datatype of struct. Siemens regards the use of structs as use only when necessary as they can add considerable overhead to a PLC's performance if used too often. Figure 3.1 shows two sample pumps' global data blocks for storing information associated with the asset:
Both of these pumps use exactly the same struct, Raw_IO
; however, they are not tied together in any way...