FB_BACnet_LogBufferProperty

 

FB_BACnet_LogBufferProperty 1:

 

Application

The function block can be used to read the property Log_Buffer of any BACnet object (typically BACnet TrendLog object). The input tObjectID specifies the object (Object_Identifier: object type and object instance) to be accessed. The Example shows a possible configuration.

The data to be read are stored in the output data structure stLogBuffer (see also ST_BACnet_LogBufferReal).

The only data type supported by the PLC function block for entries in the property Log_Buffer is Real! Entries with other data types are ignored.

FB_BACnet_LogBufferProperty 2:
Figure 1: Example entry of property Log_Buffer with data type Real.

The function block instance is created by the PLC program and called cyclically. The input/output stAdsConn must be linked to the output stAdsConn of the respective device function block (FB_BACnet_Device or FB_BACnet_RemoteDevice).

FB_BACnet_LogBufferProperty 3:

The ADS buffer from the global variables is used for buffering the ADS data (see ST_BACnet_GlobalAdsBuffer).

VAR_INPUT

tObjectID    : T_BACnet_ObjectIdentifier:=16#FFFFFFFF;
bAutoGet     : BOOL:=TRUE;
bGet         : BOOL;
stStartTime  : ST_BACnet_DateTime := (
                 stDate := (nYear       := 16#FF,
                 nMonth      := 16#FF,
                 nDay    := 16#FF),
                 stTime := (nHour       := 16#FF,
                   nMinute     := 16#FF,
                   nSecond     := 16#FF,
                   nHundredths := 16#FF));
stEndTime    : ST_BACnet_DateTime := (
                 stDate := (nYear       := 16#FF,
                 nMonth      := 16#FF,
                 nDay    := 16#FF),
                 stTime := (nHour       := 16#FF,
                   nMinute     := 16#FF,
                   nSecond     := 16#FF,
                   nHundredths := 16#FF));

 

tObjectID: Specifies the object (Object_Identifier: object type and object instance) to be accessed.

bAutoGet: TRUE = the property is read automatically when the ADS connection or the Object_Identifier have changed. An ADS connection change occurs when the connection is restored after an interruption, or if the AMS NetID or port has changed. Automatic reading does not occur cyclically, and not if the property itself changes!

bGet: FALSETRUE = Property is read once, irrespective of input bAutoGet.

stStartTime, :stEndTime Only entries from the Log_Buffer with time stamps between the start and end times are output. The filter is disabled by default (placeholder 255 → undefined).

VAR_OUPUT

bDone        : BOOL;
bBusy        : BOOL;
bError       : BOOL;
nErrorId     : UINT;
stLogBuffer  : ST_BACnet_LogBufferReal;

bDone: Reading or writing of the data completed successfully. bDone set remains set until bGet, bSet and bAutoGet are reset, or until a new read or write operation starts. If bGet, bSet and bAutoGet are reset before bDone is active, bDone is set for one cycle.

bBusy: The block is busy.

bError: Error during processing.

nErrorId: Error code, see BACnet_Globals for an overview.

stLogBuffer: Output data structure for entries of property Log_Buffer with data type Real. The following section compares two entries in the PLC and the TwinCAT System Manager (see Example).

VAR_IN_OUT

stAdsConn    : ST_BACnet_AdsConnection;

stAdsConn: Linking to the output stAdsConn of the corresponding device function block.

 

Example 1: Comparison of PLC and System Manager

FB_BACnet_LogBufferProperty 4:
Fig. 2: Example of 2 log entries in the PLC
FB_BACnet_LogBufferProperty 5:
Fig. 3: Example of 2 log entries in the TwinCAT System Manager
FB_BACnet_LogBufferProperty 6:
Fig. 4: Exemplary representation of the property Log_Buffer in the TwinCAT System Manager.

Example 2: Function block call

FB_BACnet_LogBufferProperty 7:
Fig. 5: Application example. Cyclic reading of the property Log_Buffer of a BACnet TrendLog object.