Skip to content

Commit b6137dd

Browse files
committed
Remove power_distribution_results from the battery pool
The results from the power distributing actor would instead be used by the power manager to provide more information through its reporting stream. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 4306d72 commit b6137dd

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

benchmarks/power_distribution/power_distributor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
PORT = 61060
3434

3535

36+
# TODO: this send_requests function uses the battery pool to # pylint: disable=fixme
37+
# send requests, and those no longer go directly to the power distributing actor, but
38+
# instead through the power managing actor. So the below function needs to be updated
39+
# to use the PowerDistributingActor directly.
3640
async def send_requests(batteries: set[int], request_num: int) -> list[Result]:
3741
"""Send requests to the PowerDistributingActor and wait for the response.
3842
@@ -47,8 +51,8 @@ async def send_requests(batteries: set[int], request_num: int) -> list[Result]:
4751
List of the results from the PowerDistributingActor.
4852
"""
4953
battery_pool = microgrid.battery_pool(batteries)
50-
results_rx = battery_pool.power_distribution_results()
51-
result: list[Result] = []
54+
results_rx = battery_pool.power_bounds().new_receiver()
55+
result: list[Any] = []
5256
for _ in range(request_num):
5357
await battery_pool.set_power(Power(float(random.randrange(100000, 1000000))))
5458
try:

src/frequenz/sdk/microgrid/_data_pipeline.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ def battery_pool(
221221
power_manager_bounds_subscription_sender=(
222222
self._power_manager_bounds_subscription_channel.new_sender()
223223
),
224-
power_manager_results_receiver=(
225-
self._power_distribution_results_channel.new_receiver()
226-
),
227224
min_update_interval=self._resampler_config.resampling_period,
228225
batteries_id=battery_ids,
229226
)

src/frequenz/sdk/timeseries/battery_pool/battery_pool.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from ..._internal._channels import ReceiverFetcher
1717
from ...actor import ComponentMetricRequest, _channel_registry, _power_managing
1818
from ...actor.power_distributing._battery_pool_status import BatteryStatus
19-
from ...actor.power_distributing.result import Result
2019
from ...microgrid import connection_manager
2120
from ...microgrid.component import ComponentCategory
2221
from ...timeseries import Sample
@@ -51,7 +50,6 @@ def __init__( # pylint: disable=too-many-arguments
5150
batteries_status_receiver: Receiver[BatteryStatus],
5251
power_manager_requests_sender: Sender[_power_managing.Proposal],
5352
power_manager_bounds_subscription_sender: Sender[_power_managing.ReportRequest],
54-
power_manager_results_receiver: Receiver[Result],
5553
min_update_interval: timedelta,
5654
batteries_id: Set[int] | None = None,
5755
) -> None:
@@ -72,8 +70,6 @@ def __init__( # pylint: disable=too-many-arguments
7270
requests to the power managing actor.
7371
power_manager_bounds_subscription_sender: A Channel sender for sending
7472
power bounds requests to the power managing actor.
75-
power_manager_results_receiver: A Channel receiver for receiving results
76-
from the power managing actor.
7773
min_update_interval: Some metrics in BatteryPool are send only when they
7874
change. For these metrics min_update_interval is the minimum time
7975
interval between the following messages.
@@ -106,7 +102,6 @@ def __init__( # pylint: disable=too-many-arguments
106102
self._power_manager_bounds_subscription_sender = (
107103
power_manager_bounds_subscription_sender
108104
)
109-
self._power_manager_results_receiver = power_manager_results_receiver
110105

111106
self._active_methods: dict[str, MetricAggregator[Any]] = {}
112107
self._power_bounds_subs: dict[str, asyncio.Task[None]] = {}
@@ -252,14 +247,6 @@ async def discharge(
252247
)
253248
)
254249

255-
def power_distribution_results(self) -> Receiver[Result]:
256-
"""Return a receiver for the power distribution results.
257-
258-
Returns:
259-
A receiver for the power distribution results.
260-
"""
261-
return self._power_manager_results_receiver
262-
263250
@property
264251
def battery_ids(self) -> Set[int]:
265252
"""Return ids of the batteries in the pool.

0 commit comments

Comments
 (0)