diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index e76d4430..4796cd9f 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -434,9 +434,11 @@ async def trigger_plan(body: PlanTriggerRequest): "longitude": p.spatial["longitude"], "latitude": p.spatial["latitude"], # Energy consumption is adjusted for the property's expected post retrofit state + # We set the target rating to EPC C, which is the typical EPC rating we would expect the + # property to achieve post retrofit of just the fabric "energy_consumption": energy_consumption_client.estimate_new_consumption( current_rating=p.data["current-energy-rating"], - target_rating=body.goal_value, + target_rating="C", current_consumption=p.current_adjusted_energy ), "property_id": p.id, @@ -507,12 +509,42 @@ async def trigger_plan(body: PlanTriggerRequest): p.set_solar_panel_configuration(unit_solar_panel_configuration) else: - # # Model the solar potential at the property level - # for p in input_properties: - # # TODO: Complete me! - we probably won't do this for individual flats - # solar_performance = solar_api_client.get( - # longitude=p.spatial["longitude"], latitude=p.spatial["latitude"] - # ) + # Model the solar potential at the property level + for p in input_properties: + # TODO: Complete me! - we probably won't do this for individual flats - IGNORE FLATS FROM THIS WITHOUT + # BUILDING IDS + + # if the property is already very close to an EPC C, we don't adjust the energy consumption based on + # expected movement to EPC C. + # To extend this, what we could do is adjust the based on the expected movement from the current SAP + # rating to the target SAP rating (ie 69C) + # TODO: Update this! + energy_consumption = energy_consumption_client.estimate_new_consumption( + current_rating=p.data["current-energy-rating"], + target_rating="C", + current_consumption=p.current_adjusted_energy + ) + + # TODO: Should energy_consumption to adjusted to just electricity requirement? + # We should align our calculation of required energy consumption with expectations around decarbonising + # heating and hot water, so worse case we should take just the electrical consumption of the property + # if the property is current using gas for heating and hot water, then we should adjust the kwh demand + # to reflect the 200-400% efficiency of an ASHP with electrified heating, so that the solar panel can + # cover heating generation. While + # If the main fuel is electricity (not community) then we don't need to change the kwh demand, if it's + # gas we should adjust on the suitability of an ashp! + + solar_performance = solar_api_client.get( + longitude=p.spatial["longitude"], + latitude=p.spatial["latitude"], + energy_consumption=energy_consumption, + is_building=False, + session=session, + uprn=p.uprn + ) + + # TODO: Insert the pitched roof area into the property class as we store the solar performance + # in the property class print("Implement me") # TODO: We can set the pitched roof area based on the results of the solar api!