mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Cert 000565 surfaced the spec gap. Worksheet shows "Electricity
Tariff: 10 Hour Off Peak" while the Summary PDF only lodges
"Electricity meter type: Dual" — no separate tariff-hour field is
exported. Elmhurst SAP picks 10-hour because RdSAP 10 §12 page 62
contains a published inference algorithm:
> If the meter is dual 18-hour/24-hour it is 18-hour/24-hour tariff.
> Otherwise the choice between 7-hour and 10-hour is determined as
> follows.
> 1. If the main heating system (or main system if there are two)
> is an electric CPSU (192) it is 10-hour tariff.
> 2. Otherwise, if … electric storage heaters (401 to 409), or
> electric dry core or water storage boiler (193 or 195), or
> electric underfloor heating (421 or 422) — it is 7-hour tariff.
> 3. If that has not resolved it then if … direct-acting electric
> boiler (191), or heat pump (211 to 224, 521 to 524, or
> database), or electric room heaters — it is 10-hour tariff.
> 4. If none of the above applies it is 7-hour tariff.
Cert 000565 Main 1 SAP code 224 (ASHP) + Dual meter → Rule 3 →
10-hour. Matches the worksheet exactly.
New `rdsap_tariff_for_cert(meter_type, main_1_sap_code=...,
main_2_sap_code=..., main_1_is_heat_pump_database=...,
main_2_is_heat_pump_database=...)` implements the dispatch.
"or database" branch covers PCDB Table 362 heat-pump lodgements per
the spec's "or database" wording. Callers compute the boolean via
`heat_pump_record(main_heating_index_number) is not None`.
The pre-existing `tariff_from_meter_type(meter_type)` keeps its
contract for legacy call sites — returns SEVEN_HOUR as the Dual
default (the §12 Rule 4 fallback). Docstring updated to point at the
new helper for callers that need spec-correct dispatch.
Code sets (verbatim §12 page 62):
- `_RULE_1_CPSU_CODES` = {192}
- `_RULE_2_STORAGE_CODES` = {401..409, 193, 195, 421, 422} (NOT 423/424/425)
- `_RULE_3_TEN_HOUR_CODES` = {191, 211..224, 521..524}
- electric room heater codes (Table 4a 6xx) deferred with TODO until a
fixture surfaces them — Rule 4 fallback is correct in the interim
(electric room heater certs would currently get 7-hour, biasing
their cost residual; not on the active fixture front).
This commit is the FOUNDATIONAL change — no cost helpers are wired
to the new dispatch yet, so cohort/golden tests are unchanged
(354 pass + 10 expected 000565 fails). The next slice wires
`_space_heating_fuel_cost_gbp_per_kwh` / `_hot_water_fuel_cost_gbp_
per_kwh` / `_other_fuel_cost_gbp_per_kwh` to use the new dispatch +
Table 12a high-rate fractions for off-peak certs.
Spec source: `domain/sap10_calculator/docs/specs/RdSAP 10
Specification 10-06-2025.pdf` §12 page 62. Verified verbatim per
[[feedback-verify-handover-claims]] before implementing.
Pyright net-zero (0 / 0).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| addresses | ||
| data_transformation | ||
| epc | ||
| sap10_calculator | ||
| sap10_ml | ||
| tasks | ||
| postcode.py | ||