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
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@

- The resampler's `max_age_in_intervals` has also become configurable, through `LogicalMeterConfig`.

- The `Quantity` trait now exposes numeric operations (`abs`, `floor`, `ceil`, `round`, `trunc`, `fract`, `is_nan`, `is_infinite`, `min`, `max`) as trait methods, so they can be used in generic code over any `Quantity` (including `f32` and all quantity types).

- The `Quantity` trait now provides associated `MIN` and `MAX` constants.

- New `BatteryPool` type (accessible via `Microgrid::battery_pool`) exposing:
- `power()` — a `Formula<Power>` for the pool's aggregated power.
- `power_bounds()` — a `broadcast::Receiver<Vec<Bounds<Power>>>` tracking the pool's power bounds.

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
34 changes: 34 additions & 0 deletions examples/bounds.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// License: MIT
// Copyright © 2026 Frequenz Energy-as-a-Service GmbH

use chrono::TimeDelta;
use frequenz_microgrid::Microgrid;
use frequenz_microgrid::{Error, LogicalMeterConfig};
use tracing_subscriber::{
EnvFilter,
fmt::{self},
prelude::*,
};

#[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::registry()
.with(EnvFilter::new("info,frequenz_microgrid=warn"))
.with(fmt::layer().with_file(true).with_line_number(true))
.init();

let microgrid = Microgrid::try_new(
"http://[::1]:8800",
LogicalMeterConfig::new(TimeDelta::try_seconds(1).unwrap()),
)
.await?;

let mut battery_pool = microgrid.battery_pool(None)?;
let mut bounds_rx = battery_pool.power_bounds();

while let Ok(bounds) = bounds_rx.recv().await {
tracing::info!("Battery pool active-power bounds: {:?}", bounds);
}

Ok(())
}
Loading
Loading