Best practices for using structures

Structures allow you to group related variables from a PLC project into a single logical unit within the visualization. This keeps projects structured, ensures consistent data management, and enables you to efficiently implement reusable visualization patterns using StructureUserControls.

Benefits of structures:

  • Logical grouping of related variables

  • Centralized and consistent data management

  • Higher reusability of visualization components

  • Reduced maintenance overhead when making updates

  • Direct integration with StructureUserControls

While structures streamline project configuration significantly, there are several technical constraints and design considerations essential for reliable, high-performance operation. The following guidelines will help avoid common pitfalls and get the most out of your structures.

Do not use structure variables with Key controls

Problem
Binding a Key control directly to a variable inside a structure can cause write errors when the Key is pressed. This may lead to unexpected behavior, such as a button latching permanently in a TRUE state.

Recommendation
Use only standalone variables (outside of structures) for Key controls.
Starting with EASY UI Designer 1.9, the Select Variable dialog automatically restricts Key controls to valid standalone variables, preventing the selection of structure variables altogether.

Use only supported data types

Problem
If a structure contains any unsupported data types, the entire structure becomes invalid. As a result, its values cannot be correctly displayed or processed in the visualization.

Recommendation
Use only data types supported by EASY UI Designer (see Supported and not supported data types).

Starting with version 1.9, EASY UI Designer validates data types during variable browsing and displays relevant warnings. Unsupported variables cannot be selected. This applies to both standalone variables and complete structures. Consequently, nested structures containing invalid child elements will also be hidden from browsing. As a result, they are not added to the project variables, are excluded from communication, and cannot cause unintended runtime behavior.

Configure the correct access rights

Problem
For EASY UI Designer to utilize a structure, it must be able to read the structure definition directly from the PLC. This read access is required to parse the structure's members and verify their data types.
If a structure is configured as Write Only, the visualization cannot inspect the definition. From the perspective of EASY UI Designer, the structure is invalid and will not be processed.

Recommendation
As a general best practice for stable OPC UA communication, separate read and write data into dedicated structures (see Preventing value flickering). This separation avoids concurrent read/write operations on the same structure, reducing the risk of update artifacts and transient states. Verify that access rights are properly assigned across all utilized structures to ensure smooth communication.

Preventing value flickering

Problem
When using structures, displayed values may briefly “flicker” or jump between states. This occurs due to how OPC UA handles structured data: the entire structure is transferred as a single contiguous packet. When both the PLC and the HMI modify values simultaneously, multiple sequential telegrams are queued and processed one after another. During this exchange, intermediate values can become visible on the screen.

Recommendations
To eliminate this artifact, separate setpoints (commands) and process values (status):

Avoid:

STRUCT: MachineData 
  • SetSpeed 
  • SetPressure 
  • ActualSpeed 
  • ActualPressure

Recommended:

STRUCT: MachineCommands (write) 
  • SetSpeed 
  • SetPressure 
STRUCT: MachineStatus (read) 
  • ActualSpeed 
  • ActualPressure

Or address them as individual variables:

• MachineCommands.SetSpeed 
• MachineCommands.SetPressure 
• MachineStatus.ActualSpeed 
• MachineStatus.ActualPressure

This pattern ensures that setpoints are written and actual values are read independently without interfering with each other—the preferred design pattern for OPC UA information modeling.

Summary

To ensure stability and optimal performance when working with structures, follow these core rules:

  • Use structures for logical grouping.

  • Stick exclusively to supported data types.

  • Correctly configure and verify read and write access rights.

  • Separate status data from command data.

  • Use standalone variables for rapidly changing values.

Avoid the following:

  • Never bind structure variables to Key controls.

  • Avoid unsupported data types.

  • Avoid bundling high-frequency or highly dynamic signals into large structures.

Related topics: