handling bug when no recommendations for a property

This commit is contained in:
Khalim Conn-Kowlessar 2024-08-13 14:30:17 +01:00
parent e7ab28bd17
commit 5696b03b8c
5 changed files with 9 additions and 8 deletions

View file

@ -17,10 +17,6 @@ logger = setup_logger()
class GoogleSolarApi:
NORTH_FACING_AZIMUTH_RANGE = (-30, 30)
# Conservative estimate of the proportion of electricity that will be consumed, whereas the rest will
# be exported
SOLAR_CONSUMPTION_PROPORTION = 0.5
# These are variables, described in the documentation for cost analysis for non-us locations, seen here
# https://developers.google.com/maps/documentation/solar/calculate-costs-non-us
# We use the default figures that the API uses for US locations

View file

@ -2,3 +2,7 @@
# which is often quoted as a sensible efficiency range for air source heat pumps.
PESSIMISTIC_ASHPY_EFFICIENCY = 200
AVERAGE_ASHP_EFFICIENCY = 300
# Conservative estimate of the proportion of electricity that will be consumed, whereas the rest will
# be exported
SOLAR_CONSUMPTION_PROPORTION = 0.5

View file

@ -655,7 +655,7 @@ async def trigger_plan(body: PlanTriggerRequest):
roof_area=solar_api_client.roof_area
)
logger.info("Getting components and epc recommendations")
logger.info("Identifying property recommendations")
recommendations = {}
recommendations_scoring_data = []
representative_recommendations = {}
@ -742,7 +742,7 @@ async def trigger_plan(body: PlanTriggerRequest):
# cylinder jacket), we should add these to the recommendations as default
for p in input_properties:
if not recommendations[p.id]:
if not recommendations.get(p.id):
continue
input_measures = prepare_input_measures(recommendations[p.id], body.goal)

View file

@ -1,6 +1,6 @@
import numpy as np
import pandas as pd
from backend.apis.GoogleSolarApi import GoogleSolarApi
import backend.app.assumptions as assumptions
QUARTERLY_ENERGY_PRICES = [
# 2024 Q1
@ -283,7 +283,7 @@ class AnnualBillSavings:
if fuel == "Natural Gas + Solar Thermal":
# The solar thermal covers a % of the heating kwh, so we need to adjust the cost
return (kwh / cop) * GoogleSolarApi.SOLAR_CONSUMPTION_PROPORTION * cls.GAS_PRICE_CAP
return (kwh / cop) * assumptions.SOLAR_CONSUMPTION_PROPORTION * cls.GAS_PRICE_CAP
if fuel == "Oil":
price_data = cls.FUEL_DATA[cls.FUEL_DATA["Fuel"] == "Kerosene"].squeeze()

View file

@ -39,6 +39,7 @@ DESCRIPTIONS_TO_FUEL_TYPES = {
"No system present: electric heaters assumed": {"fuel": "Electricity", "cop": 1},
"Electric instantaneous at point of use": {"fuel": "Electricity", "cop": 1},
"Boiler and radiators, oil": {"fuel": "Oil", "cop": 0.9},
"Electric storage heaters, Electric storage heaters": {"fuel": "Electricity", "cop": 1},
}
STARTING_DUMMY_ID_VALUE = -9999