Skip to content

Commit 9d4a8e1

Browse files
committed
Support EVChargers in PowerManager
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 0c96cdd commit 9d4a8e1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,22 @@ def _add_bounds_tracker(self, component_ids: frozenset[int]) -> None:
133133
microgrid,
134134
)
135135

136-
if self._component_category is not ComponentCategory.BATTERY:
136+
bounds_receiver: Receiver[SystemBounds]
137+
# pylint: disable=protected-access
138+
if self._component_category is ComponentCategory.BATTERY:
139+
battery_pool = microgrid.battery_pool(component_ids)
140+
bounds_receiver = battery_pool._system_power_bounds.new_receiver()
141+
elif self._component_category is ComponentCategory.EV_CHARGER:
142+
ev_charger_pool = microgrid.ev_charger_pool(component_ids)
143+
bounds_receiver = ev_charger_pool._system_power_bounds.new_receiver()
144+
# pylint: enable=protected-access
145+
else:
137146
err = (
138147
"PowerManagingActor: Unsupported component category: "
139148
f"{self._component_category}"
140149
)
141150
_logger.error(err)
142151
raise NotImplementedError(err)
143-
battery_pool = microgrid.battery_pool(component_ids)
144-
# pylint: disable=protected-access
145-
bounds_receiver = battery_pool._system_power_bounds.new_receiver()
146-
# pylint: enable=protected-access
147152

148153
self._system_bounds[component_ids] = SystemBounds(
149154
timestamp=datetime.now(tz=timezone.utc),

0 commit comments

Comments
 (0)