FB_BACnet_BinaryValue_ADS
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.
Use
The function block "FB_BACnet_BinaryValue_ADS" can be used for read and write access to a BACnet object of type BinaryValue (BV). To this end the BACnet object was created under a local BACnet server.
VAR_INPUT
bEnablePV : BOOL;
bPV : BOOL; (* present value bool type *)
bManual : BOOL; (* FALSE --> TRUE: write present_value immediately,
FALSE: only write present_value on-change,
TRUE: write present_value on-change and when device turns operational *)
ePriority : E_BACNETPRIORITY := BACNETPRIORITY_12;
bEnablePV: enables the value of input "bPV". As soon as the input is set to TRUE there is a write access with the value from "bPV" to the commandable property Present_Value with priority from "ePriority" (default: 12, if the input "ePriority" is not connected).
If the input is set to FALSE, write access is made with the value NULL to the commandable property Present_Value with priority from "ePriority" (NULL write).
bPV: value to be written to the Priority_Array of the commandable property Present_Value when "bEnablePV" is set to TRUE. The priority is determined with the input "ePriority" (default: 12, if the input "ePriority" is not connected). Writing is enabled by setting the input "bEnablePV" to TRUE. Writing to the object is executed via ADS when the value changes.
Since writing of the property Present_Value takes place acyclically, and only when the value changes, it is potentially possible that the property Present_Value is also overwritten with the same priority by other BACnet devices. In this case (i.e. same priority) the last write access always "wins". |
bManual: a distinction is made between the following options for the input:
- FALSE: writing when the value changes
- Edge change FALSE --> TRUE: triggers the writing of the property Present_Value immediately.
- TRUE: writing when the value changes and the associated BACnet server changes to "Operational" state (see FB_BACnet_Device).
ePriority: specification of the priority for write access to the property Present_Value (default: 12, see also E_BACNETPRIORITY).
VAR_OUTPUT
bReady : BOOL;
bPvDone : BOOL; (* present_value written over ADS *)
bPresentValue: BOOL;
bOverridden : BOOL;
bOutOfService: BOOL;
bFault : BOOL;
bInAlarm : BOOL;
bError : BOOL;
nErrorId : UINT;
nAdsErrorId : UDINT;
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.
bPvDone: Positive edge when write access to property Present_Value was successfull.
bPresentValue: Current value of the BACnet object (see also BACnet specification DIN EN ISO 16484-5 for BACnet object BinaryValue and property Present_Value).
bOverridden, bOutOfService, bFault, bInAlarm: See BACnet specification DIN EN ISO 16484-5 for BACnet object BinaryValue and property Status_Flags.
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)
4 = the object type of the BACnet object dosn't match the function block type (the object type will determined over the process data. --> check the process data mapping in the System Manager!)
The error numbers can be queried as block constants via the FB instance (FB_BACnet_???.nERR_xxx).
nAdsErrorId: ADS error code.
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.