pub struct PvPool { /* private fields */ }Expand description
A pool of PV inverters in the microgrid.
Created with Microgrid::pv_pool, passing either an explicit set of PV
inverter component IDs or None to cover every PV inverter in the microgrid.
It exposes:
power— aFormulafor the pool’s aggregate active power;power_bounds— a stream of the pool’s aggregated active-power bounds;telemetry_snapshots— a stream ofPvPoolSnapshots partitioning the inverters into healthy and unhealthy sets.
The bounds and snapshot streams share a telemetry tracker that is started on first use and reused while it still has live receivers.
§Example
use chrono::TimeDelta;
use frequenz_microgrid::{LogicalMeterConfig, Microgrid};
let microgrid = Microgrid::try_new(
"grpc://localhost:50051",
LogicalMeterConfig::new(TimeDelta::try_seconds(1).unwrap()),
)
.await?;
// A pool over every PV inverter in the microgrid.
let mut pv_pool = microgrid.pv_pool(None)?;
// Subscribe to the pool's aggregated active-power bounds.
let mut bounds_rx = pv_pool.power_bounds();
while let Ok(bounds) = bounds_rx.recv().await {
println!("PV pool active-power bounds: {bounds:?}");
}Implementations§
Source§impl PvPool
impl PvPool
Sourcepub fn power(&mut self) -> Result<Formula<Power>, Error>
pub fn power(&mut self) -> Result<Formula<Power>, Error>
Returns a formula for the active power of the PV pool.
Sourcepub fn power_bounds(&mut self) -> Receiver<Vec<Bounds<Power>>>
pub fn power_bounds(&mut self) -> Receiver<Vec<Bounds<Power>>>
Returns a receiver for the aggregated active-power bounds of the pool, updated on each snapshot.
Reuses the running bounds tracker if one exists and still has active receivers; otherwise starts a new one (which also starts or reuses the underlying telemetry tracker).
Sourcepub fn telemetry_snapshots(&mut self) -> Receiver<PvPoolSnapshot>
pub fn telemetry_snapshots(&mut self) -> Receiver<PvPoolSnapshot>
Returns a receiver for a stream of PvPoolSnapshot values, each
reflecting the latest inverter telemetry partitioned into healthy and
unhealthy sets.
Reuses the running tracker if one exists and still has active receivers (including any held by a bounds tracker); otherwise starts a new one.
Auto Trait Implementations§
impl Freeze for PvPool
impl RefUnwindSafe for PvPool
impl Send for PvPool
impl Sync for PvPool
impl Unpin for PvPool
impl UnsafeUnpin for PvPool
impl UnwindSafe for PvPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request