Commit e582efa
authored
Add
This PR introduces a channel type called `FormulaChannel`, which derives
from `Broadcast` channels, and a receiver type for it called
`FormulaReceiver`, which derives from the Broadcast `Receiver`.
LogicalMeter now returns `FormulaReceiver`s instead of broadcast
`Receiver`s, and these `FormulaReceiver`s can be composed to create new
formula engines that operate on the outputs of other formula engines.
This would make it easier to build complex formulas that operate on
resampled component data streams. For example:
``` python
net_power_recv = (
(
logical_meter.grid_power()
- logical_meter.battery_power()
- logical_meter.pv_power()
)
.build("net_power")
.new_receiver()
)
```FormulaChannels for composing formula outputs (#133)File tree
14 files changed
+818
-93
lines changed- src/frequenz/sdk/timeseries/logical_meter
- _formula_generators
- tests
- microgrid
- timeseries
14 files changed
+818
-93
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
0 commit comments