Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
19 changes: 12 additions & 7 deletions src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding an inline comment to explain why bounds_tracker is initialized to None and conditionally set based on component_ids. This will help maintainers understand the intent behind this change.

Suggested change
# Initialize bounds_tracker to None. It will be conditionally assigned
# if component_ids are provided or derived, as it is only needed to track
# system bounds for the specified components.

Copilot uses AI. Check for mistakes.
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()
Comment on lines +114 to +115
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not introduced by this PR, but just FYI, as I mentioned in other insteances and at least if this is a BackgroundService, stopping of sub-services should be done separately via cancel() and wait(), and leave stop() being just an alias for self.cancel(); await self.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a bug the way it is now, at least not in this layer, because this is in the *reference_store, which is supposed to be shared already.

But we will have to look at the outer layers, where we just removed the call to *reference_store.stop() as a temporary fix.

self.status_receiver.close()
Loading