Time synchronization

In this description, the term time stands for the combination of date and time (Date and Time).

BACnet time synchronization

In BACnet, time synchronization is performed via two services:

TimeSynchronization synchronizes the time based on the local time, i.e. the timer and the time receiver must be in the same time zone.

When using UTCTimeSynchronization (UTC=Universal Time Coordinated) the time is transmitted as GMT (Greenwich Mean Time = local time London). The timer converts the time to GMT before sending. Using the local settings UTC_Offset and DaylightSavingsStatus (in the device object of the server), the time receiver then converts back to the local time.

UTC_Offset specifies the value in minutes relative to GMT. A positive value is to be used westward from GMT, a negative value eastward from GMT.
Western Europe has an offset of -60 minutes from GMT. This is set as the default value in the TwinCAT BACnet server and may have to be adjusted when used in other time zones with the use of UTC.

Time synchronization 1:
  • The time synchronization has a direct effect on the recording of BACnet logging objects (Trendlog, Trendlog-Multiple and Eventlog). If the time changes, this is accepted as an entry in the log memory. Short time synchronization intervals can therefore result in many (unnecessary) entries in the log memory of the logging objects.
  • There should be only one timer in a BACnet network. This must be ensured by the operator or specialist planner.
    Even if it is basically possible according to the BACnet standard to send the time synchronization to only one group of participants (multicast) or to only one single participant (unicast), in practice the time is often sent as a broadcast to all participants of the network.

TwinCAT as BACnet time receiver

If a TwinCAT controller receives a BACnet time synchronization, the internal time of the controller is set with this time.

TwinCAT as BACnet timer

If a TwinCAT controller is used as a BACnet timer, it must determine the exact time from an external location, e.g. by using the NTP service on an external NTP server (NTP = Network Time Protocol). For example, time.windows.com is available as a publicly available time server.

The method TimeSyncEx im FB_BACnet_Adapter is available for taking over the time and, if necessary, broadcasting in the network.

The following values are passed to the call as parameters:

Name

Type

Description

pDateTime

ST_BA_DateTime

Pointer to a structure of type ST_BA_DateTime (see library Tc3_BA2_Common). In this structure the date and time to be set is passed or returned in case of eSyncMode = 3.

eSyncMode

E_BACnet_TimeSyncMode

Enumeration
The value determines the type of synchronization:

eSyncAndSendLocalTime := 0
Sets pDateTime in the BACnet stack (as Local Time) and sends the time as broadcast (TimeSync request)
Use case: The controller receives the time via NTP and sends the local BACnet time to other controllers as broadcast.

eSyncOnly := 1
Sets pDateTime in the BACnet stack (as Local Time)
Use case: All controllers receive the time via NTP and synchronize their own BACnet clock.

eSyncAndSendUtcTime := 2
Sets pDateTime in the BACnet stack (as UTC Time) and sends the time as broadcast (UTC Time Sync request)
Use case: The controller receives the time via NTP and sends the BACnet time as UTC to other controllers as broadcast.

eSyncGetTime := 3
Returns the current time in the BACnet stack in pDateTime.
Use case: Is rather rarely used. A possible use case would be, for example, a comparison of the BACnet clock with the trend recording.