Skip to content

Commit bf3ccc6

Browse files
committed
Revert "Support power requests from shifting actors in the PowerManager (frequenz-floss#957)"
This reverts commit d5d74a3, reversing changes made to 8e5d65e. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 11159ef commit bf3ccc6

File tree

10 files changed

+21
-465
lines changed

10 files changed

+21
-465
lines changed

src/frequenz/sdk/microgrid/__init__.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -185,43 +185,6 @@
185185
found in the documentation for any of the
186186
[`propose_power`][frequenz.sdk.timeseries.battery_pool.BatteryPool.propose_power]
187187
methods.
188-
189-
### Shifting the target power by an offset
190-
191-
There are cases where the target power needs to be shifted by a certain amount, for
192-
example, to make adjustments to the operating point. This can be done by designating
193-
some actors to be part of the `shifting_group`.
194-
195-
When creating a `*Pool` instance using the above-mentioned constructors, an optional
196-
`in_shifting_group` parameter can be passed to specify that this actor is special, and
197-
the target power of the regular actors will be shifted by the target power of all
198-
shifting actors together.
199-
200-
In a location with 2 regular actors and 1 shifting actor, here's how things
201-
would play out:
202-
203-
1. When only non-shifting actors have made proposals, the power bounds available
204-
from the batteries are available to them exactly.
205-
206-
| actor priority | in shifting group? | proposed power/bounds | available bounds |
207-
|----------------|--------------------|-----------------------|------------------|
208-
| 3 | No | 1000, -4000..2500 | -3000..3000 |
209-
| 2 | No | 2500 | -3000..2500 |
210-
| 1 | Yes | None | -3000..3000 |
211-
212-
Power actually distributed to the batteries: 2500W
213-
214-
2. When the shifting actor has made proposals, the bounds available to the
215-
regular actors gets shifted, and the final power that actually gets
216-
distributed to the batteries is also shifted.
217-
218-
| actor priority | in shifting group? | proposed power/bounds | available bounds |
219-
|----------------|--------------------|-----------------------|------------------|
220-
| 3 | No | 1000, -4000..2500 | -2000..4000 |
221-
| 2 | No | 2500 | -2000..2500 |
222-
| 1 | Yes | -1000 | -3000..3000 |
223-
224-
Power actually distributed to the batteries: 1500W
225188
""" # noqa: D205, D400
226189

227190
from datetime import timedelta

src/frequenz/sdk/microgrid/_data_pipeline.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def new_ev_charger_pool(
208208
priority: int,
209209
component_ids: abc.Set[int] | None = None,
210210
name: str | None = None,
211-
in_shifting_group: bool = False,
212211
) -> EVChargerPool:
213212
"""Return the corresponding EVChargerPool instance for the given ids.
214213
@@ -221,8 +220,6 @@ def new_ev_charger_pool(
221220
EVChargerPool.
222221
name: An optional name used to identify this instance of the pool or a
223222
corresponding actor in the logs.
224-
in_shifting_group: Whether the power requests get sent to the shifting group
225-
in the PowerManager or not.
226223
227224
Returns:
228225
An EVChargerPool instance.
@@ -279,7 +276,6 @@ def new_ev_charger_pool(
279276
pool_ref_store=self._ev_charger_pool_reference_stores[ref_store_key],
280277
name=name,
281278
priority=priority,
282-
in_shifting_group=in_shifting_group,
283279
)
284280

285281
def new_pv_pool(
@@ -288,7 +284,6 @@ def new_pv_pool(
288284
priority: int,
289285
component_ids: abc.Set[int] | None = None,
290286
name: str | None = None,
291-
in_shifting_group: bool = False,
292287
) -> PVPool:
293288
"""Return a new `PVPool` instance for the given ids.
294289
@@ -301,8 +296,6 @@ def new_pv_pool(
301296
`PVPool`.
302297
name: An optional name used to identify this instance of the pool or a
303298
corresponding actor in the logs.
304-
in_shifting_group: Whether the power requests get sent to the shifting group
305-
in the PowerManager or not.
306299
307300
Returns:
308301
A `PVPool` instance.
@@ -356,7 +349,6 @@ def new_pv_pool(
356349
pool_ref_store=self._pv_pool_reference_stores[ref_store_key],
357350
name=name,
358351
priority=priority,
359-
in_shifting_group=in_shifting_group,
360352
)
361353

362354
def new_battery_pool(
@@ -365,7 +357,6 @@ def new_battery_pool(
365357
priority: int,
366358
component_ids: abc.Set[int] | None = None,
367359
name: str | None = None,
368-
in_shifting_group: bool = False,
369360
) -> BatteryPool:
370361
"""Return a new `BatteryPool` instance for the given ids.
371362
@@ -378,8 +369,6 @@ def new_battery_pool(
378369
`BatteryPool`.
379370
name: An optional name used to identify this instance of the pool or a
380371
corresponding actor in the logs.
381-
in_shifting_group: Whether the power requests get sent to the shifting group
382-
in the PowerManager or not.
383372
384373
Returns:
385374
A `BatteryPool` instance.
@@ -438,7 +427,6 @@ def new_battery_pool(
438427
pool_ref_store=self._battery_pool_reference_stores[ref_store_key],
439428
name=name,
440429
priority=priority,
441-
in_shifting_group=in_shifting_group,
442430
)
443431

444432
def _data_sourcing_request_sender(self) -> Sender[ComponentMetricRequest]:
@@ -555,7 +543,6 @@ def new_ev_charger_pool(
555543
priority: int,
556544
component_ids: abc.Set[int] | None = None,
557545
name: str | None = None,
558-
in_shifting_group: bool = False,
559546
) -> EVChargerPool:
560547
"""Return a new `EVChargerPool` instance for the given parameters.
561548
@@ -581,17 +568,12 @@ def new_ev_charger_pool(
581568
component graph are used.
582569
name: An optional name used to identify this instance of the pool or a
583570
corresponding actor in the logs.
584-
in_shifting_group: Whether the power requests get sent to the shifting group
585-
in the PowerManager or not.
586571
587572
Returns:
588573
An `EVChargerPool` instance.
589574
"""
590575
return _get().new_ev_charger_pool(
591-
priority=priority,
592-
component_ids=component_ids,
593-
name=name,
594-
in_shifting_group=in_shifting_group,
576+
priority=priority, component_ids=component_ids, name=name
595577
)
596578

597579

@@ -600,7 +582,6 @@ def new_battery_pool(
600582
priority: int,
601583
component_ids: abc.Set[int] | None = None,
602584
name: str | None = None,
603-
in_shifting_group: bool = False,
604585
) -> BatteryPool:
605586
"""Return a new `BatteryPool` instance for the given parameters.
606587
@@ -626,17 +607,12 @@ def new_battery_pool(
626607
graph are used.
627608
name: An optional name used to identify this instance of the pool or a
628609
corresponding actor in the logs.
629-
in_shifting_group: Whether the power requests get sent to the shifting group
630-
in the PowerManager or not.
631610
632611
Returns:
633612
A `BatteryPool` instance.
634613
"""
635614
return _get().new_battery_pool(
636-
priority=priority,
637-
component_ids=component_ids,
638-
name=name,
639-
in_shifting_group=in_shifting_group,
615+
priority=priority, component_ids=component_ids, name=name
640616
)
641617

642618

@@ -645,7 +621,6 @@ def new_pv_pool(
645621
priority: int,
646622
component_ids: abc.Set[int] | None = None,
647623
name: str | None = None,
648-
in_shifting_group: bool = False,
649624
) -> PVPool:
650625
"""Return a new `PVPool` instance for the given parameters.
651626
@@ -671,18 +646,11 @@ def new_pv_pool(
671646
graph are used.
672647
name: An optional name used to identify this instance of the pool or a
673648
corresponding actor in the logs.
674-
in_shifting_group: Whether the power requests get sent to the shifting group
675-
in the PowerManager or not.
676649
677650
Returns:
678651
A `PVPool` instance.
679652
"""
680-
return _get().new_pv_pool(
681-
priority=priority,
682-
component_ids=component_ids,
683-
name=name,
684-
in_shifting_group=in_shifting_group,
685-
)
653+
return _get().new_pv_pool(priority=priority, component_ids=component_ids, name=name)
686654

687655

688656
def grid() -> Grid:

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ class ReportRequest:
3232
priority: int
3333
"""The priority of the actor ."""
3434

35-
in_shifting_group: bool
36-
"""Whether the proposal gets sent to the shifting group of the power manager."""
37-
3835
def get_channel_name(self) -> str:
3936
"""Get the channel name for the report request.
4037
@@ -157,9 +154,6 @@ class Proposal:
157154
This is used by the power manager to determine the age of the proposal.
158155
"""
159156

160-
in_shifting_group: bool
161-
"""Whether the proposal gets sent to the shifting group of the power manager."""
162-
163157
def __lt__(self, other: Proposal) -> bool:
164158
"""Compare two proposals by their priority.
165159
@@ -237,21 +231,6 @@ def calculate_target_power(
237231
didn't change.
238232
"""
239233

240-
@abc.abstractmethod
241-
def get_target_power(
242-
self,
243-
component_ids: frozenset[int],
244-
) -> Power | None:
245-
"""Get the target power for the given components.
246-
247-
Args:
248-
component_ids: The component IDs to get the target power for.
249-
250-
Returns:
251-
The target power for the given components, or `None` if there is no target
252-
power.
253-
"""
254-
255234
# The arguments for this method are tightly coupled to the `Matryoshka` algorithm.
256235
# It can be loosened up when more algorithms are added.
257236
@abc.abstractmethod

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,6 @@ def _validate_component_ids(
151151
)
152152
return True
153153

154-
def get_target_power(
155-
self,
156-
component_ids: frozenset[int],
157-
) -> Power | None:
158-
"""Get the target power for the given components.
159-
160-
Args:
161-
component_ids: The component IDs to get the target power for.
162-
163-
Returns:
164-
The target power for the given components, or `None` if there is no target
165-
power.
166-
"""
167-
return self._target_power.get(component_ids)
168-
169154
@override
170155
def calculate_target_power(
171156
self,

0 commit comments

Comments
 (0)