ExampleAirConditioning2 (FB)

FUNCTION_BLOCK ExampleAirConditioning2

Example air conditioning 2

This example function block evolves from ExampleAirConditioning1 and implements a bit more complex air conditioning plant to demonstrate how to:

  • implement a plant / an aggregate in CFC using CODESYS Building Automation library function blocks

  • use SequenceControl and SequenceSwitch

  • do anti-freeze control / anti-freeze shutoff for heater coil

  • compute the xError / eErrorID from xError / eErrorID of function block instances used

This example involves following real world application aspects:

  • recirculation air admixing

  • minimum outdoor air ratio

  • sequence control of recirculation air damper / heater coil / cooler coil

  • energy selection (outdoor air vs. extract air) for recirculation air damper

  • energy level

  • air side anti-freeze / water side anti-freeze for heater coil

  • exhaust air damper / outdoor air damper control

  • extract air fan / supply air fan control

Watch out for comments in the implementation where those aspects are covered.

../../../_images/ExampleAirConditioning2.png
  1. outdoor air temperatur sensor

  2. outdoor air damper

  3. recirculation air damper

  4. heater coil (water operated)

  5. frost monitor

  6. heater coil return temperatur sensor

  7. cooler coil (water operated)

  8. supply air fan

  9. extract air fan

  10. extract air temperatur sensor

  11. exhaust air damper

Air types

Air types - terms, abbreviations and colors oriented towards DIN EN 16798-3.

../../../_images/AirTypes.png

Sequence control damper / heater coil / cooler coil

SequenceControl is used to control three sequences - heater coil, RCA damper and cooler coil.

RCA damper - 0% (maximum outdoor air) .. 100% (would be: no outdoor air)

This is about to utilize mixed air or outdoor air energy as much as possible to heat / cool.

In case you want to trade comfort (in this case control deviation and it’s duration) a bit higher to energy consumption, you might want to set mc_rDamperCoilOverlap to a value < 0.0, making the RCA damper sequence and the coil sequences overlap thus forcing the coils to jump in before maximum RCA ratio is reached. Set mc_rDamperCoilOverlap to -1.0 (K) will make the coil open 25% (because rXP = 4.0) if recirculation air damper reached maximum.

Recirculation air admixing and energy selection

RCA admixing is done using the RCA damper as primary control sequence thus minimizing heat / cool energy consumption. Please see m_energySelection for the energy selection aspect.

Minimum outdoor air ratio

Minimum ODA ratio is achieved by rMax2 := 100% - rMinOdaRatio Remember: RCA damper is controlled by sequence 2. rOut2 = 0% means maximum ODA ratio (100% in this case).

Water side anti-freeze for heater coil

Water side anti-freeze for heater coil is done with two separate sub-functionalities

  • a controlled startup procedure

  • continuous anti-freeze during control

The startup procedure is done using HVAC_AntiFreezeControlStartup if ODA temperature < startup threshold:

  1. preload (the heater coil):

  • ODA / ETA damper closed

  • RCA damper open (maximum recirculation air ratio - 100%)

  • forcing the heater coil to open

  • check heater coil return temperature to reach a threshold

  1. after preload - wait for system to become settled (HVAC_AntiFreezeControlStartup.tFollowUp):

  • open ODA / ETA damper to minimum ODA ratio

  • set RCA damper accordingly to minimum ODA ratio

  1. take over to normal control actions

SequenceControl.xForceEnable and .rForcedValue is used to force the heater coil sequence, thus providing smooth control takeover after sucessfull startup.

The continuous anti-freeze during control is done using a CommandVariable setting the heater coil sequence minimum.

Air side anti-freeze

Air side anti-freeze is done using a frost monitor HVAC_AntiFreezeControlMonitor. The frost monitor simply does shut-off the whole plant, but keeping the heater coil opened to maximum.

Hints

Unused pins of function block instances are hidden, so refer to the function block documentation for more details.

Caveats

To keep complexity as low as possible this example omits the following real world application aspects worth mentioning:

  • configuration missing (configuration of m_energyLevelSetpoint, m_sequenceControl, m_antiFreezeControlStartup and m_antiFreezeCont is not exposed on the ExampleAirConditioning1 VAR_INPUT section)

  • ignoring the subtle differences between indoor air control vs. extract air control (assuming extract air temp. = indoor air temp.)

  • no indoor air / supply air cascade control (control quality)

  • no supply air minimum enforced (physiological problems caused by low supply air temperature)

  • ramping up/down the ODA / EHA damper after anti-freeze control preload is done (our impl. does simply switch to rMinOdaRatio or 100%)

  • cooling is not blocked if continuous anti-freeze during control is opening heater coil

InOut:

Scope

Name

Type

Initial

Comment

Input

xEnable

BOOL

TRUE

Enable

eLevel

EnergyLevel

EnergyLevel.COMFORT

Energy level

rEtaTemp

REAL

22.0

Extract air temperature

rSetptHeatComfort

REAL

21.0

Heat setpoint comfort level

rSetptCoolComfort

REAL

23.0

Cool setpoint comfort level

rOdaTemp

REAL

10.0

Outdoor air temperature

rMinOdaRatio

REAL

20.0

Minimum outdoor air ratio, 0..100%

rHeaterCoilReturnTemp

REAL

20.0

Heater coil return temperature

xFrost

BOOL

FALSE

Heater coil frost indication

xReset

BOOL

FALSE

Reset to proportional control / reset detected input error

itfDateTimeProvider

Util.IDateTimeProvider

Globals.g_dtpDateTimeProvider

Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000

Output

eModeOut

HeatCoolOperationMode

HeatCoolOperationMode.INACTIVE

Operation mode.

rHeatOut

REAL

Heat valve signal (0..100%).

rCoolOut

REAL

Cool valve signal (0..100%).

rOdaDamperOut

REAL

Outdoor air damper signal (0..100%).

rRcaDamperOut

REAL

Recirculation air damper signal (0..100%).

rEhaDamperOut

REAL

Exhaust air damper signal (0..100%).

xFan

BOOL

Extract air / supply air fan

xAntiFreezeStartup

BOOL

Anti-freeze control startup indication

xAntiFreezeStartupError

BOOL

Anti-freeze control startup error indication

xFrostAlarm

BOOL

Frost alarm indication

xError

BOOL

Error indication

eErrorID

Error

Error ID