I would like to hear your feedback on the following PR:
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:
The unit test in PowerDistributionTest.java shows some example distributions:
Grid Sell -1000 W, Production 2000 W, ESS Discharge 500 W (Consumption is 1500 W in this case)
1000 W Production-to-Consumption
1000 W Production-to-Grid
500 W ESS-to-Consumption
These 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 few Wh difference might not make a difference.
Great job on adding the power and energy distribution channels! The implementation is clear.
In my Opinion it is a great Contribution and Improvement !
If it is merged i would be able to test it locally aswell on my System
What would be a UI Widget which is suitable maybe on History Tab to show some new Values? Do you have something in your mind?
What do you think should we do with invalid data? For example negative Production and Consumption. Using them the way they are (so that the sum-equation fulfills) or setting them to zero (breaking the equation).
As weāre working on a new version of the channels and focusing on improving the user experience, I believe it would be better, especially for installers who may not be familiar with grid connections, to keep the values at 0 if any values are incorrect. What is your opinion on this approach?
Additionally, it might be helpful to display an error in the UI if the values are invalid, so that users can easily identify and correct any issues.
I havenāt had a detailed look at it, but how do you choose the six channel values for the powers? In the example you give,
1500W Production-to-Consumption,
500W Production-to-Grid and
500W ESS-to-Grid
would also be valid, wouldnāt it? And anything in between, like
1250W Production-to-Consumption,
750W Production-to-Grid,
250W ESS-to-Consumption and
250W ESS-to-Grid.
Mathematically speaking, you have a linear equation system with 6 variables (Production-to-Consumption etc.) and only 3 equations (Production = Production-to-Consumption + Production-to-ESS + Production-to-Grid etc.), leaving a 3-dimensional solution space, if Iām not mistaken. Okay, you additionally say that most powers are non-negative, which solves it in some cases, but still, how do you determine which of the many solutions you take?
Showing a Warning is a good idea, but we need to consider corner cases as well. E.g. in my system the grid meter measures electric vehicle charging power before I get the value from the charging station. This leads to a short period of negative consumption as well.
Solution #2 (equally possible within the linear equation system)
Grid-to-ESS: 500 W (might be illegal depending on the legislation)
Production-to-Consumption: 1500 W
Grid-to-Consumption: 500 W
In the implementation I chose to distribute ESS first, to avoid these legislation pitfalls, that also exist in the ESS-To-Grid direction.
But I am very open to discussion. Maybe it helps if we add more examples in the PowerDistributionTest.java - including some that break other constraints (like Consumption and Production being negative)
I think the better approach would be to show a warning when invalid data is detected without altering the core calculations. This would allow users to identify and correct any discrepancies without affecting the equation.
Maybe this could be handled with a delay easily ? As if the Meter is incorrect it is negative most of the Times and not only a short Period
Unfortunately this is not only a corner case. The idm heatpump measures its own consumption only approx. every 30s. Same for the dachs CHP and there are other components. Therefore we often have short periods of negative consumption.
ā¦
I donāt like the idea of setting invalid data to zero. Having negative data has helped us identify other system problems in a lot of systems. If really needed, I prefer to catch this kind of problem within the component that causes it.
Unfortunately we still do not have a way to handle this appropriately. E.g. the idm heatpump always breaks the consumption within the UI. That is something we simply live with at the moment:
First of, I like the idea of breaking down the power and energy values within PR #2923.
Regarding
People buy a battery to store the energy from the PV!
Therefore I think the ESS first assumption is pragmatic and comes closest to reality of most people.