Closes the remaining cert 000565 BP[0] Main wall residual (-1.54 W/K
under ws) by routing solid-brick walls with documentary wall
thickness + lodged insulation through the RdSAP 10 §5.7 + §5.8
formula chain. Adds a Table-6 footnote (a) cap on the §5.6 stone
formula to handle thin uninsulated stone walls (Ext1 BP[1] Granite
W=50 mm).
RdSAP 10 §5.7 Table 13 (PDF p.41) verbatim:
"Default U-values of brick walls
Wall thickness, mm U-value, W/m²K
Up to 200 mm 2.5
200 to 280 mm 1.7
280 to 420 mm 1.4 ← cert 000565 Main W = 300 mm
More than 420 mm 1.1"
RdSAP 10 §5.8 step 2 (PDF p.41-42) verbatim:
"The U-value of the insulated wall is U = 1 / (1/U₀ + R_insulation)
...
Where R_insulation comes from Table 14: Insulation thickness and
corresponding resistance.
...
R = 0.025 × T + 0.25 when λ = 0.04 W/m·K
R = 0.0333 × T + 0.248 when λ = 0.03 W/m·K
R = 0.040 × T + 0.25 when λ = 0.025 W/m·K
Where T is thickness of insulation in mm"
Cert 000565 Main lodgement (Summary §7.0):
Type SO Solid Brick (wall_construction = 3)
Insulation E External (wall_insulation_type = 1)
Insulation Thickness 75 mm
Wall Thickness 300 mm (measured)
Conductivity Known No → λ defaults to 0.04 (§5.8 final note)
Age band A
Formula chain:
U₀ = 1.4 (§5.7 Table 13 row "280 to 420 mm")
R = 0.025 × 75 + 0.25 = 2.125 m²K/W
U = 1 / (1/1.4 + 2.125) = 1 / 2.8393 = 0.3522 → 0.35 (2 d.p.)
Pre-slice the cascade bucketed 75 mm into the Table-6 "100 mm
external/internal insulation" row → 0.32 for age A. The -0.03 U
delta on Main's 51.72 m² external wall is the entire -1.54 W/K
under-count driving the cohort's remaining fabric residual.
RdSAP 10 Table 6 footnote (a) (PDF p.34) verbatim:
"Or from equations in 5.6 if the calculated U-value is less than
1.7."
Applies only to the AS-BUILT (no insulation, no dry-line) Table 6
row. For thin walls where §5.6 gives U ≥ 1.7 the Table 6 row
default of 1.7 caps the result. Verified empirically against cert
000565 Main alt_wall_1 (granite W=120 mm dry-lined): raw §5.6 →
3.879 + dry-line → 2.34 matches worksheet, NOT capped 1.7 + dry-
line → 1.32. The cap therefore only fires when neither dry-lining
nor insulation is present (cert 000565 BP[1] Ext1: granite W=50 mm
"Insulation Unknown" → §5.6 = 6.09 → capped to 1.7, matches ws).
3-layer fix:
1. `domain/sap10_ml/rdsap_uvalues.py`:
- Add `_u_brick_thin_wall_age_a_to_e(W_mm)` per §5.7 Table 13
- Add `_r_insulation_table_14(T_mm, λ)` per §5.8 Table 14
interpolation rule (handles all 3 λ columns)
- Wire §5.7+§5.8 chain into `u_wall` for WALL_SOLID_BRICK + age
A-E + lodged thickness + (External | Internal) insulation +
thickness > 0
- Add Table 6 footnote (a) cap to `_u_stone_thin_wall_age_a_to_e`
(cap at 1.7 only when not dry-lined)
- Round dry-lined §5.6 result to 2 d.p. (worksheet A×U precision)
2. `domain/sap10_calculator/worksheet/heat_transmission.py` passes
`wall_thickness_mm=part.wall_thickness_mm` through to `u_wall`
for the per-BP main wall U (previously passed only for alt walls).
3. AAA test pins cert 000565 walls_w_per_k = 604.07 within 1e-4.
Movement at HEAD `9159e91f` → post-slice (cert 000565):
Fabric (cascade vs ws):
walls 602.53 → 604.08 (Δ -1.54 → +0.01 W/K — sub-spec
alt-wall float rounding artifact)
total W/K 935.54 → 937.09 (Δ -1.52 → +0.03 W/K — essentially
zero net fabric HTC residual)
End-result pins:
sap_score (int) 29 ✓ EXACT (unchanged)
sap_score_continuous 28.5380 → 28.5028 (Δ +0.0293 → -0.0059;
80% magnitude reduction)
ecf 5.3838 → 5.3874 (Δ -0.0028 → +0.0008)
total_fuel_cost_gbp 4677.64 → 4680.78 (Δ -2.62 → +0.52)
co2_kg_per_yr 6444.27 → 6448.34 (Δ -3.35 → +0.72)
space_heating 58974.84 → 59020.02 (Δ -33.5 → +11.7)
main_heating_fuel 34691.09 → 34717.66 (Δ -19.7 → +6.87)
lighting_kwh 1382.67 (unchanged)
pumps_fans_kwh ✓ EXACT (unchanged)
Continuous SAP magnitude improved 80% (0.0293 → 0.0059). All
SH-driven downstream residuals (cost, co2, SH kwh, main_heating
fuel) magnitude-reduced 65-80%. Integer SAP stays exact at 29.
Cohort safety verified: 6 cohort certs (000474-000516) lodge wc=4
(cavity) + wit=4 (as-built) — neither precondition for the new
§5.7+§5.8 path. §5.6 cap only fires when not dry-lined (cohort
certs don't trigger). All 11 cert→inputs and 6 sap_result_pin
cohort tests pass unchanged.
Golden cert 6035-7729-2309-0879-2296 (mid-terrace age A solid
brick) sees the §5.7+§5.8 chain fire on its Main wall:
PE +46.7562 → +46.0936 kWh/m² (cascade closer to actual EPC)
CO2 +1.0652 → +1.0495 tonnes/yr (cascade closer to actual EPC)
Per [[feedback-golden-residuals-near-zero]] the expected pin is
updated to track the improvement (target → ~0 as mapper closes).
Test count: 608 pass + 7 expected 000565 fails → **608 pass + 7
expected 000565 fails** (new §5.7+§5.8 formula test green; golden
cert 6035 pin re-pinned; integer SAP stays at 29). Pyright net-zero
per touched file (27 baseline → 27 post-change).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
||
|---|---|---|
| .devcontainer | ||
| .github/workflows | ||
| .idea | ||
| .vscode | ||
| applications | ||
| asset_list | ||
| backend | ||
| backlog | ||
| datatypes | ||
| deployment/terraform | ||
| docs/adr | ||
| domain | ||
| epr_data_exports | ||
| etl | ||
| infrastructure | ||
| model_data/requirements | ||
| orchestration | ||
| recommendations | ||
| repositories | ||
| scripts | ||
| sfr/principal_pitch | ||
| survey_report | ||
| tests | ||
| utilities | ||
| utils | ||
| .coveragerc | ||
| .dockerignore | ||
| .gitignore | ||
| __init__.py | ||
| ara_backend_design.md | ||
| BaseUtility.py | ||
| CLAUDE.md | ||
| conftest.py | ||
| CONTEXT.md | ||
| devcontainer.sh | ||
| Dockerfile.test | ||
| Dockerfile.test.dockerignore | ||
| Makefile | ||
| MEMORY.md | ||
| package-lock.json | ||
| package.json | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| pytest.ini | ||
| README.md | ||
| run_lambda_local.sh | ||
| serverless.yml | ||
| test.requirements.txt | ||
| tox.ini | ||
| UBIQUITOUS_LANGUAGE.md | ||
Model Repository
This repository contains the code pertaining to the development of the data science and machine learning products being utilised by Hestia.
The different folders in this repository relate to services that can be used independently, or can be imported and used as part of a larger application
Getting Started
Prerequisites
Dev Container Setup
This repo uses a Docker Compose-based dev container. The model-backend service joins a shared-dev Docker network so it can communicate with other local services (e.g. a frontend container) running on your machine.
VS Code users: The initializeCommand in devcontainer.json creates the shared-dev network automatically before the container starts. No manual step required — just open the repo and select Reopen in Container.
Non-VS Code / CI workflows: Run the following once before starting the container:
make dev-setup
This is idempotent and safe to re-run if the network already exists.
Folders
backend/
This folder contains the code for the fastapi backend service, which provides an interface to much of the functionality in this repository, for the frontend
model_data/
This folder contains related to the reading and preparation of assessment model data, including pulling out epc attributes
Testing
All tests can be run, against the configuration in pytest.ini running
pytest
This will run the complete panel of tests and report on coverage in the locations specified by the pytest.ini file.
To run tests in a specific service, e.g. inside of model_data, simply run
pytest --cov-config=model_data/.coveragerc --cov=model_data
This will produce the test results and coverage reports