FB_BACnet_NSinkAcknEvent

FB_BACnet_NSinkAcknEvent 1:

Application

The function block can be used to acknowledge an event from the BACnet Notification Sink. The Example shows a possible configuration.

The event to be acknowledged is transferred at the input stAcknEvent. Events from the BACnet notification sink can be read with the aid of FB_BACnet_NSinkReadEvent. It is irrelevant whether the event is still present in the Notification Sink at the time of the acknowledgement, or whether it was already removed or overwritten.

When an event is acknowledged, BACnet triggers an acknowledgement, based on the event parameters. The acknowledgement is only successful, if the event time stamp of the corresponding transition of the object to be acknowledged (see Figure 4) matches the time stamp from the event parameters (see Figure 3). The acknowledgement is aborted with an error if the time stamps do not match exactly (see Figure 5).

The input sMessage can be used to append a message to the Acknowledge event. The block expects a Windows-1252-coded string at the input. Internally, the block codes an UTF-8 string from it (see FB_BACnet_StringExtEncode). If an error occurs during coding, this is indicated at the nErrorId output.

The block instance is created by the PLC program and called cyclically. The input/output stAdsConn must be linked to the output stBACnetAds of the corresponding NotificationSink function block (FB_BACnet_NotificationSink).

FB_BACnet_NSinkAcknEvent 2:
Figure 1: Online view of the BACnet Notification Sink.
FB_BACnet_NSinkAcknEvent 3:
Fig. 2: Online view of the BACnet notification sink with acknowledgement as example.
FB_BACnet_NSinkAcknEvent 4:
Fig. 3: Time stamp from event parameters in the PLC.
FB_BACnet_NSinkAcknEvent 5:
Fig. 4: Time stamp in the object triggering the event; property Event_Time_Stamps
FB_BACnet_NSinkAcknEvent 6:
Fig. 5: Error message in the TwinCAT System Manager logger. The time stamps of the property Event_Time_Stamps and the event parameters of the acknowledgment do not match.
FB_BACnet_NSinkAcknEvent 7:
Fig. 6: Message in the TwinCAT System Manager logger. Acknowledgement was successful. In the object generating the event (BI:0), the flag of the corresponding transition is reset to TRUE (property Acked_Transitions).

 

VAR_INPUT

bAcknowledge   : BOOL;
stAcknEvent   : ST_BACnet_NSinkEvent;
sMessage      : T_MaxString;

 

bAcknowledge: Edge FALSETRUE triggers sending if the acknowledgement.

stAcknEvent: Event parameters of the event to be acknowledged. The event parameters can be read from a BACnet Notification Sink with the aid of the function block FB_BACnet_NSinkReadEvent. At the time of the acknowledgement, the read event no longer must be listed in the BACnet Notification Sink. In this way it is possible to buffer and display event parameters in the PLC and acknowledge them later.

sMessage: Windows-1252-coded message sent with the acknowledgement.

VAR_OUPUT

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

 

bDone: Read of the data completed successfully. bDone remains set until bAcknowledge is reset. If bAcknowledge is 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.

 

VAR_IN_OUT

stAdsConn     : ST_BACnet_AdsConnection;

 

stAdsConn: Linking to the output stBACnetAds of the corresponding NotificationSink function block.

 

Example: Function block call

FB_BACnet_NSinkAcknEvent 8:
Figure 7: Application example. Acknowledgment of a previously read event entry

(see FB_BACnet_NSinkReadEvent) of a BACnet Notification Sink with AMS Port 1001.

FB_BACnet_NSinkAcknEvent 9:

The AMS port depends on the TwinCAT System Manager configuration of the corresponding BACnet device (see FB_BACnet_NotificationSink).