Skip to content

Commit a4d6268

Browse files
committed
Expose exclusion_bounds through PowerManager reporting streams
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 358e064 commit a4d6268

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ class Report:
5555
priorities.
5656
"""
5757

58+
exclusion_bounds: timeseries.Bounds[Power] | None
59+
"""The exclusion bounds for the batteries.
60+
61+
The power manager doesn't manage exclusion bounds, so these are aggregations of
62+
values reported by the microgrid API.
63+
64+
These bounds are adjusted to any restrictions placed by actors with higher
65+
priorities.
66+
"""
67+
5868

5969
@dataclasses.dataclass(frozen=True)
6070
class Proposal:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def get_status(
155155
"""
156156
target_power = self._target_power.get(battery_ids)
157157
if system_bounds.inclusion_bounds is None:
158-
return Report(target_power, None)
158+
return Report(target_power, None, system_bounds.exclusion_bounds)
159159

160160
lower_bound = system_bounds.inclusion_bounds.lower
161161
upper_bound = system_bounds.inclusion_bounds.upper
@@ -177,4 +177,5 @@ def get_status(
177177
inclusion_bounds=timeseries.Bounds[Power](
178178
lower=lower_bound, upper=upper_bound
179179
),
180+
exclusion_bounds=system_bounds.exclusion_bounds,
180181
)

tests/timeseries/_battery_pool/test_battery_pool_control_methods.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ def _make_report(
145145
lower=Power.from_watts(lower),
146146
upper=Power.from_watts(upper),
147147
),
148+
exclusion_bounds=timeseries.Bounds(
149+
lower=Power.from_watts(0.0),
150+
upper=Power.from_watts(0.0),
151+
),
148152
)
149153

150154
async def test_case_1(

0 commit comments

Comments
 (0)