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
8 changes: 4 additions & 4 deletions packages/control/algorithm/surplus_controlled.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def set_surplus_current(self) -> None:
for counter in common.counter_generator():
preferenced_loads_groups, preferenced_loads_without_set_current = get_preferenced_load_charging(
get_grouped_loads_by_mode_and_counter(CONSIDERED_CHARGE_MODES_SURPLUS, f"counter{counter.num}"))
if data.data.general_data.data.chargemode_config.pv_charging.feed_in_limit:
feed_in_yield = data.data.general_data.data.chargemode_config.feed_in_yield
if data.data.general_data.data.chargemode_config.surplus.feed_in_limit:
feed_in_yield = data.data.general_data.data.chargemode_config.surplus.feed_in_yield
else:
feed_in_yield = 0
self._set(preferenced_loads_groups, feed_in_yield, counter)
Expand Down Expand Up @@ -110,10 +110,10 @@ def _set_loadmangement_message(self,
def filter_by_feed_in_limit(self, loads: List[Load]) -> Tuple[List[Union[Chargepoint, Load]],
List[Union[Chargepoint, Load]]]:
cp_with_feed_in = list(filter(lambda cp: isinstance(cp, Chargepoint)
and data.data.general_data.data.chargemode_config.pv_charging.feed_in_limit is True,
and data.data.general_data.data.chargemode_config.surplus.feed_in_limit is True,
loads))
cp_without_feed_in = list(filter(lambda cp: isinstance(cp, Consumer)
or data.data.general_data.data.chargemode_config.pv_charging.feed_in_limit is False,
or data.data.general_data.data.chargemode_config.surplus.feed_in_limit is False,
loads))
return cp_with_feed_in, cp_without_feed_in

Expand Down
7 changes: 6 additions & 1 deletion packages/control/consumer/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def update(self):

def process_on_time(self):
if self.data.get.charge_state:
self.data.set.on_time += data.data.general_data.data.control_interval
now = timecheck.create_timestamp()
if self.data.set.timestamp_wrote_last_on_time is None:
self.data.set.timestamp_wrote_last_on_time = now
Comment on lines 74 to +78
self.data.set.on_time += now - self.data.set.timestamp_wrote_last_on_time
self.data.set.timestamp_wrote_last_on_time = now
if self.data.control_parameter.timestamp_charge_start is None:
self.data.control_parameter.timestamp_charge_start = timecheck.create_timestamp()
elif self.data.get.charge_state is False:
Expand All @@ -84,6 +88,7 @@ def reset_timestamp_start(self):

def reset_on_time(self):
self.data.set.on_time = 0
self.data.set.timestamp_wrote_last_on_time = None

def is_switch_interval_elapsed(self):
if (timecheck.create_timestamp() < self.data.set.timestamp_last_current_set + self.data.config.min_interval and
Expand Down
2 changes: 2 additions & 0 deletions packages/control/consumer/consumer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class Set:
power: Optional[float] = field(default=None)
switch_interval_elapsed: bool = field(default=False)
timestamp_last_current_set: float = field(default=0, metadata={"topic": "set/timestamp_last_current_set"})
timestamp_wrote_last_on_time: Optional[float] = field(
default=None, metadata={"topic": "set/timestamp_wrote_last_on_time"})
Comment on lines +103 to +104
wait_for_start_state: WaitForStartStates = field(
default=WaitForStartStates.WAIT_FOR_DEVICE_START, metadata={"topic": "set/wait_for_start_state"})

Expand Down
2 changes: 2 additions & 0 deletions packages/control/counter_all/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def check_and_remove(name, type_name: ComponentType, data_structure):
check_and_remove("counter", ComponentType.COUNTER, data.data.counter_data)
check_and_remove("cp", ComponentType.CHARGEPOINT, data.data.cp_data)
check_and_remove("pv", ComponentType.INVERTER, data.data.pv_data)
check_and_remove("consumer", ComponentType.CONSUMER, data.data.consumer_data)

def _add_missing_entries(self: HierarchyProtocol):
def check_and_add(type_name: ComponentType, data_structure):
Expand Down Expand Up @@ -347,6 +348,7 @@ def check_and_add(type_name: ComponentType, data_structure):
check_and_add(ComponentType.BAT, data.data.bat_data)
check_and_add(ComponentType.CHARGEPOINT, data.data.cp_data)
check_and_add(ComponentType.INVERTER, data.data.pv_data)
check_and_add(ComponentType.CONSUMER, data.data.consumer_data)
except TypeError:
pub_system_message({}, ("Es konnte kein Zähler gefunden werden, der als EVU-Zähler an die Spitze des "
"Lastmanagements gesetzt werden kann. Bitte zuerst einen EVU-Zähler hinzufügen."),
Expand Down
4 changes: 2 additions & 2 deletions packages/helpermodules/setdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ def process_consumer_topic(self, msg):
re.search("consumer/[0-9]+/set/on_time$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/plug_time$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/timestamp_last_current_set$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/timestamp_wrote_last_on_time$", msg.topic) is not None or
re.search("consumer/[0-9]+/get/set_power$", msg.topic) is not None):
self._validate_value(msg, float)
elif (re.search("consumer/[0-9]+/get/currents$", msg.topic) is not None or
Expand All @@ -1269,8 +1270,7 @@ def process_consumer_topic(self, msg):
elif (re.search("consumer/[0-9]+/get/exported$", msg.topic) is not None or
re.search("consumer/[0-9]+/get/imported$", msg.topic) is not None or
re.search("consumer/[0-9]+/get/daily_exported$", msg.topic) is not None or
re.search("consumer/[0-9]+/get/daily_imported$", msg.topic) is not None or
re.search("consumer/[0-9]+/get/timestamp_last_current_set$", msg.topic) is not None):
re.search("consumer/[0-9]+/get/daily_imported$", msg.topic) is not None):
self._validate_value(msg, float, [(0, float("inf"))])
elif (re.search("consumer/[0-9]+/get/fault_state$", msg.topic) is not None or
re.search("consumer/get/fault_state$", msg.topic) is not None):
Expand Down
1 change: 1 addition & 0 deletions packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class UpdateConfig:
"^openWB/consumer/[0-9]+/set/phases_to_use$",
"^openWB/consumer/[0-9]+/set/plug_time$",
"^openWB/consumer/[0-9]+/set/timestamp_last_current_set$",
"^openWB/consumer/[0-9]+/set/timestamp_wrote_last_on_time$",
"^openWB/consumer/[0-9]+/set/wait_for_start_state$",

"^openWB/counter/config/consider_less_charging$",
Expand Down
Loading