fix(15min-settlement): render slot import and export separately - #291
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 renderingImportWh - ExportWhas 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 renders15m ↑156 Wh ↓17 Wh; tints to import-red or export-green based on which direction dominates.go/internal/api/api.go— keepnet_whin the response for backwards compat but document it as observational only; never bill against it.state/cost.goalready integrates per-direction correctly — no change there.Test plan
go test ./internal/api/ -count=1🤖 Generated with Claude Code