feat: added software overheating protection

This commit is contained in:
Yurii
2025-06-17 17:50:15 +03:00
parent 1eee184887
commit b985275309
9 changed files with 244 additions and 2 deletions

View File

@@ -171,10 +171,13 @@ protected:
vars.master.heating.enabled = this->isReady()
&& (settings.heating.enabled || vars.emergency.state)
&& vars.cascadeControl.input
&& !vars.master.heating.blocking;
&& !vars.master.heating.blocking
&& !vars.master.heating.overheat;
// DHW settings
vars.master.dhw.enabled = settings.opentherm.options.dhwSupport && settings.dhw.enabled;
vars.master.dhw.enabled = settings.opentherm.options.dhwSupport
&& settings.dhw.enabled
&& !vars.master.dhw.overheat;
vars.master.dhw.targetTemp = settings.dhw.target;
// CH2 settings
@@ -1313,6 +1316,76 @@ protected:
}
}
}
// Heating overheat control
if (settings.heating.overheatHighTemp > 0 && settings.heating.overheatLowTemp > 0) {
float highTemp = max({
vars.slave.heating.currentTemp,
vars.slave.heating.returnTemp,
vars.slave.heatExchangerTemp
});
if (vars.master.heating.overheat) {
if ((float) settings.heating.overheatLowTemp - highTemp + 0.0001f >= 0.0f) {
vars.master.heating.overheat = false;
Log.sinfoln(
FPSTR(L_OT_HEATING), F("Overheating not detected. Current high temp: %.2f, threshold (low): %hhu"),
highTemp, settings.heating.overheatLowTemp
);
}
} else if (vars.slave.heating.active) {
if (highTemp - (float) settings.heating.overheatHighTemp + 0.0001f >= 0.0f) {
vars.master.heating.overheat = true;
Log.swarningln(
FPSTR(L_OT_HEATING), F("Overheating detected! Current high temp: %.2f, threshold (high): %hhu"),
highTemp, settings.heating.overheatHighTemp
);
}
}
} else if (vars.master.heating.overheat) {
vars.master.heating.overheat = false;
}
// DHW overheat control
if (settings.dhw.overheatHighTemp > 0 && settings.dhw.overheatLowTemp > 0) {
float highTemp = max({
vars.slave.heating.currentTemp,
vars.slave.heating.returnTemp,
vars.slave.heatExchangerTemp,
vars.slave.dhw.currentTemp,
vars.slave.dhw.currentTemp2,
vars.slave.dhw.returnTemp
});
if (vars.master.dhw.overheat) {
if ((float) settings.dhw.overheatLowTemp - highTemp + 0.0001f >= 0.0f) {
vars.master.dhw.overheat = false;
Log.sinfoln(
FPSTR(L_OT_DHW), F("Overheating not detected. Current high temp: %.2f, threshold (low): %hhu"),
highTemp, settings.dhw.overheatLowTemp
);
}
} else if (vars.slave.dhw.active) {
if (highTemp - (float) settings.dhw.overheatHighTemp + 0.0001f >= 0.0f) {
vars.master.dhw.overheat = true;
Log.swarningln(
FPSTR(L_OT_DHW), F("Overheating detected! Current high temp: %.2f, threshold (high): %hhu"),
highTemp, settings.dhw.overheatHighTemp
);
}
}
} else if (vars.master.dhw.overheat) {
vars.master.dhw.overheat = false;
}
}
void initialize() {

View File

@@ -108,6 +108,8 @@ struct Settings {
byte minTemp = DEFAULT_HEATING_MIN_TEMP;
byte maxTemp = DEFAULT_HEATING_MAX_TEMP;
uint8_t maxModulation = 100;
uint8_t overheatHighTemp = 95;
uint8_t overheatLowTemp = 90;
} heating;
struct {
@@ -116,6 +118,8 @@ struct Settings {
byte minTemp = DEFAULT_DHW_MIN_TEMP;
byte maxTemp = DEFAULT_DHW_MAX_TEMP;
uint8_t maxModulation = 100;
uint8_t overheatHighTemp = 95;
uint8_t overheatLowTemp = 90;
} dhw;
struct {
@@ -280,6 +284,7 @@ struct Variables {
bool blocking = false;
bool enabled = false;
bool indoorTempControl = false;
bool overheat = false;
float setpointTemp = 0.0f;
float targetTemp = 0.0f;
float currentTemp = 0.0f;
@@ -292,6 +297,7 @@ struct Variables {
struct {
bool enabled = false;
bool overheat = false;
float targetTemp = 0.0f;
float currentTemp = 0.0f;
float returnTemp = 0.0f;

View File

@@ -150,6 +150,9 @@ const char S_OPTIONS[] PROGMEM = "options";
const char S_OUTDOOR_TEMP[] PROGMEM = "outdoorTemp";
const char S_OUT_GPIO[] PROGMEM = "outGpio";
const char S_OUTPUT[] PROGMEM = "output";
const char S_OVERHEAT[] PROGMEM = "overheat";
const char S_OVERHEAT_HIGH_TEMP[] PROGMEM = "overheatHighTemp";
const char S_OVERHEAT_LOW_TEMP[] PROGMEM = "overheatLowTemp";
const char S_PASSWORD[] PROGMEM = "password";
const char S_PID[] PROGMEM = "pid";
const char S_PORT[] PROGMEM = "port";

View File

@@ -495,6 +495,8 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp;
heating[FPSTR(S_MAX_MODULATION)] = src.heating.maxModulation;
heating[FPSTR(S_OVERHEAT_HIGH_TEMP)] = src.heating.overheatHighTemp;
heating[FPSTR(S_OVERHEAT_LOW_TEMP)] = src.heating.overheatLowTemp;
auto dhw = dst[FPSTR(S_DHW)].to<JsonObject>();
dhw[FPSTR(S_ENABLED)] = src.dhw.enabled;
@@ -502,6 +504,8 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dhw[FPSTR(S_MIN_TEMP)] = src.dhw.minTemp;
dhw[FPSTR(S_MAX_TEMP)] = src.dhw.maxTemp;
dhw[FPSTR(S_MAX_MODULATION)] = src.dhw.maxModulation;
dhw[FPSTR(S_OVERHEAT_HIGH_TEMP)] = src.dhw.overheatHighTemp;
dhw[FPSTR(S_OVERHEAT_LOW_TEMP)] = src.dhw.overheatLowTemp;
auto equitherm = dst[FPSTR(S_EQUITHERM)].to<JsonObject>();
equitherm[FPSTR(S_ENABLED)] = src.equitherm.enabled;
@@ -1342,6 +1346,29 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
if (!src[FPSTR(S_HEATING)][FPSTR(S_OVERHEAT_HIGH_TEMP)].isNull()) {
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_OVERHEAT_HIGH_TEMP)].as<unsigned char>();
if (isValidTemp(value, dst.system.unitSystem, 0.0f, 100.0f) && value != dst.heating.overheatHighTemp) {
dst.heating.overheatHighTemp = value;
changed = true;
}
}
if (!src[FPSTR(S_HEATING)][FPSTR(S_OVERHEAT_LOW_TEMP)].isNull()) {
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_OVERHEAT_LOW_TEMP)].as<unsigned char>();
if (isValidTemp(value, dst.system.unitSystem, 0.0f, 99.0f) && value != dst.heating.overheatLowTemp) {
dst.heating.overheatLowTemp = value;
changed = true;
}
}
if (dst.heating.overheatHighTemp < dst.heating.overheatLowTemp) {
dst.heating.overheatHighTemp = dst.heating.overheatLowTemp;
changed = true;
}
// dhw
if (src[FPSTR(S_DHW)][FPSTR(S_ENABLED)].is<bool>()) {
@@ -1385,6 +1412,29 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
if (!src[FPSTR(S_DHW)][FPSTR(S_OVERHEAT_HIGH_TEMP)].isNull()) {
unsigned char value = src[FPSTR(S_DHW)][FPSTR(S_OVERHEAT_HIGH_TEMP)].as<unsigned char>();
if (isValidTemp(value, dst.system.unitSystem, 0.0f, 100.0f) && value != dst.dhw.overheatHighTemp) {
dst.dhw.overheatHighTemp = value;
changed = true;
}
}
if (!src[FPSTR(S_DHW)][FPSTR(S_OVERHEAT_LOW_TEMP)].isNull()) {
unsigned char value = src[FPSTR(S_DHW)][FPSTR(S_OVERHEAT_LOW_TEMP)].as<unsigned char>();
if (isValidTemp(value, dst.system.unitSystem, 0.0f, 99.0f) && value != dst.dhw.overheatLowTemp) {
dst.dhw.overheatLowTemp = value;
changed = true;
}
}
if (dst.dhw.overheatHighTemp < dst.dhw.overheatLowTemp) {
dst.dhw.overheatHighTemp = dst.dhw.overheatLowTemp;
changed = true;
}
if (!safe) {
// external pump
@@ -2016,6 +2066,7 @@ void varsToJson(const Variables& src, JsonVariant dst) {
mHeating[FPSTR(S_ENABLED)] = src.master.heating.enabled;
mHeating[FPSTR(S_BLOCKING)] = src.master.heating.blocking;
mHeating[FPSTR(S_INDOOR_TEMP_CONTROL)] = src.master.heating.indoorTempControl;
mHeating[FPSTR(S_OVERHEAT)] = src.master.heating.overheat;
mHeating[FPSTR(S_SETPOINT_TEMP)] = roundf(src.master.heating.setpointTemp, 2);
mHeating[FPSTR(S_TARGET_TEMP)] = roundf(src.master.heating.targetTemp, 2);
mHeating[FPSTR(S_CURRENT_TEMP)] = roundf(src.master.heating.currentTemp, 2);
@@ -2027,6 +2078,7 @@ void varsToJson(const Variables& src, JsonVariant dst) {
auto mDhw = master[FPSTR(S_DHW)].to<JsonObject>();
mDhw[FPSTR(S_ENABLED)] = src.master.dhw.enabled;
mDhw[FPSTR(S_OVERHEAT)] = src.master.dhw.overheat;
mDhw[FPSTR(S_TARGET_TEMP)] = roundf(src.master.dhw.targetTemp, 2);
mDhw[FPSTR(S_CURRENT_TEMP)] = roundf(src.master.dhw.currentTemp, 2);
mDhw[FPSTR(S_RETURN_TEMP)] = roundf(src.master.dhw.returnTemp, 2);

View File

@@ -117,6 +117,7 @@
"mHeatEnabled": "Heating enabled",
"mHeatBlocking": "Heating blocked",
"mHeatOverheat": "Heating overheat",
"sHeatActive": "Heating active",
"mHeatSetpointTemp": "Heating setpoint temp",
"mHeatTargetTemp": "Heating target temp",
@@ -126,6 +127,7 @@
"mHeatOutdoorTemp": "Heating, outdoor temp",
"mDhwEnabled": "DHW enabled",
"mDhwOverheat": "DHW overheat",
"sDhwActive": "DHW active",
"mDhwTargetTemp": "DHW target temp",
"mDhwCurrTemp": "DHW current temp",
@@ -302,6 +304,18 @@
"max": "Maximum temperature"
},
"maxModulation": "Max modulation level",
"overheat": {
"title": "Overheating protection",
"desc": "<b>Note:</b> This feature can be useful if the built-in boiler overheating protection does not work or does not work correctly and the heat carrier boils. To disable, set 0 as <b>high</b> and <b>low</b> temperature.",
"highTemp": {
"title": "High temperature threshold",
"note": "Threshold at which the burner will be forcibly switched off"
},
"lowTemp": {
"title": "Low temperature threshold",
"note": "Threshold at which the burner can be turned on again"
}
},
"portal": {
"login": "Login",

View File

@@ -117,6 +117,7 @@
"mHeatEnabled": "Riscaldamento attivato",
"mHeatBlocking": "Riscaldamento bloccato",
"mHeatOverheat": "Riscaldamento surriscaldamento",
"sHeatActive": "Riscaldamento attivo",
"mHeatSetpointTemp": "Temp riscaldamento impostato",
"mHeatTargetTemp": "Target Temp caldaia",
@@ -126,6 +127,7 @@
"mHeatOutdoorTemp": "Riscaldamento, temp esterna",
"mDhwEnabled": "ACS attivata",
"mDhwOverheat": "ACS surriscaldamento",
"sDhwActive": "ACS attiva",
"mDhwTargetTemp": "ACS temp impostata",
"mDhwCurrTemp": "ACS temp attuale",
@@ -302,6 +304,18 @@
"max": "Temperatura massima"
},
"maxModulation": "Max livello modulazione",
"overheat": {
"title": "Protezione contro il surriscaldamento",
"desc": "<b>Nota:</b> questa funzione può essere utile se la protezione contro il surriscaldamento integrata nella caldaia non funziona o non funziona correttamente e il fluido termovettore bolle. Per disattivarla, impostare 0 come temperatura <b>alta</b> e <b>bassa</b>.",
"highTemp": {
"title": "Soglia di temperatura alta",
"note": "Soglia alla quale il bruciatore verrà spento forzatamente"
},
"lowTemp": {
"title": "Soglia di temperatura bassa",
"note": "Soglia alla quale il bruciatore può essere riacceso"
}
},
"portal": {
"login": "Login",

View File

@@ -117,6 +117,7 @@
"mHeatEnabled": "Отопление",
"mHeatBlocking": "Блокировка отопления",
"mHeatOverheat": "Отопление, перегрев",
"sHeatActive": "Активность отопления",
"mHeatSetpointTemp": "Отопление, уставка",
"mHeatTargetTemp": "Отопление, целевая температура",
@@ -126,6 +127,7 @@
"mHeatOutdoorTemp": "Отопление, наружная темп.",
"mDhwEnabled": "ГВС",
"mDhwOverheat": "ГВС, перегрев",
"sDhwActive": "Активность ГВС",
"mDhwTargetTemp": "ГВС, целевая температура",
"mDhwCurrTemp": "ГВС, текущая температура",
@@ -302,6 +304,18 @@
"max": "Макс. температура"
},
"maxModulation": "Макс. уровень модуляции",
"overheat": {
"title": "Защита от перегрева",
"desc": "<b>Примечание:</b> Эта функция может быть полезна, если встроенная защита от перегрева котла не срабатывает или срабатывает некорректно и теплоноситель закипает. Для отключения установите 0 в качестве <b>верхнего</b> и <b>нижнего</b> порога температуры.",
"highTemp": {
"title": "Верхний порог температуры",
"note": "Порог, при котором горелка будет принудительно отключена"
},
"lowTemp": {
"title": "Нижний порог температуры",
"note": "Порог, при котором горелка может быть включена снова"
}
},
"portal": {
"login": "Логин",

View File

@@ -184,6 +184,10 @@
<th scope="row" data-i18n>dashboard.states.mHeatBlocking</th>
<td><i class="mHeatBlocking"></i></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.states.mHeatOverheat</th>
<td><i class="mHeatOverheat"></i></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.states.sHeatActive</th>
<td><i class="sHeatActive"></i></td>
@@ -218,6 +222,10 @@
<th scope="row" data-i18n>dashboard.states.mDhwEnabled</th>
<td><i class="mDhwEnabled"></i></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.states.mDhwOverheat</th>
<td><i class="mDhwOverheat"></i></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.states.sDhwActive</th>
<td><i class="sDhwActive"></i></td>
@@ -611,6 +619,11 @@
result.master.heating.blocking ? "red" : "green"
);
setState('.mHeatIndoorTempControl', result.master.heating.indoorTempControl);
setStatus(
'.mHeatOverheat',
result.master.heating.overheat ? "success" : "error",
result.master.heating.overheat ? "red" : "green"
);
setValue('.mHeatSetpointTemp', result.master.heating.setpointTemp);
setValue('.mHeatTargetTemp', result.master.heating.targetTemp);
setValue('.mHeatCurrTemp', result.master.heating.currentTemp);
@@ -621,6 +634,11 @@
setValue('.mHeatMaxTemp', result.master.heating.maxTemp);
setState('.mDhwEnabled', result.master.dhw.enabled);
setStatus(
'.mDhwOverheat',
result.master.dhw.overheat ? "success" : "error",
result.master.dhw.overheat ? "red" : "green"
);
setValue('.mDhwTargetTemp', result.master.dhw.targetTemp);
setValue('.mDhwCurrTemp', result.master.dhw.currentTemp);
setValue('.mDhwRetTemp', result.master.dhw.returnTemp);

View File

@@ -207,6 +207,28 @@
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
</label>
<details>
<summary><b data-i18n>settings.overheat.title</b></summary>
<div class="grid">
<label>
<span data-i18n>settings.overheat.highTemp.title</span>
<input type="number" inputmode="numeric" name="heating[overheatHighTemp]" min="0" max="212" step="1" required>
<small data-i18n>settings.overheat.highTemp.note</small>
</label>
<label>
<span data-i18n>settings.overheat.lowTemp.title</span>
<input type="number" inputmode="numeric" name="heating[overheatLowTemp]" min="0" max="211" step="1" required>
<small data-i18n>settings.overheat.lowTemp.note</small>
</label>
</div>
<small data-i18n>settings.overheat.desc</small>
</details>
<br>
<button type="submit" data-i18n>button.save</button>
</form>
</div>
@@ -236,6 +258,28 @@
<input type="number" inputmode="numeric" name="dhw[maxModulation]" min="1" max="100" step="1" required>
</label>
<details>
<summary><b data-i18n>settings.overheat.title</b></summary>
<div class="grid">
<label>
<span data-i18n>settings.overheat.highTemp.title</span>
<input type="number" inputmode="numeric" name="dhw[overheatHighTemp]" min="0" max="212" step="1" required>
<small data-i18n>settings.overheat.highTemp.note</small>
</label>
<label>
<span data-i18n>settings.overheat.lowTemp.title</span>
<input type="number" inputmode="numeric" name="dhw[overheatLowTemp]" min="0" max="211" step="1" required>
<small data-i18n>settings.overheat.lowTemp.note</small>
</label>
</div>
<small data-i18n>settings.overheat.desc</small>
</details>
<br>
<button type="submit" data-i18n>button.save</button>
</form>
</div>
@@ -880,6 +924,8 @@
setInputValue("[name='heating[hysteresis]']", data.heating.hysteresis);
setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
setInputValue("[name='heating[overheatHighTemp]']", data.heating.overheatHighTemp);
setInputValue("[name='heating[overheatLowTemp]']", data.heating.overheatLowTemp);
setBusy('#heating-settings-busy', '#heating-settings', false);
// DHW
@@ -892,6 +938,8 @@
"max": data.system.unitSystem == 0 ? 100 : 212
});
setInputValue("[name='dhw[maxModulation]']", data.dhw.maxModulation);
setInputValue("[name='dhw[overheatHighTemp]']", data.dhw.overheatHighTemp);
setInputValue("[name='dhw[overheatLowTemp]']", data.dhw.overheatLowTemp);
setBusy('#dhw-settings-busy', '#dhw-settings', false);
// Emergency mode