Skip to content

Commit e582efa

Browse files
Add FormulaChannels for composing formula outputs (#133)
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() ) ```
2 parents 7a0361f + ff5adc6 commit e582efa

File tree

14 files changed

+818
-93
lines changed

14 files changed

+818
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pip-delete-this-directory.txt
3939

4040
# Unit test / coverage reports
4141
htmlcov/
42+
.htmlcov*/
4243
.tox/
4344
.nox/
4445
.coverage

RELEASE_NOTES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
- Ability to compose formula outputs into higher-order formulas:
14+
https://github.com/frequenz-floss/frequenz-sdk-python/pull/133
1415

1516
## Bug Fixes
1617

0 commit comments

Comments
 (0)