Skip to content

docs(api): state c_m in Wh/(m²K), the unit the pipeline uses - #53

Merged
jravani merged 1 commit into
mainfrom
docs/c-m-unit
Oct 1, 2026
Merged

jravani merged 1 commit into
mainfrom
docs/c-m-unit

Conversation

@jravani

@jravani jravani commented Oct 1, 2026

Copy link
Copy Markdown
Member

Closes #52.

The TABULA workbook gives c_m in Wh/(m²K) and tau in hours, and the pipeline follows it: tau = c_m / (H_tr + H_ve) (calc_level_12.go:52) and a_H = 0.8 + tau/30 (calc_level_13.go:48) only hold with tau in hours. The stored values are correct. Four places described the field in other units:

Location Was Now
internal/models/field_metadata.go (served by GET /api/v1/fields) J/(m²K) Wh/(m²K)
docs/openapi/openapi.yaml J/(m²K), example 165000 Wh/(m²K), example 45
schemas/request_schema.json J/K Wh/(m²K)
schemas/example_request.json 165000 45

Validation of c_m is unchanged (must be greater than 0). Only the documented unit and the examples move.

The handler test fixture in internal/api/handler/calculation_test.go:141 still uses C_m: 165000 as its default. It is test input for a mocked repository, not documentation, and TestCalculateHeatDemand_cMOverride_changesResult overrides it with 45, so it is left as it is.

Checks

  • go vet ./internal/... and go test ./internal/... pass.
  • python3 test/schema_check.py: all 2 example payloads match their schema.
  • docs/openapi/openapi.yaml parses as YAML; mkdocs build --strict passes.

The TABULA workbook gives c_m in Wh/(m²K) and the time constant tau
in hours, and the pipeline follows it: tau = c_m / (H_tr + H_ve)
(calc_level_12.go) and a_H = 0.8 + tau/30 (calc_level_13.go) only
hold with tau in hours. The stored values are correct; a typical row
holds 45, which is 162 kJ/(m²K).

Four places said otherwise. The field metadata served by
GET /api/v1/fields and the OpenAPI description said J/(m²K), the
request schema said J/K, and the example request sent 165000, a
J/(m²K) value about 3,600 times too large as an override. All four
now say Wh/(m²K) and the example sends 45. Validation is unchanged.

Closes #52
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jravani
jravani merged commit 5a6de56 into main Oct 1, 2026
6 checks passed
@jravani
jravani deleted the docs/c-m-unit branch October 1, 2026 13:55
@jravani jravani added this to the v0.8.0 milestone Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

c_m is documented in J/(m²K) but the pipeline uses Wh/(m²K)

2 participants