Synchronization Client-Server

In a Client-Server environment WinCC OA compensates differences of the system time between Client (remote User Interface) and Server using the feature Synchronization. Manual correction of the client’s system time is not necessary.

Basic Concepts

The WinCC OA Event Manager is the communication centre of the WinCC OA system. As the central processing unit the WinCC OA Event Manager constantly keeps a copy of all process variables in the memory.

On the Server all read and all write requests of other involved functional units (Manager) are administered by the Event Manager, where value changes of process variables and alarm handling are executed within the Event Manager.

If the remote UI sends a value change request (dpSet) or for instance an alert acknowledge (alertSet) to the Event Manager, a strict chronological order regulated by means of time stamps, which are generated by the client, is followed.

For a remote UI the system time is always corrected.

During client start the difference to the server system time is stored in the internal data point element _ManagerConnections.TimeDiff in the form of second. (please compare figure 1)

Figure 1. data point element "_ManagerConnections.<Connection>.TimeDiff"

If required, a data point of the _ManagerConnections must be created for the connection, in order to get the time difference information. The information will be kept in the following form: _Conn_event_<number><replica>_to_<manager>_<number>_<replica>, e.g. _Conn_event_0_1_to_ui_3_1.

In addition, the internal data point _Connections shows the host names of all connected Managers in the form of _Connections.<manager type>.HostNames.

In this way it can be verified if the client actually uses the system time of the server in dpSet and alertSet or not.

Technical Details

In general time synchronization can be used by all Managers. However, in contrast to a remote UI for which synchronization is active by default, it needs to be explicitly activated for all the other Managers (e.g. API-Manager).

As soon as a Manager runs on a different host than the Event Manager (remote manager), WinCC OA detects whether a synchronization needs to be carried out or not by using the callback function useServerTime().

The default return value of the callback function is FALSE (signifying no synchronization). The callback function can be overloaded by every Manager. Overloading sets the member variable useServerTime_, which allows using the synchronization. In order to activate the synchronization, the member variable needs to be explicitly set to TRUE.

The data points for messages relating to a value change (DP_MESSAGE_VC) or an alert value change (DP_MSG_ALERT_VC) also contain an additional flag useServerTime_ for synchronisation. This flag is set by the functions dpSet() and alertSet() to the value of the member variable useServerTime. In case of active time synchronization the Event Manager uses the time of processing instead of the send time of the message.

If the time correction is activated and the time difference exceeds the tolerance value defined in the configuration file, only a warning is shown in the log viewer during start-up. See also: Configuration file / Entries for different sections -> valueChangeTimeDiff.

If synchronization is deactivated and if the time difference exceeds the time interval defined in the configuration, a message with priority SEVERE is dumped and the connection gets closed.

Setting a time stamp explicitly using the functions dpSetTimed() and alertSetTimed() is not affected (by the synchronization) and is still possible.)

If a remote non-synchronized manager uses its own system time value, value changes and alarm changes may be rejected or marked as invalid.

Time Synchronization in redundant and distributed Systems

In redundant systems before messages are processed they are first transferred by the active Event Manager to the redundant (passive) Event Manager. Messages from the Client with time correction are added with a time stamp of the server time by the active Event Manager, before they are sent to the passive Event Manager.

In distributed systems the mechanism resembles redundant systems: The value changes are forwarded to the target system and the target Event Manager generates the time stamp.

In redundant distributed systems only the active Event Manager forwards the value changes, the passive Event Manager blocks the messages.