FB_BACnet_MultiStateOutput

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_MultiStateOutput 1:

Use

The function block "FB_BACnet_MultiStateOutput" can be used for reading and write access to a BACnet object of type MultiStateOutput (MO). To this end the BACnet object was created under a local BACnet server.

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

VAR_INPUT

bEnablePV    : BOOL;
nPV          : UDINT;

bEnablePV: Enables the value of input nPV. When the input is set to TRUE, an entry is made in the Priority_Array of the corresponding BACnet object with the value of the input nPV. This corresponds to a write access to the commandable property Present_Value with the set priority (default: 12 when PLC automapping is used or 16 for manual linking in the System Manager).
If bEnablePV is set to FALSE, the corresponding entry from the Priority_Array is removed again (write ZERO).

nPV: Value to be written to the Priority_Array of the commandable property Present_Value. The priority is based on the process data configuration and mapping of the BACnet object in the System Manager (see also Figs. 2 and -3). Writing is enabled by setting the input bEnablePV to TRUE. Process data are always written cyclically once enabled.

FB_BACnet_MultiStateOutput 3:
Fig. 2: Example of a BACnet object with process data for writing the commandable property Present_Value.
FB_BACnet_MultiStateOutput 4:
Fig. 3: Example for a process data configuration of an BACnet object in the System Manager. Priority 12 and 16 are created as mappable process data (see result in Fig. 2).

VAR_OUTPUT

bReady          : BOOL;
nPresentValue   : UDINT;
bOverridden     : BOOL;
bOutOfService   : BOOL;
bFault          : BOOL;
bInAlarm        : BOOL;
nNbrOfStates    : UDINT;
bError          : BOOL;
nErrorId        : UINT;

bReady: Notification of general readiness. If this output is set, the other status outputs are valid (PresentValue, Overridden ...). If the output is FALSE, the corresponding function block "FB_BACnet_Device" does not report "Operational", or the block instance was not linked correctly in the System Manager.

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

bOverridden, bOutOfService, bFault, bInAlarm: See BACnet specification DIN EN ISO 16484-5 for BACnet object MultiStateOutput and property Status_Flags.

nNbrOfStates: Reports the available number of values, which the Present_Value of the MultiStateOutput object can assume (1...nNbrOfStates). If nNbrOfStates is 0, then there is no valid "state" which the object can assume (Present_Value is 0).

bError: An error is pending.

nErrorId: Error number
0 = no error
2 = incorrect process data mapping detected (check mapping in the System Manager; if necessary compile complete PLC project and reload)
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.