Skip to content

Feature negative dc charging - #3795

Draft
AlexanderHa98 wants to merge 8 commits into
openWB:masterfrom
AlexanderHa98:feature_negative_dc_charging
Draft

Feature negative dc charging#3795
AlexanderHa98 wants to merge 8 commits into
openWB:masterfrom
AlexanderHa98:feature_negative_dc_charging

Conversation

@AlexanderHa98

@AlexanderHa98 AlexanderHa98 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fürs Debug in _chargepoint.py folgende Zeilen setzen:
pub_to_broker("openWB/set/chargepoint/" + str(self.num) + "/get/max_charge_power", 500000)
pub_to_broker("openWB/set/chargepoint/" + str(self.num) + "/get/max_discharge_power", -500000)
pub_to_broker("openWB/set/chargepoint/" + str(self.num) + "/get/evse_signaling", "HLC")

@AlexanderHa98
AlexanderHa98 requested a lite review from Copilot August 12, 2026 07:45
@AlexanderHa98
AlexanderHa98 requested a lite review from Copilot and removed request for Copilot August 17, 2026 05:17

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

This PR extends the charging/control logic to support bidirectional operation (negative currents/power), including counter/loadmanagement tracking for “export” limits and updated algorithm behavior/tests for DC discharge scenarios.

Changes:

  • Allow/control negative setpoints for bidirectional (dis)charging across templates and EV current calculation.
  • Add “exported” headroom tracking on counters (power + currents) and use it in loadmanagement limiting.
  • Update BIDI algorithm flow and expand integration test coverage for instant discharging / DC current limits.

Reviewed changes

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

Show a summary per file
File Description
packages/helpermodules/setdata.py Relaxes validation for chargepoint /set/required_power to allow negative values.
packages/control/loadmanagement.py Adds BIDI-specific current availability method and extends current/power limiting to handle negative currents.
packages/control/ev/ev.py Passes bidirectional state into instant-charging template logic.
packages/control/ev/charge_template.py Enables instant-charging discharge behavior (negative current) gated by BidiState.
packages/control/ev/charge_template_test.py Updates unit test to match new instant-charging signature (adds BidiState).
packages/control/counter.py Tracks remaining “exported” power/currents headroom and updates raw-value accounting for discharge scenarios.
packages/control/algorithm/integration_test/bidi_charging_test.py Expands integration tests for BIDI instant discharge (DC current, counter export limits, multi-CP behavior).
packages/control/algorithm/common.py Allows negative diffs (discharge) and updates current monotonicity logic for discharge.
packages/control/algorithm/chargemodes.py Reorders/extends mode tuples and slice definitions to include additional BIDI discharge consideration.
packages/control/algorithm/bidi_charging.py Refactors BIDI handling to use loadmanagement-based limiting and adds instant-discharge handling based on DC current.

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

Comment thread packages/control/loadmanagement.py Outdated
try:
# Am meisten belastete Phase trägt am meisten zur Leistungsreduktion bei.
currents[i] = available_currents[i] / sum(available_currents) * raw_power_left / cp_voltage
currents[i] = available_currents[i] / sum(available_currents) * power_left / cp_voltage
Comment thread packages/helpermodules/setdata.py Outdated
self._validate_value(msg, float, [(float("-inf"), 0), (6, 32), (0, 0)])
elif "/set/required_power" in msg.topic:
self._validate_value(msg, float, [(0, float("inf"))])
self._validate_value(msg, float)
@AlexanderHa98 AlexanderHa98 self-assigned this Aug 17, 2026
@AlexanderHa98
AlexanderHa98 requested a review from LKuemmel August 17, 2026 06:26
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