Repository navigation
Feature Request "Mindest-SoC: Automatik-Option für Phasenwahl ergänzen" - #4068
Conversation
…hasenwahl auto_phase_switch() nutzt control_parameter.min_current bereits als Untergrenze für die automatische 1p/3p-Umschaltung - dieser wird jetzt während aktiver Mindest-SoC-Ladung auf min_soc_current/dc_min_soc_current gesetzt statt auf den allgemeinen Mindeststrom des Fahrzeugs. Keine neue Umschaltlogik nötig, die bestehende automatische Phasenumschaltung greift dafür unverändert, sobald phases_to_use_min_soc == 0 zulässig ist (Frontend-Erweiterung). min_current bleibt zusätzlich während einer laufenden Phasenumschaltung eingefroren, da auto_phase_switch() die reservierte Leistung sonst mit unterschiedlichen Werten reserviert und wieder freigibt.
…gänzen phases_to_use_min_soc == 0 (Automatik) wird vom Backend bereits unterstützt, in cards/colors/koala/standard_legacy fehlte dafür nur der dritte Button - analog zur bereits vorhandenen Automatik-Option bei PV-Ladeziel/Eco-Laden. display_themes/colors hat aktuell gar keine Phasenauswahl für Mindest-SoC und bleibt daher unverändert.
…ter/core into min-soc-automatic-phases
cshagen
left a comment
There was a problem hiding this comment.
Die Änderungen am Colors-Theme sind gut!
| soc = self.data.set.charging_ev_data.data.get.soc | ||
| if (self.data.control_parameter.chargemode == Chargemode.PV_CHARGING and | ||
| pv_charging.min_soc != 0 and soc is not None and soc < pv_charging.min_soc): | ||
| self.data.control_parameter.min_current = ( |
There was a problem hiding this comment.
Das hat zur Folge, dass beim Runterregeln durch das Lastmanagement nicht mehr mit weniger als min-soc-current geladen wird und dann direkt abgeschaltet wird, auch wenn das Auto mit weniger Strom laden könnte.
Klare Lösung wäre, eine neue Variable control_parameter.reserved_power einzuführen. Dann können da auch keine Race Conditions mehr entstehen.
There was a problem hiding this comment.
reserved_power habe ich wie vorgeschlagen ergänzt. Zusätzlich hab ich min_current von der Mindest-SoC-Logik getrennt (neu: min_soc_current), sonst wäre der eigentliche Bug (Lastmanagement schaltet komplett ab statt mit weniger zu laden) noch da gewesen - min_current bleibt jetzt unverändert der harte Lastmanagement-Untergrenze. Passt das so für dich?
There was a problem hiding this comment.
reserved_power habe ich wie vorgeschlagen ergänzt.
Das passt so.
Zusätzlich hab ich min_current von der Mindest-SoC-Logik getrennt (neu: min_soc_current), sonst wäre der eigentliche Bug (Lastmanagement schaltet komplett ab statt mit weniger zu laden) noch da gewesen - min_current bleibt jetzt unverändert der harte Lastmanagement-Untergrenze. Passt das so für dich?
Die Variable brauchen wir meiner Meinung nach nicht. Die gleiche Situation gibt es aktuell schon bei beim PV-Laden mit Mindest-SoC. Aktuell ist es implementiert, dass hochgeschaltet wird, sobald einphasig mit Maximalstrom geladen wird.
Bei zB 14A Mindeststrom und Max 16A würde aktuell bei 16A hochgeschaltet werden und dann mit 4,2kW geladen. Bei deinem Vorschlag würde erst bei 9,6kW hochgeschaltet werden und der Überschuss zwischen 4,2 und 9,6kW ins Netz eingespeist werden. Der Gedanke hinter Automatik ist aber doch, möglichst so die Phasen zu schalten, dass möglichst viel Überschuss ins Auto geht.
There was a problem hiding this comment.
Sollte jetzt passen?
There was a problem hiding this comment.
Mmh, ich dachte, dass Du die Änderungen in set_control_parameter komplett rausnimmst. So sind wir jetzt wieder bei dem Bug von oben "Lastmanagement schaltet komplett ab statt mit weniger zu laden". Und es wird auch erst hochgeschaltet, wenn der Min-SoC-Current auch für 3 Phasen erreicht ist und damit Überschuss eingespeist.
Also ich denke, dass die einzige Änderung am Python-Code das Speichern der reservierten Leistung ist statt diese immer neu zu berechnen.
für die Umschaltschwellen muss nichts geändert werden, dass wurde von Mindest-Strom im PV-Laden schon genutzt und sollte so passen.
There was a problem hiding this comment.
Sorry, missverständnis auf meiner Seite, jetzt okay?
There was a problem hiding this comment.
Der Merge-Status hängt, ich schließe und öffne den PR wieder.
|
Koala-Teil getestet: Der "Automatik"-Button erscheint bei "Anzahl Phasen Mindest-SoC", wird korrekt hervorgehoben und setzt phases_to_use_min_soc im Ladeprofil auf 0. Von Koala-Seite passt das so 👍 |
There was a problem hiding this comment.
Linked issues
#4005 Feature Request: "Mindest-Soc" so anpassen, dass kein PV-Überschuss eingespeist wird · 0 of 1 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Make minimum-SoC charging optionally treat its configured current as a lower bound and use available PV surplus in addition to it. | 🟡 Partly met | The new Automatik option enables phase switching during minimum-SoC charging, but the configured minimum-SoC current is not used as the lower bound for that switching or for additional surplus charging. |
| required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 - | ||
| self.ev_template.data.max_current_single_phase * 230) |
There was a problem hiding this comment.
🟠 High · Minimum current is not preserved
The change enables automatic phase selection, but it still bases switching power on control_parameter.min_current, which is the vehicle's general minimum current rather than the configured AC/DC minimum-SoC current. Consequently, minimum-SoC charging does not get the requested lower-bound behavior, and a phase switch can use a current below that configured minimum; there is also no choice between fixed-current and lower-bound behavior.
Prompt for AI agents
In `packages/control/ev/ev.py` at lines 324-325:
**Minimum current is not preserved**
The change enables automatic phase selection, but it still bases switching power on `control_parameter.min_current`, which is the vehicle's general minimum current rather than the configured AC/DC minimum-SoC current. Consequently, minimum-SoC charging does not get the requested lower-bound behavior, and a phase switch can use a current below that configured minimum; there is also no choice between fixed-current and lower-bound behavior.From #4005:
Make minimum-SoC charging optionally treat its configured current as a lower bound and use available PV surplus in addition to it.
Reviewer's GuideAdds an automatic phase-selection option for minimum-SoC charging by reusing the existing delayed phase-switch mechanism with the minimum-SoC current as its floor, while persisting the exact reserved switching power to prevent reservation drift when parameters change mid-switch. The option is added to all listed UI themes and covered by focused unit tests. Sequence diagram for automatic minimum-SoC phase switchingsequenceDiagram
participant Controller as ChargepointController
participant EV as EV
participant Counter as EVUCounter
participant Control as ControlParameter
Controller->>Control: set min_current to min_soc_current
Controller->>EV: auto_phase_switch(control_parameter)
EV->>Counter: get_usable_surplus()
alt phase switch required
EV->>Control: set reserved_power
EV->>Counter: reserve reserved_power
EV-->>Controller: PHASE_SWITCH_DELAY
else delay completed
EV->>Counter: release reserved_power
EV->>Control: set phases_to_use and current
EV-->>Controller: PHASE_SWITCH_AWAITED
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 7 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/control/ev/ev.py" line_range="324-325" />
<code_context>
direction_str = f"Umschaltung von 1 auf {max_phases}"
- required_reserved_power = (control_parameter.min_current * max_phases * 230 -
- self.ev_template.data.max_current_single_phase * 230)
+ required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -
+ self.ev_template.data.max_current_single_phase * 230)
new_phase = max_phases
</code_context>
<issue_to_address>
**Minimum-SoC current floor is lost**
When minimum-SoC charging uses automatic phase selection and its configured current exceeds the vehicle’s general minimum, `set_control_parameter()` puts the vehicle’s general minimum in `min_current`, which `auto_phase_switch()` uses for the switch threshold and target current. The switch can therefore charge below the configured minimum-SoC current.
Use the configured minimum-SoC current for the automatic switch threshold and target during minimum-SoC charging.
Also at `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/standard_legacy/web/index.html:959-960`.
</issue_to_address>
### Comment 2
<location path="packages/control/ev/ev.py" line_range="448" />
<code_context>
data.data.counter_all_data.get_evu_counter(
- ).data.set.reserved_surplus -= max(0, required_reserved_power)
+ ).data.set.reserved_surplus -= control_parameter.reserved_power
+ control_parameter.reserved_power = 0
phases_to_use = new_phase
current = new_current
</code_context>
<issue_to_address>
**Reserved surplus remains unavailable**
When a 1-to-3-phase delay has reserved power and the phase count changes from 1 before `reset_phase_switch_delay()` runs, `reset_phase_switch_delay()` releases and clears the reservation only when `control_parameter.phases == 1`, even though the charge-point update changes phases first. The reservation remains in `reserved_surplus`, reducing the surplus available to other charge points.
Release `reserved_power` and clear the delay reservation regardless of the current phase count.
Also at `packages/control/chargepoint/chargepoint.py:191`, `packages/control/chargepoint/chargepoint.py:667`, `packages/control/ev/ev.py:449`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/web_themes/standard_legacy/web/index.html:960`.
</issue_to_address>
### Comment 3
<location path="packages/control/chargepoint/chargepoint.py" line_range="667" />
<code_context>
if self.chargemode_changed or self.submode_changed:
data.data.counter_all_data.get_evu_counter().reset_switch_on_off(self)
- charging_ev.reset_phase_switch_delay(self.data.control_parameter, self.get_max_phase_hw())
+ charging_ev.reset_phase_switch_delay(self.data.control_parameter)
if self.chargemode_changed:
self.data.control_parameter.failed_phase_switches = 0
</code_context>
<issue_to_address>
**Disabled automation strands phase delay**
When the automatic minimum-SoC phase option is changed to a fixed phase while an automatic phase-switch delay is active, `_check_auto_phase_switch_delay()` stops servicing the delay once `template_phases` is no longer 0, while `Chargepoint.update()` calls `reset_phase_switch_delay()` only when the chargemode or submode changes. Changing the minimum-SoC phase selection from automatic to a fixed option during a delay therefore leaves the charge point in `PHASE_SWITCH_DELAY` with its surplus reservation held; the requested phase switch never completes.
Cancel and release an active automatic phase-switch delay when the selected phase mode changes away from automatic.
</issue_to_address>
### Comment 4
<location path="packages/control/ev/ev.py" line_range="388-389" />
<code_context>
else:
data.data.counter_all_data.get_evu_counter(
- ).data.set.reserved_surplus -= max(0, required_reserved_power)
+ ).data.set.reserved_surplus -= control_parameter.reserved_power
+ control_parameter.reserved_power = 0
phases_to_use = new_phase
current = new_current
</code_context>
<issue_to_address>
**Restored reservations are not released**
When a restart or upgrade restores a pending phase-switch delay created before `reserved_power` existed, `reserved_power` defaults to zero, so the timeout and reset paths subtract zero instead of the existing reservation from `reserved_surplus`. Usable surplus remains understated after the delay ends or is cancelled.
Provide a compatibility fallback or migration that restores the prior reservation amount before the timeout and reset paths release it.
Also at `packages/control/ev/ev.py:447-449`, `packages/control/chargepoint/control_parameter.py:24`.
</issue_to_address>
### Comment 5
<location path="packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue" line_range="1036" />
<code_context>
+ pytest.param(6901, True, id="Überschuss reicht für min_current auf allen Phasen: umschalten"),
+ pytest.param(5000, False, id="Überschuss reicht nicht für min_current auf allen Phasen: nicht umschalten"),
+ ],
+)
+def test_check_phase_switch_conditions_required_surplus_based_on_min_current(surplus, expected_condition):
+ """ required_surplus muss auf control_parameter.min_current basieren. """
</code_context>
<issue_to_address>
**Automatik selection is ignored**
When a user selects Automatik in the Cards theme, the `selected_phases &&` guard rejects the selected value `0`, so `setChargePointConnectedVehiclePvChargingMinSocPhases()` does not update the saved phase selection.
Change the guard to accept `0` as a valid selection.
</issue_to_address>
### Comment 6
<location path="packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue" line_range="1039" />
<code_context>
+ )
+ "
+ >
+ Automatik
+ </i-button>
</i-button-group>
</code_context>
<issue_to_address>
**Automatic option is absent in served themes**
When the PR is deployed using the checked-in web assets without a separate frontend build, the deployed pages load the prebuilt files under `web/`, not these edited source components, so without rebuilding and including those files the new buttons do not appear to users.
Rebuild and include the generated web assets for each theme whose source changes in this PR.
Also at `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`.
</issue_to_address>
### Comment 7
<location path="packages/control/ev/ev.py" line_range="324" />
<code_context>
direction_str = f"Umschaltung von 1 auf {max_phases}"
- required_reserved_power = (control_parameter.min_current * max_phases * 230 -
- self.ev_template.data.max_current_single_phase * 230)
+ required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 -
+ self.ev_template.data.max_current_single_phase * 230)
</code_context>
<issue_to_address>
**Use surplus above minimum**
The change adds automatic phase switching, but does not make available PV surplus raise the charging current above the minimum-SoC current. Thus the requested lower-bound behavior—and the choice between that behavior and a fixed minimum-SoC current—is still missing.
</issue_to_address>Linked issues
#4005 Feature Request: "Mindest-Soc" so anpassen, dass kein PV-Überschuss eingespeist wird · 0 of 1 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Use available PV surplus during minimum-SoC charging while keeping the configured minimum-SoC current as a lower bound, with a choice to keep it fixed. | 🟡 Partly met | The new Automatik option can switch phases, but minimum-SoC charging still sets a fixed required current and does not use surplus to raise it; the charge point’s min_current also remains the vehicle’s general minimum. |
Sourcery assessment
Approval pending. 7 findings to address first.
Blocking findings: packages/control/ev/ev.py:325, packages/control/ev/ev.py:448, packages/control/chargepoint/chargepoint.py:667, packages/control/ev/ev.py:389, packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1036, and 2 more
| required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 - | ||
| self.ev_template.data.max_current_single_phase * 230) |
There was a problem hiding this comment.
🟠 High · Minimum-SoC current floor is lost
When minimum-SoC charging uses automatic phase selection and its configured current exceeds the vehicle’s general minimum, set_control_parameter() puts the vehicle’s general minimum in min_current, which auto_phase_switch() uses for the switch threshold and target current. The switch can therefore charge below the configured minimum-SoC current.
Use the configured minimum-SoC current for the automatic switch threshold and target during minimum-SoC charging.
Also at packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120, packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039, packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82, packages/modules/web_themes/standard_legacy/web/index.html:959-960.
Prompt for AI agents
In `packages/control/ev/ev.py` at lines 324-325:
**Minimum-SoC current floor is lost**
When minimum-SoC charging uses automatic phase selection and its configured current exceeds the vehicle’s general minimum, `set_control_parameter()` puts the vehicle’s general minimum in `min_current`, which `auto_phase_switch()` uses for the switch threshold and target current. The switch can therefore charge below the configured minimum-SoC current.
Use the configured minimum-SoC current for the automatic switch threshold and target during minimum-SoC charging.
Also at `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/standard_legacy/web/index.html:959-960`.| reserved = max(0, control_parameter.min_current * max_phases * 230 - | ||
| self.ev_template.data.max_current_single_phase * 230) | ||
| reserved = control_parameter.reserved_power | ||
| control_parameter.reserved_power = 0 |
There was a problem hiding this comment.
🟡 Medium · Reserved surplus remains unavailable
When a 1-to-3-phase delay has reserved power and the phase count changes from 1 before reset_phase_switch_delay() runs, reset_phase_switch_delay() releases and clears the reservation only when control_parameter.phases == 1, even though the charge-point update changes phases first. The reservation remains in reserved_surplus, reducing the surplus available to other charge points.
Release reserved_power and clear the delay reservation regardless of the current phase count.
Also at packages/control/chargepoint/chargepoint.py:191, packages/control/chargepoint/chargepoint.py:667, packages/control/ev/ev.py:449, packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039, packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82, packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120, packages/modules/web_themes/standard_legacy/web/index.html:960.
Prompt for AI agents
In `packages/control/ev/ev.py` at line 448:
**Reserved surplus remains unavailable**
When a 1-to-3-phase delay has reserved power and the phase count changes from 1 before `reset_phase_switch_delay()` runs, `reset_phase_switch_delay()` releases and clears the reservation only when `control_parameter.phases == 1`, even though the charge-point update changes phases first. The reservation remains in `reserved_surplus`, reducing the surplus available to other charge points.
Release `reserved_power` and clear the delay reservation regardless of the current phase count.
Also at `packages/control/chargepoint/chargepoint.py:191`, `packages/control/chargepoint/chargepoint.py:667`, `packages/control/ev/ev.py:449`, `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue:1039`, `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`, `packages/modules/web_themes/standard_legacy/web/index.html:960`.| if self.chargemode_changed or self.submode_changed: | ||
| data.data.counter_all_data.get_evu_counter().reset_switch_on_off(self) | ||
| charging_ev.reset_phase_switch_delay(self.data.control_parameter, self.get_max_phase_hw()) | ||
| charging_ev.reset_phase_switch_delay(self.data.control_parameter) |
There was a problem hiding this comment.
🟡 Medium · Disabled automation strands phase delay
When the automatic minimum-SoC phase option is changed to a fixed phase while an automatic phase-switch delay is active, _check_auto_phase_switch_delay() stops servicing the delay once template_phases is no longer 0, while Chargepoint.update() calls reset_phase_switch_delay() only when the chargemode or submode changes. Changing the minimum-SoC phase selection from automatic to a fixed option during a delay therefore leaves the charge point in PHASE_SWITCH_DELAY with its surplus reservation held; the requested phase switch never completes.
Cancel and release an active automatic phase-switch delay when the selected phase mode changes away from automatic.
Prompt for AI agents
In `packages/control/chargepoint/chargepoint.py` at line 667:
**Disabled automation strands phase delay**
When the automatic minimum-SoC phase option is changed to a fixed phase while an automatic phase-switch delay is active, `_check_auto_phase_switch_delay()` stops servicing the delay once `template_phases` is no longer 0, while `Chargepoint.update()` calls `reset_phase_switch_delay()` only when the chargemode or submode changes. Changing the minimum-SoC phase selection from automatic to a fixed option during a delay therefore leaves the charge point in `PHASE_SWITCH_DELAY` with its surplus reservation held; the requested phase switch never completes.
Cancel and release an active automatic phase-switch delay when the selected phase mode changes away from automatic.| ).data.set.reserved_surplus -= control_parameter.reserved_power | ||
| control_parameter.reserved_power = 0 |
There was a problem hiding this comment.
🟡 Medium · Restored reservations are not released
When a restart or upgrade restores a pending phase-switch delay created before reserved_power existed, reserved_power defaults to zero, so the timeout and reset paths subtract zero instead of the existing reservation from reserved_surplus. Usable surplus remains understated after the delay ends or is cancelled.
Provide a compatibility fallback or migration that restores the prior reservation amount before the timeout and reset paths release it.
Also at packages/control/ev/ev.py:447-449, packages/control/chargepoint/control_parameter.py:24.
Prompt for AI agents
In `packages/control/ev/ev.py` at lines 388-389:
**Restored reservations are not released**
When a restart or upgrade restores a pending phase-switch delay created before `reserved_power` existed, `reserved_power` defaults to zero, so the timeout and reset paths subtract zero instead of the existing reservation from `reserved_surplus`. Usable surplus remains understated after the delay ends or is cancelled.
Provide a compatibility fallback or migration that restores the prior reservation amount before the timeout and reset paths release it.
Also at `packages/control/ev/ev.py:447-449`, `packages/control/chargepoint/control_parameter.py:24`.| setChargePointConnectedVehiclePvChargingMinSocPhases( | ||
| modalChargePointId, | ||
| 0, | ||
| ) |
There was a problem hiding this comment.
🟡 Medium · Automatik selection is ignored
When a user selects Automatik in the Cards theme, the selected_phases && guard rejects the selected value 0, so setChargePointConnectedVehiclePvChargingMinSocPhases() does not update the saved phase selection.
Change the guard to accept 0 as a valid selection.
Prompt for AI agents
In `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue` at line 1036:
**Automatik selection is ignored**
When a user selects Automatik in the Cards theme, the `selected_phases &&` guard rejects the selected value `0`, so `setChargePointConnectedVehiclePvChargingMinSocPhases()` does not update the saved phase selection.
Change the guard to accept `0` as a valid selection.| ) | ||
| " | ||
| > | ||
| Automatik |
There was a problem hiding this comment.
🟠 High · Automatic option is absent in served themes
When the PR is deployed using the checked-in web assets without a separate frontend build, the deployed pages load the prebuilt files under web/, not these edited source components, so without rebuilding and including those files the new buttons do not appear to users.
Rebuild and include the generated web assets for each theme whose source changes in this PR.
Also at packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82, packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120.
Prompt for AI agents
In `packages/modules/display_themes/cards/source/src/views/ChargePointsView.vue` at line 1039:
**Automatic option is absent in served themes**
When the PR is deployed using the checked-in web assets without a separate frontend build, the deployed pages load the prebuilt files under `web/`, not these edited source components, so without rebuilding and including those files the new buttons do not appear to users.
Rebuild and include the generated web assets for each theme whose source changes in this PR.
Also at `packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/ConfigPv.vue:82`, `packages/modules/web_themes/koala/source/src/components/ChargePointPvSettings.vue:120`.| direction_str = f"Umschaltung von 1 auf {max_phases}" | ||
| required_reserved_power = (control_parameter.min_current * max_phases * 230 - | ||
| self.ev_template.data.max_current_single_phase * 230) | ||
| required_reserved_power = max(0, control_parameter.min_current * max_phases * 230 - |
There was a problem hiding this comment.
🟠 High · Use surplus above minimum
The change adds automatic phase switching, but does not make available PV surplus raise the charging current above the minimum-SoC current. Thus the requested lower-bound behavior—and the choice between that behavior and a fixed minimum-SoC current—is still missing.
Prompt for AI agents
In `packages/control/ev/ev.py` at line 324:
**Use surplus above minimum**
The change adds automatic phase switching, but does not make available PV surplus raise the charging current above the minimum-SoC current. Thus the requested lower-bound behavior—and the choice between that behavior and a fixed minimum-SoC current—is still missing.From #4005:
Use available PV surplus during minimum-SoC charging while keeping the configured minimum-SoC current as a lower bound, with a choice to keep it fixed.
Feature Request: #4005
UI: openWB/openwb-ui-settings#1119
Was
Ergänzt die bisher nicht vorhandene "Automatik"-Option für die Phasenwahl beim Mindest-SoC (
phases_to_use_min_soc), analog zur bereits vorhandenen Automatik bei PV-Ladeziel und Eco-Laden.Hintergrund: siehe #3989 und #4005 - bisher musste man sich bei aktivem Mindest-SoC fest für 1 oder 3 Phasen entscheiden. Mit Automatik bleibt der konfigurierte Mindest-SoC-Ladestrom als feste Untergrenze bestehen, Phasen werden aber automatisch hoch- bzw. runtergeschaltet, wenn mehr bzw. weniger Überschuss verfügbar ist - der Strom selbst wird dabei nicht unter den Mindest-SoC-Ladestrom reduziert.
Umsetzung
Die bereits bestehende automatische Phasenumschaltung (
_check_auto_phase_switch_delay()/auto_phase_switch()) wird unverändert wiederverwendet - sie läuft für jeden Ladepunkt mittemplate_phases == 0, unabhängig vom Lademodus. Sie nutztcontrol_parameter.min_currentbereits als Untergrenze für beide Phasenzahlen. Einzige Änderung:min_currentwird während aktiver Mindest-SoC-Ladung aufmin_soc_current/dc_min_soc_currentgesetzt statt auf den allgemeinen Mindeststrom des Fahrzeugs. Keine neue Umschaltlogik.Zusätzlich gefunden und mitbehoben:
min_currentdarf sich nicht ändern, während eine automatische Phasenumschaltung bereits läuft (Umschaltverzögerung), daauto_phase_switch()die zu reservierende/freizugebende Leistung bei jedem Aufruf frisch daraus berechnet - ein Wechsel mittendrin hättereserved_surplusdauerhaft verfälscht. Das war vorher nie erreichbar, weilmin_currentwährend einer Session nie geändert wurde - erst durch diese Änderung wird genau dieser Fall möglich.Test
Unit-Tests für beide Fälle. Zusätzlich live mit einem Testsystem und dem Simulator über MQTT durchgespielt: Laden unterhalb Mindest-SoC mit wenig Überschuss (1 Phase, Strom bleibt am Mindest-SoC-Strom), mit viel Überschuss (automatische Umschaltung auf 3 Phasen), Rückschaltung bei sinkendem Überschuss, sowie der kritische Fall - Mindest-SoC wird exakt während einer laufenden Umschaltung erreicht - sauber ohne Fehler oder hängenbleibende Reservierung.
Frontend
@Brett-S-OWB @cshagen könnt ihr bitte kurz über die Koala- bzw. Colors-Integration schauen? Hab das alles mit in den PR hier mit rein. Jeweils im Colors und Koala/Display Theme den Automatik Button ergänzt. Hab ich aber nicht live getestet, nur im UI Repo hab ich ein Built gemacht.
Alternativ kann ich es auch aus dem PR loslösen, wenn ihr das selbst mitmachen wollt?
Summary by Sourcery
Enable automatic phase selection during minimum-SoC charging while preserving the configured minimum charging current and reservation state.
New Features:
Bug Fixes:
Enhancements:
Tests: