FB_BA_BACnetTime_TO_SysTime

FB_BA_BACnetTime_TO_SysTime 1:

The template reads the BACnet system time at regular intervals and writes it to the local NT system time of the TwinCAT system.

The NT system time is read at regular intervals and the time information is mapped in the PLC to local and global variables.

Block diagram

FB_BA_BACnetTime_TO_SysTime 2:

Syntax

FUNCTION_BLOCK FB_BA_BACnetTime_TO_SysTime
VAR_INPUT CONSTANT
  {attribute 'parameterUnit':= 's'}
  GetBACnetAdapterTime_nTiAuto           : UDINT := 600;
  {attribute 'parameterUnit':= 's'}
  GetLocalSysTime_nTiAuto                : UDINT := 60;
END_VAR
VAR_INPUT CONSTANT
  SetSysTimeLocal                        : FB_BA_SetTime;
  GetLocalSysTime                        : FB_BA_GetTime;
  GetBACnetAdapterTime                   : FB_BA_GetBACnetAdapterTime;
END_VAR
VAR
  GetBACnetAdapterTime_wYear             : WORD;
  GetBACnetAdapterTime_wMonth            : WORD;
  GetBACnetAdapterTime_wDayOfWeek        : WORD;
  GetBACnetAdapterTime_wDay              : WORD;
  GetBACnetAdapterTime_wHour             : WORD;
  GetBACnetAdapterTime_wMinute           : WORD;
  GetBACnetAdapterTime_wSecond           : WORD;
  GetBACnetAdapterTime_wMilliseconds     : WORD;
END_VAR

FB_BA_BACnetTime_TO_SysTime 3: Inputs CONSTANT

Name

Type

Description

GetBACnetAdapterTime_nTiAuto

UDINT

Based on this time information, the local BACnet system time of a TwinCAT system is regularly determined automatically.

GetLocalSysTime_nTiAuto

UDINT

Based on this time information, the local NT system time of a TwinCAT system is regularly determined.

SetSysTimeLocal

FB_BA_SetTime

The locally determined BACnet system time (GetBACnetAdapterTime) is written to the local NT system time of the TwinCAT system using the function block SetSysTimeLocal.

GetLocalSysTime

FB_BA_GetTime

The function block GetLocalSysTime determines the local NT system time of the TwinCAT system. The determined time is transferred to the global variable lists SysTime.

GetBACnetAdapterTime

FB_BA_GetBACnetAdapterTime

The function block GetBACnetAdapterTime determines the local BACnet system time.

VAR

Name

Type

Description

GetBACnetAdapterTime_wYear

WORD

Year specification of the BACnet system time.

GetBACnetAdapterTime_wMonth

WORD

Month specification of the BACnet system time.

GetBACnetAdapterTime_wDayOfWeek

WORD

Indication of the day of the week of the BACnet system time.

GetBACnetAdapterTime_wDay

WORD

Indication of the day in the month of the BACnet system time.

GetBACnetAdapterTime_wHour

WORD

Hour specification of the BACnet system time.

GetBACnetAdapterTime_wMinute

WORD

Minute specification of the BACnet system time.

GetBACnetAdapterTime_wSecond

WORD

Seconds specification of the BACnet system time.

GetBACnetAdapterTime_wMilliseconds

WORD

Milliseconds specification of the BACnet system time.

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.35

TF8040 | TwinCAT Building Automation from V5.0.0.0