Skip to content

Commit 17dd927

Browse files
Clarify documentation of BatteryPool soc and capacity methods
SoC and capacity from batteries whose inverters are out of order are not usable, and therefore not considered. Fixes #543 Signed-off-by: Stefan Brus <[email protected]>
1 parent a8f3d62 commit 17dd927

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/frequenz/sdk/timeseries/battery_pool/battery_pool.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,11 @@ def consumption_power(self) -> FormulaEngine[Power]:
345345
def soc(self) -> MetricAggregator[Sample[Percentage]]:
346346
"""Fetch the normalized average weighted-by-capacity SoC values for the pool.
347347
348-
The values are normalized to the 0-100% range and clamped if the SoC is out of
349-
bounds.
348+
The SoC values are normalized to the 0-100% range and clamped if they are out
349+
of bounds. Only values from working batteries with operational inverters are
350+
considered in the calculation.
350351
351-
Average soc is calculated with the formula:
352+
Average SoC is calculated using the formula:
352353
```
353354
working_batteries: Set[BatteryData] # working batteries from the battery pool
354355
@@ -364,15 +365,16 @@ def soc(self) -> MetricAggregator[Sample[Percentage]]:
364365
average_soc = used_capacity/total_capacity
365366
```
366367
367-
`None` values will be sent if there are no components to calculate the metric
368-
with.
368+
`None` values will be sent if there are no working batteries with operational
369+
inverters to calculate the metric with.
369370
370371
A receiver from the MetricAggregator can be obtained by calling the
371372
`new_receiver` method.
372373
373374
Returns:
374-
A MetricAggregator that will calculate and stream the aggregate soc of
375-
all batteries in the pool.
375+
A MetricAggregator that will calculate and stream the aggregate SoC of all
376+
batteries in the pool, considering only working batteries with
377+
operational inverters.
376378
"""
377379
method_name = SendOnUpdate.name() + "_" + SoCCalculator.name()
378380

@@ -406,7 +408,10 @@ def temperature(self) -> MetricAggregator[Sample[Temperature]]:
406408

407409
@property
408410
def capacity(self) -> MetricAggregator[Sample[Energy]]:
409-
"""Get receiver to receive new capacity metrics when they change.
411+
"""Get a receiver to receive new capacity metrics when they change.
412+
413+
The reported capacity values consider only working batteries with operational
414+
inverters.
410415
411416
Calculated with the formula:
412417
```
@@ -417,14 +422,16 @@ def capacity(self) -> MetricAggregator[Sample[Energy]]:
417422
)
418423
```
419424
420-
None will be send if there is no component to calculate metrics.
425+
`None` will be sent if there are no working batteries with operational
426+
inverters to calculate metrics.
421427
422428
A receiver from the MetricAggregator can be obtained by calling the
423429
`new_receiver` method.
424430
425431
Returns:
426432
A MetricAggregator that will calculate and stream the capacity of all
427-
batteries in the pool.
433+
batteries in the pool, considering only working batteries with
434+
operational inverters.
428435
"""
429436
method_name = SendOnUpdate.name() + "_" + CapacityCalculator.name()
430437

0 commit comments

Comments
 (0)