Skip to content
Open
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
4 changes: 2 additions & 2 deletions data/config/mosquitto/local/openwb_local.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# openwb-version:19
# openwb-version:20
listener 1886 localhost
allow_anonymous true

Expand Down Expand Up @@ -52,7 +52,7 @@ topic openWB/optional/# out 2

topic openWB/counter/config/# out 2
topic openWB/counter/set/# out 2
topic openWB/counter/get/hierarchy out 2
topic openWB/counter/get/# out 2
topic openWB/counter/+/module/# out 2
topic openWB/counter/+/config/# out 2
topic openWB/counter/+/get/# out 2
Expand Down
2 changes: 1 addition & 1 deletion packages/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from control.counter import Config as CounterConfig
from control.counter import Get as CounterGet
from control.counter import Set as CounterSet
from control.counter_all import CounterAll
from control.counter_all.counter_all import CounterAll
from control.pv import Pv, PvData
from control.pv import Config as PvConfig
from control.pv import Get as PvGet
Expand Down
8 changes: 4 additions & 4 deletions packages/control/algorithm/additional_current.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging

from control import data
from control.algorithm import common
from control.algorithm.chargemodes import CONSIDERED_CHARGE_MODES_ADDITIONAL_CURRENT
from control.limiting_value import LoadmanagementLimit
Expand All @@ -24,9 +25,9 @@ def set_additional_current(self) -> None:
if preferenced_chargepoints:
common.update_raw_data(preferenced_chargepoints)
log.info(f"Mode-Tuple {mode_tuple[0]} - {mode_tuple[1]} - {mode_tuple[2]}, Zähler {counter.num}")
while len(preferenced_chargepoints):
cp = preferenced_chargepoints[0]
missing_currents, counts = common.get_missing_currents_left(preferenced_chargepoints)
for cp, group in data.data.counter_all_data.generator_cps_by_loadmanagement_prios(
preferenced_chargepoints):
missing_currents, counts = common.get_missing_currents_left(group)
available_currents, limit = Loadmanagement().get_available_currents(missing_currents, counter, cp)
log.debug(f"cp {cp.num} available currents {available_currents} missing currents "
f"{missing_currents} limit {limit.message}")
Expand All @@ -40,7 +41,6 @@ def set_additional_current(self) -> None:
cp.data.control_parameter.min_current,
current,
cp)
preferenced_chargepoints.pop(0)
if preferenced_cps_without_set_current:
for cp in preferenced_cps_without_set_current:
cp.data.set.current = cp.data.set.target_current
Expand Down
6 changes: 2 additions & 4 deletions packages/control/algorithm/bidi_charging.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ def set_bidi(self):
if preferenced_cps:
log.info(
f"Mode-Tuple {mode_tuple[0]} - {mode_tuple[1]} - {mode_tuple[2]}, Zähler {grid_counter.num}")
while len(preferenced_cps):
cp = preferenced_cps[0]
zero_point_adjustment = grid_counter.data.set.surplus_power_left / len(preferenced_cps)
for cp, group in data.data.counter_all_data.generator_cps_by_loadmanagement_prios(preferenced_cps):
zero_point_adjustment = grid_counter.data.set.surplus_power_left / len(group)
log.debug(f"Nullpunktanpassung für LP{cp.num}: verbleibende Leistung {zero_point_adjustment}W")
missing_currents = [zero_point_adjustment / cp.data.get.phases_in_use /
230 for i in range(0, cp.data.get.phases_in_use)]
Expand All @@ -43,4 +42,3 @@ def set_bidi(self):
grid_counter.update_surplus_values_left(missing_currents, voltages_mean(cp.data.get.voltages))
cp.data.set.current = missing_currents[0]
log.info(f"LP{cp.num}: Stromstärke {missing_currents}A")
preferenced_cps.pop(0)
2 changes: 1 addition & 1 deletion packages/control/algorithm/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from control.chargepoint.chargepoint import Chargepoint
from control.ev.ev import Ev
from control.counter import Counter
from control.counter_all import CounterAll
from control.counter_all.counter_all import CounterAll
from control.io_device import IoActions


Expand Down
4 changes: 2 additions & 2 deletions packages/control/algorithm/filter_chargepoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_chargepoints_with_required_current_by_chargemode(

def get_preferenced_chargepoint_charging(
chargepoints: List[Chargepoint]) -> Tuple[List[Chargepoint], List[Chargepoint]]:
preferenced_chargepoints = _get_preferenced_chargepoint(chargepoints)
preferenced_chargepoints = get_preferenced_chargepoint(chargepoints)
preferenced_chargepoints_with_set_current = []
preferenced_chargepoints_without_set_current = []
for cp in preferenced_chargepoints:
Expand All @@ -67,7 +67,7 @@ def get_preferenced_chargepoint_charging(
# tested


def _get_preferenced_chargepoint(valid_chargepoints: List[Chargepoint]) -> List:
def get_preferenced_chargepoint(valid_chargepoints: List[Chargepoint]) -> List:
"""ermittelt die Ladepunkte in der Reihenfolge, in der sie geladen/gestoppt werden sollen. Die Bedingungen
sind:
geringste Mindeststromstärke, niedrigster SoC, frühester Ansteck-Zeitpunkt(Einschalten)/Lademenge(Abschalten),
Expand Down
4 changes: 2 additions & 2 deletions packages/control/algorithm/filter_chargepoints_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from control.chargepoint.chargepoint import Chargepoint, ChargepointData
from control.chargepoint.chargepoint_data import Log, Set
from control.chargepoint.control_parameter import ControlParameter
from control.counter_all import CounterAll
from control.counter_all.counter_all import CounterAll
from control.ev.ev import Ev, EvData, Get


Expand Down Expand Up @@ -78,7 +78,7 @@ def mock_cp(cp: Chargepoint, num: int):
cp2 = mock_cp(mock_cp2, 2)
cp3 = mock_cp(mock_cp3, 3)
# execution
preferenced_chargepoints = filter_chargepoints._get_preferenced_chargepoint([cp1, cp2, cp3])
preferenced_chargepoints = filter_chargepoints.get_preferenced_chargepoint([cp1, cp2, cp3])

# evaluation
assert preferenced_chargepoints == params.expected_sort
Expand Down
10 changes: 9 additions & 1 deletion packages/control/algorithm/integration_test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from control.bat_all import BatAll
from control.chargepoint.chargepoint import Chargepoint
from control.chargepoint.chargepoint_template import CpTemplate
from control.counter_all import CounterAll
from control.counter_all.counter_all import CounterAll
from control.counter import Counter
from control.ev.ev import Ev
from control.io_device import IoActions
Expand All @@ -27,6 +27,7 @@ def data_() -> None:
for i in range(3, 6):
data.data.cp_data[f"cp{i}"].template = CpTemplate()
data.data.cp_data[f"cp{i}"].data.config.phase_1 = i-2
data.data.cp_data[f"cp{i}"].data.config.ev = i
data.data.cp_data[f"cp{i}"].data.set.charging_ev_data = Ev(i)
data.data.cp_data[f"cp{i}"].data.set.charging_ev_data.ev_template.data.max_current_single_phase = 32
data.data.cp_data[f"cp{i}"].data.get.plug_state = True
Expand All @@ -49,6 +50,13 @@ def data_() -> None:
data.data.counter_data["counter6"].data.config.max_total_power = 11000
data.data.counter_all_data = CounterAll()
data.data.counter_all_data.data.get.hierarchy = NESTED_HIERARCHY
data.data.counter_all_data.data.get.loadmanagement_prios = [{
"type": "group",
"label": "Fahrzeuge",
"children": [
{"type": "vehicle", "id": 3}, {"type": "vehicle", "id": 4}, {"type": "vehicle", "id": 5}
]
}]
data.data.counter_all_data.data.config.consider_less_charging = True
data.data.io_actions = IoActions()

Expand Down
5 changes: 2 additions & 3 deletions packages/control/algorithm/min_current.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def set_min_current(self) -> None:
if preferenced_chargepoints:
log.info(f"Mode-Tuple {mode_tuple[0]} - {mode_tuple[1]} - {mode_tuple[2]}, Zähler {counter.num}")
common.update_raw_data(preferenced_chargepoints, diff_to_zero=True)
while len(preferenced_chargepoints):
cp = preferenced_chargepoints[0]
for cp, group in data.data.counter_all_data.generator_cps_by_loadmanagement_prios(
preferenced_chargepoints):
missing_currents, counts = common.get_min_current(cp)
if max(missing_currents) > 0:
available_currents, limit = Loadmanagement().get_available_currents(
Expand Down Expand Up @@ -52,4 +52,3 @@ def set_min_current(self) -> None:
except Exception:
log.exception(f"Fehler in der PV-gesteuerten Ladung bei {cp.num}")
cp.data.set.current = 0
preferenced_chargepoints.pop(0)
6 changes: 2 additions & 4 deletions packages/control/algorithm/surplus_controlled.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ def _set(self,
counter: Counter) -> None:
log.info(f"Mode-Tuple {mode_tuple[0]} - {mode_tuple[1]} - {mode_tuple[2]}, Zähler {counter.num}")
common.update_raw_data(chargepoints, surplus=True)
while len(chargepoints):
cp = chargepoints[0]
missing_currents, counts = common.get_missing_currents_left(chargepoints)
for cp, group in data.data.counter_all_data.generator_cps_by_loadmanagement_prios(chargepoints):
missing_currents, counts = common.get_missing_currents_left(group)
available_currents, limit = Loadmanagement().get_available_currents_surplus(
missing_currents,
voltages_mean(cp.data.get.voltages),
Expand Down Expand Up @@ -88,7 +87,6 @@ def _set(self,
limited_current,
cp,
surplus=True)
chargepoints.pop(0)

def _set_loadmangement_message(self,
current: float,
Expand Down
Loading
Loading