Skip to content

Commit 914716c

Browse files
Expose BatteryPool and PowerDistributingHandle from sdk.microgrid (#323)
2 parents df383ee + af20290 commit 914716c

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/frequenz/sdk/microgrid/_data_pipeline.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,42 @@ def ev_charger_pool(ev_charger_ids: set[int] | None = None) -> EVChargerPool:
300300
created and returned.
301301
302302
Args:
303-
ev_charger_ids: Optional set of IDs of EV Charger to be managed by the
304-
EVChargerPool.
303+
ev_charger_ids: Optional set of IDs of EV Chargers to be managed by the
304+
EVChargerPool. If not specified, all EV Chargers available in the
305+
component graph are used.
305306
306307
Returns:
307308
An EVChargerPool instance.
308309
"""
309310
return _get().ev_charger_pool(ev_charger_ids)
310311

311312

313+
def battery_pool(battery_ids: abc.Set[int] | None = None) -> BatteryPool:
314+
"""Return the corresponding BatteryPool instance for the given ids.
315+
316+
If a BatteryPool instance for the given ids doesn't exist, a new one is
317+
created and returned.
318+
319+
Args:
320+
battery_ids: Optional set of IDs of batteries to be managed by the
321+
BatteryPool. If not specified, all batteries available in the
322+
component graph are used.
323+
324+
Returns:
325+
A BatteryPool instance.
326+
"""
327+
return _get().battery_pool(battery_ids)
328+
329+
330+
def power_distributing_handle() -> Bidirectional.Handle[Request, Result]:
331+
"""Return the handle to the power distributing actor.
332+
333+
Returns:
334+
A Bidirectional handle to communicate with the power distributing actor.
335+
"""
336+
return _get().power_distributing_handle()
337+
338+
312339
def _get() -> _DataPipeline:
313340
if _DATA_PIPELINE is None:
314341
raise RuntimeError(

0 commit comments

Comments
 (0)