diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cf471e1dd..961a42e67 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -22,3 +22,5 @@ | Battery | 0.0 | | PV | Minimum power (aka max production power) | | EV Chargers | Maximum power (aka max consumption power) | + +- PV Pool instances can now be created in sites without any PV. This allows for writing generic code that works for all locations, that depends on the PV power formula, for example. diff --git a/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py b/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py index 261de7fd4..d912bd5b4 100644 --- a/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py +++ b/src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py @@ -97,15 +97,20 @@ def __init__( # pylint: disable=too-many-arguments name=f"System Bounds for PV inverters: {component_ids}", resend_latest=True, ) - self.bounds_tracker: PVSystemBoundsTracker = PVSystemBoundsTracker( - self.component_ids, - self.status_receiver, - self.bounds_channel.new_sender(), - ) - self.bounds_tracker.start() + + self.bounds_tracker: PVSystemBoundsTracker | None = None + # In locations without PV inverters, the bounds tracker will not be started. + if self.component_ids: + self.bounds_tracker = PVSystemBoundsTracker( + self.component_ids, + self.status_receiver, + self.bounds_channel.new_sender(), + ) + self.bounds_tracker.start() async def stop(self) -> None: """Stop all tasks and channels owned by the PVInverterPool.""" await self.formula_pool.stop() - await self.bounds_tracker.stop() + if self.bounds_tracker is not None: + await self.bounds_tracker.stop() self.status_receiver.close()