Skip to content

Consumer fixes: wait_for_start_active default, fix reset reserved surplus - #3960

Merged
LKuemmel merged 2 commits into
openWB:masterfrom
LKuemmel:consumer_dev
Sep 17, 2026
Merged

LKuemmel merged 2 commits into
openWB:masterfrom
LKuemmel:consumer_dev

Conversation

@LKuemmel

Copy link
Copy Markdown
Contributor

@LKuemmel LKuemmel changed the title Consumer fixes Consumer fixes: wait_for_start_active default, fix reset reserved surplus Sep 17, 2026
@LKuemmel
LKuemmel requested a lite review from Copilot September 17, 2026 06:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reset path must release the exact surplus amount reserved for the load.

Pull request overview

Updates consumer startup defaults and surplus reservation cleanup during switch delays.

Changes:

  • Disables wait_for_start_active by default.
  • Adds regression tests for delay-state reset behavior.
  • Corrects surplus release to use the exact reserved amount.
File summaries
File Summary
packages/control/counter.py Updates delay-state surplus reservation cleanup.
packages/control/counter_test.py Adds reset behavior regression tests.
packages/control/consumer/consumer_data.py Changes the consumer startup default.
Review details

Suppressed comments (1)

packages/control/counter.py:607

  • For SWITCH_OFF_DELAY, released_surplus was incremented by load.data.set.required_power when the delay started (in switch_off_check_threshold), but this reset path subtracts vehicle.switch_on_threshold * phases instead. For a typical chargepoint these values differ substantially (for example, 16 A × 3 phases is 11,040 W versus a 1,500 W threshold × 3 = 4,500 W), so changing mode during the delay leaves stale released surplus and reduces the surplus available to other loads. Release the exact amount reserved for this load (preserving it before Chargepoint.update overwrites required_power) rather than recomputing it from the switch-on threshold.
                        if state == ChargepointState.SWITCH_ON_DELAY:
                            threshold = surplus_config.vehicle.switch_on_threshold * load.data.set.phases_to_use
                        else:
                            threshold = surplus_config.vehicle.switch_on_threshold * load.data.control_parameter.phases
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@LKuemmel
LKuemmel merged commit 24e9ec6 into openWB:master Sep 17, 2026
1 check passed
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.

2 participants