Repository navigation
Conversation
This was referenced Nov 14, 2026
hannesb90
force-pushed
the
feat/heat-planner
branch
2 times, most recently
from
November 15, 2026 07:46
d25295c to
bfce314
Compare
hannesb90
marked this pull request as ready for review
November 15, 2026 08:21
The low notes from the review of srcfl#1997, for the step that adds a planned-value caller: - The test seams were part of the production API: two hook parameters on Send and SendDefault, and exported State.Lock, State.Unlock, ArmLocked, Expire, Peek, Len and State.CurrentHold. A planned-value caller could have held the per-driver lock through them. They are now behind Holds.Seams, which panics outside a test binary. An export_test.go would not do: the API package's hold-race tests need them too. - Holds.State, which created an entry for any name, is reachable only through Seams. - Active takes the per-driver lock and so waits for a command in flight. TryActive is the same read for the control tick: it never waits, and says so when a command or a default holds the lock. The hold-race tests are unchanged apart from the call target. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: hannesb90 <[email protected]>
A dynamic program over a zone's predicted temperature. It costs heat as electricity divided by the source's efficiency, so direct electric heat, air-to-air, air-to-water, a hot-water tank, a spa and a pool are the same problem with different inertia, band and COP. The site's energy plan comes first. Heat is costed at the import price, takes only what the plan still exports and only the headroom it leaves under the import limit, and leaves its band before it proposes a value that draws through that limit. Battery energy costs what the site buys back in the cheapest later slot the battery was to cover, never what the battery was charged at. Two owner rules sit beside the plan, both off until the owner sets them: PriceComfort moves a zone's target with the day's mean price, linearly between the owner's cheap, normal and dear levels, inside the zone's hard band; SavingsGate leaves every zone on its target unless the plans together save the owner's least amount in a day. A `thermal` config section carries the owner's numbers as plain values with their own checks, and cmd/ftw turns them into the planner's rules, so no control package depends on heatplan. Nothing calls the package yet: the service and dispatch are separate changes. ADR 0012 gains the proposal under "What the owner sets". Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: hannesb90 <[email protected]>
hannesb90
force-pushed
the
feat/heat-planner
branch
from
November 15, 2026 14:18
c48d939 to
6730139
Compare
This was referenced Nov 15, 2026
Member
|
@hannesb90 thanks, this is good work. Fredrik asked me to carry it on rather than send it back to you, so it has merged in two parts, with your commits and authorship kept:
Fredrik's direction (15 November 2026), now decision 9 in ADR 0012
Fixes in #2022
Closing this PR, since its content is in master. |
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.
What
A
heatplanpackage: for one zone, it proposes the control value to hold in each slot from prices, weather and the site's energy plan. Nothing calls it yet, so there is no behaviour change. Zone config, the service and dispatch are separate changes.Part of ADR 0012 section 4.
Stacked
This branch contains #1996 and #1997, which it needs (the twin and the control holds), rebased onto their current heads. It is a draft until those two merge. Review the last three commits:
refactor(drivercontrol): keep the hold test seams out of the APItakes the three low notes from the review of refactor(drivercontrol): move operator holds out of the API #1997. The test seams (the hook parameters onSendandSendDefault,State.Lock/Unlock,ArmLocked,Expire,Peek,Len,State) are now behindHolds.Seams(), which panics outside a test binary; anexport_test.gowould not do, because the API package's hold-race tests need them too.TryActivereads a hold without waiting, for the control tick. Nothing calls it yet.feat(heatplan): propose a zone's heat from prices and the site's plan, unchanged.feat(heatplan): comfort follows the day's price, and a least daily saving, new. See below.Nothing here reads a twin's status yet, so the new
unprovenstate in #1996 changes nothing in this PR.How it plans
What the owner sets
Two rules beside the plan, both off until the owner sets them. Nothing has a default: the numbers depend on the contract, the price area and the household.
PriceComfort). The zone's target moves with the day's mean price, linearly between the owner's cheap, normal and dear levels. Each direction is per zone: a bathroom floor may follow cheap days up while room air only follows dear days down. The moved target stays inside the hard band. It needs no model of the house.SavingsGate). Planned heat is acted on only when the plans of all zones together save the owner's amount in a day; below it every zone is left on its target. An open gate closes at 80 % of the limit. A plan that leaves its band counts as saving nothing.A
thermalsection in the configuration carries the numbers (cheap_day_ore_kwh,normal_day_ore_kwh,dear_day_ore_kwh,min_saving_ore_per_day, and per zonecheap_day_raise_k,dear_day_lower_k,step_k). It is parsed and validated, and nothing acts on it yet. ADR 0012 gains the proposal in section 1 and under Open; it has not been answered.Where it comes from: one household runs both rules in a local script on three floor-heating zones. With a 5 kr limit the planned savings of 0.1–4.9 kr a day never opened the gate, so in practice only the day's comfort level acted.
Evidence
Synthetic houses and prices, not hardware. On a volatile two-day price series the plan saves 14–65 % against leaving the device alone, and about 0–27 % on a calm series, without leaving any zone's band. It is within 0.02 % of a finer-grid and a local-search check, except a spa at 1.25 %. In a battery simulation with a re-planning EMS, costing battery energy as cheap cost up to 23 SEK a day more than the import price and emptied the battery before the peak ended. The rule here was never worse than the import price.
Not included
Zone config, the service, dispatch, a driver-declared heat source and COP curve, twins for tanks, pools and electric floors, zones on a shared source planned together, dead time, cooling and discrete modes.
The open questions this raises are in the ADR 0012 addendum on #1994.
🤖 Generated with Claude Code