Sum: add Power and Energy distribution channels #2923
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a feature to closely analyze in real-time and for historic values, how the power and energy distributed between Grid, Production, Energy-Storage-System and Consumption, i.e. how much grid-buy energy was charged to the battery; how much grid-sell energy was discharged from a battery, etc.
This PR adds new Channels to the
_sum
component, that represent power and energy distribution:PRODUCTION_TO_CONSUMPTION_POWER
/PRODUCTION_TO_CONSUMPTION_ENERGY
PRODUCTION_TO_GRID_POWER
/PRODUCTION_TO_GRID_ENERGY
PRODUCTION_TO_ESS_POWER
/PRODUCTION_TO_ESS_ENERGY
GRID_TO_CONSUMPTION_POWER
/GRID_TO_CONSUMPTION_ENERGY
ESS_TO_CONSUMPTION_POWER
/ESS_TO_CONSUMPTION_ENERGY
GRID_TO_ESS_POWER
/GRID_TO_ESS_ENERGY
/ESS_TO_GRID_ENERGY
The unit test in
PowerDistributionTest.java
shows some example distributions:-1000 W
, Production2000 W
, ESS Discharge500 W
(Consumption is1500 W
in this case)1000 W
Production-to-Consumption1000 W
Production-to-Grid500 W
ESS-to-ConsumptionThese values will be useful in a UI visualization in future. The feature has been successfully tested locally on my private system.
One downside of the approach with
CalculateEnergyFromPower
is, that the resulting energy values might be slightly different to e.g.CONSUMPTION_ACTIVE_ENERGY
. It's difficult to overcome this - but in reality a fewWh
difference might not make a difference.