ExampleAirConditioning1 (FB)¶
FUNCTION_BLOCK ExampleAirConditioning1
Example air conditioning 1
This example function block implements a very simple air conditioning plant to demonstrate how to:
implement a plant / an aggregate in CFC using CODESYS Building Automation library function blocks
use SequenceControl
This example involves:
sequence control of heater coil / cooler coil
energy level
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.

outdoor air damper
heater coil (water operated)
cooler coil (water operated)
supply air fan
extract air fan
extract air temperatur sensor
exhaust air damper
Air types¶
Air types - terms, abbreviations and colors oriented towards DIN EN 16798-3.

Sequence control heater coil / cooler coil¶
SequenceControl is used to control two sequences - heater coil and cooler coil.
Hints¶
Unused pins of function block instances are hidden, so refer to the function block documentation for more details. This example is evolved into ExampleAirConditioning2.
Caveats¶
To keep complexity as low as possible this example omits the following real world application aspects worth mentioning:
ignoring the subtle differences between indoor air control vs. extract air control (assuming extract air temp. = indoor air temp.)
no anti-freeze mechanism for heater coil
no indoor air / supply air cascade control (control quality)
no supply air minimum enforced (physiological problems caused by low supply air temperature)
configuration missing (configuration of m_energyLevelSetpoint, m_sequenceControl, m_hvacHeaterCoil and m_hvacCoolerCoil is not exposed on the ExampleAirConditioning1 VAR_INPUT section)
input consistency checks (implausible measurement values, …)
xError / eErrorID not computed from xError / eErrorID of all function block instances used, see ExampleAirConditioning2 how to do this
- InOut:
Scope
Name
Type
Initial
Comment
Input
xEnable
BOOL
TRUE
Enable
eLevel
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
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.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%).
rEhaDamperOut
REAL
Exhaust air damper signal (0..100%).
xFan
BOOL
Extract air / supply air fan
xError
BOOL
Error indication
eErrorID
Error ID