ExampleHeating (FB)¶
FUNCTION_BLOCK ExampleHeating
Example heating circuit
This example function block implements a simple outside temperature dependent water heating circuit to demonstrate how to:
implement a plant / an aggregate in CFC using CODESYS Building Automation library function blocks
SequenceControl can be used for one sequence as well
use DailyMeanTemperature to enable / disable heating circuit in “atomatic”-mode
use HeatingCharacteristicCurve to compute supply temperature setpoint
This example involves:
heating circuit operation enabled / disabled in “auto”-mode using DailyMeanTemperature or outdoor temperature
computation of supply temperature setpoint using HeatingCharacteristicCurve
night time setpoint reduction vs. switching off heating circuit operation
economy mode - switching off circulation pump and mixing valve if supply temperature to low to provide sufficient energy
optional anti-freeze
Watch out for comments in the implementation where those aspects are covered.
outdoor air temperature sensor
indoor air temperature sensor
supply temperature sensor
circulation pump
mixing valve
Heating circuit operation¶
Heating circuit operation could be enabled / disabled manually setting eOnOff accordingly. Heating circuit operation could be determined automatically setting eOnOff to Auto. In “auto”-mode the operation is enabled if either the daily mean temperature or the outdoor temperature (xUseOdaTemp = TRUE) is below rTempLimitEnable.
Night time setpoint reduction vs. switching off heating circuit operation¶
ExampleHeating allows to use either a reduced supply temperature setpoint (rSupplyTempSetpt) at night, or to switch off operation at all.
Economy mode¶
Economy mode is switching off circulation pump and mixing valve if rSupplyTempSetpt is to low to provide sufficient energy. It differentiates low / high temperature heating systems by HeatingCharacteristicCurve gradient. Gradient < 1.0 assumes a low temperature heating system (for example floor heating).
Gradient <= 1.0 - low temperature heating system:
rSupplyTempSetpt < rIdaTempSetpt => switch off rSupplyTempSetpt > rIdaTempSetpt + 2.0K => switch on
Gradient > 1.0 - high temperature heating system:
rSupplyTempSetpt < rIdaTempSetpt + 5.0K => switch off rSupplyTempSetpt > rIdaTempSetpt + 7.0K => switch on
Optional anti-freeze¶
If anti-freeze is activated, there are three separate measures activated:
low outdoor temperature (rOdaTemp < rAntiFreezeOdaTempLimit) cause the circulation pump to be enabled
low supply temperature (rSupplyTemp < rAntiFreezeSupplyTempLimit) cause the heating circuit operation to be enabled anyway
low indoor air temperature (rIdaTemp < rAntiFreezeIdaTempLimit) cause the heating circuit operation to be enabled anyway
Caveats¶
To keep complexity as low as possible this example omits - amongst others - the following real world application aspects worth mentioning:
configuration missing (configuration of m_heatingCharacteristicCurve, m_circulationPump, m_sequenceControl, m_mixingValve, etc. is not or not completely exposed on the ExampleHeating VAR_INPUT section)
sensors missing (circulation pump service / error indication, …)
input consistency checks (implausible measurement values, …)
day / night operation does often fullfill more complex needs
scheduling (for example via BACnet scheduler) might set setpoint instead of day / night
ramping up/down the setpoint instead of switching over between day / night setpoint
xError / eErrorID not computed at all, see ExampleAirConditioning2 how to do this
sensor / actuator process I/O not mapped (FB sensor inputs, m_circulationPump, m_mixingValve)
- InOut:
Scope
Name
Type
Initial
Comment
Input
eOnOffAutoOnOff.Auto
Operation mode preset
rSupplyTempREALSupply temperature
rOdaTempREALOutdoor temperature
rIdaTempREAL21.0
Indoor air temperature
rIdaTempSetptREAL21.0
Indoor air temperature setpoint
rTempLimitAutoEnableREAL16.0
Temperature limit to enable operation in “auto”-mode
xUseOdaTempBOOLFALSE
Decides whether to use daily mean temperature or outdoor temperature to enable operation in “auto”-mode. xUseOdaTemp := FALSE => use daily mean temperature. xUseOdaTemp := TRUE => use outdoor temperature.
xDayNightBOOLTRUE
Decides whether to use day / night operation
rGradientREAL1.2
HeatingCharacteristicCurve gradient.
rShiftREAL0.0
HeatingCharacteristicCurve parallel shift
rMinimumSupplyTempREAL20.0
Supply temperature minimum
rMaximumSupplyTempREAL80.0
Supply temperature maximum
xNightSetptReductionEnableBOOLTRUE
Decides whether to use night time setpoint reduction vs. switching off heating circuit operation
rNightSetptReductionREAL-12.0
Night time setpoint reduction
xEconomyEnableBOOLTRUE
Enables economy mode
xAntiFreezeEnableBOOLTRUE
Enables anti-freeze
rAntiFreezeOdaTempLimitREAL4.0
Anti-freeze outdoor temperature limit
rAntiFreezeSupplyTempLimitREAL10
Anti-freeze supply temperature limit
rAntiFreezeIdaTempLimitREAL14.0
Anti-freeze indoor air temperature limit
xResetBOOLFALSE
Reset
itfDateTimeProviderUtil.IDateTimeProviderGlobals.g_dtpDateTimeProvider
Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000
Output
xOnBOOLHeating circuit is activated / enabled
xHeatBOOLHeating circuit in operation
rSupplyTempSetptREALSupply temperature setpoint
xEconomyBOOLEconomy mode active
xFrostAlarmBOOLFrost alarm indication
xCircPumpBOOLCirculation pump running
rValveREALMixing valve