FB_BA_HeatCool_PID
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:
- fRmTAdj_In: Input room setpoint shift from the HMI.
- fRmTAdj_Out: Output of current room setpoint shift to the HMI.
- fRmTAdjLimit_Out: Output of the +/- range limits of the room setpoint shift to the HMI.
- fRmT_Out: Output of current room temperature to the HMI.
- fSPHtg_Out: Output of heating setpoint to the human-machine interface.
- fSPCol_Out: Output of setpoint cooling to the HMI.
- fCtrlValHtg_Out: Output heating controller output to the HMI.
- fCtrlValCol_Out: Output cooling controller output to the HMI.
- eActualEnergyLevel_Out: Output of the current energy level to the HMI.
- bErr_Out: Output status "Error to FnctSel" to the HMI.
The initialization of the template takes place within the method FB_Init. |
Block diagram
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
Inputs
Name | Type | Description |
---|---|---|
bPrc | BOOL | Presence detection |
bWdwCon | BOOL | Window contact (open = TRUE) |
eMedium | 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 | Structure of room setpoints (Protection Cooling..Comfort Cooling and Protection Heating ... Comfort Heating) | |
eBuildingEnergyLevel | E_BA_EnergyLvlEx | Current building energy level |
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 | Requested medium (heating or cooling medium) |
Inputs CONSTANT PERSISTENT
Name | Type | Description |
---|---|---|
ePipeSys | 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 |
Inputs CONSTANT
Name | Type | Description |
---|---|---|
CtrlHtg | Heating controller | |
CtrlCol | Cooling controller |
Variables
Name | Type | Description |
---|---|---|
RmTAdj | Function block that applies the sh to the corresponding setpoints and outputs them explicitly. | |
EnergLvlSlcn | Prioritizing selection and conversion of the possible energy levels into a numerical value. | |
SpSlcnHtg | Selection of the heating setpoint | |
SpSclnCol | Selection of the cooling setpoint | |
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 |