small tweaks to fill missing data in ventilation recs and percentage in solar description

This commit is contained in:
Khalim Conn-Kowlessar 2024-02-16 15:18:09 +00:00
parent 1f0dea980f
commit 132bf98eeb
5 changed files with 14 additions and 12 deletions

View file

@ -220,7 +220,7 @@ async def trigger_plan(body: PlanTriggerRequest):
selected_recommendations = {r["id"] for r in solution}
# If wall ventilation is selected, we also include mechanical ventilation as a best practice measure
# If wall insulation is selected, we also include mechanical ventilation as a best practice measure
if any(x in [r["type"] for r in solution] for x in [
"internal_wall_insulation", "external_wall_insulation", "cavity_wall_insulation"
]):

View file

@ -860,12 +860,12 @@ class Costs:
kw = wattage / 1000
total_cost = kw * regional_cost
subtotal_before_vat = total_cost / (1 + self.VAT_RATE)
if has_battery:
# The battery cost is based on the £3500 quote, recieved from installers
subtotal_before_vat += BATTERY_COST
total_cost += BATTERY_COST
subtotal_before_vat = total_cost / (1 + self.VAT_RATE)
vat = total_cost - subtotal_before_vat
# Labour hours are based on estimates from online research but an average team seems to consist of 3 people

View file

@ -215,8 +215,6 @@ class Recommendations:
heat_phase_impact = property_heat_predictions.groupby("phase")["predictions"].median().reset_index()
carbon_phase_impact = property_carbon_predictions.groupby("phase")["predictions"].median().reset_index()
## TODO: NEW
# The heat demand change is the difference between the starting heat demand and the value at the final phase
expected_heat_demand = property_instance.floor_area * (
heat_phase_impact[heat_phase_impact["phase"] == max(heat_phase_impact["phase"])]["predictions"].values[0]
@ -305,13 +303,13 @@ class Recommendations:
rec["heat_demand"] / predicted_heat_demand_change
)
# We make sure this is NOT below 0
rec["adjusted_heat_demand"] = max(0, rec["heat_demand"])
rec["adjusted_heat_demand"] = max(0, rec["adjusted_heat_demand"])
# Depending on the property's tarriff, we calculate the amount of energy savings this measure will bring
if property_instance.energy_source == "electricity":
rec["energy_cost_savings"] = AnnualBillSavings.estimate_electric(rec["heat_demand"])
rec["energy_cost_savings"] = AnnualBillSavings.estimate_electric(rec["adjusted_heat_demand"])
elif property_instance.energy_source == "electricity_and_gas":
rec["energy_cost_savings"] = AnnualBillSavings.estimate(rec["heat_demand"])
rec["energy_cost_savings"] = AnnualBillSavings.estimate(rec["adjusted_heat_demand"])
else:
raise ValueError("Invalid value for energy source")

View file

@ -70,10 +70,10 @@ class SolarPvRecommendations:
if has_battery:
description = (f"Install a {kw} kilowatt-peak (kWp) solar photovoltaic (PV) panel system on "
f"{round(roof_coverage_percent * 100)}% the roof, with a battery storage system.")
f"{round(roof_coverage_percent)}% the roof, with a battery storage system.")
else:
description = (f"Install a {kw} kilowatt-peak (kWp) solar photovoltaic (PV) p"
f"anel system on {round(roof_coverage_percent * 100)}% the roof.")
f"anel system on {round(roof_coverage_percent)}% the roof.")
self.recommendation.append(
{

View file

@ -66,6 +66,10 @@ class VentilationRecommendations(Definitions):
"starting_u_value": None,
"new_u_value": None,
"sap_points": 0,
"heat_demand": 0,
"adjusted_heat_demand": 0,
"co2_equivalent_savings": 0,
"energy_cost_savings": 0,
"total": estimated_cost,
# We use a very simple and rough estimate of 4 hours per unit
"labour_hours": 4 * n_units,