debugging issue where properties start from EPC C

This commit is contained in:
Khalim Conn-Kowlessar 2025-08-26 13:25:55 +01:00
parent 65b32592f3
commit 2609ddc8e2
2 changed files with 15 additions and 1 deletions

View file

@ -323,7 +323,9 @@ class Funding:
def _calculate_full_project_abs(self, floor_area_band: str, starting_sap_band: str, ending_sap_band: str):
if starting_sap_band == ending_sap_band:
if (starting_sap_band == ending_sap_band) or (
starting_sap_band in ["Low_C", "High_C", "Low_B", "High_B", "Low_A", "High_A"]
):
return 0
data = self.project_scores_matrix[
@ -584,6 +586,11 @@ class Funding:
return pps.squeeze()["Cost Savings"]
if measure_type == "suspended_floor_insulation":
if self.starting_sap_band in ["Low_C", "High_C", "Low_B", "High_B", "Low_A", "High_A"]:
# We don't fund SFI for properties starting at C or above
return 0
pps = filtered_pps_matrix[filtered_pps_matrix["Measure_Type"] == "UFI"]
if pps.shape[0] != 1:
raise ValueError("Invalid UFI category")

View file

@ -417,6 +417,13 @@ def optimise_with_funding_paths(p, input_measures, housing_type, funding: Fundin
axis=1
)
for _, x in solutions.iterrows():
funding._calculate_full_project_abs(
floor_area_band=x["floor_area_band"],
starting_sap_band=x["starting_band"],
ending_sap_band=x["ending_band"],
)
rate = funding.get_eco4_abs_rate(is_cavity=p.walls["is_cavity_wall"])
solutions["full_project_funding"] = solutions["project_score"] * rate
# if the scheme is not ECO4, we set the funding to 0 with iloc