Skip to content

Commit 13b0250

Browse files
committed
Pass component_ids to _calc_targets instead of proposals
1 parent 6d106d1 commit 13b0250

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/frequenz/sdk/microgrid/_power_managing/_shifting_matryoshka.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self, max_proposal_age: timedelta) -> None:
6363

6464
def _calc_targets(
6565
self,
66-
proposals: set[Proposal],
66+
component_ids: frozenset[int],
6767
system_bounds: SystemBounds,
6868
priority: int | None = None,
6969
) -> tuple[Power | None, Bounds[Power]]:
@@ -77,6 +77,7 @@ def _calc_targets(
7777
Returns:
7878
The new target power and bounds for the components.
7979
"""
80+
proposals = self._component_buckets.get(component_ids, set())
8081
lower_bound = (
8182
system_bounds.inclusion_bounds.lower
8283
if system_bounds.inclusion_bounds
@@ -242,9 +243,7 @@ def calculate_target_power(
242243
del self._component_buckets[component_ids]
243244
_ = self._target_power.pop(component_ids, None)
244245

245-
target_power, _ = self._calc_targets(
246-
self._component_buckets.get(component_ids, set()), system_bounds
247-
)
246+
target_power, _ = self._calc_targets(component_ids, system_bounds)
248247

249248
if target_power is not None and (
250249
must_return_power
@@ -274,9 +273,7 @@ def get_status( # pylint: disable=too-many-locals
274273
the given priority.
275274
"""
276275
target_power = self._target_power.get(component_ids)
277-
_, bounds = self._calc_targets(
278-
self._component_buckets.get(component_ids, set()), system_bounds, priority
279-
)
276+
_, bounds = self._calc_targets(component_ids, system_bounds, priority)
280277
return _Report(
281278
target_power=target_power,
282279
_inclusion_bounds=timeseries.Bounds[Power](

0 commit comments

Comments
 (0)