Skip to content

phase switch delay: fix consideration of own reserved required power#3666

Merged
LKuemmel merged 2 commits into
openWB:masterfrom
LKuemmel:fix_phase_switch
Jul 15, 2026
Merged

phase switch delay: fix consideration of own reserved required power#3666
LKuemmel merged 2 commits into
openWB:masterfrom
LKuemmel:fix_phase_switch

Conversation

@LKuemmel

Copy link
Copy Markdown
Contributor

Ticket #66006152

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.

Pull request overview

Adjusts the EV phase-switching logic so phase switch delay decisions correctly account for power already reserved by the same chargepoint (Ticket #66006152), and updates unit tests accordingly.

Changes:

  • Passes computed surplus into _check_phase_switch_conditions instead of re-reading surplus inside that helper.
  • During PHASE_SWITCH_DELAY, adjusts surplus evaluation to account for already-reserved switching power.
  • Updates auto_phase_switch_test.py to reflect the new surplus handling and helper signature.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/control/ev/ev.py Refactors phase-switch condition checks to accept a surplus argument and adjusts surplus computation during phase-switch delay.
packages/control/auto_phase_switch_test.py Updates test cases and helper invocation to match the refactored API and new surplus semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/control/ev/ev.py
Comment on lines +339 to +345
all_surplus = data.data.counter_all_data.get_evu_counter().get_usable_surplus(feed_in_yield)
if control_parameter.state == ChargepointState.PHASE_SWITCH_DELAY:
# eigene reservierte Leistung abziehen, wenn die Verzögerung für die Umschaltung läuft,
# da diese Leistung bereits für die Umschaltung reserviert ist.
surplus = all_surplus + required_reserved_power
else:
surplus = all_surplus
# execution
phase_switch, condition_msg = ev._check_phase_switch_conditions(
ChargeTemplate(),
phase_switch, condition_msg = ev._check_phase_switch_conditions( # type: ignore

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

# execution
phase_switch, condition_msg = ev._check_phase_switch_conditions(
ChargeTemplate(),
phase_switch, condition_msg = ev._check_phase_switch_conditions( # type: ignore
@LKuemmel
LKuemmel merged commit 5ec0dbb into openWB:master Jul 15, 2026
1 check passed
@LKuemmel
LKuemmel deleted the fix_phase_switch branch July 15, 2026 07:25
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