FB_BA_HeatCool_PID

FB_BA_HeatCool_PID 1:

This template is used to control a heating-cooling zone.

The priority selection EnergLvlSlcn first determines the currently valid energy level.

The window contact always has priority and switches to the energy level "Protection" when the window is open. When there is a presence in the room, the "Comfort" level is always activated.

The function block RmTAdj is used for a local shift of the room temperature setpoint for the energy levels "Pre-Comfort" and "Comfort".

The setpoint is shifted via a local input value fRmTAdj or via an external value fRmTAdj_In which is read via the base class FB_BA_Ext_SunblindAngle (internal function block), for example via a HMI. The value that was last changed is always valid; the function block FB_BA_LastWriterWins_R04 is responsible for this. The room temperature value is limited to +/- fRmTAdjLimit (predefined to 1.0 in FB_init).

The instance FnctSel of the function block FB_BA_FnctSel enables the heating or cooling controller of the temperature zone.

Data exchange HMI

The data exchange with the HMI is realized here in the base class FB_BA_Ext_HeatCoolBase (internal function block). The use of the following variables is visible in this template:

FB_BA_HeatCool_PID 2:

The initialization of the template takes place within the method FB_Init.

Block diagram

FB_BA_HeatCool_PID 3:

Syntax

FUNCTION_BLOCK FB_BA_HeatCool_PID EXTENDS FB_BA_Ext_HeatCoolBase
VAR_INPUT
  bPrc                    : BOOL;
  bWdwCon                 : BOOL;
  eMedium                 : E_BA_Medium;
  bDewPnt                 : BOOL;
  fRmT                    : REAL;
  fRmTAdj                 : REAL;
  stBuildingSpRmT         : ST_BA_SpRmT;
  eBuildingEnergyLevel    : E_BA_EnergyLvlEx;

END_VAR
VAR_OUTPUT
  bCtrlHtgActv            : BOOL;
  fCtrlValHtg             : REAL;
  bCtrlColActv            : BOOL;
  fCtrlValCol             : REAL;
  eReqdMedium             : E_BA_Medium;
END_VAR 
VAR_INPUT CONSTANT PERSISTENT
  ePipeSys                : E_BA_PipeSys;
  nFnctSelChgOvrDly       : UDINT;
  fRmTAdjLimit            : REAL;
END_VAR
VAR_INPUT CONSTANT
  CtrlHtg                 : FB_BA_Loop;
  CtrlCol                 : FB_BA_Loop;
END_VAR
VAR
  RmTAdj                  : FB_BA_RmTAdj;
  EnergLvlSlcn            : FB_BA_PrioSwi_UDI04;
  SpSlcnHtg               : FB_BA_MUX_R04;
  SpSclnCol               : FB_BA_MUX_R04;
  FnctSel                 : FB_BA_FnctSel;
END_VAR

FB_BA_HeatCool_PID 4: Inputs

Name

Type

Description

bPrc

BOOL

Presence detection

bWdwCon

BOOL

Window contact (open = TRUE)

eMedium

E_BA_Medium

Medium present (heating or cooling medium, only important for two-pipe operation)

bDewPnt

BOOL

Dew point sensor (alarm = TRUE)

fRmT

BOOL

Room temperature [°C]

fRmTAdj

REAL

Room setpoint shift [K]

stBuildingSpRmT

ST_BA_SpRmT

Structure of room setpoints (Protection Cooling..Comfort Cooling and Protection Heating ... Comfort Heating)

eBuildingEnergyLevel

E_BA_EnergyLvlEx

Current building energy level

FB_BA_HeatCool_PID 5: Outputs

Name

Type

Description

bCtrlHtgActv

BOOL

Heating controller is active

fCtrlValHtg

REAL

Control value heating valve

bCtrlColActv

BOOL

Cooling controller is active

fCtrlValCol

REAL

Control value cooling valve

eReqdMedium

E_BA_Medium

Requested medium (heating or cooling medium)

FB_BA_HeatCool_PID 6: Inputs CONSTANT PERSISTENT

Name

Type

Description

ePipeSys

E_BA_PipeSys

Selection of two or four-pipe system.

nFnctSelChgOvrDly

UDINT

Switchover delay [s] from heating to cooling or vice versa.

fRmTAdjLimit

REAL

Adjustable range [K] of the setpoint value shift fRmTAdj : -fRmTAdjLimit <= fRmTAdj <= +fRmTAdjLimit

FB_BA_HeatCool_PID 7: Inputs CONSTANT

Name

Type

Description

CtrlHtg

FB_BA_Loop

Heating controller

CtrlCol

FB_BA_Loop

Cooling controller

Variables

Name

Type

Description

RmTAdj

FB_BA_RmTAdj

Function block that applies the sh to the corresponding setpoints and outputs them explicitly.

EnergLvlSlcn

FB_BA_PrioSwi_UDI04

Prioritizing selection and conversion of the possible energy levels into a numerical value.

SpSlcnHtg

FB_BA_MUX_R04

Selection of the heating setpoint

SpSclnCol

FB_BA_MUX_R04

Selection of the cooling setpoint

FnctSel

FB_BA_FnctSel

Function selection heating or cooling.

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.35

TF8040 | TwinCAT Building Automation from V5.0.0.0