OPC UA Data Exchange & Structures

General

The read of input values from an OPC UA server is carried out either via subscriptions (spontaneous) or via poll groups (periodically). The preferred variant is the spontaneous transfer as here the transfer of values that have not changed is omitted and so the unnecessary load is prevented.

Subscriptions

The peripheral address defines to which subscription an address is assigned. The parameters of a subscription are defined at the corresponding data point of the type _OPCUASubscription (see Internal Data points of the OPC UA Client). This data point can be partly (some of the settings are only configurable via internal data points) configured via the subscription panel.

If all addresses of a subscription are deactivated or have been deleted, the client removes automatically the subscription on the server.

Monitored Items

The parameters of the monitored items are partly fix-coded or predefined in the subscription. That means that it is assumed that a lot of monitored items are summarized to groups with the same parameters.

Mapping of WinCC OA <-> OPC UA Attributes

Each node in the address space has attributes. These are mapped to their correspondents in the WinCC OA address space.

OPC UA WinCC OA Config Description
Status code: Good or Bad/Uncertain _original.._aut_inv Invalid set by an interface driver.
Attribute value _original.._value Original value.
Set by WinCC OA OPC UA Client _original _..GI Is set when a general query is executed.
Set by WinCC OA OPC UA Client _original _..SI Is set when a general query is executed.
Set by WinCC OA OPC UA Client _online_..stime Source time.
Project-specific mapping

_online.._userbit1

bis

_online.._userbit32

User-defined status bits that are project-specific configured on the client (see Configuration of the Servers).

OPC UA status codes (see OPC UA Status Codes) have to be mapped to WinCC OA user bits in each project.

With the config entry setInvalidForConnLoss all input and in/output addresses of the UPC OA client can be set invalid when a connection loss between client and server occurs. The invalid bit is reset when the next valid value is received.

If the client is shut down properly or the connection to the server is deactivated inside the configuration panel, the invalid bit is not set. It is also not set for alerts and output addresses.

General Query (GQ)

GQ for data values

The general query for data values can be triggered either for all connected servers, for one specific server or for one specific subscription.

For all servers:

Internal data point element: _Driver1.GQ.._original

For one server:

Internal data point element: _Server4.Command.GQ.._original

For one subscription:

Internal data point element: _Subs23.Command.GQ.._original

Automatic GQ

During an automatic general query on connection establishment only those data is queried, which are not in a subscription as the data in any case are sent when the subscription is created. With the aid of the autoGQ config entry the different variants of the automatic query can be set.

GQ for alarms (not supported yet)

The general query for alarms like the GQ for values can be triggered either for all connected servers, for one specific server or for one specific subscription. The data points for triggering the GQ are the same as those for the values (see above). Which GQ is triggered can be determined by the value written on the corresponding data point element.

0 -> values and alarms

1 -> values only

2 -> alarms only

Write command feedback

It is possible to receive a feedback to a OPC UA write operation on the corresponding data point. The feedback can be requested by setting a configurable userbit when writing a DPE with an I/O address. If this is requested the driver sets a another configurable userbit if the result of the write request has been received. If the write fails the driver additionally sets the _aut_inv status bit.

Use the config entry connUserBitWriteFeedback to set the userbit for requesting the feedback. To define the userbit which shall be set when receiving the feedback use config entry userBitWriteFeedback.

In order to consider the userbit which marks the feedback in the low level comparison or in the smoothing, the general driver config entry smoothBit = "Userbit <userbitWriteFeedback>" must be also set.

OPC UA Structured Data Variables

Concept

For the usage of OPC UA structured data variables (SDV) within WinCC OA they must be mapped to JSON strings.

The reasons why WinCC OA does not provide a direct mapping of the structured data to a WinCC OA DP are the following:

  1. A SDV must be handled as a unit, which is very difficult if it is mapped to several DPEs.
  2. Addressing would be very complex because a separate peripheral address for be required each element.
  3. SDV can use data types, which cannot be mapped to WinCC OA DP, e.g. an array of structures.

In principle using a JSON string an intermediate step and the final representation of an SDV in WinCC OA is a mapping variable.

This means, that the DPE containing the address of an SDV is of type string and the content is a JSON string. This allows the application to easily convert the data to a mapping variable for comfortable processing while the mapping is flexible enough to represent arbitrary SDV.

OPC UA Structured Data Variable Mapping

A simple example of an OPC UA DataType Vector is given below. This Vector has the following elements:

X: double
Y: double
Z: double

In WinCC OA this will correspond to a mapping:

mapping m;
m["X"] = 10.0;
m["Y"] = 20.0;
m["Z"] = 30.0;

To write this to an SDV the mapping must be converted into a JSON string (jsonEncode()) and written to a string DPE, with a configured address of the SDV.

For input direction the driver will provide a JSON string on the DPE, which could be converted to a mapping using the function jsonDecode().

This can also be used for very complex nested structures. If there is an array of structures in OPC UA you map this to a dyn_mapping in WinCC OA. If the OPC UA data type has a nested structure the WinCC OA mapping has an nested mapping.

For example, imagine an OPC UA data type, which consists of a build in type string and the Vector type above:

Name: string
V: Vector

You build the corresponding mapping as followed:

mapping m1, m;
m1["X"] = 10.0;
m1["Y"] = 20.0;
m1["Z"] = 30.0;
m["Name"] = "Vector Name";
m["V"] = m1;
Note: It is important that a nested mapping is used and not one mapping with the keys that also represent the hierarchy.

Restrictions

The following restrictions must be considered:

  • Union or OptionSet DataTypes are not supported