Skip to content

Commit 1c600ad

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 ac4055b commit 1c600ad

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
@@ -210,7 +210,6 @@ def new_ev_charger_pool(
210210
priority: int,
211211
component_ids: abc.Set[int] | None = None,
212212
name: str | None = None,
213-
in_shifting_group: bool = False,
214213
) -> EVChargerPool:
215214
"""Return the corresponding EVChargerPool instance for the given ids.
216215
@@ -223,8 +222,6 @@ def new_ev_charger_pool(
223222
EVChargerPool.
224223
name: An optional name used to identify this instance of the pool or a
225224
corresponding actor in the logs.
226-
in_shifting_group: Whether the power requests get sent to the shifting group
227-
in the PowerManager or not.
228225
229226
Returns:
230227
An EVChargerPool instance.
@@ -281,7 +278,6 @@ def new_ev_charger_pool(
281278
pool_ref_store=self._ev_charger_pool_reference_stores[ref_store_key],
282279
name=name,
283280
priority=priority,
284-
in_shifting_group=in_shifting_group,
285281
)
286282

287283
def new_pv_pool(
@@ -290,7 +286,6 @@ def new_pv_pool(
290286
priority: int,
291287
component_ids: abc.Set[int] | None = None,
292288
name: str | None = None,
293-
in_shifting_group: bool = False,
294289
) -> PVPool:
295290
"""Return a new `PVPool` instance for the given ids.
296291
@@ -303,8 +298,6 @@ def new_pv_pool(
303298
`PVPool`.
304299
name: An optional name used to identify this instance of the pool or a
305300
corresponding actor in the logs.
306-
in_shifting_group: Whether the power requests get sent to the shifting group
307-
in the PowerManager or not.
308301
309302
Returns:
310303
A `PVPool` instance.
@@ -358,7 +351,6 @@ def new_pv_pool(
358351
pool_ref_store=self._pv_pool_reference_stores[ref_store_key],
359352
name=name,
360353
priority=priority,
361-
in_shifting_group=in_shifting_group,
362354
)
363355

364356
def new_battery_pool(
@@ -367,7 +359,6 @@ def new_battery_pool(
367359
priority: int,
368360
component_ids: abc.Set[int] | None = None,
369361
name: str | None = None,
370-
in_shifting_group: bool = False,
371362
) -> BatteryPool:
372363
"""Return a new `BatteryPool` instance for the given ids.
373364
@@ -380,8 +371,6 @@ def new_battery_pool(
380371
`BatteryPool`.
381372
name: An optional name used to identify this instance of the pool or a
382373
corresponding actor in the logs.
383-
in_shifting_group: Whether the power requests get sent to the shifting group
384-
in the PowerManager or not.
385374
386375
Returns:
387376
A `BatteryPool` instance.
@@ -440,7 +429,6 @@ def new_battery_pool(
440429
pool_ref_store=self._battery_pool_reference_stores[ref_store_key],
441430
name=name,
442431
priority=priority,
443-
in_shifting_group=in_shifting_group,
444432
)
445433

446434
def _data_sourcing_request_sender(self) -> Sender[ComponentMetricRequest]:
@@ -557,7 +545,6 @@ def new_ev_charger_pool(
557545
priority: int,
558546
component_ids: abc.Set[int] | None = None,
559547
name: str | None = None,
560-
in_shifting_group: bool = False,
561548
) -> EVChargerPool:
562549
"""Return a new `EVChargerPool` instance for the given parameters.
563550
@@ -583,17 +570,12 @@ def new_ev_charger_pool(
583570
component graph are used.
584571
name: An optional name used to identify this instance of the pool or a
585572
corresponding actor in the logs.
586-
in_shifting_group: Whether the power requests get sent to the shifting group
587-
in the PowerManager or not.
588573
589574
Returns:
590575
An `EVChargerPool` instance.
591576
"""
592577
return _get().new_ev_charger_pool(
593-
priority=priority,
594-
component_ids=component_ids,
595-
name=name,
596-
in_shifting_group=in_shifting_group,
578+
priority=priority, component_ids=component_ids, name=name
597579
)
598580

599581

@@ -602,7 +584,6 @@ def new_battery_pool(
602584
priority: int,
603585
component_ids: abc.Set[int] | None = None,
604586
name: str | None = None,
605-
in_shifting_group: bool = False,
606587
) -> BatteryPool:
607588
"""Return a new `BatteryPool` instance for the given parameters.
608589
@@ -628,17 +609,12 @@ def new_battery_pool(
628609
graph are used.
629610
name: An optional name used to identify this instance of the pool or a
630611
corresponding actor in the logs.
631-
in_shifting_group: Whether the power requests get sent to the shifting group
632-
in the PowerManager or not.
633612
634613
Returns:
635614
A `BatteryPool` instance.
636615
"""
637616
return _get().new_battery_pool(
638-
priority=priority,
639-
component_ids=component_ids,
640-
name=name,
641-
in_shifting_group=in_shifting_group,
617+
priority=priority, component_ids=component_ids, name=name
642618
)
643619

644620

@@ -647,7 +623,6 @@ def new_pv_pool(
647623
priority: int,
648624
component_ids: abc.Set[int] | None = None,
649625
name: str | None = None,
650-
in_shifting_group: bool = False,
651626
) -> PVPool:
652627
"""Return a new `PVPool` instance for the given parameters.
653628
@@ -673,18 +648,11 @@ def new_pv_pool(
673648
graph are used.
674649
name: An optional name used to identify this instance of the pool or a
675650
corresponding actor in the logs.
676-
in_shifting_group: Whether the power requests get sent to the shifting group
677-
in the PowerManager or not.
678651
679652
Returns:
680653
A `PVPool` instance.
681654
"""
682-
return _get().new_pv_pool(
683-
priority=priority,
684-
component_ids=component_ids,
685-
name=name,
686-
in_shifting_group=in_shifting_group,
687-
)
655+
return _get().new_pv_pool(priority=priority, component_ids=component_ids, name=name)
688656

689657

690658
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
@@ -152,21 +152,6 @@ def _validate_component_ids(
152152
)
153153
return True
154154

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

0 commit comments

Comments
 (0)