Skip to content

Commit

Permalink
Predheat weather comp (#1752)
Browse files Browse the repository at this point in the history
* Add weather_compensation

* Remove weather_comp_max

* [pre-commit.ci lite] apply automatic fixes

* Remove testing constant and tidyup

* [pre-commit.ci lite] apply automatic fixes

* Add weather comp documentation

* Correct weather comp doc

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
Meatballs1 and pre-commit-ci-lite[bot] authored Dec 18, 2024
1 parent f749960 commit fcb5d3d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
24 changes: 21 additions & 3 deletions apps/predbat/predheat.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def __init__(self, base):
self.heat_pump_efficiency = HEAT_PUMP_EFFICIENCY.copy()
self.gas_efficiency = GAS_EFFICIENCY.copy()
self.delta_correction = DELTA_CORRECTION.copy()
self.weather_compensation = {}
self.weather_compensation_enabled = False

# Collect predheat settings
heat_pump_efficiency = self.get_arg("heat_pump_efficiency", {}, domain="predheat")
Expand All @@ -129,17 +131,27 @@ def __init__(self, base):
for key, value in delta_correction.items():
self.delta_correction[key] = value

weather_compensation = self.get_arg("weather_compensation", {}, domain="predheat")
if weather_compensation:
for key, value in weather_compensation.items():
self.weather_compensation[key] = value
self.weather_compensation_enabled = True

# Fill gaps in tables
self.delta_correction = self.fill_table_gaps(self.delta_correction)
self.gas_efficiency = self.fill_table_gaps(self.gas_efficiency)
self.heat_pump_efficiency = self.fill_table_gaps(self.heat_pump_efficiency)
self.weather_compensation = self.fill_table_gaps(self.weather_compensation)

self.heat_pump_efficiency_max = max(self.heat_pump_efficiency.values())
self.log("Predheat: Delta correction {}".format(self.delta_correction))
self.log("Predheat: Gas boiler efficiency {}".format(self.gas_efficiency))
self.log("Predheat: Heat pump efficiency {}".format(self.heat_pump_efficiency))
self.log("Predheat: Heat pump efficiency max {}".format(self.heat_pump_efficiency_max))

if self.weather_compensation_enabled:
self.log("Predheat: Weather compensation {}".format(self.weather_compensation))

def minutes_to_time(self, updated, now):
"""
Compute the number of minutes between a time (now) and the updated time
Expand Down Expand Up @@ -352,8 +364,15 @@ def run_simulation(self, volume_temp, heating_active, save="best", last_predict_
heat_power_in = 0
heat_power_out = 0
if heating_on:
out_temp = int(external_temp + 0.5)
out_temp = min(max(out_temp, -20), 20)
heat_to = target_temp
flow_temp = self.flow_temp

if self.weather_compensation_enabled:
flow_temp = self.weather_compensation.get(out_temp)
else:
flow_temp = self.flow_temp

if volume_temp < flow_temp:
flow_temp_diff = min(flow_temp - volume_temp, self.flow_difference_target)
power_percent = flow_temp_diff / self.flow_difference_target
Expand All @@ -371,8 +390,7 @@ def run_simulation(self, volume_temp, heating_active, save="best", last_predict_
heat_power_in = heat_power_out / (condensing * self.heat_cop)
else:
# Heat pump efficiency based on outdoor temp
out_temp = int(external_temp + 0.5)
out_temp = min(max(out_temp, -20), 20)

cop_adjust = self.heat_pump_efficiency.get(out_temp, self.heat_pump_efficiency_max) / self.heat_pump_efficiency_max
heat_power_in = heat_power_out / (self.heat_cop * cop_adjust)

Expand Down
13 changes: 13 additions & 0 deletions docs/predheat.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,16 @@ The final figure should be the number of watts your house loses per 1 degree of
Then you can set **heat_gain_static** to be the static heat output of other things in your house eg. computers and people. You can figure this out by looking at how many degrees of
temperature difference your house can maintain without any heating and multiply up your heat loss watts figure by this.
### Weather Compensation
If your heat source makes use of weather compensation then add the following to the configuration to map out your heat curve. The example has a flow temp of 45C at -3C outside and 25C at 15C outside:
```yaml weather_compensation:
-20: 45.0
-3: 45.0
15: 25.0
20: 25.0
```
Predheat will fill in the gaps between the points provided.

0 comments on commit fcb5d3d

Please sign in to comment.