FB_BA_FnctSel

FB_BA_FnctSel 1:

The function block FB_BA_FnctSel is used to enable heating or cooling operation in a room.
The type of distribution network plays a major role here:
If it is a two-pipe system, all the rooms in the system can only ever be either heated or cooled.
In a four-pipe system, on the other hand, the air conditioning of the rooms can be based on demand, i.e. one part of the rooms can be heated and the other cooled by the same system.

The function block used for each room, as already mentioned, selects its controllers, depending on which type of piping system is available:

Two-pipe network

The two-pipe system is selected when ePipeSys.e2Pipe is set at the input of the function block. Since all rooms served by the plant can only either be heated or cooled, the choice is specified centrally for all rooms via the input eMedium. If eMedium is FALSE, the room heating controller is selected. If the input is TRUE the cooling controller is selected. The controller enable states bEnHtg and bEnCol are always issued with a delay of nChgOvrDly [s]. In other words, heating cannot be enabled until the cooling enable state bEnCol for nChgOvrDly is FALSE, and vice versa. In addition to the elapsing of this changeover time, the system checks that the output from controller to be switched off is 0.0. This is done by feedback at the inputs fCtrlValHtg and fCtrlValCol. In this way, a drastic change from heating to cooling and vice versa is avoided.

Four-pipe network

The four-pipe system is selected when ePipeSys.e4Pipe is set at the input of the function block. In this case, the choice of controller can be different for the individual rooms as required, based on the room temperature fRmT and the setpoints fSpHtg for heating and fSpCol for cooling. If the room temperature exceeds the cooling setpoint, the cooling controller is enabled (bEnCol), if it falls below the heating setpoint, the heating controller is enabled (bEnHtg). If the temperature is between the two setpoints, both controllers are switched off (energy-neutral zone). Here too, the output of the controller enable states bEnHtg and bEnCol is delayed by nChgOvrDly [s] (see two-pipe network). In addition to the elapsing of this changeover time, the system checks that the output from controller to be switched off is 0.0. This is done by feedback at the inputs fCtrlValHtg and fCtrlValCol. In this way, a drastic change from heating to cooling and vice versa is avoided, if the changeover time is inadequate.

Dew point sensor (bDewPnt)

In both systems (two- and four-pipe) the dew point sensor has the task of deactivating cooling immediately, if required.

Program sequence

The function block can have 3 possible states:

  1. Waiting for heating or cooling enable
  2. Heating enable
  3. Cooling enable

In the first step, the function block waits for compliance with the conditions required for heating or cooling:

Heating

Cooling

Output cooling controller = 0 (fCtrlValCol)

Output heating controller = 0 (fCtrlValHtg)

Room temperature (fRmT) < setpoint heating (fSpHtg)

Room temperature (fRmT) > setpoint cooling (fSpCol)

Cooling controller enable (bEnCol) is FALSE over at least the changeover time nChgOvrDly [s]

Heating controller enable (bEnHtg) is FALSE over at least the changeover time nChgOvrDly [s]

Four-pipe system is selected (ePipesys = E_BA_PipeSys.4Pipe) or two-pipe system is selected and heating medium is available (ePipesys = E_BA_PipeSys.2Pipe AND bMedium = FALSE)

Four-pipe system is selected (ePipesys = E_BA_PipeSys.e4Pipe) or two-pipe system is selected and cooling medium is aveilable (ePipesys = E_BA_PipeSys.e2Pipe AND bMedium = TRUE)

 

The dew point sensor does not trigger (bDewPnt = TRUE)

If a chain of conditions is met, the function block switches to the respective state (heating or cooling) and remains in this state until the corresponding controller issues 0 at the function block input (fCtrlValHtg/fCtrlValCol). This ensures that only one controller is active at any one time, even if a high heating controller output, for example, would call for a brief cooling intervention (overshoot). Heating or cooling continues until there is no longer a demand.

There are 3 exceptions, for which heating or cooling is immediately interrupted:

  1. In the two-pipe system (ePipeSys = E_BA_PipeSys.2Pipe) heating is active (bEnHtg), but the system has been switched to cooling medium (eMedium = E_BA_Medium.eCoolMedium)
  2. In the two-pipe system (ePipeSys = E_BA_PipeSys.2Pipe) cooling is active (bEnCol), but the system has been switched to heating medium (eMedium = E_BA_Medium.eHeatMedium)
  3. The dew point sensor was triggered (bDewPnt=TRUE) in cooling mode (two or four-pipe system)

In these cases the heating or cooling enable states are canceled, and the plant switches to standby.

FB_BA_FnctSel 2:

If one of the two controller is enabled and the corresponding controller does not react, i.e. it remains at "0" for the time nChgOvrDly [s],
the function block automatically returns to the first step "Wait for heating or cooling enable".

This is an emergency function in case a temperature sensor jumps and a wrong selection is made, which then cannot be fulfilled by the selected controller. An example would be if at PLC start a sensor function outputs 0°, thus heating is selected and the sensor function then assumes a temperature value that requires the cooling controller due to a programmed PLC start delay. Without this emergency function, it would be waited in vain for the heating controller to assume a value greater than "0".

Demand message (eReqdMedium)

To notify the plant of the current demand for heating or cooling, a demand ID is issued at the function block output, i.e. for each room, depending on the actual and set temperature. These can be collected and evaluated centrally. The evaluation always takes place, irrespective of the network type (two- or four-pipe).

eReqdMedium

Medium

Room temperature

1

No medium is requested

fRmT > fSpHtg AND fRmT < fSpCol

2

Heating medium is requested

fRmT < fSpHtg

3

Cooling medium is requested

fRmT > fSpCol

Error handling

The heating setpoint must not be greater than or equal to the cooling setpoint, since this would result in temperature range with simultaneous heating and cooling demand. However, since the function block only issues one enable state at a time (i.e. heating or cooling), the case is harmless from a plant engineering perspective. In this case only a warning message is issued (bErr = TRUE, sErrDescr = warning message); the function block does not interrupt its cycle.

FB_BA_FnctSel 3: Inputs

VAR_INPUT
  ePipeSys          : E_BA_PipeSys;
  eMedium           : E_BA_Medium;
  bDewPnt           : BOOL;
  fRmT              : REAL;
  fSpHtg            : REAL;
  fSpCol            : REAL;
  fCtrlValHtg       : REAL;
  fCtrlValCol       : REAL;
  nChgOvrDel        : UDINT;
END_VAR

Name

Type

Description

ePipeSys

E_BA_PipeSys

Pipe system (2Pipe, 4Pipe) of the plant.

eMedium

E_BA_Medium

Selection of the medium for the entire two-pipe network (NoMedium, HeatMedium, CoolMedium).

bDewPnt

BOOL

Dew point sensor: if bDewPnt = FALSE, then the cooling controller is locked.

fRmT

REAL

Room temperature

fSpHtg

REAL

Calculated setpoint of the supply air temperature for the heater.

fSpCol

REAL

Calculated setpoint of the supply air temperature for the cooler.

fCtrlValHtg

REAL

Current output value of the heating controller. Used internally as switching criterion from heating to cooling: fCtrlValHtg must be 0.

fCtrlValCol

REAL

Current output value of the cooling controller. Used internally as switching criterion from cooling to heating: fCtrlValCol must be 0.

nChgOvrDel

UDINT

Switchover delay [s] from heating to cooling or vice versa. Internally limited to a minimum value of 0.

FB_BA_FnctSel 4: Outputs

VAR_OUTPUT
  bEnHtg              : BOOL;
  bEnCol              : BOOL;
  eReqdMedium         : E_BA_Medium;
  nRemTiChgOvrDlyHtg  : UDINT;
  nRemTiChgOvrDlyCol  : UDINT;
  bErr                : BOOL;
  sErrDescr           : T_MAXSTRING;
END_VAR

Name

Type

Description

bEnHtg

BOOL

Heating controller enable.

bEnCol

BOOL

Cooling controller enable.

eReqdMedium

E_BA_Medium

Requested medium (see Determination of needs).

nRemTiChgOvrDlyHtg

UDINT

Countdown [s] for switchover delay from cooling to heating.

nRemTiChgOvrDlyCol

UDINT

Countdown [s] for switchover delay from heating to cooling.

bErr

BOOL

In case of a fault, e.g. if warning stages are active, this output is set to TRUE.

sErrDescr

T_MAXSTRING

Contains the error description.

Error description

01: Warning: The setpoint Heating is higher than or equal to the setpoint Cooling

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.22

Tc3_BA2 from v5.2.5.0