FB_HVACPIDDehumidify

PID dehumidification controller

In order to dehumidify the supply air, it is cooled down by the cooler. The dehumidification is constantly controlled by dosing the coolant at the cooling register with the cooler valve. Two controllers, FB_HVACPIDCooling and FB_HVACPIDDehumidify, act on the cooler valve. First of all the control signal rY is relayed by FB_HVACPIDCooling to the dehumidification sequence controller FB_HVACPIDDehumidify. Inside the FB_HVACPIDDehumidify function block, the larger of the two control signals is routed through to the controller output. If the air humidity is too high, the dehumidification controller takes precedence over the cooling controller. However, in order that the correct supply air temperature can still be achieved, the preheater is disabled if dehumidification is in operation. The reheater is put into operation in order to reheat the air.

FB_HVACPIDDehumidify 1:

VAR_INPUT

eDataSecurityType  : E_HVACDataSecurityType;
bSetDefault        : BOOL;
eModeSeqCtrl       : E_HVACSequenceCtrlMode;
iNumberOfSequences : INT;
iMyNumberInSequence: INT;
rW                 : REAL;
rX                 : REAL;
tTaskCycleTime     : TIME;
tCtrlCycleTime     : TIME;
rYFromPIDCooling   : REAL;
eCtrlMode          : E_HVACCtrlMode;
rYManual           : REAL;
bResetcontroller   : BOOL;
bReset             : BOOL;

eDataSecurityType:if eDataSecurityType:= eHVACDataSecurityType_Persistent, the persistent VAR_IN_OUT variables of the function block are stored in the flash of the computer if a value changes. For this to work, the function block FB_HVACPersistentDataHandling must be instanced once in the main program, which is called cyclically. Otherwise the instanced FB is not released internally.

A change of value can be initiated by the building management system, a local operating device or via a write access from TwinCAT. When the computer is restarted, the saved data are automatically read back from the flash into the RAM.

Application example: FB_HVACPIDDehumidify 2:Example_PERSISTENT.zip

If eDataSecurityType:= eHVACDataSecurityType_Idle the persistently declared variables are not saved in a fail-safe manner.

Notice

A cyclically changing variable must never be linked with the IN_OUT variable of a function block, if eDataSecurityType:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory.

bSetDefault: If the variable is TRUE, the default values of the VAR_IN_OUT variables are adopted.

eModeSeqCtrl: among other things, control is enabled via this enum. In addition, the operation mode of the VAC system is transmitted to the controller function block in the sequence. See also Table operation modes.

iNumberOfSequences: number of sequence controllers in the system.

iMyNumberInSequence: the controller's own number in the sequence.

rW: the setpoint is transferred to the controller with the variable rW.

rX: actual value of the control loop.

tTaskCycleTime: cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the task cycle time of the calling task.

tCtrlCycleTime: the variable tCtrlCycleTime specifies the cycle time with which the PID controller is processed. The shortest possible cycle time is that of the controller. Since the controlled systems in building automation are predominantly slow, the cycle time of the controller can be several times that of the control cycle time.

rYFromPIDCooling: in the case of a VAC system with dehumidification, the output of the cooling controller is connected to this input. Inside the function block FB_HVACPIDDehumidify there is a MAX selection that relays the larger of the control signals from the two controllers FB_HVACPIDDehumidify and FB_HVACPIDCooling to the cooler actuator valve.

eCtrlMode: the operation mode is selected via this enum. Manual or automatic operation mode.

rYManual: manual value that is set at the output rY if eCtrlMode = eHVACCtrlMode_Manual.

bResetController: a positive edge on the input bResetController resets the PID controller.

bReset: acknowledge input in the event of a fault.

VAR_OUTPUT

rY               : REAL; 
rYDehumidify     : REAL;
rXW              : REAL;
bMaxLimit        : BOOL;
bMinLimit        : BOOL;
bActive          : BOOL;
bARWactive       : BOOL;
eState           : E_HVACState;
bError           : BOOL;
eErrorCode       : E_HVACErrorCodes;
bInvalidParameter: BOOL;

rY: control signal output of the PID controller.

rYDehumidify: control signal output of the dehumidification controller.

rXW: control deviation.

bMaxLimit: the output bMaxLimit is TRUE, if the output rY has reached the value rYMax.

bMinLimit: the output bMinLimit is TRUE, if the output rY has reached the value rYMin.

bActive: bActive is TRUE, if the controller is active and enabled.

bARWactive: bARWactiveis TRUE, if the integral component of the controller has reached the lower or upper control value limit.

eState: state of the controller. See E_HVACState.

bError: this output indicates with a TRUE that there is an error.

eErrorCode: contains the command-specific error code. See E_HVACErrorCodes.

bInvalidParameter: TRUE if an error occurs during the plausibility check. The message must be acknowledged with bReset.

VAR_IN_OUT

rDeadRange      : REAL;
rInitialValue   : REAL;
rKp             : REAL;
tTi             : TIME;
tTv             : TIME;
tTd             : TIME;
rDeadBand       : REAL;
rYMin           : REAL;
rYMax           : REAL;
iCurrentSequence: INT;

rDeadRange: in order to avoid unnecessary driving and hence premature wear of the valves or damper drives, a dead range can be set for the controller output signal rY. This means that a control signal change is only active if the change of value is greater than the dead range. A constant change of the control signal rY is converted to a pulsating drive of the actuator if a dead range is specified. The larger the dead range the larger the pauses and the control signal jumps will be. The variable is saved persistently. Preset to 0.

rInitialValue: the restart behavior of the controller is influenced by rInitialValue. The variable is saved persistently. Preset to 0.

rKp: proportional factor gain. The variable is saved persistently. Preset to 0.

tTi: integral action time. The I-part corrects the residual control deviation following correction of the P-part. The smaller the tTi time is set, the faster the controller corrects. The control loop becomes unstable if the time is too short. Larger tTi-times must be entered in order to reduce the integration component. The integral action time should be selected to be longer than the stroke time of the valve or damper drive. The variable is saved persistently. Preset to 30 s.

tTv: rate time. The larger tTv is, the stronger the controller corrects. The control loop becomes unstable if the time is too long. Often in normal building automation applications only a PI controller is used. In this case zero must be entered for tTv. The variable is saved persistently. Preset to 0 s.

tTd : damping time. The variable is saved persistently. Preset to 0 s.

rDeadBand: if the control value is at the lower or upper limit of a controller and the actual value of the controlled system oscillates around the setpoint with a small amplitude, frequent switching back and forth between two sequence controllers can be damped by an additional parameter for the switchover. To this end, the difference between the actual values and the setpoints of the controlled system is integrated after the sequence controller has reached its lower or upper limit. Switching to the next sequence only takes place if the sum of this integration is greater than the value of rDeadband (see sample). The variable is saved persistently. Preset to 0.

rYMin: lower limit of the working range of the controller. The variable is saved persistently. Preset to 0.

rYMax: upper limit of the working range of the controller. The variable is saved persistently. Preset to 100.

iCurrentSequence: number of the active controller in the sequence.