debugging funding paths

This commit is contained in:
Khalim Conn-Kowlessar 2025-08-12 21:43:49 +01:00
parent 00f4b41907
commit e3066fbd76

View file

@ -503,12 +503,14 @@ def _make_generic_eco4_funding_paths(p, input_measures, funding_paths, remaining
) )
if has_eligible_heating_system: if has_eligible_heating_system:
single_solar_template = [{"AND": ["solar_pv"], "reference": "solar_pv"}] single_solar_template = [{"AND": ["solar_pv"], "reference": None}]
# We now look to pair this with any lingering insulation measures # We now look to pair this with any lingering insulation measures
solar_paths = [] solar_paths = []
for insulation_measure in remaining_insulation_type: for insulation_measure in remaining_insulation_type:
new_solar_path = deepcopy(single_solar_template) new_solar_path = deepcopy(single_solar_template)
new_solar_path[0]["AND"].append(insulation_measure) new_solar_path[0]["AND"].append(insulation_measure)
# Make a specific reference for this path
new_solar_path[0]["reference"] = "solar_pv+" + insulation_measure + ":eco4"
solar_paths.append(new_solar_path) solar_paths.append(new_solar_path)
if solar_paths: if solar_paths:
@ -523,21 +525,21 @@ def _make_generic_eco4_funding_paths(p, input_measures, funding_paths, remaining
if (_find_measure(input_measures, "solar_pv") and if (_find_measure(input_measures, "solar_pv") and
_find_measure(input_measures, "high_heat_retention_storage_heater")): _find_measure(input_measures, "high_heat_retention_storage_heater")):
funding_paths.append( funding_paths.append(
[{"AND": ["solar_pv", "high_heat_retention_storage_heater"], "reference": "solar_pv+hhrsh"}] [{"AND": ["solar_pv", "high_heat_retention_storage_heater"], "reference": "solar_pv+hhrsh:eco4"}]
) )
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Solar PV + ASHP # Solar PV + ASHP
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (_find_measure(input_measures, "solar_pv") and if (_find_measure(input_measures, "solar_pv") and
_find_measure(input_measures, "air_source_heat_pump")): _find_measure(input_measures, "air_source_heat_pump")):
funding_paths.append([{"AND": ["solar_pv", "air_source_heat_pump"]}]) funding_paths.append([{"AND": ["solar_pv", "air_source_heat_pump"], "reference": "solar_pv+ashp:eco4"}])
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Solar PV + Electric Boiler # Solar PV + Electric Boiler
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (_find_measure(input_measures, "solar_pv") and if (_find_measure(input_measures, "solar_pv") and
_find_measure(input_measures, "electric_boiler")): _find_measure(input_measures, "electric_boiler")):
funding_paths.append([{"AND": ["solar_pv", "electric_boiler"]}]) funding_paths.append([{"AND": ["solar_pv", "electric_boiler"], "reference": "solar_pv+electric_boiler:eco4"}])
# We've actually covered all possible options where solar PV can be included in a funded package, so where # We've actually covered all possible options where solar PV can be included in a funded package, so where
# solar PV is not in a reference, we can exclude it # solar PV is not in a reference, we can exclude it
@ -553,22 +555,29 @@ def _make_generic_eco4_funding_paths(p, input_measures, funding_paths, remaining
"air_source_heat_pump": "ashp" "air_source_heat_pump": "ashp"
} }
for heating_upgrade in ["boiler_upgrade", "high_heat_retention_storage_heater", "air_source_heat_pump"]: for heating_upgrade in ["boiler_upgrade", "high_heat_retention_storage_heater", "air_source_heat_pump"]:
if _find_measure(input_measures, ""): if _find_measure(input_measures, heating_upgrade):
# We check if we have any remaining insulation measures to be applied to the property # We check if we have any remaining insulation measures to be applied to the property
if remaining_insulation_type: if remaining_insulation_type:
hhrsh_template = [ hhrsh_template = [
{"AND": [heating_upgrade], "reference": measure_references[heating_upgrade]} {"AND": [heating_upgrade], "reference": None}
] ]
hhrsh_paths = [] hhrsh_paths = []
for insulation_measure in remaining_insulation_type: for insulation_measure in remaining_insulation_type:
new_hhrsh_path = deepcopy(hhrsh_template) new_hhrsh_path = deepcopy(hhrsh_template)
new_hhrsh_path[0]["AND"].append(insulation_measure) new_hhrsh_path[0]["AND"].append(insulation_measure)
# Make a specific reference for this path
new_hhrsh_path[0]["reference"] = (
measure_references[heating_upgrade] + "+" + insulation_measure + ":eco4"
)
hhrsh_paths.append(new_hhrsh_path) hhrsh_paths.append(new_hhrsh_path)
funding_paths.extend(hhrsh_paths) funding_paths.extend(hhrsh_paths)
else: else:
# If we have no insulation measures, we just add the HHRSH path # If we have no insulation measures, we just add the HHRSH path
funding_paths.append([{"AND": [measure_references[heating_upgrade]]}]) funding_paths.append(
[{"AND": [heating_upgrade],
"reference": measure_references[heating_upgrade] + ":eco4"}]
)
return funding_paths return funding_paths