Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

precise phase switch conditions for 2 phase charging #1875

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/control/chargepoint/chargepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,20 @@ def initiate_control_pilot_interruption(self):
except Exception:
log.exception("Fehler in der Ladepunkt-Klasse von "+str(self.num))

def check_deviating_contactor_states(self, phase_a: int, phase_b: int) -> bool:
return (phase_a == 1 and phase_b in [2, 3]) or (phase_b == 1 and phase_a in [2, 3])

def _is_phase_switch_required(self) -> bool:
phase_switch_required = False
# Manche EVs brauchen nach der Umschaltung mehrere Zyklen, bis sie mit den drei Phasen laden. Dann darf
# nicht zwischendurch eine neue Umschaltung getriggert werden.
if (self.data.control_parameter.state == ChargepointState.CHARGING_ALLOWED or
self.data.control_parameter.state == ChargepointState.PHASE_SWITCH_DELAY_EXPIRED):
# Nach Ablauf der Laden aktiv halten Zeit, sollte mit der vorgegebenen Phasenzahl geladen werden.
if ((self.data.set.phases_to_use != self.data.get.phases_in_use or
if ((self.check_deviating_contactor_states(self.data.set.phases_to_use, self.data.get.phases_in_use) or
# Vorgegebene Phasenzahl hat sich geändert
self.data.set.phases_to_use != self.data.control_parameter.phases) and
self.check_deviating_contactor_states(self.data.set.phases_to_use,
self.data.control_parameter.phases)) and
# Wenn ein Soll-Strom vorgegeben ist, muss das Auto auch laden, damit umgeschaltet wird, sonst
# wird zB bei automatischer Umschaltung ständig versucht auf 1 Phase zurück zu schalten, wenn
# das Auto bei 3 Phasen voll ist.
Expand All @@ -386,9 +390,10 @@ def _is_phase_switch_required(self) -> bool:
self.data.set.current == 0)):
phase_switch_required = True
if (self.data.control_parameter.state == ChargepointState.NO_CHARGING_ALLOWED and
(self.data.set.phases_to_use != self.data.get.phases_in_use or
(self.check_deviating_contactor_states(self.data.set.phases_to_use, self.data.get.phases_in_use) or
# Vorgegebene Phasenzahl hat sich geändert
self.data.set.phases_to_use != self.data.control_parameter.phases) and
self.check_deviating_contactor_states(self.data.set.phases_to_use,
self.data.control_parameter.phases)) and
# Wenn der Ladevorgang gestartet wird, muss vor dem ersten Laden umgeschaltet werden.
self.data.set.current != 0):
phase_switch_required = True
Expand Down