Skip to content

scheduled charging: increase buffer time by soc request interval after charge start#3160

Open
LKuemmel wants to merge 2 commits intoopenWB:masterfrom
LKuemmel:fixes
Open

scheduled charging: increase buffer time by soc request interval after charge start#3160
LKuemmel wants to merge 2 commits intoopenWB:masterfrom
LKuemmel:fixes

Conversation

@LKuemmel
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modifies the scheduled charging logic to conditionally apply the soc_request_interval_offset based on whether charging has started and the type of charging plan. The change addresses timing precision in scheduled charging by differentiating between SOC-based and amount-based charging plans.

Changes:

  • Added charge_state parameter to track whether the chargepoint is actively charging
  • Modified logic to exclude soc_request_interval_offset for amount-based plans before charging starts
  • Updated all test calls to include the new parameter (all with value True)

Reviewed changes

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

File Description
packages/control/ev/ev.py Added charge_state parameter to get_required_current method signature and forwarded it to scheduled charging logic
packages/control/ev/charge_template.py Added conditional logic to set soc_request_interval_offset to 0 for non-SOC plans when charging hasn't started
packages/control/ev/charge_template_test.py Updated all test calls to include the new charge_state parameter
packages/control/chargepoint/chargepoint.py Passed self.data.get.charge_state to the get_required_current method
Comments suppressed due to low confidence (1)

packages/control/ev/ev.py:142

  • The docstring should be updated to document the new charge_state parameter. Add a description explaining that it indicates whether charging is currently active, which affects how the soc_request_interval_offset is applied in scheduled charging calculations.
        """ ermittelt, ob und mit welchem Strom das EV geladen werden soll (unabhängig vom Lastmanagement)

        Parameter
        ---------
        imported_since_mode_switch: float
            seit dem letzten Lademodi-Wechsel geladene Energie.
        Return
        ------
        state: bool
            Soll geladen werden?
        message: str
            Nachricht, warum nicht geladen werden soll
        submode: str
            Lademodus, in dem tatsächlich geladen wird
        required_current: int
            Strom, der nach Ladekonfiguration benötigt wird
        """

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

Comment on lines 279 to 291
@@ -288,7 +288,7 @@ def test_scheduled_charging_calc_current_no_plans():

# execution
ret = ct.scheduled_charging_calc_current(
None, 63, 5, 3, 3, 6, 0, ChargingType.AC.value, EvTemplate(), BidiState.BIDI_CAPABLE)
None, 63, 5, 3, 3, 6, 0, ChargingType.AC.value, EvTemplate(), BidiState.BIDI_CAPABLE, True)
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All existing tests use charge_state=True. Consider adding test cases with charge_state=False and plan.limit.selected="amount" to verify the new logic at line 561-564 of charge_template.py that sets soc_request_interval_offset to 0 for amount-based plans before charging starts. This would ensure the conditional behavior works correctly for both SOC and amount-based plans.

Copilot uses AI. Check for mistakes.
Comment on lines +562 to +563
# das Abfrageintervall nur einbeziehen, wenn die Ladung bereits gestartet wurde, sonst wird einfach alles
# um das Abfrageintervall früher gestartet, und nicht die Pufferzeit um das Abfrageintervall erhöht.
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment could be more specific to clarify that this logic applies only to non-SOC plans. Consider rephrasing to: "Für Pläne ohne SoC-Begrenzung das Abfrageintervall nur einbeziehen, wenn die Ladung bereits gestartet wurde. Bei SoC-basierten Plänen wird das Abfrageintervall immer berücksichtigt, da der SoC-Wert unabhängig vom Ladezustand veraltet sein kann." This makes it clear that SOC plans always use the offset while amount plans only use it after charging starts.

Suggested change
# das Abfrageintervall nur einbeziehen, wenn die Ladung bereits gestartet wurde, sonst wird einfach alles
# um das Abfrageintervall früher gestartet, und nicht die Pufferzeit um das Abfrageintervall erhöht.
# Für Pläne ohne SoC-Begrenzung das Abfrageintervall nur einbeziehen, wenn die Ladung bereits gestartet
# wurde. Bei SoC-basierten Plänen wird das Abfrageintervall immer berücksichtigt, da der SoC-Wert
# unabhängig vom Ladezustand veraltet sein kann.

Copilot uses AI. Check for mistakes.
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