Supported port data types - connection of structures

The programs of a PLCnext Technology application communicate via IN ports and OUT ports. Only a combination of specific data types is supported. When setting the IN and OUT ports with PLCnext Engineer, you can only enter permitted combinations of data types.

If you implement the configuration without PLCnext Engineer but via an XML configuration file, you have to ensure that only the data type combinations listed in the Elementary data types table are used. If an invalid combination is configured, the startup process of the PLCnext Technology firmware is interrupted.
Debugging: Information on the startup behavior of the firmware is available in the Output.log diagnostic file. The file contains status and error messages as well as warning notes that help you find the source of error. The Output.log file is stored in the controller file system in the /opt/plcnext/logs directory. The file system is accessed via the SFTP protocol (see Common classes: Logging).

In addition to connecting elementary data types and arrays, the GDS also enables the connection of entire structures. Structures are data types that can exist of elements of different data types. The design of structures can be freely defined. 

A StructConnector is used for connecting two struct ports. A StructConnector is a management object that is used to implement the connection of complete structures and the actual data transport. The connection logic of two struct ports therefore contains a comparison based on type definitions. It is checked whether the size of the structure, the data type, the offset, the dimensions and the number of elements match. It is also checked if the alignment of the individual struct members is consistent. This is important for determining the binary compatibility of the structures. The check is implemented without the names of the individual struct members.

The firmware completely copies the structures via memcpy(). Binary compatibility of the type definitions is required for this method.
To compare the size of the structure types and subsequently, the data types and offsets of the individual structure fields, a type check is run.

Below figure shows the connection of structures between tasks. Here, the communication between two programs is implemented via a type SampleStruct port.



•  Web browser recommendation: Chrome/Edge 88 or newer, Firefox ESR 90 or neweror Safari • 
• Published/reviewed: 2022-09-14 • Revision 046 •