66
77import uuid
88from collections import abc
9- from datetime import timedelta
109
1110from frequenz .channels import Broadcast , Receiver , Sender
1211
2423 EVChargerPowerFormula ,
2524 FormulaGeneratorConfig ,
2625)
27- from ._set_current_bounds import BoundsSetter , ComponentCurrentLimit
2826from ._system_bounds_tracker import EVCSystemBoundsTracker
2927
3028
@@ -45,13 +43,6 @@ class EVChargerPool:
4543 and 3-phase
4644 [`current`][frequenz.sdk.timeseries.ev_charger_pool.EVChargerPool.current]
4745 measurements of the EV Chargers in the pool.
48- - The
49- [`component_data`][frequenz.sdk.timeseries.ev_charger_pool.EVChargerPool.component_data]
50- method for fetching the 3-phase current and state of individual EV Chargers in
51- the pool.
52- - The
53- [`set_bounds`][frequenz.sdk.timeseries.ev_charger_pool.EVChargerPool.set_bounds]
54- method for limiting the max current of individual EV Chargers in the pool.
5546 """
5647
5748 def __init__ ( # pylint: disable=too-many-arguments
@@ -60,7 +51,6 @@ def __init__( # pylint: disable=too-many-arguments
6051 resampler_subscription_sender : Sender [ComponentMetricRequest ],
6152 status_receiver : Receiver [ComponentPoolStatus ],
6253 component_ids : abc .Set [int ] | None = None ,
63- repeat_interval : timedelta = timedelta (seconds = 3.0 ),
6454 ) -> None :
6555 """Create an `EVChargerPool` instance.
6656
@@ -79,11 +69,8 @@ def __init__( # pylint: disable=too-many-arguments
7969 component_ids: An optional list of component_ids belonging to this pool. If
8070 not specified, IDs of all EV Chargers in the microgrid will be fetched
8171 from the component graph.
82- repeat_interval: Interval after which to repeat the last set bounds to the
83- microgrid API, if no new calls to `set_bounds` have been made.
8472 """
8573 self ._channel_registry : ChannelRegistry = channel_registry
86- self ._repeat_interval : timedelta = repeat_interval
8774 self ._resampler_subscription_sender : Sender [ComponentMetricRequest ] = (
8875 resampler_subscription_sender
8976 )
@@ -105,7 +92,6 @@ def __init__( # pylint: disable=too-many-arguments
10592 self ._channel_registry ,
10693 self ._resampler_subscription_sender ,
10794 )
108- self ._bounds_setter : BoundsSetter | None = None
10995
11096 self ._bounds_channel : Broadcast [SystemBounds ] = Broadcast (
11197 name = f"System Bounds for EV Chargers: { component_ids } "
@@ -174,37 +160,8 @@ def power(self) -> FormulaEngine[Power]:
174160 assert isinstance (engine , FormulaEngine )
175161 return engine
176162
177- async def set_bounds (self , component_id : int , max_current : Current ) -> None :
178- """Send given max current bound for the given EV Charger to the microgrid API.
179-
180- Bounds are used to limit the max current drawn by an EV, although the exact
181- value will be determined by the EV.
182-
183- Args:
184- component_id: ID of EV Charger to set the current bounds to.
185- max_current: maximum current that an EV can draw from this EV Charger.
186- """
187- if not self ._bounds_setter :
188- self ._bounds_setter = BoundsSetter (self ._repeat_interval )
189- await self ._bounds_setter .set (component_id , max_current .as_amperes ())
190-
191- def new_bounds_sender (self ) -> Sender [ComponentCurrentLimit ]:
192- """Return a `Sender` for setting EV Charger current bounds with.
193-
194- Bounds are used to limit the max current drawn by an EV, although the exact
195- value will be determined by the EV.
196-
197- Returns:
198- A new `Sender`.
199- """
200- if not self ._bounds_setter :
201- self ._bounds_setter = BoundsSetter (self ._repeat_interval )
202- return self ._bounds_setter .new_bounds_sender ()
203-
204163 async def stop (self ) -> None :
205164 """Stop all tasks and channels owned by the EVChargerPool."""
206- if self ._bounds_setter :
207- await self ._bounds_setter .stop ()
208165 await self ._formula_pool .stop ()
209166
210167 @property
0 commit comments