FB_BA_BACnetTime_TO_SysTime

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

Syntax
FUNCTION_BLOCK FB_BA_BACnetTime_TO_SysTime
VAR_INPUT CONSTANT PERSISTENT
{attribute 'parameterUnit':= 's'}
GetLocalSysTime_nTiAuto : UDINT := 60;
END_VAR
VAR_INPUT CONSTANT
SetSysTimeLocal : FB_BA_SetTime;
GetLocalSysTime : FB_BA_GetTime;
GetBACnetAdapterTime : FB_BACnet_GetAdapterTime;
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
Inputs CONSTANT PERSISTENT
Name | Type | Description |
---|---|---|
GetLocalSysTime_nTiAuto | UDINT | Based on this time information, the local NT system time of a TwinCAT system is regularly determined. |
Inputs CONSTANT
Name | Type | Description |
---|---|---|
SetSysTimeLocal | 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 | 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_BACnet_GetAdapterTime | The function block GetBACnetAdapterTime determines the local BACnet system time. Important parameters are explained below. |
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. |
Parameter of GetBACnetAdapterTime
These parameters are used to configure time synchronization.
Name | Type | Description |
---|---|---|
GetBACnetAdapterTime.bTrig | BOOL | A rising edge at this input determines the local BACnet system time of a TwinCAT system. |
GetBACnetAdapterTime.nTiAuto | UDINT | The local BACnet system time of a TwinCAT system is automatically determined on a regular basis using this time specification from the parameter menu. The time specification must be greater than or equal to 500ms. The default value is 1800s. |
GetBACnetAdapterTime.fbAdapter | fbAdapter | The function block fbAdapter represents a BACnet device. This is pre-initialized to the local BACnet device of the TwinCAT system under Devices. |
GetBACnetAdapterTime.bSuccess | BOOL | The system time was read successfully from the target system. The variable is TRUE for one cycle. |
GetBACnetAdapterTime.stDateTime | Current BACnet system time of a TwinCAT system. | |
GetBACnetAdapterTime.stTimeStruct | Current BACnet system time of a TwinCAT system. | |
GetBACnetAdapterTime.bError | BOOL | Error while reading the BACnet system time. |
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.35 | TF8040 | TwinCAT Building Automation from V5.0.0.0 |