diff --git a/tests/infrastructure/epc_client/test_sap_accuracy_corpus.py b/tests/infrastructure/epc_client/test_sap_accuracy_corpus.py index 496ddd31..cc57d28d 100644 --- a/tests/infrastructure/epc_client/test_sap_accuracy_corpus.py +++ b/tests/infrastructure/epc_client/test_sap_accuracy_corpus.py @@ -193,7 +193,7 @@ _CORPUS = Path( # within-0.5 71.6% -> 72.5%, MAE 0.819 -> 0.815. Surfaced by Khalim's Elmhurst # stress worksheet (simulated case 46): closed its last ventilation residual # (our Jan ACH 9.14 -> 9.0748 exact; SAP 29 -> 30 = accredited Elmhurst). -_MIN_WITHIN_HALF_SAP = 0.73 +_MIN_WITHIN_HALF_SAP = 0.74 # 0.793 -> 0.789 via the §12 Unknown-meter + dual-electric-immersion off-peak # trigger (RdSAP 10 PDF p.62): Apartment 241 (main 691 + 903 dual immersion) # -5.38 -> -1.05. Worksheet-validated on "simulated case 48" (Elmhurst SAP 57, @@ -238,7 +238,17 @@ _MIN_WITHIN_HALF_SAP = 0.73 # already computes 74. roof_insulation_location="ND" ⟺ party ceiling separates # the corpus classes with zero disagreement (all 190 party flats lodge "ND"); # the 4 mid/ground-floor flats this exposes all move toward lodged, 0 away. -_MAX_SAP_MAE = 0.762 +# Then 0.761 -> 0.740 (within-0.5 73.6% -> 74.1%) via the PV dwelling-meter +# connection gate (RdSAP 10 §11.1 / SAP 10.2 Appendix M): PV is credited to the +# dwelling only when gov-API `pv_connection == 2` ("connected to the dwelling's +# meter"); == 1 ("present but NOT connected" — communal / separately metered) +# now contributes zero to cost/CO2/PE. All 5 pv_connection=1 PV certs move +# inside ±0.5 (e.g. 100051118081 +6.5 -> +0.5); pv_connection=2 certs (52) keep +# their credit (corpus MAE 0.98 with vs 10.29 without). Khalim's Elmhurst proof: +# an identical dwelling rates SAP 87 with "Connected to Dwelling = Yes" (credit +# -£167) vs SAP 74 with "No" (credit £0). Enum decoded empirically: 0 = no PV, +# 1 = not connected, 2 = connected (the gov-API does not expose it elsewhere). +_MAX_SAP_MAE = 0.740 _MAX_CO2_MAE_TONNES = 0.09 # t CO2 / yr vs co2_emissions_current _MAX_PE_PER_M2_MAE = 3.5 # kWh / m2 / yr vs energy_consumption_current