mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
adding enforcing of solar across the building if one unit needs it
This commit is contained in:
parent
0fad758fbb
commit
3ccc5eae89
5 changed files with 49 additions and 9 deletions
2
.idea/Model.iml
generated
2
.idea/Model.iml
generated
|
|
@ -7,7 +7,7 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Stonewater-wave-3" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Fastapi-backend" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PyNamespacePackagesService">
|
<component name="PyNamespacePackagesService">
|
||||||
|
|
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -3,7 +3,7 @@
|
||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Python 3.10 (backend)" />
|
<option name="sdkName" value="Python 3.10 (backend)" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Stonewater-wave-3" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Fastapi-backend" project-jdk-type="Python SDK" />
|
||||||
<component name="PyCharmProfessionalAdvertiser">
|
<component name="PyCharmProfessionalAdvertiser">
|
||||||
<option name="shown" value="true" />
|
<option name="shown" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
|
|
@ -772,6 +772,32 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
]
|
]
|
||||||
recommendations[p.id] = final_recommendations
|
recommendations[p.id] = final_recommendations
|
||||||
|
|
||||||
|
# when we have buildings, we tweak our solar PV recommendations as if one unit needs it, we apply it to all
|
||||||
|
# of them
|
||||||
|
# TODO: We can probably do better and optimise at the building level - this is temp
|
||||||
|
logger.info("Adjusting solar PV recommendations for buildings")
|
||||||
|
building_ids = set([p.building_id for p in input_properties if p.building_id is not None])
|
||||||
|
|
||||||
|
for bid in building_ids:
|
||||||
|
# We check if any of them have solar PV
|
||||||
|
building = [p for p in input_properties if p.building_id == bid]
|
||||||
|
has_solar = False
|
||||||
|
for unit in building:
|
||||||
|
# Get default recommendations
|
||||||
|
has_solar = len([r for r in recommendations[unit.id] if r["default"] and r["type"] == "solar_pv"]) > 0
|
||||||
|
if has_solar:
|
||||||
|
break
|
||||||
|
|
||||||
|
if has_solar:
|
||||||
|
# We adjust the units within the building
|
||||||
|
for unit in building:
|
||||||
|
for rec in recommendations[unit.id]:
|
||||||
|
if rec["type"] == "solar_pv":
|
||||||
|
# This is straightforward, we just set the default to True, since when we're at a building
|
||||||
|
# level, we only allow 1 solar PV option for each unit. If we change this, this logic will
|
||||||
|
# need to be updated
|
||||||
|
rec["default"] = True
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~
|
||||||
# Funding
|
# Funding
|
||||||
# ~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ class RetrieveFindMyEpc:
|
||||||
"roomstat_programmer_trvs", "time_temperature_zone_control"
|
"roomstat_programmer_trvs", "time_temperature_zone_control"
|
||||||
],
|
],
|
||||||
"Change heating to gas condensing boiler": ["boiler_upgrade"],
|
"Change heating to gas condensing boiler": ["boiler_upgrade"],
|
||||||
"Fan assisted storage heaters and dual immersion cylinder": ["high_heat_retention_storage_heaters"],
|
"Fan assisted storage heaters and dual immersion cylinder": ["high_heat_retention_storage_heater"],
|
||||||
"Flat roof or sloping ceiling insulation": ["flat_roof_insulation"],
|
"Flat roof or sloping ceiling insulation": ["flat_roof_insulation"],
|
||||||
"Heating controls (room thermostat)": [
|
"Heating controls (room thermostat)": [
|
||||||
"roomstat_programmer_trvs", "time_temperature_zone_control"
|
"roomstat_programmer_trvs", "time_temperature_zone_control"
|
||||||
|
|
@ -291,7 +291,7 @@ class RetrieveFindMyEpc:
|
||||||
"PV Cells recommendation": [],
|
"PV Cells recommendation": [],
|
||||||
"Replacement glazing units": ["double_glazing"],
|
"Replacement glazing units": ["double_glazing"],
|
||||||
"Heating controls (time and temperature zone control)": ["time_temperature_zone_control"],
|
"Heating controls (time and temperature zone control)": ["time_temperature_zone_control"],
|
||||||
"High heat retention storage heaters": ["high_heat_retention_storage_heaters"],
|
"High heat retention storage heaters": ["high_heat_retention_storage_heater"],
|
||||||
"Gas condensing boiler": ["boiler_upgrade"],
|
"Gas condensing boiler": ["boiler_upgrade"],
|
||||||
"Change room heaters to condensing boiler": ["boiler_upgrade"],
|
"Change room heaters to condensing boiler": ["boiler_upgrade"],
|
||||||
"Cylinder thermostat": ["cylinder_thermostat"],
|
"Cylinder thermostat": ["cylinder_thermostat"],
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import re
|
import re
|
||||||
import backend.app.assumptions as assumptions
|
import backend.app.assumptions as assumptions
|
||||||
from etl.customers.immo.pilot.asset_list import non_invasive_recommendations
|
|
||||||
from recommendations.Costs import Costs, BOILER_UPGRADE_SCHEME_ASHP_VALUE
|
from recommendations.Costs import Costs, BOILER_UPGRADE_SCHEME_ASHP_VALUE
|
||||||
from recommendations.recommendation_utils import (
|
from recommendations.recommendation_utils import (
|
||||||
check_simulation_difference, override_costs, combine_recommendation_configs
|
check_simulation_difference, override_costs, combine_recommendation_configs
|
||||||
|
|
@ -632,7 +631,8 @@ class HeatingRecommender:
|
||||||
heating_controls_only,
|
heating_controls_only,
|
||||||
system_change,
|
system_change,
|
||||||
system_type,
|
system_type,
|
||||||
measure_type
|
measure_type,
|
||||||
|
non_intrusive_recommendation=None
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Given a recommendation for heating controls, and a recommendation for the heating system, we combine the two
|
Given a recommendation for heating controls, and a recommendation for the heating system, we combine the two
|
||||||
|
|
@ -650,8 +650,13 @@ class HeatingRecommender:
|
||||||
:param system_type: The type of heating system we are recommending
|
:param system_type: The type of heating system we are recommending
|
||||||
:param measure_type: The type of measure we are recommending - more granular than the "type" field, allowing us
|
:param measure_type: The type of measure we are recommending - more granular than the "type" field, allowing us
|
||||||
to distinguish between different types of heating recommendations
|
to distinguish between different types of heating recommendations
|
||||||
|
:param non_intrusive_recommendation: A non-intrusive recommendation, which may specify the number of SAP points
|
||||||
|
or a cost for this recommendation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if non_intrusive_recommendation is None:
|
||||||
|
non_intrusive_recommendation = {}
|
||||||
|
|
||||||
# We produce recommendations with & without heating controls
|
# We produce recommendations with & without heating controls
|
||||||
# We will also produce a recommendation for heating controls only
|
# We will also produce a recommendation for heating controls only
|
||||||
heating_controls_switch = [True, False] if controls_recommendations else [False]
|
heating_controls_switch = [True, False] if controls_recommendations else [False]
|
||||||
|
|
@ -699,13 +704,14 @@ class HeatingRecommender:
|
||||||
"description": recommendation_description,
|
"description": recommendation_description,
|
||||||
"starting_u_value": None,
|
"starting_u_value": None,
|
||||||
"new_u_value": None,
|
"new_u_value": None,
|
||||||
"sap_points": None,
|
"sap_points": non_intrusive_recommendation.get("sap_points"),
|
||||||
"already_installed": already_installed,
|
"already_installed": already_installed,
|
||||||
**total_costs,
|
**total_costs,
|
||||||
"simulation_config": recommendation_simulation_config,
|
"simulation_config": recommendation_simulation_config,
|
||||||
"description_simulation": recommendation_description_simulation,
|
"description_simulation": recommendation_description_simulation,
|
||||||
# We insert the heating system type here
|
# We insert the heating system type here
|
||||||
"system_type": system_type
|
"system_type": system_type,
|
||||||
|
"survey": non_intrusive_recommendation.get("survey", False)
|
||||||
}
|
}
|
||||||
|
|
||||||
output.append(recommendation)
|
output.append(recommendation)
|
||||||
|
|
@ -808,6 +814,13 @@ class HeatingRecommender:
|
||||||
# No recommendation needed
|
# No recommendation needed
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# We check if there is a high heat retention non-intrusive recommendation
|
||||||
|
non_intrusive_recommendation = next(
|
||||||
|
(r for r in self.property.non_invasive_recommendations if
|
||||||
|
r["type"] == "high_heat_retention_storage_heater"),
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
|
||||||
# We check if the property has dual heating in place with a boiler and storage heaters
|
# We check if the property has dual heating in place with a boiler and storage heaters
|
||||||
if self.dual_heating:
|
if self.dual_heating:
|
||||||
new_heating_description = self.DUAL_HEATING_DESCRIPTIONS[
|
new_heating_description = self.DUAL_HEATING_DESCRIPTIONS[
|
||||||
|
|
@ -896,7 +909,8 @@ class HeatingRecommender:
|
||||||
heating_controls_only=heating_controls_only,
|
heating_controls_only=heating_controls_only,
|
||||||
system_change=system_change,
|
system_change=system_change,
|
||||||
system_type="high_heat_retention_storage_heater",
|
system_type="high_heat_retention_storage_heater",
|
||||||
measure_type="high_heat_retention_storage_heater"
|
measure_type="high_heat_retention_storage_heater",
|
||||||
|
non_intrusive_recommendation=non_intrusive_recommendation
|
||||||
)
|
)
|
||||||
if _return:
|
if _return:
|
||||||
return recommendations
|
return recommendations
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue