FB_BACnet_Accumulator_RAW_R6
Application
The function block can be used for read and write access to a BACnet object of type Accumulator (ACC).
In contrast to the standard and _EX versions of the block, the current counter value (Present_Value) and the state of the property Reliablitity are provided by function block inputs, not directly by the IO hardware. For example, the state of a counter input can be mapped from a sub-bus system in PLC code to a BACnet object (signal conversion from sub-bus systems or virtual data points to BACnet, see Example).
VAR_INPUT
nPV : UDINT;
nReliability : WORD;
bOutOfServiceOut : BOOL;
nPV: Value that is written directly to the Property Present_Value.
nReliability: Input sets the appropriate state of the property Reliability. See BACnet specification DIN EN ISO 16484-5 for BACnet object Accumulator and property Reliability.
bOutOfServiceOut: TRUE sets the object state to out_of_service. See BACnet specification DIN EN ISO 16484-5 for BACnet object Accumulator and property Status_Flags.
VAR_OUPUT
bReady : BOOL;
nPresentValue : UDINT;
nMaxPV : UDINT;
bOverridden : BOOL;
bOutOfService : BOOL;
bFault : BOOL;
bInAlarm : BOOL;
bOverRange : BOOL;
bUnderRange : BOOL;
bNoSensor : BOOL;
bOpenLoop : BOOL;
bShortedLoop : BOOL;
bOtherFault : BOOL;
eEventState : E_BACNETEVENTSTATE;
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.
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 a digital pulse signal on a BACnet object of type Accumulator.
The BACnet object records the count value at the input nPV. An overflow of the UDINT value occurs when a maximum value is set or depending on data type. Further information is provided by the input diPulseOk. This input indicates that the pulse-generating side (e.g. an external counter) is ready.