Skip to content

Commit

Permalink
fix pv 3p1p failed phase switch
Browse files Browse the repository at this point in the history
  • Loading branch information
LKuemmel committed Jan 24, 2025
1 parent 8996d1b commit 57627c2
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/control/chargepoint/chargepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,7 @@ def _is_phase_switch_required(self) -> bool:
# Umschaltung fehlgeschlagen
if self.data.set.phases_to_use != self.data.get.phases_in_use:
if data.data.general_data.data.chargemode_config.retry_failed_phase_switches:
if self.data.control_parameter.failed_phase_switches <= self.MAX_FAILED_PHASE_SWITCHES:
self.data.control_parameter.failed_phase_switches += 1
else:
if self.data.control_parameter.failed_phase_switches > self.MAX_FAILED_PHASE_SWITCHES:
phase_switch_required = False
self.set_state_and_log(
"Keine Phasenumschaltung, da die maximale Anzahl an Fehlversuchen erreicht wurde. Die "
Expand All @@ -396,6 +394,7 @@ def _is_phase_switch_required(self) -> bool:
"Keine Phasenumschaltung, da wiederholtes Anstoßen der Umschaltung in den übergreifenden "
"Ladeeinstellungen deaktiviert wurde. Die aktuelle "
"Phasenzahl wird bis zum Abstecken beibehalten.")
self.data.control_parameter.failed_phase_switches += 1
return phase_switch_required

STOP_CHARGING = ", dafür wird die Ladung unterbrochen."
Expand Down Expand Up @@ -828,11 +827,19 @@ def cp_ev_chargemode_support_phase_switch(self) -> bool:
control_parameter.submode == Chargemode.PV_CHARGING and
data.data.general_data.get_phases_chargemode(Chargemode.SCHEDULED_CHARGING.value,
control_parameter.submode) == 0)
if ((data.data.general_data.data.chargemode_config.retry_failed_phase_switches and
self.data.control_parameter.failed_phase_switches > self.MAX_FAILED_PHASE_SWITCHES) or
(data.data.general_data.data.chargemode_config.retry_failed_phase_switches is False and
self.data.control_parameter.failed_phase_switches == 1)):
failed_phase_switches_reached = True
else:
failed_phase_switches_reached = False
return (self.cp_ev_support_phase_switch() and
self.data.get.charge_state and
(pv_auto_switch or scheduled_auto_switch) and
control_parameter.state == ChargepointState.CHARGING_ALLOWED or
control_parameter.state == ChargepointState.PHASE_SWITCH_DELAY)
(control_parameter.state == ChargepointState.CHARGING_ALLOWED or
control_parameter.state == ChargepointState.PHASE_SWITCH_DELAY) and
failed_phase_switches_reached is False)

def cp_ev_support_phase_switch(self) -> bool:
return (self.data.config.auto_phase_switch_hw and
Expand Down

0 comments on commit 57627c2

Please sign in to comment.