Recommended Riemann Sum Method #872
Replies: 3 comments 3 replies
-
@dsolva Thanks for your extensive writeup. I am in no means expert in how the riemann sensor exactly works and no mathematician guru ;-). Under the hood powercalc just creates the same riemann sensor which HA provides, so the logic is the same. Your explanation sounds logic to me to make |
Beta Was this translation helpful? Give feedback.
-
I think as well, that left ist most of the time the best choice in HA. Trepzoid is in my point of view only good, if you have a real function and not a sum of discrete data point as you have in HA. I have already changes global settings from Powercalc in the past to left. What I do not get as well, how my points are used by the Riemann sum within HA in cases with few points/state changes and esp. With a lot of data points/state changes. |
Beta Was this translation helpful? Give feedback.
-
Fyi I have changed default from trapezoid to left in version v0.26.0 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have been using this integration a lot and I love it. It's great and simple and I'm even looking to add some of the light models I have.
Up util yesterday I had been using this only for lights and fixed consumptions determined by the state of my devices. So far, all numbers made sense. However, I started measuring my fridge energy with a plug and noticed my mistake on using the "trapezoid" default method due to the spikes (as documentation mentions) and started thinking about using the "left" method always unless it’s a plug with an uncertain polling of data and some other cases mentioned below. I'm open to being corrected if i make any mistake on the interpretation of how data and calculations work.
My line of thought is the following: If I'm measuring my fridge and for any reason remains at 0 since 8am until 8pm when its starts consuming 500W. HA's recorder will have two registries: 0 at 8am and 500W at 8pm and nothing in the middle because the value of 0 did not change until 8pm. The trapezoid method would draw a huge rectangle starting at 8am and touch 500W at 8pm which involves a huge overestimation. This is why the ideal method would be the "left" so it only draws a rectangle starting at 8pm until it drops.
I saw the setting "scan_interval" defaults to 10 minutes and i guesses that the trapezoid wouldn't be drawn far beyond the last scan (<10min) but it does. A real numerical situation is this: My fridge stays at 0W (constantly) for 30 minutes exactly and spiked to 447W. I see my energy increase from 1.71kWH to 1.82kWh instantly when the spike occurs. Making numbers it makes sense: (447W*30min/60) equals a square of .22kWh and thus a triangle (due to trapezoid method) of .11kWh which is exactly the jump I see in energy.
Now, that happened if i use my own power value from a switch (polled 1 per second) and I don't see energy jumps when I turn my lights on after a long time. Why is this? How does the calculation between calculated power and plug power to determine energy defer?
Because of this I'm thinking that the left method should (almost) always be used for lights and devices whose state might remain constant for long periods of time (turning on a fan, etc.) specially if their state is always determined by HA and the recorder will register it instantly (there wouldn't be a need for averaging with trapezoid since the left would be spot on). For example, if I have adaptive lighting and HA is changing brightness then HA is registering it on time and left is perfect. On the other hand, if the state of a device is used to determine the power and this value had to be polled or called by HA then maybe the trapezoid is ok to average for the unknown between states. This until I understand how the trapezoid works on power values from this integration...
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions