Key frames and delta frames

In TwinCAT 3 OPC UA Pub/Sub, data records can be transmitted either as key frames or as delta frames. These mechanisms serve to optimize the network bandwidth and the efficient transmission of process data.

Key frames

A key frame always contains the complete data record of all configured fields of a DataSetMessage. The receiver can reconstruct the complete state of all transmitted variables with a key frame.

Properties of key frames:

Key frames thus form the reference basis for subsequent delta frames.

Delta frames

A delta frame only contains the values of the fields whose content has changed since the last frame sent. This reduces the size of the transmitted messages, especially if only a few variables change within a DataSet.

Properties of delta frames:

A subscriber must therefore first receive a key frame before delta frames can be applied correctly.

Interaction of key frames and delta frames

When delta frame functionality is activated, the publisher typically sends a sequence of delta frames that is regularly interrupted by a key frame.

This ensures that:

The frequency of the key frames is determined via the "KeyFrameCount" parameter.

In the case of UADP, there is a special feature in the interaction of key frames and delta frames: If all fields of a data record change, then a key frame must be sent. Even if the delta frame is larger than the key frame (possible due to the coding), a key frame must be sent.

Parameter: KeyFrameCount

The KeyFrameCount parameter defines after how many sent messages a key frame is transmitted again.

Example:

KeyFrameCount = 3

In this case:

  1. a key frame is sent.
  2. followed by up to two delta frames.
  3. then a key frame again.

The sequence therefore looks as follows, for example:

Key, Delta, Delta, Key, Delta, ...

Smaller values for "KeyFrameCount" mean that a complete data set is transmitted more frequently, which increases robustness but also increases the network load.

Parameter: KeepAliveInterval

The KeepAliveInterval parameter ensures that messages are transmitted even if no values in the DataSet have changed.

This is particularly relevant when using delta frames, as otherwise no messages would be sent without changes.

When the KeepAlive interval is reached, the publisher sends a message, even if there are no field changes. The purpose of this message is:

Depending on the implementation, this message can be transmitted as a key frame or as a frame without field changes.

Summary

The combination of key frames, delta frames, KeyFrameCount and KeepAliveInterval enables efficient and robust data transmission:

Through suitable parameterization, an optimal compromise between bandwidth consumption and system robustness can be achieved.

The following diagram illustrates these relationships once again.

Key frames and delta frames 1: