FB_BACnet_Accumulator_EX

FB_BACnet_Accumulator_EX 1:

Application

The function block FB_BACnet_Accumulator can be used for reading and write access to a BACnet object of type Accumulator (ACC).

An accumulator object is typically used for mapping meter readings to BACnet. The Example illustrates the interfacing of an M-Bus counter with an accumulator object.

The basic and _EX versions of the block differ in terms of how the property Present_Value is written and the number of status outputs. In the basic version write access to the object is via the property Value_Set. Before the value acceptance in the property Present_Value, the previous value including time stamp is saved. In this way the property Value_Change_Time indicates when the property Present_Value was last updated, for example. In the case of an external counter (e.g. M-Bus), this feature can be used to check the up-to-dateness of the value.

VAR_INPUT

FB_BACnet_Accumulator_EX 2:

Variables shown in gray color are not included in the basic version of the function block. Variables shown in black are not included in the _EX version of the function block.

nPV        : UDINT;
nValueSet  : UDINT;

nPV: value to be written to the property Present_Value. The process data are written when there is a change.

nValueSet: value to be written to the property Value_Set. Write access also triggers update of the properties Value_Change_Time and Value_Before_Change. The process data are written when there is a change.

VAR_OUPUT

bReady         : BOOL;
nPresentValue  : UDINT;
nMaxPV         : UDINT;
bOverridden    : BOOL;
bOutOfService  : BOOL;
bFault         : BOOL;
bInAlarm       : BOOL;
bOverRange     : BOOL;
bUnderRange    : BOOL;
bNoSensor      : BOOL;
bOpenLoop      : BOOL;
bCommFailure   : BOOL;
bShortedLoop   : BOOL;
bOtherFault    : BOOL;
eEventState    : E_BACNETEVENTSTATE;
tObjectID      : T_BACnet_ObjectIdentifier:=16#FFFFFFFF;
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 TwinCAT System Manager.

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

nMaxPV: Current value of the property Max_Pres_Value of the BACnet object (see also BACnet specification DIN EN ISO 16484-5 for BACnet object Accumulator and property Max_Pres_Value).

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

bOverRange, bUnderRange, bNoSensor, bOpenLoop, bShortedLoop, bOtherFault: See BACnet specification DIN EN ISO 16484-5 for BACnet object Accumulator and property Reliability.

eEventState: See BACnet specification DIN EN ISO 16484-5 for BACnet object Accumulator and property Event_State.

tObjectID: Object ID of the BACnet object (object type and object instance).

bError: An error is pending.

nErrorId: see global constants (BACnet_Globals).

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.

Example

The following example illustrates the implementation of an M-Bus counter on a BACnet object of type Accumulator.

FB_BACnet_Accumulator_EX 3:
Fig. 1: Example for the implementation of an M-Bus counter in the BACnet object Accumulator in the PLC program.

The BACnet object records the value of the input nValueSet and saves it as property Present_Value. Further information for setting the property Reliability of the BACnet object is provided by the bError and bReady states of the M-Bus block. This property indicates the state of the value of the BACnet object. If the M-Bus block reports bReady = TRUE, the BACnet object assumes state no_fault_detected → value valid.