Skip to content

Commit ab9abf0

Browse files
committed
Add section about aggregated data to README
Signed-off-by: cwasicki <[email protected]>
1 parent d264e1f commit ab9abf0

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,29 @@ data = [
169169
]
170170
```
171171

172-
### Optionally convert the data to a pandas DataFrame
172+
## Usage of formulas
173+
174+
Formulas can be used to calculate a metric aggregated over multiple components or sensors.
175+
Note that this endpoint must be used with a `resampling_period`.
176+
Details on the formula syntax can be found [here](https://github.com/frequenz-floss/frequenz-microgrid-formula-engine-rs/tree/v0.x.x?tab=readme-ov-file#formula-syntax-overview).
177+
178+
```
179+
# Example formula to sum the values of two components.
180+
formula = "#1 + #2"
181+
data = [
182+
sample async for sample in
183+
client.receive_aggregated_data(
184+
microgrid_id=microgrid_id,
185+
metric=Metric.AC_ACTIVE_POWER,
186+
aggregation_formula=formula,
187+
start_time=datetime.fromisoformat("2024-05-01T00:00:00"),
188+
end_time=datetime.fromisoformat("2024-05-02T00:00:00"),
189+
resampling_period=resampling_period,
190+
)
191+
]
192+
```
193+
194+
## Optionally convert the data to a pandas DataFrame
173195

174196
For easier data manipulation and analysis, you can convert the collected data into a pandas DataFrame.
175197

0 commit comments

Comments
 (0)