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
14 changes: 1 addition & 13 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Frequenz Python SDK Release Notes

## Summary

<!-- Here goes a general summary of what this release is about -->

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
- The additive `ShiftingMatryoshka` algorithm was made for batteries, but got set as the default algorithm for PV and EV chargers. This is now reversed and PV and EV chargers are back to using the original `Matryoshka` algorithm.
5 changes: 5 additions & 0 deletions src/frequenz/sdk/microgrid/_data_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from frequenz.channels import Broadcast, Sender
from frequenz.client.microgrid import ComponentCategory, InverterType

from frequenz.sdk.microgrid._power_managing._base_classes import Algorithm

from .._internal._channels import ChannelRegistry
from ..actor._actor import Actor
from ..timeseries import ResamplerConfig
Expand Down Expand Up @@ -103,16 +105,19 @@ def __init__(
self._battery_power_wrapper = PowerWrapper(
self._channel_registry,
api_power_request_timeout=api_power_request_timeout,
power_manager_algorithm=Algorithm.SHIFTING_MATRYOSHKA,
component_category=ComponentCategory.BATTERY,
)
self._ev_power_wrapper = PowerWrapper(
self._channel_registry,
api_power_request_timeout=api_power_request_timeout,
power_manager_algorithm=Algorithm.MATRYOSHKA,
component_category=ComponentCategory.EV_CHARGER,
)
self._pv_power_wrapper = PowerWrapper(
self._channel_registry,
api_power_request_timeout=api_power_request_timeout,
power_manager_algorithm=Algorithm.MATRYOSHKA,
component_category=ComponentCategory.INVERTER,
component_type=InverterType.SOLAR,
)
Comment on lines 111 to 123
Copy link
Contributor

Choose a reason for hiding this comment

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

If I remember correctly, original Matryoshka algorithm had something like operating point adjustment.
How it works now?

Copy link
Contributor

Choose a reason for hiding this comment

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

That was like a partition, so all actors that were in the operating point group would shift the other actors or something like that. I think now is like the operating point group is always empty. But maybe @shsms can check I'm not mistaken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was mainly for battery use cases and is gone now. We only have a single matryoshka instance for PV and EV chargers.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks a lot! :)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ def __init__( # pylint: disable=too-many-arguments
power_distributing_requests_sender: Sender[_power_distributing.Request],
power_distributing_results_receiver: Receiver[_power_distributing.Result],
channel_registry: ChannelRegistry,
algorithm: Algorithm,
component_category: ComponentCategory,
component_type: ComponentType | None = None,
# arguments to actors need to serializable, so we pass an enum for the algorithm
# instead of an instance of the algorithm.
algorithm: Algorithm = Algorithm.SHIFTING_MATRYOSHKA,
):
"""Create a new instance of the power manager.

Expand All @@ -55,6 +53,7 @@ def __init__( # pylint: disable=too-many-arguments
power_distributing_results_receiver: The receiver for power distribution
results.
channel_registry: The channel registry.
algorithm: The power management algorithm to use.
component_category: The category of the component this power manager
instance is going to support.
component_type: The type of the component of the given category that this
Expand All @@ -64,7 +63,6 @@ def __init__( # pylint: disable=too-many-arguments
the inverter as a solar inverter or a battery inverter. This can be
`None` when the component category is enough to uniquely identify the
component.
algorithm: The power management algorithm to use.
"""
self._component_category = component_category
self._component_type = component_type
Expand Down
7 changes: 6 additions & 1 deletion src/frequenz/sdk/microgrid/_power_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@
Request,
Result,
)
from ._power_managing._base_classes import Algorithm

_logger = logging.getLogger(__name__)


class PowerWrapper:
"""Wrapper around the power managing and power distributing actors."""

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
channel_registry: ChannelRegistry,
*,
api_power_request_timeout: timedelta,
power_manager_algorithm: Algorithm,
component_category: ComponentCategory,
component_type: ComponentType | None = None,
):
Expand All @@ -44,6 +46,7 @@ def __init__(
channel_registry: A channel registry for use in the actors.
api_power_request_timeout: Timeout to use when making power requests to
the microgrid API.
power_manager_algorithm: The power management algorithm to use.
component_category: The category of the components that actors started by
this instance of the PowerWrapper will be responsible for.
component_type: The type of the component of the given category that this
Expand All @@ -56,6 +59,7 @@ def __init__(
"""
self._component_category = component_category
self._component_type = component_type
self._power_manager_algorithm = power_manager_algorithm
self._channel_registry = channel_registry
self._api_power_request_timeout = api_power_request_timeout

Expand Down Expand Up @@ -101,6 +105,7 @@ def _start_power_managing_actor(self) -> None:
self._power_managing_actor = _power_managing.PowerManagingActor(
component_category=self._component_category,
component_type=self._component_type,
algorithm=self._power_manager_algorithm,
proposals_receiver=self.proposal_channel.new_receiver(),
bounds_subscription_receiver=(
self.bounds_subscription_channel.new_receiver()
Expand Down
Loading