ClientWriteProperty_ManyInputs

ClientWriteProperty_ManyInputs (FB)

FUNCTION_BLOCK ClientWriteProperty_ManyInputs

Short description

Updating properties of BACNET objects (write access) Typical application: Changing a setpoint via BACNET

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

xEn

BOOL

TRUE

Enable / disable communication ( TRUE = enabled )

‘itfServer*

BACnet.IBACnetServer

Interface variable for referencing the server

eSetpValueMode

ClientWriteProperty_SetpValueMode

ClientWriteProperty_SetpValueMode.Auto

Selection of operating mode for the setpoint input

ePropertyDataTypeMode

ClientWriteProperty_PropertyDataTypeMode

ClientWriteProperty_PropertyDataTypeMode.Auto

Selection of the operating mode for the transferred data type of the property

ePropertyDataType

BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE

BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE.DATA_TYPE_NULL

Selection of the transferred data type of the property in operating mode ePropertyDataTypeMode = ePropertyDataType

rSetpValue

REAL

0.0

Setpoint of the property in REAL format (floating point number according to IEEE754 - 32 bit)

xSetpValue

BOOL

FALSE

Setpoint of the property in BOOL format

sSetpValue

STRING[255]

‘’

Setpoint of the property in STRING format (character string)

diSetpValue

DINT

0

Setpoint of the property in DINT format (32 BIT, signed integer)

udiSetpValue

UDINT

0

Setpoint of the property in UDINT format (32 BIT, unsigned integer)

stSetpValue

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_CONTENTS

Setpoint of the property in IEC_BACNET_PROPERTY_CONTENTS format (direct transfer to the interface)

xUpdateSetp

BOOL

FALSE

Update of setpoints ( on each rising edge )

xResError

BOOL

FALSE

Reset of the error outputs ‘eErrorCodeCom’ and ‘eRepyErrorCode.XXX’ (on each rising edge)

Outputs

Name
Data type
Value range
Initial value
Function

dwDeviceID_Fb

DWORD

0

Number of the BACnet target device (range: 0 - 4194302) - feedback

dwObjectInstance_Fb

DWORD

0

Number of the object (range: 0 - 4194303) - feedback

eObjectType_Fb

BACnet.CmpBACnet.IEC_BACnet_Object_Type

Type of the object - feedback

ePropertyType_Fb

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID

Type of the property - feedback

<br/>*<br/> eActPropertyDataType’

BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE

BACNET - data type of the property, automatic detection based on ‘eObjectType’ and ‘ePropertyType’ (ePropertyDataTypeMode = Auto)

<br/>*<br/> sInputSetpValue’

STRING

‘’

Display of the input for the property setpoint

<br/>*<br/> xRegToServer’

BOOL

FALSE

Status of registration at the BACnet server (TRUE = successful registration)

<br/>*<br/> xConfigObject’

BOOL

FALSE

Status of the object's configuration (TRUE = successful configuration)

<br/>*<br/> xSuccTransfer’

BOOL

FALSE

Status of the success of the property setpoint update (TRUE = transfer successful, rising edge after each successful transfer)

<br/>*<br/> eState’

BACnet.CmpBACnet.IEC_BACNET_STATUS

Status of communication

<br/>*<br/> eErrorCodeCom’

BACnet.CmpBACnet.IEC_BACNET_STATUS

Most recent communication error

<br/>*<br/> eReplyErrorCode’

TYPE_OF_REPLY_ERROR_CODE

Most recent communication error in the reply to one's own request

<br/>*<br/> xAlarm’

BOOL

FALSE

General fault ( TRUE = fault )

<br/>*<br/> xAlarmCom’

BOOL

FALSE

General fault - communication ( TRUE = fault )

xBusy

BOOL

Communication indicator ( TRUE = communication )

Setpoints / parameters

Name
Data type
Value range
Initial value
Function

tTimeUpdateSetp

TIME

T#0s

Update interval for operations influenced by the input 'xUpdateSetp' ( 0 = no automatic update, > 0 cyclical update )

dwDeviceID

DWORD

4096

Number of the BACnet target device (range: 0 - 4194302)

dwObjectInstance

DWORD

1

Number of the object (range: 0 - 4194303)

eObjectType

BACnet.CmpBACnet.IEC_BACnet_Object_Type

BACnet.CmpBACnet.IEC_BACnet_Object_Type.OBJ_ANALOG_OUTPUT

Type of the object

ePropertyType

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID.PROP_PRESENT_VALUE

Type of the property

diWritePriority

BACnet.CmpBACnet.IEC_BACNET_SIGNED

16

Priority of the property (1 = highest, 16 = lowest priority)

ePropertyCharSet

BACnet.CmpBACnet.IEC_BACNET_STRING_TYPE

BACnet.CmpBACnet.IEC_BACNET_STRING_TYPE.BACNET_STRING_UTF_8

Character set of the property

udiTimeoutFB

UDINT

5*1000*1000

Timeout duration for the instance of the FB BACnet.BACnetClientWriteProperty (in microseconds, 0 = no timeout, CBML ETrigATo)

rDevPlus

REAL

0.0

Maximum positive deviation of the input variable ‘rSetpValue’ (type: REAL) before triggering the setpoint update

rDevMinus

REAL

0.0

Maximum negative deviation of the input variable ‘rSetpValue’ (type: REAL) before triggering the setpoint update

Function description

General

This function block transmits setpoints of properties via BACNET communication (write access). The selection of the setpoint input is done via the input ‘eSetpValueMode’ (Default = Auto). The selection of the BACNET data type is done via the input ‘ePropertyDataTypeMode’ (Default = Auto). The current BACNET data type is available at the output ‘eActPropertyDataType’. The currently selected input for the setpoint is available at the output ‘sInputSetpValue’.

Enable / disable communication

The enabling/disabling of communication is done via the input ‘xEn’ (Default = TRUE = enabled). At every rising edge on the input ‘xEn’, a transmission of the setpoint with the current settings is triggered. In the disabled state, the outputs from ‘xRegToServer’ downward assume predefined states and a deregistration from the server occurs.

Input ‘eSetpValueMode’

The operating mode of the setpoint input is selected by this input as follows. It determines the input that is monitored for changes of the setpoint. In operating mode ‘Auto’ the input is automatically determined by the state of the output ‘eActPropertyDataType’ (by the parameters ‘eObjectType’ and ‘ePropertyType’). In operating mode ‘Auto’ and simultaneously ePropertyDataTypeMode = ePropertyDataType, the input ‘stSetpValue’ is automatically selected.

eSetpValueMode

Function

Notes

None

Triggering of transmission locked

Auto

Selection of input by ‘eActPropertyDataType’

rSetpValue

Manual mode - input ‘rSetpValue’

xSetpValue

Manual mode - input ‘xSetpValue’

sSetpValue_String

Manual mode - input ‘sSetpValue’

Mode: character string (CHAR_STRING)

sSetpValue_Bit_String

Manual mode - input ‘sSetpValue’

Mode: bit string (BIT_STRING)

diSetpValue

Manual mode - input ‘diSetpValue’

udiSetpValue

Manual mode - input ‘udiSetpValue’

stSetpValue

Manual mode - input ‘stSetpValue’

Direct access to the interface

Input ‘ePropertyDataTypeMode’

The operating mode of the BACNET data type is selected by this input as follows. It determines the BACNET data type that is transmitted in the UDP telegram. In operating mode ‘Auto’ the BACNET data type is automatically selected by the parameters ‘eObjectType’ and ‘ePropertyType’. In operating mode ‘ePropertyDataType’ and simultaneously eSetpValueMode = Auto the input ‘stSetpValue’ is automatically selected.

ePropertyDataTypeMode

Function

Notes

None

Triggering of transmission locked

Auto

Determination of the BACNET data type by the parameters ‘eObjectType’ and ‘ePropertyType’

ePropertyDataType

Manual mode - input ‘ePropertyDataType’

Clearing entries in the priority array

The desired clearing (e.g. the array element 16 is described with the value 100.0) of an array element entry is performed by making the current value NULL (= 0) and setting the data type to be transmitted to DATA_TYPE_NULL: eSetpValueMode = ‘udiSetpValue’ udiSetpValue = 0 ePropertyDataTypeMode := ‘ePropertyDataType’ ePropertyDataType = DATA_TYPE_NULL After successful transmission, e.g. the array element 16 is described with the value NULL and thus no longer effective.

Triggering a transfer

The transmission of the property's setpoint can be triggered as follows (prerequisite: xRegToServer = TRUE)\

  • every rising edge at the input 'xEn'

  • every rising edge at the input ‘xUpdateSetpn’

  • cyclically at interval ‘tTimeUpdateSetp’ (Default: T#0s)

  • once after each download

  • once after every change of the configuration

  • once after every change on the active input

Configuration of the BACNET object

The BACNET object is uniquely defined by the following parameters:\

  • Device address 'dwDeviceID'

  • Object address 'dwObjectInstance'

  • Object type ‘eObjectType’

  • Property type ‘ePropertyType’

  • Write priority ‘diWritePriority’

  • Timeout for the FB ‘udiTimeoutFB’

Input ‘rSetpValue’

The transmission of the property's setpoint is triggered (prerequisite: xRegToServer = TRUE) if the change exceeds the parameter ‘rDevPlus’ or falls below the parameter ‘rDevMinus’.

Input ‘stSetpValue’

This input is a direct access to the internal interface of the transmission. (Data type = BACnet.CmpBACnet.IEC_BACNET_PROPERTY_CONTENTS) Therefore, in the CFC it must be ensured that all structure elements are initialized correctly!!! The transmission of the property's setpoint is triggered (prerequisite: xRegToServer = TRUE) if at least one change in the structure has been detected.

Output ‘sInputSetpValue’

This output permanently provides the current input for the setpoint as a string.

Output 'xRegToServer'

This output permanently provides the status of the internal connection to the BACNET server. A successful connection to the server is a prerequisite for transmitting the setpoint.

Output 'xConfigObject'

This output permanently provides the status of the successful configuration of the BACNET object.

Output ‘xSuccTransfer’

This output permanently provides the status of the BACNET transmission. After each successful transmission a rising edge is generated here.

Display of faults

Faults are indicated at the collective output ‘xAlarm’ (= TRUE). It here only includes communication faults (delay time: gc_Parameters.gc_tOnDelayxAlarmCom, Default = 60s) (output ‘xAlarmCom’). In case of a communication error, the output ‘eErrorCodeCom’ provides an explanatory text for the cause. It always shows the cause of the last communication error. In case of an error in the reply telegram, the output ‘eReplyErrorCode’ provides an explanatory text for the cause.

Output 'xBusy'

This output signals the active transmission of the setpoint (= TRUE).

Example

CODESYS

InOut:

Scope
Name
Type
Initial
Comment

Input

xEn

BOOL

TRUE

Enable / disable communication ( TRUE = enabled )

Input

itfServer

BACnet.IBACnetServer

Interface variable for referencing the server

Input

eSetpValueMode

ClientWriteProperty_SetpValueMode

ClientWriteProperty_SetpValueMode.Auto

Selection of operating mode for the setpoint input 0 = None 1 = Automatic mode (the input is selected automatically) 2 = Manual mode: input ‘rSetpValue’ 3 = Manual mode: input ‘xSetpValue’ 4 = Manual mode: input ‘sSetpValue’ 5 = Manual mode: input ‘diSetpValue’ 6 = Manual mode: input ‘udiSetpValue’ 7 = Manual mode: input ‘stSetpValue’ (direct transfer to the interface)

Input

ePropertyDataTypeMode

ClientWriteProperty_PropertyDataTypeMode

ClientWriteProperty_PropertyDataTypeMode.Auto

Selection of operating mode for the transferred data type of the property 0 = None 1 = Automatic mode (the data type is selected automatically) 2 = Manual mode: input ‘ePropertyDataType’

Input

ePropertyDataType

BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE

BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE.DATA_TYPE_NULL

Selection of the transferred data type of the property in operating mode ePropertyDataTypeMode = ePropertyDataType

Input

rSetpValue

REAL

0.0

Setpoint of the property in REAL format (floating point number according to IEEE754 - 32 bit)

Input

xSetpValue

BOOL

FALSE

Setpoint of the property in BOOL format

Input

sSetpValue

STRING(255)

‘’

Setpoint of the property in STRING format (character string)

Input

diSetpValue

DINT

0

Setpoint of the property in DINT format (32 bit, signed integer)

Input

udiSetpValue

UDINT

0

Setpoint of the property in UDINT format (32 bit, unsigned integer)

Input

stSetpValue

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_CONTENTS

Setpoint of the property in IEC_BACNET_PROPERTY_CONTENTS format (direct transfer to the interface)

Input

xUpdateSetp

BOOL

FALSE

Update of setpoint values (on every rising edge )

Input

xResError

BOOL

FALSE

Reset of the output 'eError' (on each rising edge)

Output

dwDeviceID_Fb

DWORD

Number of the BACnet target device (range: 0 - 4194302) - feedback

Output

dwObjectInstance_Fb

DWORD

Number of the object (range: 0 - 4194303) - feedback

Output

eObjectType_Fb

BACnet.CmpBACnet.IEC_BACnet_Object_Type

Type of the object - feedback

Output

ePropertyType_Fb

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID

Type of the property - feedback

Output

eActPropertyDataType

BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE

BACnet data type of the property Automatic detection based on ‘eObjectType’ and ‘ePropertyType’ (ePropertyDataTypeMode = Auto) Manual specification via the input ‘ePropertyDataType’ (ePropertyDataTypeMode = ePropertyDataType) Passed to the element ‘tag’ of the structure IEC_BACNET_PROPERTY_CONTENTS Immediate transfer in the UDP telegram

Output

sInputSetpValue

STRING

‘’

Display of the input for the property setpoint

Output

xRegToServer

BOOL

Status of registration at the BACnet server (TRUE = successful registration)

Output

xConfigObject

BOOL

Status of the object's configuration (TRUE = successful configuration)

Output

xSuccTransfer

BOOL

FALSE

Status of the success of the property setpoint update (TRUE = transfer successful)

Output

eCBMState

BACnet.CmpBACnet.IEC_BACNET_STATUS

CBM - communication status (updates: states DONE, ERROR and ABORT)

Output

eComState

ClientWriteProperty_ComStates

Communication status (updates: states No_Execution, Target_Device_Searching, Request_Sending, Reply_Waiting, Finishing)

Output

eErrorCodeCom

BACnet.CmpBACnet.IEC_BACNET_STATUS

Most recent communication error

Output

eReplyErrorCode

TYPE_OF_REPLY_ERROR_CODE

Most recent communication error in the reply to one's own request

Output

xAlarm

BOOL

General fault ( TRUE = fault )

Output

xAlarmCom

BOOL

General fault - communication ( TRUE = fault )

Output

xBusy

BOOL

Communication indicator ( TRUE = communication )

Input Const

rDevMinus

REAL

0.0

Maximum negative deviation of the input variable ‘rSetpValue’ (type: REAL) before triggering the setpoint update

Input Const

rDevPlus

REAL

0.0

Maximum positive deviation of the input variable ‘rSetpValue’ (type: REAL) before triggering the setpoint update

Input Const

udiTimeoutFB

UDINT

((5 * 1000) * 1000)

Timeout duration for the instance of the FB BACnet.BACnetClientWriteProperty (in microseconds, 0 = no timeout, CBML ETrigATo)

Input Const

ePropertyCharSet

BACnet.CmpBACnet.IEC_BACNET_STRING_TYPE

BACnet.CmpBACnet.IEC_BACNET_STRING_TYPE.BACNET_STRING_UTF_8

Character set of the property

Input Const

diWritePriority

BACnet.CmpBACnet.IEC_BACNET_SIGNED

16

Priority of the property (1 = highest, 16 = lowest priority)

Input Const

ePropertyType

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID

BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID.PROP_PRESENT_VALUE

Type of the property

Input Const

eObjectType

BACnet.CmpBACnet.IEC_BACnet_Object_Type

BACnet.CmpBACnet.IEC_BACnet_Object_Type.OBJ_ANALOG_OUTPUT

Type of the object

Input Const

dwObjectInstance

DWORD

1

Number of the object (range: 0 - 4194303)

Input Const

dwDeviceID

DWORD

4096

Number of the BACnet target device (range: 0 - 4194302)

Input Const

tTimeUpdateSetp

TIME

TIME#0ms

Update interval for operations influenced by the input 'xUpdateSetp'

Methods:

CHECK_BUFFER_CHANGE

FB_Exit

Structure:

  • CHECK_BUFFER_CHANGE (Method)

  • FB_Exit (Method)

Last updated