FB_BACnet_Adapter
Function block for linking the PLC program with a local BACnet adapter (network card). The linking of the function block takes place with the aid of process data.
The process data can be linked manually or automatically via PLC automapping. The comments required for PLC automapping ( (* ~ (BACnet... | ??? | ??? ) *) ) are already included in the declaration of the function block.
Attention:
This block must not be instantiated in the PLC program! An instance of the block is already included in the global data of the PLC library (fbBACnet_Adapter), where it is automatically detected by the PLC automapping. Instantiation in the PLC program is only necessary if several BACnet adapters are used in a PLC program!
Application
The function block FB_BACnet_Adapter is used to read the state of the local BACnet adapter (process data Device Status) and output it in the PLC program. In addition, the process dataAmsNetId is used to read the AMS NetID of the BACnet adapter and output it to sAmsNetId.
As described above, one instance of the block FB_BACnet_Adapter is already provided by the PLC library as a global instance and must therefore not be explicitly created. The global instance is recognized by the PLC automapping and automatically linked to the corresponding BACnet adapter in the System Manager.
The block instance is required by the BACnet function blocks FB_BACnet_Device and FB_BACnet_RemoteDevice. The hierarchy between FB_BACnet_Adapter, FB_BACnet_Device and a BACnet object of type AnalogValue is shown below:
Notes re. the figure:
|
Tip:
The instance of the block FB_BACnet_Adapter does not have to called in the PLC program. If required, the adapter is called automatically by the blocks FB_BACnet_Device or FB_BACnet_RemoteDevice.
VAR_OUPUT
eAdapterStatus : E_BACNETADAPTERSTATUS;
bEthLinkOk : BOOL;
bGatewayOk : BOOL;
sAmsNetId : T_AmsNetId;
bFirstCycle : BOOL;
bError : BOOL;
nErrorId : UINT;
eAdapterStatus: Status of the BACnet adapter; see: E_BACNETADAPTERSTATUS.
bEthLinkOk: The local Ethernet connection is active (cable connected, adapter linked) if the output is set to TRUE.
bGatewayOk: The configured gateway can be reached if the output is set to TRUE.
sAmsNetId: Output of the AMS NetID of the local BACnet adapter (can be used for asynchronous access to BACnet objects via ADS).
bFirstCycle: Is set for one cycle when the block instance is first called after a PLC reset or restart.
bError: An error is pending.
nErrorId: Error code, see BACnet_Globals for an overview.
If there is no network connection (bEthLinkOk = FALSE) or the gateway cannot be reached (bGatewayOk = FALSE), all remote objects (BACnet objects under one client) are blocked. Objects of the local BACnet server are not affected. |