FB_BACnetLoop1202

Universal BACnet PID controller. Unlike FB_BACnetLoop1201, this function block does not permit writing of the following BACnet properties from the PLC:

FB_BACnetLoop1202 1:

Functional description

This function block maps the function block FB_BA_PIDCtrl as loop object in BACnet. The loop object on the BACnet side essentially has the task of displaying parameters and values from the PLC and transferring them to the PLC. The controller logic is solely in the PLC, in the subordinate FB_BA_PIDCtrl. The main parameters can be changed from both sides - PLC and BACnet; the last change is always the valid one. These parameters are transferred from the PLC via ADS and into the PLC via a cyclic interface. On the PLC side, all parameters have an additional Enable input: when the respective Enable input is set for the first time (rising edge), the value at the parameter input is transferred in any case; subsequently, if Enable is set, it is only transferred if it changes, in order to reduce the ADS traffic. If the Enable input is not set, no transfer takes place.

PLC variable

Comment

BACnet-Property (Property ID)

bEnActn

Enable for writing the controller direction of action

 

bActn

Property value control direction
bActn=TRUE, BACnet direct → control direction: E=X-W (cooling)
bActn=FALSE, BACnet reverse → control direction: E=W-X (heating)

Action (2)

bEnPropConst

Enable for writing the proportionality constant (K-factor)

 

rPropConst

Property value proportionality constant (K-factor)

ProportionalConstant (93)

bEnIntgConst

Enable for writing the integration time (I-component)

 

rIntgConst

Property value integration time [s] (I-component)

IntegralConstant (49)

bEnDervConst

Enable for writing the rate time (D-component)

 

rDervConst

Property value rate time [s] (D-component)

DerivativeConstant (26)

bEnEvtEn

Enable for writing the EventEnable bit pattern

 

stEvtEn

Property value bit pattern EventEnable

EventEnable (35)

bEnErrLmt

Enable for writing the message value "maximum value control deviation"

 

rErrLmt

Property value message value "maximum value control deviation"

ErrorLimit (34)

bEnTiDly

Enable for writing the message delay [s]

 

udiTiDly

Property value message delay [s]

TimeDelay (113)

Inputs/outputs

VAR_INPUT

bEn          : BOOL;
bEnActn      : BOOL;
bActn        : BOOL;
bEnPropConst : BOOL;
rPropConst   : REAL;
bEnIntgConst : BOOL;
rIntgConst   : REAL;
bEnDervConst : BOOL;
rDervConst   : REAL;
bEnEvtEn     : BOOL;
stEvtEn      : ST_BACnet_EventTransitionBits;
bEnErrLmt    : BOOL;
rErrLmt      : REAL;
bEnTiDly     : BOOL;
udiTiDly     : UDINT;
bSync        : BOOL;
lrSync       : LREAL;
lrNz         : LREAL;
udiDampConst : UDINT;
udiMinToMax  : UDINT;
udiMaxToMin  : UDINT;
uiCycCl      : UINT;

bEn: controller activation

bEnActn / bActn: enable/property value control direction: "direct" or "reverse"

bEnPropConst / rPropConst: enable/property value proportionality constant (K-factor)

bEnIntgConst / rIntgConst: enable/property value integration time [s] (I-component)

bEnDervConst / rDervConst: enable/property value rate time [s] (D-component)

bEnEvtEn / stEvtEn: enable/property value bit pattern EventEnable

bEnErrLmt / rErrLmt: enable/property value message value maximum output

bEnTiDly / udiTiDly: enable/property value message delay [s]

bSync: set output to lrSync.

lrSync: synchronization value, to which the control value is set on rising edge at input bSync.

lrNz: neutral zone

udiDampConst: damping time of the D-component [s]

udiMinToMax: slope limit of controller output for increase: udiMinToMax [s] related to a change from lrMinOut to rMaxOut.

udiMaxToMin: slope limit of controller output for decrease: udiMaxToMin [s] related to a change from lrMaxOut to rMinOut.

uiCycCl: call cycle of the function block as a multiple of the cycle time. A zero entry is automatically interpreted as uiCycleCall =1.
Example: tTaskCycleTime = 20ms, uiCtrlCycleCall =10 -> The control algorithm is called every 200 ms. Thus the outputs are also updated only every 200 ms.

VAR_OUTPUT

rPrVal     : REAL;
rX         : REAL;
rW         : REAL;
bStaActn   : BOOL;
rStaYMin   : REAL;
rStaYMax   : REAL;
bStaOvrrd  : BOOL;
bStaOoServ : BOOL;
bStaFlt    : BOOL;
bStaInAlm  : BOOL;
bOpLp      : BOOL;
bOthFlt    : BOOL;
stStaFlg   : ST_BACnet_StatusFlags;
dwObjId    : DWORD;
bErr       : BOOL;
udiErrId   : UDINT;
udiErrArg  : UDINT;

rPrVal: control value - controller output

rX: current valid actual value read from the BACnet.

rW: current valid setpoint read from the BACnet.

bStaActn: indicates the state of the control direction.

bStaYMin: indicates the lower value of the controller output limitation.

bStaYMax: indicates the upper value of the controller output limitation.

bStaOvrrd: indicates the state of the status flag "Overridden" of the loop object.

bStaOoServ: indicates the state of the status flag "OutOfService" of the loop object.

bStaFlt: indicates the state of the status flag "Fault" of the loop object.

bStaInAlm: indicates the state of the status flag "InAlarm" of the loop object.

bOpLp: indicates the state “OpenLoop” of the loop object property “Reliability”.

bOthFlt: indicates the state "OtherFault" of the loop object property “Reliability”.

stStaFlg: output structure of the BACnet status

dwObjId: BACnet object ID of the loop object

bErr: indicates a general error in the function block. The cause can be in BACnet, in the ADS data exchange, or due to incorrect parameterization.

udiErrId / udiErrArg: contains the error number and the error argument. See error codes.

VAR_IN_OUT

stComnMsg : ST_BA_ComnMsg;
fbDvc     : FB_BACnet_Device;

stComnMsg: reference to the connection structure for the collective message function block FB_BA_ComMsg.

fbDvc: reference to the function block of the BACnet device object

Requirements

Development environment

Target system

required library

required supplement

TwinCAT 2.11 R3/x64

PC/CX

TcBA library from V1.0.0

TS8040 | TwinCAT Building Automation from V1.0.0