Skip to content

fix(15min-settlement): render slot import and export separately - #291

Merged
frahlg merged 1 commit into
masterfrom
fix/15min-slot-import-export-separate
May 24, 2026
Merged

fix(15min-settlement): render slot import and export separately#291
frahlg merged 1 commit into
masterfrom
fix/15min-slot-import-export-separate

Conversation

@frahlg

@frahlg frahlg commented May 24, 2026

Copy link
Copy Markdown
Member

Summary

Under 15-min settlement (Svk), import and export accumulate as independent registers within a slot — the bill is import_wh × import_price + export_wh × export_price, never their net. The dashboard's "15m" badge was rendering ImportWh - ExportWh as a single signed value, silently hiding the operator's true settlement-window exposure.

Reported live (2026-05-24): a slot showing "15m +139 Wh" was actually import_wh=156, export_wh=17 — these are billed independently and netting them is wrong.

Changes

  • web/next-app.js — badge renders 15m ↑156 Wh ↓17 Wh; tints to import-red or export-green based on which direction dominates.
  • go/internal/api/api.go — keep net_wh in the response for backwards compat but document it as observational only; never bill against it.
  • state/cost.go already integrates per-direction correctly — no change there.

Test plan

  • go test ./internal/api/ -count=1
  • Full suite green
  • Visual check on homelab-rpi after deploy: badge shows both arrows during a mixed-direction slot

🤖 Generated with Claude Code

…r as net

Under Sweden's 15-min settlement model, import_wh and export_wh
accumulate as independent registers within a slot — the bill is

  import_wh × import_price  +  export_wh × export_price

never their net. The dashboard's "15m" badge was rendering
ImportWh - ExportWh as a single signed value, which silently hides
the operator's true settlement-window exposure: a slot that
imported 156 Wh and exported 17 Wh got summarised as +139 Wh,
making it indistinguishable from a slot that imported 139 Wh and
exported nothing.

Render both directions: "15m ↑156 Wh ↓17 Wh". The badge tints
import-red or export-green based on which dominates.

API: keep `net_wh` for backwards compatibility but document it as
observational — consumers must NOT bill against the net.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@frahlg
frahlg merged commit 4ef942b into master May 24, 2026
1 check passed
@frahlg
frahlg deleted the fix/15min-slot-import-export-separate branch May 24, 2026 17:55
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.

1 participant