Root cause: SAP 10.2 has an internal unit-convention ambiguity for (H7)m between page 75 (Equation H1 implies W/m² 24-hour-average flux) and page 76 (verbatim "Monthly solar radiation per m² from U3.3 in Appendix U", i.e. kWh/m²/month monthly integrated). Page 77 (H23) formula's `× hours / 1000` term double-converts when (H7) is W/m². The cascade's `surface_solar_flux_w_per_m2` returns the §U3.2 24h-avg flux in W/m² (verified bit-exact vs Elmhurst worksheet line 295: SE 90° Jan region 0 = 36.7938 W/m²). The (H9) helper was using this directly without applying the U3.3 conversion that page 76's "from U3.3" cross-reference calls for. Elmhurst-certified software follows the U3.3 reading. SAP 10.2 spec p.76 line (H7): "Monthly solar radiation per m² from U3.3 in Appendix U". Appendix U §U3.3 (p.130) defines the conversion S_monthly = 0.024 × n_m × S(orient,p,m), where S(orient,p,m) is the §U3.2 24-hour-average flux in W/m². Therefore: (H7)m_U3.3 [kWh/m²/month] = flux_U3.2 [W/m²] × hours / 1000 Option A fix (per ChatGPT-mediated research): apply the U3.3 conversion inside the (H9) helper, so (H9) is in kWh/month rather than W. Spec p.77 (H23) formula then carries the conversion's dimensional residue correctly without double-counting. Diagnostic that closed the trap: back-solving poly(X_cas, Y_eff) = ws_H24/H17 at fixed X across 24 worksheet-positive observations from 4 cert fixtures (000565 + new A/B/C at sap worksheets/Solar PV tests/) revealed Y_eff/Y_cascade took ONLY two distinct values: - 0.7200 (exact) for every 30-day month observation - 0.7440 (exact) for every 31-day month observation i.e. exactly days × 24 / 1000. No utilizability function, no missing constant — a per-month unit-conversion factor that the polynomial non-linearity had been masking. Closure metrics (HEAD post-fix): - 000565 (W-30, modest): annual Δ −0.0000 kWh (every month exact) - A-baseline (S-30, modest): annual Δ +0.0001 kWh - B-highY (S-30, none): annual Δ −0.0000 kWh (incl Oct 10.5905) - C-lowY (N-60, signif): annual Δ −4.36 kWh (polynomial zero-clamp boundary; worksheet poly = 0.0024 → 0.41 kWh, cascade poly = −0.04 → 0) 47/48 month-observations pin at <1e-4 kWh. Test baseline: 547 pass + 9 expected `test_sap_result_pin[000565-*]` cascade-gap fails (unchanged — orchestrator still NOT integrated into water_heating.py:943; that's the follow-on slice that closes cert 000565's HW pin +272 → ~0). Pyright net-zero on both touched files. Files: - domain/sap10_calculator/worksheet/appendix_h_solar.py: rename `monthly_solar_energy_available_h9_w` → `_h9_kwh_per_month`, add `hours_in_month` param, apply U3.3 conversion. Y23 param renamed accordingly. Orchestrator updated. - domain/sap10_calculator/worksheet/tests/test_appendix_h_solar.py: add cert 000565 (H24)m monthly magnitude pin at abs < 1e-3 kWh; update H9 + Y23 unit tests for new kWh/month units. - BRIEF_APPENDIX_H_EN_15316_RESEARCH.md: new "Closure" section with the days-in-month diagnostic, root cause, and lessons. - HANDOVER_POST_4_CERT_EMPIRICAL.md: NEW — closure handover. 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