-
Notifications
You must be signed in to change notification settings - Fork 112
se automatic phase switch, enum handling with dataclass <->dict conversion #3241
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
Changes from 1 commit
944d0a7
e7e0760
27c0a9f
6b7d349
d47a6e3
e204b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,7 +27,8 @@ def set_min_current(self) -> None: | |||||||||
| if max(missing_currents) > 0: | ||||||||||
| available_currents, limit = Loadmanagement().get_available_currents( | ||||||||||
| missing_currents, counter, cp) | ||||||||||
| cp.data.control_parameter.limit = limit | ||||||||||
| if limit.limiting_value is not None: | ||||||||||
| cp.data.control_parameter.limit = limit | ||||||||||
|
||||||||||
| cp.data.control_parameter.limit = limit | |
| cp.data.control_parameter.limit = limit | |
| else: | |
| cp.data.control_parameter.limit = None |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -61,7 +61,9 @@ def _set(self, | |||||||||||||
| cp, | ||||||||||||||
| feed_in=feed_in_yield | ||||||||||||||
| ) | ||||||||||||||
| cp.data.control_parameter.limit = limit | ||||||||||||||
| # im PV-Laden wird der Strom immer durch die Leistung begrenzt | ||||||||||||||
| if limit.limiting_value is not None and limit.limiting_value != LimitingValue.POWER: | ||||||||||||||
| cp.data.control_parameter.limit = limit | ||||||||||||||
|
||||||||||||||
| cp.data.control_parameter.limit = limit | |
| cp.data.control_parameter.limit = limit | |
| else: | |
| # Clear any stale CURRENT/UNBALANCED limit when there is no limiting | |
| # or when limiting is by POWER (ignored in PV mode). | |
| cp.data.control_parameter.limit = None |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,8 @@ def setup_algorithm(self) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| data.data.cp_all_data.no_charge() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data.data.counter_all_data.set_home_consumption() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data.data.io_actions.setup() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for cp in data.data.cp_data.values(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cp.reset_values_before_algorithm() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| for cp in data.data.cp_data.values(): | |
| cp.reset_values_before_algorithm() | |
| for cp in data.data.cp_data.values(): | |
| # Limit-Wert des vorherigen Zyklus sichern, damit er für die | |
| # Phasenumschaltung im Algorithmus weiterhin verfügbar bleibt. | |
| prev_limit = None | |
| try: | |
| prev_limit = getattr( | |
| getattr(cp, "data", None), | |
| "control_parameter", | |
| None, | |
| ) | |
| if prev_limit is not None: | |
| prev_limit = getattr(prev_limit, "limit", None) | |
| except AttributeError: | |
| prev_limit = None | |
| cp.reset_values_before_algorithm() | |
| # Gesicherten Limit-Wert wiederherstellen. | |
| try: | |
| if hasattr(cp, "data") and hasattr(cp.data, "control_parameter"): | |
| cp.data.control_parameter.limit = prev_limit | |
| except AttributeError: | |
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as in
min_current.py: skipping the assignment whenlimit.limiting_value is Nonemeanscp.data.control_parameter.limitcan remain set to an old limiting reason even after the constraint is gone. That stale state can propagate into phase-switch logic and status messaging. Consider clearing/resetting the limit explicitly when there is no active limitation.