Skip to content

Commit 1d48545

Browse files
Refactor set_bounds() in EVChargerPool
This commit refactors the set_bounds() method in EVChargerPool to use the Current type instead of a float for the max current, and the parameter name was renamed to max_current to reflect the change in type. The Current type provides semantic clarity, unit consistency, and better arithmetic operations when dealing with current units compared to raw and built-in floats. Signed-off-by: Daniel Zullo <[email protected]>
1 parent 44576d5 commit 1d48545

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,19 @@ def component_data(self, component_id: int) -> Receiver[EVChargerData]:
240240

241241
return output_chan.new_receiver()
242242

243-
async def set_bounds(self, component_id: int, max_amps: float) -> None:
243+
async def set_bounds(self, component_id: int, max_current: Current) -> None:
244244
"""Send given max current bound for the given EV Charger to the microgrid API.
245245
246246
Bounds are used to limit the max current drawn by an EV, although the exact
247247
value will be determined by the EV.
248248
249249
Args:
250250
component_id: ID of EV Charger to set the current bounds to.
251-
max_amps: maximum current in amps, that an EV can draw from this EV Charger.
251+
max_current: maximum current that an EV can draw from this EV Charger.
252252
"""
253253
if not self._bounds_setter:
254254
self._bounds_setter = BoundsSetter(self._repeat_interval)
255-
await self._bounds_setter.set(component_id, max_amps)
255+
await self._bounds_setter.set(component_id, max_current.as_amperes())
256256

257257
def new_bounds_sender(self) -> Sender[ComponentCurrentLimit]:
258258
"""Return a `Sender` for setting EV Charger current bounds with.

0 commit comments

Comments
 (0)