A winter evening
Grid power is cheap tonight. The battery is down to a third, and the heat pump is running. So: fill it up, right? But the house buys only a small top-up. Tomorrow's sun is free, and storing loses about a tenth. And what it pays tonight helps decide who heats tomorrow: the heat pump, or gas.
This episode takes the planner behind that decision apart, backwards, link by link, all the way to the weather forecast. Then it puts it back together as one chain.
The result first
Here's the real planner on a week like that, with example inputs: grey, in December. Tuesday afternoon, the battery is at about half. The heat pump, for heating and hot water, is about two fifths of everything the house uses. Without buying, the battery would drop below 30 % early on Wednesday morning.
That purchase goes into the battery price: a mix of everything in the battery, and the only price the heat pump pays. As long as the battery price stays below about 30 ct, heat from the heat pump beats heat from gas (at a COP of 3, with gas heat at about 10 ct). Thursday? No prices yet. That part waits.
How much: the gap below the mark
Why just over a quarter, and not more? It starts with a gap: what the battery would be missing below a line at 30 %. It is counted in points: one point is one percent of the battery.
- Floor 20 %. The grid tops the battery up only gently, so a reserve has to cover the house's peaks, like the heat pump starting while the car charges. And in winter the charge reading can drift: 20 % on the screen can really be 15.
- Buffer 10 points. No forecast is perfect. Floor plus buffer makes the line at 30 %: the mark.
- One gap at a time. The house finds the first gap, closes it, and calculates again, and only then looks at the next one. Every purchase changes the whole curve after it: the next gap may move, or disappear.
A week of battery levels
To find that gap, the house predicts its own battery level for the next seven days, hour by hour: 168 hours. Each hour it adds what the sun brings and takes away what the house uses. On the way in and out the battery loses a little, about a tenth for a full round trip, and the electronics draw a little power all the time, day and night. Over a day, that adds up to a few points of the battery. At the bottom, the level stops at the floor.
level at the end of the hour = level before + sun − demand − losses + charged
Why a whole week, when prices reach only a day and a half ahead? Because a grey stretch shows up in this line days before it reaches the battery. Then the house can already use clearly cheap hours before it. The further ahead, the shakier the forecast, so after the first two days the mark climbs by two points per day: 30 % for now, 40 % a week ahead. Over time, the house learns the size of those steps from its own measured forecast errors.
Three inputs and a starting point
- The sun. The house calculates its own solar forecast for the week, from the weather forecast and the position of the sun. For this plan it uses only that plain physics, not the learned corrections: those are learned for the hour right now, and stretched over a whole day, such a correction once nearly tripled a forecast. A forecast older than two hours buys nothing, and an hour with no solar value at all is marked unknown: nothing is bought in it.
- The house. A learned typical day, one for weekdays and one for weekends, that remembers roughly the last ten days; a day only counts if at least three quarters of it were measured. The heat pump and mining are taken out of this pattern. On top comes the car's typical charging, learned per hour and type of day. The mining hardware only adds its small standby draw; mining itself runs on solar surplus, never on grid power.
- The heat pump, for heating and hot water, the biggest single machine in winter. The house works out electricity per hour, not how often it starts: for the next 24 hours from the daily heating plan, beyond that the house's heat loss at that hour's outdoor temperature, divided by the COP. Cold weather hits twice: the house needs more heat, and each unit of electricity brings less of it (at minus six degrees, a COP of only about 2.5). When it gets really cold, gas helps out, but the heat pump keeps running alongside, so the plan keeps counting its power. Hot water gets its own pattern from the last two weeks, because it follows habits more than the weather: on one October day, a good third of the heat pump's electricity went into hot water.
- The starting point. How full is the battery right now? Only the battery meter counts, live or held for at most half an hour. If it isn't fresh, there is no plan at all, just a red light. Unknown is not zero.
Time window and prices
The plan is recalculated every fifteen minutes, and right away when new prices arrive. Every input moves, so a wrong guess at breakfast is corrected long before lunch. Even the calendar needs care: when the clocks go back in autumn, one night has an extra hour, and the plan counts it.
On a dynamic tariff, every quarter hour has its own price, set the day before: the day-ahead price. The house sees its battery a week ahead, but prices at most a day and a half: tomorrow's prices arrive in the early afternoon. Just before that, about ten hours of prices are known; right after, about 35. So the week splits into three parts:
| Part | What the plan does |
|---|---|
| Prices known | Closes the gap in the cheapest quarter hours within reach, at whatever they cost. That power would be bought anyway, at the floor; the only question is when. |
| Up to three days ahead | Buys in advance only when a price is clearly cheap: at most 25 ct, below the average of the known prices, and among the cheapest 30 % of the last two weeks. All three have to be true. |
| Further out | Waits for its prices. The plan is redone the moment they arrive. |
And a price of zero or below? Always charge, all the way to 100 %. The cheaper the hours the plan finds, the lower the battery price, and the colder it can get before gas becomes the cheaper heat.
Why not just fill it up?
- The sun. What it brings tomorrow is free, so the house never buys a charge the sun would deliver anyway. And this house sells nothing to the grid: a battery that's full on a sunny morning leaves much of the solar power nowhere to go. It's simply turned down.
- Storing isn't free. About a tenth is lost on every round trip. A charge that isn't needed is money lost.
- The battery account. Sunshine in the battery counts as zero cents, so paid grid top-ups push the battery price up. Once it climbs above the winter tipping point, around 30 ct, heat from gas becomes cheaper than heat from the heat pump.
- The cells. Once a day, the battery should be full for an hour, so its cells can even out. That full hour is meant for the sun, not for bought power.
So here are the rules. From the grid, 90 % at most: the top ten percent stay free for sun the forecast didn't see coming. Never in the daily full hour. Never while the sun already covers the house. Only a price of zero or below breaks these rules.
The cheapest power is the power you never have to buy.
What moves the plan most
By the numbers: the sun. In one real week plan, worked out on an October afternoon, the forecast sun covered just under half of the demand on one day, and more than one and a half times the demand on another. The weather forecast itself is off: for tomorrow it moves the solar total by about 11 % on average, for the day after by about 17 %. Further out, the error isn't measured here, which is exactly why the mark climbs. The solar model itself tends to come in low, by about 15 %: the safer mistake, a little too much bought rather than too little.
Then the temperature, through the heat pump: in that October week it made up between 14 and 28 % of the demand, and in winter that share grows a lot. And the prices: the known hours cost between about 19 and 39 ct. The cheapest were around noon on Saturday, while the sun was filling the battery anyway. Cheap, but there was no gap, so nothing was bought. Cheap alone is never a reason.
From plan to charger
Every link here has a story. An early version wanted 48 hours of prices before it would plan anything; on the day it was checked, there weren't even 17, and that version never charged. Since then: plan with what's known. Another version would have bought at noon, into a battery the sun was already filling, because midday prices are often the cheapest of the day. Since then: no grid charging while the sun covers the house.
The last link is the charger. Each charging block goes into the battery system's own schedule: charge up to this level, stop at this time. Each block runs at full power, as much as the charger and the grid connection allow: the plan decides when, not how hard. After every setting, the house reads it back from the device; getting no error message isn't enough. If the house's computer goes quiet, the charging still ends on its own, and a small watchdog on the battery system removes the entry after ten minutes without a heartbeat. Before and during every block, the rules are checked again and again: no charging while mining runs, in the full hour or on a battery alarm, and none if the price has jumped more than five cents above the plan.
The charger only charges the battery. The house hangs on the battery, through the inverter system, and keeps running from it while it charges. There is no line from the grid straight to the house.
One winter week, step by step
Remember the purchase from the start? Here's how the planner got there. Tuesday, 3 pm, overcast, the battery at 52 %. The house uses about a third of the battery per day, plus a few points for losses; the sun covers at most half of that, on most days much less. Prices are known until Wednesday midnight: 41 ct in the evening peak, 22 ct between one and five in the morning, and 22 again late on Wednesday evening.
- With the plan
- Without buying
- Mark (floor + reserve)
- Floor 20 %
Example inputs, not this house's data · neutral charging speed, not this house's.
| Step | What it calculates | Result |
|---|---|---|
| 1 | The line without buying | below 30 % at 7 am on Wednesday, on the floor at 5 pm |
| 2 | The gap up to the last known price | 22.5 points: 10 to get back up to the mark, 12.5 the house would otherwise buy at the floor, mostly in the 41-ct evening peak |
| 3 | The cheapest quarter hour within reach, again and again | first the night at about 22 ct, then a few at the edges of the night at about 25 ct; the cheap late evening only once the gap gets there |
| 4 | Reserve for the next gap, early on Thursday | the cheap late quarter hours that are still free; every other one costs more than 25 ct, so the buying stops |
| 5 | Result | just over a quarter of the battery at about 22.5 ct, against an average of about 32 ct; the level stays between about 30 and 50 %, far from full |
| 6 | Rest | from early Thursday, 22 to 37 points per day: waits for Thursday's prices |
The rest waits, and the plan is redone the moment Thursday's prices arrive, on Wednesday afternoon. And the real October plan from earlier? Battery at about three quarters. The lowest point of the coming week: about 48 %, still about ten points above the mark, which by then had climbed to 38 %. The plan said: nothing needed. That's the cheapest answer.
The level 3 page recalculates this week in code, quarter hour by quarter hour.
The whole chain
The weather becomes a solar forecast. The house's habits, the car, the heat pump and hot water become demand. A trusted charge level is the start. Together: a week of battery levels. Below the mark: a gap. Prices decide when. And the battery system's own schedule does the charging, and stops on its own. Every link can be wrong. That's why each one carries an age, a reason, and a safe way to stop.
Follow the chain on the logic map: every link, what it uses, and what uses it.
Buy only what's missing. Only when it's needed. At the cheapest time you already know, and leave the rest to the sun.
Real values from one house, rounded: the October week plan (battery about 75 %, lowest point about 48 %, mark 38 %, known prices 19 to 39 ct, sun from just under half to more than one and a half times the demand, heat pump 14 to 28 % of it), the weather error (about 11 % and 17 %), the solar model about 15 % too low, a good third of the heat pump's electricity for hot water on one October day, and a COP of about 2.5 at minus six degrees. The example week uses invented inputs and a neutral charging speed.