Behavior at Runtime

You can use structured OPC UA data types, which you have configured on the Structures tab, in store and retrieve queries and in subscription items for notifications. (See also: Query Destination System.)

If you want to use structured data types in queries, this data is formatted as a JSON string in PCo at runtime. This means that you receive the data in a retrieve query as a JSON string and, in return, you have to transfer the data for a store query as a JSON string.

The transformation of the instance of the structure into a JSON string occurs internally in PCo for a retrieve query. The JSON format is defined in PCo. To generate JSON strings from structured data objects, you can use the expression editor function struct2json.

You can generate a template for the write operation by reading an instance of the relevant structure and storing it at a location of your choice. (See also: Save the JSON Template of the Selected Structures.)

The number of characters that can be used for OPC UA names is greater than the number of characters permitted in JSON structure descriptions. Therefore, when the names of the attributes are transformed, there may be deviations. For example, the name in the PCo-internal JSON display might differ from the name on the OPC server. For that reason, you should always save an example of the instances in JSON format and use the naming convention in the example as a guide.

If you want to use structured OPC UA data types, which you have configured on the Structures tab, in a tag-based notification scenario, you can import the OPC UA data types into the PCo data type repository and thereby generate the PCo data types that correspond to the OPC UA data types. (See also: Import OPC UA Data Types into the PCo Data Type Repository.) You can then select the corresponding structured PCo data types or arrays of structured PCo data types in subscription items. The PCo agent instance converts the data objects into typed, structured PCo data types or array PCo data objects at runtime.