tweaked solar ranking algorithm

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-29 14:56:17 +01:00
parent 87de0ce3c9
commit eec453670c
3 changed files with 14 additions and 4 deletions

View file

@ -311,12 +311,19 @@ class GoogleSolarApi:
)
# Now that we know the lifetime cnsumption of ac kwh, we can estimate the roi
# Key things we estimate:
# - generation_value: this is the gbp value of the electricity generated
# - roi: the return on investment, calcualated as generation_value / total_cost
# - surplus: this is the amount of additional energy generated, and therefore how much will be exported
# - surplus_value: the value of the surplus energy - this feeds into generation_value, when relevant
# - expected_payback_years: the number of years it will take to pay back the initial investment
lifetime_energy_consumption = energy_consumption * self.installation_life_span
roi_results = []
for _, panel_config in panel_performance.iterrows():
lifetime_ac_kwh = panel_config["lifetime_ac_kwh"]
surplus = 0
generation_deficit = 0
if lifetime_ac_kwh < lifetime_energy_consumption:
# We estimate the amount of electricity generated, based on the price cap
generation_value = lifetime_ac_kwh * AnnualBillSavings.ELECTRICITY_PRICE_CAP
@ -329,7 +336,6 @@ class GoogleSolarApi:
surplus_value = surplus * AnnualBillSavings.ELECTRICITY_EXPORT_PAYMENT
generation_value = lifetime_energy_consumption * AnnualBillSavings.ELECTRICITY_PRICE_CAP
roi = (generation_value + surplus_value) / panel_config["total_cost"]
generation_deficit = surplus_value
# Calculate expected payback years
if generation_value > 0:

View file

@ -0,0 +1,3 @@
# Assumes that the average efficiency of an air source heat pump is 300%, taking the median of the 200-400% range,
# which is often quoted as a sensible efficiency range for air source heat pumps.
AVERAGE_ASHP_EFFICIENCY = 300

View file

@ -10,6 +10,7 @@ from sqlalchemy.exc import IntegrityError, OperationalError
from sqlalchemy.orm import sessionmaker
from starlette.responses import Response
import backend.app.assumptions as assumptions
from backend.app.config import get_settings, get_prediction_buckets
from backend.app.db.connection import db_engine
from backend.app.db.functions.materials_functions import get_materials
@ -440,7 +441,7 @@ async def trigger_plan(body: PlanTriggerRequest):
current_energy_efficiency=p.data["current-energy-efficiency"],
target_efficiency="C",
current_consumption=p.estimate_electrical_consumption(
assumed_ashp_efficiency=300, exclusions=body.exclusions
assumed_ashp_efficiency=assumptions.AVERAGE_ASHP_EFFICIENCY, exclusions=body.exclusions
)
),
"property_id": p.id,
@ -517,7 +518,7 @@ async def trigger_plan(body: PlanTriggerRequest):
# BUILDING IDS
electric_consumption = p.estimate_electrical_consumption(
assumed_ashp_efficiency=300, exclusions=body.exclusions
assumed_ashp_efficiency=assumptions.AVERAGE_ASHP_EFFICIENCY, exclusions=body.exclusions
)
# We now decrease this, based on the expected energy efficiency of the property post retrofit to a C,
@ -529,7 +530,7 @@ async def trigger_plan(body: PlanTriggerRequest):
current_consumption=electric_consumption
)
solar_performance = solar_api_client.get(
solar_api_client.get(
longitude=p.spatial["longitude"],
latitude=p.spatial["latitude"],
energy_consumption=electric_consumption,