pytest - #3786
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Extends load-management and PV-delay handling to consumers while updating integration expectations.
Changes:
- Adds consumer-aware surplus reservation and reset logic.
- Prevents incomplete consumer creation without an EVU counter.
- Updates algorithm logging and charging tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/helpermodules/command.py |
Reorders consumer creation and handles missing EVU counters. |
packages/control/counter.py |
Adds consumer-aware PV switching calculations. |
packages/control/consumer/consumer.py |
Resets delays when consumer modes change. |
packages/control/algorithm/surplus_controlled.py |
Suppresses empty load-group logs. |
packages/control/algorithm/min_current.py |
Suppresses empty load-group logs. |
packages/control/algorithm/additional_current.py |
Suppresses empty load-group logs. |
packages/control/algorithm/integration_test/conftest.py |
Adds consumer current expectations. |
packages/control/algorithm/integration_test/pv_charging_test.py |
Updates PV charging scenarios for consumers. |
packages/control/algorithm/integration_test/instant_charging_test.py |
Updates instant-charging expectations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return self.SWITCH_ON_TEXTS_CONSUMER | ||
|
|
||
| def calc_switch_on_power(self, load: Load) -> Tuple[float, float]: | ||
| def calc_switch_on_power(self, switch_on_threshold: float) -> Tuple[float, float, float]: |
| return surplus, threshold | ||
|
|
||
| def get_pv_config_py_load(self, load: Load) -> Tuple[float, float, bool]: | ||
| def get_pv_config_py_load(self, load: Load) -> Tuple[float, float]: |
| evu_counter.data.set.released_surplus -= (surplus_config.vehicle.switch_on_threshold | ||
| * chargepoint.data.control_parameter.phases) | ||
| chargepoint.data.control_parameter.state = ChargepointState.NO_CHARGING_ALLOWED | ||
| evu_counter.data.set.released_surplus -= threshold |
| expected_current_cp3: float = 0 | ||
| expected_current_cp4: float = 0 | ||
| expected_current_cp5: float = 0 | ||
| expected_current_consumer7: float = 0 |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (2)
packages/control/algorithm/integration_test/conftest.py:89
- This new shared assertion makes existing parameterized cases fail because several cases still inherit
expected_current_consumer7 = 0even when the consumer is allocated 0.5 A. For example,test_instant_charging_limitimmediately asserts 0.5 A after calling this helper, and the phase-switch case also omits the consumer expectation. Set the expected consumer current explicitly in every affected case before enabling this assertion.
assert data.data.consumer_data["consumer7"].data.set.current == params.expected_current_consumer7
packages/control/counter.py:603
- An active consumer enters the switch-off delay by adding
load.data.set.required_powertoreleased_surplus(line 573), but this branch removesrequired_current * 230 * phases. Sincerequired_poweris calculated from the consumer's actual voltages, a mode change at any voltage other than exactly 230 V leaves a stale balance that affects subsequent surplus decisions. Remove the samerequired_powervalue for active consumers; retain the nominal threshold calculation only for switch-on reservations.
else:
threshold = (load.data.control_parameter.required_current *
230 *
load.data.control_parameter.phases)
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.
No description provided.