66
77import uuid
88from collections import abc
9- from datetime import timedelta
109
1110from frequenz .channels import Sender
1211from frequenz .client .microgrid import ComponentCategory
2120 EVChargerPowerFormula ,
2221 FormulaGeneratorConfig ,
2322)
24- from ._set_current_bounds import BoundsSetter , ComponentCurrentLimit
2523
2624
2725class EVChargerPoolError (Exception ):
@@ -41,21 +39,13 @@ class EVChargerPool:
4139 and 3-phase
4240 [`current`][frequenz.sdk.timeseries.ev_charger_pool.EVChargerPool.current]
4341 measurements of the EV Chargers in the pool.
44- - The
45- [`component_data`][frequenz.sdk.timeseries.ev_charger_pool.EVChargerPool.component_data]
46- method for fetching the 3-phase current and state of individual EV Chargers in
47- the pool.
48- - The
49- [`set_bounds`][frequenz.sdk.timeseries.ev_charger_pool.EVChargerPool.set_bounds]
50- method for limiting the max current of individual EV Chargers in the pool.
5142 """
5243
5344 def __init__ (
5445 self ,
5546 channel_registry : ChannelRegistry ,
5647 resampler_subscription_sender : Sender [ComponentMetricRequest ],
5748 component_ids : abc .Set [int ] | None = None ,
58- repeat_interval : timedelta = timedelta (seconds = 3.0 ),
5949 ) -> None :
6050 """Create an `EVChargerPool` instance.
6151
@@ -72,11 +62,8 @@ def __init__(
7262 component_ids: An optional list of component_ids belonging to this pool. If
7363 not specified, IDs of all EV Chargers in the microgrid will be fetched
7464 from the component graph.
75- repeat_interval: Interval after which to repeat the last set bounds to the
76- microgrid API, if no new calls to `set_bounds` have been made.
7765 """
7866 self ._channel_registry : ChannelRegistry = channel_registry
79- self ._repeat_interval : timedelta = repeat_interval
8067 self ._resampler_subscription_sender : Sender [ComponentMetricRequest ] = (
8168 resampler_subscription_sender
8269 )
@@ -97,7 +84,6 @@ def __init__(
9784 self ._channel_registry ,
9885 self ._resampler_subscription_sender ,
9986 )
100- self ._bounds_setter : BoundsSetter | None = None
10187
10288 @property
10389 def component_ids (self ) -> abc .Set [int ]:
@@ -158,35 +144,6 @@ def power(self) -> FormulaEngine[Power]:
158144 assert isinstance (engine , FormulaEngine )
159145 return engine
160146
161- async def set_bounds (self , component_id : int , max_current : Current ) -> None :
162- """Send given max current bound for the given EV Charger to the microgrid API.
163-
164- Bounds are used to limit the max current drawn by an EV, although the exact
165- value will be determined by the EV.
166-
167- Args:
168- component_id: ID of EV Charger to set the current bounds to.
169- max_current: maximum current that an EV can draw from this EV Charger.
170- """
171- if not self ._bounds_setter :
172- self ._bounds_setter = BoundsSetter (self ._repeat_interval )
173- await self ._bounds_setter .set (component_id , max_current .as_amperes ())
174-
175- def new_bounds_sender (self ) -> Sender [ComponentCurrentLimit ]:
176- """Return a `Sender` for setting EV Charger current bounds with.
177-
178- Bounds are used to limit the max current drawn by an EV, although the exact
179- value will be determined by the EV.
180-
181- Returns:
182- A new `Sender`.
183- """
184- if not self ._bounds_setter :
185- self ._bounds_setter = BoundsSetter (self ._repeat_interval )
186- return self ._bounds_setter .new_bounds_sender ()
187-
188147 async def stop (self ) -> None :
189148 """Stop all tasks and channels owned by the EVChargerPool."""
190- if self ._bounds_setter :
191- await self ._bounds_setter .stop ()
192149 await self ._formula_pool .stop ()
0 commit comments