Feature negative dc charging - #3795
Draft
AlexanderHa98 wants to merge 8 commits into
Draft
Conversation
AlexanderHa98
requested
a lite review from Copilot
and removed request for
Copilot
August 17, 2026 05:17
Contributor
There was a problem hiding this comment.
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.
| 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 |
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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")