mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
adding measure type for wall and roof insulation
This commit is contained in:
parent
2a75a6db17
commit
1f1bf9981c
6 changed files with 35 additions and 18 deletions
|
|
@ -621,7 +621,7 @@ class Property:
|
||||||
self.set_windows_count()
|
self.set_windows_count()
|
||||||
self.set_energy_source()
|
self.set_energy_source()
|
||||||
self.find_energy_sources()
|
self.find_energy_sources()
|
||||||
self.set_current_energy_bill(kwh_client, kwh_predictions)
|
self.set_current_energy(kwh_client, kwh_predictions)
|
||||||
|
|
||||||
def set_solar_panel_configuration(
|
def set_solar_panel_configuration(
|
||||||
self, solar_panel_configuration, roof_area
|
self, solar_panel_configuration, roof_area
|
||||||
|
|
@ -651,7 +651,7 @@ class Property:
|
||||||
else:
|
else:
|
||||||
self.roof_area = roof_area
|
self.roof_area = roof_area
|
||||||
|
|
||||||
def set_current_energy_bill(self, kwh_client, kwh_predictions):
|
def set_current_energy(self, kwh_client, kwh_predictions):
|
||||||
"""
|
"""
|
||||||
Given what we know about the property now, estimates the current energy consumption using the UCL paper
|
Given what we know about the property now, estimates the current energy consumption using the UCL paper
|
||||||
https://www.sciencedirect.com/science/article/pii/S0378778823002542
|
https://www.sciencedirect.com/science/article/pii/S0378778823002542
|
||||||
|
|
@ -808,6 +808,9 @@ class Property:
|
||||||
|
|
||||||
def get_property_details_epc(self, portfolio_id: int, rating_lookup):
|
def get_property_details_epc(self, portfolio_id: int, rating_lookup):
|
||||||
|
|
||||||
|
if self.current_energy_bill is None:
|
||||||
|
raise ValueError("Current energy bill has not been set")
|
||||||
|
|
||||||
property_details_epc = {
|
property_details_epc = {
|
||||||
"property_id": self.id,
|
"property_id": self.id,
|
||||||
"portfolio_id": portfolio_id,
|
"portfolio_id": portfolio_id,
|
||||||
|
|
@ -865,6 +868,7 @@ class Property:
|
||||||
"current_energy_demand": self.current_energy_consumption,
|
"current_energy_demand": self.current_energy_consumption,
|
||||||
"current_energy_demand_heating_hotwater": self.current_energy_consumption_heating_hotwater,
|
"current_energy_demand_heating_hotwater": self.current_energy_consumption_heating_hotwater,
|
||||||
"estimated": self.data.get("estimated", False),
|
"estimated": self.data.get("estimated", False),
|
||||||
|
**self.current_energy_bill
|
||||||
}
|
}
|
||||||
|
|
||||||
return property_details_epc
|
return property_details_epc
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,13 @@ class PropertyDetailsEpcModel(Base):
|
||||||
current_energy_demand = Column(Float)
|
current_energy_demand = Column(Float)
|
||||||
current_energy_demand_heating_hotwater = Column(Float)
|
current_energy_demand_heating_hotwater = Column(Float)
|
||||||
estimated = Column(Boolean, default=False)
|
estimated = Column(Boolean, default=False)
|
||||||
|
# Include estimates for energy bills, across the different types of energy
|
||||||
|
heating_cost_current = Column(Float)
|
||||||
|
hot_water_cost_current = Column(Float)
|
||||||
|
lighting_cost_current = Column(Float)
|
||||||
|
appliances_cost_current = Column(Float)
|
||||||
|
gas_standing_charge = Column(Float)
|
||||||
|
electricity_standing_charge = Column(Float)
|
||||||
|
|
||||||
|
|
||||||
class PropertyDetailsSpatial(Base):
|
class PropertyDetailsSpatial(Base):
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ from sqlalchemy.exc import IntegrityError, OperationalError
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from starlette.responses import Response
|
from starlette.responses import Response
|
||||||
|
|
||||||
import backend.app.assumptions as assumptions
|
|
||||||
from backend.app.config import get_settings, get_prediction_buckets
|
from backend.app.config import get_settings, get_prediction_buckets
|
||||||
from backend.app.db.connection import db_engine
|
from backend.app.db.connection import db_engine
|
||||||
from backend.app.db.functions.materials_functions import get_materials
|
from backend.app.db.functions.materials_functions import get_materials
|
||||||
|
|
@ -614,10 +613,12 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
property_recommendations = recommendations.get(property_id, [])
|
property_recommendations = recommendations.get(property_id, [])
|
||||||
property_instance = [p for p in input_properties if p.id == property_id][0]
|
property_instance = [p for p in input_properties if p.id == property_id][0]
|
||||||
|
|
||||||
property_current_energy_bill = Recommendations.calculate_recommendation_tenant_savings(
|
property_current_energy_bill = (
|
||||||
property_instance=property_instance,
|
Recommendations.calculate_recommendation_tenant_savings(
|
||||||
kwh_simulation_predictions=kwh_simulation_predictions,
|
property_instance=property_instance,
|
||||||
property_recommendations=property_recommendations
|
kwh_simulation_predictions=kwh_simulation_predictions,
|
||||||
|
property_recommendations=property_recommendations
|
||||||
|
)
|
||||||
)
|
)
|
||||||
property_instance.current_energy_bill = property_current_energy_bill
|
property_instance.current_energy_bill = property_current_energy_bill
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -797,13 +797,14 @@ class Recommendations:
|
||||||
|
|
||||||
electricity_standing_charge = AnnualBillSavings.DAILY_STANDARD_CHARGE_ELECTRICITY * 365
|
electricity_standing_charge = AnnualBillSavings.DAILY_STANDARD_CHARGE_ELECTRICITY * 365
|
||||||
|
|
||||||
current_energy_bill = (
|
# We return a dictionary that contains the individual costs, that can be stored to the database
|
||||||
starting_figures["heating_cost"] +
|
current_energy_bill = {
|
||||||
starting_figures["hotwater_cost"] +
|
"heating_cost_current": starting_figures["heating_cost"],
|
||||||
property_instance.energy_cost_estimates["unadjusted"]["lighting"] +
|
"hot_water_cost_current": starting_figures["hotwater_cost"],
|
||||||
property_instance.energy_cost_estimates["unadjusted"]["appliances"] +
|
"lighting_cost_current": property_instance.energy_cost_estimates["unadjusted"]["lighting"],
|
||||||
gas_standing_charge +
|
"appliances_cost_current": property_instance.energy_cost_estimates["unadjusted"]["appliances"],
|
||||||
electricity_standing_charge
|
"gas_standing_charge": gas_standing_charge,
|
||||||
)
|
"electricity_standing_charge": electricity_standing_charge,
|
||||||
|
}
|
||||||
|
|
||||||
return current_energy_bill
|
return current_energy_bill
|
||||||
|
|
|
||||||
|
|
@ -250,8 +250,10 @@ class RoofRecommendations:
|
||||||
|
|
||||||
if is_pitched:
|
if is_pitched:
|
||||||
insulation_materials = self.loft_insulation_materials
|
insulation_materials = self.loft_insulation_materials
|
||||||
|
measure_type = "loft_insulation"
|
||||||
elif is_flat:
|
elif is_flat:
|
||||||
insulation_materials = self.flat_roof_insulation_materials
|
insulation_materials = self.flat_roof_insulation_materials
|
||||||
|
measure_type = "flat_roof_insulation"
|
||||||
else:
|
else:
|
||||||
raise ValueError("Roof is not pitched or flat")
|
raise ValueError("Roof is not pitched or flat")
|
||||||
|
|
||||||
|
|
@ -367,6 +369,7 @@ class RoofRecommendations:
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
"type": material["type"],
|
"type": material["type"],
|
||||||
|
"measure_type": measure_type,
|
||||||
"description": self.make_roof_insulation_description(material),
|
"description": self.make_roof_insulation_description(material),
|
||||||
"starting_u_value": u_value,
|
"starting_u_value": u_value,
|
||||||
"new_u_value": new_u_value,
|
"new_u_value": new_u_value,
|
||||||
|
|
@ -490,10 +493,9 @@ class RoofRecommendations:
|
||||||
recommendations.append(
|
recommendations.append(
|
||||||
{
|
{
|
||||||
"phase": phase,
|
"phase": phase,
|
||||||
"parts": [
|
"parts": [],
|
||||||
# TODO
|
|
||||||
],
|
|
||||||
"type": "room_roof_insulation",
|
"type": "room_roof_insulation",
|
||||||
|
"measure_type": "room_roof_insulation",
|
||||||
"description": "Insulate room in roof at rafters and re-decorate",
|
"description": "Insulate room in roof at rafters and re-decorate",
|
||||||
"starting_u_value": u_value,
|
"starting_u_value": u_value,
|
||||||
"new_u_value": new_u_value,
|
"new_u_value": new_u_value,
|
||||||
|
|
|
||||||
|
|
@ -374,6 +374,7 @@ class WallRecommendations(Definitions):
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
"type": "cavity_wall_insulation",
|
"type": "cavity_wall_insulation",
|
||||||
|
"measure_type": "cavity_wall_insulation",
|
||||||
"description": description,
|
"description": description,
|
||||||
"starting_u_value": u_value,
|
"starting_u_value": u_value,
|
||||||
"new_u_value": new_u_value,
|
"new_u_value": new_u_value,
|
||||||
|
|
@ -545,6 +546,7 @@ class WallRecommendations(Definitions):
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
"type": material["type"],
|
"type": material["type"],
|
||||||
|
"measure_type": material["type"], # This is distinguished between EWI & IWI
|
||||||
"description": self._make_description(material),
|
"description": self._make_description(material),
|
||||||
"starting_u_value": u_value,
|
"starting_u_value": u_value,
|
||||||
"new_u_value": new_u_value,
|
"new_u_value": new_u_value,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue