Skip to content

Commit 708114c

Browse files
authored
fix CURRENT_OUT_OF_NOMINAL_DIFFERENCE message (#2823)
1 parent 9a183dc commit 708114c

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

packages/control/algorithm/algorithm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def _check_auto_phase_switch_delay(self) -> None:
6969
cp.data.set.charge_template,
7070
cp.data.control_parameter,
7171
cp.num,
72+
cp.data.get.evse_current,
7273
cp.data.get.currents,
7374
cp.data.get.power,
7475
cp.template.data.max_current_single_phase,

packages/control/auto_phase_switch_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def test_auto_phase_switch(monkeypatch, vehicle: Ev, params: Params):
138138
phases_to_use, current, message = vehicle.auto_phase_switch(ChargeTemplate(),
139139
control_parameter,
140140
0,
141+
max(params.get_currents),
141142
params.get_currents,
142143
params.get_power,
143144
32,

packages/control/ev/ev.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,16 @@ def check_min_max_current(self,
257257
def _check_phase_switch_conditions(self,
258258
charge_template: ChargeTemplate,
259259
control_parameter: ControlParameter,
260+
evse_current: float,
260261
get_currents: List[float],
261262
get_power: float,
262263
max_current_cp: int,
263264
limit: LoadmanagementLimit) -> Tuple[bool, Optional[str]]:
264265
# Manche EV laden mit 6.1A bei 6A Soll-Strom
265-
min_current = (max(control_parameter.min_current, control_parameter.required_current) +
266-
self.ev_template.data.nominal_difference)
267-
max_current = (min(self.ev_template.data.max_current_single_phase, max_current_cp)
268-
- self.ev_template.data.nominal_difference)
266+
min_current = max(control_parameter.min_current, control_parameter.required_current)
267+
min_current_range = min_current + self.ev_template.data.nominal_difference
268+
max_current = min(self.ev_template.data.max_current_single_phase, max_current_cp)
269+
max_current_range = max_current - self.ev_template.data.nominal_difference
269270
phases_in_use = control_parameter.phases
270271
pv_config = data.data.general_data.data.chargemode_config.pv_charging
271272
max_phases_ev = self.ev_template.data.max_phases
@@ -276,27 +277,33 @@ def _check_phase_switch_conditions(self,
276277
all_surplus = data.data.counter_all_data.get_evu_counter().get_usable_surplus(feed_in_yield)
277278
required_surplus = control_parameter.min_current * max_phases_ev * 230 - get_power
278279
unbalanced_load_limit_reached = limit.limiting_value == LimitingValue.UNBALANCED_LOAD
279-
condition_1_to_3 = (((get_medium_charging_current(get_currents) > max_current and
280+
condition_1_to_3 = (((get_medium_charging_current(get_currents) > max_current_range and
280281
all_surplus > required_surplus) or unbalanced_load_limit_reached) and
281282
phases_in_use == 1)
282283
condition_3_to_1 = get_medium_charging_current(
283-
get_currents) < min_current and all_surplus <= 0 and phases_in_use > 1
284+
get_currents) < min_current_range and all_surplus <= 0 and phases_in_use > 1
284285
if condition_1_to_3 or condition_3_to_1:
285286
return True, None
286287
else:
287288
if phases_in_use > 1 and all_surplus > 0:
289+
# genug Leistung, um weiter mehrphasig zu laden
288290
return False, self.ENOUGH_POWER
289291
elif phases_in_use == 1 and all_surplus < required_surplus:
292+
# nicht genug Leistung, um mehrphasig zu laden, also einphasig laden
290293
return False, self.NOT_ENOUGH_POWER
291-
else:
294+
elif min_current == evse_current or max_current == evse_current:
295+
# EV lädt nicht mit dem vorgegebenen Strom +/- der erlaubten Abweichung
292296
return False, self.CURRENT_OUT_OF_NOMINAL_DIFFERENCE
297+
else:
298+
return False, None
293299

294300
PHASE_SWITCH_DELAY_TEXT = '{} Phasen in {}.'
295301

296302
def auto_phase_switch(self,
297303
charge_template: ChargeTemplate,
298304
control_parameter: ControlParameter,
299305
cp_num: int,
306+
evse_current: float,
300307
get_currents: List[float],
301308
get_power: float,
302309
max_current_cp: int,
@@ -337,6 +344,7 @@ def auto_phase_switch(self,
337344
if not self.ev_template.data.prevent_phase_switch:
338345
condition, condition_msg = self._check_phase_switch_conditions(charge_template,
339346
control_parameter,
347+
evse_current,
340348
get_currents,
341349
get_power,
342350
max_current_cp,

0 commit comments

Comments
 (0)