hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
108 stars 13 forks source link

Insufficient accuracy for rapidly updating meters #6

Closed hif2k1 closed 2 years ago

hif2k1 commented 2 years ago

This is a great project by the way, but i had to make a few Tweaks the sensor/py to get things to register and they may relevant to the above.

My Import/Export is live (second-by-second) kWh and noticed that the battery would charge/discharge well when there was large amounts of Energy moving. But the slight overnight discharge or when the generation was near equal to consumption was not being registered.

I increased the Float for the round from 2 up to 10 digits and now the Battery discharges at a much better rate. image

_Originally posted by @NBS1997 in https://github.com/hif2k1/battery_sim/issues/3#issuecomment-951496075_

hif2k1 commented 2 years ago

Thanks for raising this point, I didn't realise meters updated that frequently! Having given it some thought it would be best not to round at all except when displaying the value. I have moved the rounding step so that it maintains the maximum accuracy in the internal variable tracking the energy, but when displaying the output it is still rounded so we don't have millions of decimal places. Just update your version of the extension. Let me know if this works. Thanks

NBS1997 commented 2 years ago

Happy to have helped. These latest changes are certainly looking like a perfect picture to gauge the true benefits of fitting a battery system. Overnight discharge with the 10 decimal places (Targeted in Image) worked well and the removal of the rounding will only provide a better result.

I will keep an eye out for others with Graphing/Visualization ideas.

Thank you again, This is by far one of the most valuable projects I have come across.

image

YMGV commented 2 years ago

Happy to have helped. These latest changes are certainly looking like a perfect picture to gauge the true benefits of fitting a battery system. Overnight discharge with the 10 decimal places (Targeted in Image) worked well and the removal of the rounding will only provide a better result.

I will keep an eye out for others with Graphing/Visualization ideas.

Thank you again, This is by far one of the most valuable projects I have come across.

image

How do you get the total kwh used since?

hif2k1 commented 2 years ago

Thanks, I have added the start date and daily, weekly, monthly counters to attributes in the latest release.

flooxo commented 1 year ago

i'm not sure if my problem is related to this. my simulated battery sensors only update every 60 seconds or more. my other sensors update every 10 seconds, causing more to be charged than is actually being produced. Is there a way to shorten the update interval? image So in this example, the battery charges with 10 kW because a minute ago that was the value of the solar production, but then it decreased, but the battery charging rate takes way longer to update it's value and therefore leading to inaccurate results

hif2k1 commented 1 year ago

I'm afraid this is a result of the way the battery works. Updates to the battery have to lag behind because the battery needs information on input and output which are not synchronised. It has to check how much energy is available and compare that with how fast it can charge and discharge. Secondly the battery updates based on energy (kWh) not power. Power sensors are therefore an estimate/average calculated retrospectively. The reason for all this is that the purpose of the battery is to give the most accurate idea possible idea of how much energy and money a battery can save the home owner over time so energy calculation is prioritised. Overall the energy in and out over the day should be completely accurate. The instantaneous power readings may vary and lag. They should average out by the end of the day to the right number, but they are secondary to energy readings. Hope that makes sense.