FB_BACnet_Command

The following function block is used for linking a BACnet object of the local BACnet server. The function block for the corresponding BACnet object is linked with the aid of process data.

The process data can be created manually in the BACnet object, linked manually, or they can be generated automatically via PLC automapping. The comments required for PLC automapping ( (* ~ (BACnet... | ??? | ??? ) *) ) are already included in the declaration of the function block.

FB_BACnet_Command 1:

Use

The function block "FB_BACnet_Command" can be used for read and write access to a BACnet object of type Command (CMD). To this end the BACnet object was created under a local BACnet server.

FB_BACnet_Command 2:
Fig. 1: Example of a BACnet object under a local BACnet server.

VAR_INPUT

bEnablePV    : BOOL;
nPV          : UDINT;
bRetrigger   : BOOL; 

bEnablePV: Enables the value of input nPV. When the input is set to TRUE, writing takes place into the property Present_Value of the corresponding BACnet object with the value of input nPV.
If bEnablePV is set to FALSE, the process data of the mapped property Present_Value are written to 16#FFFFFFFF and thus deactivated.

nPV: Value of the property Present_Value to be written. If the value is outside the value range (see BACnet specification DIN EN ISO 16484-5 for BACnet object Command and property Present_Value), the corresponding process data is disabled, i.e. writing to the property is disabled and other BACnet services have write access to the property Present_Value.
Writing of a valid value triggers execution of the corresponding command list of the BACnet object. The value of the property Present_Value is written whenever the process data changes (i.e. change in the value of nPV with bEnablePV set or signal change from FALSE to TRUE at input bRetrigger with bEnablePV set).

bRetrigger: A rising edge at this input triggers a repeat of the write process and therefore execution of the corresponding commands of the BACnet object Command. The signal change from FALSE to TRUE corresponds to a change of the process data of the property Present_Value from x to 0 to x.

VAR_OUTPUT

bReady       : BOOL;
nPresentValue: UDINT;
bAllWritesOk : BOOL;
bInProcess   : BOOL;
bError       : BOOL;
nErrorId     : UINT;

bReady: Notification of general readiness. If this output is set, the other status outputs are valid (PresentValue, AllWritesOk, InProcess). If the output is FALSE, the associated function block "FB_BACnet_Device" reports "not operational".

nPresentValue: Current value of the BACnet object (see also BACnet specification DIN EN ISO 16484-5 for BACnet object Command and property Present_Value).

bAllWritesOk: The last requested command list was successfully processed (see also BACnet specification DIN EN ISO 16484-5 for BACnet object Command and property All_Writes_Successful).

bInProcess: The selected command list is processed (see also BACnet specification DIN EN ISO 16484-5 for BACnet object Command and property In_Process).

bError: An error is pending.

nErrorId: Error number
0 = no error
3 = the corresponding BACnet server is not ready (bOperational = FALSE at instance of the FB_BACnet_Device)
The error numbers can be queried as block constants via the FB instance (FB_BACnet_???.nERR_xxx).

VAR_IN_OUT

Device       : FB_BACnet_Device;

Device: Specification of the instance of the local corresponding BACnet server block. For each BACnet adapter one BACnet server is possible. See FB_BACnet_Adapter and FB_BACnet_Device for further information.