-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the consumption and production power formulas #697
Remove the consumption and production power formulas #697
Conversation
What do you mean? These formulas were introduced exactly for the reason that passive sign convention can be confusing. |
1b0d965
to
bc7630d
Compare
bc7630d
to
116ed3c
Compare
I will leave it for @cwasicki to approve, because he has open questions, but if we are doing this, we should also remove the corresponding formulas from the battery pool and the ev charger pool. |
Possible approaches for keeping the functionality aliveWe discussed that these formulas are useful but they might lead to subtle bugs when confusing the slightly different functions. 1chp_power("production") 2chp_power().production() and chp_power().consumption() |
Option 2 wins! BTW, Option 1.3 is Option 2, right? |
Yes, but option 1.3a only ;-) |
Back to draft as it needs the operators to get implemented. |
In order to simplify usability but don't loose functionality we decided to remove the consumption and production power formulas, i.e. the formulas that are having a production or consumption attached to their name, and replace them with operators that can be called on a formula engine. The consumption operator returns either the identity if the power value is positive or 0 and the production operator returns either the identity if the power value is negative or 0. As an example we can now create the following formula: ```python grid_consumption = logical_meter.grid_power().consumption().build() ``` This would return the consumption part of the grid_power stream. Removing the old consumption and production power formulas will happen in the follow up PR #697.
2a09dd6
to
af9152b
Compare
unblocked after #746 has been merged as a replacement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeeeiii! Removing code and special cases! 🎉
grid_consumption_recv = logical_meter.grid_consumption_power.new_receiver() | ||
grid_consumption_recv = logical_meter.grid_power.new_receiver() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are purposely not using consumption
(with the new operator) anymore here because this is already tested in the new operator tests, right?
These formulas are replaced by a combination of the corresponding passive sign convention formulas and the recently added consumption and production operators. Signed-off-by: Matthias Wende <matthias.wende@frequenz.com>
Signed-off-by: Matthias Wende <matthias.wende@frequenz.com>
Signed-off-by: Matthias Wende <matthias.wende@frequenz.com>
The formula Type has been used to distinguish between consumption, production or passive sign convention formulas. With the recent changes the sdk only provides passive sign convention formulas. Signed-off-by: Matthias Wende <matthias.wende@frequenz.com>
Signed-off-by: Matthias Wende <matthias.wende@frequenz.com>
af9152b
to
3dfdb3c
Compare
Some of the commits here are a great example of unhelpful commit title/messages. Please, write the why, not the what. It was very very obvious that it was removing something... no need to mention that even imo. |
The reason is written up in the first of the commit chain.
Next time I'll add a note to each of the involved commits ;). |
right, thus I said "some" ;) but I still had to do more investigation to be sure.
<3 |
Users must understand passive sign conventions to utilize these formulas effectively, and therefore they do not provide significant benefits.