Skip to content

Commit 9334aab

Browse files
committed
Don't start PVSystemBoundsTracker in locations without PV
Without this, it was hard to create `PVPool`s at locations without PV. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 656386f commit 9334aab

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,20 @@ def __init__( # pylint: disable=too-many-arguments
9797
name=f"System Bounds for PV inverters: {component_ids}",
9898
resend_latest=True,
9999
)
100-
self.bounds_tracker: PVSystemBoundsTracker = PVSystemBoundsTracker(
101-
self.component_ids,
102-
self.status_receiver,
103-
self.bounds_channel.new_sender(),
104-
)
105-
self.bounds_tracker.start()
100+
101+
self.bounds_tracker: PVSystemBoundsTracker | None = None
102+
# In locations without PV inverters, the bounds tracker will not be started.
103+
if self.component_ids:
104+
self.bounds_tracker = PVSystemBoundsTracker(
105+
self.component_ids,
106+
self.status_receiver,
107+
self.bounds_channel.new_sender(),
108+
)
109+
self.bounds_tracker.start()
106110

107111
async def stop(self) -> None:
108112
"""Stop all tasks and channels owned by the PVInverterPool."""
109113
await self.formula_pool.stop()
110-
await self.bounds_tracker.stop()
114+
if self.bounds_tracker is not None:
115+
await self.bounds_tracker.stop()
111116
self.status_receiver.close()

0 commit comments

Comments
 (0)