mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Merge pull request #484 from Hestia-Homes/main
fixing funding paths bugs and solar description error
This commit is contained in:
commit
3d2cf071fe
2 changed files with 17 additions and 11 deletions
|
|
@ -264,7 +264,7 @@ class SolarPvRecommendations:
|
||||||
scaffolding_options=self.scaffolding_options,
|
scaffolding_options=self.scaffolding_options,
|
||||||
n_floors=self.property.number_of_floors
|
n_floors=self.property.number_of_floors
|
||||||
)
|
)
|
||||||
description = solar_pv_product['description']
|
description = f"{solar_pv_product['description']} - {solar_pv_product['size']} kWp system"
|
||||||
|
|
||||||
if self.property.in_conservation_area:
|
if self.property.in_conservation_area:
|
||||||
description += " Property is in a consevation area - please check with local planning authority."
|
description += " Property is in a consevation area - please check with local planning authority."
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ from backend.Funding import Funding
|
||||||
logger = setup_logger()
|
logger = setup_logger()
|
||||||
|
|
||||||
# measures we DO NOT treat as fundable in the ECO4 'funded' pass
|
# measures we DO NOT treat as fundable in the ECO4 'funded' pass
|
||||||
_ECO4_EXCLUDE_TYPES = {"secondary_heating"}
|
_ECO4_EXCLUDE_TYPES = {"secondary_heating", "extension_cavity_wall_insulation", "sealing_open_fireplace"}
|
||||||
|
|
||||||
|
|
||||||
def _path_scheme(path_spec):
|
def _path_scheme(path_spec):
|
||||||
|
|
@ -314,11 +314,17 @@ def optimise_with_funding_paths(p, input_measures, housing_type, funding: Fundin
|
||||||
# 4) run your existing optimiser for the remaining groups
|
# 4) run your existing optimiser for the remaining groups
|
||||||
# If we have a budget, we need to ensure the subproblem respects it so we remove the fixed cost (which
|
# If we have a budget, we need to ensure the subproblem respects it so we remove the fixed cost (which
|
||||||
# may already be over budget) and the fixed gain (which may not be achievable)
|
# may already be over budget) and the fixed gain (which may not be achievable)
|
||||||
picked, sub_cost, sub_gain = run_optimizer(
|
|
||||||
sub_measures,
|
if fixed_gain > target_gain:
|
||||||
budget - fixed_cost if budget is not None else None,
|
picked, sub_cost, sub_gain = ([], 0.0, 0.0)
|
||||||
sub_target_gain=target_gain - fixed_gain if target_gain is not None else None
|
elif fixed_gain < target_gain and not sub_measures:
|
||||||
)
|
picked, sub_cost, sub_gain = ([], 0.0, 0.0)
|
||||||
|
else:
|
||||||
|
picked, sub_cost, sub_gain = run_optimizer(
|
||||||
|
sub_measures,
|
||||||
|
budget - fixed_cost if budget is not None else None,
|
||||||
|
sub_target_gain=target_gain - fixed_gain if target_gain is not None else None
|
||||||
|
)
|
||||||
|
|
||||||
if picked is None:
|
if picked is None:
|
||||||
continue
|
continue
|
||||||
|
|
@ -346,14 +352,14 @@ def optimise_with_funding_paths(p, input_measures, housing_type, funding: Fundin
|
||||||
# We find the indexes of the picked types
|
# We find the indexes of the picked types
|
||||||
picked_group_index = {}
|
picked_group_index = {}
|
||||||
for pt in picked_types:
|
for pt in picked_types:
|
||||||
for gi, grp in enumerate(optimisation_input_measures):
|
for gi, grp in enumerate(input_measures):
|
||||||
if any(pt in opt["type"] for opt in grp):
|
if any(pt in opt["type"] for opt in grp):
|
||||||
picked_group_index[pt] = gi
|
picked_group_index[pt] = gi
|
||||||
break
|
break
|
||||||
# We get the remaining types
|
# We get the remaining types
|
||||||
# ECO4 case
|
# ECO4 case
|
||||||
remaining = []
|
remaining = []
|
||||||
for i, grp in enumerate(optimisation_input_measures):
|
for i, grp in enumerate(input_measures):
|
||||||
if i in picked_group_index.values():
|
if i in picked_group_index.values():
|
||||||
continue
|
continue
|
||||||
keep = [x for x in grp if x["type"] not in picked_types]
|
keep = [x for x in grp if x["type"] not in picked_types]
|
||||||
|
|
@ -677,8 +683,8 @@ def _make_solar_heating_funding_paths(
|
||||||
# Solar PV with existing eligible heating system
|
# Solar PV with existing eligible heating system
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
has_eligible_heating_system = funding.check_solar_eligible_heating_system(
|
has_eligible_heating_system = funding.check_solar_eligible_heating_system(
|
||||||
mainheat_description=p.main_heating["clean_description"],
|
mainheat_description=p.main_heating["clean_description"].lower(),
|
||||||
heating_control_description=p.main_heating_controls["clean_description"]
|
heating_control_description=p.main_heating_controls["clean_description"].lower()
|
||||||
)
|
)
|
||||||
|
|
||||||
if has_eligible_heating_system and _find_measure(input_measures, "solar_pv"):
|
if has_eligible_heating_system and _find_measure(input_measures, "solar_pv"):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue