Skip to content

fix(load): do not turn on a minimum-power load when the surplus cannot cover it#7

Merged
bvweerd merged 1 commit into
devfrom
fix/load-minimum-power-gate
Jul 3, 2026
Merged

fix(load): do not turn on a minimum-power load when the surplus cannot cover it#7
bvweerd merged 1 commit into
devfrom
fix/load-minimum-power-gate

Conversation

@bvweerd

@bvweerd bvweerd commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Problem

A numeric load with a minimum active power (absolute_min_w, e.g. an EV charger that requires at least 6 A / 1380 W when on) was snapped up to that minimum for any surplus, however small. With a 300 W surplus the charger turned on at 1380 W, creating over 1 kW of grid import that the controller then had to correct by curtailing PV or reducing other loads — the opposite of what the surplus-distribution step is supposed to do.

Fix

A load that is off (below its minimum active power) now only turns on when the available surplus actually covers absolute_min_w — consistent with how switch loads already gate their turn-on on power_w. Reducing toward off (snap down to 0 through the forbidden zone) is unchanged.

Tests

Two tests in tests/test_load_control.py: the load stays off at 300 W surplus (no write, surplus untouched for the next actuator), and turns on normally once the surplus covers the minimum. The old test that codified the over-absorb behaviour is replaced. Full suite: 239 passed.

This is the last remaining fix from the earlier control-loop review; with this, everything from that series is on dev and PR #1 can be closed as superseded.

https://claude.ai/code/session_01RUWpwxbGsgR3PoLHLq4Djz


Generated by Claude Code

…t cover it

A numeric load with absolute_min_w (e.g. an EV charger that requires at
least 6 A / 1380 W when on) was snapped up to that minimum for any
surplus, however small. A 300 W surplus turned the charger on at
1380 W, creating over 1 kW of grid import that the controller then had
to correct by curtailing PV or reducing other loads.

The load now only turns on from off when the available surplus covers
absolute_min_w — consistent with how switch loads already gate on their
fixed power. Reducing toward off (snap down to 0) is unchanged.

https://claude.ai/code/session_01RUWpwxbGsgR3PoLHLq4Djz
@github-actions github-actions Bot added enhancement New feature or request bug Something isn't working labels Jul 3, 2026
@bvweerd bvweerd merged commit 8ff225b into dev Jul 3, 2026
9 checks passed
@bvweerd bvweerd deleted the fix/load-minimum-power-gate branch July 3, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant