Skip to content

Fix Überschuss-Verrechnung über mehrere Zählerebenen - #4167

Merged
LKuemmel merged 1 commit into
openWB:masterfrom
LKuemmel:loadmangement
Nov 3, 2026
Merged

LKuemmel merged 1 commit into
openWB:masterfrom
LKuemmel:loadmangement

Conversation

@LKuemmel

Copy link
Copy Markdown
Contributor

Ticket #66008194

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.

🟡 Changes recommended

The additional-current test cannot initialize its required counter hierarchy, and the integration test contains a duplicate test definition.

2 open issues
What changed in this PR

Fixes surplus-current accounting across nested load-management counter levels by using each load’s previously allocated target_current as the counter-difference baseline.

Changes:

  • Updates surplus and additional-current allocation calculations.
  • Aligns raw counter-data bookkeeping with target_current.
  • Adds regression coverage for nested counters and multi-phase allocations.
File Summary
packages/​control/​algorithm/​surplus_controlled.py Uses the previous target_current when updating surplus counter differences.
packages/​control/​algorithm/​integration_test/​multi_level_loadmanagement_test.py Adds multi-level surplus allocation regression coverage.
packages/​control/​algorithm/​common.py Recalculates raw counter data relative to target_current.
packages/​control/​algorithm/​additional_current.py Uses the previous target allocation for additional-current accounting.
packages/​control/​algorithm/​additional_current_test.py Adds additional-current regression coverage across counter levels and phases.

Review effort: Lite

@pytest.mark.parametrize("phases", [1, 2, 3])
def test_additional_current_preserves_target_across_counter_levels(phases):
"""The previous stage's allocation may differ from the configured minimum."""
cp = data.data.cp_data["cp4"]

@pytest.mark.parametrize("phases", [1, 2, 3])
@pytest.mark.parametrize("consider_less_charging", [False, True])
def test_surplus_preserves_previous_allocation_across_counter_levels(phases, consider_less_charging, monkeypatch):
@LKuemmel LKuemmel added this to the 2.4.0 milestone Oct 22, 2026
@LKuemmel
LKuemmel merged commit 0538f9e into openWB:master Nov 3, 2026
1 check passed
@LKuemmel
LKuemmel deleted the loadmangement branch November 3, 2026 12:16
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