Model/backend/documents_parser
Khalim Conn-Kowlessar d4f6ff0f2f Slice S0380.152: SAP 10.2 Table 3 — primary loss for solid-fuel back-boilers
SAP 10.2 Table 3 (PDF p.160) "Primary circuit loss" verbatim:

  "Primary circuit loss applies when hot water is heated by a heat
   generator (e.g. boiler) connected to a hot water storage vessel
   via insulated or uninsulated pipes (the primary pipework)."

The spec rule does NOT restrict to Table 4b gas/oil boilers — any
boiler connected to a cylinder via primary pipework incurs the loss.
The cert's `water_heating_code` is the discriminator:

  - WHC=901/902/914 (HW from main heating system) + wet boiler +
    cylinder → primary loss applies (back-boiler / wet boiler heats
    cylinder via primary loop).
  - WHC=903 (HW from a separate electric immersion / secondary) → no
    primary loss even when the main is a wet boiler.

Pre-slice `_primary_loss_applies` only covered Table 4b gas/oil boiler
codes (101-141). Table 4a solid-fuel boiler codes 151-161 (manual /
auto / range-cooker boilers, closed room heater + back-boiler, open
fire + back-boiler, wood pellet + back-boiler) fell through and
primary loss silently went to zero — under-counting §5 (72) water-
heating internal gain by ~74 W cohort-wide for every WHC=901 solid-
fuel back-boiler variant.

Worksheet evidence on the 001431 corpus (all age G, same cylinder):
  - solid fuel 2 (code 158, WHC=901): ws (59) ≈ 505 kWh/yr   → apply
  - solid fuel 3 (code 160, WHC=901): ws (59) ≈ 643 kWh/yr   → apply
  - solid fuel 5 (code 153, WHC=903): ws (59) = 0            → skip
  - solid fuel 4..11 (633/636 non-boilers, WHC=903): skip

The fix:
  - `_primary_loss_applies(...)` gains a `water_heating_code: Optional[int]`
    parameter (default None for back-compat with synthetic tests).
  - New branch after the Table 4b fallback: `_is_wet_boiler_main(main)`
    + `water_heating_code in _WATER_INHERIT_FROM_MAIN_CODES` → True.
  - Call site `_primary_loss_override` passes
    `epc.sap_heating.water_heating_code`.

Heating-systems corpus impact:
  - solid fuel 3 (code 160, WHC=901): +1.31 → +0.30 SAP
                                       PE -918.6 → -214.3 kWh/yr
  - solid fuel 2 (code 158, WHC=901): +2.77 → +2.06 SAP
                                       PE -1241.7 → -754.1 kWh/yr
  - All other variants: unchanged

SF2 doesn't fully close because the worksheet's (59) is winter-only
(0 in summer) but the cascade applies the year-round Table 3 formula
via `_separately_timed_dhw=True` (cylinder + non-electric HW fuel).
Remaining residual is a follow-up — likely a
`_separately_timed_dhw=False` rule for solid-fuel back-boilers (HW
timing tied to the room fire, not separately programmed).

Pyright net-zero (43 → 43). Extended handover suite: 895 → 896 pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 12:59:08 +00:00
..
handler address JTK review comments 2026-04-20 15:11:17 +00:00
tests Slice S0380.152: SAP 10.2 Table 3 — primary loss for solid-fuel back-boilers 2026-06-01 12:59:08 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
db_writer.py include updating epc_property_data to pashub to ara workflow 2026-04-29 09:55:14 +00:00
elmhurst_extractor.py Slice S0380.140: §4 cylinder storage loss — extractor picks up §16 thermostat lodging + Table 2b note b restricts ×0.9 to boiler/warm-air/HP systems 2026-05-31 19:03:58 +00:00
extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
local_runner.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00
parser.py load ecmk site notes to db 2026-04-29 11:20:47 +00:00
pdf.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00