Frequenz-sdk

Latest version: v0.25.2

Safety actively analyzes 685670 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 8

0.25.0

Frequenz Python SDK Release Notes

Summary

This release replaces the `actor` decorator with a new `Actor` class.

Upgrading


- The `frequenz.sdk.power` package contained the power distribution algorithm, which is for internal use in the sdk, and is no longer part of the public API.

- `PowerDistributingActor`'s result type `OutOfBound` has been renamed to `OutOfBounds`, and its member variable `bound` has been renamed to `bounds`.

- The `actor` decorator was replaced by the new `Actor` class. The main differences between the new class and the old decorator are:

* It doesn't start automatically, `start()` needs to be called to start an actor (using the `frequenz.sdk.actor.run()` function is recommended).
* The method to implement the main logic was renamed from `run()` to `_run()`, as it is not intended to be run externally.
* Actors can have an optional `name` (useful for debugging/logging purposes).
* The actor will only be restarted if an unhandled `Exception` is raised by `_run()`. It will not be restarted if the `_run()` method finishes normally. If an unhandled `BaseException` is raised instead, it will be re-raised. For normal cancellation the `_run()` method should handle `asyncio.CancelledError` if the cancellation shouldn't be propagated (this is the same as with the decorator).
* The `_stop()` method is public (`stop()`) and will `cancel()` and `await` for the task to finish, catching the `asyncio.CancelledError`.
* The `join()` method is renamed to `wait()`, but they can also be awaited directly ( `await actor`).
* For deterministic cleanup, actors can now be used as `async` context managers.

Most actors can be migrated following these steps:

1. Remove the decorator
2. Add `Actor` as a base class
3. Rename `run()` to `_run()`
4. Forward the `name` argument (optional but recommended)

For example, this old actor:

python
from frequenz.sdk.actor import actor

actor
class TheActor:
def __init__(self, actor_args) -> None:
init code

def run(self) -> None:
run code


Can be migrated as:

python
import asyncio
from frequenz.sdk.actor import Actor

class TheActor(Actor):
def __init__(self, actor_args,
*,
name: str | None = None,
) -> None:
super().__init__(name=name)
init code

def _run(self) -> None:
run code


Then you can instantiate all your actors first and then run them using:

python
from frequenz.sdk.actor import run
Init code
actor = TheActor()
other_actor = OtherActor()
more setup
await run(actor, other_actor) Start and await for all the actors


- The `MovingWindow` is now a `BackgroundService`, so it needs to be started manually with `window.start()`. It is recommended to use it as an `async` context manager if possible though:

python
async with MovingWindow(...) as window:
The moving windows is started here
use(window)
The moving window is stopped here


- The base actors (`ConfigManagingActor`, `ComponentMetricsResamplingActor`, `DataSourcingActor`, `PowerDistributingActor`) now inherit from the new `Actor` class, if you are using them directly, you need to start them manually with `actor.start()` and you might need to do some other adjustments.

- The `BatteryPool.power_distribution_results` method has been enhanced to provide power distribution results in the form of `Power` objects, replacing the previous use of `float` values.

- In the `Request` class:
* The attribute `request_timeout_sec` has been updated and is now named `request_timeout` and it is represented by a `timedelta` object rather than a `float`.
* The attribute `power` is now presented as a `Power` object, as opposed to a `float`.

- Within the `EVChargerPool.set_bounds` method, the parameter `max_amps` has been redefined as `max_current`, and it is now represented using a `Current` object instead of a `float`.

- The argument `nones_are_zeros` in `FormulaEngine` and related classes and methods is now a keyword-only argument.

New Features

- Added `DFS` to the component graph

- `BackgroundService`: This new abstract base class can be used to write other classes that runs one or more tasks in the background. It provides a consistent API to start and stop these services and also takes care of the handling of the background tasks. It can also work as an `async` context manager, giving the service a deterministic lifetime and guaranteed cleanup.

All classes spawning tasks that are expected to run for an indeterminate amount of time are likely good candidates to use this as a base class.

- `Actor`: This new class inherits from `BackgroundService` and it replaces the `actor` decorator.

- Newly added `min` and `max` functions for Formulas. They can be used as follows:

python
formula1.min(formula2)


Bug Fixes

- Fixes a bug in the ring buffer updating the end timestamp of gaps when they are outdated.

- Properly handles PV configurations with no or only some meters before the PV component.

So far we only had configurations like this: `Meter -> Inverter -> PV`. However the scenario with `Inverter -> PV` is also possible and now handled correctly.

- Fix `consumer_power()` not working certain configurations.

In microgrids without consumers and no main meter, the formula would never return any values.

- Fix `pv_power` not working in setups with 2 grid meters by using a new reliable function to search for components in the components graph

- Fix `consumer_power` and `producer_power` similar to `pv_power`

- Zero value requests received by the `PowerDistributingActor` will now always be accepted, even when there are non-zero exclusion bounds.

- Hold on to a reference to all streaming tasks in the microgrid API client, so they don't get garbage collected.


What's Changed
* Fix ring buffer gap cleanup code by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/578
* Amend deficit calculation in the power distributor by daniel-zullo-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/577
* Clear release notes by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/574
* Bump types-protobuf from 4.23.0.3 to 4.24.0.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/576
* Bump mypy from 1.4.1 to 1.5.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/580
* Support PV configurations with no or only some meters by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/584
* Bump mypy from 1.5.0 to 1.5.1 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/585
* Bump types-protobuf from 4.24.0.0 to 4.24.0.1 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/581
* Bump time-machine from 2.11.0 to 2.12.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/582
* Some very small fixes by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/590
* Bump mkdocs-material from 9.1.21 to 9.2.1 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/592
* Fix `consumer_power()` not working certain configurations. by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/589
* Add depth first search for components by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/595
* [ci] Add test for installation in multiple architectures by tiyash-basu-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/597
* Improve formula generators by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/599
* Forward zero power requests always to the microgrid API by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/591
* Implement BackgroundService and new Actor class by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/564
* Replace absolute imports with relative imports by tiyash-basu-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/604
* Drop example to private PowerDistributor API by christianparpart in https://github.com/frequenz-floss/frequenz-sdk-python/pull/605
* Bump mkdocs-material from 9.2.1 to 9.2.5 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/608
* Improve consumer power formula by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/609
* Update high-level public interfaces to concrete types by daniel-zullo-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/607
* Make nones_are_zeros a keyword-only parameter by daniel-zullo-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/611
* Improve error message for incorrect component graphs by tiyash-basu-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/602
* DataPipeline: Fix resampling/ds/power actors not started by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/603
* Bump polars from 0.18.13 to 0.18.15 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/583
* Add module to easily create component graphs by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/606
* Upgrade to repo-config v0.5.2 by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/587
* Store references to streaming tasks by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/615
* Add min and max operations to formula engine by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/561

New Contributors
* tiyash-basu-frequenz made their first contribution in https://github.com/frequenz-floss/frequenz-sdk-python/pull/597

**Full Changelog**: https://github.com/frequenz-floss/frequenz-sdk-python/compare/v0.24.0...v0.25.0

0.24.0

Frequenz Python SDK Release Notes

Summary

Now the microgrid API v0.15.x is being used. The SDK can only connect to microgrids using this version of the API. Inclusion and exclusion bounds in the new API are now handled by the power distributor and battery pool.

Upgrading

- Upgrade to microgrid API v0.15.1. If you're using any of the lower level microgrid interfaces, you will need to upgrade your code.
- The argument `conf_file` of the `ConfigManagingActor` constructor was renamed to `config_path`.

- The `BatteryPool.power_bounds` method now streams inclusion/exclusion bounds. The bounds are now represented by `Power` objects and not `float`s.

New Features

- The `ConfigManagingActor` constructor now can accept a `pathlib.Path` as `config_path` too (before it accepted only a `str`).

- The `PowerDistributingActor` now considers exclusion bounds, when finding an optimal distribution for power between batteries.


What's Changed
* Use `Timer.periodic` in the `Resampler` by jh2007github in https://github.com/frequenz-floss/frequenz-sdk-python/pull/520
* Allow running release notes check in merge queues by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/566
* Clear release notes by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/560
* Update `frequenz-api-microgrid` to v0.15.1 by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/416
* Improvements to the `ConfigManagingActor` by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/565
* Bump brettcannon/check-for-changed-files from 294a99714e0d350b5083472a293d41bc91804e68 to 4170644959a21843b31f1181f2a1761d65ef4791 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/567
* Bump types-protobuf from 4.23.0.2 to 4.23.0.3 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/568
* Bump polars from 0.18.11 to 0.18.12 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/569
* Stream exclusion bounds from the battery pool by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/537
* Bump polars from 0.18.12 to 0.18.13 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/570
* Add docs cross-linking to APIs by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/571
* Support exclusion bounds in power distributor by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/562
* Update release notes for the v0.24.0 release by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/573


**Full Changelog**: https://github.com/frequenz-floss/frequenz-sdk-python/compare/v0.23.0...v0.24.0

0.23.0

Frequenz Python SDK Release Notes

Summary

This release ships many small improvements and bug fixes to `Quantity`s. It also depends on [channels](https://github.com/frequenz-floss/frequenz-channels-python/) v0.16.0, so users must update the dependency too.

Upgrading

- `Channels` has been upgraded to version 0.16.0, for information on how to upgrade please read the [channels v0.16.0 release notes](visit https://github.com/frequenz-floss/frequenz-channels-python/releases/tag/v0.16.0).
- `Quantity` objects are no longer hashable. This is because of the pitfalls of hashing `float` values.

New Features

- Quantities

* Add support for the unary negative operator (negation of a quantity).
* Add `abs()`.
* Add a `isclose()` method on quantities to compare them to other values of the same type. Because `Quantity` types are just wrappers around `float`s, direct comparison might not always be desirable.
* Add `zero()` constructor (which returns a singleton) to easily get a zero value.
* Add multiplication by `Percentage` types.
* Add a new quantity class `Frequency` for frequency values.
* Add a new quantity class `Temperature` for temperature values.

- `FormulaEngine` arithmetics now supports scalar multiplication with `float`s and addition with `Quantity`s.
- Add a new `temperature` method for streaming average temperature values for the battery pool.

Bug Fixes

- Fix formatting issue for `Quantity` objects with zero values.
- Fix formatting issue for `Quantity` when the base value fulfills `math.isinf()` or `math.isnan()`.
- Fix clamping to 100% for the battery pool SoC scaling calculation.
- Fix indexing for empty `MovingWindow`s (now it properly raises an `IndexError`).


What's Changed
* Bump polars from 0.18.4 to 0.18.5 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/486
* Add installation instructions by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/487
* Updated float("NaN") to math.nan by jh2007github in https://github.com/frequenz-floss/frequenz-sdk-python/pull/484
* Bump polars from 0.18.5 to 0.18.6 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/491
* Add methods for sending individual mock component data messages in tests by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/483
* Clear release notes by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/493
* Migrate to repo-config by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/488
* Bump actions/labeler from 4.2.0 to 4.3.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/496
* Bump time-machine from 2.10.0 to 2.11.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/497
* Bump black from 23.3.0 to 23.7.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/498
* Fix formatting bug for zero value Quantities by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/505
* Add quantity class `Frequency` by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/506
* Add documentation on how to receive power request results by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/507
* Bump pytest-asyncio from 0.21.0 to 0.21.1 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/510
* Bump polars from 0.18.6 to 0.18.7 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/509
* Update to channels 0.16.x by jh2007github in https://github.com/frequenz-floss/frequenz-sdk-python/pull/490
* Bump sybil from 5.0.2 to 5.0.3 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/513
* Support negation of quantities by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/515
* Support float.inf and float.nan in quantities by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/514
* Add from_receiver method to FormulaEngine by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/489
* Add abs() support for quantities by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/516
* Bump mkdocs-material from 9.1.18 to 9.1.19 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/521
* Bump polars from 0.18.7 to 0.18.8 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/526
* Add capability to multiply quantities with percentage by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/512
* Implement dunder iadd, isub, imul methods for Quantity by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/527
* Bump types-protobuf from 4.23.0.1 to 4.23.0.2 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/528
* Add constant to FormulaEngine arithmetic by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/525
* Quantity improvements by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/533
* Add BatteryStatus tests to ensure it recovers automatically after issues by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/522
* Nice error message for empty buffer and new test case by jh2007github in https://github.com/frequenz-floss/frequenz-sdk-python/pull/517
* Bump pylint from 2.17.4 to 2.17.5 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/539
* Update to repo-config v0.4.0 by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/540
* Bump mkdocs-material from 9.1.19 to 9.1.21 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/549
* Bump polars from 0.18.8 to 0.18.9 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/553
* Bump polars from 0.18.9 to 0.18.11 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/554
* Add zero() constructor for Quantities by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/535
* Temperature streaming from the BatteryPool by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/552
* Add BatteryPool.temperature and quantity Temperature by christianparpart in https://github.com/frequenz-floss/frequenz-sdk-python/pull/485
* Update battery pool SoC calculation by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/557
* Add CI check that RELEASE_NOTES.md was updated by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/544
* Prepare for release v0.23.0 by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/559

New Contributors
* jh2007github made their first contribution in https://github.com/frequenz-floss/frequenz-sdk-python/pull/484

**Full Changelog**: https://github.com/frequenz-floss/frequenz-sdk-python/compare/v0.22.0...v0.23.0

0.22.1

Release Notes

Bug Fixes

- Fix formatting issue for `Quantity` objects with zero values.


What's Changed
* Fix formatting bug for zero values by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/503


**Full Changelog**: https://github.com/frequenz-floss/frequenz-sdk-python/compare/v0.22.0...v0.22.1

0.22.0

Release Notes

Summary

New `Quantity` types! These types can have units (power, current, voltage, etc.) and are *type- and unit-safe* in the sense that users can't accidentally sum a power with a voltage, or a power in kW with a power in W.

Upgrading

- `Sample` objects no longer hold `float`s, but rather `Quantity` or one of its subclasses, like `Power`, `Current`, `Energy`, etc. based on the type of values being streamed.

python
sample: Sample[Power] = await battery_pool.power.new_receiver().receive()
power: float = sample.value.as_watts()


- `BatteryPool.soc` now streams values of type `Sample[Quantity]`, and `BatteryPool.capacity` now streams values of type `Sample[Energy]`.

python
battery_pool = microgrid.battery_pool()
soc_sample: Sample[Quantity] = await battery_pool.soc.new_receiver().receive()
soc: float = soc_sample.value.base_value

capacity_sample: Sample[Energy] = await battery_pool.capacity.new_receiver().receive()
capacity: float = soc_sample.value.as_watt_hours()


- `MicrogridApiClient.set_power` no longer returns a `protobuf.Empty` result, but a `None`. This won't affect you unless you are using the low level APIs of the SDK.

New Features

- The logical meter has a new method that returns producer power, that is the sum of all energy producers.

- `Quantity` types (`Power`, `Current`, `Energy`, `Voltage`) for providing type- and unit-safety when dealing with physical quantities.

Bug Fixes

- Two bugs in the ring buffer which is used by the `MovingWindow` class were fixed:
- `len(buffer)` was not considering potentially existing gaps (areas without elements) in the buffer.
- A off-by-one error in the gap calculation logic was fixed that recorded a gap when there was none if an element with a future timestamp was added that would create a gap of exactly 1.

- A formula engine lifetime issue, when creating higher order formula receivers without holding on to a reference to the engine, was fixed.


What's Changed
* Clear release notes by leandro-lucarella-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/423
* Bump polars from 0.18.0 to 0.18.2 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/432
* Bump pytest from 7.3.1 to 7.3.2 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/431
* Add more unit tests for PeriodicFeatureExtractor by cwasicki in https://github.com/frequenz-floss/frequenz-sdk-python/pull/375
* Enhance battery pool documentation by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/425
* Fix seconds in MovingWindow doc example by cwasicki in https://github.com/frequenz-floss/frequenz-sdk-python/pull/437
* Add `--diff` as a default argument for `isort` by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/438
* Bump mkdocs-material from 9.1.15 to 9.1.16 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/439
* Add producer power formula by matthias-wende-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/444
* Bump polars from 0.18.2 to 0.18.3 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/448
* Bump pytest-mock from 3.10.0 to 3.11.1 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/440
* Bump time-machine from 2.9.0 to 2.10.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/447
* Add Quantity types and update formulas to produce typed Samples by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/422
* Bump mypy from 1.3.0 to 1.4.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/458
* Remove example programs for internal components by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/453
* Expose only usable SoC and Capacity through the BatteryPool by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/459
* Bump polars from 0.18.3 to 0.18.4 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/464
* Bump pytest from 7.3.2 to 7.4.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/463
* Bump mkdocs-material from 9.1.16 to 9.1.17 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/461
* Bump mypy from 1.4.0 to 1.4.1 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/462
* Fix ring buffer len by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/445
* Disable default constructor in specialized `Quantity` types by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/465
* A `Percentage` quantity by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/470
* Bump actions/labeler from 4.0.4 to 4.2.0 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/471
* Fix broken reference to `ResamplingFunction` in documentation by Marenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/472
* Limit pydantic to v1 by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/474
* Remove unused `JUNCTION` and `LOAD` component categories by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/467
* Fix release notes and add a summary by llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/476
* Bump mkdocs-material from 9.1.17 to 9.1.18 by dependabot in https://github.com/frequenz-floss/frequenz-sdk-python/pull/481
* Store a reference to the engine in receiver objects by shsms in https://github.com/frequenz-floss/frequenz-sdk-python/pull/478

New Contributors
* cwasicki made their first contribution in https://github.com/frequenz-floss/frequenz-sdk-python/pull/375
* llucax made their first contribution in https://github.com/frequenz-floss/frequenz-sdk-python/pull/476

**Full Changelog**: https://github.com/frequenz-floss/frequenz-sdk-python/compare/v0.21.1...v0.22.0

0.21.1

Release Notes

Note

Please note that even when there is a v0.21.0 tag in the project's repository, there is no public release for v0.21.0 in GitHub or pypi.

This is due to a bug in the automation to create releases for new tags in v0.21.0. This release is exactly the same as v0.21.0 but with that bug fixed, so the full changes introduced by v0.21.0 are included here.

Summary

This release mainly introduces the new `PeriodicFeatureExtractor`, the control interface to the `BatteryPool`, and a new naming scheme for retrieving `LogicalMeter` and `BatteryPool` metrics. It also drops support for Python versions older than 3.11.

Upgrading

* Now Python 3.11 is the minimum supported version. All users must upgrade to Python 3.11 (including virtual environments used for development).

* `BatteryPool` metric streaming interfaces have changed for `soc`, `capacity` and `power_bounds`:

python
soc_rx = battery_pool.soc() old

soc_rx = battery_pool.soc.new_receiver() new


* Formulas now follow the new naming scheme.

- `BatteryPool.{power, production_power, consumption_power}`
- `EVChargerPool.{power, production_power, consumption_power}`
- `LogicalMeter`:
- `consumer_power`
- `grid_power`
- `grid_production_power`
- `grid_consumption_power`
- `chp_power`
- `chp_production_power`
- `chp_consumption_power`

* A power request can now be forced by setting the `include_broken_batteries` attribute. This is especially helpful as a safety measure when components appear to be failing, such as when battery metrics are unavailable. Note that applications previously relying on automatic fallback to all batteries when none of them was working will now require the `include_broken_batteries` attribute to be explicitly set in the request.

* Now `float` is used everywhere for representing power (before power metrics were `float` but setting power was done using `int`).
* `frequenz.sdk.actor.power_distributing`: the `power` attribute of the `Request` class has been updated from `int` to a `float`.
* `frequenz.sdk.microgrid`: the `set_power()` method of both the `MicrogridApiClient` and `MicrogridGrpcClient` classes now expect a `float` value for the `power_w` parameter instead of `int`.

* The `LogicalMeter` no longer takes a `component_graph` parameter.

* Now `frequenz.sdk.timeseries.Sample` uses a more sensible comparison. Before this release `Sample`s were compared only based on the `timestamp`. This was due to a limitation in Python versions earlier than 3.10. Now that the minimum supported version is 3.11 this hack is not needed anymore and `Sample`s are compared using both `timestamp` and `value` as most people probably expects.

* The dependency to `sympy` was unused and thus removed from the SDK. If you used it indirectly without declaring the dependency in your project you should do it now.

New Features

* The `MovingWindow` has new public methods that return the oldest and newest timestamp of all stored samples.

* The `PeriodicFeatureExtractor` has been added.

This is a tool to create certain profiles out of periodic reoccurring windows inside a `MovingWindow`.

As an example one can create a daily profile of specific weekdays which will be returned as numpy arrays.

* The `BatteryPool` can now be used to control the batteries in it via the new methods `charge()`, `discharge()`, and `set_power()`.

Bug Fixes

* Fixed many examples in the documentation.


What's Changed
* ci: Fix building of tags by leandro-lucarella-frequenz in https://github.com/frequenz-floss/frequenz-sdk-python/pull/426


**Full Changelog**: https://github.com/frequenz-floss/frequenz-sdk-python/compare/v0.21.0...v0.21.1

Page 5 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.