Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions packages/control/algorithm/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from control.algorithm import common
from control.algorithm.additional_current import AdditionalCurrent
from control.algorithm.bidi_charging import Bidi
from control.algorithm.filter_chargepoints import filtered_loads_to_str, group_loads_generator
from control.algorithm.filter_chargepoints import filter_active_loads, filtered_loads_to_str, group_loads_generator
from control.algorithm.min_current import MinCurrent
from control.algorithm.no_current import NoCurrent
from control.algorithm.surplus_controlled import SurplusControlled
Expand Down Expand Up @@ -33,6 +33,9 @@ def calc_current(self) -> None:
for cp in data.data.cp_data.values():
cp.reset_values_before_algorithm()
for grouped_loads in group_loads_generator():
grouped_loads = filter_active_loads(grouped_loads)
if len(grouped_loads) == 0:
continue
log.info(f"Gruppe {filtered_loads_to_str(grouped_loads)}")
log.info("**Mindestrom setzen**")
self.min_current.set_min_current(grouped_loads)
Expand All @@ -47,9 +50,9 @@ def calc_current(self) -> None:
self.surplus_controlled.set_surplus_current(grouped_loads)
else:
log.info("Keine Leistung für PV-geführtes Laden übrig.")
log.info("**Bidi-(Ent-)Lade-Strom setzen**")
counter.set_raw_surplus_power_left()
# Nullpunktausregelung, nachdem für alle anderen Ladepunkte der Soll-Strom feststeht
log.info("**Bidi-(Ent-)Lade-Strom setzen**")
counter.set_raw_surplus_power_left()
self.bidi.set_bidi()
self.no_current.set_no_current()
self.no_current.set_none_current()
Expand Down
3 changes: 1 addition & 2 deletions packages/control/algorithm/filter_chargepoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def filter_grouped_loads_by_mode_and_counter(grouped_loads: List[Load],
filtered_grouped_loads = list(grouped_loads)

filtered_grouped_loads = filter_loads_by_chargemodes(filtered_grouped_loads, chargemodes)
filtered_grouped_loads = _filter_active_loads(filtered_grouped_loads)

loads_to_counter = data.data.counter_all_data.get_loads_of_counter(counter)
# nur die Zahl aus dem String "cp1" und "consumer2" extrahieren
Expand Down Expand Up @@ -60,7 +59,7 @@ def filter_loads_by_chargemodes(grouped_loads: List[Load],
return filtered_grouped_loads


def _filter_active_loads(grouped_loads: List[Load]) -> List[Load]:
def filter_active_loads(grouped_loads: List[Load]) -> List[Load]:
active_loads: List[Load] = []
for load in grouped_loads:
if load.data.control_parameter.required_current != 0:
Expand Down
2 changes: 1 addition & 1 deletion packages/control/algorithm/filter_chargepoints_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_filter_active_loads_removes_loads_with_zero_required_current(
mock_consumer3.data.control_parameter.required_current = 1

# evaluation
active_loads = filter_chargepoints._filter_active_loads([mock_cp1, mock_cp2, mock_consumer3])
active_loads = filter_chargepoints.filter_active_loads([mock_cp1, mock_cp2, mock_consumer3])

# assertion
assert active_loads == [mock_cp2, mock_consumer3]
Loading