ExampleHotWater (FB)¶
FUNCTION_BLOCK ExampleHotWater
Example hot water boiler control
This example function block implements a simple hot water boiler control to demonstrate how to implement a plant / an aggregate in ST using CODESYS Building Automation library function blocks. All other examples are implemented using CFC, because this way it’s a bit more easy to read / understand. No matter of this ST is also a good choice to implement plants / aggregates. Here we demonstrate, that an implementation using ST is also easy to read / understand if structured nicely and well documented.
This example involves:
2 point control of boiler temperature
steady control of boiler supply temperature
demand-based activation of loading pump
legionella prevention
optional unload protection using supply temperature sensor
Watch out for comments in the implementation where those aspects are covered.
supply temperature sensor
mixing valve
loading pump
boiler supply temperature sensor
upper boiler temperature sensor
lower boiler temperature sensor
circulation pump
2 point control of boiler temperature¶
A boiler load cycle is requested, if boiler temperature is below setpoint. The boiler load cycle is stopped, if boiler temperature exceeds setpoint plus hysteresis.
Legionella prevention¶
Boiler temperature is to be kept above 60°C for at least an hour the day. Circulation pump is enabled during this load cycle.
Optional unload protection¶
In case there is a supply temperature sensor ExampleHotWater checks the supply temperature before / during a load operation. In case the supply temperature is below boiler temperature the boiler will not be loaded.
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_legionellaPreventionDone, m_legionellaPreventionTimer, m_loadPump, m_circPump, m_mixingValve etc. is not or not completely exposed on the ExampleHotWater VAR_INPUT section)
input consistency checks (rHyst <= 0, implausible measurement values, …)
no legionella warning issued, if legionella prevention load cycle is missed due to unload conditions
sensors missing (both pumps - service / error indication, …)
xError / eErrorID not computed at all, see ExampleAirConditioning2 how to do this
sensor / actuator process I/O not mapped (FB sensor inputs, m_loadPump, m_circPump, m_mixingValve, …)
- InOut:
Scope
Name
Type
Initial
Comment
Input
rSetptREAL50.0
Hot water temperature setpoint
rHystREAL5.0
Hot water temperature hysteresis
rSupplyTempREALSupply temperature
xSupplyTempSensorBOOLFALSE
Optional supply temperature sensor exists
rBoilerSupplyTempREALBoiler supply temperature
rBoilerTemp1REALUpper boiler temperature
rBoilerTemp2REALLower boiler temperature
xCircPumpRequestBOOLFALSE
Request circulation pump
tLegionellaTIMETIME#1440m0s0ms
Time to next legionella prevention boiler load cycle
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
rRequestedBoilerTempREALRequested boiler temperature
xLegionellaPreventionDoneBOOLLegionella prevention has been done in the last 24 hours
xLoadBOOLBoiler will be loaded actually.
xLoadPumpBOOLLoading pump running
xCircPumpBOOLCirculation pump running
rValveREALMixing valve
tLegionellaRemainingTIMERemaing time to next legionella prevention boiler load cycle