Skip to content

Releases: frequenz-floss/frequenz-sdk-python

v0.16.2

03 Jul 12:43
v0.16.2
3fa4c14
Compare
Choose a tag to compare

Release Notes

Bug Fixes

  • Ping pypantic version to < 2.

What's Changed

Full Changelog: v0.16.1...v0.16.2

v0.21.1

06 Jun 17:46
783874f
Compare
Choose a tag to compare

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:

    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 Samples 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 Samples 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

Full Changelog: v0.21.0...v0.21.1

v0.20.0

25 Apr 14:22
v0.20.0
7c7302d
Compare
Choose a tag to compare

Release Notes

Summary

The main feature in the release is the high-level interface. Now all base pipeline actors are created automatically when the SDK is initialized, and the wrapper classes can be accessed directly via frequenz.sdk.microgrid: logical_meter(), battery_pool() and ev_charger_pool().

Upgrading

  • Battery power is no longer available through the LogicalMeter, but through the BatteryPool (#338)

    battery_power_receiver = microgrid.battery_pool().power.new_receiver()
  • Formulas composition has changed (#327)

    • Receivers from formulas are no longer composable.
    • Formula composition is now done by composing FormulaEngine instances.
    • Automatic formulas from the logical meter and *pools, are now properties, and return FormulaEngine instances, which can be composed further, or can provide a receiver to fetch values.
    grid_power_receiver = microgrid.logical_meter().grid_power.new_receiver()
    
    self._inverter_power = (
        microgrid.logical_meter().pv_power
        + microgrid.battery_pool().power
    ).build("inverter_power")
    
    inverter_power_receiver = self._inverter_power.new_receiver()
  • Update BatteryStatus to mark battery with unknown capacity as not working (#263)

  • The channels dependency was updated to v0.14.0 (#292)

  • Some properties for PowerDistributingActor results were renamed to be more consistent between Success and PartialFailure:

    • The Success.used_batteries property was renamed to succeeded_batteries.
    • The PartialFailure.success_batteries property was renamed to succeeded_batteries.
    • The succeed_power property was renamed to succeeded_power for both Success and PartialFailure.
  • MovingWindow

    • The class is now publicly available in the frequenz.sdk.timeseries package.

    • Accept the size parameter as timedelta instead of int (#269).

      This change allows users to define the time span of the moving window more intuitively, representing the duration over which samples will be stored.

    • The input data will be resampled if a resampler_config is passed (#269).

      This allows controlling the granularity of the samples to be stored in the underlying buffer.

      Note that the parameter sampling_period has been renamed to input_sampling_period to better distinguish it from the sampling period parameter in the resampler_config.

    • Rename the constructor argument window_alignment to align_to and change the default to UNIX_EPOCH. This is to make it more consistent with the ResamplerConfig.

  • Resampler

    • The ResamplerConfig class is now publicly available in the frequenz.sdk.timeseries package.

    • The ResamplerConfig now takes the resampling period as a timedelta. The configuration was renamed from resampling_period_s to resampling_period accordingly.

    • The SourceProperties of the resampler now uses a timedelta for the input sampling period. The attribute was renamed from sampling_period_s to sampling_period accordingly.

    • The periods are now aligned to the UNIX_EPOCH by default.

      To use the old behaviour (aligning to the time the resampler was created), pass align_to=None to the ResamplerConfig.

New Features

  • The core data-pipeline actors are now created automatically (#270).

    This eliminates a lot of boiler plate code and makes it much simpler to deploy apps.

    For example:

    async def run():
        await microgrid.initialize(
            host=HOST, port=PORT, resampler_config=ResamplerConfig(resampling_period_s=1.0)
        )
        grid_power = microgrid.logical_meter().grid_power()
  • The Result class (and subclasses) for the PowerDistributingActor are now dataclasses, so logging them will produce a more detailed output.

  • The Resampler can now can align the resampling period to an arbitrary datetime.

    This can be configured via the new align_to option in the ResamplerConfig. By default the resampling period is aligned to the UNIX_EPOCH.

Bug Fixes

  • Change PowerDistributor to use all batteries when none are working (#258)

  • Update the ordered ring buffer used by the MovingWindow to fix the len() function so that it returns a value equal to or greater than zero, as expected (#274)

What's Changed

Read more

v0.19.0

15 Mar 15:55
v0.19.0
d5614a8
Compare
Choose a tag to compare

Release Notes

Summary

Upgrading

  • Remove _soc formula from the LogicalMeter. This feature has been moved to the BatteryPool.
  • Upgrade PowerDistributingActor to handle components with the NaN metrics (#247):
    • if power bounds are NaN, then it tries to replace them with corresponding power bounds from adjacent component. If these components are also NaN, then it ignores battery.
    • if other metrics metrics are NaN then it ignores battery.
  • BatteryStatus to track that a component stopped sending messages. If the battery or its adjacent inverter stopped sending messages, then the battery would be considered as not working. (#207)
  • PowerDistributing to send battery status to subscribed users (#205)
  • Rename microgrid.Microgrid to microgrid.ConnectionManager (#208)
  • Change few resampler logs from info to debug, because they were polluting startup logs (#238)

New Features

  • A new class SerializableRingbuffer is now available, extending the OrderedRingBuffer class with the ability to load & dump the data to disk.
  • Add the run(*actors) function for running and synchronizing the execution of actors. This new function simplifies the way actors are managed on the client side, allowing for a cleaner and more streamlined approach. Users/apps can now run actors simply by calling run(actor1, actor2, actor3...) without the need to manually call join() and deal with linting errors.
  • The datasourcing actor now automatically closes all sending channels when the input channel closes.
  • BatteryPool implementation for aggregating battery-inverter metrics into higher level metrics. (#205)
  • Add EV power and current streams to EVChargerPool (#201)

Bug Fixes

  • The resampler now correctly produces resampling windows of exact resampling period size, which only include samples emitted during the resampling window (see #170)

Removing

  • Deprecated code (#232):
    • frequenz.sdk._data_ingestion
    • frequenz.sdk._data_handling
  • The pandas(-stubs) and pytz dependencies are no longer needed (#261).

What's Changed

New Contributors

Full Changelog: v0.18.0...v0.19.0

v0.16.1

09 Mar 19:49
v0.16.1
4890ad3
Compare
Choose a tag to compare

Release Notes

Bug Fixes

  • Fix battery status logic: inverter that was discharging was considered as not working. So it was impossible to set any command until its state changed.

What's Changed

Full Changelog: v0.16.0...v0.16.1

v0.18.0

12 Feb 13:49
v0.18.0
b4e1efe
Compare
Choose a tag to compare

Release Notes

Summary

Upgrading

New Features

  • A new class OrderedRingBuffer is now available, providing a sorted ring buffer of datetime-value pairs with tracking of any values that have not yet been written.
  • Add logical meter formula for EV power.
  • A MovingWindow class has been added that consumes a data stream from a logical meter and updates an OrderedRingBuffer.
  • Add EVChargerPool implementation. It has only streaming state changes for ev chargers, now.
  • Add 3-phase current formulas: 3-phase grid_current and 3-phase ev_charger_current to the LogicalMeter.

Bug Fixes

  • Add COMPONENT_STATE_DISCHARGING as valid state for the inverter. DISCHARGING state was missing by mistake and this caused the power distributor to error out if the inverter is already discharging.

What's Changed

New Contributors

Full Changelog: v0.17.0...v0.18.0

v0.17.0

25 Jan 10:07
v0.17.0
fd68a06
Compare
Choose a tag to compare

Broken version

This version has a major bug in the power distributor, and it is recommended not to be used. Please upgrade to v0.18.0, there are no breaking changes so updating should be trivial.


Release Notes

Summary

Upgrading

  • The resampler now takes a name argument for add_timeseries(). This is only used for logging purposes.

  • The resampler and resampling actor now takes a ResamplerConfig object in the constructor instead of the individual values.

  • The resampler and resampling actor can emit errors or warnings if the buffer needed to resample is too big. If it is bigger than ResamplingConfig.max_buffer_len, the buffer will be truncated to that length, so the resampling can lose accuracy.

  • The ResamplingFunction now takes different arguments:

    • resampling_period_s was removed.
    • resampler_config is the configuration of the resampler calling the resampling function.
    • source_properties is the properties of the source being resampled.
  • Update frequenz-channel-python dependency to the latest release v0.12.0

  • The MetricFetcher now propagates NaN to handle None values when None are not treated from the stream as 0s. Then any FormulaStep can compute the results without checking for None on each value involved. However the final result is written as None rather than NaN/INF in the FormulaEngine.

New Features

  • The resampler and resampling actor can now take a few new options via the new ResamplerConfig object:

    • warn_buffer_len: The minimum length of the resampling buffer that will emit a warning.
    • max_buffer_len: The maximum length of the resampling buffer.
  • The resampler now infers the input sampling rate of sources and use a buffer size according to it.

    This information can be consulted via resampler.get_source_properties(source). The buffer size is now calculated so it can store all the needed samples requested via the combination of resampling_period_s, max_data_age_in_periods and the calculated input_sampling_period_s.

    If we are upsampling, one sample could be enough for back-filling, but we store max_data_age_in_periods using input_sampling_period_s as period, so the resampling functions can do more complex inter/extrapolation if they need to.

    If we are downsampling, we want a buffer that can hold max_data_age_in_periods * resampling_period_s seconds of data, and we have one sample every input_sampling_period_s, so we use a buffer length of: max_data_age_in_periods * resampling_period_s / input_sampling_period_s

Bug Fixes

  • Fixed logger creationg for some modules.

    Some modules didn't create the logger properly so there was no way to configure them using the standard logger configuration system. Because of this, it might have happened that some log messages were never showed, or some message that the user didn't want to get were emitted anyway.

  • When automatically generating formulas for calculating grid power, include measurements from EV chargers if any are directly connected to the grid.

What's Changed

New Contributors

Full Changelog: v0.16.0...v0.17.0

v0.16.0

05 Jan 15:19
v0.16.0
b148768
Compare
Choose a tag to compare

Release Notes

Summary

The Frequenz SDK now supports Python 3.11.

New Features

  • Upgrade PowerDistributingActor to track if batteries are working
    #117

  • Simplify Resampler by moving configuration to its own class ResamplerConfig
    #131

  • Add initial_buffer_len to the ResamplerConfig. This means that Resampler will store at least this number of arguments. Other Resampler behaviour won't change
    #131

  • Ability to compose formula outputs into higher-order formulas:
    #133

  • Add a formula generator for SoC in the LogicalMeter
    #137

Bug Fixes

  • Formulas with repeated operators like #1 - #2 - #3 were getting
    calculated incorrectly as #1 - (#2 - #3). This has been fixed in
    #141

  • Remove microgrid_api and component_graph arguments from PowerDistributingActor constructor
    #156

What's Changed

Full Changelog: v0.15.0...v0.16.0

v0.15.0

20 Dec 20:19
v0.15.0
fcfc8fc
Compare
Choose a tag to compare

Release Notes

Summary

Upgrading

  • Add fine-grained Result types for the PowerDistributingActor. Previously Result was one class with many fields. Now each type of the result has its own class that derives from Result parent class.

New Features

  • Add inverter type to the Component data. Inverter type tells what kind of inverter it is (Battery, Solar etc).
  • Add FormulaGenerator class for generating formulas from the component graph.
  • Add formulas for: grid_power, battery_power, PV power.

Bug Fixes

  • Fix ComponentMetricResamplingActor, to not subscribe twice to the same source.

What's Changed

New Contributors

Full Changelog: v0.14.0...v0.15.0

v0.14.0

09 Dec 15:30
v0.14.0
d04a7dd
Compare
Choose a tag to compare

Release Notes

Summary

This release improves the performance of the ComponentMetricsResamplingActor, and fixes a bug in the LogicalMeter that was causing it to crash.

Upgrading

  • frequenz.sdk.timseries:
    • The resample classes (GroupResampler, Resampler, ResamplingFunction) where removed and the replacement classes are hidden for now, as they are going through a rewrite.

Bug Fixes

  • The Resampling actor sends None values out when there is no data from a component. The logical meter used to raise an exception if it saw a None value from any of its streams. The logical meter is now able to handle None values by propagating the None values, or treating them as 0s.

What's Changed

Full Changelog: v0.13.0...v0.14.0