FB_BACnet_GetDiagInfo

Function block for access to BACnet diagnosis via ADS. In contrast to the Read/Write property, the ADS access takes place on the BACnet adapter. The BACnet adapter is instantiated by the global variables of the PLC Library and is linked to the BACnet adapter process data in the TwinCAT System Manager. Diagnostic data of a remote BACnet server can be queried via its remote AMS NetID.

FB_BACnet_GetDiagInfo 1:

Application

The function block instance is created by the PLC program and called cyclically. The input sNetId must be assigned the corresponding AMS NetID of the BACnet adapter. The AMS NetID can be queried via the global BACnet adapter instance.

FB_BACnet_GetDiagInfo 2:

The AMS NetID does not match the local AMS NetID and always has to be specified - empty strings cannot be used!

The current AMS NetID is output by the associated FB_BACnet_Adapter:

FB_BACnet_GetDiagInfo 3:
Figure 1: FB_BACnet_AdaptersAmsNetId outputs the local AMS NetID of the BACnet adapter

The AMS NetID can also be displayed in the TwinCAT System Manager (see Figure 2). The AMS port of the BACnet adapter is 0xFFFF (65535).

FB_BACnet_GetDiagInfo 4:
Figure 2: AMS NetID of the BACnet adapter

VAR_INPUT

sNetId    : T_AmsNetId;
bExecute  : BOOL;
tTimeout  : TIME:=BACnet_ADSTimeOut;

 

sNetId: AMS NetId of the BACnet adapter.

bExecute: Rising edge at the input starts the read process.

tTimeout: Optional input, monitoring time for ADS access (default: see BACnet_ADSTimeOut).

 

VAR_OUPUT

bBusy     : BOOL;
bError    : BOOL;
nErrID    : UDINT;
stInfo    : ST_BACnet_Diagnosis;

 

bBusy: The block is busy.

bError: Error during processing.

nErrID: ADS error code.

stInfo: Structure with diagnostic information on BACnet.

 

Example

FB_BACnet_GetDiagInfo 5:
Figure 3: Example for cyclic reading of the diagnostic information
FB_BACnet_GetDiagInfo 6:

The instance fbBACnet_Adapter is a global variable of the PLC Library of type FB_BACnet_Adapter. If should not be instantiated more than once.